diff options
| author | lucy96chen <47800040+lucy96chen@users.noreply.github.com> | 2022-04-07 11:11:45 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-07 11:11:45 -0700 |
| commit | 2aac3700741f47caa6e8d674872979e2cdc251ab (patch) | |
| tree | 02e750f77fa40f4f397e4698f06e05e15e38be16 /tools/gfx/d3d12/render-d3d12.cpp | |
| parent | 86221ff4757ee504307f3537b34acb05117ce272 (diff) | |
Texture views/shapes tests part 1 (#2179)
* Framework for texture views testing working; Small tweaks to texture testing utils; Changed D3D12 readTextureResource to account for non-1 depth
* Basic framework for texture views tests working; Test file needs a rename at some point
* 1D, 2D, and 3D textures working for ShaderResource, UnorderedAccess, and RenderTarget tests; Fixed some small issues with handling the depth field of 3D textures in Vulkan causing incorrectly cleared textures
Diffstat (limited to 'tools/gfx/d3d12/render-d3d12.cpp')
| -rw-r--r-- | tools/gfx/d3d12/render-d3d12.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/gfx/d3d12/render-d3d12.cpp b/tools/gfx/d3d12/render-d3d12.cpp index a5b584349..657769284 100644 --- a/tools/gfx/d3d12/render-d3d12.cpp +++ b/tools/gfx/d3d12/render-d3d12.cpp @@ -668,7 +668,7 @@ Result DeviceImpl::captureTextureToSurface( size_t rowPitch = int(desc.Width) * bytesPerPixel; static const size_t align = 256; // D3D requires minimum 256 byte alignment for texture data. rowPitch = (rowPitch + align - 1) & ~(align - 1); // Bit trick for rounding up - size_t bufferSize = rowPitch * int(desc.Height); + size_t bufferSize = rowPitch * int(desc.Height) * int(desc.DepthOrArraySize); if (outRowPitch) *outRowPitch = rowPitch; if (outPixelSize) @@ -717,7 +717,7 @@ Result DeviceImpl::captureTextureToSurface( dstLoc.PlacedFootprint.Footprint.Format = desc.Format; dstLoc.PlacedFootprint.Footprint.Width = UINT(desc.Width); dstLoc.PlacedFootprint.Footprint.Height = UINT(desc.Height); - dstLoc.PlacedFootprint.Footprint.Depth = 1; + dstLoc.PlacedFootprint.Footprint.Depth = UINT(desc.DepthOrArraySize); dstLoc.PlacedFootprint.Footprint.RowPitch = UINT(rowPitch); encodeInfo.d3dCommandList->CopyTextureRegion(&dstLoc, 0, 0, 0, &srcLoc, nullptr); @@ -1749,7 +1749,7 @@ Result DeviceImpl::createTextureView( rtvDesc.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE3D; rtvDesc.Texture3D.MipSlice = desc.subresourceRange.mipLevel; rtvDesc.Texture3D.FirstWSlice = desc.subresourceRange.baseArrayLayer; - rtvDesc.Texture3D.WSize = desc.subresourceRange.layerCount; + rtvDesc.Texture3D.WSize = (desc.subresourceRange.layerCount == 0) ? -1 : desc.subresourceRange.layerCount; break; case IResource::Type::Buffer: rtvDesc.ViewDimension = D3D12_RTV_DIMENSION_BUFFER; |
