Fix D3D multi-layer texture fallback upload alignment

This commit is contained in:
Chicken-Bones
2026-09-16 10:32:09 +10:00
committed by Ethan Lee
parent 53761230c9
commit d316e5b2f3

View File

@@ -6007,7 +6007,11 @@ static void D3D12_UploadToTexture(
needsPlacementCopy = source->offset % D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT != 0;
}
alignedBytesPerSlice = alignedRowPitch * destination->h;
alignedBytesPerSlice = alignedRowPitch * blockHeight;
if (!renderer->UnrestrictedBufferTextureCopyPitchSupported && destination->d > 1 && alignedBytesPerSlice % D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT != 0) {
needsRealignment = true;
alignedBytesPerSlice = D3D12_INTERNAL_Align(alignedBytesPerSlice, D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT);
}
sourceLocation.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT;
sourceLocation.PlacedFootprint.Footprint.Format = SDLToD3D12_TextureFormat[textureContainer->header.info.format];
@@ -6021,7 +6025,7 @@ static void D3D12_UploadToTexture(
temporaryBuffer = D3D12_INTERNAL_CreateBuffer(
d3d12CommandBuffer->renderer,
0,
alignedRowPitch * blockHeight * destination->d,
alignedBytesPerSlice * destination->d,
D3D12_BUFFER_TYPE_UPLOAD,
NULL);