mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Explicitly shutdown only the running test, instead of using destructors
* The tests are global objects so there's a potential ordering issue of destroying these tests after RenderDoc's global destructors have run.
This commit is contained in:
@@ -339,7 +339,7 @@ void D3D11GraphicsTest::PostDeviceCreate()
|
||||
dev1->CheckFeatureSupport(D3D11_FEATURE_D3D11_OPTIONS1, &opts1, sizeof(opts1));
|
||||
}
|
||||
|
||||
D3D11GraphicsTest::~D3D11GraphicsTest()
|
||||
void D3D11GraphicsTest::Shutdown()
|
||||
{
|
||||
delete mainWindow;
|
||||
|
||||
|
||||
@@ -45,9 +45,8 @@ struct D3D11GraphicsTest : public GraphicsTest
|
||||
{
|
||||
static const TestAPI API = TestAPI::D3D11;
|
||||
|
||||
~D3D11GraphicsTest();
|
||||
|
||||
bool Init(int argc, char **argv);
|
||||
void Shutdown();
|
||||
GraphicsWindow *MakeWindow(int width, int height, const char *title);
|
||||
bool IsSupported();
|
||||
|
||||
|
||||
@@ -407,11 +407,8 @@ bool D3D12GraphicsTest::IsSupported()
|
||||
return result;
|
||||
}
|
||||
|
||||
D3D12GraphicsTest::~D3D12GraphicsTest()
|
||||
void D3D12GraphicsTest::Shutdown()
|
||||
{
|
||||
if(dev == NULL)
|
||||
return;
|
||||
|
||||
GPUSync();
|
||||
|
||||
infoqueue = NULL;
|
||||
|
||||
@@ -46,9 +46,8 @@ struct D3D12GraphicsTest : public GraphicsTest
|
||||
{
|
||||
static const TestAPI API = TestAPI::D3D12;
|
||||
|
||||
~D3D12GraphicsTest();
|
||||
|
||||
bool Init(int argc, char **argv);
|
||||
void Shutdown();
|
||||
GraphicsWindow *MakeWindow(int width, int height, const char *title);
|
||||
bool IsSupported();
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ void OpenGLGraphicsTest::PostInit()
|
||||
}
|
||||
}
|
||||
|
||||
OpenGLGraphicsTest::~OpenGLGraphicsTest()
|
||||
void OpenGLGraphicsTest::Shutdown()
|
||||
{
|
||||
if(!managedResources.bufs.empty())
|
||||
glDeleteBuffers((GLsizei)managedResources.bufs.size(), &managedResources.bufs[0]);
|
||||
|
||||
@@ -34,9 +34,8 @@ struct OpenGLGraphicsTest : public GraphicsTest
|
||||
{
|
||||
static const TestAPI API = TestAPI::OpenGL;
|
||||
|
||||
~OpenGLGraphicsTest();
|
||||
|
||||
bool Init(int argc, char **argv);
|
||||
void Shutdown();
|
||||
bool IsSupported();
|
||||
GraphicsWindow *MakeWindow(int width, int height, const char *title);
|
||||
void *MakeContext(GraphicsWindow *win, void *share);
|
||||
|
||||
@@ -451,6 +451,7 @@ Usage: %s Test_Name [test_options]
|
||||
{
|
||||
TEST_LOG("\n\n======\nRunning %s\n\n", test.Name);
|
||||
int ret = test.test->main(argc, argv);
|
||||
test.test->Shutdown();
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -406,6 +406,10 @@ bool GraphicsTest::Init(int argc, char **argv)
|
||||
return true;
|
||||
}
|
||||
|
||||
void GraphicsTest::Shutdown()
|
||||
{
|
||||
}
|
||||
|
||||
std::string GraphicsTest::GetDataPath(const std::string &filename)
|
||||
{
|
||||
return dataRoot + filename;
|
||||
|
||||
@@ -155,6 +155,7 @@ struct GraphicsTest
|
||||
virtual int main(int argc, char **argv) { return 9; }
|
||||
virtual bool IsSupported() { return false; }
|
||||
virtual bool Init(int argc, char **argv);
|
||||
virtual void Shutdown();
|
||||
|
||||
std::string GetDataPath(const std::string &filename);
|
||||
|
||||
|
||||
@@ -414,11 +414,8 @@ GraphicsWindow *VulkanGraphicsTest::MakeWindow(int width, int height, const char
|
||||
#endif
|
||||
}
|
||||
|
||||
VulkanGraphicsTest::~VulkanGraphicsTest()
|
||||
void VulkanGraphicsTest::Shutdown()
|
||||
{
|
||||
if(volkGetInstanceVersion() == 0)
|
||||
return;
|
||||
|
||||
vmaDestroyAllocator(allocator);
|
||||
|
||||
if(device)
|
||||
|
||||
@@ -139,9 +139,9 @@ struct VulkanGraphicsTest : public GraphicsTest
|
||||
static const TestAPI API = TestAPI::Vulkan;
|
||||
|
||||
VulkanGraphicsTest();
|
||||
~VulkanGraphicsTest();
|
||||
|
||||
bool Init(int argc, char **argv);
|
||||
void Shutdown();
|
||||
bool IsSupported();
|
||||
GraphicsWindow *MakeWindow(int width, int height, const char *title);
|
||||
VkResult CreateSurface(GraphicsWindow *win, VkSurfaceKHR *outSurf);
|
||||
|
||||
Reference in New Issue
Block a user