Backdrop Path + Cybersteel (#23)
Co-authored-by: Zachary Levy <zachary@sunforge.is> Reviewed-on: #23
This commit was merged in pull request #23.
This commit is contained in:
+12
-13
@@ -14,8 +14,8 @@ Texture_Kind :: enum u8 {
|
||||
}
|
||||
|
||||
Sampler_Preset :: enum u8 {
|
||||
Nearest_Clamp,
|
||||
Linear_Clamp,
|
||||
Nearest_Clamp,
|
||||
Nearest_Repeat,
|
||||
Linear_Repeat,
|
||||
}
|
||||
@@ -41,8 +41,7 @@ Texture_Desc :: struct {
|
||||
kind: Texture_Kind,
|
||||
}
|
||||
|
||||
// Internal slot — not exported.
|
||||
@(private)
|
||||
//INTERNAL
|
||||
Texture_Slot :: struct {
|
||||
gpu_texture: ^sdl.GPUTexture,
|
||||
desc: Texture_Desc,
|
||||
@@ -319,8 +318,8 @@ texture_kind :: proc(id: Texture_Id) -> Texture_Kind {
|
||||
return GLOB.texture_slots[u32(id)].desc.kind
|
||||
}
|
||||
|
||||
// Internal: get the raw GPU texture pointer for binding during draw.
|
||||
@(private)
|
||||
// Get the raw GPU texture pointer for binding during draw.
|
||||
//INTERNAL
|
||||
texture_gpu_handle :: proc(id: Texture_Id) -> ^sdl.GPUTexture {
|
||||
if id == INVALID_TEXTURE do return nil
|
||||
idx := u32(id)
|
||||
@@ -328,8 +327,8 @@ texture_gpu_handle :: proc(id: Texture_Id) -> ^sdl.GPUTexture {
|
||||
return GLOB.texture_slots[idx].gpu_texture
|
||||
}
|
||||
|
||||
// Deferred release (called from draw.end / clear_global)
|
||||
@(private)
|
||||
// Deferred release (called from end / clear_global).
|
||||
//INTERNAL
|
||||
process_pending_texture_releases :: proc() {
|
||||
device := GLOB.device
|
||||
for id in GLOB.pending_texture_releases {
|
||||
@@ -346,7 +345,7 @@ process_pending_texture_releases :: proc() {
|
||||
clear(&GLOB.pending_texture_releases)
|
||||
}
|
||||
|
||||
@(private)
|
||||
//INTERNAL
|
||||
get_sampler :: proc(preset: Sampler_Preset) -> ^sdl.GPUSampler {
|
||||
idx := int(preset)
|
||||
if GLOB.samplers[idx] != nil do return GLOB.samplers[idx]
|
||||
@@ -379,15 +378,15 @@ get_sampler :: proc(preset: Sampler_Preset) -> ^sdl.GPUSampler {
|
||||
)
|
||||
if sampler == nil {
|
||||
log.errorf("Failed to create sampler preset %v: %s", preset, sdl.GetError())
|
||||
return GLOB.pipeline_2d_base.sampler // fallback to existing default sampler
|
||||
return GLOB.core_2d.sampler // fallback to existing default sampler
|
||||
}
|
||||
|
||||
GLOB.samplers[idx] = sampler
|
||||
return sampler
|
||||
}
|
||||
|
||||
// Internal: destroy all sampler pool entries. Called from draw.destroy().
|
||||
@(private)
|
||||
// Destroy all sampler pool entries. Called from destroy().
|
||||
//INTERNAL
|
||||
destroy_sampler_pool :: proc() {
|
||||
device := GLOB.device
|
||||
for &s in GLOB.samplers {
|
||||
@@ -398,8 +397,8 @@ destroy_sampler_pool :: proc() {
|
||||
}
|
||||
}
|
||||
|
||||
// Internal: destroy all registered textures. Called from draw.destroy().
|
||||
@(private)
|
||||
// Destroy all registered textures. Called from destroy().
|
||||
//INTERNAL
|
||||
destroy_all_textures :: proc() {
|
||||
device := GLOB.device
|
||||
for &slot in GLOB.texture_slots {
|
||||
|
||||
Reference in New Issue
Block a user