ANGLE reports that GL_ANGLE_framebuffer_multisample extension is present but glRenderbufferStorageMultisample is not working as expected on our code

332 views
Skip to first unread message

Roberto Garrido

unread,
Mar 17, 2015, 11:07:25 AM3/17/15
to anglep...@googlegroups.com
Hi all,
We are using in our Qt app the Qt distribution of ANGLE (ANGLE 2.1.30d6c255d238).
glGetString(GL_EXTENSIONS) is returning the follwing string:

GL_OES_element_index_uint GL_OES_packed_depth_stencil GL_OES_get_program_binary GL_OES_rgb8_rgba8 GL_EXT_texture_format_BGRA8888 GL_EXT_read_format_bgra GL_NV_pixel_buffer_object GL_OES_mapbuffer GL_EXT_map_buffer_range GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_float GL_OES_texture_float_linear GL_EXT_texture_rg GL_EXT_texture_compression_dxt1 GL_ANGLE_texture_compression_dxt3 GL_ANGLE_texture_compression_dxt5 GL_EXT_sRGB GL_ANGLE_depth_texture GL_EXT_texture_storage GL_OES_texture_npot GL_EXT_draw_buffers GL_EXT_texture_filter_anisotropic GL_EXT_occlusion_query_boolean GL_NV_fence GL_EXT_robustness GL_EXT_blend_minmax GL_ANGLE_framebuffer_blit GL_ANGLE_framebuffer_multisample GL_ANGLE_instanced_arrays GL_ANGLE_pack_reverse_row_order GL_OES_standard_derivatives GL_EXT_shader_texture_lod GL_EXT_frag_depth GL_ANGLE_texture_usage GL_ANGLE_translated_shader_source

As you can see, GL_ANGLE_framebuffer_multisample is there. So, in our code, after checking that the extension is present, we get the proc address of the gl function "glRenderbufferStorageMultisampleANGLE", with:

glRenderbufferStorageMultisample = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC)eglGetProcAddress("glRenderbufferStorageMultisampleANGLE");



The result is a not null function pointer, so we assume that it is correct. However, when we configure our multisample buffer, we are getting OpenGL errors. The buffer initialization code is like this:

    glGenRenderbuffers(1, &ColorBuffer);
    glBindRenderbuffer
(GL_RENDERBUFFER, ColorBuffer);
    glRenderbufferStorageMultisample
(GL_RENDERBUFFER, NumSamples, GL_RGBA8, viewport.width, viewport.height);


    glGenRenderbuffers
(1, &DepthStencilBuffer);
    glBindRenderbuffer
(GL_RENDERBUFFER, DepthStencilBuffer);
    glRenderbufferStorageMultisample
(GL_RENDERBUFFER, NumSamples, GL_DEPTH24_STENCIL8, viewport.width, viewport.height);


    glGenFramebuffers
(1, &FrameBuffer);
    glBindFramebuffer
(GL_FRAMEBUFFER, FrameBuffer);
    glFramebufferRenderbuffer
(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, ColorBuffer);
    glFramebufferRenderbuffer
(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, DepthStencilBuffer);
    glFramebufferRenderbuffer
(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, DepthStencilBuffer);


The above code, that was perfectly working on iOS (OpenGL ES 2) and Mac OSX (OpenGL 3), fails to work on OpenGL ES 2.0 (ANGLE) on certain machines. After the first call to glRenderbufferStorageMultisample, we check for GL errors and get GL_INVALID_VALUE. The number of samples passed is 4.

Also, surprisingly, the following sentence tells us that the max samples supported are 0:

    int maxSamples = 0;
    glGetIntegerv
(GL_MAX_SAMPLES_ANGLE, &maxSamples);

Any ideas on what could be happening?

Thanks in advance,
Robert. 

Jamie Madill

unread,
Mar 17, 2015, 11:22:17 AM3/17/15
to robertogar...@gmail.com, anglep...@googlegroups.com
Hey Robert,

What platform are you running ANGLE on? Do you know if it's a D3D9/D3D11 FL10+/D3D11 9 platform? I'm not sure entirely why you're getting a max sample count of zero, it would depend on the back-end.

It's definitely a bug that we're exposing the extension when our max sample count is zero, please open a bug on the angle issue tracker and cc me. Why you're getting zero is another matter, so more info could help, or someone experienced with Qt.

--
You received this message because you are subscribed to the Google Groups "angleproject" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angleproject...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Roberto Garrido

unread,
Mar 17, 2015, 11:37:52 AM3/17/15
to anglep...@googlegroups.com, robertogar...@gmail.com
Hi Jamie,
thanks for your response.

Here you have the renderer, GL Version, GL Shading Language Version and the Vendor:

