Commit: 87a923fdb671f1d5278ac91511c82ac1f55292b4 Author: Jeroen Bakker Date: Mon Jan 30 19:07:33 2023 +0100 Branches: master https://developer.blender.org/rB87a923fdb671f1d5278ac91511c82ac1f55292b4
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. =================================================================== M source/blender/gpu/CMakeLists.txt M source/blender/gpu/shaders/infos/gpu_shader_test_info.hh M source/blender/gpu/tests/gpu_shader_test.cc A source/blender/gpu/tests/shaders/gpu_compute_dummy_test.glsl =================================================================== diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt index 30a525af6cd..6804c63d4e4 100644 --- a/source/blender/gpu/CMakeLists.txt +++ b/source/blender/gpu/CMakeLists.txt @@ -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 diff --git a/source/blender/gpu/shaders/infos/gpu_shader_test_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_test_info.hh index 432fa56b95f..bf4de62415d 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_test_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_test_info.hh @@ -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); diff --git a/source/blender/gpu/tests/gpu_shader_test.cc b/source/blender/gpu/tests/gpu_shader_test.cc index 8a5b70a9b1d..9bb0d1504b3 100644 --- a/source/blender/gpu/tests/gpu_shader_test.cc +++ b/source/blender/gpu/tests/gpu_shader_test.cc @@ -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(); diff --git a/source/blender/gpu/tests/shaders/gpu_compute_dummy_test.glsl b/source/blender/gpu/tests/shaders/gpu_compute_dummy_test.glsl new file mode 100644 index 00000000000..c08e5bcfebe --- /dev/null +++ b/source/blender/gpu/tests/shaders/gpu_compute_dummy_test.glsl @@ -0,0 +1,2 @@ +void main () { +} \ No newline at end of file _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs