src/compiler/translator/TranslatorGLSL.cpp


Log

Author Commit Date CI Message
Shahbaz Youssefi 061188a7 2021-08-04T10:07:47 Translator: General clean up General clean up done as part of other changes, split to simplify review. Bug: angleproject:4889 Bug: angleproject:6132 Change-Id: Iade9954d187a759be9edd0e3754be007f4133c56 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3071598 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 1ce78397 2021-07-30T16:51:45 Remove support for WEBGL_debug_shader_precision This extension was rejected, and the implementation was hacky. This clean up is part of an ongoing work to improve precision handling. Bug: angleproject:6059 Change-Id: If08581ec6f19cf1698ffa3dd6d248dc5e68a1d31 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3064303 Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi b8d6f8aa 2021-07-22T22:31:29 Translator: Facilitate integration in FireFox Instead of relying on is_apple to build workarounds applied on apple hardware, a new build argument is added for this purpose. This allows FireFox to more easily include these files in their build system (which builds every workaround on every platform). The workarounds are reorganized too and moved from tree_ops/gl/mac to tree_ops/apple. RewriteRowMajorMatrices is moved there too as it's now used by both gl and metal. This workaround is large, and removing it from non-apple builds improves binary size (~40KB on Linux). Bug: angleproject:6188 Change-Id: I8e1dab44d0235bb6b8341d53721bdd0d157d46c6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3047385 Reviewed-by: Jeff Gilbert <jgilbert@mozilla.com> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi af1eed2e 2021-06-10T01:55:59 Vulkan: Generate gl_FragColor/Data declarations in AST gl_FragColor and gl_FragData are not available in Vulkan. Prior to this change, their declaration as webgl_FragColor and webgl_FragData was done in text. This change implements an AST transformation that declares a normal fragment output variable and replaces all references to these built-ins with those variables. Bug: angleproject:4889 Change-Id: If224e089dec25e4aa580beb135e1be2890de7887 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2953042 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Brandon Schade 69f2fb00 2021-03-08T10:49:31 Vulkan: Expose OES_geometry_shader extension Modify the symbol table generation script to accept a list of supported extensions. This allows for the EXT and OES versions of the geometry shader extension to be exposed. Test: angle_deqp_khr_gles31_tests --deqp-case=*geometry_shader* Bug: angleproject:3571 Change-Id: Ia7127a03dbd3fce78957f0505d3ce0c9bab6cb15 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2765011 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 013613ea 2021-06-08T01:33:30 Translator: Allow invariant on I/O block members The GLSL ES 3.2 spec says: > Only variables output from a shader can be candidates for invariance. And: > All uses of invariant must be at global scope or on block members, and > before any use of the variables being declared as invariant. As a result, it's possible to specify `invariant` on a member of an output I/O block. Bug: angleproject:4889 Change-Id: I8822ed214813db8424d6a67dfef7f069a448b19d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2946115 Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 1b680b77 2021-06-02T22:04:45 Reland "Make SH_CLAMP_INDIRECT_ARRAY_BOUNDS do proper AST transformation" This is a reland of a474fd7de769ae817db83490d410510cdbed75b2 The integer clamp used in this transformation is not available in es100 shaders, and float clamp is used instead. Original change's description: > Make SH_CLAMP_INDIRECT_ARRAY_BOUNDS do proper AST transformation > > This translator flag adds a clamp to non-literal indices to arrays. Two > strategies were provisioned, using the clamp intrinsic or a hand-written > function. The latter is ununsed in angle, chromium, firefox and > webkit, so this change removes this option and uses the clamp intrinsic > unconditionally. > > The clamp itself was added at output generation time with special flags > set on the index node. This is changed such that a proper AST > transformation is done and no-special handling would be necessary. > > Bug: angleproject:4361 > Bug: angleproject:4889 > Change-Id: Ieccfd2c1c347563fb5282e9fa66d39304e62f2ca > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2935041 > Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Bug: angleproject:4361 Bug: angleproject:4889 Change-Id: I9397ec7e6bdfb706c2a891b33fd3b2b79e883ccc Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2940902 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Yuly Novikov 10f15011 2021-06-03T19:22:53 Revert "Make SH_CLAMP_INDIRECT_ARRAY_BOUNDS do proper AST transformation" This reverts commit a474fd7de769ae817db83490d410510cdbed75b2. Reason for revert: breaks GLES2ConformTest, see roll into Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/2935093 Original change's description: > Make SH_CLAMP_INDIRECT_ARRAY_BOUNDS do proper AST transformation > > This translator flag adds a clamp to non-literal indices to arrays. Two > strategies were provisioned, using the clamp intrinsic or a hand-written > function. The latter is ununsed in angle, chromium, firefox and > webkit, so this change removes this option and uses the clamp intrinsic > unconditionally. > > The clamp itself was added at output generation time with special flags > set on the index node. This is changed such that a proper AST > transformation is done and no-special handling would be necessary. > > Bug: angleproject:4361 > Bug: angleproject:4889 > Change-Id: Ieccfd2c1c347563fb5282e9fa66d39304e62f2ca > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2935041 > Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Bug: angleproject:4361 Bug: angleproject:4889 Change-Id: I911cfe0199b04dbc3d6d4265775b6c2de00a9777 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2937024 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Shahbaz Youssefi a474fd7d 2021-06-02T22:04:45 Make SH_CLAMP_INDIRECT_ARRAY_BOUNDS do proper AST transformation This translator flag adds a clamp to non-literal indices to arrays. Two strategies were provisioned, using the clamp intrinsic or a hand-written function. The latter is ununsed in angle, chromium, firefox and webkit, so this change removes this option and uses the clamp intrinsic unconditionally. The clamp itself was added at output generation time with special flags set on the index node. This is changed such that a proper AST transformation is done and no-special handling would be necessary. Bug: angleproject:4361 Bug: angleproject:4889 Change-Id: Ieccfd2c1c347563fb5282e9fa66d39304e62f2ca Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2935041 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Kyle Piddington d7aa0130 2021-04-26T16:56:15 Upstream Apple's direct-to-Metal backend: compile translator. This change is meant to merge the translator changes from Apple's direct-to-Metal backend. Taken from Kyle Piddington's CL: https://chromium-review.googlesource.com/c/angle/angle/+/2857366/ The goal of this CL is to merge the translator code in a state that compiles, but not to switch the Metal backend over to use this translator backend yet. Bug: angleproject:5505 Change-Id: I68a6354604498cd5fd1eb96c13fc56f3b38f2bd0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2897536 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Shahbaz Youssefi bd2954a9 2021-01-16T11:33:12 Reland "Cleanup translator option checks" This reverts commit 9173e01730923823846348e513bb8cbe7eddbbe5. Reason for revert: This was in a chain of reverts, but is unrelated to the issue. Original change's description: > Revert "Cleanup translator option checks" > > This reverts commit 9710c4e473c88a38f11eb10c600717181d6e24df. > > Reason for revert: > Earlier CL breaks pre-rotation: > https://chromium-review.googlesource.com/c/angle/angle/+/2598584 > > Original change's description: > > Cleanup translator option checks > > > > Use comparison with 0 for explicit conversion to bool. > > > > Bug: angleproject:3606 > > Change-Id: Ie0a76d7df829227c1376894535813b54e13491b4 > > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2631689 > > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > > Reviewed-by: Charlie Lao <cclao@google.com> > > Reviewed-by: Jamie Madill <jmadill@chromium.org> > > TBR=syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com > > Change-Id: Ib597a62f3c7078d28f7f5b79d1cc9f8d9e469c31 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: angleproject:3606 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2634047 > Reviewed-by: Tim Van Patten <timvp@google.com> > Commit-Queue: Tim Van Patten <timvp@google.com> TBR=timvp@google.com,syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com Bug: angleproject:3606 Change-Id: I10ecca63a3db6dbc3ddedf5bb7e5319a82a80a30 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2633712 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Tim Van Patten 9173e017 2021-01-16T00:10:34 Revert "Cleanup translator option checks" This reverts commit 9710c4e473c88a38f11eb10c600717181d6e24df. Reason for revert: Earlier CL breaks pre-rotation: https://chromium-review.googlesource.com/c/angle/angle/+/2598584 Original change's description: > Cleanup translator option checks > > Use comparison with 0 for explicit conversion to bool. > > Bug: angleproject:3606 > Change-Id: Ie0a76d7df829227c1376894535813b54e13491b4 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2631689 > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Charlie Lao <cclao@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> TBR=syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com Change-Id: Ib597a62f3c7078d28f7f5b79d1cc9f8d9e469c31 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:3606 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2634047 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 9710c4e4 2021-01-14T22:41:48 Cleanup translator option checks Use comparison with 0 for explicit conversion to bool. Bug: angleproject:3606 Change-Id: Ie0a76d7df829227c1376894535813b54e13491b4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2631689 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 382bf288 2020-12-24T23:56:39 Organize AST transforms per backend Most of the AST transforms are written as a workaround to an issue that affects a single backend. This change identifies such transforms and organizes them by backend. They are then only built if the respective backend is. Additionally, about half of the GL transforms are due to mac workarounds, including the large RewriteRowMajorMatrices transform. Mac-specific workarounds are additionally only built on said platform. This change reduces the ANGLE binary size: - 106KB in a Vulkan-only build on Linux - 27KB in a GL-only build on Android (60KB on Linux) Bug: chromium:1084580 Bug: chromium:1161513 Change-Id: I64b334332c0d4f848756c6538af0d8d96864c7e9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2601346 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill 43acf3ba 2020-07-31T15:43:57 GL: Compiler changes for GL_OES_texture_buffer This extension is core in GLES 3.2 This CL enables the extension, added 412 new dEQP tests for texture buffer. 410 of these tests pass, but there are two tests that fail, detailed in anglebug.com/4933 Also includes a fix for completeness checks. Based on a CL by Jonah Ryan-Davis. Bug: angleproject:3573 Bug: angleproject:4933 Change-Id: I45759d765c88c64f21b592eab01d910dc4bc8da3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2521239 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Jonah Ryan-Davis eadc387c 2020-04-01T16:53:31 GL: Support GL_OES_texture_cube_map_array in shader translator GL_OES_texture_cube_map_array is core in 3.2. This CL adds support for this extension in the shader translator. Now passes dEQP.KHR_GLES31/core_texture_cube_map_array.*, dEQP.GLES31/functional_fbo_color_texcubearray_*, and dEQP.GLES31/functional_opaque_type_indexing*samplercubearray* with GL backend. Bug: angleproject:3584 Change-Id: I1a8485c7d9d3fffb9b5109d292b35b0c56a3c665 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2133086 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Geoff Lang 36c938e0 2020-03-31T12:42:16 GL: Ignore warnings about requested extensions not being present. Some drivers emit warnings about enabled extensions not being present dispite the 'enable' flag only being a request. Supress these warnings to clean up the Chrome console. Also request GL_EXT_gpu_shader5 in addition to GL_ARB_gpu_shader5 to maximize reach. BUG=chromium:1066212 Change-Id: If48cc60b8533f6ffedb727e845a4ca784d98c07c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2129111 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Tobin Ehlis a1ceb87b 2020-02-25T11:58:19 Vulkan:Refactor precision emulation code GLSL, ESSL, and HLSL translators all had the same code to emulate precision so migrate that code to base class. This is a structural change to prepare for honoring precision qualifiers in the Vulkan translator as well, which is done in a follow-on commit. Bug: angleproject:3078 Change-Id: Id85bba83543189e3bbc4002be92b056e63afc8de Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2072644 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Tobin Ehlis <tobine@google.com>
Kenneth Russell e196bc85 2020-01-17T13:11:20 Add driver bug workaround for rewriting row major matrices. Joint work with syoussefi@, who wrote the RewriteRowMajorMatrices pass, and revised it for this CL to not rely on the NameNamelessUniformBuffers pass - which was breaking it on the GL backend. Hook up previously written RewriteRowMajorMatrices transformation, and enable on all GPU types on macOS. It is needed at least for AMD and Intel GPUs. Add a new test which verifies the behavior of dynamically-indexed arrays of row-major matrices. Bug: angleproject:2273 Bug: angleproject:3843 Change-Id: Id582f9cf6b9b1a59091aab1786539174f360b705 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2008717 Commit-Queue: Kenneth Russell <kbr@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi 230e14dd 2020-01-21T23:32:06 Add support for layout(early_fragment_tests) in; Bug: angleproject:4314 Change-Id: I37b228f37201cc4188834e68459cd7294727c3ac Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2014240 Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Artem Bolgar ffdd58f5 2019-12-28T15:34:41 Fixing OVR_multiview and OVR_multiview2 issues Found two issues when native OVR_multiview and OVR_multiview2 extensions are generated. 1. OVR_multiview got replaced by the OVR_multiview2 in the translated shader (ESSL & GLSL) 2. Duplicate #extension OVR_multiview2 (for Fragment & Vertex) and 'layout (num_views=x)' (for Vertex) got generated into the translated shader. Bug: angleproject:4247 Change-Id: I9a550883eeb326d95af4557578f8202a9493f4ec Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1983802 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi 472c74c6 2019-08-19T16:32:13 Translator: Allow tree validation in children of TCompiler This is to be able to perform validation inside TranslatorVulkan, even if it's through ASSERTs. Additionally, every transformation is changed such that they do their validation themselves. TIntermTraverser::updateTree() performs the validation, which indirectly validates many of three tree transformations. Some of the more ancient transformations that don't use this function directly call TCompiler::validateAST. Bug: angleproject:2733 Change-Id: Ie4af029d34e053c5ad1dc8c2c2568eecd625d344 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1761149 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Stuart Morgan 9d737966 2019-08-14T12:25:12 Standardize copyright notices to project style For all "ANGLE Project" copyrights, standardize to the format specified by the style guide. Changes: - "Copyright (c)" and "Copyright(c)" changed to just "Copyright". - Removed the second half of date ranges ("Y1Y1-Y2Y2"->"Y1Y1"). - Fixed a small number of files that had no copyright date using the initial commit year from the version control history. - Fixed one instance of copyright being "The ANGLE Project" rather than "The ANGLE Project Authors" These changes are applied both to the copyright of source file, and where applicable to copyright statements that are generated by templates. BUG=angleproject:3811 Change-Id: I973dd65e4ef9deeba232d5be74c768256a0eb2e5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1754397 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi f92fc916 2019-07-15T22:39:23 Vulkan: Compute shader support A DispatchHelper class is created as the equivalent of FramebufferHelper as a command graph resource. There's currently a single dispatcher and all dispatch calls are recorded on that. Context dirty bits are set up in such a way that graphics and compute workloads are independently handled, so that issuing a dispatch call wouldn't cause a framebuffer's render pass to rebind resources. Bug: angleproject:3562 Change-Id: Ib96db48297074d99b04324e44b067cfbfd43e333 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1688504 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jeff Gilbert d9fa0744 2019-04-25T14:57:26 Emit OVR_multiview2 on ESSL/GLSL outputs. Add ARB_shader_viewport_layer_array support to SH_SELECT_VIEW_IN_NV_GLSL_VERTEX_SHADER. Bug: angleproject:3404 Change-Id: Ia89517d0cc92400ce47c9118e8c1abf8285aec41 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1585452 Reviewed-by: Jamie Madill <jmadill@chromium.org>
Mingyu Hu ebab670c 2019-04-19T14:36:45 Adding new extension GL_OVR_multiview GL_OVR_multiview functions exactly the same as GL_OVR_multiview2. All GL_OVR_multiview2 tests now also repeat the same test using GL_OVR_multiview Bug: angleproject:3341 Change-Id: I7e5294fb6bbf7692535174a15da6a42e1b5fc4e2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1575904 Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Mingyu Hu 7d64c486 2019-03-12T14:27:40 GL_ANGLE_multiview has been renamed to GL_OVR_multiview2. changes include: 1) GL_OVR_multiview to GL_OVR_multiview2 extension directive change 2) Removal of all references to side by side. We no longer support multiple views in a single 2DTexture. Only 2DTextureArray's are supported 3) WebGL 2 (ES3) is required for multiview Bug: angleproject:3341 Change-Id: Ie0c1d21d7610f8feebdb2e4d01c6947f57e69328 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1552023 Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill b980c563 2018-11-27T11:34:27 Reformat all cpp and h files. This applies git cl format --full to all ANGLE sources. Bug: angleproject:2986 Change-Id: Ib504e618c1589332a37e97696cdc3515d739308f Reviewed-on: https://chromium-review.googlesource.com/c/1351367 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Yizhou Jiang 7818a85c 2018-09-06T15:02:04 Implement GL_ANGLE_texture_multisample API part Support GL_ANGLE_texture_multisample extension. This patch adds enums of multisampled texture and texStorage2DMultisampleANGLE API. TEST=angle_end2end_tests.exe --gtest_filter=TextureMultisampleTest* TEST=angle_end2end_tests.exe --gtest_filter=NegativeTextureMultisampleTest.Negtive* BUG=angleproject:2275 Change-Id: I2cab997edc33aa2d0be6082381545335423f64e0 Reviewed-on: https://chromium-review.googlesource.com/c/804613 Commit-Queue: Yizhou Jiang <yizhou.jiang@intel.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho 6f591c97 2018-09-21T11:20:47 Clean up TCompiler members and style Some dead code and duplicate data are cleaned up from the compiler. Several parameters can be accessed directly from ShBuiltInResources instead of creating a copy in TCompiler. This also encapsulates some TCompiler member functions as private and changes the remaining unprefixed TCompiler member variable names to start with the m prefix. BUG=angleproject:2068 TEST=angle_unittests Change-Id: I6690aaf538b17e0f45460660272a21f82f1808a0 Reviewed-on: https://chromium-review.googlesource.com/c/1267503 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho a07b4213 2018-03-22T16:13:13 Move AST transformations to a subdirectory Move AST transformations to compiler/translator/tree_ops. BUG=angleproject:2409 TEST=angle_unittests Change-Id: I9c620e98707d22d005da6192fe7d1b4e8030aadd Reviewed-on: https://chromium-review.googlesource.com/975550 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 68981eb5 2018-01-23T17:46:12 Track parameter qualifiers of functions in call nodes We now add a reference to TFunction to all TIntermAggregate nodes where it is possible, including built-in ops. We also make sure that internal TFunctions added in traversers have correct parameter qualifiers. This makes TLValueTrackingTraverser much simpler. Instead of storing traversed functions or looking up builtin functions from the symbol table, determining which function parameters are out parameters can now be done simply by looking it up from the function symbol associated with the aggregate node. Symbol instances are no longer deleted when a symbol table level goes out of scope, and TFunction destructor no longer clears the parameters. They're all either statically allocated or pool allocated, so this does not result in leaks. TEST=angle_unittests BUG=angleproject:2267 Change-Id: I57e5570da5b5a69a98a8778da3c2dc82b6284738 Reviewed-on: https://chromium-review.googlesource.com/881324 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jiawei Shao bd924af1 2017-11-16T15:28:04 ES31: Remove support of GL_OES_geometry_shader in compiler This patch intends to remove the support of GL_OES_geometry_shader in ANGLE compiler. To make the implementation simpler, currently we decide to only support "GL_EXT_geometry_shader" as the extension string of geometry shader in ANGLE. This patch also updates all the related shaders in angle_unittests into R"()" format. BUG=angleproject:1941 TEST=angle_unittests Change-Id: Ife9858abeedfb46b02c5c2fb1cda16fa27198511 Reviewed-on: https://chromium-review.googlesource.com/773451 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho ebe13bb1 2017-12-11T13:32:44 Remove SH_TRANSLATE_VIEWID_OVR_TO_UNIFORM Instanced multiview is fully implemented and performs much better than broadcasting draw calls on the CPU. There's no need to maintain translating ViewID_OVR to a uniform. BUG=angleproject:2267 TEST=angle_unittests Change-Id: If3a8fa573f37b7926c052aecfcd4271f266751dc Reviewed-on: https://chromium-review.googlesource.com/819417 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 89a69a03 2017-10-23T12:20:45 Generate performance warnings in HLSL translation Generate performance warnings for some code that undergoes heavy emulation when translated to HLSL: 1. Dynamic indexing of vectors and matrices. 2. Non-empty fall-through cases in switch/case. The warnings are generated only when code is translated to HLSL. Generating them in the parsing stage would add too much maintenance burden. Improves switch statement fall-through handling in cases where an empty fall-through case follows a non-empty one so that extra performance warnings are not generated. BUG=angleproject:1116 Change-Id: I7c85d78fe7c4f8e6042bda72ceaaf6e37dadfe6c Reviewed-on: https://chromium-review.googlesource.com/732986 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 2a1e8f95 2017-07-14T11:49:36 Refer to GLSL extensions through TExtension enum Extensions are now referred to by enum values instead of strings most of the time. This gets rid of unnecessary copying of strings. The code is easier to work with than before as typoing the extension enum names will be caught by the compiler. BUG=angleproject:2147 TEST=angle_unittests Change-Id: Ifa61b9f86ef03211188fc23bc23a5ce4e4d8c390 Reviewed-on: https://chromium-review.googlesource.com/571002 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho ec3a9cbb 2017-09-07T12:18:01 Only support GL_OVR_multiview extension variant The WebGL spec proposal was changed so that only GL_OVR_multiview extension name is supported, instead of having two variants OVR_multiview and OVR_multiview2. We're only supporting the WebGL version of the shader extension, so we drop compiler support for GL_OVR_multiview2. Shader restrictions were also removed from the WebGL spec, so no special validation for how ViewID_OVR gets used is needed. Tests that were testing for the shader restrictions are either removed or changed from negative tests to positive tests. BUG=angleproject:1669 TEST=angle_unittests Change-Id: I83f92b879376d41b727b5aca419fd75fb6f53477 Reviewed-on: https://chromium-review.googlesource.com/654608 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho c634a637 2017-05-18T14:09:49 Remove webgl_ prefix from emulated function names The prefix is unnecessary now that user-defined names are prefixed in both GLSL and HLSL output. Removing the prefix makes compiler output a bit simpler to read. BUG=angleproject:2038 TEST=angle_unittests Change-Id: I9ffc508f50d6146a2d85798875c88e2c385b83fe Reviewed-on: https://chromium-review.googlesource.com/508730 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Shao b5cc1198 2017-07-06T10:47:20 ES31: Add Geometry Shader layout qualifiers in GLSL compiler This patch intends to implement Geometry Shader layout qualifiers required in OpenGL ES 3.1 extension GL_OES_geometry_shader in ANGLE GLSL compiler. 1. Add support to the shader type GL_GEOMETRY_SHADER_OES. 2. Implement Geometry Shader layout qualifiers in the GLSL compiler: (1) Add support to OpenGL ES 3.1 extension "GL_OES_geometry_shader". (2) Add validations of the input and output primitive declarations in the Geometry Shader layout declarations. (3) Add 'invocations' and 'max_vertices' support in the Geometry Shader layout declarations 3. Add unit tests to cover all the new features added in this patch. BUG=angleproject:1941 TEST=angle_unittests Change-Id: Ie693e11f8a00dab3552626ed63e9336c7fbd3cb8 Reviewed-on: https://chromium-review.googlesource.com/560647 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho a5e693af 2017-07-13T16:07:26 Make unique id counter a member of TSymbolTable This makes unique id counting thread-safe. BUG=angleproject:624 TEST=angle_unittests Change-Id: Ie0f2c7e574470b39750d37d2181c790bc874b275 Reviewed-on: https://chromium-review.googlesource.com/570419 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Martin Radev c39a19aa 2017-07-07T18:52:09 Select viewport index in the GLSL/ESSL vertex shader The patch enables viewport selection for multiview rendering in the GLSL/ESSL vertex shader through the use of the GL_NV_viewport_array2 extension. The AST is modified only for GLSL and ESSL to include the viewport selection expression after ViewID_OVR's initialization. BUG=angleproject:2062 TEST=angle_unittests Change-Id: Iee05bb5a4b687ed53ddbdd466f1572227b1f0cde
Olli Etuaho 5df2b9d2 2017-05-18T12:15:28 Clean up AddDefaultReturnStatements It doesn't need to use a traverser, since all function definitions can be found simply by iterating over the children of the root node. BUG=angleproject:2040 TEST=angle_end2end_tests Change-Id: I380942f90a0e73152f296b98d1fb027762d913b0 Reviewed-on: https://chromium-review.googlesource.com/508689 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho dfa75e87 2017-01-23T09:43:06 Add support for 4-parameter functions to BuiltInFunctionEmulator New entry points are needed to support built-ins with more parameters. Also, now that ops that are not function calls don't use the TIntermAggregate class any more, it's easier to exclude nodes that are not candidates for built-in emulation using a simple blacklist rather than to use a whitelist. Also includes function name style cleanup in BuiltInFunctionEmulator. This will make it possible to add necessary emulation for built-ins from ESSL 3.10. BUG=angleproject:1730 TEST=angle_unittests Change-Id: If267fc68f5cb9b2ee6703cbcbbe4d157da44a7e0 Reviewed-on: https://chromium-review.googlesource.com/431297 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 2f90a9b5 2017-01-10T12:27:56 Fix shader support of OVR_multiview Fix up incorrect capitalization of gl_ViewID_OVR in a few places. Also add extension macro test to compiler unit tests. BUG=angleproject:1669 TEST=angle_unittests Change-Id: Ia7fdd747ad08355cdc149db9e2e7911c2e673af5 Reviewed-on: https://chromium-review.googlesource.com/425851 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 09b04a2f 2016-12-15T13:30:26 Add shader translator support for OVR_multiview The OVR_multiview and OVR_multiview2 extensions add gl_ViewID_OVR to shaders. gl_ViewID_OVR can be translated either as is in GLSL output or as a uniform by setting the SH_TRANSLATE_VIEWID_OVR_AS_UNIFORM compiler flag. If WebGL output is selected, the shaders will be validated according to proposed rules in the WEBGL_multiview spec. BUG=angleproject:1669 TEST=angle_unittests Change-Id: I19ea3a6c8b4edb78be03f1a50a96bfef018870d0 Reviewed-on: https://chromium-review.googlesource.com/422848 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho da9fb093 2016-12-09T17:32:29 Work around atan(y, x) bug on NVIDIA atan(y, x) is not always returning expected results on NVIDIA OpenGL drivers between versions 367 and 375. Work around this by emulating atan(y, x) using the regular atan(x) function. A fix to the driver is expected in a future release. It is most convenient to implement the vector atan(y, x) functions by using the scalar atan(y, x) function. Support for simple dependencies between emulated functions is added to BuiltInFunctionEmulator. In the current implementation one function is allowed to have at most one other function as its dependency. BUG=chromium:672380 TEST=angle_end2end_tests Change-Id: I9eba8b0b7979c7c7eaed353b264932e41830beb1 Reviewed-on: https://chromium-review.googlesource.com/419016 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill d7b1ab58 2016-12-12T14:42:19 Fix up translator style. Using git cl format. BUG=angleproject:650 Change-Id: I7d3f98d2b0dcfb0a8de6c35327db74e55c28d761 Reviewed-on: https://chromium-review.googlesource.com/419059 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Qiankun Miao f52fe93d 2016-12-07T13:39:15 Work around unary minus operator float issue on Intel Mac 10.11 Result of -float is wrong on Intel Mac 10.11 drivers. Replace -float with 0.0 - float to work around this issue. BUG=308366 BUG=672380 Change-Id: I53bc2eda7259fff5805bec39896fc7b7a6eaf665 Reviewed-on: https://chromium-review.googlesource.com/417169 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 8c04d077 2016-12-09T15:30:48 Make minimum GLSL version for compute shaders GLSL 430 Compute shaders were added to the core OpenGL spec in version 4.3. Also don't output GL_ARB_explicit_attrib_location extension directive for compute shaders. This extension is only relevant for vertex and fragment shaders. BUG=angleproject:1442 TEST=angle_end2end_tests Change-Id: I92021ac048b38ffbc5a61af408b37c387193389b Reviewed-on: https://chromium-review.googlesource.com/418657 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Corentin Wallez 729a9c97 2016-12-05T14:22:47 Don't require GL_ARB_gpu_shader5 in order to support ES 3.0. ES 3.0 doesn't require non-constant sampler array indexing, and we can't require it for ES 2 without breaking WebGL for some users. BUG=671280 Change-Id: Ib04446284acc92410a90c683a3d222871de554a8 Reviewed-on: https://chromium-review.googlesource.com/416195 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Qiankun Miao 41f9f673 2016-11-16T17:04:36 Remove invariant qualifier for ESSL 3.0 on AMD driver AMD driver in Linux requires invariant qualifier to match between shaders even for GLSL >= 4.2. This conflicts with ESSL 3.0 which disallows invariant qualifier in fragment shader. Remove invariant qualifier in vertex shader to workaround AMD driver bug. BUG=chromium:639760 TEST=webgl2_conformance Change-Id: Id5adf7e7032105486df90a1f200471ea81ee5c36 Reviewed-on: https://chromium-review.googlesource.com/411917 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Zhenyao Mo <zmo@chromium.org>
Qiankun Miao 89dd8f37 2016-11-09T12:59:30 Remove invariant declaration in vertex shader for translation from ESSL 3.00 to GLSL <= 4.1 This is a follow-up patch of https://chromium-review.googlesource.com/408569. This CL removes invariant declaration in ESSL 3.00 vertex shader, such like: " out vec4 foo; invariant foo; " This CL also adds the workarounds in libANGLE. BUG=chromium:639760 TEST=webgl2_conformance Change-Id: I568ab51a9a2f5da10d1aff0b63aae8805097e081 Reviewed-on: https://chromium-review.googlesource.com/409157 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill acb4b81a 2016-11-07T13:50:29 translator: Put ShaderLang APIs in "sh" namespace. Working with glslang in Vulkan means we are static linking libANGLE with functions that have the same name as our translator APIs. We can fix this by scoping our APIs. We don't need to scope the types of the file, since they don't conflict. This will require a follow-up patch to remove the unscoped APIs once we switch over Chromium. We also scope TCompiler and some related classes to avoid multiply defined link errors with glslang. BUG=angleproject:1576 Change-Id: I729b19467d2ff7d374a82044b16dbebdf2dc8f16 Reviewed-on: https://chromium-review.googlesource.com/408337 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Corentin Wallez 1df16022 2016-10-27T08:16:56 TranslatorGLSL: collect variables when flattening pramga invariant all BUG=chromium:659472 Change-Id: Icfeada9f09fff5d28eb3f4fafb2c94d57598af1f Reviewed-on: https://chromium-review.googlesource.com/403849 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Qiankun Miao 705a9194 2016-08-29T10:05:27 Reland "Remove invariant qualifier for input in fragment shader" This relands https://chromium-review.googlesource.com/#/c/400005/. ESSL and GLSL are not consistent on invariant matching in vertex shader and fragment shader. See the following rules: ESSL 1.00 - input and output must match ESSL 3.00 - only output, inputs cannot be declared as invariant. GLSL 1.10.59 - does not exist GLSL 1.20.8 - input and output must match GLSL 1.30.10 - input and output must match GLSL 1.40.8 - input and output must match GLSL 1.50.11 - input and output must match GLSL 3.30.6 - input and output must match GLSL 4.00.9 - input and output must match GLSL 4.10.6 - input and output must match GLSL 4.20.11 - input can omit invariant GLSL 4.30.8 - input can omit invariant GLSL 4.40.9 - input can omit invariant GLSL 4.50.5 - input can omit invariant Since GLSL 4.20, invariant qualifier description were changed to: " Only variables output from a shader (including those that are then input to a subsequent shader) can be candidates for invariance. This includes user-defined output variables and the built-in output variables. As only outputs need be declared with invariant, an output from one shader stage will still match an input of a subsequent stage without the input being declared as invariant. " It's not very clear if input in fragment can be declared as invariant. Mesa driver disallows use of input declared as invariant in fragment shader, while other drivers may allow it. This CL removes invariant declaration for input in fragment shader except AMD driver in Linux. AMD's driver obviously contradicts the spec by forcing invariance to match between vertex and fragment shaders. BUG=chromium:639760, chromium:659326 TEST=conformance/glsl/misc/shaders-with-invariance.html and conformance/glsl/bugs/invariant-does-not-leak-across-shaders.html Change-Id: I0aa9be14f0cee7a11a249c91fba27c570c52ca1b Reviewed-on: https://chromium-review.googlesource.com/404228 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Shao 6f0a0dca 2016-09-27T13:51:29 Workaround isnan() on Intel drivers On some Intel drivers, calling function isnan() on highp float will get wrong answer. This patch work arounds this bug by using an expression to emulate this function. BUG=chromium:650547 Change-Id: I5bc5e0352c434f42cd2c55103a74f9f7ba51a72c Reviewed-on: https://chromium-review.googlesource.com/389834 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jiawei-Shao f979524a 2016-09-21T15:19:00 Remove redundant code in RewriteTexelFetchOffset Remove useTemporaryIndex() in function RewriteTexelFetchOffset since no temporary variables will be created in this function. BUG=angleproject:1469 Change-Id: Ibed56f0ba5c89b6ae1ab1611de39514c3fbb600f Reviewed-on: https://chromium-review.googlesource.com/387198 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Qiankun Miao 7ebb97fc 2016-09-08T18:01:50 Use 64-bits compile options BUG=chromium:645071 Change-Id: I31825123bf4cb45fb37a93f538e8936487beb5ff Reviewed-on: https://chromium-review.googlesource.com/382712 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Qiankun Miao e5bb72ff 2016-09-01T01:41:27 Remove SH_EMULATE_BUILT_IN_FUNCTIONS which isn't used The flag is not used in chrome. We decide to do per emulation per flag. BUG=chromium:642227 Change-Id: I936d53e5015186e35e672d0cb51c853a941582d2 Reviewed-on: https://chromium-review.googlesource.com/379077 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Qiankun Miao a4e6f074 2016-08-29T14:49:21 Work around abs() issue in Intel Mac drivers abs(i) where i is an integer returns unexpected result in Intel Mac. This works around the issue by emulating abs(i) manually. BUG=chromium:642227 TEST=deqp/functional/gles3/shadercommonfunction.html Change-Id: I2a41e0f4bcb0766109d651e663283b1760468017 Reviewed-on: https://chromium-review.googlesource.com/377628 Commit-Queue: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
jchen10 7ef9aa7b 2016-08-31T15:39:38 Enable texelFetchOffset re-writing for GLSL translator Intel Mac has the same bug as Win. So the CL enables it in GLSL translator as well. BUG=chromium:642605 TEST=deqp/functional/gles3/shadertexturefunction/texelfetchoffset.html Change-Id: I30323ea3a6d4c07ff32e50bd7c574916b5b865f4 Reviewed-on: https://chromium-review.googlesource.com/378601 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Martin Radev 4c4c8e72 2016-08-04T12:25:34 Add compute program compilation and linking support Compute shaders can be now compiled and linked to create programs. Some tests are added to verify successful and unsuccessful compute shader linking. The patch also replaces std::array<int, 3> with a custom struct WorkGroupSize. BUG=angleproject:1442 TEST=angle_end2end_tests TEST=angle_unittests Change-Id: I4ab0ac05755d0167a6d2a798f8d7f1516cf54d84 Reviewed-on: https://chromium-review.googlesource.com/366740 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Kenneth Russell bccc65d3 2016-07-19T16:48:43 Flatten "#pragma STDGL invariant(all)" into varying variables. This is implemented as a compiler option which is enabled by default when outputting to desktop GLSL version 130 and greater, which does not support this #pragma in fragment shaders. As a workaround, and for better compatibility on desktop OpenGL drivers, this pragma is also flattened into the outputs of vertex shaders, and the inputs of ESSL 1.00 fragment shaders. TEST=conformance/glsl/misc/shaders-with-invariance.html with --enable-unsafe-es3-apis BUG=629622, angleproject:1293 Change-Id: Ib040230915e639971505ed496d26e804c9d64e68 Reviewed-on: https://chromium-review.googlesource.com/361792 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Kenneth Russell <kbr@chromium.org>
Martin Radev 802abe01 2016-08-04T17:48:32 Add compute shader compilation support in the glsl compiler Support is added for compute shader compilation. There is a small extension to the parser so that 'local_size_x = ', 'local_size_y = ' and 'local_size_z = ' are supported as layout qualifiers. A few shader compilation tests are added and one which checks the AST whether the layout qualifiers are properly parsed. BUG=angleproject:1442 TEST=angle_unittests TEST=angle_end2end_tests Change-Id: I67283797d1cf13fa4ac47faa2a6e66d93a2db867 Reviewed-on: https://chromium-review.googlesource.com/362300 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Corentin Wallez b00dcee4 2016-07-11T17:42:58 TranslatorGLSL/ESSL: Output #pragma before #extension The Intel Mesa driver considers the #pragma directive to be a non-preprocessor token which makes shaders fail compilation. The relevant blurb from the spec is: "the extension directives must occur before any non-preprocessor tokens" BUG=627417 Change-Id: Ic22cff49a9f9c1fe5d140302581ca7b36688732c Reviewed-on: https://chromium-review.googlesource.com/359621 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Olli Etuaho 61b81acf 2016-06-28T14:15:20 Support non-square matrices in precision emulation In case the shader version is greater than ESSL 1.00, the precision emulation needs to output rounding functions for non-square matrix types. Writing emulated compound assignment functions for non-square matrices already had most of the code in place before this change. New compound assignment operators like >>= don't need floating point precision emulation in ESSL 3.00, since all of them only operate on integers. BUG=angleproject:1434 TEST=angle_unittests Change-Id: I4678f511edf4f9f744fe23bb8d7dab4387f07f20 Reviewed-on: https://chromium-review.googlesource.com/358472 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Corentin Wallez 419bfc91 2016-06-28T10:54:45 On Desktop GL, require index-constant sampler array indexing BUG=598924 Change-Id: If97dbaa782595997b815c70d14f079e0f0c3d82a Reviewed-on: https://chromium-review.googlesource.com/356710 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Zhenyao Mo b0987761 2016-06-17T18:10:15 Don't emit shader_texture_lod and draw_buffers extensions in core profile shader. BUG=angleproject:1416 TEST=conformance/extention/ in core profile R=jmadill@chromium.org,geofflang@chromium.org,cwallez@chromium.org Change-Id: I89b815929535586a2e90489129a1c6692bb87b3c Reviewed-on: https://chromium-review.googlesource.com/353820 Tryjob-Request: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org> Commit-Queue: Zhenyao Mo <zmo@chromium.org>
Geoff Lang 149a0999 2016-06-06T13:36:07 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>
Corentin Wallez 6218c80b 2015-11-09T11:14:47 Revert "Revert "renderergl_utils: Require explicit location qualifier for OpenGLES3"" This reverts commit 45a7d64fd84a7cb292ff71890a61f8d2b7609aa4. Change-Id: I7f94609fc7cf14220d98c61e73a13311d3cc4ecd Reviewed-on: https://chromium-review.googlesource.com/311245 Tryjob-Request: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Corentin Wallez 0e39f492 2015-11-09T13:16:41 Revert "Revert "Revert "renderergl_utils: Require explicit location qualifier for OpenGLES3""" This reverts commit 24db86441d148eb6a497b70c015296422ab48470.
Corentin Wallez 24db8644 2015-11-09T11:14:47 Revert "Revert "renderergl_utils: Require explicit location qualifier for OpenGLES3"" This reverts commit 45a7d64fd84a7cb292ff71890a61f8d2b7609aa4. Change-Id: I2a8212c7507a7566baca200ed938d9e00f7103c2
Corentin Wallez 45a7d64f 2015-11-06T16:19:21 Revert "renderergl_utils: Require explicit location qualifier for OpenGLES3" Causes angle_end2end_tests failures on Mac This reverts commit d63243f5be2ac7d8dafa6aea5b23e036074af397. Change-Id: Idf25d7fe9f4162813a4fc67927191747f660fceb Reviewed-on: https://chromium-review.googlesource.com/311041 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Corentin Wallez d63243f5 2015-10-29T14:23:37 renderergl_utils: Require explicit location qualifier for OpenGLES3 BUG=525930 Change-Id: I591308078c5a392a527291419567a11241a8be17 Reviewed-on: https://chromium-review.googlesource.com/309636 Tested-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tryjob-Request: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 91dbc188 2015-06-17T16:19:29 Enable needed extensions in generated GLSL shaders and call them when possible. reland: use the defined preprocessor function. BUG=angleproject:1044 Change-Id: I6171708a2d55ec085ba2c598a1a863779842da6c Reviewed-on: https://chromium-review.googlesource.com/311270 Tryjob-Request: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang e7fcf1e3 2015-11-05T21:23:53 Revert "Enable needed extensions in generated GLSL shaders and call them when possible." This reverts commit 233b334213c1a4853e81f71ba90aa223b2a68dce. Change-Id: Id99024b736324ad030ce63c5d0baae32b6d7f54b Reviewed-on: https://chromium-review.googlesource.com/311181 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 233b3342 2015-06-17T16:19:29 Enable needed extensions in generated GLSL shaders and call them when possible. BUG=angleproject:1044 Change-Id: Ife94d2258fb912974aa97484a0e30f289dd96734 Reviewed-on: https://chromium-review.googlesource.com/278324 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Corentin Wallez d4b5054d 2015-09-28T12:19:26 compiler: Rewrite do-while loops as while loops This works around a Mac driver shader compiler bug that makes many do-while loops cause GPU-hangs when ran. BUG=angleproject:891 Change-Id: I29828d6ea9e887ad0ed0c577f1deb41fb632a900 Reviewed-on: https://chromium-review.googlesource.com/302465 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 217fe6ec 2015-08-05T13:25:08 Detect when built-in modf requires an l-value in AST traversal This fixes an omission that out parameter tracking had inherited from EmulatePrecision. Accurate tracking of when values are written is required for converting dynamic indexing of vectors and matrices to function calls. A new test covering this is added to angle_unittests. TEST=angle_unittests BUG=angleproject:1116 Change-Id: I05c5fd60355117d0053b84110748ae221375a790 Reviewed-on: https://chromium-review.googlesource.com/290562 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Kimmo Kinnunen b18609b9 2015-07-16T14:13:11 Implement ES 2,3 parts of EXT_blend_func_extended for shader translation Exposes gl_SecondaryFragColor, glSecondaryFragData[] and gl_MaxDualSourceDrawBuffers to GLES SL 1.0. Relaxes rules for undefined output locations for GLES SL 3.0 and exposes gl_MaxDualSourceDrawBuffers. If the output GL context is GL ES 2.0 or 3.0: The emulation layer is expected to turn on EXT_blend_func_extended if the output GL context supports it. If the output GL context is GL: The emulation layer is expected to turn on EXT_blend_func_extended if the output GL context supports ARB_blend_func_extended or if GL context is 3.2 or later. If the source shader spec is GLES SL 2.0: The emulation layer is expected to inspect the shader compilation output variables upon linking. If output target is GL SL, the emulation layer should bind color location 0, index 1 to "angle_SecondaryFragColor" if variable "gl_SecondaryFragColorEXT" is used. Alternatively, emulation layer should bind "angle_SecondaryFragData" to locations 0,1,2,3,..., all color index 1, if "gl_SecondaryFragData" array is used. (The caller can not bind the locations or specify output variables.) If the source shader spec is GLES SL 3.0: The emulation layer is expected to do location auto-resolve of the the output variables that have undefined output locations that have not been bound by the caller. (The caller can not use gl_ built-ins, so nothing to do with those.) BUG=angleproject:1085 TEST=angle_unittest Change-Id: I5cafe205b0c29478b0dcd24aa89a7b0000f5d046 Reviewed-on: https://chromium-review.googlesource.com/287580 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Kimmo Kinnunen <kkinnunen@nvidia.com>
Kimmo Kinnunen 0932df61 2015-07-21T14:35:11 Expose GL built-in output variables in ShGetOutputVariables Expose GL built-in output variables in ShGetOutputVariables. Currently gl_FragColor, gl_FragData and gl_FragDepthEXT are exposed. The output variable names in the returned array are the input shader names, not the output shader names. This is needed in future features in which the emulation layer (command buffer/libANGLE) needs to know which output variables caller used. Example of such a feature is EXT_blend_func_extended, where gl_SecondaryFragColorEXT and gl_SecondaryFragDataEXT cause the need to bind the emulated output variables to their respective color indices. BUG=angleproject:1085 TEST=angle_unittests Change-Id: I7ca3e0fe6bdd3e3c66113518aa771cbb013fc014 Reviewed-on: https://chromium-review.googlesource.com/287230 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Kimmo Kinnunen <kkinnunen@nvidia.com>
Geoff Lang 7b9b284b 2015-06-15T11:02:49 Refactor GLSL version calculations for emulated functions. Pass the target GLSL version to InitBuiltInFunctionEmulatorForGLSL so that it can be updated to generate emulated functions for multiple versions. BUG=angleproject:1044 Change-Id: I34c408df52fd0f7d6c2f66d0579ac854afd93b87 Reviewed-on: https://chromium-review.googlesource.com/277700 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Qingqing Deng 03f3caec 2015-03-16T02:01:21 Emulate Missing pack_unpack functions from OpenGL 4.1 BUG=angleproject:947 TEST=angle_unittests, angle_end2end_tests Change-Id: Id1afd7630d9720b6701225b7abf1ce4a3bf528b6 Reviewed-on: https://chromium-review.googlesource.com/260232 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 3d0d9a48 2015-06-01T12:16:36 Clean up TIntermTraverser usage Remove default parameters from TIntermTraverser. Also clean up a few dead function declarations in traversers. TEST=angle_unittests, angle_end2end_tests BUG=angleproject:1037 Change-Id: I8d126c6c2d5b53e8b14e23e3d102f204a59323b3 Reviewed-on: https://chromium-review.googlesource.com/275184 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Qingqing Deng ad0d0799 2015-04-08T14:25:06 Expand ShShaderOutput for different GLSL versions BUG=angleproject:968 Change-Id: I2d4c0a8e9a91a940922da4501c22124da0c0399c Reviewed-on: https://chromium-review.googlesource.com/264840 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 8efc5ad5 2015-03-03T17:21:10 Initialize BuiltInFunctionEmulator outside Compiler This moves GLSL output specific code from the Compiler class to the GLSL/ESSL translators. BUG=angleproject:865 Change-Id: I2d552e9cdb41f7d8ddfee7b0249a99d629a6d7d7 Reviewed-on: https://chromium-review.googlesource.com/255471 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 95cd3c68 2015-03-03T16:45:32 Move some output out of BuiltInFunctionEmulator subclasses This paves the way for getting rid of the BuiltInFunctionEmulator subclasses in favor of initializing the BuiltInFunctionEmulator dynamically in Compiler subclasses. The eventual goal is getting rid of GLSL output specific functionality in Compiler, which should be language-agnostic. BUG=angle:865 Change-Id: Ibb114b905785c7343b2726c97699268c982536a0 Reviewed-on: https://chromium-review.googlesource.com/255470 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Zhenyao Mo 05b6b7fc 2015-03-02T17:08:09 Add an SH_GLSL_CORE_OUTPUT profile. So we could generate shaders for Apple using core GL profile. By switching to core profile, we still pass most WebGL conformance tests 1.0.2 on Linux, but not all, so apparently more work is needed. However, I think it's OK to check this CL in because this output profile will be only used behind a chromium switch. BUG=angleproject:933 TEST=webgl conformance tests Change-Id: Iad70e1aebf82349d3fc5f4116c1d6bc4448193fd Reviewed-on: https://chromium-review.googlesource.com/255282 Tested-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho a3a5cc6a 2015-02-13T13:12:22 Expose the IntermNode tree generated in the compiler for testing This refactoring makes it possible for tests to access the IntermNode tree produced by compilation by calling compileTree(). Removing ParseContext usage from OutputHLSL has the additional benefit of better separation between parsing and output. BUG=angle:916 Change-Id: Ib40954832316328772a5c1dcbbe6b46b238e4e65 Reviewed-on: https://chromium-review.googlesource.com/249723 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Austin Kinross 3ae6465f 2015-01-26T15:51:39 Fix lots of variable shadowing in ANGLE BUG=angle:877 Change-Id: I3df0fffb19f5ecbe439fbc2a8d6d239a5dc6b638 Reviewed-on: https://chromium-review.googlesource.com/243334 Tested-by: Austin Kinross <aukinros@microsoft.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 74cafab1 2015-01-23T23:17:32 Revert "Fix lots of variable shadowing in ANGLE" Caused WebGL CTS failures on the texture-npot test: https://www.khronos.org/registry/webgl/sdk/tests/conformance/textures/texture-npot.html This reverts commit c67e6e9fade44ef8938724e82db11db725e9c8e5. Change-Id: I089e99859231e0d657084ac3647257c650a9da92 Reviewed-on: https://chromium-review.googlesource.com/243041 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Austin Kinross c67e6e9f 2015-01-21T16:01:07 Fix lots of variable shadowing in ANGLE BUG=angle:877 Change-Id: I15168ae32605b26aee08274464ffe68adb5a7e87 Reviewed-on: https://chromium-review.googlesource.com/242351 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Austin Kinross <aukinros@microsoft.com>
Olli Etuaho 853dc1ab 2014-11-06T17:25:48 Add mediump and lowp precision emulation support for GLSL output This implements the rounding as specified in WEBGL_debug_shader_precision extension proposal for desktop GLSL and ESSL output. The bulk of the new functionality is added in the form of a new EmulatePrecision AST traverser, which inserts calls to the rounding routines angle_frm and angle_frl in the appropriate places, and writes the rounding routines themselves to the shader. Compound assignments which are subject to emulation are transformed from "x op= y" to "angle_compound_op_frm(x, y)", a call to a function which does the appropriate rounding and places the result of the operation to x. The angle_ prefixed names should not clash with user-defined names if name hashing is on. If name hashing is not on, the precision emulation can only be used if the angle_ prefix is reserved for use by ANGLE. To support the rounding routines in output, a new operator type is added for internal helper function calls, which are not subject to name hashing. In ESSL output, all variables are forced to highp when precision emulation is on to ensure consistency with how precision emulation performs on desktop. Comprehensive tests for the added code generation are included. BUG=angle:787 Change-Id: I0d0ad9327888f803a32e79b64b08763c654c913b Reviewed-on: https://chromium-review.googlesource.com/229631 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Zhenyao Mo 94ac7b78 2014-10-15T18:22:08 Invariant related processing. * Fix a bug in PreProcessor for STDGL pragma. * Record all invariant settings and set them in ShaderVariable. * Write #pragma STDGL invariant(all) in GL BUG=angle:776 TEST=https://www.khronos.org/registry/webgl/sdk/tests/conformance/glsl/misc/shaders-with-invariance.html Change-Id: Ie28b75480deed79f0c9f26e3b98f1778d1290182 Reviewed-on: https://chromium-review.googlesource.com/223610 Tested-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 183bde55 2014-07-02T15:31:19 Return shader variable information using GLenum values. Instead of duplicating GL header define values, explictly return GLenum for variable queries in the shader inspection API. This reduces the duplicate defines in the shader compiler header. BUG=angle:466 Change-Id: Iddaaff597b188251fa2e546f352bf77ab3ac43bc Reviewed-on: https://chromium-review.googlesource.com/205860 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Nicolas Capens <capn@chromium.org>
Jamie Madill ce505553 2014-06-26T14:56:33 Revert "Return variable type queries using GLenum values." Breaks the FYI bots until we get Chromium patched. BUG=angle:466 This reverts commit 53221f5a0382887155d90f7f286e41190d4f5bfb. Change-Id: Ib28548df5c10a6f76f46e4cf8f2013dca5cf0ee2 Reviewed-on: https://chromium-review.googlesource.com/205850 Reviewed-by: Shannon Woods <shannonwoods@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 53221f5a 2014-06-25T16:04:59 Return variable type queries using GLenum values. Instead of duplicating GL header define values, explictly return GLenum for variable queries in the shader inspection API. This reduces the duplicate defines in the shader compiler header. BUG=angle:466 Change-Id: If631b20ce68747297a946e1371def7709027a613 Reviewed-on: https://chromium-review.googlesource.com/204937 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Nicolas Capens <nicolascapens@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Jamie Madill 68fe74aa 2014-05-27T12:56:01 Add a compiler query for the translator output type. This is useful for determining if we are compiling to a D3D9 or D3D11 shader outside of the internal translator classes. BUG=angle:656 Change-Id: Ib1c1d3de569edaa2b65c24c09d05aa4dd229d3e4 Reviewed-on: https://chromium-review.googlesource.com/201564 Reviewed-by: Nicolas Capens <nicolascapens@chromium.org> Reviewed-by: Shannon Woods <shannonwoods@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Shannon Woods 32e66b7a 2014-04-22T13:54:56 Add newline to fix clang compile Change-Id: I9e0e32d94f24fb32e9971772fb7cd68cd36ab47d Reviewed-on: https://chromium-review.googlesource.com/196280 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Shannon Woods <shannonwoods@chromium.org>
Nicolas Capens 46485086 2014-04-15T13:12:50 Implement EXT_shader_texture_lod BUG=angle:551 Change-Id: I81d7574a15861f1b24ddf6147cf71adbf20e10f3 Reviewed-on: https://chromium-review.googlesource.com/194960 Tested-by: Nicolas Capens <nicolascapens@chromium.org> Reviewed-by: Shannon Woods <shannonwoods@chromium.org>