1
0
mirror of https://github.com/microsoft/DirectXTex synced 2024-11-21 20:10:05 +00:00

Fix of CaptureTexture for Reserved and MultiSample resources (#218)

This commit is contained in:
Boris Galochkin 2021-02-19 09:19:42 +03:00 committed by GitHub
parent fe43f39242
commit 87e5b0e9fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 13 deletions

View File

@ -141,12 +141,6 @@ namespace
return HRESULT_E_NOT_SUPPORTED;
}
D3D12_HEAP_PROPERTIES sourceHeapProperties;
D3D12_HEAP_FLAGS sourceHeapFlags;
HRESULT hr = pSource->GetHeapProperties(&sourceHeapProperties, &sourceHeapFlags);
if (FAILED(hr))
return hr;
numberOfResources = (desc.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D)
? 1u : desc.DepthOrArraySize;
numberOfResources *= desc.MipLevels;
@ -171,7 +165,9 @@ namespace
device->GetCopyableFootprints(&desc, 0, numberOfResources, 0,
pLayout, pNumRows, pRowSizesInBytes, &totalResourceSize);
if (sourceHeapProperties.Type == D3D12_HEAP_TYPE_READBACK)
D3D12_HEAP_PROPERTIES sourceHeapProperties;
HRESULT hr = pSource->GetHeapProperties(&sourceHeapProperties, nullptr);
if (SUCCEEDED(hr) && sourceHeapProperties.Type == D3D12_HEAP_TYPE_READBACK)
{
// Handle case where the source is already a staging texture we can use directly
pStaging = pSource;
@ -218,6 +214,7 @@ namespace
auto descCopy = desc;
descCopy.SampleDesc.Count = 1;
descCopy.SampleDesc.Quality = 0;
descCopy.Alignment = D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT;
ComPtr<ID3D12Resource> pTemp;
hr = device->CreateCommittedResource(

View File

@ -691,12 +691,8 @@ namespace
return HRESULT_E_NOT_SUPPORTED;
D3D12_HEAP_PROPERTIES sourceHeapProperties;
D3D12_HEAP_FLAGS sourceHeapFlags;
HRESULT hr = pSource->GetHeapProperties(&sourceHeapProperties, &sourceHeapFlags);
if (FAILED(hr))
return hr;
if (sourceHeapProperties.Type == D3D12_HEAP_TYPE_READBACK)
HRESULT hr = pSource->GetHeapProperties(&sourceHeapProperties, nullptr);
if (SUCCEEDED(hr) && sourceHeapProperties.Type == D3D12_HEAP_TYPE_READBACK)
{
// Handle case where the source is already a staging texture we can use directly
pStaging = pSource;
@ -745,6 +741,7 @@ namespace
auto descCopy = desc;
descCopy.SampleDesc.Count = 1;
descCopy.SampleDesc.Quality = 0;
descCopy.Alignment = D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT;
ComPtr<ID3D12Resource> pTemp;
hr = device->CreateCommittedResource(