Fix format transfer shader

This commit is contained in:
cdozdil
2025-12-21 12:15:18 +03:00
parent 807906eee3
commit 3e185cdec9
2 changed files with 7 additions and 6 deletions
+4 -3
View File
@@ -75,6 +75,9 @@ bool Shader_Dx12::CreateBufferResource(ID3D12Device* InDevice, ID3D12Resource* I
inDesc.Height = InHeight;
}
if (InFormat != DXGI_FORMAT_UNKNOWN)
inDesc.Format = InFormat;
if (*OutResource != nullptr)
{
auto bufDesc = (*OutResource)->GetDesc();
@@ -102,8 +105,6 @@ bool Shader_Dx12::CreateBufferResource(ID3D12Device* InDevice, ID3D12Resource* I
}
inDesc.Flags |= ResourceFlags;
if (InFormat != DXGI_FORMAT_UNKNOWN)
inDesc.Format = InFormat;
hr = InDevice->CreateCommittedResource(&heapProperties, D3D12_HEAP_FLAG_NONE, &inDesc, InState, nullptr,
IID_PPV_ARGS(OutResource));
@@ -133,4 +134,4 @@ void Shader_Dx12::SetBufferState(ID3D12GraphicsCommandList* InCommandList, D3D12
InCommandList->ResourceBarrier(1, &barrier);
*BufferState = InState;
}
}
@@ -15,7 +15,7 @@ bool FT_Dx12::CreateBufferResource(ID3D12Device* InDevice, ID3D12Resource* InSou
auto resourceFlags = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET | D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS;
auto result = Shader_Dx12::CreateBufferResource(InDevice, InSource, InState, &_buffer, resourceFlags);
auto result = Shader_Dx12::CreateBufferResource(InDevice, InSource, InState, &_buffer, resourceFlags, 0, 0, format);
if (result)
{
@@ -74,8 +74,8 @@ bool FT_Dx12::Dispatch(ID3D12Device* InDevice, ID3D12GraphicsCommandList* InCmdL
UINT dispatchWidth = 0;
UINT dispatchHeight = 0;
dispatchWidth = static_cast<UINT>((bufferWidth + InNumThreadsX - 1) / InNumThreadsX);
dispatchHeight = (bufferHeight + InNumThreadsY - 1) / InNumThreadsY;
dispatchWidth = static_cast<UINT>((inDesc.Width + InNumThreadsX - 1) / InNumThreadsX);
dispatchHeight = (inDesc.Height + InNumThreadsY - 1) / InNumThreadsY;
InCmdList->Dispatch(dispatchWidth, dispatchHeight, 1);