Skip to content

WebGPURenderer clear() function does not work [WebGPU Only] #30757

@Bug-Reaper

Description

@Bug-Reaper

Description

Couldn't for the life of me get a canvas that had been saturated by webGPURenderer to be cleared. It also yielded no warnings or errors.

Trying to run myWebGPURenderer.clear() basically no-ops and the last thing drawn remains on canvas

NOTE: The webgl2 fallback works fine! It is only when renderer is in new webgpu mode that clear() is nonfunctional. I can replicate this bug 100% consistency even with basic setup.

Reproduction steps

  1. Render anything to the screen via webGPURenderer(). Must not use webGL2 fallback!
  2. cancelAnimationFrame() your render loop
  3. Run myWebGPURenderer.clear()
  4. Canvas still dirty with the last thing drawn.

Code

// This was my best attempt 
setClearColor(0x000000, 0)
gpu.setClearAlpha(0)
gpu.clear()
// Nothing happens if just above is run, canvas still dirty with the last drawn frame :(

gpuComposer.render()
// All black opaque screen from empty composer render()

Live example

Holy cow finally got the fiddle up. We pull the plug here in a setTimeout and you can watch the canvas not be cleared after 3 seconds.

    setTimeout(()=>{
      cancelAnimationFrame(frame);
      renderer.setClearColor(0xFF0000,0);
      renderer.clear();
    },3000)

Screenshots

No response

Version

r174

Device

Desktop

Browser

Chrome

OS

MacOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions