Skip to content

Commit 2d2697e

Browse files
authored
WebGPURenderer: copyTextureToTexture subframe upload and new API (#959)
* WebGPURenderer: copyTextureToTexture subframe upload and new API * Format * Update three.js * Add examples * Update patch * Delete examples
1 parent 9cd45b9 commit 2d2697e

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

examples-testing/changes.patch

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13679,7 +13679,7 @@ index ca0ae9e7..2125232e 100644
1367913679
const windowHalfY = window.innerHeight / 2;
1368013680

1368113681
diff --git a/examples-testing/examples/webgpu_materials_texture_partialupdate.ts b/examples-testing/examples/webgpu_materials_texture_partialupdate.ts
13682-
index 3fb91ed9..67f2f7bf 100644
13682+
index b25b4234..8f3d457b 100644
1368313683
--- a/examples-testing/examples/webgpu_materials_texture_partialupdate.ts
1368413684
+++ b/examples-testing/examples/webgpu_materials_texture_partialupdate.ts
1368513685
@@ -1,7 +1,12 @@
@@ -13696,7 +13696,12 @@ index 3fb91ed9..67f2f7bf 100644
1369613696

1369713697
let last = 0;
1369813698
const position = new THREE.Vector2();
13699-
@@ -79,7 +84,7 @@ async function animate() {
13699+
@@ -75,11 +80,11 @@ async function animate() {
13700+
13701+
// perform copy from src to dest texture to a random position
13702+
13703+
- renderer.copyTextureToTexture(dataTexture, diffuseMap, new THREE.Vector2(), position);
13704+
+ renderer.copyTextureToTexture(dataTexture, diffuseMap, null, position);
1370013705
}
1370113706
}
1370213707

types/three/examples/jsm/renderers/common/Renderer.d.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {
2+
Box2,
23
BufferGeometry,
34
Camera,
45
Color,
@@ -271,7 +272,13 @@ export default class Renderer {
271272

272273
copyFramebufferToTexture(framebufferTexture: FramebufferTexture): void;
273274

274-
copyTextureToTexture(position: Vector2, srcTexture: Texture, dstTexture: Texture, level?: number): void;
275+
copyTextureToTexture(
276+
srcTexture: Texture,
277+
dstTexture: Texture,
278+
srcRegion?: Box2 | null,
279+
dstPosition?: Vector2 | null,
280+
level?: number,
281+
): void;
275282

276283
readRenderTargetPixelsAsync(
277284
renderTarget: RenderTarget,

0 commit comments

Comments
 (0)