Parcourir la source

Windows 11 - fixed D3D12 ERROR: ID3D12DescriptorHeap::GetGPUDescriptorHandleForHeapStart: GetGPUDescriptorHandleForHeapStart is invalid to call on a descriptor heap that does not have DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE set. If the heap is not supposed to be shader visible, then GetCPUDescriptorHandleForHeapStart would be the appropriate method to call. That call is valid both for shader visible and non shader visible descriptor heaps. [ STATE_GETTING ERROR #1315: DESCRIPTOR_HEAP_NOT_SHADER_VISIBLE]

Jorrit Rouwe il y a 3 ans
Parent
commit
2b11f2bfb3
1 fichiers modifiés avec 4 ajouts et 2 suppressions
  1. 4 2
      TestFramework/Renderer/DescriptorHeap.h

+ 4 - 2
TestFramework/Renderer/DescriptorHeap.h

@@ -25,7 +25,8 @@ public:
 		mDescriptorSize = inDevice->GetDescriptorHandleIncrementSize(heap_desc.Type);
 		mDescriptorSize = inDevice->GetDescriptorHandleIncrementSize(heap_desc.Type);
 
 
 		// Delta between the CPU and GPU heap
 		// Delta between the CPU and GPU heap
-		mGPUOffset = mHeap->GetGPUDescriptorHandleForHeapStart().ptr - mHeap->GetCPUDescriptorHandleForHeapStart().ptr;
+		if (inFlags & D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE)
+			mGPUOffset = mHeap->GetGPUDescriptorHandleForHeapStart().ptr - mHeap->GetCPUDescriptorHandleForHeapStart().ptr;
 
 
 		// Populate the freelist
 		// Populate the freelist
 		mFreeList.reserve(inNumber);
 		mFreeList.reserve(inNumber);
@@ -58,6 +59,7 @@ public:
 	/// Convert from a CPU to a GPU handle
 	/// Convert from a CPU to a GPU handle
 	D3D12_GPU_DESCRIPTOR_HANDLE			ConvertToGPUHandle(D3D12_CPU_DESCRIPTOR_HANDLE inHandle)
 	D3D12_GPU_DESCRIPTOR_HANDLE			ConvertToGPUHandle(D3D12_CPU_DESCRIPTOR_HANDLE inHandle)
 	{
 	{
+		JPH_ASSERT(mGPUOffset != -1);
 		return { inHandle.ptr + mGPUOffset };
 		return { inHandle.ptr + mGPUOffset };
 	}
 	}
 
 
@@ -71,5 +73,5 @@ private:
 	ComPtr<ID3D12DescriptorHeap>		mHeap;
 	ComPtr<ID3D12DescriptorHeap>		mHeap;
 	uint								mDescriptorSize;				///< The size (in bytes) of a single heap descriptor
 	uint								mDescriptorSize;				///< The size (in bytes) of a single heap descriptor
 	vector<uint>						mFreeList;						///< List of indices in the heap that are still free
 	vector<uint>						mFreeList;						///< List of indices in the heap that are still free
-	INT64								mGPUOffset;						///< Offset between CPU and GPU handles
+	INT64								mGPUOffset = -1;				///< Offset between CPU and GPU handles
 };
 };