Skip to content

Commit

Permalink
Override MessageCallback in GPUTestingEnvironment
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve J. Cai committed Sep 30, 2023
1 parent 94786b3 commit b99cfd0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions Tests/GPUTestFramework/include/GPUTestingEnvironment.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class GPUTestingEnvironment : public TestingEnvironment
{
public:
static GPUTestingEnvironment* Initialize(int argc, char** argv);
static GPUTestingEnvironment* InitializeVk();

struct CreateInfo
{
Expand All @@ -61,6 +62,8 @@ class GPUTestingEnvironment : public TestingEnvironment
bool EnableDeviceSimulation = false;

DeviceFeatures Features{DEVICE_FEATURE_STATE_OPTIONAL};

DebugMessageCallbackType MessageCallback = TestingEnvironment::MessageCallback;
};
GPUTestingEnvironment(const CreateInfo& CI, const SwapChainDesc& SCDesc);

Expand Down
12 changes: 6 additions & 6 deletions Tests/GPUTestFramework/src/GPUTestingEnvironment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ GPUTestingEnvironment::GPUTestingEnvironment(const CreateInfo& EnvCI, const Swap
# endif

auto* pFactoryD3D11 = GetEngineFactoryD3D11();
pFactoryD3D11->SetMessageCallback(MessageCallback);
pFactoryD3D11->SetMessageCallback(EnvCI.MessageCallback);

EngineD3D11CreateInfo EngineCI;
EngineCI.GraphicsAPIVersion = Version{11, 0};
Expand Down Expand Up @@ -273,7 +273,7 @@ GPUTestingEnvironment::GPUTestingEnvironment(const CreateInfo& EnvCI, const Swap
}
# endif
auto* pFactoryD3D12 = GetEngineFactoryD3D12();
pFactoryD3D12->SetMessageCallback(MessageCallback);
pFactoryD3D12->SetMessageCallback(EnvCI.MessageCallback);

if (!pFactoryD3D12->LoadD3D12())
{
Expand Down Expand Up @@ -338,7 +338,7 @@ GPUTestingEnvironment::GPUTestingEnvironment(const CreateInfo& EnvCI, const Swap
}
# endif
auto* pFactoryOpenGL = GetEngineFactoryOpenGL();
pFactoryOpenGL->SetMessageCallback(MessageCallback);
pFactoryOpenGL->SetMessageCallback(EnvCI.MessageCallback);
EnumerateAdapters(pFactoryOpenGL, Version{},
[](const GraphicsAdapterInfo& AdapterInfo, Uint32 AdapterId) {
return std::vector<DisplayModeAttribs>{};
Expand Down Expand Up @@ -374,7 +374,7 @@ GPUTestingEnvironment::GPUTestingEnvironment(const CreateInfo& EnvCI, const Swap
# endif

auto* pFactoryVk = GetEngineFactoryVk();
pFactoryVk->SetMessageCallback(MessageCallback);
pFactoryVk->SetMessageCallback(EnvCI.MessageCallback);

if (EnvCI.EnableDeviceSimulation)
pFactoryVk->EnableDeviceSimulation();
Expand Down Expand Up @@ -421,7 +421,7 @@ GPUTestingEnvironment::GPUTestingEnvironment(const CreateInfo& EnvCI, const Swap
case RENDER_DEVICE_TYPE_METAL:
{
auto* pFactoryMtl = GetEngineFactoryMtl();
pFactoryMtl->SetMessageCallback(MessageCallback);
pFactoryMtl->SetMessageCallback(EnvCI.MessageCallback);

EnumerateAdapters(pFactoryMtl, Version{},
[](const GraphicsAdapterInfo& AdapterInfo, Uint32 AdapterId) {
Expand Down Expand Up @@ -564,7 +564,7 @@ GPUTestingEnvironment::GPUTestingEnvironment(const CreateInfo& EnvCI, const Swap
# else
m_ArchiverFactory = Diligent::GetArchiverFactory();
# endif
m_ArchiverFactory->SetMessageCallback(MessageCallback);
m_ArchiverFactory->SetMessageCallback(EnvCI.MessageCallback);
}
#endif
}
Expand Down

0 comments on commit b99cfd0

Please sign in to comment.