src/compiler/translator/Compiler.h


Log

Author Commit Date CI Message
Shahbaz Youssefi 46149c0e 2021-09-17T15:38:47 Translator: Fix pruning functions that declare a struct When pruning unused functions, the entire declaration of the function is removed. If the function declares a struct as part of its return value, the declaration of that struct was lost. This change makes sure that declaration survives the pruning. For example: struct S { vec4 v; } unused_func() { ... } is now replaced with: struct S { vec4 v; }; This change also makes struct usage validation more stringent. Bug: chromium:1248753 Change-Id: Idd9a87fd2e785135775cfea62995fd33adaf3c09 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3169691 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@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 798c5200 2021-07-31T22:17:48 Translator: Make precise-ness a property of AST nodes Instead of creating a "set of precise nodes", the nodes themselves are marked precise. This change is preparation for another change that overhauls precision propagation through the nodes, and which would also be storing the promoted precision in the nodes. Bug: angleproject:4889 Change-Id: Ieec8864be5cd2e95ed6fb4d90b367946d9f33fa1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3065569 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 3036e090 2021-07-29T15:55:39 Vulkan: Direct SPIR-V Gen: Support the precise keyword The precise keyword is different in GLSL in that it defines what arithmetic operations _that have led to the value being assigned to a variable_ should be done precisely (i.e. not "contracted"). A tree traverser is implemented that detects precise access chains and applies precise-ness to the right hand side of assignment expressions to said access chains. This is only done if the shader uses the precise keyword in the first place. The algorithm for this is inspired by the implementation in glslang. This change additionally: - Fixes parser to allow precise on function parameters - Fixes GLSL code generation to output precise on struct members and function parameters. Bug: angleproject:4889 Change-Id: Ie3808c3c8c08da308e88af20f5f90379d9d14d47 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3056369 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 7c6da493 2021-07-26T21:24:25 Translator: Make sure built-in variables are consistent Some transformations left the tree in an inconsistent state, for example if it used gl_SampleMask from ES3.1+OES_sample_variables and the transformation added a usage of gl_SampleMask from ES3.2. The offending transformations are fixed and AST validation is improved to catch such errors. Bug: angleproject:4889 Change-Id: I9d9ea5bb43a9408dd4c6dc3e89ec20d60dfeff73 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3054613 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi a3df80ea 2021-07-19T17:15:13 Translator: Validate AST consistency w.r.t function calls This ensures that tree transformations don't create invalid function calls. Additionally, it's validated that no raw function calls are issued, as that's deprecated. Bug: angleproject:4889 Change-Id: Iabbb493dcc0a5654bbb5f930e402bf3492c89979 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3040119 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Kenneth Russell 2534ee4c 2021-07-02T12:18:07 Limit the size of declared variables in WebGL shaders. Add an implementation-specific limit for the sizes of variables (specifically arrays, structs, and arrays of structs) in WebGL 1.0 and 2.0 shaders, and interface blocks in WebGL 2.0 shaders, no matter whether they're input, output, or local variables. It is legal in the OpenGL ES and OpenGL ES Shading Language specifications to fail to compile shaders for implementation-specific reasons. Add WebGLCompatibilityTests covering the new limit. Bug: chromium:1220237 Change-Id: I6c1d24a5d9a382ba4454c2dfbb856ab9468f5409 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3023033 Commit-Queue: Kenneth Russell <kbr@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 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>
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 58eabfd7 2021-04-08T23:57:04 Translator: Validate consistent variable references Some transformations change variable declarations. This validation ensures that all references to said variables are appropriately replaced as well. Bug: angleproject:2733 Change-Id: I6c2873968eeed4cba66e70069f84eb69a1f77074 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2818140 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
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>
Jamie Madill 173f1c94 2020-12-03T13:53:16 Translator: Collect gl_in as a varying. This unifies the variable handling for IO blocks. Previously the gl_in block we treated as an "in block" similar to an interface block. Bug: angleproject:5423 Change-Id: Idf2db4c209055fa9ffca567dab39c89464eba156 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2571966 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Charlie Lao 24f64249 2020-11-16T17:55:02 Vulkan: Track specialization constant usage bit and feedback to ctx Right now context does not know which specialization constant is used by the shader. Whenever a specialization constant changes, we assume shader program is using it, we always reach into vulkan driver to ask for a new program. Instead we can track shader's usage of specialization constant so that context can utilize this information to avoid recompile pipeline program if an unused specialization constant has changed. This CL implements the plumbing the usage bits form compiler to program object, it does not actually utilize the usage bits to avoid unnecessary compilation yet. Bug: b/173461931 Change-Id: Iebc9d0638c17b1a282c8b6093ce6bae154246e57 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2542866 Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Jamie Madill 7a0faa82 2020-09-24T20:15:26 Revert "Pass #pragma optimize setting down to compilation." This reverts commit 499173de1c91932ba272269cab6918bf7e8d7c11. Reason for revert: Causes unexpected HLSL compiler errors in some cases. See bug. Bug: angleproject:5094 Original change's description: > Pass #pragma optimize setting down to compilation. > > This will allow us to disable optimizations in the back-end. This can > be useful both for developers and for ANGLE to disable very slow > shader compilation on D3D11. > > Also apply this pragma to VerifyMaxVertexUniformVectorsWithSamplers. > Reduces compilation time by half in local testing. > > Bug: angleproject:5076 > Change-Id: I64ad576e11b9cee5b41f8af0d3621570304d65c2 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2420749 > Commit-Queue: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> > Reviewed-by: Geoff Lang <geofflang@chromium.org> TBR=geofflang@chromium.org,jonahr@google.com,jmadill@chromium.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: angleproject:5076 Change-Id: I733e788fe8e9421ae0af662c0eb51af1ed79dde3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2429517 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 499173de 2020-09-20T10:42:56 Pass #pragma optimize setting down to compilation. This will allow us to disable optimizations in the back-end. This can be useful both for developers and for ANGLE to disable very slow shader compilation on D3D11. Also apply this pragma to VerifyMaxVertexUniformVectorsWithSamplers. Reduces compilation time by half in local testing. Bug: angleproject:5076 Change-Id: I64ad576e11b9cee5b41f8af0d3621570304d65c2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2420749 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Charlie Lao dee4d7a5 2020-04-10T10:22:56 Vulkan: Early fragment tests optimization Checks if early fragment tests as an optimization is feasible and enable it if we can. In the link time, if context state diagrees with optimization (in rare case), then remove the ExecutionModeEarlyFragmentTests sprv op code. Bug: angleproject:4508 Change-Id: Ifbb06c0ffb050a9f3ddb16ab50362e908b4b9cf6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2136490 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
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>
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>
Courtney Goeltzenleuchter 33a00efd 2019-11-27T09:21:45 Add Compute Shared Memory Size Validation Add tracking of shared memory declarations in compute shaders. Test:   angle_deqp_gles31_tests --gtest_filter=dEQP.GLES31/functional_debug_negative_coverage_callbacks_compute_exceed_shared_memory_size_limit Bug: 4173 Change-Id: If2a86d467a82f73fa5b2ee0ced752701acfe1872 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1934653 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tim Van Patten 90a58622 2019-09-04T15:39:58 Refactor ShaderVariable to Remove Specializations The following structs are being refactored and moved into the parent struct ShaderVariable: VariableWithLocation Uniform Attribute OutputVariable InterfaceBlockField Varying Bug: angleproject:3899 Test: CQ Change-Id: I389eb3ab4ed44a360e09fca75ecc78d64a277f83 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1785877 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Commit-Queue: Tim Van Patten <timvp@google.com>
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>
Tobin Ehlis 5546fb4f 2019-01-17T12:25:54 Vulkan:Adding custom pool allocator Migrated pool allocator used by compiler to common. Planning to use this for ANGLE custom command buffers so this some refactoring in preparation for that work. Added a unit test to check PoolAllocator functionality. Bug: angleproject:2951 Reviewed-on: https://chromium-review.googlesource.com/c/1476953 Reviewed-by: Jamie Madill <jmadill@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Tobin Ehlis <tobine@google.com> Change-Id: I0b4f3d55ea1799e35c9799c221f7129233f30b24 Reviewed-on: https://chromium-review.googlesource.com/c/1492972
Yuly Novikov 0546b538 2019-02-25T22:47:17 Revert "Vulkan:Adding custom pool allocator" This reverts commit 941717496141b96f1d5817f31c2bb4a4e19847b9. Reason for revert: crashes on Debug bots Original change's description: > Vulkan:Adding custom pool allocator > > Migrated pool allocator used by compiler to common. > > Planning to use this for ANGLE custom command buffers so this some > refactoring in preparation for that work. > > Added a unit test to check PoolAllocator functionality. > > Bug: angleproject:2951 > Change-Id: I29618cfdb065b8a5fefd40719a35d27b1f6e99ef > Reviewed-on: https://chromium-review.googlesource.com/c/1476953 > Reviewed-by: Jamie Madill <jmadill@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Tobin Ehlis <tobine@google.com> TBR=ynovikov@chromium.org,jmadill@google.com,tobine@google.com,syoussefi@chromium.org Change-Id: Id8c522bd1d94154e871211d975e801a55cc9c257 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:2951, angleproject:3169 Reviewed-on: https://chromium-review.googlesource.com/c/1487977 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Tobin Ehlis 94171749 2019-01-17T12:25:54 Vulkan:Adding custom pool allocator Migrated pool allocator used by compiler to common. Planning to use this for ANGLE custom command buffers so this some refactoring in preparation for that work. Added a unit test to check PoolAllocator functionality. Bug: angleproject:2951 Change-Id: I29618cfdb065b8a5fefd40719a35d27b1f6e99ef Reviewed-on: https://chromium-review.googlesource.com/c/1476953 Reviewed-by: Jamie Madill <jmadill@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Tobin Ehlis <tobine@google.com>
Jamie Madill c09ae15c 2019-02-01T14:16:32 Enable -Wextra-semi and -Wextra-semi-stmt. This will prevent users from accidentally making semicolon errors in the future. Bug: chromium:926235 Change-Id: I79a6fa376fb1ad8f0fcf1b65b1f572a035d1f4e9 Reviewed-on: https://chromium-review.googlesource.com/c/1446493 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Nico Weber <thakis@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 91d469aa 2018-08-27T10:47:25 Initial support for compiler AST validation This is to be able to catch issues introduced through AST manipulation earlier than shader compilation time, improving debuggability. Bug: angleproject:2733 Change-Id: Ic57bc72f2ab438e60f32553d602074f3d72cc4f5 Reviewed-on: https://chromium-review.googlesource.com/c/1199922 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Tobin Ehlis 47ca1b2f 2019-01-23T16:11:41 Revert "Vulkan: Adding custom pool allocator" This reverts commit 05459e06fde5047ae8f5f90fe091c3255e6bc88e. Reason for revert: Clusterfuzz bugs flagged this commit Original change's description: > Vulkan: Adding custom pool allocator > > Copied pool allocator used by compiler to common and hooking it up as > custom allocator for CommandPools. Modified it to support reallocation. > > RendererVk now has a private poolAllocator and VkAllocationCallbacks > struct. The allocation callbacks are initialized to static functions > in RendererVk::initializeDevice() and then passed to CommandPool init() > and destroy() functions. > > Using the pool allocator saves Command Pool/Buffer clean-up time which > was showing us as a bottleneck is some cases. > > Bug: angleproject:2951 > Change-Id: I81aa8a7ec60397676fa722d6435029db27947ef4 > Reviewed-on: https://chromium-review.googlesource.com/c/1409867 > Commit-Queue: Tobin Ehlis <tobine@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> TBR=jmadill@chromium.org,tobine@google.com,ianelliott@google.com,syoussefi@chromium.org Change-Id: I363a351667c4dddef79833061790da90de477e70 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:2951 Reviewed-on: https://chromium-review.googlesource.com/c/1430679 Reviewed-by: Tobin Ehlis <tobine@google.com> Commit-Queue: Tobin Ehlis <tobine@google.com>
Tobin Ehlis 05459e06 2019-01-17T12:25:54 Vulkan: Adding custom pool allocator Copied pool allocator used by compiler to common and hooking it up as custom allocator for CommandPools. Modified it to support reallocation. RendererVk now has a private poolAllocator and VkAllocationCallbacks struct. The allocation callbacks are initialized to static functions in RendererVk::initializeDevice() and then passed to CommandPool init() and destroy() functions. Using the pool allocator saves Command Pool/Buffer clean-up time which was showing us as a bottleneck is some cases. Bug: angleproject:2951 Change-Id: I81aa8a7ec60397676fa722d6435029db27947ef4 Reviewed-on: https://chromium-review.googlesource.com/c/1409867 Commit-Queue: Tobin Ehlis <tobine@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@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>
Jamie Madill c3bef3e7 2018-10-03T07:35:09 Allow 'defined' in define in non-WebGL. This is needed to pass dEQP conformance. Several of the harder dEQP tests around this behaviour are excluded from the mustpass list. This is presumably because the behaviours weren't implemented portably. Nevertheless we need to support conformant behaviour for GLES 2.0 Contexts for the most simple uses. This also leaves the error behaviour intact for WebGL specs. Bug: angleproject:1335 Change-Id: Ia80b4f71475efa928488ee6c2ee35c566d4602d4 Reviewed-on: https://chromium-review.googlesource.com/c/1242013 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jiawei Shao e41df655 2018-02-09T14:31:39 ES31: Add shader version check for CS and GS This patch adds the missing check on the shader version for compute and geometry shaders, which can fix a bug that ANGLE GLSL compiler doesn't report a compile error when compiling an empty compute or geometry shader in version 100 or 300. This patch also updates the original compiler tests on the check of shader version. In these tests, the compile errors are all caused by illegal layouts instead of shader versions, which is against the purpose of the tests. This patch also fixes an incorrect case that used an empty compute shader in version 300. BUG=angleproject:1442, angleproject:1941 TEST=angle_unittests Change-Id: Ic26bb8eb312dbc0cec6a879997d0ae7a2e625a0f Reviewed-on: https://chromium-review.googlesource.com/910715 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho b5601eb6 2017-11-15T18:08:04 Only initialize globals if initialization flag is set This avoids the possibility of initializing globals twice in Chromium. Now we also never initialize variables redundantly in case we're writing HLSL output. This was already the intent of the code before, but a mistake had slipped in and the code didn't actually check the output type properly. This also simplifies DeferGlobalInitializers by running it after SeparateDeclarations. BUG=chromium:735497 TEST=WebGL conformance tests Change-Id: I95036a24ac8cf18113755510376a2fca286b3ee6 Reviewed-on: https://chromium-review.googlesource.com/771555 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho d10cf69e 2017-11-02T11:06:14 Remove repeated "success" check from compileTreeImpl This refactoring simplifies the compilation code by putting AST checks and simplification into a separate function. This function will immediately return false when an error is encountered. This is easier to maintain than repeated checking of a "success" boolean. BUG=angleproject:2068 TEST=WebGL conformance tests, angle_unittests, angle_end2end_tests Change-Id: I1ae1c8def3625ada1482104a6babe605405229ef Reviewed-on: https://chromium-review.googlesource.com/750085 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@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>
Jiawei Shao d8105a03 2017-08-08T09:54:36 ES31: Implement gl_in in Geometry Shader This patch intends to implement geometry shader built-in interface block instance gl_in defined in GL_OES_geometry_shader. 1. Add the definition of gl_in and its interface block gl_PerVertex into the symbol table. 2. Support gl_Position as a member of gl_in. 3. Set the array size of gl_in when a valid input primitive type is known. 4. Add check that it should be a compile error to index gl_in or call length() on gl_in without a valid input primitive declaration. This patch also adds unit tests to cover all these new features. BUG=angleproject:1941 TEST=angle_unittests Change-Id: I8da20c943b29c9ce904834625b396aab6302e1e1 Reviewed-on: https://chromium-review.googlesource.com/605059 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 78ed6cd9 2017-08-09T16:19:00 Rename VariableInfo files to CollectVariables Files that only have a single function should be named consistently with the function. Unnecessary include in CallDAG.h is removed. BUG=angleproject:2068 TEST=angle_unittests Change-Id: I27d55a766b9eb66fcfd1e0a2341a2843bb9dc5bb Reviewed-on: https://chromium-review.googlesource.com/608368 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jiajia Qin 9b11ea4f 2017-07-11T16:50:08 Gather UniformBlock and ShaderStorageBlock separately Refactor InterfaceBlocks since it only stands for UniformBlock before ES31. But for ES31, uniform block and shader storage block both belong to interface block. This CL will add GetUniformBlocks and GetShaderStorageBlocks in ShaderLang.h. Meanwhile, keep GetInterfaceBlocks which can return all the interface blocks together. BUG=angleproject:1951 Change-Id: I3036e201aadfbd490575ed03538c81bcc3793ff3 Reviewed-on: https://chromium-review.googlesource.com/582546 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jiawei-Shao df7d7c9e 2017-07-31T09:34:04 Split varyings into input and output varyings in compiler This patch intends to split all vector<Varying> into two vectors to store input and output varyings separately in the compiler. This patch is a base of implementing the built-ins, inputs and outputs of a geometry shader to ANGLE GLSL compiler. Unlike the vertex shaders (their outputs are varyings) and fragment shaders (their inputs are varyings), the inputs and outputs of geometry shaders are all varyings, so we need two vector<Varying> to store them correctly. BUG=angleproject:1941 Change-Id: I9e8cc16045d5e29e9a80a09dc31b33a7ae39b345 Reviewed-on: https://chromium-review.googlesource.com/593347 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@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 4dd06d5d 2017-07-05T12:41:06 Set proper symbol ids on temporary symbol nodes Temporary symbols used to all have symbol id 0. Now they get assigned unique symbol ids. This makes it possible to keep track of them according to the symbol id instead of their name, paving way to more robust AST handling in the future. BUG=angleproject:1490 TEST=angle_unittests Change-Id: I292e2e483cc39173524fd30a30b48c4c808442e5 Reviewed-on: https://chromium-review.googlesource.com/559335 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho b12040c4 2017-06-27T14:20:45 Clean up redundant initialization of gl_Position In case gl_Position is statically used in the input shader, setting the INIT_OUTPUT_VARIABLES flag will initialize gl_Position. Avoid redundant initialization of gl_Position in this case. Includes cleaning up memory management in InitOutputVariables_test: all the pool-allocated variables will be freed at the end of each test when the memory pool is cleared, so manual memory management is not needed. Also includes making the zero node check used in unit tests stricter so that the tests are more reliable and moving it to ShaderCompileTreeTest.h so that it can be reused in the future. BUG=angleproject:2092 TEST=angle_unittests Change-Id: I323a0a094afa6cea95c8a64e681d9fc485137423 Reviewed-on: https://chromium-review.googlesource.com/549418 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 19515019 2017-06-26T18:00:17 Refactor CollectVariables New helper functions are added for collecting built-in variables, and the traverser is encapsulated inside VariableInfo.cpp. The helper functions get data for built-in variables from the symbol table, so a duplicate copy of the data doesn't need to be maintained in CollectVariables any more. BUG=angleproject:2068 TEST=angle_unittests Change-Id: I42595d0da0e5d4fb634a3d92f38db1dd6dd9efab Reviewed-on: https://chromium-review.googlesource.com/549323 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 12b0b399 2017-05-30T13:22:31 Clean up ValidateOutputs Remove the validateOutputs method from Compiler and replace it with a static method alongside the traverser. This encapsulates the ValidateOutputs implementation better. TEST=angle_unittests BUG=angleproject:2068 Change-Id: I1788cb9726db41ca35fd0e746f8d48ced7fee74f Reviewed-on: https://chromium-review.googlesource.com/535477 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 0ffc441e 2017-05-19T14:18:55 Initialize uninitialized globals in GLSL output Initializing globals is done by the DeferGlobalInitializers AST transformation, which makes sure that the global variable init proceeds in the correct order. This is important since some global variables may use other uninitialized globals in their initializers. The global variable init is only done in case the WebGL shader spec is being followed. This avoids adding global initializers twice in case the same shader goes through multiple translations, assuming only one of them is a WebGL shader translation. BUG=angleproject:1966 TEST=angle_end2end_tests, WebGL conformance tests Change-Id: Iea701d3ae40edc906abd87303f2aa27fd23bf55a Reviewed-on: https://chromium-review.googlesource.com/509689 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho b427920e 2017-05-18T15:08:24 Clean up ValidateMaxParameters 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_unittests Change-Id: I18a98eff9710485c0cdce73e7fffe124f7d7afb2 Reviewed-on: https://chromium-review.googlesource.com/508791 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
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 9cbc07c3 2017-05-10T18:22:01 Simplify AST transformations that need to find main Share code for finding the main function from the AST between InitializeVariables, DeferGlobalInitializers, EmulateGLFragColorBroadcast and UseInterfaceBlockFields. This makes InitializeVariables simpler in particular, as it doesn't need an AST traverser anymore. BUG=angleproject:2033 TEST=angle_unittests, WebGL conformance tests Change-Id: I14c994bbde58a904f6684d2f0b72bd8004f70902 Reviewed-on: https://chromium-review.googlesource.com/501166 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 9ec79391 2017-03-31T23:04:23 Use TLValueTrackingTraverser in ValidateLimitations Use TLValueTrackingTraverser to determine whether a loop index is used as an l-value. This replaces custom logic in ValidateLimitations, greatly simplifying the code. Also pass the symbol table to ValidateLimitations as a parameter, which removes the need to store a global pointer to the current ParseContext. BUG=angleproject:1960 TEST=angle_unittests, WebGL conformance tests Change-Id: I122c85c78bbea05833d7c787cd184de568c5c45f Reviewed-on: https://chromium-review.googlesource.com/465606 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
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 77ba408a 2016-12-16T12:01:18 Unify Diagnostics interface Use the same kind of interface for reporting preprocessor errors as for reporting regular compiler errors, and make global errors like having too many uniforms also go through Diagnostics. Also don't create std::string objects unnecessarily. Includes cleanups of some dead code related to reporting errors. BUG=angleproject:1670 TEST=angle_unittests Change-Id: I3ee794d32ddeec1826bdf1b76b558f35259f82c0 Reviewed-on: https://chromium-review.googlesource.com/421527 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>
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 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>
Yuly Novikov c5fa0ad5 2016-10-25T21:36:54 Revert "Remove invariant qualifier for input in fragment shader" This reverts commit d842a6b2014447db0676c8a3f5a5e9ae4ce67d9a. Because of WebglConformance_conformance_glsl_bugs_invariant_does_not_leak_across_shaders failure BUG=chromium:659326 Change-Id: I0602e24f3d34ccf852cda865f673c5c7634f82a6 Reviewed-on: https://chromium-review.googlesource.com/403230 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Qiankun Miao d842a6b2 2016-08-29T10:05:27 Remove invariant qualifier for input in fragment shader 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. In ESSL 3.00, inputs cannot be declared as invariant. ANGLE should follow this rule for GLSL >= 4.20. BUG=chromium:639760 Change-Id: I7f7a07401381ac970488b69752f6d50d4f19d31f Reviewed-on: https://chromium-review.googlesource.com/400005 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Qin Jiajia 7835b525 2016-10-08T11:20:17 Reland "Add workaround for unused std140 and shared uniform blocks on MacOS" On some Mac drivers with shader version 4.1, they will treat unused std140 and shared uniform blocks' members as inactive. However, WebGL2.0 based on OpenGL ES3.0.4 requires all members of a named uniform block declared with a shared or std140 layout qualifier to be considered active. The uniform block itself is also considered active. This workaround is to reference all members of unused std140 and shared uniform blocks at the beginning of the vertex/fragment shader's main(). BUG=chromium:618464 TEST=UniformBufferTest.ActiveUniformBlockNumber Change-Id: I18da4e2b61b0170068bf5ea38ce54667b0737780 Reviewed-on: https://chromium-review.googlesource.com/395648 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@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>
Kenneth Russell c9e6026c 2016-09-30T17:15:07 Revert "Add workaround for unused std140 and shared uniform blocks on MacOS" This reverts commit 9aa83fe302578d226f195fff5fb3f0e2fb723a4c. The new test UniformBufferTest.ActiveUniformNumberAndName/ES3_OPENGL is failing on multiple platforms. Examples: https://build.chromium.org/p/chromium.gpu.fyi/builders/Mac%2010.10%20Release%20%28ATI%29/builds/12285 https://build.chromium.org/p/chromium.gpu.fyi/builders/Linux%20Release%20(ATI) Change-Id: I78b1a4d58e9a291e40ad304eb32f990e0518f7ee Reviewed-on: https://chromium-review.googlesource.com/391049 Reviewed-by: Kenneth Russell <kbr@chromium.org>
Qin Jiajia 9aa83fe3 2016-09-29T08:42:42 Add workaround for unused std140 and shared uniform blocks on MacOS On some Mac drivers with shader version 4.1, they will treat unused std140 and shared uniform blocks' members as inactive. However, WebGL2.0 based on OpenGL ES3.0.4 requires all members of a named uniform block declared with a shared or std140 layout qualifier to be considered active. The uniform block itself is also considered active. This workaround is to reference all members of unused std140 and shared uniform blocks at the beginning of the vertex/fragment shader's main(). BUG=chromium:618464 TEST=UniformBufferTest.ActiveUniformBlockNumber Change-Id: I1d2c5e3e8da04786ac6a37fd26f7bb9c14cd76ed Reviewed-on: https://chromium-review.googlesource.com/387169 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: 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>
Olli Etuaho 966456de 2016-09-12T11:42:44 Remove SH_TIMING_RESTRICTIONS compiler flag The timing restrictions code is not in use and not updated for ESSL3, so it is better to remove it to make refactoring the AST easier. It can also be argued that perfect prevention of shader timing attacks is not feasible due to factors that are not under control of ANGLE, such as fixed function color compression in GPUs. Such color compression may make the use of texture bandwidth and thus performance dependent on the content of a texture regardless of whether a compressed format is chosen through the API. SH_DEPENDENCY_GRAPH flag that could only be active together with the timing restrictions flag is also removed, along with all the code that was supporting it. The newer CallDAG code is used for different purposes and is kept. BUG=angleproject:1490 TEST=angle_unittests Change-Id: I2cd10e18df366e8e43f7c3af1ca12d2a4bfb2007 Reviewed-on: https://chromium-review.googlesource.com/384511 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Qiankun Miao c2c5fc48 2016-08-31T15:24:22 Remove CSS Shader related code CSS shader has been removed from spec and chrome code base. Remove the code in ANGLE. BUG=chromium:233383 Change-Id: I93a35437f540e51ce7af9d49f21ca60d7c0b156a Reviewed-on: https://chromium-review.googlesource.com/378739 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@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>
Olli Etuaho 27776e33 2016-07-22T14:00:56 Fix member variable masking warning in standalone MSVS build The patch for initializing output variables introduced a warning that broke MSVS 2015 standalone build. The "shaderType" variable passed to TCompiler::initializeOutputVariables was unnecessary and had the same name as a member variable of TCompiler that stores the shader type. TEST=MSVS 2015 build Change-Id: I9e01f5eae77a88babde21d4864a02c8731a220de Reviewed-on: https://chromium-review.googlesource.com/362550 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Zhenyao Mo 72111915 2016-07-20T17:45:56 Initialize all output variables. BUG=angleproject:1441 TEST=bots Change-Id: Ia4cf415d8346c3234bf0f548a178ee3ea8cd35c4 Reviewed-on: https://chromium-review.googlesource.com/362110 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Commit-Queue: Zhenyao Mo <zmo@chromium.org>
Olli Etuaho 19d1dc99 2016-03-08T17:18:46 Add option to limit the number of function parameters Trying to compile user-defined functions that have thousands of parameters introduces some instability in native compilers, so it is better to reject shaders with large numbers of function parameters in ANGLE. The check is only enabled if the SH_LIMIT_EXPRESSION_COMPLEXITY flag is turned on. The default limit for the number of parameters is 1024, but it can also be configured. BUG=angleproject:1338 TEST=angle_unittests Change-Id: I5c9b7a4e97e67f36e77f969368336fa8fffba1c3 Reviewed-on: https://chromium-review.googlesource.com/331970 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 183d7e24 2015-11-20T15:59:09 Remove predefined precision qualifiers from ESSL3 samplers New sampler types in ESSL3 should not have default precision qualifiers. This is specified in ESSL 3.00.4 section 4.5.4. BUG=angleproject:1222 TEST=angle_unittests Change-Id: I9c8e7a5fbb4278db80de79bcaeebaf23e64242a0 Reviewed-on: https://chromium-review.googlesource.com/312048 Tryjob-Request: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Olli Etuaho 5d91dda9 2015-06-18T15:47:46 Remove dynamic indexing of matrices and vectors in HLSL Re-re-relanding after clang warning fix. Re-re-landing with fix to setting qualifiers on generated nodes. The previous version failed when a uniform was indexed, because it would set the uniform qualifier on some of the generated nodes and that interfered with the operation of UniformsHLSL. Re-landing after fixing D3D9 specific issues. HLSL doesn't support dynamic indexing of matrices and vectors, so replace that with helper functions that unroll dynamic indexing into switch/case and static indexing. Both the indexed vector/matrix expression and the index may have side effects, and these will be evaluated correctly. If necessary, index expressions that have side effects will be written to a temporary variable that will replace the index. Besides dEQP tests, this change is tested by a WebGL 2 conformance test. In the case that a dynamic index is out-of-range, the base ESSL 3.00 spec allows undefined behavior. KHR_robust_buffer_access_behavior adds the requirement that program termination should not occur and that out-of-range reads must return either a value from the active program's memory or zero, and out-of-range writes should only affect the active program's memory or do nothing. This patch clamps out-of-range indices so that either the first or last item of the matrix/vector is accessed. The code is not transformed in case the it fits within the limited subset of ESSL 1.00 given in Appendix A of the spec. If the code isn't within the restricted subset, even ESSL 1.00 shaders may require this workaround. BUG=angleproject:1116 TEST=dEQP-GLES3.functional.shaders.indexing.* (all pass after change) WebGL 2 conformance tests (glsl3/vector-dynamic-indexing.html) Change-Id: I9f6d7c7ecda8ac4dc3c30b39e15a9a0b5381c5a8 Reviewed-on: https://chromium-review.googlesource.com/310010 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill a5f64de7 2015-10-30T12:31:00 Revert "Remove dynamic indexing of matrices and vectors in HLSL" Failing build on Clang-win: ..\..\third_party\angle\src\compiler\translator\RemoveDynamicIndexing.cpp(128,43) : error: expected '(' for function-style cast or type construction fieldType.setPrimarySize(unsigned char(indexedType.getRows())); ~~~~~~~~ ^ BUG=angleproject:1116 This reverts commit 7535b761dd4740c8e76b888d7c58c7cbeefd2083. Change-Id: I7b502e3dcd45e17b7ed88fec18be702614d9ac65 Reviewed-on: https://chromium-review.googlesource.com/309772 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 7535b761 2015-06-18T15:47:46 Remove dynamic indexing of matrices and vectors in HLSL Re-re-landing with fix to setting qualifiers on generated nodes. The previous version failed when a uniform was indexed, because it would set the uniform qualifier on some of the generated nodes and that interfered with the operation of UniformsHLSL. Re-landing after fixing D3D9 specific issues. HLSL doesn't support dynamic indexing of matrices and vectors, so replace that with helper functions that unroll dynamic indexing into switch/case and static indexing. Both the indexed vector/matrix expression and the index may have side effects, and these will be evaluated correctly. If necessary, index expressions that have side effects will be written to a temporary variable that will replace the index. Besides dEQP tests, this change is tested by a WebGL 2 conformance test. In the case that a dynamic index is out-of-range, the base ESSL 3.00 spec allows undefined behavior. KHR_robust_buffer_access_behavior adds the requirement that program termination should not occur and that out-of-range reads must return either a value from the active program's memory or zero, and out-of-range writes should only affect the active program's memory or do nothing. This patch clamps out-of-range indices so that either the first or last item of the matrix/vector is accessed. The code is not transformed in case the it fits within the limited subset of ESSL 1.00 given in Appendix A of the spec. If the code isn't within the restricted subset, even ESSL 1.00 shaders may require this workaround. BUG=angleproject:1116 TEST=dEQP-GLES3.functional.shaders.indexing.* (all pass after change) WebGL 2 conformance tests (glsl3/vector-dynamic-indexing.html) Change-Id: I16119f9092360fb72798f9550a6f4d3cfffdc92f Reviewed-on: https://chromium-review.googlesource.com/308790 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Zhenyao Mo <zmo@chromium.org>
Jamie Madill b066669d 2015-10-26T10:38:18 Revert "Remove dynamic indexing of matrices and vectors in HLSL" This reverts commit 3766a40d6fda7e7190514ab7838a3f37169d863f. This CL was causing crashes in UniformHLSL.cpp, where an internal uniform "base" was attempted to be declared in HLSL. Was crashing on an external WebGL 3D canvas page (http://www.taccgl.org/?dbg=t). BUG=546686 Original commit message: Re-landing after fixing D3D9 specific issues. HLSL doesn't support dynamic indexing of matrices and vectors, so replace that with helper functions that unroll dynamic indexing into switch/case and static indexing. Both the indexed vector/matrix expression and the index may have side effects, and these will be evaluated correctly. If necessary, index expressions that have side effects will be written to a temporary variable that will replace the index. Besides dEQP tests, this change is tested by a WebGL 2 conformance test. In the case that a dynamic index is out-of-range, the base ESSL 3.00 spec allows undefined behavior. KHR_robust_buffer_access_behavior adds the requirement that program termination should not occur and that out-of-range reads must return either a value from the active program's memory or zero, and out-of-range writes should only affect the active program's memory or do nothing. This patch clamps out-of-range indices so that either the first or last item of the matrix/vector is accessed. The code is not transformed in case the it fits within the limited subset of ESSL 1.00 given in Appendix A of the spec. If the code isn't within the restricted subset, even ESSL 1.00 shaders may require this workaround. BUG=angleproject:1116 TEST=dEQP-GLES3.functional.shaders.indexing.* (all pass after change) WebGL 2 conformance tests (glsl3/vector-dynamic-indexing.html) Change-Id: I1d4b2e3888e91af7d5eebf743d12778698b6b903 Reviewed-on: https://chromium-review.googlesource.com/308770 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@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 3766a40d 2015-06-18T15:47:46 Remove dynamic indexing of matrices and vectors in HLSL Re-landing after fixing D3D9 specific issues. HLSL doesn't support dynamic indexing of matrices and vectors, so replace that with helper functions that unroll dynamic indexing into switch/case and static indexing. Both the indexed vector/matrix expression and the index may have side effects, and these will be evaluated correctly. If necessary, index expressions that have side effects will be written to a temporary variable that will replace the index. Besides dEQP tests, this change is tested by a WebGL 2 conformance test. In the case that a dynamic index is out-of-range, the base ESSL 3.00 spec allows undefined behavior. KHR_robust_buffer_access_behavior adds the requirement that program termination should not occur and that out-of-range reads must return either a value from the active program's memory or zero, and out-of-range writes should only affect the active program's memory or do nothing. This patch clamps out-of-range indices so that either the first or last item of the matrix/vector is accessed. The code is not transformed in case the it fits within the limited subset of ESSL 1.00 given in Appendix A of the spec. If the code isn't within the restricted subset, even ESSL 1.00 shaders may require this workaround. BUG=angleproject:1116 TEST=dEQP-GLES3.functional.shaders.indexing.* (all pass after change) WebGL 2 conformance tests (glsl3/vector-dynamic-indexing.html) Change-Id: I66a5e5a8d7f4267da0045f1cc2ba6b0dc7eb3f5d Reviewed-on: https://chromium-review.googlesource.com/296671 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tryjob-Request: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Jamie Madill a0a9e12d 2015-09-02T15:54:30 translator: Add sh::OutputVariable type. This replaces the dual-use of sh::Attribute, which can be a bit confusing to people expecting a literal output variable. Currently not used in Chromium, so should be safe to land. BUG=angleproject:1146 Change-Id: I436f2bc9dc4ddc3709369cb2baa344c6b13a21a2 Reviewed-on: https://chromium-review.googlesource.com/296683 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 3c192a78 2015-08-26T20:32:53 Revert "Remove dynamic indexing of matrices and vectors in HLSL" Seems to be failing a WebGL/ES2 CTS test in D3D9: conformance/ogles/GL/mat3/mat3_001_to_006 BUG=angleproject:1116 BUG=525188 This reverts commit 83f3411da456faac8570892e3dd7d76edf4095e5. Change-Id: Ic186f51240dbdd96ccab3f5470329cdc9727c618 Reviewed-on: https://chromium-review.googlesource.com/295730 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 83f3411d 2015-06-18T15:47:46 Remove dynamic indexing of matrices and vectors in HLSL HLSL doesn't support dynamic indexing of matrices and vectors, so replace that with helper functions that unroll dynamic indexing into switch/case and static indexing. Both the indexed vector/matrix expression and the index may have side effects, and these will be evaluated correctly. If necessary, index expressions that have side effects will be written to a temporary variable that will replace the index. Besides dEQP tests, this change is tested by a WebGL 2 conformance test. In the case that a dynamic index is out-of-range, the base ESSL 3.00 spec allows undefined behavior. KHR_robust_buffer_access_behavior adds the requirement that program termination should not occur and that out-of-range reads must return either a value from the active program's memory or zero, and out-of-range writes should only affect the active program's memory or do nothing. This patch clamps out-of-range indices so that either the first or last item of the matrix/vector is accessed. The code is not transformed in case the it fits within the limited subset of ESSL 1.00 given in Appendix A of the spec. If the code isn't within the restricted subset, even ESSL 1.00 shaders may require this workaround. BUG=angleproject:1116 TEST=dEQP-GLES3.functional.shaders.indexing.* (all pass after change) WebGL 2 conformance tests (glsl3/vector-dynamic-indexing.html) Change-Id: I024722ef4ca1e14d5ad47fdc540397e18858bed6 Reviewed-on: https://chromium-review.googlesource.com/290515 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 4dfe8094 2015-08-21T17:44:35 Always collect variables when generating HLSL HLSL output needs uniform information generated by the collectVariables() step to be able to write uniform registers. Tested manually by compiling a shader with a uniform with shader_translator. BUG=angleproject:1132 Change-Id: I91d19b5fa789b7b33cf76a654ffbbd17d279db01 Reviewed-on: https://chromium-review.googlesource.com/294962 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@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 a7b6db7f 2015-08-19T14:26:30 Only apply Appendix A limitations to ESSL 1.00 shaders ESSL 1.00 specifies a set of minimum functionality, and ANGLE automatically checks that WebGL shaders stay within this minimum functionality. However, this should only apply to ESSL 1.00. ESSL 3.00 shaders compiled for WebGL 2.0 should not be subject to these restrictions, since there is no similar spec for minimum functionality for ESSL 3.00. In case a non-WebGL based shader spec is used, the restrictions can be toggled from outside by specifying the SH_VALIDATE_LOOP_INDEXING flag, same as before this patch. BUG=angleproject:1116 TEST=WebGL 2 conformance tests Change-Id: Idaec0fb4c7c85cd72020d0b23112fddb1b020571 Reviewed-on: https://chromium-review.googlesource.com/293933 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Dmitry Skiba 2539fffa 2015-06-16T17:56:09 Add ShClearResults() for clearing last compilation results. This helps reclaiming memory used by the results when we don't need them anymore. BUG=492725 Change-Id: I4bc11be27b23589548120f0dc43e9979bf894089 Reviewed-on: https://chromium-review.googlesource.com/277808 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Dmitry Skiba <dskiba@google.com> Tested-by: Dmitry Skiba <dskiba@google.com> Reviewed-by: Dmitry Skiba <dskiba@google.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>
Corentin Wallez a094a8a9 2015-04-07T11:53:06 Add a compiler option to prune unused function and prototypes Also adds a simple unit test checking the pruning BUG=angleproject:937 BUG=395048 Change-Id: I88440378f66178dcebebcd596f8f80235903f20e Reviewed-on: https://chromium-review.googlesource.com/264568 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Jamie Madill 78b3a8b9 2015-04-08T16:04:24 Revert "Add a compiler option to prune unused function and prototypes" Compile error on Mac: http://build.chromium.org/p/chromium.gpu.fyi/builders/GPU%20Mac%20Builder/builds/29051 This reverts commit e423d9ca6e1b340ae06d543419b8a515de5ac3f2. Change-Id: Ie08d7f2bf86089a006f3177480aa7491a9405257 Reviewed-on: https://chromium-review.googlesource.com/264585 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Corentin Wallez e423d9ca 2015-04-07T11:53:06 Add a compiler option to prune unused function and prototypes Also adds a simple unit test checking the pruning BUG=angleproject:937 BUG=395048 Change-Id: I49904c34d1a72949cdc579569967d99c736c7237 Reviewed-on: https://chromium-review.googlesource.com/264415 Reviewed-by: Kenneth Russell <kbr@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Corentin Wallez 71d147f6 2015-02-11T11:15:24 Implemented a CallDAG to allow for more AST analysis The CallDAG preprocesses the AST to construct a DAG of functions that can be used for several analyses. Use it to implement check for recursion and max call depth. It will also be used to limit the usage of [[flatten]] and [[unroll]]. BUG=angleproject:937 BUG=395048 Change-Id: I8578703f2d49513f315aecccbcff34914562e4ff Reviewed-on: https://chromium-review.googlesource.com/263774 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Nicolas Capens <capn@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>