diff options
| author | Andre Weissflog <floooh@gmail.com> | 2023-02-19 16:33:25 +0100 |
|---|---|---|
| committer | Andre Weissflog <floooh@gmail.com> | 2023-02-19 16:33:25 +0100 |
| commit | 494fb11e9af560d9df0d65c754b24f3ce3e5b7b9 (patch) | |
| tree | c1d089fd0293a81d0aff1fe7313dfd1db7bc3393 /tests/functional | |
| parent | a0a7c38f5bfb1ed14d5d6b824ab919df023acb1d (diff) | |
sokol_gfx.h: implement sg_query_shader_desc()
Diffstat (limited to 'tests/functional')
| -rw-r--r-- | tests/functional/sokol_gfx_test.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/functional/sokol_gfx_test.c b/tests/functional/sokol_gfx_test.c index a9e0d0e5..8a8612c6 100644 --- a/tests/functional/sokol_gfx_test.c +++ b/tests/functional/sokol_gfx_test.c @@ -929,6 +929,63 @@ UTEST(sokol_gfx, query_image_desc) { sg_shutdown(); } +UTEST(sokol_gfx, query_shader_desc) { + setup(&(sg_desc){0}); + + sg_shader s0 = sg_make_shader(&(sg_shader_desc){ + .attrs = { + [0] = { .name = "pos", .sem_name = "POS", .sem_index = 1 }, + }, + .vs = { + .source = "vs_source", + .uniform_blocks = { + [0] = { + .size = 128, + .layout = SG_UNIFORMLAYOUT_STD140, + .uniforms = { + [0] = { .name = "blub", .type = SG_UNIFORMTYPE_FLOAT4, .array_count = 1 }, + [1] = { .name = "blob", .type = SG_UNIFORMTYPE_FLOAT2, .array_count = 1 }, + } + } + }, + .images = { + [0] = { .name = "img0", .image_type = SG_IMAGETYPE_2D, .sampler_type = SG_SAMPLERTYPE_FLOAT }, + } + }, + .fs = { + .source = "fs_source", + .images = { + [0] = { .name = "img1", .image_type = SG_IMAGETYPE_ARRAY, .sampler_type = SG_SAMPLERTYPE_UINT }, + } + }, + .label = "label", + }); + const sg_shader_desc s0_desc = sg_query_shader_desc(s0); + T(s0_desc.attrs[0].name == 0); + T(s0_desc.attrs[0].sem_name == 0); + T(s0_desc.attrs[0].sem_index == 0); + T(s0_desc.vs.source == 0); + T(s0_desc.vs.uniform_blocks[0].size == 128); + T(s0_desc.vs.uniform_blocks[0].layout == 0); + T(s0_desc.vs.uniform_blocks[0].uniforms[0].name == 0); + T(s0_desc.vs.uniform_blocks[0].uniforms[0].type == 0); + T(s0_desc.vs.uniform_blocks[0].uniforms[0].array_count == 0); + T(s0_desc.vs.images[0].name == 0); + T(s0_desc.vs.images[0].image_type == SG_IMAGETYPE_2D); + T(s0_desc.vs.images[0].sampler_type == SG_SAMPLERTYPE_FLOAT); + T(s0_desc.fs.source == 0); + T(s0_desc.fs.uniform_blocks[0].size == 0); + T(s0_desc.fs.uniform_blocks[0].layout == 0); + T(s0_desc.fs.uniform_blocks[0].uniforms[0].name == 0); + T(s0_desc.fs.uniform_blocks[0].uniforms[0].type == 0); + T(s0_desc.fs.uniform_blocks[0].uniforms[0].array_count == 0); + T(s0_desc.fs.images[0].name == 0); + T(s0_desc.fs.images[0].image_type == SG_IMAGETYPE_ARRAY); + T(s0_desc.fs.images[0].sampler_type == SG_SAMPLERTYPE_UINT); + + sg_shutdown(); +} + UTEST(sokol_gfx, buffer_resource_states) { setup(&(sg_desc){0}); sg_buffer buf = sg_alloc_buffer(); |