Texture2DArray and Compute Pipeline in DirectX12 (#15161)

Apparently, because PlaneSlice wasn't initialized, we couldn't use SDL_GPU_TEXTURETYPE_2D_ARRAY and SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE together, as the error d3d12:
"ID3D12Device::CreateUnorderedAccessView occurred: The PlaneSlice -858993460 is invalid when the resource format is R8G8B8A8_UNORM and the view format is R8G8B8A8_UNORM. Only Plane Slice 0 is valid when creating a view on a non-planar format. [ STATE_CREATION ERROR #344: CREATEUNORDEREDACCESSVIEW_INVALIDPLANESLICE]"

(cherry picked from commit 89cab56536)
This commit is contained in:
ImpDi
2026-03-04 11:19:45 +08:00
committed by Sam Lantinga
parent 4128c4e44b
commit 99a65853a6

View File

@@ -3635,6 +3635,7 @@ static D3D12Texture *D3D12_INTERNAL_CreateTexture(
uavDesc.Texture2DArray.MipSlice = levelIndex;
uavDesc.Texture2DArray.FirstArraySlice = layerIndex;
uavDesc.Texture2DArray.ArraySize = 1;
uavDesc.Texture2DArray.PlaneSlice = 0;
} else if (createinfo->type == SDL_GPU_TEXTURETYPE_3D) {
uavDesc.ViewDimension = D3D12_UAV_DIMENSION_TEXTURE3D;
uavDesc.Texture3D.MipSlice = levelIndex;