Correct depth format on desktop and web

main
parent 4065074e0e
commit cd83f2fd92

@ -2743,7 +2743,7 @@ void create_screenspace_gfx_state()
state.threedee_pass_image = sg_make_image(&desc); state.threedee_pass_image = sg_make_image(&desc);
desc.label = "threedee-pass-depth-render-target"; 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_depth_image = sg_make_image(&desc);
state.threedee_pass = sg_make_pass(&(sg_pass_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, [ATTR_threedee_vs_uv_in].format = SG_VERTEXFORMAT_FLOAT2,
}}, }},
.depth = { .depth = {
.pixel_format = SG_PIXELFORMAT_DEPTH, .pixel_format = sapp_depth_format(),
.compare = SG_COMPAREFUNC_LESS_EQUAL, .compare = SG_COMPAREFUNC_LESS_EQUAL,
.write_enabled = true, .write_enabled = true,
}, },
@ -3332,7 +3332,7 @@ void init(void)
{ {
.shader = shd, .shader = shd,
.depth = { .depth = {
.pixel_format = SG_PIXELFORMAT_DEPTH, .pixel_format = sapp_depth_format(),
.compare = SG_COMPAREFUNC_LESS_EQUAL, .compare = SG_COMPAREFUNC_LESS_EQUAL,
.write_enabled = true .write_enabled = true
}, },

@ -11930,7 +11930,11 @@ SOKOL_API_IMPL int sapp_color_format(void) {
} }
SOKOL_API_IMPL int sapp_depth_format(void) { SOKOL_API_IMPL int sapp_depth_format(void) {
#ifdef SOKOL_GLES2
return _SAPP_PIXELFORMAT_DEPTH;
#else
return _SAPP_PIXELFORMAT_DEPTH_STENCIL; return _SAPP_PIXELFORMAT_DEPTH_STENCIL;
#endif
} }
SOKOL_API_IMPL int sapp_sample_count(void) { SOKOL_API_IMPL int sapp_sample_count(void) {

Loading…
Cancel
Save