RESOLVED FIXED 87718
Shader compiler unprepared to make ESSL output when GLES is used
https://bugs.webkit.org/show_bug.cgi?id=87718
Summary Shader compiler unprepared to make ESSL output when GLES is used
Roland Takacs
Reported 2012-05-29 02:52:34 PDT
Shader compiler generate only GLSL output.
Attachments
patch (1.85 KB, patch)
2012-05-29 06:03 PDT, Roland Takacs
rtakacs: review-
rtakacs: commit-queue-
work in progress patch (3.91 KB, patch)
2012-05-30 05:53 PDT, Roland Takacs
rtakacs: review-
rtakacs: commit-queue-
WIP (4.19 KB, patch)
2012-06-04 07:19 PDT, Roland Takacs
rtakacs: review-
rtakacs: commit-queue-
patch (4.18 KB, patch)
2012-06-05 05:16 PDT, Roland Takacs
no flags
patch (4.14 KB, patch)
2012-06-06 01:07 PDT, Roland Takacs
webkit.review.bot: commit-queue-
Archive of layout-test-results from ec2-cr-linux-03 (2.80 MB, application/zip)
2012-06-06 15:32 PDT, WebKit Review Bot
no flags
patch (2.75 KB, patch)
2012-06-25 06:30 PDT, Roland Takacs
no flags
patch (3.83 KB, patch)
2012-06-25 10:46 PDT, Roland Takacs
noam: review-
buildbot: commit-queue-
patch (3.83 KB, patch)
2012-06-26 01:03 PDT, Roland Takacs
no flags
Roland Takacs
Comment 1 2012-05-29 06:03:50 PDT
Noam Rosenthal
Comment 2 2012-05-29 06:24:40 PDT
Comment on attachment 144534 [details] patch I'm ok with this, but I'd rather let mrobinson/kbr take a look since I don't usually review common ANGLE code.
Martin Robinson
Comment 3 2012-05-29 07:55:21 PDT
Comment on attachment 144534 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=144534&action=review > Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp:78 > +#if USE(OPENGL_ES_2) > + m_fragmentCompiler = ShConstructCompiler(SH_FRAGMENT_SHADER, SH_WEBGL_SPEC, SH_ESSL_OUTPUT, &m_resources); > + m_vertexCompiler = ShConstructCompiler(SH_VERTEX_SHADER, SH_WEBGL_SPEC, SH_ESSL_OUTPUT, &m_resources); > +#else > m_fragmentCompiler = ShConstructCompiler(SH_FRAGMENT_SHADER, SH_WEBGL_SPEC, SH_GLSL_OUTPUT, &m_resources); > m_vertexCompiler = ShConstructCompiler(SH_VERTEX_SHADER, SH_WEBGL_SPEC, SH_GLSL_OUTPUT, &m_resources); > +#endif Perhaps this should be a runtime decision based on the result of isGLES2Compliant. Theoretically a compilation could support both OpenGL and OpenGL ES and I think this is the direction GTK+ is moving.
Roland Takacs
Comment 4 2012-05-29 08:57:31 PDT
(In reply to comment #3) > (From update of attachment 144534 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=144534&action=review > > > Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp:78 > > +#if USE(OPENGL_ES_2) > > + m_fragmentCompiler = ShConstructCompiler(SH_FRAGMENT_SHADER, SH_WEBGL_SPEC, SH_ESSL_OUTPUT, &m_resources); > > + m_vertexCompiler = ShConstructCompiler(SH_VERTEX_SHADER, SH_WEBGL_SPEC, SH_ESSL_OUTPUT, &m_resources); > > +#else > > m_fragmentCompiler = ShConstructCompiler(SH_FRAGMENT_SHADER, SH_WEBGL_SPEC, SH_GLSL_OUTPUT, &m_resources); > > m_vertexCompiler = ShConstructCompiler(SH_VERTEX_SHADER, SH_WEBGL_SPEC, SH_GLSL_OUTPUT, &m_resources); > > +#endif > > Perhaps this should be a runtime decision based on the result of isGLES2Compliant. Theoretically a compilation could support both OpenGL and OpenGL ES and I think this is the direction GTK+ is moving. You are right, the solution is better (and nicer) with isGLES2Compliant. I will do it!
Kenneth Russell
Comment 5 2012-05-29 11:23:01 PDT
Agreed, isGLES2Compliant is the better way to make this decision. To see how Chromium handles this, see GLES2DecoderImpl::InitializeShaderTranslator in src/gpu/command_buffer/service/gles2_cmd_decoder.cc and ShaderTranslator::Init and src/gpu/command_buffer/service/shader_translator.cc under http://src.chromium.org/viewvc/chrome/trunk/ .
Roland Takacs
Comment 6 2012-05-30 05:53:10 PDT
Created attachment 144790 [details] work in progress patch Is it appropriate? If yes I will add the initializeShaderCompilers method to the build files. Otherwise please let me know how you imagine it.
Noam Rosenthal
Comment 7 2012-05-30 07:12:11 PDT
Comment on attachment 144790 [details] work in progress patch View in context: https://bugs.webkit.org/attachment.cgi?id=144790&action=review I think this is the right direction, though has some style issues, as appropriate to a WIP patch :) > Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp:71 > + ShShaderOutput shader_output = (isGLES2 ? SH_ESSL_OUTPUT : SH_GLSL_OUTPUT); style. > Source/WebCore/platform/graphics/ANGLEWebKitBridge.h:56 > + bool initializeShaderCompilers(bool isGLES2); This is kind of a boolean trap. I'd rather have an enum.
Roland Takacs
Comment 8 2012-06-04 07:19:51 PDT
Created attachment 145581 [details] WIP should I to add my new function into some build file?
Noam Rosenthal
Comment 9 2012-06-04 07:31:11 PDT
Comment on attachment 145581 [details] WIP Wouldn't this break ports that don't use GraphicsContext3DOpenGLCommon.cpp?
Martin Robinson
Comment 10 2012-06-04 07:56:25 PDT
Comment on attachment 145581 [details] WIP View in context: https://bugs.webkit.org/attachment.cgi?id=145581&action=review > Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:470 > + if (!(isGLES2Compliant() ? m_compiler.initializeShaderCompilers(SH_ESSL_OUTPUT) : m_compiler.initializeShaderCompilers(SH_GLSL_OUTPUT))) This is a slightly odd choice... I probably would have written: if (!m_compiler.initializeShaderCompilers(isGLES2Compliant() ? SH_ESSL_OUTPUT : SH_GLSL_OUTPUT)) return;
Kenneth Russell
Comment 11 2012-06-04 12:40:36 PDT
(In reply to comment #9) > (From update of attachment 145581 [details]) > Wouldn't this break ports that don't use GraphicsContext3DOpenGLCommon.cpp? It might break ports that support WebGL, use ANGLEWebKitBridge, but don't use GraphicsContext3DOpenGLCommon. I don't know which ports those might be (Qt?). Chromium doesn't use ANGLEWebKitBridge.
Noam Rosenthal
Comment 12 2012-06-04 13:25:34 PDT
(In reply to comment #11) > (In reply to comment #9) > > (From update of attachment 145581 [details] [details]) > > Wouldn't this break ports that don't use GraphicsContext3DOpenGLCommon.cpp? > I don't really know. Does Mac use any of this stuff? Qt uses GC3DOpenGLCommon.
Kenneth Russell
Comment 13 2012-06-04 13:55:14 PDT
(In reply to comment #12) > (In reply to comment #11) > > (In reply to comment #9) > > > (From update of attachment 145581 [details] [details] [details]) > > > Wouldn't this break ports that don't use GraphicsContext3DOpenGLCommon.cpp? > > > I don't really know. Does Mac use any of this stuff? > Qt uses GC3DOpenGLCommon. The Mac port uses GC3DOpenGLCommon.
Noam Rosenthal
Comment 14 2012-06-04 14:01:30 PDT
(In reply to comment #13) > (In reply to comment #12) > > (In reply to comment #11) > > > (In reply to comment #9) > > > > (From update of attachment 145581 [details] [details] [details] [details]) > > > > Wouldn't this break ports that don't use GraphicsContext3DOpenGLCommon.cpp? > > > > > I don't really know. Does Mac use any of this stuff? > > Qt uses GC3DOpenGLCommon. > > The Mac port uses GC3DOpenGLCommon. OK then. This looks an ok direction to me, though Martin's comments are valid.
Roland Takacs
Comment 15 2012-06-05 05:16:20 PDT
Roland Takacs
Comment 16 2012-06-06 01:07:47 PDT
Created attachment 145957 [details] patch updated the changelog because since yesterday the changelog is changed.
WebKit Review Bot
Comment 17 2012-06-06 15:32:27 PDT
Comment on attachment 145957 [details] patch Attachment 145957 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/12908084 New failing tests: css1/font_properties/font.html
WebKit Review Bot
Comment 18 2012-06-06 15:32:32 PDT
Created attachment 146128 [details] Archive of layout-test-results from ec2-cr-linux-03 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: ec2-cr-linux-03 Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'> Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Noam Rosenthal
Comment 19 2012-06-07 06:42:21 PDT
(In reply to comment #18) > Created an attachment (id=146128) [details] > Archive of layout-test-results from ec2-cr-linux-03 > > The attached test failures were seen while running run-webkit-tests on the chromium-ews. > Bot: ec2-cr-linux-03 Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'> Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick This looks flaky.
Noam Rosenthal
Comment 20 2012-06-08 14:23:44 PDT
*** Bug 60617 has been marked as a duplicate of this bug. ***
Martin Robinson
Comment 21 2012-06-13 11:10:58 PDT
Comment on attachment 145957 [details] patch This patch introduces a way to misuse the ANGLEWebKitBridge, by running validateShaderSource without calling initializeShaderCompilers first. I think it would be better for ANGLEWebKitBridge to take a ShShaderOutput argument in the constructor and then to call initializeShaderCompilers during the first call to validateShaderSource. At the very least validateShaderSource should ASSERT builtCompilers.
Martin Robinson
Comment 22 2012-06-13 11:12:14 PDT
(In reply to comment #21) > At the very least validateShaderSource should ASSERT builtCompilers. By the way, apologies for not noticing this in an earlier review!
Roland Takacs
Comment 23 2012-06-25 06:30:17 PDT
Created attachment 149280 [details] patch If I add a new argument to the ANGLEWebKitBridge constructor, the m_compiler (member of GraphicsContext3D class) must be initialized with the parameter at the GraphicsContext3D constructor ( on qt, this located at the GraphicsContext3DQt.cpp ). If I would like to initialize the m_compiler (ANGLEWebKitBridge) at the GC3D constructor, it looks like: GraphicsContext3D::GraphicsContext3D(....) : ..... , ..... #if (opengles) , m_compiler(SH_ESSL_OUTPUT) #else , m_compiler(SH_GLSL_OUTPUT) #endif , ... , ... So I could not initialize the m_compiler runtime (with isGles2Compliant()) only compiling time. [AFAIK] Because of this, I would rather add a new member ( m_shaderOutput) to ANGLEWebKitBridge, and it is initialized at its constructor by macro checking. Let me know how do you think if it not the best solution. :)
Martin Robinson
Comment 24 2012-06-25 08:24:07 PDT
(In reply to comment #23) > Created an attachment (id=149280) [details] > patch > > If I add a new argument to the ANGLEWebKitBridge constructor, the m_compiler (member of GraphicsContext3D class) must be initialized with the parameter at the GraphicsContext3D constructor ( on qt, this located at the GraphicsContext3DQt.cpp ). > > If I would like to initialize the m_compiler (ANGLEWebKitBridge) at the GC3D constructor, it looks like: > > GraphicsContext3D::GraphicsContext3D(....) > : ..... > , ..... > #if (opengles) > , m_compiler(SH_ESSL_OUTPUT) > #else > , m_compiler(SH_GLSL_OUTPUT) > #endif > , ... > , ... > isGles2Compliant is not virtual, so it should be safe to call it during construction. Does: m_compile(isGles2Compliant() ? SH_ESSL_OUTPUT : SH_GLSL_OUTPUT) work?
Roland Takacs
Comment 25 2012-06-25 10:46:09 PDT
Noam Rosenthal
Comment 26 2012-06-25 11:29:05 PDT
Comment on attachment 149322 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=149322&action=review > Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp:35 > +ANGLEWebKitBridge::ANGLEWebKitBridge(ShShaderOutput shaderOutput = SH_GLSL_OUTPUT) : Shouldn't the default argument be in the header?
Build Bot
Comment 27 2012-06-25 11:38:39 PDT
Noam Rosenthal
Comment 28 2012-06-25 12:12:54 PDT
Comment on attachment 149322 [details] patch Patch doesn't compile, default argument is at the wrong place.
Roland Takacs
Comment 29 2012-06-26 01:02:43 PDT
(In reply to comment #26) > (From update of attachment 149322 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=149322&action=review > > > Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp:35 > > +ANGLEWebKitBridge::ANGLEWebKitBridge(ShShaderOutput shaderOutput = SH_GLSL_OUTPUT) : > > Shouldn't the default argument be in the header? Yes, you are right. Fixed.
Roland Takacs
Comment 30 2012-06-26 01:03:46 PDT
WebKit Review Bot
Comment 31 2012-06-26 06:07:33 PDT
Comment on attachment 149474 [details] patch Clearing flags on attachment: 149474 Committed r121259: <http://trac.webkit.org/changeset/121259>
WebKit Review Bot
Comment 32 2012-06-26 06:07:42 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.