Skip to content

Copying RenderTarget doesn't work with the WebGL fallback for the WebGPURenderer #31950

@Kycklingris

Description

@Kycklingris

Description

Copying a render target to a render target with copyTextureToTexture doesn't work with the WebGL fallback for WebGPURenderer, instead failing with the error "TypeError: Invalid value used as weak map key".

A quick log from chrome as jsfiddle doesn't exactly provide the best logging functionality

index.html:50 webgpu:
index.html:43 finished correctly
index.html:56 webgl:
index.html:61 TypeError: Invalid value used as weak map key
    at WeakMap.set (<anonymous>)
    at WebGLBackend.get (three.webgpu.js:59994:14)
    at WebGLTextureUtils.copyTextureToTexture (three.webgpu.js:62629:41)
    at WebGLBackend.copyTextureToTexture (three.webgpu.js:65685:21)
    at WebGPURenderer.copyTextureToTexture (three.webgpu.js:56292:16)
    at render (index.html:41:14)
    at async init (index.html:57:5)
(anonymous) @ index.html:61
Promise.catch
(anonymous) @ index.html:60

Reproduction steps

  1. Create a WebGPURenderer with forceWebGL set to true
  2. Create 2 RenderTargets
  3. call copyTextureToTexture between the two RenderTargets

Code

const renderer = new WebGPURenderer({ forceWebGL: true });
await renderer.init();

const src = new RenderTarget(100, 100);
const dst = new RenderTarget(100, 100);

renderer.copyTextureToTexture(src.texture, dst.texture);

Live example

Screenshots

No response

Version

r180 (also tried r170 but same issue)

Device

Desktop

Browser

Chrome

OS

Windows

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions