Skip to content

Commit

Permalink
Extension of the WebGPU copyTextureToTexture function for array textu…
Browse files Browse the repository at this point in the history
…res (#29364)

* Extension of the copyTextureToTexture function to also be able to use array textures

* Update WebGPUBackend.js

remove empty space
  • Loading branch information
Spiri0 authored Sep 8, 2024
1 parent 10a7df8 commit 18b66b7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/renderers/webgpu/WebGPUBackend.js
Original file line number Diff line number Diff line change
Expand Up @@ -1365,9 +1365,11 @@ class WebGPUBackend extends Backend {

let dstX = 0;
let dstY = 0;
let dstLayer = 0;

let srcX = 0;
let srcY = 0;
let srcLayer = 0;

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

srcX = srcRegion.x;
srcY = srcRegion.y;
srcLayer = srcRegion.z || 0;
srcWidth = srcRegion.width;
srcHeight = srcRegion.height;

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

dstX = dstPosition.x;
dstY = dstPosition.y;
dstLayer = dstPosition.z || 0;

}

Expand All @@ -1397,16 +1401,17 @@ class WebGPUBackend extends Backend {
{
texture: sourceGPU,
mipLevel: level,
origin: { x: srcX, y: srcY, z: 0 }
origin: { x: srcX, y: srcY, z: srcLayer }
},
{
texture: destinationGPU,
mipLevel: level,
origin: { x: dstX, y: dstY, z: 0 }
origin: { x: dstX, y: dstY, z: dstLayer }
},
[
srcWidth,
srcHeight
srcHeight,
1
]
);

Expand Down

0 comments on commit 18b66b7

Please sign in to comment.