Renderer: ANGLE (Intel(R) HD Graphics Direct3D11 vs_4_0 ps_4_0)
GL Version: OpenGL ES 2.0 (ANGLE 2.1.30d6c255d238)
GL Shading Language Version: OpenGL ES GLSL ES 1.00 (ANGLE 2.1.30d6c255d238)
Vendor: Google Inc.

Let me know if you need any other information.

By the way, this guy from the OpenGL forums is complaining about an Intel HD Graphics card that reports that GL_EXT_framebuffer_multisample extension is available, but GL_MAX_SAMPLES is giving an invalid value.
He is talking about desktop OpenGL but I think it could be translated to OpenGL ES. Seems that  the existence or not of certain extensions doesn't assure that you can use that functionality. 
A guy from the forum says: "The driver should not emit `GL_INVALID_ENUM` if ARB_framebuffer_object is supported and you use `glGetIntegerv` with `GL_MAX_SAMPLES`. However, that does not mean that multisampling is supported. The extension is very clear that `GL_MAX_SAMPLES` can be zero, in which case multisampling is not supported. The infrastructure for multisampling exists, but that doesn't mean you can use it."

So, maybe the right choice is to disable MSAA on our renderer if GL_MAX_SAMPLES_ANGLE is zero??


What do you think?

Thanks,
Robert.

Roberto Garrido

unread,
Mar 17, 2015, 11:40:48 AM3/17/15
to anglep...@googlegroups.com, robertogar...@gmail.com
Hey, some more information.
On my laptop (the one causing the issue), OpenGL Extensions Viewer is reporting as DirectX version: 9.0c - June 2010, 10.0. And shader model: vs_4_0 ps_4_0.

Cheers,
Robert.

Jamie Madill

unread,
Mar 17, 2015, 11:47:33 AM3/17/15
to robertogar...@gmail.com, anglep...@googlegroups.com
Hi Roberto,

I checked both the ANGLE spec and the GL_EXT_framebuffer_multisample, and they both list the minimum value for MAX_SAMPLES as 1, not 0. So we're out-of-spec here and should not be advertising the extension.

For your purposes, the idea to work around the issue by skipping multisampling when MAX_SAMPLES is zero sounds like a good one to me! Perhaps a Qt expert might have advice as well. Note that you're on the D3D11 back-end, so the D3D9 may or may not have different behaviour.

Shannon Woods

unread,
Mar 17, 2015, 11:54:06 AM3/17/15
to anglep...@googlegroups.com, robertogar...@gmail.com
Qt appears to do this for EXT_framebuffer_multisample: https://qt.gitorious.org/qt/qt-wayland/commit/24742e54332a71db0bc5ae7b1632924ae592aea7

We are out of spec, but I'm not sure that preventing advertisement of the extension is the appropriate fix. Why are we reporting zero for max samples? 1 is the number of samples for a non-multisampled renderbuffer, so any framebuffer with a color attachment should support at least MAX_SAMPLES = 1, shouldn't it?


On Tuesday, March 17, 2015 at 11:47:33 AM UTC-4, Jamie Madill wrote:
Hi Roberto,

I checked both the ANGLE spec and the GL_EXT_framebuffer_multisample, and they both list the minimum value for MAX_SAMPLES as 1, not 0. So we're out-of-spec here and should not be advertising the extension.

For your purposes, the idea to work around the issue by skipping multisampling when MAX_SAMPLES is zero sounds like a good one to me! Perhaps a Qt expert might have advice as well. Note that you're on the D3D11 back-end, so the D3D9 may or may not have different behaviour.
To unsubscribe from this group and stop receiving emails from it, send an email to angleproject+unsubscribe@googlegroups.com.

Geoff Lang

unread,
Mar 17, 2015, 12:20:23 PM3/17/15
to shanno...@chromium.org, anglep...@googlegroups.com, robertogar...@gmail.com
A sample count of 1 for GL means that multisampling rules should be used (D3D uses a sample count of 1 to indicate no multisampling). 

Shannon Woods

unread,
Mar 17, 2015, 1:08:26 PM3/17/15
to anglep...@googlegroups.com, shanno...@chromium.org, robertogar...@gmail.com
Isn't that largely a validation burden? Are we unable to implement 1-sample buffers using D3DMULTISAMPLE_NONE (which I thought was zero)?

Mark Callow

unread,
Mar 20, 2015, 7:15:49 PM3/20/15
to shanno...@chromium.org, anglep...@googlegroups.com, robertogar...@gmail.com


Are you perhaps changing to a different context after calling glGetString and checking for the extension? Sometimes extensions are supported only on some context types/versions/configs available in an implementation. Also note that eglGetProcAddr usually returns a non-null pointer if at least one context type/version/config supports the function being queried, regardless of support, if any, in the current context.

Regards

-Mark


signature.asc
Reply all
Reply to author
Forward
0 new messages