GPU: Add SSBO binding test to new structure.

This test was added to test the shader info structure binding
information for SSBOs. It still used the legacy GLSL structure.
This commit is contained in:
Jeroen Bakker 2023-01-30 19:07:33 +01:00
parent f4deed288b
commit 87a923fdb6
4 changed files with 13 additions and 21 deletions

View File

@ -505,6 +505,7 @@ set(GLSL_SRC_TEST
tests/shaders/gpu_compute_2d_test.glsl
tests/shaders/gpu_compute_ibo_test.glsl
tests/shaders/gpu_compute_vbo_test.glsl
tests/shaders/gpu_compute_dummy_test.glsl
)
set(MTL_BACKEND_GLSL_SRC

View File

@ -41,3 +41,10 @@ GPU_SHADER_CREATE_INFO(gpu_compute_vbo_test)
.storage_buf(0, Qualifier::WRITE, "vec4", "out_positions[]")
.compute_source("gpu_compute_vbo_test.glsl")
.do_static_compilation(true);
GPU_SHADER_CREATE_INFO(gpu_compute_ssbo_binding_test)
.local_group_size(1)
.storage_buf(0, Qualifier::WRITE, "int", "data0[]")
.storage_buf(1, Qualifier::WRITE, "int", "data1[]")
.compute_source("gpu_compute_dummy_test.glsl")
.do_static_compilation(true);

View File

@ -218,30 +218,12 @@ static void test_gpu_shader_ssbo_binding()
}
/* Build compute shader. */
const char *compute_glsl = R"(
layout(local_size_x = 1) in;
layout(std430, binding = 0) buffer ssboBinding0
{
int data0[];
};
layout(std430, binding = 1) buffer ssboBinding1
{
int data1[];
};
void main() {
}
)";
GPUShader *shader = GPU_shader_create_compute(compute_glsl, nullptr, nullptr, "gpu_shader_ssbo");
GPUShader *shader = GPU_shader_create_from_info_name("gpu_compute_ssbo_binding_test");
EXPECT_NE(shader, nullptr);
GPU_shader_bind(shader);
EXPECT_EQ(0, GPU_shader_get_ssbo(shader, "ssboBinding0"));
EXPECT_EQ(1, GPU_shader_get_ssbo(shader, "ssboBinding1"));
EXPECT_EQ(0, GPU_shader_get_ssbo(shader, "data0"));
EXPECT_EQ(1, GPU_shader_get_ssbo(shader, "data1"));
/* Cleanup. */
GPU_shader_unbind();

View File

@ -0,0 +1,2 @@
void main () {
}