From cd83f2fd920046201728bbdd229d5495c011c982 Mon Sep 17 00:00:00 2001 From: Cameron Reikes Date: Mon, 21 Aug 2023 19:58:03 -0700 Subject: [PATCH] Correct depth format on desktop and web --- main.c | 6 +++--- thirdparty/sokol_app.h | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 2f625ee..7d3740c 100644 --- a/main.c +++ b/main.c @@ -2743,7 +2743,7 @@ void create_screenspace_gfx_state() state.threedee_pass_image = sg_make_image(&desc); desc.label = "threedee-pass-depth-render-target"; - desc.pixel_format = SG_PIXELFORMAT_DEPTH; + desc.pixel_format = sapp_depth_format(); state.threedee_pass_depth_image = sg_make_image(&desc); state.threedee_pass = sg_make_pass(&(sg_pass_desc){ @@ -3307,7 +3307,7 @@ void init(void) [ATTR_threedee_vs_uv_in].format = SG_VERTEXFORMAT_FLOAT2, }}, .depth = { - .pixel_format = SG_PIXELFORMAT_DEPTH, + .pixel_format = sapp_depth_format(), .compare = SG_COMPAREFUNC_LESS_EQUAL, .write_enabled = true, }, @@ -3332,7 +3332,7 @@ void init(void) { .shader = shd, .depth = { - .pixel_format = SG_PIXELFORMAT_DEPTH, + .pixel_format = sapp_depth_format(), .compare = SG_COMPAREFUNC_LESS_EQUAL, .write_enabled = true }, diff --git a/thirdparty/sokol_app.h b/thirdparty/sokol_app.h index 0142947..30db44d 100644 --- a/thirdparty/sokol_app.h +++ b/thirdparty/sokol_app.h @@ -11930,7 +11930,11 @@ SOKOL_API_IMPL int sapp_color_format(void) { } SOKOL_API_IMPL int sapp_depth_format(void) { + #ifdef SOKOL_GLES2 + return _SAPP_PIXELFORMAT_DEPTH; + #else return _SAPP_PIXELFORMAT_DEPTH_STENCIL; + #endif } SOKOL_API_IMPL int sapp_sample_count(void) {