src/compiler/translator/OutputGLSLBase.h


Log

Author Commit Date CI Message
Chris Dalton b5514bb2 2022-09-21T20:47:00 Support pixel local storage on ES 3.0 Now that the application-facing API is implemented, we don't have to rely on ES 3.1 anymore. Expose and test the extension on ES 3.0. Bug: angleproject:7279 Change-Id: I5635620b9088201c20bafd283813092a329225d6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3915327 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Chris Dalton <chris@rive.app> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app>
Shahbaz Youssefi 6f80f0f0 2022-08-06T02:29:19 Translator: Clean up the compile flag passing interface Historically, compile flags were sent to the translator as a bitmask. Recently, we were getting close to running out of bits. Additionally, direct-to-metal work had started to introduce constants to be passed to the translator, which were misplaced in ShBuiltInResources and Caps. Recent work on Pixel Local Storage adds even more constants, aggravating the situation. In this change, the interface to passing compile flags is reworked. A struct is passed (instead of a bitmask) that has one bit for each flag. This can be indefinitely extended. Additionally, the constants needed by metal and PLS are also placed in this struct. In turn, the backends can set these options directly, and don't have to hack them into Caps to further get hacked into ShBuiltInResources. Bug: angleproject:7559 Change-Id: If93f1e1b8818ad3a0ac708ab04ab93b4b397d114 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3812562 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org>
Gregg Tavares 6106da49 2021-09-22T16:18:21 Indent Generated GLSL Before: in vec4 _ua_position; void main(){ (gl_Position = vec4(0.0, 0.0, 0.0, 0.0)); (gl_Position = _ua_position); } layout(shared) uniform _uG{ float _ufoobar; } _ug; struct _uS { int _ufoo; float _ubar; }; layout(shared) uniform _uT{ _uS _us; float _um; } _ut; float _ufunc(in _uS _ustructVar){ return _ustructVar._ubar; } out vec4 _uoutColor; void main(){ float _uv = 0.0; for (int _ui = 0; (_ui < _ut._us._ufoo); (++_ui)) { int _uk = 0; while ((_uk < _ut._us._ufoo)) { (_uv += _ufunc(_ut._us)); if ((_uv > 100.0)) { break; } else { (_uv += 5.0); } switch (_uk) { case (0): (_uv += 3.0); break; case (1): (_uv += 1.0); break; default: (_uv -= 2.0); break; } } } (_uoutColor = (vec4(_uv) + vec4(_ug._ufoobar))); } After: in vec4 _ua_position; void main(){ (gl_Position = vec4(0.0, 0.0, 0.0, 0.0)); (gl_Position = _ua_position); } layout(shared) uniform _uG{ float _ufoobar; } _ug; struct _uS { int _ufoo; float _ubar; }; layout(shared) uniform _uT{ _uS _us; float _um; } _ut; float _ufunc(in _uS _ustructVar){ return _ustructVar._ubar; } out vec4 _uoutColor; void main(){ float _uv = 0.0; for (int _ui = 0; (_ui < _ut._us._ufoo); (++_ui)) { int _uk = 0; while ((_uk < _ut._us._ufoo)) { (_uv += _ufunc(_ut._us)); if ((_uv > 100.0)) { break; } else { (_uv += 5.0); } switch (_uk) { case (0): (_uv += 3.0); break; case (1): (_uv += 1.0); break; default: (_uv -= 2.0); break; } } } (_uoutColor = (vec4(_uv) + vec4(_ug._ufoobar))); } Bug: angleproject:6428 Change-Id: Ica25151e68eb0defd85a3b6241db442d8eb84743 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3177339 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Gregg Tavares <gman@chromium.org>
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 8b869a95 2021-06-13T01:09:27 Translator: Generate Ops for all built-in functions EOpCallBuiltInFunction is removed in this change, as well as the "op": "auto" property in builtin_function_declarations.txt. Instead, gen_builtin_symbols.py automatically generates Ops for every built-in function and generates the TOperator enum accordingly. This simplifies SPIR-V code generation by allowing switches to be used on operators instead of string comparisons. Bug: angleproject:4589 Bug: angleproject:4889 Change-Id: Ia351524400b0e12a10a5572e27e9b88c6ec2e61c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2958869 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 31641b8e 2021-06-05T02:17:47 Declare specialization constants in the AST A new qualifier (EvqSpecConst) is added so that specialization constants can be declared in tree. This enables TVariable references to specialization constants to be validated, which were in fact invalid as every reference declared a new variable. That is fixed. Bug: angleproject:4889 Change-Id: I1711e41cbc5a1260843d2d004d3568bdae11e963 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2941451 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: 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 6746e5dd 2021-06-01T22:48:14 Vulkan: SPIR-V Gen: Basic support for compute shaders This change enables direct SPIR-V generation for compute shaders and enables a few tests. A handful of built-in functions are translated to support said tests. Bug: angleproject:4889 Change-Id: I8fd6dc50ff31559a738ba680a993fb197e29fcf9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2939330 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
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>
Shahbaz Youssefi daeac238 2021-05-08T22:09:38 Translator: Ensure structs and blocks are uniquely defined A new AST validation is added to ensure that the same TStructure or TInterfaceBlock is not redundantly defined. This helps with SPIR-V generation by allowing the id to be used as key in a hash map that looks up the corresponding SPIR-V type id. A bug is fixed where the Vulkan driver uniform declaration created two identical declarations for ANGLEDepthRangeParams. A number of other bugs are also fixed in this change, where if a variable declaration is eliminated (for example due to constant folding, or inactive interface variable removal) and it contained a struct specifier, the struct declaration was also removed. OutputGLSLBase had a hack where structs were declared on first encounter, which was incorrect as the scope of the declaration could change. Those bugs are fixed and this hack is removed. Bug: angleproject:2733 Bug: angleproject:4889 Bug: angleproject:5936 Change-Id: I8e13748c0bf552ae8b052249282769a1f0775603 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2881942 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill e670fc72 2021-01-18T15:51:42 Implement shader compiler changes for Tessellation. Numerous rule changes to support validating Tessellation Control and Evaluation shaders. New per-patch inputs and output variable support. Includes a new traverser step that validates barrier function calls. Functionality changes upcoming in http://crrev.com/c/2568234 Bug: angleproject:3572 Change-Id: If8da1c21d30efa12c60ed0d6c3f8cf0b27e4c86f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2633936 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Mohan Maiya <m.maiya@samsung.com>
Shahbaz Youssefi 8b851562 2020-12-08T16:51:51 Don't output matrix qualifiers in I/O blocks row_major and column_major only apply to uniform and buffer interface blocks per GLSL ES 3.2 spec. Bug: angleproject:3580 Change-Id: Iad0afeffc7ddb7bff2ebaec0ea0ec4eda26171a7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2580191 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi e59d8716 2020-12-07T16:41:35 GL: Expose OES_shader_io_blocks As extra validation that new tests are indeed correct. Bug: angleproject:3580 Change-Id: I4792bd8e26f96ab6c988f2605f053ce5789a782f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2577818 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi f1f082e1 2020-01-17T14:53:38 Vulkan: Set varying location & xfb decorations in SPIR-V The shader translator outputs arbitrary location indices. Once compiled by glslang, the SPIR-V transformer modifies these decorations. If the transform feedback extension is used, it will also add the relevant decorations to the varyings that are captured. Bug: angleproject:3394 Change-Id: I5ecafd0536408612a5d4b920dbabbfabe650657c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2008468 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi bef8ca7d 2020-01-20T14:19:05 Vulkan: Set vertex attribute locations in SPIR-V The shader translator outputs arbitrary location indices for vertex attributes. Once compiled by glslang, the SPIR-V transformer modifies these decorations. Bug: angleproject:3394 Change-Id: I88453b44e3a8770f51e79228148233ff308f1885 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2011212 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi feb3b6cc 2020-01-13T22:58:59 Vulkan: Remove row->col major shader transformation This was done based on the incorrect assumption that Vulkan GLSL doesn't allow layout qualifiers on interface block fields. This was due to glslang compile failures in some shaders that included mixed row- and column-major fields in interface blocks. However, the failures were only in the case the interface block is inactive, in which case glslang wrapper previously replaced the layout/qualifier of the interface block with |struct|, which left the shader with an unused struct definition with fields that have layout qualifiers; an invalid shader. The change introduced in https://chromium-review.googlesource.com/c/angle/angle/+/1951523 removes inactive shader interface declarations. The above scenario thus never occurs, rendering the row- to column-major transformation unnecessary. Bug: angleproject:3443 Change-Id: Ice34a0fc6e047b79a4d44f04b730ec59bdfafe33 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1961098 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 07f0f019 2019-12-19T14:47:46 Translator: Memory qualifiers on SSBO fields These were not output prior to this CL. Of these qualifiers, readonly and writeonly are unnecessary as ANGLE already does the appropriate validation, but the rest (coherent, volatile, restrict) are necessary, even though the tests pass on the bots by coincidence of driver behavior/test simplicity. Bug: angleproject:3602 Change-Id: Ie75fee0f004944b50ef21124ba25c4315e082b85 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1976499 Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Yan 17b3c2f3 2019-10-14T14:13:59 Implement SamplerVideoWEBGL for WEBGL_video_texture extension on desktop WEBGL_video_texture is an extension that will improve uploading video frame to WebGL performance. (https://www.khronos.org/registry/webgl/extensions/proposals/WEBGL_video_texture/) This extension introduced a new texture type TEXTURE_VIDEO_IMAGE_WEBGL and a new sampler type samplerVideoWEBGL to sample it. In chromium implementation, TEXTURE_VIDEO_IMAGE_WEBGL maps to different native texture type based on platform. On desktop, it maps to GL_TEXTURE2D(Currently supported). On Android, it should map to GL_TEXTURE_EXTERNAL(TODO). SamplerVideoWEBGL needs to be mapped to sampler2D or samplerExternalOES according to TEXTURE_VIDEO_IMAGE_WEBGL implementation. This patch implements samplerVideoWEBGL in Angle to support WEBGL_video_texture on desktop. In this case, samplerVideoWEBGL should map to sampler2D. Bug: chromium:776222, angleproject:3889 Change-Id: Idb0a5fcde37ca75ccc1181226b91f257212e7500 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1866274 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi b8e056dd 2019-12-11T15:02:43 Vulkan: Have the translator output in/out qualifiers Currently, when assigning varying locations, we assign in/out qualifiers based on whether the varying name is present between different shader stages. This is broken for separate shader objects as there is possibly no pair of shaders to be able to tell which is input and which is output (by trying to find the same varying in a stage before or after the shader). Bug: angleproject:3571 Change-Id: Id928a3eaa16e917c81bae0b3414c41842eb2b664 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1961993 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 795a3559 2019-12-03T11:31:18 Vulkan: EXT_gpu_shader5 support: precise The precise keyword is used in tessellation shaders but introduced in this extension. EXT_gpu_shader5 introduces a handful of features to shaders. This change only implements the `precise` keyword. Bug: angleproject:3569 Change-Id: I2252b79098eb8ba2d2faa040d7eaed7548b7051e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1939851 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 249cb200 2019-12-03T11:10:06 Translator: Rename TIntermInvariantDeclaration to ..GlobalQualifier.. This is to support the upcoming `precise` keyword. Bug: angleproject:3569 Change-Id: Idbcc8fd6f261757dbbf81b381e7a2dae938d8101 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1947451 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi d6c7fec1 2019-08-12T16:46:57 Vulkan: Support mixed column/row-major buffer fields Adds comprehensive tests for mixed column/row-major interface blocks, which flush out various bugs in different OpenGL drivers too. Bug: angleproject:3443 Change-Id: Ie88cca743373891bbb49d9f564f30407475e07fb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1749334 Reviewed-by: Shahbaz Youssefi <syoussefi@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 5dfad811 2019-07-02T13:23:27 Vulkan: GLSL output support for SSBO memory qualifiers Makes the QUALIFIER macro take arguments similar to LAYOUT, to allow passing in tokens to be conditionally output after the storage qualifier. Bug: angleproject:3561 Change-Id: I4368eba2c34c1398f81d33cd23c9e56557fd4ed8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1685876 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 216f73d0 2019-04-12T13:32:30 Vulkan: add uniform buffer object support Support for layout qualifiers in interface blocks are added. All interface blocks are adjusted to either be in std140 or std430. In the Vulkan backend, a new descriptor set is added for UBOs. A dirty bit is added for UBO updating and pipeline layouts and descriptor bindings are updated. Bug: angleproject:3199, angleproject:3220 Change-Id: I271fc34ac2e1e8b76dee75e54a7cff0fe15fe4ee Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1565061 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang 366df2b2 2019-01-18T15:40:34 Vulkan: Support external texture binding points. BUG=angleproject:2668 BUG=angleproject:3023 Change-Id: Idab0c4cbe1c7ed203ace50f1a6701dba11a40242 Reviewed-on: https://chromium-review.googlesource.com/c/1422548 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill b36a4816 2018-09-25T10:15:11 Vulkan: Add OpenGL line segment rasterization. Line rasterization rules are implemented using a shader patch. The patch does a small test and discards pixels that are outside of the OpenGL line region. The feature is disabled on Android until we can determine the root cause of the test failures. Bug: angleproject:2598 Change-Id: Ic76c5e40fa3ceff7643e735e66f5a9050240c80b Reviewed-on: https://chromium-review.googlesource.com/1120153 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 1283ef62 2018-07-12T10:15:42 translator: Add TIntermPreprocessorDirective. This new node type can be used to inject preprocessor directives into the intermediate tree. Outputting the preprocessor directive is easy for the GLSL back-end. This can be used to implement workarounds such as the OpenGL line rasterization rules on Vulkan. Also fixes the build that was broken on Win/x64 with a prior change and makes more methods in IntermNode.h const. Bug: angleproject:2598 Change-Id: Ifd6d0ac7912ccf2137997bb9a0187fd063023d5e Reviewed-on: https://chromium-review.googlesource.com/1133420 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill f5557acc 2018-06-15T09:46:58 translator: Store symbol type in TField. This allows us to keep a separate symbol type for each field in a struct. This can allow us to assign internal names to struct types. It could also allow us to add internal fields to user defined stucts. Bug: angleproject:2665 Change-Id: I6a129107d9db66c54b98b07684c3ead5801712ba Reviewed-on: https://chromium-review.googlesource.com/1101565 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com>
Luc Ferron 3ec304db 2018-04-18T14:14:25 Vulkan: Support struct initializers in shaders Also adds a new test in GLSLTest to validate the initialization of a struct on the same line as its declaration. Bug: angleproject:2459 Change-Id: Ib37e20378f8ec76541db26392663bcba03390756 Reviewed-on: https://chromium-review.googlesource.com/1017340 Commit-Queue: Luc Ferron <lucferron@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com>
Luc Ferron f1d3c20c 2018-04-16T07:44:27 Vulkan: Fix the issue with unused attributes / varyings When an attribute, a uniform or a varying isn't used, we now remove their layout and in/out qualifiers so that the shader can still refer to these var names. Bug: angleproject:2456 Change-Id: I5f1241d91bd46f663750adfab2562ef87ce69ae5 Reviewed-on: https://chromium-review.googlesource.com/1014009 Commit-Queue: Luc Ferron <lucferron@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jamie Madill aed1b56a 2018-04-17T11:47:46 Prerequisite code for simpler GlslangWrapper. This makes two changes for the linking step: * allows symbol names in TOutputGLSLBase::writeVariableType * stores a list of inactive varying names in VaryingPacking Bug: angleproject:2456 Change-Id: Id651721a008c049508303d18c45c6b96c76114d9 Reviewed-on: https://chromium-review.googlesource.com/1014707 Reviewed-by: Luc Ferron <lucferron@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Luc Ferron d91c3793 2018-04-06T09:36:36 Vulkan: Implement support for structs in uniforms - Also enables 174 additional dEQP tests. Bug: angleproject:2446 Change-Id: I07cce46815d2f7a80fd48e7fd9407f7d528b397f Reviewed-on: https://chromium-review.googlesource.com/998406 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Luc Ferron <lucferron@chromium.org>
Olli Etuaho c26214de 2018-03-16T10:43:11 Move AST utilities to a subdirectory Move AST related utilities to compiler/translator/tree_util. BUG=angleproject:2409 TEST=angle_unittests Change-Id: I7567c2f6f2710292029263257c7ac26e2a144ac8 Reviewed-on: https://chromium-review.googlesource.com/966032 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho d4bd963f 2018-03-08T16:32:44 Don't use TIntermSymbol nodes for function parameters Parameter nodes are not needed - it's simpler to just create a TVariable object for each parameter when the TFunction is initialized. With this change we also store only one object per each parameter type used in built-in functions, instead of one array of TConstParameter entries for each unique parameter sequence. This simplifies code and reduces binary size and compiler memory use. Compiler perf does not seem to be significantly affected. BUG=angleproject:2267 TEST=angle_unittests Change-Id: I2b82400dd594731074309f92a705e75135a4c82c Reviewed-on: https://chromium-review.googlesource.com/955589 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho fbb1c792 2018-01-19T16:26:59 Store symbol names as a ImmutableString This will enable compile-time initialization of built-in symbols as well as reducing copying strings. Most of the code that deals with names is changed to use ImmutableString where it makes sense to avoid conversions. The lexer/parser now allocate const char pointers into pool memory instead of allocating TStrings. These are then converted to ImmutableString upon entering TParseContext. BUG=angleproject:2267 TEST=angle_unittests, angle_end2end_tests Change-Id: I244d6271ea1ecf7150d4f89dfa388a7745a1150c Reviewed-on: https://chromium-review.googlesource.com/881561 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 8b5e8fdb 2017-12-15T14:59:15 Replace remaining usage of TName with TSymbol TName used to contain just a subset of the information stored in TSymbol. It makes more sense to use TSymbol directly instead of converting it to TName. This also improves type safety a bit by making some functions only take in TVariable or TFunction instead of the more generic TName. BUG=angleproject:2267 TEST=angle_unittests Change-Id: Icb46923c25d33ebbbbc06ddc487da25957dda771 Reviewed-on: https://chromium-review.googlesource.com/829143 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho beb6dc74 2017-12-14T16:03:03 Always use TFunction instead of TFunctionSymbolInfo This reduces unnecessary memory allocations and conversions between different objects containing the same data. BUG=angleproject:2267 TEST=angle_unittests Change-Id: I87316509ab1cd6d36756ff6af7fa2b5c5a76a8ea Reviewed-on: https://chromium-review.googlesource.com/827134 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 1bb8528c 2017-12-14T13:39:53 Remove TFunctionSymbolInfo from TIntermAggregate All the information stored in TFunctionSymbolInfo was duplicated from the TFunction that the aggregate node pointed to. BUG=angleproject:2267 TEST=angle_unittests Change-Id: I1f5574ab0416e5cae00c3dae6fc11d2fe1fa128c Reviewed-on: https://chromium-review.googlesource.com/827065 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 39f74df5 2017-11-20T16:09:57 Remove unreferenced struct types from the AST This expands pruning unreferenced variables so that unreferenced named struct types can also be removed from the AST. Includes a small cleanup in GLSL output so that the output code matching tests can test against clean output. BUG=chromium:786535 TEST=angle_unittests Change-Id: I20974ac99a797e478d82f9203c179d2d58fac268 Reviewed-on: https://chromium-review.googlesource.com/779519 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jamie Madill 2a9e107c 2017-09-22T11:31:57 Vulkan: Support multiple vertex outputs. This is a bit of a hack, similar to how D3D11 works. We need to write output locations in the GLSL shader before we send them to glslang, so we wait until the link call, then string-replace some hard-coded identifeir code to the attribute location determined by ANGLE. This CL also fills in some of the vertex format conversion tables in formatutilsvk.cpp. BUG=angleproject:2167 Change-Id: I2424d0d990bdbcd831a4dd130e61e87d8f8f479f Reviewed-on: https://chromium-review.googlesource.com/677555 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
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>
Olli Etuaho cccf2b00 2017-07-05T14:50:54 Reorganize AST traversal utility code Define TIntermTraverser and TIntermLValueTrackingTraverser in a separate header file. hash() function is moved out from TIntermTraverser as it is not related to the core functionality of traversing and transforming ASTs. Also reorganize some traversers to follow common conventions: - Intermediate output is now in OutputTree.h/.cpp - Max tree depth check is now in IsASTDepthBelowLimit.h/.cpp BUG=angleproject:1490 TEST=angle_unittests Change-Id: Id4968aa9d4e24d0c5bac90dc147fc9f310de0184 Reviewed-on: https://chromium-review.googlesource.com/559531 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho ec9232bd 2017-03-27T17:01:37 Store unmangled function names in the AST This makes the code simpler across the board. There are a few cases where mangled names still need to be generated in AST traversers, but they are outweighed by much leaner output code for all function nodes. BUG=angleproject:1490 TEST=angle_unittests, angle_end2end_tests Change-Id: Id3638e0fca6019bbbe6fc5e1b7763870591da2d8 Reviewed-on: https://chromium-review.googlesource.com/461077 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jamie Madill e794cd86 2017-01-13T17:29:51 Vulkan: Implement new GLSL translator back-end. The Vulkan GLSL translator back-end will handle validating and translating our WebGL/ESSL shaders into Vulkan-specific GLSL. glslang (the Vulkan one) accepts both GLSL and GLSL ES shaders as inputs, and both the desktop and ESSL back-ends give incompleteness warnings when used. For now, use the desktop GL 450 as a target for Vulkan GLSL. The Vulkan-specific changes are currently only to add locations to every vertex input and fragment output. BUG=angleproject:1575 Change-Id: I7c3f32f522e9d18e5f8618eb7927336bf4fbdcf2 Reviewed-on: https://chromium-review.googlesource.com/412266 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 16c745a3 2017-01-16T17:02:27 Split TIntermFunctionPrototype from TIntermAggregate Function prototypes now have their own class TIntermFunctionPrototype. It's only used for prototypes, not function parameter lists. TIntermAggregate is still used for parameter lists and function calls. BUGS=angleproject:1490 TEST=angle_unittests Change-Id: I6e246ad00a29c2335bd2ab7f61cf73fe463b74bb Reviewed-on: https://chromium-review.googlesource.com/427944 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho e180559f 2017-01-02T16:41:20 Use GetOperatorString when writing GLSL built-in function calls GetOperatorString is now used when writing GLSL for built-in calls that fall under TIntermAggregate. Component wise and not component wise TOperator enums are disambiguated from each other. BUG=angleproject:1682 TEST=angle_unittests, angle_end2end_tests, WebGL conformance tests Change-Id: I861f1e94eb695eb712592df99705848b442ef07b Reviewed-on: https://chromium-review.googlesource.com/424532 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 bf4e1b73 2016-12-09T11:30:15 Split TIntermInvariantDeclaration from TIntermAggregate This change is pure refactoring and doesn't fix bugs related to invariant declarations. Invariant declarations are supposed to accept a list of identifiers, but this refactoring keeps the current behavior of only accepting a single identifier in an invariant declaration. When the bug will be fixed, the new TIntermInvariantDeclaration class that now has only a single child node can be changed so that it may have multiple children. TIntermAggregate is still used for function calls, function prototypes and function parameter lists. BUG=angleproject:1490 TEST=angle_unittests Change-Id: I3e22092c87e1c06445fd7e123d9922c2fcb59428 Reviewed-on: https://chromium-review.googlesource.com/419415 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
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>
Olli Etuaho 56a2f95f 2016-12-08T12:16:27 Output infinity and NaN literals correctly in shaders Previously infinity and NaN resulting from constant folding would be clamped to finite 32-bit float range when they were written in shader output. Now they are written as a bit pattern in case the shader version allows it. This does not guarantee that NaNs work, but this is fine, since ESSL 3.00.6 spec has very loose requirements when it comes to NaNs. BUG=angleproject:1654 TEST=angle_end2end_tests Change-Id: I9997000beeaa8ed22523c22d5cf6929cdfc93f60 Reviewed-on: https://chromium-review.googlesource.com/417301 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Corentin Wallez 1b896c62 2016-11-16T13:10:44 translator: remove code related to for-loop unrolling For loop unrolling is not used and causes the translator fuzzer to find a hang when unrolling tons of nested loops (duh). Also remove MMap.h which was unused. This is essentially a revert of https://codereview.appspot.com/4331048 BUG=chromium:665255 Change-Id: Id6940f7e306d4ed53bc992f751e9ffe733190f17 Reviewed-on: https://chromium-review.googlesource.com/412023 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@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>
Zhenyao Mo b7bf7426 2016-11-08T14:44:05 Don't ouput "invarant" and "centroid" in GLSL 4.1 or older. BUG=chromium:639760,chromium:641129 TEST=webgl2_conformance Change-Id: I5fe87246eaea78888529d7b45b79399e6065daa9 Reviewed-on: https://chromium-review.googlesource.com/408569 Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Zhenyao Mo <zmo@chromium.org>
Jamie Madill 45bcc784 2016-11-07T13:58:48 translator: Scope all classes with "sh". I was seeing an odd problem with our PoolAlloc conflicting with the glslang/Vulkan TIntermNode, so the fix was to move everything to a separate namespace. The bison grammars are also regenerated. No functional changes. BUG=angleproject:1576 Change-Id: I959c7afe4c092f0d458432c07b4dcee4d39513f3 Reviewed-on: https://chromium-review.googlesource.com/408267 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 0982a2bf 2016-11-01T15:13:46 Prefix internal names in GLSL output Prefixing internal names will avoid clashes with user-defined names. We use prefix webgl_angle_ so that the internal names are both reserved in WebGL on one hand and clearly separated from hashed names starting with just webgl_ on the other hand. BUG=angleproject:1597 TEST=WebGL conformance tests Change-Id: I7deef9c1a38105c8b57eda13c84eec13e515a91a Reviewed-on: https://chromium-review.googlesource.com/406247 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
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>
Olli Etuaho 13389b66 2016-10-16T11:48:18 Split TIntermDeclaration from TIntermAggregate The new class TIntermDeclaration is now used for struct, interface block and variable declarations. TIntermDeclaration nodes do not have a type - rather the type is stored in each child node. The types may differ in case the declaration is a series of array declarators with mismatching sizes. TIntermAggregate is still used for function calls, function prototypes, function parameter lists and invariant declarations. BUG=angleproject:1490 TEST=angle_unittests Change-Id: I0457188f354481470855f61ac1c878fc2579b1d1 Reviewed-on: https://chromium-review.googlesource.com/400023 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 336b1470 2016-10-05T16:37:55 Split TIntermFunctionDefinition from TIntermAggregate This makes the code easier to understand. Function definition nodes always have just two children, the parameters node and the function body node, so there was no proper reason why they should be aggregate nodes. As a part of this change, intermediate output is modified to print symbol table ids of functions so that debugging function id related functionality will be easier in the future. After this patch, TIntermAggregate is still used for function prototypes, function parameter lists, function calls, variable and invariant declarations and the comma (sequence) operator. BUG=angleproject:1490 TEST=angle_unittests, angle_end2end_tests Change-Id: Ib88b4ca5d21abd5f126836ca5900d0baecabd19e Reviewed-on: https://chromium-review.googlesource.com/394707 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho 6d40bbdd 2016-09-30T13:49:38 Split TIntermBlock from TIntermAggregate The new TIntermBlock node class replaces TIntermAggregate nodes with the EOpSequence op. It represents the root node of the tree which is a list of declarations and function definitions, and any code blocks that can be denoted by curly braces. These include function and loop bodies, and if-else branches. This change enables a bunch of more compile-time type checking, and makes the AST code easier to understand and less error-prone. The PostProcess step that used to be done to ensure that the root node is TIntermAggregate is removed in favor of making sure that the root node is a TIntermBlock in the glslang.y parsing code. Intermediate output formatting is improved to print the EOpNull error in a clearer way. After this patch, TIntermAggregate is still used for function definitions, function prototypes, function parameter lists, function calls, variable and invariant declarations and the comma (sequence) operator. BUG=angleproject:1490 TEST=angle_unittests, angle_end2end_tests Change-Id: I04044affff979a11577bc1fe75d747e538b799c8 Reviewed-on: https://chromium-review.googlesource.com/393726 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho b6fa043d 2016-09-28T16:28:05 Split vector swizzle AST nodes into a different node class This avoids creating a weird aggregate node with a sequence of constant union nodes to store the offsets. They're stored neatly inside a vector instead. This makes code that needs to iterate over the swizzle offsets much simpler. BUG=angleproject:1490 TEST=angle_unittests Change-Id: I156b95723529ee05a94d30295ffb6d0952a98564 Reviewed-on: https://chromium-review.googlesource.com/390832 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 5796127e 2016-09-14T13:57:46 Rename TIntermSelection to TIntermIfElse Now that ternary nodes are not represented by TIntermSelection any more, TIntermIfElse is an easier name to understand for newcomers to the code. BUG=angleproject:1490 TEST=angle_unittests Change-Id: Ia1e04e356ab93409400245092a84533d7dfd129d Reviewed-on: https://chromium-review.googlesource.com/385416 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho d0bad2c7 2016-09-09T18:01:16 Split ternary node class from TIntermSelection Ternary operator nodes are typed parts of expressions, they always have two children and the children are also guaranteed to be TIntermTyped. "If" selection nodes can't be a part of an expression, they can have either one or two children and the children are code blocks. Due to all of these differences it makes sense to store these using two different AST node classes. BUG=angleproject:1490 TEST=angle_unittests Change-Id: I913ab1d806e3cdb5c21106f078cc9c0b6c72ac54 Reviewed-on: https://chromium-review.googlesource.com/384512 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho e92507bc 2016-07-04T11:20:10 Reuse code for determining built-in type name string Add TType::getBuiltInTypeNameString() that returns an unique char pointer for each built-in type. They can be easily stored in an std::set as required by EmulatePrecision, and the function can also be used in TOutputGLSLBase. BUG=angleproject:1437 TEST=angle_unittests Change-Id: I9acfe1b149546dedeae058841cbabf0d9829cdc9 Reviewed-on: https://chromium-review.googlesource.com/358471 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho ae69d7e1 2015-10-07T17:19:50 Output layout qualifiers in GLSL output Output layout qualifiers for vertex shader attributes and fragment shader outputs. This applies both to ESSL output and GLSL output. If the source shader is in ESSL1, the code has no effect since there's no layout information in the AST. BUG=525930 TEST=angle_unittests, angle_end2end_tests Change-Id: I48b3aa56116c15d11599b030eed4c45be2c8fc7e Reviewed-on: https://chromium-review.googlesource.com/304550 Tryjob-Request: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang bdcc54a4 2015-09-02T13:09:48 Support writing interface blocks in OutputGLSL. BUG=angleproject:882 BUG=angleproject:1149 Change-Id: Iea0b1d0bc586ec9517a06793386c91890b7a5115 Reviewed-on: https://chromium-review.googlesource.com/297086 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Corentin Wallez e5a1f271 2015-08-21T02:58:25 Use override in all the places where it is possible This will avoid -Winconsistent-overrides in the future. Done using the -Wsuggest-override warning of GCC 5.1 BUG= Change-Id: I707a649dc368f5dd1e139fd144370abcac0b6263 Reviewed-on: https://chromium-review.googlesource.com/294920 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 59f9a641 2015-08-06T20:38:26 Remove EOpInternalFunctionCall It's cleaner to mark internal functions by using the TName class, similarly to TIntermSymbol. TEST=angle_unittests BUG=angleproject:1116 Change-Id: I12a03a3dea42b3fc571fa25a1b11d0161f24de72 Reviewed-on: https://chromium-review.googlesource.com/291621 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill 6ba6eadc 2015-05-04T14:21:21 Rename ConstantUnion to TConstantUnion. This clarified that we're using the Pool allocator/deallocator for this type. BUG=angleproject:993 Change-Id: If8c95f6054d07291e7014be0d4e35766ba2e943b Reviewed-on: https://chromium-review.googlesource.com/269131 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Olli Etuaho f40319e9 2015-03-10T14:33:00 Add basic support for array constructors Add limited support for parsing array constructors and writing them out as GLSL code. Still missing from this version: HLSL output, array support in initializer lists, arrays with implicit size. BUG=angleproject:941 Change-Id: I7febf80923c4cd0b730399f1f49f9456cf3668e9 Reviewed-on: https://chromium-review.googlesource.com/260572 Reviewed-by: Geoff Lang <geofflang@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 3c1dfb5a 2015-02-20T11:34:03 Add stubs for switch and case output BUG=angle:921 Change-Id: I58bd645a8d53ef5bad9b680e54c8948d50932fca Reviewed-on: https://chromium-review.googlesource.com/251525 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang 0a73dd85 2014-11-19T16:18:08 Fix include guards. BUG=angle:733 Change-Id: I08b2c11c4831f1161c178c1842b10e807185aced Reviewed-on: https://chromium-review.googlesource.com/230831 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill b1a85f48 2014-08-19T15:23:24 Rename compiler intermediate source files. This prevents confusion between "TIntermediate" and "TIntermNode". BUG=angle:711 Change-Id: Ib7a086382a479db3f77bf2ab06ce321aa7b35d13 Reviewed-on: https://chromium-review.googlesource.com/212936 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Nicolas Capens <capn@chromium.org>
Jamie Madill 01f85ac8 2014-06-06T11:55:04 Refactor GLSL scoped structure handling. With a unique ID, similar to how we handle scoped structures in the HLSL translator, we can simplify the declared structure check. BUG=angle:618 Change-Id: I5fe61c8d353650ac67a7c7ecdf53a70b91a9b717 Reviewed-on: https://chromium-review.googlesource.com/202500 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Zhenyao Mo 9eedea03 2014-05-12T16:02:35 Fix code styles in OutputGLSLBase, SymbolTable, and Types. I came across these three classes in the last CL, so do some cleanup as I touched these classes. BUG= TEST=webgl conformance, no regressions Change-Id: I2819bab5965fcb4917f85c2eded571a7f95ab9a2 Reviewed-on: https://chromium-review.googlesource.com/199423 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Zhenyao Mo <zmo@chromium.org>
Zhenyao Mo 904a9164 2014-05-09T14:07:45 Fix nested struct scope support in GL backend. Basically we should be able to reuse a struct name once the previous use is out of the scope, or we can reuse it if we are in a inner scope than where it is defined before. BUG=368910 BUG=angle:618 TEST=conformance/glsl/bugs/nested-structs-with-same-name.html Change-Id: Icfac76b844deaca0c8a0501d7426ff3802e657dc Reviewed-on: https://chromium-review.googlesource.com/199137 Reviewed-by: Nicolas Capens <nicolascapens@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Zhenyao Mo <zmo@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>
Zhenyao Mo 550c600b 2014-02-26T15:40:48 Improvement on loop unrolling with loops indexing sampler arrays 1) Before this workaround is hardwired on mac, now we move it behind a compil 2) Fix the issue where "break" inside the loop isn't handled while unrolled. BUG=338474 TEST=webgl conformance test sampler-array-using-loop-index.html Change-Id: I4996a42c2dea39a8a5af772c256f8e3cb383f59a Reviewed-on: https://chromium-review.googlesource.com/188079 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Zhenyao Mo <zmo@chromium.org> Conflicts: include/GLSLANG/ShaderLang.h src/compiler/translator/ValidateLimitations.cpp Change-Id: I546197bd7df1634ebccdd380be14c3250cd56151 Reviewed-on: https://chromium-review.googlesource.com/189061 Reviewed-by: Shannon Woods <shannonwoods@chromium.org> Tested-by: Zhenyao Mo <zmo@chromium.org>
Jamie Madill 6b9cb259 2013-10-17T10:45:47 Rename ParseHelper.cpp/h to ParseContext.cpp/h. TRAC #24002 Signed-off-by: Shannon Woods Signed-off-by: Geoff Lang
Geoff Lang 17732823 2013-08-29T13:46:49 Moved the compiler source files into directories based on their project and added a compiler.gypi to generate the compiler projects.