Przeglądaj źródła

WebGPURenderer: Honor resolve flags in WebGPU backend. (#33946)

Michael Herzog 5 dni temu
rodzic
commit
a5b4ce6d22
1 zmienionych plików z 20 dodań i 2 usunięć
  1. 20 2
      src/renderers/webgpu/WebGPUBackend.js

+ 20 - 2
src/renderers/webgpu/WebGPUBackend.js

@@ -900,6 +900,8 @@ class WebGPUBackend extends Backend {
 
 
 		//
 		//
 
 
+		const renderTarget = renderContext.renderTarget;
+
 		if ( renderContext.depth ) {
 		if ( renderContext.depth ) {
 
 
 			if ( renderContext.clearDepth ) {
 			if ( renderContext.clearDepth ) {
@@ -913,7 +915,15 @@ class WebGPUBackend extends Backend {
 
 
 			}
 			}
 
 
-			depthStencilAttachment.depthStoreOp = GPUStoreOp.Store;
+			if ( renderContext.sampleCount > 1 && renderTarget?.resolveDepthBuffer === false ) {
+
+				depthStencilAttachment.depthStoreOp = GPUStoreOp.Discard;
+
+			} else {
+
+				depthStencilAttachment.depthStoreOp = GPUStoreOp.Store;
+
+			}
 
 
 		}
 		}
 
 
@@ -930,7 +940,15 @@ class WebGPUBackend extends Backend {
 
 
 			}
 			}
 
 
-			depthStencilAttachment.stencilStoreOp = GPUStoreOp.Store;
+			if ( renderContext.sampleCount > 1 && renderTarget?.resolveStencilBuffer === false ) {
+
+				depthStencilAttachment.stencilStoreOp = GPUStoreOp.Discard;
+
+			} else {
+
+				depthStencilAttachment.stencilStoreOp = GPUStoreOp.Store;
+
+			}
 
 
 		}
 		}
 
 

粤ICP备19079148号