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:
baldurk
2019-04-04 15:43:29 +01:00
parent 043fcda299
commit ccd5ba218e
11 changed files with 14 additions and 17 deletions
+1 -1
View File
@@ -339,7 +339,7 @@ void D3D11GraphicsTest::PostDeviceCreate()
dev1->CheckFeatureSupport(D3D11_FEATURE_D3D11_OPTIONS1, &opts1, sizeof(opts1));
}
D3D11GraphicsTest::~D3D11GraphicsTest()
void D3D11GraphicsTest::Shutdown()
{
delete mainWindow;
+1 -2
View File
@@ -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();
+1 -4
View File
@@ -407,11 +407,8 @@ bool D3D12GraphicsTest::IsSupported()
return result;
}
D3D12GraphicsTest::~D3D12GraphicsTest()
void D3D12GraphicsTest::Shutdown()
{
if(dev == NULL)
return;
GPUSync();
infoqueue = NULL;
+1 -2
View File
@@ -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();
+1 -1
View File
@@ -44,7 +44,7 @@ void OpenGLGraphicsTest::PostInit()
}
}
OpenGLGraphicsTest::~OpenGLGraphicsTest()
void OpenGLGraphicsTest::Shutdown()
{
if(!managedResources.bufs.empty())
glDeleteBuffers((GLsizei)managedResources.bufs.size(), &managedResources.bufs[0]);
+1 -2
View File
@@ -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);
+1
View File
@@ -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;
}
}
+4
View File
@@ -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;
+1
View File
@@ -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);
+1 -4
View File
@@ -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)
+1 -1
View File
@@ -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);