Minor fixes for formatting and present seperator (#583)
This commit is contained in:
Родитель
cc9606b19b
Коммит
2aaba74b83
|
@ -95,7 +95,6 @@ target_link_libraries(
|
|||
wil
|
||||
d3d12
|
||||
directml
|
||||
dxgi
|
||||
)
|
||||
|
||||
if(TARGET_WSL)
|
||||
|
@ -157,7 +156,8 @@ set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT dxdispatch)
|
|||
|
||||
if(WIN32)
|
||||
if(TARGET_WINDOWS)
|
||||
target_compile_definitions(dxdispatchImpl PRIVATE DX_PRESENT_SEPARATOR=1)
|
||||
target_compile_definitions(dxdispatchImpl PRIVATE INCLUDE_DXGI=1)
|
||||
target_link_libraries(dxdispatchImpl PRIVATE dxgi)
|
||||
endif()
|
||||
target_sources(dxdispatchImpl PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/dxdispatchImpl.rc)
|
||||
target_link_libraries(dxdispatchImpl PRIVATE version.lib)
|
||||
|
|
|
@ -192,13 +192,11 @@ CommandLineArgs::CommandLineArgs(int argc, char** argv)
|
|||
"Name used for PIX capture files.",
|
||||
cxxopts::value<std::string>()->default_value("dxdispatch")
|
||||
)
|
||||
#if defined(DX_PRESENT_SEPARATOR)
|
||||
(
|
||||
"present_separator",
|
||||
"Injects present after each full inference pass, giving debugging tools a notion of frames.",
|
||||
cxxopts::value<bool>()
|
||||
)
|
||||
#endif
|
||||
;
|
||||
|
||||
// ONNX OPTIONS
|
||||
|
@ -369,12 +367,10 @@ CommandLineArgs::CommandLineArgs(int argc, char** argv)
|
|||
m_disableAgilitySDK = result["disable_agility_sdk"].as<bool>();
|
||||
}
|
||||
|
||||
#if defined(DX_PRESENT_SEPARATOR)
|
||||
if (result.count("present_separator"))
|
||||
{
|
||||
m_presentSeparator = result["present_separator"].as<bool>();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (result.count("print_hlsl_disassembly"))
|
||||
{
|
||||
|
|
|
@ -54,10 +54,7 @@ public:
|
|||
PixCaptureType GetPixCaptureType() const { return m_pixCaptureType; }
|
||||
const std::string& PixCaptureName() const { return m_pixCaptureName; }
|
||||
|
||||
#if defined(DX_PRESENT_SEPARATOR)
|
||||
bool GetPresentSeparator() const { return m_presentSeparator; }
|
||||
#endif
|
||||
|
||||
bool GetUavBarrierAfterDispatch() const { return m_uavBarrierAfterDispatch; }
|
||||
bool GetAliasingBarrierAfterDispatch() const { return m_aliasingBarrierAfterDispatch; }
|
||||
bool PrintCommands() const { return m_commandPrinting; }
|
||||
|
@ -90,9 +87,7 @@ private:
|
|||
bool m_setStablePowerState = false;
|
||||
bool m_preferCustomHeaps = true;
|
||||
bool m_disableAgilitySDK = false;
|
||||
#if defined(DX_PRESENT_SEPARATOR)
|
||||
bool m_presentSeparator = false;
|
||||
#endif
|
||||
bool m_uavBarrierAfterDispatch = true;
|
||||
bool m_aliasingBarrierAfterDispatch = false;
|
||||
DML_FEATURE_LEVEL m_dmlFeatureLevel = DML_FEATURE_LEVEL_5_0;
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
#include "pch.h"
|
||||
#include "Device.h"
|
||||
|
||||
#if defined(DX_PRESENT_SEPARATOR)
|
||||
#include <dxgi1_6.h>
|
||||
#endif
|
||||
|
||||
using Microsoft::WRL::ComPtr;
|
||||
|
||||
// {0059DA69-B561-43D9-A39B-3355074B1082}
|
||||
|
@ -63,6 +59,7 @@ Device::Device(
|
|||
bool disableBackgroundProcessing,
|
||||
bool setStablePowerState,
|
||||
bool preferCustomHeaps,
|
||||
bool usePresentSeparator,
|
||||
uint32_t maxGpuTimeMeasurements,
|
||||
std::shared_ptr<PixCaptureHelper> pixCaptureHelper,
|
||||
std::shared_ptr<D3d12Module> d3dModule,
|
||||
|
@ -232,8 +229,9 @@ Device::Device(
|
|||
IID_GRAPHICS_PPV_ARGS(m_queue.ReleaseAndGetAddressOf())));
|
||||
m_commandListType = queueDesc.Type;
|
||||
|
||||
#if defined(DX_PRESENT_SEPARATOR)
|
||||
#if defined(INCLUDE_DXGI)
|
||||
// Create dummy swapchain for frame indication
|
||||
if (usePresentSeparator)
|
||||
{
|
||||
ComPtr<IDXGIFactory2> factory;
|
||||
THROW_IF_FAILED(CreateDXGIFactory2(DXGI_CREATE_FACTORY_DEBUG, IID_PPV_ARGS(&factory)));
|
||||
|
@ -250,8 +248,11 @@ Device::Device(
|
|||
desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
|
||||
desc.AlphaMode = DXGI_ALPHA_MODE_IGNORE;
|
||||
desc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING;
|
||||
const auto HR = factory->CreateSwapChainForComposition(m_queue.Get(), &desc, nullptr, m_dummySwapChain.GetAddressOf());
|
||||
THROW_IF_FAILED(HR);
|
||||
const auto hr = factory->CreateSwapChainForComposition(m_queue.Get(), &desc, nullptr, m_dummySwapChain.GetAddressOf());
|
||||
if (FAILED(hr))
|
||||
{
|
||||
m_logger->LogWarning("Creating dummy swap chain for present seperator failed");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -791,12 +792,12 @@ void Device::ClearShaderCaches()
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(DX_PRESENT_SEPARATOR)
|
||||
void Device::DummyPreset()
|
||||
void Device::DummyPresent()
|
||||
{
|
||||
#if defined(INCLUDE_DXGI)
|
||||
if (m_dummySwapChain)
|
||||
{
|
||||
m_dummySwapChain->Present(0, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
|
@ -23,6 +23,7 @@ public:
|
|||
bool disableBackgroundProcessing,
|
||||
bool setStablePowerState,
|
||||
bool preferCustomHeaps,
|
||||
bool usePresentSeparator,
|
||||
uint32_t maxGpuTimeMeasurements,
|
||||
std::shared_ptr<PixCaptureHelper> pixCaptureHelper,
|
||||
std::shared_ptr<D3d12Module> d3dModule,
|
||||
|
@ -121,9 +122,7 @@ public:
|
|||
static uint32_t GetSizeInBytes(DML_TENSOR_DATA_TYPE dataType);
|
||||
static DXGI_FORMAT GetDxgiFormatFromDmlTensorDataType(DML_TENSOR_DATA_TYPE dataType);
|
||||
|
||||
#if defined(DX_PRESENT_SEPARATOR)
|
||||
void DummyPreset();
|
||||
#endif
|
||||
void DummyPresent();
|
||||
|
||||
private:
|
||||
void EnsureDxcInterfaces();
|
||||
|
@ -163,7 +162,7 @@ private:
|
|||
Microsoft::WRL::ComPtr<IDxcCompiler3> m_dxcCompiler;
|
||||
#endif
|
||||
|
||||
#if defined(DX_PRESENT_SEPARATOR)
|
||||
Microsoft::WRL::ComPtr<struct IDXGISwapChain1> m_dummySwapChain;
|
||||
#if defined(INCLUDE_DXGI)
|
||||
Microsoft::WRL::ComPtr<IDXGISwapChain1> m_dummySwapChain;
|
||||
#endif
|
||||
};
|
|
@ -325,12 +325,10 @@ void Executor::operator()(const Model::DispatchCommand& command)
|
|||
std::this_thread::sleep_for(std::chrono::milliseconds(static_cast<size_t>(timeToSleep)));
|
||||
}
|
||||
|
||||
#if defined(DX_PRESENT_SEPARATOR)
|
||||
if (m_commandLineArgs.GetPresentSeparator())
|
||||
{
|
||||
m_device->DummyPreset();
|
||||
m_device->DummyPresent();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
|
|
|
@ -173,6 +173,7 @@ HRESULT DxDispatch::RuntimeClassInitialize(
|
|||
m_options->DisableBackgroundProcessing(),
|
||||
m_options->SetStablePowerState(),
|
||||
m_options->PreferCustomHeaps(),
|
||||
m_options->GetPresentSeparator(),
|
||||
m_options->MaxGpuTimeMeasurements(),
|
||||
m_pixCaptureHelper,
|
||||
m_d3dModule,
|
||||
|
|
|
@ -74,6 +74,9 @@ using IAdapter = IDXGIAdapter;
|
|||
#endif
|
||||
#include <dxcapi.h>
|
||||
#include <WinPixEventRuntime/pix3.h>
|
||||
#ifdef INCLUDE_DXGI
|
||||
#include <dxgi1_6.h>
|
||||
#endif
|
||||
|
||||
#define IGraphicsUnknown IUnknown
|
||||
#define IID_GRAPHICS_PPV_ARGS IID_PPV_ARGS
|
||||
|
|
Загрузка…
Ссылка в новой задаче