diff options
| author | Andre Weissflog <floooh@gmail.com> | 2025-06-02 18:02:56 +0200 |
|---|---|---|
| committer | Andre Weissflog <floooh@gmail.com> | 2025-06-02 18:02:56 +0200 |
| commit | 4ad872d3b2bf5158f872005194e2d17f2ec38ea1 (patch) | |
| tree | 05eb0fbde8b74b0d4c70bdeee06de5d923a4466b | |
| parent | 9ef57401088a6dec556843148736cc0ea4028ffb (diff) | |
sokol_gfx.h: fix dummy backend and tests
| -rw-r--r-- | sokol_gfx.h | 42 | ||||
| -rw-r--r-- | tests/functional/sokol_gfx_test.c | 7 |
2 files changed, 11 insertions, 38 deletions
diff --git a/sokol_gfx.h b/sokol_gfx.h index d4f792cd..c23b51a0 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -8007,10 +8007,10 @@ _SOKOL_PRIVATE void _sg_dummy_discard_shader(_sg_shader_t* shd) { _SOKOL_UNUSED(shd); } -_SOKOL_PRIVATE sg_resource_state _sg_dummy_create_pipeline(_sg_pipeline_t* pip, _sg_shader_t* shd, const sg_pipeline_desc* desc) { +_SOKOL_PRIVATE sg_resource_state _sg_dummy_create_pipeline(_sg_pipeline_t* pip, const sg_pipeline_desc* desc) { SOKOL_ASSERT(pip && desc); + _SOKOL_UNUSED(pip); _SOKOL_UNUSED(desc); - pip->shader = shd; return SG_RESOURCESTATE_VALID; } @@ -8019,38 +8019,10 @@ _SOKOL_PRIVATE void _sg_dummy_discard_pipeline(_sg_pipeline_t* pip) { _SOKOL_UNUSED(pip); } -_SOKOL_PRIVATE sg_resource_state _sg_dummy_create_attachments(_sg_attachments_t* atts, const _sg_attachments_ptrs_t* atts_ptrs, const sg_attachments_desc* desc) { - SOKOL_ASSERT(atts && atts_ptrs && desc); - - for (int i = 0; i < atts->cmn.num_colors; i++) { - const sg_attachment_desc* color_desc = &desc->colors[i]; - _SOKOL_UNUSED(color_desc); - SOKOL_ASSERT(color_desc->image.id != SG_INVALID_ID); - SOKOL_ASSERT(0 == atts->dmy.colors[i].image); - SOKOL_ASSERT(atts_ptrs->color_images[i]); - _sg_image_t* clr_img = atts_ptrs->color_images[i]; - SOKOL_ASSERT(clr_img->slot.id == color_desc->image.id); - SOKOL_ASSERT(_sg_is_valid_attachment_color_format(clr_img->cmn.pixel_format)); - atts->dmy.colors[i].image = clr_img; - const sg_attachment_desc* resolve_desc = &desc->resolves[i]; - if (resolve_desc->image.id != SG_INVALID_ID) { - SOKOL_ASSERT(0 == atts->dmy.resolves[i].image); - SOKOL_ASSERT(atts_ptrs->resolve_images[i]); - _sg_image_t* rsv_img = atts_ptrs->resolve_images[i]; - SOKOL_ASSERT(rsv_img->slot.id == resolve_desc->image.id); - SOKOL_ASSERT(clr_img->cmn.pixel_format == rsv_img->cmn.pixel_format); - atts->dmy.resolves[i].image = rsv_img; - } - } - SOKOL_ASSERT(0 == atts->dmy.depth_stencil.image); - const sg_attachment_desc* ds_desc = &desc->depth_stencil; - if (ds_desc->image.id != SG_INVALID_ID) { - SOKOL_ASSERT(atts_ptrs->ds_image); - _sg_image_t* ds_img = atts_ptrs->ds_image; - SOKOL_ASSERT(ds_img->slot.id == ds_desc->image.id); - SOKOL_ASSERT(_sg_is_valid_attachment_depth_format(ds_img->cmn.pixel_format)); - atts->dmy.depth_stencil.image = ds_img; - } +_SOKOL_PRIVATE sg_resource_state _sg_dummy_create_attachments(_sg_attachments_t* atts, const sg_attachments_desc* desc) { + SOKOL_ASSERT(atts && desc); + _SOKOL_UNUSED(atts); + _SOKOL_UNUSED(desc); return SG_RESOURCESTATE_VALID; } @@ -10243,6 +10215,7 @@ _SOKOL_PRIVATE GLenum _sg_gl_depth_stencil_attachment_type(const _sg_image_t* ds _SOKOL_PRIVATE sg_resource_state _sg_gl_create_attachments(_sg_attachments_t* atts, const sg_attachments_desc* desc) { SOKOL_ASSERT(atts && desc); + _SOKOL_UNUSED(desc); _SG_GL_CHECK_ERROR(); // if this is a compute pass attachment we're done here @@ -14885,6 +14858,7 @@ _SOKOL_PRIVATE void _sg_mtl_discard_pipeline(_sg_pipeline_t* pip) { _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_attachments(_sg_attachments_t* atts, const sg_attachments_desc* desc) { SOKOL_ASSERT(atts && desc); + _SOKOL_UNUSED(desc); // create texture views for storage attachments for (int i = 0; i < SG_MAX_STORAGE_ATTACHMENTS; i++) { diff --git a/tests/functional/sokol_gfx_test.c b/tests/functional/sokol_gfx_test.c index 8e5383f8..a44a3060 100644 --- a/tests/functional/sokol_gfx_test.c +++ b/tests/functional/sokol_gfx_test.c @@ -511,8 +511,7 @@ UTEST(sokol_gfx, make_destroy_pipelines) { T(pipptr); T(pipptr->slot.id == pip[i].id); T(pipptr->slot.state == SG_RESOURCESTATE_VALID); - T(pipptr->shader == _sg_lookup_shader(desc.shader.id)); - T(pipptr->cmn.shader_id.id == desc.shader.id); + T(pipptr->cmn.shader.sref.id == desc.shader.id); T(pipptr->cmn.color_count == 1); T(pipptr->cmn.colors[0].pixel_format == SG_PIXELFORMAT_RGBA8); T(pipptr->cmn.depth.pixel_format == SG_PIXELFORMAT_DEPTH_STENCIL); @@ -563,9 +562,9 @@ UTEST(sokol_gfx, make_destroy_attachments) { T(attsptr->slot.state == SG_RESOURCESTATE_VALID); T(attsptr->cmn.num_colors == 3); for (int ai = 0; ai < 3; ai++) { - const _sg_image_t* img = _sg_attachments_color_image(attsptr, ai); + const _sg_image_t* img = _sg_image_ref_ptr(&attsptr->cmn.colors[ai].image); T(img == _sg_lookup_image(atts_desc.colors[ai].image.id)); - T(attsptr->cmn.colors[ai].image_id.id == atts_desc.colors[ai].image.id); + T(attsptr->cmn.colors[ai].image.sref.id == atts_desc.colors[ai].image.id); } } /* trying to create another one fails because pool is exhausted */ |