KhronosGroup / WebGL

The Official Khronos WebGL Repository
Other
2.66k stars 670 forks source link

Clarify WebGL2 invalidateFramebuffer() depth clear value #3661

Closed kkinnunen-apple closed 3 months ago

kkinnunen-apple commented 5 months ago

In OpenGL ES 3.0, after calling invalidateFramebuffer or invalidateSubFramebuffer, the affected region's contents become effectively undefined. In WebGL 2.0, it is required for the contents to either stay unchanged or become all 0.

If caller specifies GL_DEPTH_ATTACHMENT or GL_DEPTH_STENCIL_ATTACHMENT, the depth will be invalidated.

The spec now says that invalidated depth buffer is initialized to 0.0.

Contrast this to normal depth buffer initialization:

If initial data is not provided to these calls, the WebGL implementation must initialize their contents to 0; depth resources must be cleared to the default 1.0 clear depth.

Uninitialized depth buffer is specified to be initialized to 1.0.

Is this discrepancy intended?

kdashg commented 4 months ago

Yeah I think I made a mistake when I added this language, sorry!