Browse Source

Fix more DX validation errors

Panagiotis Christopoulos Charitos 1 year ago
parent
commit
68a36e074d
2 changed files with 22 additions and 12 deletions
  1. 22 6
      AnKi/Gr/D3D/D3DCommandBuffer.cpp
  2. 0 6
      AnKi/Gr/D3D/D3DGrManager.cpp

+ 22 - 6
AnKi/Gr/D3D/D3DCommandBuffer.cpp

@@ -350,13 +350,29 @@ void CommandBuffer::beginRenderPass(ConstWeakArray<RenderTarget> colorRts, Rende
 			tex.getOrCreateDsv(depthStencilRt->m_textureView.getSubresource(), !(depthStencilRt->m_usage & TextureUsageBit::kRtvDsvWrite))
 				.getCpuOffset();
 
-		dsDesc.DepthBeginningAccess.Type = convertLoadOp(depthStencilRt->m_loadOperation);
-		dsDesc.DepthBeginningAccess.Clear.ClearValue.DepthStencil.Depth = depthStencilRt->m_clearValue.m_depthStencil.m_depth;
-		dsDesc.DepthEndingAccess.Type = convertStoreOp(depthStencilRt->m_storeOperation);
+		if(!!(depthStencilRt->m_textureView.getDepthStencilAspect() & DepthStencilAspectBit::kDepth))
+		{
+			dsDesc.DepthBeginningAccess.Type = convertLoadOp(depthStencilRt->m_loadOperation);
+			dsDesc.DepthBeginningAccess.Clear.ClearValue.DepthStencil.Depth = depthStencilRt->m_clearValue.m_depthStencil.m_depth;
+			dsDesc.DepthEndingAccess.Type = convertStoreOp(depthStencilRt->m_storeOperation);
+		}
+		else
+		{
+			dsDesc.DepthBeginningAccess.Type = D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_NO_ACCESS;
+			dsDesc.DepthEndingAccess.Type = D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_NO_ACCESS;
+		}
 
-		dsDesc.StencilBeginningAccess.Type = convertLoadOp(depthStencilRt->m_stencilLoadOperation);
-		dsDesc.StencilBeginningAccess.Clear.ClearValue.DepthStencil.Stencil = U8(depthStencilRt->m_clearValue.m_depthStencil.m_stencil);
-		dsDesc.StencilEndingAccess.Type = convertStoreOp(depthStencilRt->m_stencilStoreOperation);
+		if(!!(depthStencilRt->m_textureView.getDepthStencilAspect() & DepthStencilAspectBit::kStencil))
+		{
+			dsDesc.StencilBeginningAccess.Type = convertLoadOp(depthStencilRt->m_stencilLoadOperation);
+			dsDesc.StencilBeginningAccess.Clear.ClearValue.DepthStencil.Stencil = U8(depthStencilRt->m_clearValue.m_depthStencil.m_stencil);
+			dsDesc.StencilEndingAccess.Type = convertStoreOp(depthStencilRt->m_stencilStoreOperation);
+		}
+		else
+		{
+			dsDesc.StencilBeginningAccess.Type = D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_NO_ACCESS;
+			dsDesc.StencilEndingAccess.Type = D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_NO_ACCESS;
+		}
 
 		dsFormat = tex.getFormat();
 

+ 0 - 6
AnKi/Gr/D3D/D3DGrManager.cpp

@@ -49,12 +49,6 @@ static BoolCVar g_workGraphcsCVar(CVarSubsystem::kGr, "WorkGraphs", false, "Enab
 static void NTAPI d3dDebugMessageCallback([[maybe_unused]] D3D12_MESSAGE_CATEGORY category, D3D12_MESSAGE_SEVERITY severity,
 										  [[maybe_unused]] D3D12_MESSAGE_ID id, LPCSTR pDescription, [[maybe_unused]] void* pContext)
 {
-	if(id == D3D12_MESSAGE_ID_INCOMPATIBLE_BARRIER_LAYOUT)
-	{
-		// Skip for now
-		return;
-	}
-
 	if(!Logger::isAllocated())
 	{
 		printf("d3dDebugMessageCallback : %s", pDescription);