google / filament

Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS, and WebGL2
https://google.github.io/filament/
Apache License 2.0
17.82k stars 1.89k forks source link

WebGL triangle demo has GL_INVALID_FRAMEBUFFER_OPERATION #3128

Closed prideout closed 3 years ago

prideout commented 4 years ago

The web demos all work except the triangle demo, which does not render anything and emits the following in the console:

 glBlitFramebufferCHROMIUM: framebuffer incomplete

The triangle demo is the only WebGL demo that enables multisampling.

prideout commented 4 years ago

This GL error occurs when the GL_DRAW_FRAMEBUFFER status is the following:

GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE

which means that the following spec clause has been violated:

The value of RENDERBUFFER_SAMPLES [must be] the same for all
attached renderbuffers and, if the attached images are a mix of
renderbuffers and textures, the value of RENDERBUFFER_SAMPLES
is zero.
romainguy commented 3 years ago

Is this fixed now?

prideout commented 3 years ago

I can still reproduce this (Chrome 87 + macOS Catalina)

Mivr commented 3 years ago

Hi,

I experience the same error ([.WebGL-0x395e5c67d000] GL_INVALID_FRAMEBUFFER_OPERATION: Framebuffer is incomplete.). In the following demos/tutorials: https://google.github.io/filament/webgl/tutorial_triangle.html https://google.github.io/filament/webgl/tutorial_redball.html https://google.github.io/filament/webgl/tutorial_suzanne.html https://google.github.io/filament/webgl/parquet.html https://google.github.io/filament/webgl/suzanne.html https://google.github.io/filament/webgl/helmet.html

The system is Ubuntu 20.04 Chrome version: 87.0.4280.88

P.S. Surprisingly https://prideout.net/knotess/ demo works just fine for me.

cx20 commented 3 years ago

@Mivr This is a known issue. Try Nightly Build.

https://github.com/google/filament/issues/3352

prideout commented 3 years ago

On my machine (2017 MacBook), Chrome 87 does not support EXT_multisampled_render_to_texture so the following path is taken:

OpenGLDriver::createRenderTarget is creating two attachments: COLOR_ATTACHMENT0 and DEPTH_ATTACHMENT. The render target has 4 samples. The color attachment has 1 sample and the depth attachment has 4 samples. The usage flags are appropriately marked such that the color attachment is SAMPLEABLE and the depth attachment is not.

The here we emulate ext.EXT_multisampled_render_to_texture path is taken for both attachments. Thus, ultimately there are four attachments: 1) renderbuffer attachment with 4 samples for color 2) non-ms texture attachment for color 3) renderbuffer attachment with 4 samples for depth 4) non-ms texture attachment for depth

This violates the spec rule that was mentioned in my Sept 28 comment, which was sourced from the ES 3.0 spec under Whole Framebuffer Completeness. This spec language was changed with ES 3.1. It became:

The value of RENDERBUFFER_SAMPLES [must be] the same for all attached renderbuffers;
the value of TEXTURE_SAMPLES is the same for all attached textures; and, if the attached
images are a mix of renderbuffers and textures, the value of RENDERBUFFER_SAMPLES
matches the value of TEXTURE_SAMPLES.

In theory Filament supports OpenGL ES 3.0, so we are non-conformant here. Also note that WebGL 2.0 is based on OpenGL ES 3.0.

romainguy commented 3 years ago

@pixelflinger

pixelflinger commented 3 years ago

grrr

DylanYasen commented 3 years ago

following. getting the same error when msaa is enabled on webgl build.

OSX Chrome: 87.0.4280.141 Filament: 1.9.8

Firefox 78.6.1esr (blitFramebuffer: framebuffer not complete)

cx20 commented 3 years ago

@prideout I am pleased with the release of Filament v1.9.11. However, I still seem to get an error on the Triangle Demo page. https://google.github.io/filament/webgl/tutorial_triangle.html

I think the version of Filament.js used in the demo page is old. (I think it's about v1.7.x) https://google.github.io/filament/webgl/filament.js

prideout commented 3 years ago

Thanks @cx20 , we'll update the site.

edit: This is done.