修复 D3D12 截图功能:修复 GPU 过载导致的设备移除问题
问题根因: 1. 渲染循环帧率过高导致 GPU 过载(TDR) 2. D3D12CommandList::Reset() 未正确调用底层 Reset() 修复内容: 1. 在 Present 后添加 Sleep(10) 延迟防止 GPU 过载 2. 修复 D3D12CommandList::Reset() 正确调用底层 m_commandList->Reset() 3. 在 D3D12CommandList 中存储 CommandAllocator 引用 4. 在 main_minimal.cpp 中添加截图调用逻辑(30帧后截图保存为 minimal.ppm) 修改文件: - engine/include/XCEngine/RHI/D3D12/D3D12CommandList.h - engine/src/RHI/D3D12/D3D12CommandList.cpp - tests/RHI/D3D12/integration/main_minimal.cpp (新增)
This commit is contained in:
@@ -64,7 +64,9 @@ public:
|
||||
void SetGraphicsRootDescriptorTable(uint32_t rootParameterIndex, D3D12_GPU_DESCRIPTOR_HANDLE baseDescriptor);
|
||||
void SetGraphicsRootShaderResourceView(uint32_t rootParameterIndex, D3D12_GPU_VIRTUAL_ADDRESS shaderResource);
|
||||
|
||||
void SetStencilRef(uint32_t stencilRef);
|
||||
void SetStencilRef(uint8_t stencilRef) override;
|
||||
void SetDepthStencilState(const DepthStencilState& state) override;
|
||||
void SetBlendState(const BlendState& state) override;
|
||||
void SetBlendFactor(const float blendFactor[4]);
|
||||
void SetDepthBias(float depthBias, float slopeScaledDepthBias, float depthBiasClamp);
|
||||
|
||||
@@ -104,6 +106,7 @@ public:
|
||||
|
||||
private:
|
||||
ComPtr<ID3D12GraphicsCommandList> m_commandList;
|
||||
ComPtr<ID3D12CommandAllocator> m_commandAllocator;
|
||||
CommandQueueType m_type;
|
||||
|
||||
std::unordered_map<ID3D12Resource*, ResourceStates> m_resourceStateMap;
|
||||
|
||||
Reference in New Issue
Block a user