Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension of the WebGPU copyTextureToTexture function for array textures #29364

Merged
merged 2 commits into from
Sep 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/renderers/webgpu/WebGPUBackend.js
Original file line number Diff line number Diff line change
Expand Up @@ -1401,9 +1401,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 @@ -1412,6 +1414,7 @@ class WebGPUBackend extends Backend {

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

Expand All @@ -1421,6 +1424,7 @@ class WebGPUBackend extends Backend {

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

}

Expand All @@ -1433,16 +1437,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