D3D12Device: Fix incorrect subresource calculation

pull/3730/head
Stenzek 5 months ago
parent 730c44fef5
commit 414f9f64a4
No known key found for this signature in database

@ -1497,7 +1497,7 @@ void D3D12Device::ResolveTextureRegion(GPUTexture* dst, u32 dst_x, u32 dst_y, u3
{
D3D12_RECT src_rc{static_cast<LONG>(src_x), static_cast<LONG>(src_y), static_cast<LONG>(src_x + width),
static_cast<LONG>(src_y + height)};
cmdlist->ResolveSubresourceRegion(D->GetResource(), D->CalculateSubresource(dst_level, dst_layer), dst_x, dst_y,
cmdlist->ResolveSubresourceRegion(D->GetResource(), D->CalculateSubresource(dst_layer, dst_level), dst_x, dst_y,
S->GetResource(), 0, &src_rc, D->GetDXGIFormat(), D3D12_RESOLVE_MODE_AVERAGE);
}

@ -465,7 +465,7 @@ bool D3D12Texture::Update(u32 x, u32 y, u32 width, u32 height, const void* data,
D3D12_TEXTURE_COPY_LOCATION dstloc;
dstloc.pResource = m_resource.Get();
dstloc.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX;
dstloc.SubresourceIndex = layer;
dstloc.SubresourceIndex = CalculateSubresource(layer, level);
const D3D12_BOX srcbox{0u, 0u, 0u, width, height, 1u};
cmdlist->CopyTextureRegion(&dstloc, x, y, 0, &srcloc, &srcbox);
@ -548,7 +548,7 @@ void D3D12Texture::Unmap()
D3D12_TEXTURE_COPY_LOCATION dstloc;
dstloc.pResource = m_resource.Get();
dstloc.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX;
dstloc.SubresourceIndex = m_map_level;
dstloc.SubresourceIndex = CalculateSubresource(m_map_layer, m_map_level);
const D3D12_BOX srcbox{0u, 0u, 0u, m_map_width, m_map_height, 1};
cmdlist->CopyTextureRegion(&dstloc, m_map_x, m_map_y, 0, &srcloc, &srcbox);

Loading…
Cancel
Save