Browse Source

fixed clear() when no render target

Nicolas Cannasse 1 year ago
parent
commit
09d248ae2b
1 changed files with 3 additions and 0 deletions
  1. 3 0
      h3d/impl/DX12Driver.hx

+ 3 - 0
h3d/impl/DX12Driver.hx

@@ -485,6 +485,9 @@ class DX12Driver extends h3d.impl.Driver {
 				}
 				}
 				frame.commandList.clearRenderTargetView(tmp.renderTargets[i], clear);
 				frame.commandList.clearRenderTargetView(tmp.renderTargets[i], clear);
 			}
 			}
+			// clear backbuffer
+			if( count == 0 )
+				frame.commandList.clearRenderTargetView(tmp.renderTargets[0], clear);
 		}
 		}
 		if( depth != null || stencil != null )
 		if( depth != null || stencil != null )
 			frame.commandList.clearDepthStencilView(tmp.depthStencils[0], depth != null ? (stencil != null ? BOTH : DEPTH) : STENCIL, (depth:Float), stencil);
 			frame.commandList.clearDepthStencilView(tmp.depthStencils[0], depth != null ? (stencil != null ? BOTH : DEPTH) : STENCIL, (depth:Float), stencil);