Fix: DRW: Uninitialized mutex in tests
Tests were calling the submission mutex without init. Adding functions to expose only setting up the submission mutex instead of the full DRW context (which is uneeded here).
This commit is contained in:
@@ -119,6 +119,9 @@ void DRW_render_context_disable(Render *render);
|
||||
void DRW_submission_start();
|
||||
void DRW_submission_end();
|
||||
|
||||
void DRW_submission_mutex_init();
|
||||
void DRW_submission_mutex_exit();
|
||||
|
||||
void DRW_gpu_context_create();
|
||||
void DRW_gpu_context_destroy();
|
||||
/**
|
||||
|
||||
@@ -30,6 +30,16 @@
|
||||
|
||||
static TicketMutex *submission_mutex = nullptr;
|
||||
|
||||
void DRW_submission_mutex_init()
|
||||
{
|
||||
submission_mutex = BLI_ticket_mutex_alloc();
|
||||
}
|
||||
|
||||
void DRW_submission_mutex_exit()
|
||||
{
|
||||
BLI_ticket_mutex_free(submission_mutex);
|
||||
}
|
||||
|
||||
void DRW_submission_start()
|
||||
{
|
||||
bool locked = BLI_ticket_mutex_lock_check_recursive(submission_mutex);
|
||||
@@ -69,7 +79,8 @@ void DRW_gpu_context_create()
|
||||
BLI_assert(system_gpu_context == nullptr); /* Ensure it's called once */
|
||||
|
||||
system_gpu_context_mutex = BLI_ticket_mutex_alloc();
|
||||
submission_mutex = BLI_ticket_mutex_alloc();
|
||||
DRW_submission_mutex_init();
|
||||
|
||||
/* This changes the active context. */
|
||||
system_gpu_context = WM_system_gpu_context_create();
|
||||
WM_system_gpu_context_activate(system_gpu_context);
|
||||
@@ -95,7 +106,7 @@ void DRW_gpu_context_destroy()
|
||||
GPU_context_active_set(blender_gpu_context);
|
||||
GPU_context_discard(blender_gpu_context);
|
||||
WM_system_gpu_context_dispose(system_gpu_context);
|
||||
BLI_ticket_mutex_free(submission_mutex);
|
||||
DRW_submission_mutex_exit();
|
||||
BLI_ticket_mutex_free(system_gpu_context_mutex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "draw_testing.hh"
|
||||
|
||||
#include "DRW_engine.hh"
|
||||
#include "GPU_shader.hh"
|
||||
|
||||
namespace blender::draw {
|
||||
@@ -13,6 +14,13 @@ namespace blender::draw {
|
||||
void DrawOpenGLTest::SetUp()
|
||||
{
|
||||
GPUOpenGLTest::SetUp();
|
||||
DRW_submission_mutex_init();
|
||||
}
|
||||
|
||||
void DrawOpenGLTest::TearDown()
|
||||
{
|
||||
DRW_submission_mutex_exit();
|
||||
GPUOpenGLTest::TearDown();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -20,6 +28,13 @@ void DrawOpenGLTest::SetUp()
|
||||
void DrawMetalTest::SetUp()
|
||||
{
|
||||
GPUMetalTest::SetUp();
|
||||
DRW_submission_mutex_init();
|
||||
}
|
||||
|
||||
void DrawMetalTest::TearDown()
|
||||
{
|
||||
DRW_submission_mutex_exit();
|
||||
GPUMetalTest::TearDown();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -27,6 +42,13 @@ void DrawMetalTest::SetUp()
|
||||
void DrawVulkanTest::SetUp()
|
||||
{
|
||||
GPUVulkanTest::SetUp();
|
||||
DRW_submission_mutex_init();
|
||||
}
|
||||
|
||||
void DrawVulkanTest::TearDown()
|
||||
{
|
||||
DRW_submission_mutex_exit();
|
||||
GPUVulkanTest::TearDown();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace blender::draw {
|
||||
class DrawOpenGLTest : public blender::gpu::GPUOpenGLTest {
|
||||
public:
|
||||
void SetUp() override;
|
||||
void TearDown() override;
|
||||
};
|
||||
|
||||
# define DRAW_OPENGL_TEST(test_name) \
|
||||
@@ -26,6 +27,7 @@ class DrawOpenGLTest : public blender::gpu::GPUOpenGLTest {
|
||||
class DrawMetalTest : public blender::gpu::GPUMetalTest {
|
||||
public:
|
||||
void SetUp() override;
|
||||
void TearDown() override;
|
||||
};
|
||||
|
||||
# define DRAW_METAL_TEST(test_name) \
|
||||
@@ -41,6 +43,7 @@ class DrawMetalTest : public blender::gpu::GPUMetalTest {
|
||||
class DrawVulkanTest : public blender::gpu::GPUVulkanTest {
|
||||
public:
|
||||
void SetUp() override;
|
||||
void TearDown() override;
|
||||
};
|
||||
|
||||
# define DRAW_VULKAN_TEST(test_name) \
|
||||
|
||||
Reference in New Issue
Block a user