src/compiler


Log

Author Commit Date CI Message
Shahbaz Youssefi d20afde4 2021-08-05T23:06:44 Vulkan: Retain precision of uniform variables When gathering in a uniform block, the precision of default uniforms was dropped. Bug: angleproject:4889 Bug: angleproject:6132 Change-Id: Ie6a8e2e7cef7cd3808cee08d20f886fc4e762cd5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3076124 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Kenneth Russell 1654537d 2021-08-06T17:49:52 Fix default and driver uniforms' binding indices. These abstractions were introduced in the SymbolTable during upstreaming of the direct-to-Metal compiler and were accidentally swapped, leading to widespread test failures. Fix the comment reference in ContextMtl's DriverUniforms struct. Add missing emulatedInstance field, and add a TODO about its missing support in direct-to-Metal translator. Define it in SPIR-V Metal translator; the driver uniforms for the two must match. Bug: angleproject:6259 Change-Id: I0330ab4efca5b64a749b9cca90564fdbc84d7a80 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3078998 Commit-Queue: Kenneth Russell <kbr@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Kenneth Russell d191bc32 2021-08-06T12:59:39 Reintroduce TType::isRank0. This concept was used in the direct-to-Metal compiler, and its replacement with isScalar wasn't completely correct. Fixes several assertion failures in tests. Bug: angleproject:4889 Bug: angleproject:5505 Change-Id: I9b8800ed50591560c8e53faa81eca581c4f07a02 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3078474 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Kenneth Russell <kbr@chromium.org>
Shahbaz Youssefi 63248e7f 2021-08-05T23:49:23 Translator: Fix dead-code-elimination corner case The DCE code had a corner case bug where a switch case containing multiple DCE'ed `break`s followed by another case would cause some of the DCE'ed statements in the first case to be doubly pruned, failing on an assertion. This was due to the fact that visitBlock() was asking traversal to continue if a new case was visited while pruning nodes, but the traversal does not take into account that some statements need to be skipped and so would also visit the pruned statements. If the pruned statements contain a branch instruction, they get re-pruned. The visitBlock() function that does the pruning is reworked so that it more clearly traverses the statements. Bug: chromium:1237200 Change-Id: Ib078c2ea73ade756c7d7ef5a5c489fa53c39f352 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3077659 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 0cd99779 2021-08-05T10:35:10 Translator: Propagate precision to children nodes Similarly to glslang, when the precision of a node is determined, propagate that precision to any of its children that doesn't already have a precision. Ultimately these should only include TIntermConstantUnion nodes. Bug: angleproject:4889 Bug: angleproject:6132 Change-Id: I121231d04c7cf92fc3f07716019ffe88eca48b88 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3075126 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 2e8a2d3c 2021-08-04T11:04:44 Translator: Helpers to derive precision Bug: angleproject:4889 Bug: angleproject:6132 Change-Id: I75e2084c76139ccb24b266f262d5e5597d8aa4ca Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3071599 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
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 6fe91881 2021-08-02T11:13:13 Translator: Simplify RecordConstantPrecision Just before ESSL output, this transformation made some constants specified through temp variables such that their precision can be specified. This was done in cases where the precision actually affected the expression being evaluated. This transformation is simplified by declaring constants more conservatively as variables, and not stringently attempting to identify whether that's necessary. This is still not done in trivial cases. This change is in preparation for another change that overhauls precision propagation through the nodes. This change removes all references to TIntermTyped::getPrecision() outside the precision promotion code itself. Bug: angleproject:4889 Change-Id: I135b2b3241aa2f76219b209241c3844f1d09ccd2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3067948 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 09d5047b 2021-08-03T01:31:03 GL: Remove the rewriteVectorScalarArithmetic workaround This workaround was implemented for a bug in Nvidia driver 387 which is end-of-life. More recent driver branches (390 and 4XX) are fixed, and so this workaround is no longer required. The implementation of the workaround itself could introduce bugs. Bug: chromium:772651 Bug: chromium:1201084 Change-Id: I3db179eb90d9124235bdad2daacc712302906d8e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3067952 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Brandon Schade 217acac2 2021-07-21T12:42:56 Vulkan: Add support for EXT_primitive_bounding_box 1. Added support for EXT_primitive_bounding_box extension 2. Renamed shader variable gl_BoundingBoxEXT[] to ANGLEBoundingBox[] Bug: angleproject:3576 Test: dEQP-GLES31.functional.primitive_bounding_box.* Change-Id: I15fa9af50c6fd8e86d225670ddd8eb39f6e65d35 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3053618 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi f9942640 2021-08-03T11:45:31 Translator: Fix fuzzer crashing on assertion An assertion was triggered by the fuzzer when generating an invalid shader that redeclared a built-in. The assertion itself was unnecessary and the parser would appropriately generate an error if that assertion would have fired. Bug: angleproject:4889 Bug: chromium:1235229 Change-Id: I294b2e329491c75d4e87622b602570252555869f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3063910 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi a65b4056 2021-07-30T23:00:57 Reland "Translator: Clean up type cloning" This is a reland of f016c4352f5203c10511df078b1ed5359afc1b35 Original change's description: > Translator: Clean up type cloning > > TType has a constructor that aids cloning + helpers to convert between > types. A number of places where a type is constructed from the > information gathered from another type is changed to clone the type and > then use one of these helpers. > > This clean up is part of an ongoing work to improve precision handling. > This change removes many references to TType::getPrecision(). > > Bug: angleproject:4889 > Change-Id: Ib85659ab5363b56ad298f8648fca856edc1ebf8b > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3063944 > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Tim Van Patten <timvp@google.com> Bug: angleproject:4889 Change-Id: I35772f178eb4f6cf2b64bfeb37a4a144acdb4daf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3067802 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Austin Eng c5c8a25a 2021-08-03T14:40:33 Revert "Translator: Clean up type cloning" This reverts commit f016c4352f5203c10511df078b1ed5359afc1b35. Reason for revert: Suspect for crbug.com/1236060 Original change's description: > Translator: Clean up type cloning > > TType has a constructor that aids cloning + helpers to convert between > types. A number of places where a type is constructed from the > information gathered from another type is changed to clone the type and > then use one of these helpers. > > This clean up is part of an ongoing work to improve precision handling. > This change removes many references to TType::getPrecision(). > > Bug: angleproject:4889 > Change-Id: Ib85659ab5363b56ad298f8648fca856edc1ebf8b > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3063944 > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Tim Van Patten <timvp@google.com> Bug: angleproject:4889 Change-Id: I9b5ecacc410b41be382232292ceae2f7ea7906c7 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3064393 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Austin Eng <enga@chromium.org>
Shahbaz Youssefi f016c435 2021-07-30T23:00:57 Translator: Clean up type cloning TType has a constructor that aids cloning + helpers to convert between types. A number of places where a type is constructed from the information gathered from another type is changed to clone the type and then use one of these helpers. This clean up is part of an ongoing work to improve precision handling. This change removes many references to TType::getPrecision(). Bug: angleproject:4889 Change-Id: Ib85659ab5363b56ad298f8648fca856edc1ebf8b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3063944 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi aca9f2e2 2021-07-29T17:49:26 Vulkan: SPIR-V Gen: Fix constructors with uniform parameters When the constructor contains parameters from interface blocks, they may have SPIR-V type specializations that was not previously accounted for. The code is made more robust by retrieving the column/component types when generating constructors through TTypes instead of modifying SpirvTypes directly. Bug was caught by the WebGL CTS. Bug: angleproject:4889 Change-Id: I6c9df17a97fac8622dea55ed67c7bae1ce16d1bd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3061640 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Peter Kasting d4d6c23c 2021-07-31T11:41:29 Fix a recently-introduced case of -Wunreachable-code-aggressive. Also enable this and -Wunused-but-set-variable to avoid regressing them. Bug: chromium:1066980 Change-Id: I1fd7a57c2bf14513d657b69b70e35ad727c75ffd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3065355 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi ae8ef039 2021-07-30T00:43:14 Translator: Correctly respect precision of gl_FragColor/Data These builtins are declared with a mediump precision. However, during translation to Vulkan GLSL, the precision was not output and as such glslang treated them as highp. Discovered through comparison with SPIR-V output from ANGLE which included more RelaxedPrecision operations. Bug: angleproject:4889 Change-Id: I7974478e87ad20115345d679f8f035492be1f349 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3062204 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 8fb5c2f2 2021-07-29T23:41:08 Vulkan: SPIR-V Gen: Fix OpImage* on multisampled images Lod should not be implicitly specified on multisampled images per spec. This change fixes a crash on Intel/Mesa with the TextureSampleShadingTest.Basic/ES3_1_Vulkan test. Old spirv-val catches this bug, but ToT has regressed this: https://github.com/KhronosGroup/SPIRV-Tools/issues/4424 Bug: angleproject:4889 Change-Id: Ic2a661ce5264beb1f47f4e52706fe6556176628d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3062203 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi ebe943e2 2021-07-29T11:19:33 Vulkan: SPIR-V Gen: Fix gl_Clip/CullDistance These built-ins can be redeclared in the shader. The translator took these redeclarations (and gl_LastFragData) as UserDefined symbols. There were a number of hacks such as in name generation and CollectVariables, to special-case these redeclarations. This change instead makes sure that these variables continue to be considered built-ins with the appropriate qualifiers. A number of fixes are made accordingly: - Hacks are removed. - In fragment shaders, ANGLEClipDistance was initialized with gl_ClipDistance for further use by the shader. The code generation however mistakenly produced `gl_ClipDistance[0] = ANGLEClipDistance[0];`, which caused compilation failures by glslang, but passed the tests accidentally because they expected link failures (see next item). - CollectVariables is fixed to correctly collect gl_Clip/CullDistance in fragment shaders; previously they were collected as output varyings, and therefore the aforementioned link error was not produced in the tests after the compilation error was fixed. Additional fixes: - The transformation of gl_Clip/CullDistance was always ever done on one of them due to misplaced breaks in the loop that detected their presence. - The transformation of gl_CullDistance was skipped when it was not redeclared. Validation is added to make sure these built-ins always have the correct qualifier even when redeclared. SPIR-V gen support for these variables have been fixed as well. Bug: angleproject:4889 Change-Id: Ic8bf2c508357035cb937ef41a28ae22ffc533ebe Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3059921 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi a83c9108 2021-07-29T17:13:41 Vulkan: SPIR-V Gen: Fix nested ternary operators The OpPhi instruction used to implement ternaries referenced to the blocks pregenerated for the true and false cases. However, if there were other code nested inside that could generate blocks (other ternary expressions or short-circuits), that would be wrong. Instead, the last block id is taken every time the true or false case is entirely visited (similar to how it's done in the short-circuit implementation). Bug was caught by the WebGL CTS. Bug: angleproject:4899 Change-Id: I71be86989dfe9596a13940ce657a7e67849e86bf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3061639 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 2b23aae4 2021-07-29T16:39:28 Vulkan: SPIR-V Gen: Support vec(..., mat) Matrices specified in vector constructor arguments were not correctly handled w.r.t to casting (caught by the WebGL CTS). Bug: angleproject:4889 Change-Id: I70253f049a651fc5f439b56d1e4d8f785813b605 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3061638 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Kenneth Russell aec5e65c 2021-07-28T00:36:12 Get direct-to-Metal backend to run angle_end2end_tests. Cherry-pick nameless struct fix from Apple in https://bugs.webkit.org/show_bug.cgi?id=227482 . Fix SeparateCompoundStructDeclarations pass to stop generating multiple declarations; thanks syoussefi@ for advice. Incorporate additional passes from TranslatorVulkan (MonomorphizeUnsupportedFunctionsInVulkanGLSL, RewriteArrayOfArrayOfOpaqueUniforms, SeparateStructFromUniformDeclarations) needed by RewriteStructSamplers pass in TranslatorMetalDirect. Fixes many assertion failures in GLSL tests. Moved these passes out of tree_ops/vulkan. Thanks again to syoussefi@ for advice and help. Disable a validation check related to the RewritePipelines pass. Skip two tests that were failing for other reasons. With these changes, angle_end2end_tests runs to completion when the direct-to-Metal backend is turned on. There are still ~1300 failures of the ~4000 tests which will be investigated next. Bug: angleproject:5505 Change-Id: Ibca77822543e8e8e8d2a8c862e92cdf74bfa3545 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3058524 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Kenneth Russell <kbr@chromium.org>
Shahbaz Youssefi 96ccf3f4 2021-07-29T12:38:21 Translator: Consolidate EvqFragDepth and EvqFragDepthEXT They were the same thing. Fixes SPIR-V generation which only handled EvqFragDepth. Bug: angleproject:4889 Change-Id: Id2c35f4c5a26e43ad16a420cc0306756a1add082 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3059922 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> 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 c8c9e15b 2021-07-26T22:51:49 Translator: Fix sizing of tessellation shader arrays If layout(vertices=N) is specified after implicitly sized array declarations, the correct size was not being specified on them. Bug: angleproject:4889 Change-Id: I86ccf45a7f264b493a137b87316eff744079ed6c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3054614 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Peter Kasting 5bda5f91 2021-07-26T20:37:52 Fix some instances of -Wunreachable-code-aggressive. Bug: chromium:1066980 Change-Id: I1e769b78c51d939067e8855beab32ec7c006c00e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3055794 Reviewed-by: Nico Weber <thakis@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Nico Weber <thakis@chromium.org>
Shahbaz Youssefi b8d6f8aa 2021-07-22T22:31:29 Translator: Facilitate integration in FireFox Instead of relying on is_apple to build workarounds applied on apple hardware, a new build argument is added for this purpose. This allows FireFox to more easily include these files in their build system (which builds every workaround on every platform). The workarounds are reorganized too and moved from tree_ops/gl/mac to tree_ops/apple. RewriteRowMajorMatrices is moved there too as it's now used by both gl and metal. This workaround is large, and removing it from non-apple builds improves binary size (~40KB on Linux). Bug: angleproject:6188 Change-Id: I8e1dab44d0235bb6b8341d53721bdd0d157d46c6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3047385 Reviewed-by: Jeff Gilbert <jgilbert@mozilla.com> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi dbe986d7 2021-07-26T01:43:44 Vulkan: SPIR-V Gen: Fixes to tessellation shader support - TCS barrier() built-in is correctly looked up - Patch decorations are fixed Bug: angleproject:4889 Change-Id: I1befcaca85a965c9d46b1b41ec74597de44bf2b2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3052687 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi acfd63a4 2021-07-26T01:02:11 Translator: Remove GLSL rules from the ESSL-only symbol table Shaves ~36KB off of ANGLE's binary size on Android. Bug: chromium:1084580 Change-Id: I4711c6bd28437a43b7dc63be4cfcdaed7ae11ba2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3052686 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 63fa7080 2021-07-25T23:19:02 Vulkan: SPIR-V Gen: Fix bugs with ES3.1 texture* builtins - Add missing ImageCubeArray capability for image cube arrays - Remove extra Lod image operand for sampler/image buffers Bug: angleproject:4889 Change-Id: I96545092528b7dcecf902561e194b17636217ef4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3052683 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 715bab1f 2021-07-25T23:35:17 Vulkan: SPIR-V Gen: Fixes to geometry shader support - max_vertices=0 is invalid in SPIR-V and is fixed (similarly to anglebug.com/5411) - gl_PrimitiveID used in fragment shaders requires the Geometry capability. Bug: angleproject:4889 Change-Id: If8c6a9d455d0582d61c3c52b5f773bcb5ca64b53 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3052684 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi ff7eafb5 2021-07-25T23:05:26 Vulkan: SPIR-V Gen: Fix .length() vs ssbo arrays Bug: angleproject:4889 Change-Id: Ib490a46fabf058064fc1b18d2c084a4bc5f9277d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3052682 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi b19fbbda 2021-07-25T21:57:12 Vulkan: SPIR-V Gen: Support multiview Bug: angleproject:4889 Change-Id: Ibe66f53357473dbb4435af58775b524d83ed250b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3052675 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 939ea5f4 2021-07-23T15:53:17 Vulkan: SPIR-V Gen: Fixes to tessellation builtins On TCS, TES and FS, gl_PrimitiveID is actually an input. Additionally, `patch` variables (including gl_TessLevel* built-ins) need to be decorated with Patch. Bug: angleproject:4889 Change-Id: I326ec4b0c011fe8eaafbad4f8bcb0f537005f96f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3048320 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 9416e84e 2021-07-23T14:53:43 Vulkan: SPIR-V Gen: Add missing DepthReplacing execution mode Shaders writing to gl_FragDepth need this execution mode specified. Bug: angleproject:4889 Change-Id: I315c90f9161f4d3d51b1c856f1364fb26a4bd404 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3048317 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi de8dc2c9 2021-07-23T15:45:28 Vulkan: SPIR-V Gen: Support OES_sample_variables Built-ins from this extension are now decorated. Bug: angleproject:4889 Change-Id: I12f80d67e3595f94fc64bdc8cb3031d36b98c279 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3048319 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 8bf2e5ec 2021-07-23T16:54:16 Vulkan: SPIR-V Gen: Fix switch with default at the end A minor bug was making a switch with default at the end to jump to the merge block instead of the default block. Bug: angleproject:4889 Change-Id: Ied434fab949b10d45a0db1242c1b8535a5f4f773 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3048321 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 82d7d888 2021-07-22T21:46:21 Vulkan: SPIR-V Gen: Fix bugs with texture* builtins With this change, deqp ES3 tests pass. Bug: angleproject:4889 Change-Id: Ica158d4e9012c7bb3e458da62b4a7f92aee5c6de Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3047380 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 31bc9226 2021-07-23T15:16:27 Vulkan: SPIR-V Gen: Fix unpack* built-ins The parameter to these built-ins was getting extended to a vector. Bug: angleproject:4889 Change-Id: Idddce008c9b4f6bf9205b1e20f6e89ef657ea3a1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3048318 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 6b5cec15 2021-07-22T17:01:41 Vulkan: SPIR-V Gen: Fixes to scalar->vector promotion With the ternary operator, the condition may be a bool-in-interface block that needs to be cast. This cast is now part of createConstructorVectorFromScalar so it can't be missed. Bug: angleproject:4889 Change-Id: I0e24cd4127301d33a3ac677ccaf560c4468e0799 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3047379 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi d0c03ff4 2021-07-22T14:55:51 Vulkan: SPIR-V Gen: Fix lvalues passed to in/inout parameters In GLSL, these values are semantically copied when passed to a function as an in or inout parameter. For example in: bool f(inout vec4 a, inout vec4 b) { a = vec4(0); return all(equal(a, b)); } var = vec4(1); bool result = f(var, var); result is expected to be false. In SPIR-V, every parameter is semantically passed by "reference". glslang conservatively uses temporaries to pass to functions. An optimization in ANGLE didn't create temporaries for unindexed lvalues, which did not take into account the above fact. This optimization is limited to out parameters now. Bug: angleproject:4889 Change-Id: Ie1b4b1cecba847ba63d5810d01d0856823b89ddc Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3046103 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi cc69d861 2021-07-22T12:49:39 Vulkan: SPIR-V Gen: Fix textureProj's coordinate adjustment The OpCompositeInsert's parameters were given in the wrong order. Additionally, some instructions were not having RelaxedPrecision applied correctly; this is fixed by deriving the decorations from the type of the argument that's passed in a function instead of the type of the parameter itself. Bug: angleproject:4889 Change-Id: I34a54fcc0ef1699e554f9e1abb94c93a5b34b6d3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3046102 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 9d23ae62 2021-07-22T12:32:44 Vulkan: SPIR-V Gen: Fix conditionals with pruned blocks Rewored the visitIfElse function to simplify the logic and correctly handle if-else constructs where the true block is pruned. Bug: angleproject:4889 Change-Id: Ib968a2fe65f4b6463158fd76e7d67757115ee832 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3046101 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi ad8c3257 2021-07-22T11:40:01 Vulkan: Fix bresenham line emulation in shaders with return RunAtTheEndOfShader should have been used to ensure that the appended code runs at the end of the shader no matter if the shader includes return statements. Bug: angleproject:4889 Bug: angleproject:6206 Change-Id: I848eafdf3c7bc63206a7f82cdf0badad335fa3bc Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3046100 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 9f7a86a8 2021-07-21T14:54:03 Vulkan: SPIR-V Gen: Fix bugs with matrix ops A number of matrix operations are fixed in this change, such as matrix/scalar, ++matrix etc. This change fixes most of the failing dEQP-GLES2.* tests. The test suite will be enabled once the remaining 32 failures are fixed. Bug: angleproject:4889 Change-Id: I0905dfaeabe50716432ce354b890be35f2a16e59 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3042555 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 951b04bb 2021-07-21T12:20:13 Vulkan: SPIR-V Gen: Support scalar constructors In GLSL, the scalar constructor can be given a vector and matrix, in which case the first element is selected. This case was not previously handled. Bug: angleproject:4889 Change-Id: Ibf276883fc7396b750981a4e469ff9b152c6e700 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3042554 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 45d4641a 2021-07-21T10:58:29 Vulkan: SPIR-V Gen: Support tessellation shaders Bug: angleproject:4889 Change-Id: I7370e037a82689260e27bfd5e72c5c8c982efa58 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3041624 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 7f199d75 2021-07-20T00:11:23 Vulkan: SPIR-V Gen: Support geometry shaders Geometry shader built-ins are implemented. A bug in DeclarePerVertexBlocks is fixed w.r.t to gl_PerVertex arrays and a new AST validation option is added to catch that sort of error. Bug: angleproject:4889 Change-Id: I40b2929e450eac8ae840bbf1a1583e6c4c047c88 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3041623 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 0e1c90cf 2021-07-21T10:24:26 Translator: Validate function parameter qualifiers This change cleans up a confusion in EvqConst and EvqConstReadOnly, where the former was frequently used instead of the latter for function parameters. The change makes the following renames to make the intent of the relevant qualifiers clearer: EvqIn -> EvqParamIn EvqOut -> EvqParamOut EvqInOut -> EvqParamInOut EvqConstReadOnly -> EvqParamConst Bug: angleproject:4889 Change-Id: Idedd32c08a91de069b91b1657d6b783dddece04a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3041622 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 6e261453 2021-07-20T22:34:33 Vulkan: SPIR-V Gen: Fix I/O block arrays Since the qualifier on intermediate nodes are EvqTemporary, the code that autodeduced the block storage of I/O blocks was incorrectly assigning them std140 when an indexed I/O block array was encountered. This resulted in duplicate types in the SPIR-V. This is generally benign (other than creating an unnecessary type) except for gl_PerVertex as it adds BuiltIn decorations. gl_PerVertex may be an array in geometry and tessellation shaders. Bug: angleproject:4889 Change-Id: Iaa8e414ae01a4be127dc52df0e9406546b23d24c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3041621 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi e9decf0c 2021-07-19T14:29:21 Vulkan: SPIR-V Gen: Support framebuffer fetch Bug: angleproject:4889 Change-Id: Ia75b45b5d0f6cb3b6ca8a8f8a987bb857e45ad33 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3040120 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@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>
Shahbaz Youssefi 05eb0a32 2021-07-19T16:14:34 Translator: Allow subpassLoad in AST in ESSL subpassLoad is available to desktop GLSL, but not GLSL ES. With this change, subpassLoad is made available internally to the AST so that framebuffer fetch's use of this built-in can be simplified. Additionally, this makes the tree more consistent in that there's no function call without a corresponding function declaration. A follow up change will add an AST validation to enforce this. Bug: angleproject:4889 Bug: angleproject:5454 Change-Id: I3fa502dc4b29eab7f34940466e283cffd218d746 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3040118 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi a8807cbf 2021-07-17T00:00:27 Vulkan: SPIR-V Gen: Support interpolateAt* The interpolateAt* builtins take their first argument as a pointer, so only the OpAccessChain result should be given to the corresponding SPIR-V instruction. A test is written in this change to handle interpolateAt* when given a swizzled lvalue, which is not representable in SPIR-V. This can be supported by having the AST transform: interpolateAtX(value.zy) to: interpolateAtX(value).zy which can be done right when the function is parsed and the AST node for it is created (by taking the swizzle out of the parameter and applying it to the node). However, swizzled lvalues as parameter to interpolateAt* is only allowed in desktop GLSL, and so the test is disabled. From the GLSL ES3.2 spec: > Component selection operators (e.g. .xy) may not be used when > specifying interpolant. Bug: angleproject:4889 Change-Id: I043969f22011e6171c7ae225ded3a5013e8cfa4e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3035588 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 32196d8f 2021-07-16T14:49:08 Vulkan: SPIR-V Gen: Support built-ins with out parameters Some built-ins have out parameters; modf, frexp, uaddCarry, usubBorrow, umulExtended and imulExtended. In SPIR-V, they are translated as such: - modf and frexp: Returns the same result as GLSL, with a pointer to store the output parameter. Since SPIR-V cannot create pointers to swizzles, a temp variable is used in that case. - uaddCarry, usubBorrow, umulExtended and imulExtended: These return a struct in SPIR-V, which contains the two output parameters; with lsb in field 0 and msb in field 1. Bug: angleproject:4889 Change-Id: Ic5114f74b9c1013093007e91939f78d5218f2a07 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3036088 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Kenneth Russell b3cbfd55 2021-07-07T12:31:57 Fix multiple end2end crashes in direct-to-MSL compiler. This set of changes: - Adds a single place (CompilerMtl::useDirectToMSLCompiler) where the direct-to-MSL compiler can be enabled, still at compile time rather than run time. It is still disabled by default. - Initializes MTLWaitableCompileEventImpl::mShader, without which all shader compiles crash. - Fixes a mismatch of the ANGLERasterizerDisabled variable name in the generated MSL. - Removes the transform feedback bindings as an argument to the vertex shader's main0(). Transform feedback support needs to be reimplemented in this compiler backend. - Added an option to the DriverUniform class to emit as either an interface block or a struct. The direct-to-MSL backend assumes it is a struct. - Disable variable reference validation when referencing either sample mask or rasterizer discard functionality in the shader. - Disable struct usage validation when inserting references to ANGLE_TextureEnv. This occurs during pipeline rewriting and it's infeasible to disable it at that point, so disable it during pipeline rewriting - which means it's disabled for all shaders. - For angle_end2end_tests, disable the file API hooking which disables the Metal shader cache. This speeds up the tests significantly - by roughly a factor of 5. With these changes, several hundred angle_end2end_tests run without any assertion failures, though still with many test failures. The next crash is in: GLSLTest.NamelessScopedStructs/ES2_Metal and will likely require a larger bug fix, or more changes to be upstreamed from WebKit's repository. Bug: angleproject:5505 Change-Id: Ia1ea9a13867f00035d4aeccf907fd032255588e3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3010486 Commit-Queue: Kenneth Russell <kbr@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Shahbaz Youssefi f4ce6d00 2021-07-15T11:07:25 Vulkan: SPIR-V Gen: Support bool in interface blocks SPIR-V doesn't allow bool in interface blocks. Another type specialization is added for this purpose, turning those bools to uint. Bug: angleproject:4889 Change-Id: I803bffcf5ea58c913d4df6e7aae3386c67901b25 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3032021 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 9c6fb52c 2021-07-13T14:10:41 Vulkan: SPIR-V Gen: Assignment between mismatching SPIR-V types In general, GLSL qualifiers translate to SPIR-V decorations on SPIR-V variables. In the case of blocks (struct or interface block), OpMemberDecorate is used, which due to its specification in SPIR-V, can only apply decorations to direct members of a block. This makes it impossible for example to decorate a nested member of a block through its variable id. As such, some decorations such as RowMajor and Invariant apply to members of a block given its _type_ id. Unfortunately SPIR-V requires ArrayStride to also be applied to a type directly, rather than a member of a block. This implies that some types, such as structs used in uniform/buffer interface block, or decorated with invariant or row_major, as well as arrays (of any type) used inside and outside interface blocks to produce different SPIR-V types from the same GLSL type. The SpirvTypeSpec data previously introduced specialize these types. It's necessary to "cast" between these types when needed. The translator handles casts at load/store boundary: - Upon load, the value is cast to the type with the default SpirvTypeSpec. - Upon store, the value is cast from the default to the store target SpirvTypeSpec. - All intermediate results use the default SpirvTypeSpec. Bug: angleproject:4889 Change-Id: I6fa28e518ec6b517ff163f44b6892859eb4b10fd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3026145 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 5e579a18 2021-07-13T01:22:48 Vulkan: SPIR-V Gen: Support row-major blocks The SPIR-V type generation is refactored to contain all type-differentiating properties in a specific struct that is passed around. The following can lead to different SPIR-V types generated from the same GLSL type: - Block storage for blocks - Invariant for blocks - Row-major for blocks with matrices - Row-major for matrix arrays in blocks - Bool when used inside an interface block (not yet implemented) Previously, block storage and invariant were passed around. Instead, with this change the aggregate of all the above is passed around. The row-major specialization is added in this change. This change also refactors the uniform/buffer block encoding to use the existing encoders in blocklayout.h. Bug: angleproject:4889 Change-Id: I3cfa8bd96bb380a1f1f05fbbd6b3eebd702c9e24 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3021670 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 3dda3afa 2021-07-14T16:11:01 Vulkan: SPIR-V Gen: Add missing SampleRateShading capability Bug: angleproject:4889 Bug: chromium:1229324 Change-Id: I8782ea4b0f9967c12b205a8c48d5f85bd94e950c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3027044 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 07c39616 2021-07-08T17:01:31 Vulkan: SPIR-V Gen: Enable GLSLTest* This change includes an assortment of small fixes to enable most of GLSLTest* end2end tests. - User-defined std140 storage buffers were mistakenly turned to std430. - External and WEBGL samplers were redundantly redeclaring the sampler2D type. - `invariant` specified on a field of struct type didn't apply it to said struct's members. - Arrays of struct as a member of an interface block didn't have their size aligned, producing incorrect stride - Interpolation and auxiliary qualifiers are now generated - Arrays of opaque uniforms are now correctly passed to functions when indexed. - atan(x, y)'s built-in Op is fixed - early_fragment_tests is now generated Additionally, the SPIR-V transformer didn't handle the Invariant decoration applied to gl_PerVertex built-ins, which is possible as a result of: #pragma STDGL invariant(all) This bug existed in the transformer due to two bugs: - ANGLE didn't generate this line when generating GLSL to feed to glslang. This is fixed by this change. - glslang itself ignores this line: https://github.com/KhronosGroup/glslang/issues/2689 Bug: angleproject:4889 Change-Id: I15ad9fcc178abc1eae944e7a58f4e6153fa5dfd9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3016762 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
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>
Kyle Piddington d33a2222 2021-04-26T16:56:15 Upstream Apple's direct-to-Metal backend: compile libANGLE. This change is meant to merge the metal backend 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 metal backend code in a state that compiles, but not to switch the Metal backend over to using the direct-to-metal backend yet. Bug: angleproject:5505 Bug: angleproject:6127 Change-Id: If6783e06e0086b3a1dd25c6f53caca5cfc96cb86 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2950067 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Shahbaz Youssefi c6784c9c 2021-07-09T16:48:55 Vulkan: SPIR-V Gen: Fix size of matrix in std140 layout Matrices are treated like arrays, so the size of each column should also be expanded to the size of vec4, similar to how it's done for arrays of smaller-than-vec4 elements. Bug: angleproject:4889 Change-Id: I1f4d8d0e06922c4bb9261fbbf0f4565dfdec55c8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3018641 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi e2710f59 2021-07-06T17:29:08 Vulkan: SPIR-V Gen: Fix image atomic built-ins The `imageAtomic*` built-ins additionally include coordinate and sample parameters that need to be fed to OpImageTexelPointer before the atomic operation can be generated. This change passes all *image*atomic* GLES31 deqp tests as well as: GLSLTest_ES31.ArraysOfArraysOfR32fImages/ES3_1_Vulkan_DirectSPIRVGen Bug: angleproject:4889 Change-Id: I9ed729d09914cb01467d4de504de38c931a9196e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3011419 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 8d0eb08c 2021-07-05T23:22:24 Vulkan: SPIR-V Gen: Take advantage of OpConstantNull As part of fixing GLSLTest*.MissingReturn* tests, refactoring is done such that complex null values are declared concisely with OpConstantNull. The tests are fixed by making the SPIR-V generator implicitly add a `return <null-value-of-correct-type>;` if the return statement is missing from GLSL. Bug: angleproject:4889 Change-Id: Iffd80c5e6ce66afcdbf3813bffade6928f292007 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3010578 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi e3e7447a 2021-07-08T22:22:19 Vulkan: Fix flipXY for 180 degree prerotation and spec consts The multiplier used for flipXY in this configuration was incorrect. Bug: angleproject:5348 Bug: angleproject:5349 Bug: angleproject:5350 Change-Id: I0b3771f6a9da6ab2af02ed5ee5fe7b49d0415410 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3016768 Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 81ed8d40 2021-07-02T00:54:25 Vulkan: SPIR-V Gen: Support barrier* built-ins This change enables the ComputeShaderTest suite and additionally includes the following fixes: - OpArrayLength was given the array type instead of variable. - Struct arrays inside interface blocks were not decorated with ArrayStride. Bug: angleproject:4889 Change-Id: Ibae95371bcea10e58c86b8fe1d1e172a18d56a09 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3001908 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi afdf378f 2021-07-01T21:55:58 Vulkan: SPIR-V Gen: Support == and != on complex types In GLSL, == and != produce a bool. In SPIR-V, there are only component-wise comparison operations. For ==, OpAll should be used to reduce it to a single bool, and for !=, OpAny. For matrices, the comparison is done column by column with a similar reduction for each column, and one for the final result. For structs and arrays, the comparison is similarly done field by field or element by element respectively. Bug: angleproject:4889 Change-Id: I8157c1931b7d1dedd74a3825967f5e212d346900 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3001905 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill cb87d78c 2021-07-08T08:28:04 Enable -Wshadow with Clang. Also fixes a few instances of variable shadowing in the code. Bug: angleproject:6148 Change-Id: Ic51d722a3f953f246f51af6d74abb302f832cf44 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3014875 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi cfaaf2ab 2021-06-30T17:23:55 Vulkan: SPIR-V Gen: Fixes to std430 block definition Bug: angleproject:4889 Change-Id: I18feff0916f348c8514cc97ba438d42fc00d0cba Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2999023 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 3b0fcf6a 2021-06-30T15:14:48 Vulkan: SPIR-V Gen: Support type casts in constructors GLSL basic, vector and matrix constructors can convert between types. This was already done for constants used in constructors. This change implements the cast for non-constant expressions. Bug: angleproject:4889 Change-Id: I0a8c1a6e97ffced0d1652032a41fb87c70be16ca Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2999022 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 0461d8d4 2021-06-23T23:20:33 Vulkan: SPIR-V Gen: texture and image built-ins GLSL contains a large number of built-in texture* and image* functions, but these map to only a handful of SPIR-V instructions. The bulk of the work to map these is to extract the arguments from the built-ins based on their ordinal position. Bug: angleproject:4889 Change-Id: I760d986bd9171ddde35f9f046c549ca53252df17 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2992980 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Peter Kasting 1bffabe8 2021-06-29T18:13:39 Fix -Wunreachable-code-aggressive. Bug: chromium:1066980 Change-Id: I1fa08a40dbf223d60a10681af33ca8a29b12bf8b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2991094 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi dc59772e 2021-06-22T22:37:26 Vulkan: SPIR-V Gen: Support switch With the infrastructure to support this in place, switch is simply implemented as a conditional with multiple blocks. Each block either ends with a branch to the merge block or the next block, implementing fallthrough. Bug: angleproject:4889 Change-Id: I5831531d918ac06648cced7707d1d48ffeb6b1b0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2983559 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi a8c9cecf 2021-06-12T00:12:34 Vulkan: SPIR-V Gen: Support break and continue This is simply done by issuing a branch to the merge or continue blocks respectively. Bug: angleproject:4889 Change-Id: I3e96a3b0f1a0533aa4eac519ab64a87600c0983b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2957810 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 153240b2 2021-06-11T16:36:32 Vulkan: SPIR-V Gen: Support loops Loops are similar to if-else in that they generate a number of blocks where the first block specifies divergence (OpLoopMerge) and the merge block. Differently from if-else, there is a block where the condition is evaluated and a block which `continue;` leads to (this last block is the only one allowed to back-jump to the beginning of the loop). Bug: angleproject:4889 Change-Id: Ic59f4bf3e05fbf93cb5af85acd3bc4b0da8412af Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2957809 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi c3c934a3 2021-06-25T01:40:54 Translator: Better group ES100 texture builtins The ES100 texture built-ins are now (similarly to ES300 ones) grouped based on whether they include a Bias, or Lod. Bug: angleproject:4889 Change-Id: I495af48644c68286b1b0cc2a5580566fdd22cfc9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2987859 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi c75a1d6f 2021-06-11T23:27:33 Vulkan: SPIR-V Gen: Support the ternary operator Bug: angleproject:4889 Change-Id: I3ac193e08fc74cc784b688cc049fb786ab68657d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2957808 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 7d023dac 2021-06-10T00:13:41 Vulkan: SPIR-V Gen: Basic support for fragment shaders Fragment shader built-ins are implemented in this change and direct SPIR-V generation for fragment shaders is enabled. Bug: angleproject:4889 Change-Id: I6f92a5585f242122a81c97a9b1aa2763009161a0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2951625 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 5b314268 2021-06-15T17:37:45 Vulkan: Support OVR_multiview and OVR_multiview2 Multiview is supported in Vulkan simply by specifying the number of views in the render pass, and creating the appropriate image views. A number of changes to the way image views and render targets are stored are made to support those that don't cover the entire range of layers. One particular detail that is not implemented in this change is the use of queries in combination with multiview. Vulkan specifies that N queries are actually produced (N being the number of views) which must be summed by the application, but this is not currently done. Bug: angleproject:6048 Change-Id: I1d4a9894c232d3a93d7a97c9fa0eedc334e57469 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2967625 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 64ce506d 2021-06-18T14:48:29 Vulkan: SPIR-V Gen: Support most non-texture/image built-ins Most GLSL built-ins map directly to some SPIR-V operation. texture*() and image*() built-ins are not implemented as well as a handful of other built-ins that require special-handling. Bug: angleproject:4889 Change-Id: I72abfb4692c3d66a3c8be43ce44ba6808efe6255 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2971646 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 99a98963 2021-06-10T16:11:13 Vulkan: SPIR-V Gen: Support discard This is simply done with OpKill. If-else blocks now check if the block is already terminated (through return, discard, continue or break) before adding the branch to merge block. Bug: angleproject:4889 Change-Id: I713286cf38e40f9048486d2914a4355ddbc686ac Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2953369 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 9c500951 2021-06-10T15:48:57 Vulkan: SPIR-V Gen: Fix user-defined blocks The _u prefix was missing from blocks and their fields. Bug: angleproject:4889 Change-Id: I31f3b393bc81352c8cf7a433dd652692833fc3f7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2953368 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 5a737833 2021-06-10T15:19:59 Vulkan: SPIR-V Gen: Fix row-major matrices Prior to this change, row-major and column-major matrices generated different types. That is not correct. With this change, the same type is generated for both. Row-major only comes into account when calculating the alignment and offset of fields in a block. Bug: angleproject:4889 Change-Id: Ifa03e1799a2510b90323d9d4fc2f681a3184069b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2953367 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi e48f2210 2021-06-10T13:23:34 Vulkan: SPIR-V Gen: Support short-circuiting && and || When short-circuiting is necessary (because the right-hand side has side effects), the following code is generated in SPIR-V: // For left && right: result = left if (left) result = right // For left || right: result = left if (!left) result = right Bug: angleproject:4889 Change-Id: Id87b56dc4a1463ed781852a23d2ba6eb2015d700 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2953366 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi a76f224f 2021-06-16T00:43:55 Fix build Two CLs went in at the same time, causing a build breakage. Bug: angleproject:4889 Change-Id: I0dacda7263959014fb4ad9bd83733f58a5e98fe6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2965319 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: John Plate <jplate@google.com>
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 64ca25f1 2021-06-08T17:15:49 Vulkan: SPIR-V Gen: Unary operators The line raster emulation coded uses round() which was previously not translated. This change implements all operations supported by TIntermUnary nodes. Bresenham line emulation is now allowed. Bug: angleproject:4889 Change-Id: I1ffbe3f9bf0299f7efa2c6d1e8f011fefdbb2ddb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2951624 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 0297779c 2021-06-08T01:06:21 Vulkan: SPIR-V Gen: Handle invariant variables The Invariant decoration is applied to variable declarations and block members as necessary. When invariant is applied to a gl_PerVertex built-in, it's applied to the appropriate member in DeclarePerVertexBlocks. Bug: angleproject:4889 Change-Id: Idaa8d4ab92f975381a0237d372f0a4044ff983e0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2946116 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 3f9dcb00 2021-06-12T01:37:32 Translator: Prune trivial dead code Code after discard, return, break and continue is discarded with this change. This simplifies SPIR-V generation as no code is allowed after a branch instruction and no special handling is necessary after this change. Bug: angleproject:4889 Change-Id: Ife9c8de8a6d0db9d682561daf44366aad9b1cf61 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2957811 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi a1d43971 2021-06-12T23:11:48 Translator: Pack TSymbol and TFunction fields Shaves ~45KB off of binary size in an ANGLE build on Linux, coming from the built-in TVariable and TFunction variables. Bug: angleproject:4889 Change-Id: I5466c9e26b069a07bf52d00fc2a9c5d49f3c0feb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2958868 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 18ddd131 2021-06-07T14:59:43 Vulkan: SPIR-V Gen: Support mediump/lowp The mediump and lowp precisions translate to a RelaxedPrecision decoration in SPIR-V. This change implements this decoration and enables SPIR-V generation when emulating Bresenham lines. Prior to this change, Bresenham line emulation resulted in a validation error due to the vertex shader output being without RelaxedPrecision but the fragment shader input (translated by glslang) with it. The function that produces a new id is given a list of decorations to apply, which itself is automatically deriven from the TType where applicable, to minimize the risk of any id missing this decoration. Bug: angleproject:4889 Change-Id: I30cc5a278634c5d83d63cd65b057336f9f573baa Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2946113 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi af1eed2e 2021-06-10T01:55:59 Vulkan: Generate gl_FragColor/Data declarations in AST gl_FragColor and gl_FragData are not available in Vulkan. Prior to this change, their declaration as webgl_FragColor and webgl_FragData was done in text. This change implements an AST transformation that declares a normal fragment output variable and replaces all references to these built-ins with those variables. Bug: angleproject:4889 Change-Id: If224e089dec25e4aa580beb135e1be2890de7887 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2953042 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 29227eef 2021-06-05T22:25:01 Vulkan: SPIR-V Gen: Specialization constants With specialization constant qualifier and ids set in the node types, the SPIR-V generation for these variables are trivially handled. This is in preparation for enabling line raster emulation as well as fragment shaders in general. Bug: angleproject:4889 Change-Id: Ie4d4e47b222ac66d1e0eee29f55ac09990313580 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2939337 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> 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 d769742c 2021-06-03T19:43:58 Vulkan: SPIR-V Gen: Default uniforms Default uniforms are gathered in a uniform block, so treat them like other nameless uniform block fields. Bug: angleproject:4889 Change-Id: If340040ab4c59f3243c40de7daba530b2289e147 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2939333 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>