Skip to content

WebGPURenderer: Unable to remove map from SpotLight. #30930

@Mugen87

Description

@Mugen87

Description

Removing a map assigned to a spot light triggers a runtime error:

three.webgpu.js:26114 Uncaught TypeError: Invalid value used as weak map key
at WeakMap.set ()
at Textures.get (three.webgpu.js:26114:14)
at Textures.updateTexture (three.webgpu.js:28797:28)
at Bindings._update (three.webgpu.js:27704:20)
at Bindings._updateBindings (three.webgpu.js:27606:9)
at Bindings.updateForRender (three.webgpu.js:27593:8)
at WebGPURenderer._renderObjectDirect (three.webgpu.js:52189:19)
at WebGPURenderer.renderObject (three.webgpu.js:52128:9)
at WebGPURenderer._renderObjects (three.webgpu.js:52043:9)
at WebGPURenderer._renderScene (three.webgpu.js:50726:64)

I believe this happens since the renderer does not detect a new render object with a new node builder state is required in that case.

Reproduction steps

  1. Open https://threejs.org/examples/webgpu_lights_spotlight
  2. Use the GUI to change the map to null.
  3. Observe runtime error in browser console.

Code

see live example

Live example

https://threejs.org/examples/webgpu_lights_spotlight

Expected behavior visible in: https://threejs.org/examples/webgl_lights_spotlight

Screenshots

No response

Version

r175dev

Device

No response

Browser

No response

OS

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions