Просмотр исходного кода

WebGPURenderer: Fix viewport/scissor after `copyFramebufferToTexture()` (#29978)

sunag 1 год назад
Родитель
Сommit
5855564118
1 измененных файлов с 15 добавлено и 1 удалено
  1. 15 1
      src/renderers/webgpu/WebGPUBackend.js

+ 15 - 1
src/renderers/webgpu/WebGPUBackend.js

@@ -1539,7 +1539,7 @@ class WebGPUBackend extends Backend {
 		encoder.copyTextureToTexture(
 			{
 				texture: sourceGPU,
-				origin: { x: rectangle.x, y: rectangle.y, z: 0 }
+				origin: [ rectangle.x, rectangle.y, 0 ],
 			},
 			{
 				texture: destinationGPU
@@ -1568,6 +1568,20 @@ class WebGPUBackend extends Backend {
 			renderContextData.currentPass = encoder.beginRenderPass( descriptor );
 			renderContextData.currentSets = { attributes: {}, bindingGroups: [], pipeline: null, index: null };
 
+			if ( renderContext.viewport ) {
+
+				this.updateViewport( renderContext );
+
+			}
+
+			if ( renderContext.scissor ) {
+
+				const { x, y, width, height } = renderContext.scissorValue;
+
+				renderContextData.currentPass.setScissorRect( x, y, width, height );
+
+			}
+
 		} else {
 
 			this.device.queue.submit( [ encoder.finish() ] );

粤ICP备19079148号