visgl / luma.gl

High-performance Toolkit for WebGL-based Data Visualization
https://luma.gl
Other
2.3k stars 211 forks source link

@luma.gl/webgl clear func causing an error #1903

Closed sakitam-fdd closed 3 weeks ago

sakitam-fdd commented 9 months ago

The status related to stencil seems to be set to the depth state, and I am not sure if this is intentional or a bug

https://github.com/visgl/luma.gl/blob/master/modules/webgl/src/classic/clear.ts#L53-L58

image

image

ibgreen commented 8 months ago

It looks like you are debugging your app with spector js and spector tries to read some data from luma.gl and does not see what it expected?

Not sure how to help you debug this.

sakitam-fdd commented 8 months ago

@ibgreen It occurs when clear is called, as shown in the following code

import { Framebuffer, Renderbuffer, Texture2D, clear } from '@luma.gl/webgl';

// other render pass
clear(this.gl, {
  color: true,
  stencil: true,
  // depth: false,
});

The error was raised when the depth parameter was not specified, and I noticed that when stencil was specified without depth, clearStencil had a value of null

if (stencil) {
  clearFlags |= GL_STENCIL_BUFFER_BIT;
  if (depth !== true) {
    parameters.clearStencil = depth;
  }
}

image

ibgreen commented 8 months ago

OK understood, yes it looks like a bug.