New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 617410 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Email to this user bounced
Closed: Jul 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug

Blocking:
issue 429053



Sign in to add a comment

conformance2/rendering/draw-buffers.html fails on all desktop platforms

Project Member Reported by zmo@chromium.org, Jun 4 2016

Issue description

Comment 1 by zmo@chromium.org, Jun 4 2016

Cc: geoffl...@chromium.org
Qiankun will see if there is a desktop specific capability we need to enable/disable.

Geoff, have you run into the same issue already? Do you know a fix?
Here are my findings:

The ES spec that relates to multiple draw buffers is EXT_draw_buffers (https://www.khronos.org/registry/gles/extensions/EXT/EXT_draw_buffers.txt). This spec ONLY modifies ESSL1 and broadcasting only happens when EXT_draw_buffers is enabled in the ESSL 1 shader.  It's not possible to broadcast in ESSL 3 because there is no gl_FragColor variable.  See  Issue #3  in the extension spec for more details about this.

In the desktop GL spec (https://www.opengl.org/registry/doc/glspec45.compatibility.pdf) pg 569, it says that gl_FragColor only writes to the first color output.

The desktop GL extension, ARB_draw_buffers (https://www.opengl.org/registry/specs/ARB/draw_buffers.txt) adds the same behaviour as the ES extension (EXT_draw_buffers): writing to gl_FragColor should broadcast when enabled in the shader.

So, all potential driver bugs aside, we should be able to maintain the same behaviour between ES and desktop GL by making sure all uses of "#extension EXT_draw_buffers require" are translated to "#extension ARB_draw_buffers require". Also, we need to make sure that this extension isn't allowing users to write to gl_FragData in ESSL3.

Comment 3 by zmo@chromium.org, Jun 6 2016

On desktop GL 2.0 or later, since this is part of the core, do we still need to put "#extension ARB_draw_buffers require" in shaders?
My understanding is that ARB_draw_buffers adds additional broadcast logic when it is used.  The desktop GL spec says that there is no broadcasting when gl_FragColor is written while ARB_draw_buffers says it does broadcast.

Comment 5 by zmo@chromium.org, Jun 6 2016

Thanks for clarification.  Do you know if the necessary mapping has been implemented in ANGLE shader translator already?
It looks like it was not being translated correctly in ANGLE, that may be the source of this bug.  Uploaded an ANGLE CL: https://chromium-review.googlesource.com/#/c/350121/
Project Member

Comment 7 by bugdroid1@chromium.org, Jun 7 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/angle/angle/+/149a099948cb0ffdf31057d33d0e5d327079adcf

commit 149a099948cb0ffdf31057d33d0e5d327079adcf
Author: Geoff Lang <geofflang@chromium.org>
Date: Mon Jun 06 20:36:07 2016

Translate requirements of GL_EXT_draw_buffers to GL_ARB_draw_buffers.

GL_ARB_draw_buffers adds special semantics when writing to gl_FragData even
if multiple renderbuffers is part of the core spec so it needs to be declared
in the translated shader.

BUG= 617410 

Change-Id: Id5524634c278ba303413b11251d560744f2517ca
Reviewed-on: https://chromium-review.googlesource.com/350121
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>

[modify] https://crrev.com/149a099948cb0ffdf31057d33d0e5d327079adcf/src/compiler/translator/TranslatorGLSL.cpp

Project Member

Comment 8 by bugdroid1@chromium.org, Jun 9 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/79e6c2ffb7af1ef1f3dd9366f668feaa5c2ad444

commit 79e6c2ffb7af1ef1f3dd9366f668feaa5c2ad444
Author: jmadill <jmadill@chromium.org>
Date: Thu Jun 09 00:06:31 2016

Roll ANGLE 07529ff..768996c

https://chromium.googlesource.com/angle/angle.git/+log/07529ff..768996c

BUG= 617410 

TEST=bots
TBR=geofflang@chromium.org
CQ_INCLUDE_TRYBOTS=tryserver.chromium.win:win_optional_gpu_tests_rel;tryserver.chromium.mac:mac_optional_gpu_tests_rel;tryserver.chromium.linux:linux_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2042333005
Cr-Commit-Position: refs/heads/master@{#398741}

[modify] https://crrev.com/79e6c2ffb7af1ef1f3dd9366f668feaa5c2ad444/DEPS

Project Member

Comment 9 by bugdroid1@chromium.org, Jun 28 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/752745bf129932765a41eba1c26418fe1a54103a

commit 752745bf129932765a41eba1c26418fe1a54103a
Author: zmo <zmo@chromium.org>
Date: Tue Jun 28 03:53:00 2016

Roll WebGL 926e09c..e2281f5

https://chromium.googlesource.com/external/khronosgroup/webgl.git/+log/926e09c..e2281f5

BUG= 617410 
TEST=bots
TBR=kbr@chromium.org,xidachen@chromium.org
CQ_INCLUDE_TRYBOTS=tryserver.chromium.win:win_optional_gpu_tests_rel;tryserver.chromium.mac:mac_optional_gpu_tests_rel;tryserver.chromium.linux:linux_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2088393006
Cr-Commit-Position: refs/heads/master@{#402400}

[modify] https://crrev.com/752745bf129932765a41eba1c26418fe1a54103a/DEPS
[modify] https://crrev.com/752745bf129932765a41eba1c26418fe1a54103a/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py

conformance2's draw buffer test is currently failing on Linux NVIDIA and Linux Intel core profile. I believe the reason is that not writing to some buffers is an undefined behavior:

https://www.opengl.org/registry/doc/glspec45.core.pdf page 496
If some, but not all user-defined output variables are written, the values of fragment colors corresponding to unwritten variables are similarly undefined.

https://cvs.khronos.org/bugzilla/show_bug.cgi?id=13825#c5 points out that fragment colors not written are not the ones declared in the shader, but the ones declared in DrawBuffers.

The same is true in OpenGL ES 3, so we have an undefined behavior that is not addressed by WebGL 2 so it seems the draw buffer test is currently wrong in testing that non-written to buffers do not change.

Comment 11 by zmo@chromium.org, Jul 4 2016

WebGL 2 spec should get rid of that behavior by saying all unwritten variables are unchanged rather than undefined. I forgot if it's already in the spec or we plan to do so.

The draw-buffers bug on Linux NVidia is that the driver incorrectly broadcast gl_FragColor writing to all buffers, whereas only the first buffer should be written. I am not sure about the Intel driver behaviors as I don't have means to test it.
Cc: cwallez@chromium.org
It is not in the spec yet.

The draw buffer issue on desktop opengl on nvidia is that there is no gl_FragColor but instead there is an out variable. Only one of the draw buffers gets written to and not the others, which in the desktop spec leaves the others undefined and in nvidia's case does a broadcast.

Same thing for the test that says "test that an OpenGL ES Shading Language 3.00 shader with a single output color defaults to color number zero"

I'm not sure how to force a desktop opengl driver to leave the attachment unchanged, apart from editing glDrawBuffers on a program change.

Comment 13 by zmo@chromium.org, Jul 5 2016

We can call drawBuffers to unlink the attachments so they won't be touched.

Comment 14 by zmo@chromium.org, Jul 5 2016

Actually I forgot if it's setting them all to zero or unchanged when they are not written to.

Comment 15 by kbr@chromium.org, Jul 6 2016

It would be necessary to call DrawBuffers, passing NONE for each attachment that is desired to be preserved. Unfortunately, it might be necessary to do that on a per-draw call basis.

Status: Fixed (was: Assigned)
Mo, I think this is fixed with your spec and command buffer changes, closing.
Components: -Internals>GPU>WebGL Blink>WebGL

Sign in to add a comment