Fixed dispatch size calculation for FT_Dx12

This commit is contained in:
cdozdil
2025-10-27 17:19:02 +03:00
parent f0b73c97c5
commit 2df13acff1
2 changed files with 8 additions and 3 deletions
@@ -95,6 +95,9 @@ bool FT_Dx12::CreateBufferResource(ID3D12Device* InDevice, ID3D12Resource* InSou
texDesc.Format = format;
texDesc.Flags |= D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET | D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS;
bufferWidth = (uint32_t) texDesc.Width;
bufferHeight = texDesc.Height;
hr = InDevice->CreateCommittedResource(&heapProperties, D3D12_HEAP_FLAG_NONE, &texDesc, InState, nullptr,
IID_PPV_ARGS(&_buffer));
@@ -188,9 +191,8 @@ bool FT_Dx12::Dispatch(ID3D12Device* InDevice, ID3D12GraphicsCommandList* InCmdL
UINT dispatchWidth = 0;
UINT dispatchHeight = 0;
dispatchWidth =
static_cast<UINT>((State::Instance().currentFeature->DisplayWidth() + InNumThreadsX - 1) / InNumThreadsX);
dispatchHeight = (State::Instance().currentFeature->DisplayHeight() + InNumThreadsY - 1) / InNumThreadsY;
dispatchWidth = static_cast<UINT>((bufferWidth + InNumThreadsX - 1) / InNumThreadsX);
dispatchHeight = (bufferHeight + InNumThreadsY - 1) / InNumThreadsY;
InCmdList->Dispatch(dispatchWidth, dispatchHeight, 1);
@@ -19,6 +19,9 @@ class FT_Dx12
D3D12_GPU_DESCRIPTOR_HANDLE _gpuUavHandle[2] { { NULL }, { NULL } };
int _counter = 0;
uint32_t bufferWidth = 0;
uint32_t bufferHeight = 0;
uint32_t InNumThreadsX = 512;
uint32_t InNumThreadsY = 1;