diff options
Diffstat (limited to 'source/blender/gpu/tests')
-rw-r--r-- | source/blender/gpu/tests/gpu_index_buffer_test.cc | 4 | ||||
-rw-r--r-- | source/blender/gpu/tests/gpu_shader_test.cc | 15 | ||||
-rw-r--r-- | source/blender/gpu/tests/gpu_testing.hh | 18 |
3 files changed, 31 insertions, 6 deletions
diff --git a/source/blender/gpu/tests/gpu_index_buffer_test.cc b/source/blender/gpu/tests/gpu_index_buffer_test.cc index 78e351af7f1..9d767b58a7b 100644 --- a/source/blender/gpu/tests/gpu_index_buffer_test.cc +++ b/source/blender/gpu/tests/gpu_index_buffer_test.cc @@ -10,7 +10,7 @@ namespace blender::gpu::tests { -TEST_F(GPUTest, gpu_index_buffer_subbuilders) +static void test_gpu_index_buffer_subbuilders() { const uint num_subbuilders = 10; const uint verts_per_subbuilders = 100; @@ -44,4 +44,6 @@ TEST_F(GPUTest, gpu_index_buffer_subbuilders) GPU_INDEXBUF_DISCARD_SAFE(index_buffer); } +GPU_TEST(gpu_index_buffer_subbuilders) + } // namespace blender::gpu::tests diff --git a/source/blender/gpu/tests/gpu_shader_test.cc b/source/blender/gpu/tests/gpu_shader_test.cc index e8645b89e41..43ff86ebbd8 100644 --- a/source/blender/gpu/tests/gpu_shader_test.cc +++ b/source/blender/gpu/tests/gpu_shader_test.cc @@ -18,7 +18,7 @@ namespace blender::gpu::tests { -TEST_F(GPUTest, gpu_shader_compute_2d) +static void test_gpu_shader_compute_2d() { if (!GPU_compute_shader_support()) { @@ -75,8 +75,9 @@ void main() { GPU_texture_free(texture); GPU_shader_free(shader); } +GPU_TEST(gpu_shader_compute_2d) -TEST_F(GPUTest, gpu_shader_compute_1d) +static void test_gpu_shader_compute_1d() { if (!GPU_compute_shader_support()) { @@ -137,8 +138,9 @@ void main() { GPU_texture_free(texture); GPU_shader_free(shader); } +GPU_TEST(gpu_shader_compute_1d) -TEST_F(GPUTest, gpu_shader_compute_vbo) +static void test_gpu_shader_compute_vbo() { if (!GPU_compute_shader_support()) { @@ -201,8 +203,9 @@ void main() { GPU_vertbuf_discard(vbo); GPU_shader_free(shader); } +GPU_TEST(gpu_shader_compute_vbo) -TEST_F(GPUTest, gpu_shader_compute_ibo) +static void test_gpu_shader_compute_ibo() { if (!GPU_compute_shader_support()) { @@ -258,8 +261,9 @@ void main() { GPU_indexbuf_discard(ibo); GPU_shader_free(shader); } +GPU_TEST(gpu_shader_compute_ibo) -TEST_F(GPUTest, gpu_shader_ssbo_binding) +static void test_gpu_shader_ssbo_binding() { if (!GPU_compute_shader_support()) { /* We can't test as a the platform does not support compute shaders. */ @@ -297,5 +301,6 @@ void main() { GPU_shader_unbind(); GPU_shader_free(shader); } +GPU_TEST(gpu_shader_ssbo_binding) } // namespace blender::gpu::tests diff --git a/source/blender/gpu/tests/gpu_testing.hh b/source/blender/gpu/tests/gpu_testing.hh index cf902a91264..c45770cb94e 100644 --- a/source/blender/gpu/tests/gpu_testing.hh +++ b/source/blender/gpu/tests/gpu_testing.hh @@ -15,13 +15,31 @@ namespace blender::gpu { */ class GPUTest : public ::testing::Test { private: + GHOST_TDrawingContextType draw_context_type = GHOST_kDrawingContextTypeNone; GHOST_SystemHandle ghost_system; GHOST_ContextHandle ghost_context; struct GPUContext *context; protected: + GPUTest(GHOST_TDrawingContextType draw_context_type) : draw_context_type(draw_context_type) + { + } + void SetUp() override; void TearDown() override; }; +class GPUOpenGLTest : public GPUTest { + public: + GPUOpenGLTest() : GPUTest(GHOST_kDrawingContextTypeOpenGL) + { + } +}; + +#define GPU_TEST(test_name) \ + TEST_F(GPUOpenGLTest, test_name) \ + { \ + test_##test_name(); \ + } + } // namespace blender::gpu |