From aa7c2170b957bc9591889f4c9ef79976ebd2565d Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 20 Nov 2019 18:37:04 +0000 Subject: [PATCH] Add D3D12 test command line parameter to enable GPUVA --- util/test/demos/d3d12/d3d12_test.cpp | 16 ++++++++++++++++ util/test/demos/d3d12/d3d12_test.h | 1 + 2 files changed, 17 insertions(+) diff --git a/util/test/demos/d3d12/d3d12_test.cpp b/util/test/demos/d3d12/d3d12_test.cpp index fa28cb63a..770cc77d3 100644 --- a/util/test/demos/d3d12/d3d12_test.cpp +++ b/util/test/demos/d3d12/d3d12_test.cpp @@ -141,6 +141,14 @@ void D3D12GraphicsTest::Prepare(int argc, char **argv) else if(!factory) Avail = "Couldn't create DXGI factory"; + for(int i = 0; i < argc; i++) + { + if(!strcmp(argv[i], "--gpuva") || !strcmp(argv[i], "--debug-gpu")) + { + gpuva = true; + } + } + m_Factory = factory; } @@ -191,6 +199,14 @@ bool D3D12GraphicsTest::Init() if(SUCCEEDED(hr) && d3d12Debug) { d3d12Debug->EnableDebugLayer(); + + if(gpuva) + { + ID3D12Debug1Ptr debug1 = d3d12Debug; + + if(debug1) + debug1->SetEnableGPUBasedValidation(true); + } } } diff --git a/util/test/demos/d3d12/d3d12_test.h b/util/test/demos/d3d12/d3d12_test.h index 48cae6801..a5327f79b 100644 --- a/util/test/demos/d3d12/d3d12_test.h +++ b/util/test/demos/d3d12/d3d12_test.h @@ -185,6 +185,7 @@ struct D3D12GraphicsTest : public GraphicsTest ID3D12ResourcePtr bbTex[2]; uint32_t texIdx = 0; + bool gpuva = false; IDXGIFactory1Ptr m_Factory; ID3D12DebugPtr d3d12Debug;