Skip to content

Commit 18b66b7

Browse files
authored
Extension of the WebGPU copyTextureToTexture function for array textures (#29364)
* Extension of the copyTextureToTexture function to also be able to use array textures * Update WebGPUBackend.js remove empty space
1 parent 10a7df8 commit 18b66b7

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/renderers/webgpu/WebGPUBackend.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,9 +1365,11 @@ class WebGPUBackend extends Backend {
13651365

13661366
let dstX = 0;
13671367
let dstY = 0;
1368+
let dstLayer = 0;
13681369

13691370
let srcX = 0;
13701371
let srcY = 0;
1372+
let srcLayer = 0;
13711373

13721374
let srcWidth = srcTexture.image.width;
13731375
let srcHeight = srcTexture.image.height;
@@ -1376,6 +1378,7 @@ class WebGPUBackend extends Backend {
13761378

13771379
srcX = srcRegion.x;
13781380
srcY = srcRegion.y;
1381+
srcLayer = srcRegion.z || 0;
13791382
srcWidth = srcRegion.width;
13801383
srcHeight = srcRegion.height;
13811384

@@ -1385,6 +1388,7 @@ class WebGPUBackend extends Backend {
13851388

13861389
dstX = dstPosition.x;
13871390
dstY = dstPosition.y;
1391+
dstLayer = dstPosition.z || 0;
13881392

13891393
}
13901394

@@ -1397,16 +1401,17 @@ class WebGPUBackend extends Backend {
13971401
{
13981402
texture: sourceGPU,
13991403
mipLevel: level,
1400-
origin: { x: srcX, y: srcY, z: 0 }
1404+
origin: { x: srcX, y: srcY, z: srcLayer }
14011405
},
14021406
{
14031407
texture: destinationGPU,
14041408
mipLevel: level,
1405-
origin: { x: dstX, y: dstY, z: 0 }
1409+
origin: { x: dstX, y: dstY, z: dstLayer }
14061410
},
14071411
[
14081412
srcWidth,
1409-
srcHeight
1413+
srcHeight,
1414+
1
14101415
]
14111416
);
14121417

0 commit comments

Comments
 (0)