src/compiler/translator/TranslatorVulkan.cpp


Log

Author Commit Date CI Message
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 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 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 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 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 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>
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 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 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 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 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 ee4a5266 2021-06-01T14:57:24 Vulkan: SPIR-V Gen: Function calls This change implements function calls. As a result, transform feedback tests are enabled as well as support for transform feedback emulation (which contains functions and if blocks). `const` and opaque uniform function arguments take intermediate values, while the rest take memory objects. If the argument being passed is an unindexed lvalue, it can be directly given to the function. Otherwise a temporary variable is made which is initialized by the parameter if necessary (in and inout parameters) and later overwrites the parameter if necessary (out and inout parameters). Bug: angleproject:4889 Change-Id: I8976cdd17870c35d5a2daeed3c38de57ada931d9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2930363 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 1b680b77 2021-06-02T22:04:45 Reland "Make SH_CLAMP_INDIRECT_ARRAY_BOUNDS do proper AST transformation" This is a reland of a474fd7de769ae817db83490d410510cdbed75b2 The integer clamp used in this transformation is not available in es100 shaders, and float clamp is used instead. Original change's description: > Make SH_CLAMP_INDIRECT_ARRAY_BOUNDS do proper AST transformation > > This translator flag adds a clamp to non-literal indices to arrays. Two > strategies were provisioned, using the clamp intrinsic or a hand-written > function. The latter is ununsed in angle, chromium, firefox and > webkit, so this change removes this option and uses the clamp intrinsic > unconditionally. > > The clamp itself was added at output generation time with special flags > set on the index node. This is changed such that a proper AST > transformation is done and no-special handling would be necessary. > > Bug: angleproject:4361 > Bug: angleproject:4889 > Change-Id: Ieccfd2c1c347563fb5282e9fa66d39304e62f2ca > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2935041 > Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Bug: angleproject:4361 Bug: angleproject:4889 Change-Id: I9397ec7e6bdfb706c2a891b33fd3b2b79e883ccc Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2940902 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Yuly Novikov 10f15011 2021-06-03T19:22:53 Revert "Make SH_CLAMP_INDIRECT_ARRAY_BOUNDS do proper AST transformation" This reverts commit a474fd7de769ae817db83490d410510cdbed75b2. Reason for revert: breaks GLES2ConformTest, see roll into Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/2935093 Original change's description: > Make SH_CLAMP_INDIRECT_ARRAY_BOUNDS do proper AST transformation > > This translator flag adds a clamp to non-literal indices to arrays. Two > strategies were provisioned, using the clamp intrinsic or a hand-written > function. The latter is ununsed in angle, chromium, firefox and > webkit, so this change removes this option and uses the clamp intrinsic > unconditionally. > > The clamp itself was added at output generation time with special flags > set on the index node. This is changed such that a proper AST > transformation is done and no-special handling would be necessary. > > Bug: angleproject:4361 > Bug: angleproject:4889 > Change-Id: Ieccfd2c1c347563fb5282e9fa66d39304e62f2ca > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2935041 > Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Bug: angleproject:4361 Bug: angleproject:4889 Change-Id: I911cfe0199b04dbc3d6d4265775b6c2de00a9777 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2937024 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Shahbaz Youssefi a474fd7d 2021-06-02T22:04:45 Make SH_CLAMP_INDIRECT_ARRAY_BOUNDS do proper AST transformation This translator flag adds a clamp to non-literal indices to arrays. Two strategies were provisioned, using the clamp intrinsic or a hand-written function. The latter is ununsed in angle, chromium, firefox and webkit, so this change removes this option and uses the clamp intrinsic unconditionally. The clamp itself was added at output generation time with special flags set on the index node. This is changed such that a proper AST transformation is done and no-special handling would be necessary. Bug: angleproject:4361 Bug: angleproject:4889 Change-Id: Ieccfd2c1c347563fb5282e9fa66d39304e62f2ca Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2935041 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi aa2626f9 2021-05-21T15:24:55 Vulkan: SPIR-V Gen: Handle load/store access chain This change implements a key instruction of SPIR-V, OpAccessChain. Inspired by glslang's implementation, a class is added (AccessChain) that tracks "indices" into a base value. These indices could select a field of a block, an element of an array, a column of a matrix, or a component of a vector. Nuances (such as multi-component swizzle as an lvalue not representable in SPIR-V) and optimizations (such as all-literal indices to an rvalue) that are implemented in glslang have also been implemented in this change. As a result, this change implements all manners of loads and stores (with the exception of this gotcha: https://github.com/KhronosGroup/glslang/issues/2637). The change uses this feature to translate the basic shader which does `gl_Position = positionAttr;` (by implementing EOpAssign), and enables a test that uses this shader. Bug: angleproject:4889 Change-Id: I22dbe5b169ce499eaac657902164aca3b0ebc193 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2911880 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
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 c229ccfe 2021-05-18T15:51:12 Vulkan: SPIR-V Gen: Handle gl_PerVertex If not declared by the shader, default gl_PerVertex is now explicitly declared in AST prior to SPIR-V generation. The SPIR-V generation code then doesn't need to declare them magically. Bug: angleproject:4889 Change-Id: Icc593bc1ccc3162487bdbae7f66bc775d098778d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2905952 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 9bc837f6 2021-04-07T15:24:12 Vulkan: Generate SPIR-V directly from the translator; Part 1 This is the first change in a series to generate SPIR-V directly from the translator's AST, instead of the generating text GLSL and feeding it to glslang. This change implements the majority of the work needed to map AST types to SPIR-V types, and declare types and interface variables in SPIR-V. Additionally, it lays the infrastructure to conditionally enabling this path in end2end tests. No tests are currently enabled as the change doesn't actually generate code for function bodies yet. Bug: angleproject:4889 Change-Id: Iacb28b6907fd48c50e4cc5a0e7ad72f6eed241d4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2889603 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi daeac238 2021-05-08T22:09:38 Translator: Ensure structs and blocks are uniquely defined A new AST validation is added to ensure that the same TStructure or TInterfaceBlock is not redundantly defined. This helps with SPIR-V generation by allowing the id to be used as key in a hash map that looks up the corresponding SPIR-V type id. A bug is fixed where the Vulkan driver uniform declaration created two identical declarations for ANGLEDepthRangeParams. A number of other bugs are also fixed in this change, where if a variable declaration is eliminated (for example due to constant folding, or inactive interface variable removal) and it contained a struct specifier, the struct declaration was also removed. OutputGLSLBase had a hack where structs were declared on first encounter, which was incorrect as the scope of the declaration could change. Those bugs are fixed and this hack is removed. Bug: angleproject:2733 Bug: angleproject:4889 Bug: angleproject:5936 Change-Id: I8e13748c0bf552ae8b052249282769a1f0775603 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2881942 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 81f03cc0 2021-04-07T15:23:32 Allow translator to use headers from common/spirv Bug: angleproject:4889 Change-Id: Ia297888a97c0ba9cec1283db7f94f2e5b362c27e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2815179 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi cc56e1aa 2021-04-09T23:35:07 Vulkan: Remove special output of structs and keep them in AST The code that separated out declaration of nameless structs from uniform variable declarations is generalized to separate out declaration of all structs from uniform variable declarations. As a result, a pass that outputs the struct types at the top of the shader is no longer necessary. The struct declarations are kept in the AST to be output to GLSL as they normally would when not used in conjunction with uniform variables. After this change, the Vulkan and Metal translators no longer intermix transformations and code generation; transformations are done first entirely in AST, and code generation is done at the end. Bug: angleproject:2461 Bug: angleproject:4889 Change-Id: Ieb4d3f7091845e50c3dc399603ab01182692521d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2818153 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi c2d1a464 2021-04-09T16:53:30 Translator: Track nameless interface block field indices in type Fields of nameless interface blocks are stored as TVariables and referenced through a TIntermSymbols (unlike named blocks which use EOpIndexDirectInterfaceBlock with a constant field indices). With this change, the field index is stored in the variable's type which let's the TField of the TInterfaceBlock be directly accessible (and not need a search by name). This will be helpful in translation to SPIR-V as interface block members are accessed by field index. Bug: angleproject:4889 Change-Id: If3ab45b1e5f5f9576721dc52e2bdf1161882514f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2818242 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 6ec55494 2021-04-08T22:02:50 Vulkan: Use AST transformation for gathering default uniforms ... instead of generating text. This will keep the tree in a consistent state, as previously the references to uniform values where to TVariable's whose declarations were removed. Bug: angleproject:2461 Bug: angleproject:4889 Change-Id: I2ef3787dede371514a5f495f4cc8fc67ea45f451 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2815564 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@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>
Shahbaz Youssefi 0973dd68 2021-03-31T11:11:26 Add a gl-d3d-only target for the translator Chrome's validating command decoder links statically with the ANGLE translator. This change adds a target that builds the translator with only gl and d3d support for this purpose. This will prevent chrome from linking against glslang because of the Vulkan backend. As a bonus, it will reduce the binary size of Chrome by stipping the Vulkan and Metal translation and transformation codes. Bug: angleproject:5810 Change-Id: I5673bad53817ff2aa8486622ff2c64b44c77240f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2797511 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 776c6015 2021-02-26T00:00:57 Vulkan: Call glslang at compile time With this change, the ANGLE translator immediately compiles the generated GLSL into SPIR-V with glslang and discards the source. This is in preparation for generating SPIR-V directly, by making the frontend and backend already able to digest it. This change also allows the expensive glslang calls to be parallelized, improving the following perf test by about 20%: LinkProgramBenchmark.Run/vulkan_compile_and_link_multi_thread Previously, the test was run as such in the Vulkan backend: Main Thread 1 Thread 2 Compile1 ---> Compile2 ---------------------> Translator Translator <--- <--------------------- Link glslang for shader1 glslang for shader2 Done With this change, it is run as such: Main Thread 1 Thread 2 Compile1 ---> Compile2 ---------------------> Translator Translator glslang glslang <--- <--------------------- Link Done glslang_wrapper_utils no longer interacts with glslang! A rename will follow. Bug: angleproject:4889 Change-Id: If4303e8ba0ba43b1a2f47f8c0a9133d0bee1a19a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2721195 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Xiaoxuan Liu 9f796506 2021-03-23T10:58:12 Vulkan: Fix gl_SamplePosition XY-flip and rotation. In multi sample scenario, gl_SamplePosition is not handled with XY-flip and rotation, add codes for flip and rotation. Bug: angleproject:5637 Test: dEQP-GLES31.functional.shaders.multisample_interpolation. interpolate_at_offset.at_sample_position.default_framebuffer --deqp-gl-config-name=rgba8888d24s8ms4 Test: dEQP-GLES31.functional.shaders.sample_variables.sample_pos. correctness.default_framebuffer --deqp-gl-config-name=rgba8888d24s8ms4 Change-Id: I7ba2227e85c62d2ca7bf534a841a1c3a5c9beb5e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2781124 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Mohan Maiya <m.maiya@samsung.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 2f737c25 2021-02-25T16:55:14 Translator: Rename GLSL to SPIR-V in Vulkan and Metal output Preparation for actual SPIR-V output instead of GLSL. Bug: angleproject:4889 Change-Id: Ic279b23d3a817bd5dca66a844905378207afdbac Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2721194 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 77637f2d 2021-02-19T15:18:52 Vulkan: Generate xfb support code in SPIR-V for emulation path This change moves the code generation at link time from source code to SPIR-V. As a result, transform feedback extension and emulation paths are more similarly handled before SPIR-V transformation (they both store information identically in the ShaderInterfaceVariableInfoMap). This change gets rid of the @@ XFB-OUT @@ marker. With no source code generation at link time, shader compilation can be moved to glCompileShader time. Bug: angleproject:4888 Change-Id: I8cdb89c22b57ce48cf5d226b8e41622d9d550d46 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2713269 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Mohan Maiya 550f2a3e 2021-02-24T09:49:42 Vulkan: Shader support for EXT_shader_framebuffer_fetch_non_coherent Translator can accept gl_LastFragData and 'inout' variable to gain access to framebuffer attachment data. The Vulkan translator replaces it with the SubpassInput type variable. Note that this works only for the noncoherent version of the extension. Bug: angleproject:5454 Test: *EXTShaderFramebufferFetchNoncoherent*.* Change-Id: I392f84ee3ad3eb9fbd09d0b7ff83731a9a3f33f6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2598060 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Brandon Schade 6cc845bb 2020-12-07T18:14:50 Vulkan: Add support for EXT_blend_func_extended This implementation utilizes vulkan's dualSrcBlend feature. Expose this extension if the underlying vulkan backend allows the use of this feature. Test: angle_end2end_tests --gtest_filter=EXTBlendFuncExtendedDrawTest* Bug: angleproject:5074 Change-Id: I7d2f611df89d65e5cac35158cb5f41a0ebd58aae Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2593151 Commit-Queue: Brandon Schade <b.schade@samsung.com> Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi b1deba2f 2021-01-28T16:06:51 Vulkan: Don't emit spec const declaration in compute shaders Bug: angleproject:5070 Change-Id: I74becfeac88b4a8ff66dd36670792082d0b941cd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2658882 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 203154b5 2021-01-18T10:43:07 Vulkan: Remove swiftshader workaround for missing gl_Position The following line was added by the translator to work around a swiftshader bug where no gl_PerVertex declaration (and hence no gl_Position) would fail an assertion: gl_Position = gl_Position; The swiftshader bug is fixed, so this line can be removed. Bug: b/176161380 Change-Id: I68a8e0d9cd8b97e9d294a119c2daa4ab64ec863f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2633729 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 9f4b159b 2021-01-19T12:48:15 Translator: Avoid vector copies with multi-replacement Turns push_backs into emplace_backs and changes the TIntermSequence constructor argument to &&. Bug: angleproject:5535 Change-Id: I640ce879b6ade48a28dea6385ebb7a95cb8304ff Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2636680 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi f0286e63 2021-01-19T12:38:46 Translator: Stop allocating TIntermSequence The functions that take a TIntermSequence always copy out / Swap the contents away. This change makes all TIntermSequences live on the stack instead of being newed. Bug: angleproject:5535 Change-Id: I942f1c5e57b00199d5308183f71bd9e18b0608bd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2636679 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi ea71c6b6 2021-01-12T14:13:35 Vulkan: Emulate R32F images with R32UI GL requires that imageAtomicExchange be supported for r32f formats. However VK_FORMAT_FEATURE_STORAGE_*_ATOMIC_BIT is nearly unsupported everywhere without some Vulkan extension that brings in unnecessary support. This GL feature is emulated by transforming the shader to use r32ui for all images that originally specified r32f. floatToUintBits and uintBitsToFloat is used to maintain correct usage of the image* builtin functions. Bug: angleproject:5535 Change-Id: Ie607089935d3283b3ffa054f4b4385b81fb8f53d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2635453 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 2b242f53 2021-01-17T14:24:53 Vulkan: Simplify RewriteCubeMapSamplersAs2DArray This change is mostly done to remove an unnecessary helper in ReplaceVariable.cpp. Tested locally, as the bots all support ES3.1+. There are a few failures, with or without this change. Bug: angleproject:5556 Change-Id: I7bd2d4294c9dc164146d713db6b45cbc73e59c16 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2633437 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>
Shahbaz Youssefi bd2954a9 2021-01-16T11:33:12 Reland "Cleanup translator option checks" This reverts commit 9173e01730923823846348e513bb8cbe7eddbbe5. Reason for revert: This was in a chain of reverts, but is unrelated to the issue. Original change's description: > Revert "Cleanup translator option checks" > > This reverts commit 9710c4e473c88a38f11eb10c600717181d6e24df. > > Reason for revert: > Earlier CL breaks pre-rotation: > https://chromium-review.googlesource.com/c/angle/angle/+/2598584 > > Original change's description: > > Cleanup translator option checks > > > > Use comparison with 0 for explicit conversion to bool. > > > > Bug: angleproject:3606 > > Change-Id: Ie0a76d7df829227c1376894535813b54e13491b4 > > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2631689 > > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > > Reviewed-by: Charlie Lao <cclao@google.com> > > Reviewed-by: Jamie Madill <jmadill@chromium.org> > > TBR=syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com > > Change-Id: Ib597a62f3c7078d28f7f5b79d1cc9f8d9e469c31 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: angleproject:3606 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2634047 > Reviewed-by: Tim Van Patten <timvp@google.com> > Commit-Queue: Tim Van Patten <timvp@google.com> TBR=timvp@google.com,syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com Bug: angleproject:3606 Change-Id: I10ecca63a3db6dbc3ddedf5bb7e5319a82a80a30 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2633712 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 6c5b766b 2021-01-16T11:33:00 Reland "Vulkan: Generate xfb support code in SPIR-V for extension path" This reverts commit d090627616641f7524655627bfd415de6f8af942. Reason for revert: Fixed parent CL Original change's description: > Revert "Vulkan: Generate xfb support code in SPIR-V for extension path" > > This reverts commit d06feeac1e79d6102e01c123a360bc9099d5bba3. > > Reason for revert: > Earlier CL breaks pre-rotation: > https://chromium-review.googlesource.com/c/angle/angle/+/2598584 > > Original change's description: > > Vulkan: Generate xfb support code in SPIR-V for extension path > > > > The only piece of code that's needed to be generated for the extension > > path is the following, at the right spot (right before depth correction > > and pre-rotation): > > > > ANGLEXfbPosition = gl_Position; > > > > The SPIR-V transformer already has gl_Position loaded for depth > > correction and pre-rotation, so this change simply adds an OpStore to > > ANGLEXfbPosition. > > > > As a result of this change, @@ XFB-OUT @@ is no longer emitted if > > the transform feedback extension is supported. With the above code now > > placed correctly for geometry shaders, transform feedback tests for > > geometry shaders are enabled. > > > > Bug: angleproject:3606 > > Change-Id: I13a7956ab62a1a6b4196ff999442b99b50226c0f > > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2617659 > > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > > Reviewed-by: Charlie Lao <cclao@google.com> > > Reviewed-by: Jamie Madill <jmadill@chromium.org> > > TBR=syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com > > Change-Id: I74fa9fafe3c922cdb7cd09ee6351534e38528da9 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: angleproject:3606 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2634048 > Reviewed-by: Tim Van Patten <timvp@google.com> > Commit-Queue: Tim Van Patten <timvp@google.com> TBR=timvp@google.com,syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com # Not skipping CQ checks because this is a reland. Bug: angleproject:3606 Change-Id: Ic49a0be10cdb58e2b47896554f272093e24f93b4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2633711 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 68635b43 2021-01-16T10:56:39 Reland "Vulkan: Move xfb position decl to translator in extension path" This reverts commit b4b5972627e148ed91aac3cbc02806bb6407ef0a. Reason for revert: This was in a chain of reverts, but is unrelated to the issue. Original change's description: > Revert "Vulkan: Move xfb position decl to translator in extension path" > > This reverts commit 8f5ca26678c12d54d2981a84e48a5304746ec824. > > Reason for revert: > Earlier CL breaks pre-rotation: > https://chromium-review.googlesource.com/c/angle/angle/+/2598584 > > Original change's description: > > Vulkan: Move xfb position decl to translator in extension path > > > > This change removes the @@ XFB-DECL @@ marker. The ANGLEXfbPosition > > output is unconditionally emitted in VS, TES and GS by the translator, > > and is appropriately decorated or removed by the SPIR-V transformer. > > > > Bug: angleproject:3606 > > Change-Id: Ia76224f5a6d147362eeb2d288f05e333aaf75481 > > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2617658 > > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > > Reviewed-by: Jamie Madill <jmadill@chromium.org> > > Reviewed-by: Charlie Lao <cclao@google.com> > > TBR=syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com > > Change-Id: Ia03988b9c17639513576e82e8f11cd4c7b52640b > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: angleproject:3606 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2634202 > Reviewed-by: Tim Van Patten <timvp@google.com> > Commit-Queue: Tim Van Patten <timvp@google.com> TBR=timvp@google.com,syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com # Not skipping CQ checks because this is a reland. Bug: angleproject:3606 Change-Id: Ib5b5925528a5c8698390b81f71ee788f5b332a1f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2633708 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi beea4050 2021-01-16T11:32:50 Reland "Vulkan: Generate gl_Position.z correction in SPIR-V" This reverts commit e3c357369f970a94759074418670de2ef131dcb8. Reason for revert: Fixed parent CL Original change's description: > Revert "Vulkan: Generate gl_Position.z correction in SPIR-V" > > This reverts commit 1e4f8b02ae0603e7034c37e0ff6cee39c38771a9. > > Reason for revert: > Earlier CL breaks pre-rotation: > https://chromium-review.googlesource.com/c/angle/angle/+/2598584 > > Original change's description: > > Vulkan: Generate gl_Position.z correction in SPIR-V > > > > Instead of having the translator output code to transform gl_Position.z > > to Vulkan clip space in the vertex stage, this change makes the SPIR-V > > transformer perform this operation on the last geometry stage. > > > > An alternative solution would be to generate this transformation in the > > translator in every geometry stage, each controlled by a separate > > specialization constant. This change avoids unnecessary modifications > > to earlier stages. Additionally, the transformer is already modifying > > gl_Position.xy for pre-rotation, so the addition of a small > > transformation of gl_Position.z in the same spot is rather trivial. > > > > Bug: angleproject:5479 > > Change-Id: Id971179ba47b206204bfdaf3b2b295ef97dd5117 > > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2598585 > > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > > Reviewed-by: Charlie Lao <cclao@google.com> > > Reviewed-by: Jamie Madill <jmadill@chromium.org> > > TBR=syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com > > Change-Id: I3bdf3d6f743125eaf552608f2664b715bd6935c5 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: angleproject:5479 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2634203 > Reviewed-by: Tim Van Patten <timvp@google.com> > Commit-Queue: Tim Van Patten <timvp@google.com> TBR=timvp@google.com,syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com # Not skipping CQ checks because this is a reland. Bug: angleproject:5479 Change-Id: Id23052b8fc6bffa5bab20cb93eb21ea49a0f80d7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2633710 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi dfd9bdfd 2021-01-16T11:32:30 Reland "Vulkan: Generate gl_Position pre-rotation in SPIR-V" This reverts commit 3d39b7c5eab88c420d982155ffbb6181c678ceea. Reason for revert: Fixed interaction with the `forceDriverUniformOverSpecConst` workaround. Original change's description: > Revert "Vulkan: Generate gl_Position pre-rotation in SPIR-V" > > This reverts commit 0f86b196ffaffeeee3460e3188f20a7ac120796d. > > Reason for revert: > Breaks pre-rotation for all apps, so they are displayed in portrait instead of landscape. > > Original change's description: > > Vulkan: Generate gl_Position pre-rotation in SPIR-V > > > > Instead of having the translator output pre-rotation code in the vertex > > stage based on a specialization constant, this change makes the SPIR-V > > transformer perform pre-rotation of gl_Position on the last geometry > > stage. > > > > An alternative solution would be to generate pre-rotation code in the > > translator in every geometry stage, each controlled by a separate > > specialization constant. This change avoids unnecessary modifications > > to earlier stages. The generated shaders are also smaller, as they > > don't contain a mat2[8] pre-rotation constant matrix. The SPIR-V > > transformer knows the pre-rotation at transformation time, so it can > > simply use swizzles to achieve the same results. > > > > This also ties in with upcoming changes which move gl_Position.z > > correction to the last geometry shader stage, which is trivially done > > piggy-backing on the infrastructure in this change. > > > > Bug: angleproject:5478 > > Change-Id: I9d5d9d19f3ccda665f5504368ce5ddfa5f383faf > > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2598584 > > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > > Reviewed-by: Charlie Lao <cclao@google.com> > > Reviewed-by: Jamie Madill <jmadill@chromium.org> > > TBR=syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com > > Change-Id: I81f237fa6b10c7d59831363bee8999e7ad2f09be > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: angleproject:5478 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2633694 > Reviewed-by: Tim Van Patten <timvp@google.com> > Commit-Queue: Tim Van Patten <timvp@google.com> TBR=timvp@google.com,syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com Bug: angleproject:5478 Change-Id: I7c5eaeef03d9520abd36a1c4a766b6abbf4fdb45 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2633709 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 60015ff6 2021-01-14T02:03:07 Vulkan: Redo RewriteStructSamplers This transformation is split into two. The first transformation solely takes out the samplers out of structs, and potentially generates array of array of samplers. A second transformation is added that takes any array of array of opaque uniforms and flattens it. A follow up change will simplify RewriteAtomicCounters which also handles array of arrays (which is no longer possible), and removes dependency on shaderStorageBufferArrayDynamicIndexing. Bug: angleproject:2703 Bug: angleproject:3881 Bug: angleproject:4071 Bug: angleproject:4211 Change-Id: I352bb2bbe65ac49f4d7d753c0ba3160fa3cc925a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2628138 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Mohan Maiya 9f09435b 2021-01-14T08:13:47 Vulkan: Rename ReplaceClipDistanceVariable files With the addition of EXT_clip_cull_distance extension the files are renamed like so - ReplaceClipDistanceVariable.h -> ReplaceClipCullDistanceVariable.h ReplaceClipDistanceVariable.cpp -> ReplaceClipCullDistanceVariable.cpp Bug: angleproject:5458 Change-Id: I277b2d4b6eea6f2014e10acb251284a159292dbc Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2617572 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Tim Van Patten 3d39b7c5 2021-01-16T00:15:14 Revert "Vulkan: Generate gl_Position pre-rotation in SPIR-V" This reverts commit 0f86b196ffaffeeee3460e3188f20a7ac120796d. Reason for revert: Breaks pre-rotation for all apps, so they are displayed in portrait instead of landscape. Original change's description: > Vulkan: Generate gl_Position pre-rotation in SPIR-V > > Instead of having the translator output pre-rotation code in the vertex > stage based on a specialization constant, this change makes the SPIR-V > transformer perform pre-rotation of gl_Position on the last geometry > stage. > > An alternative solution would be to generate pre-rotation code in the > translator in every geometry stage, each controlled by a separate > specialization constant. This change avoids unnecessary modifications > to earlier stages. The generated shaders are also smaller, as they > don't contain a mat2[8] pre-rotation constant matrix. The SPIR-V > transformer knows the pre-rotation at transformation time, so it can > simply use swizzles to achieve the same results. > > This also ties in with upcoming changes which move gl_Position.z > correction to the last geometry shader stage, which is trivially done > piggy-backing on the infrastructure in this change. > > Bug: angleproject:5478 > Change-Id: I9d5d9d19f3ccda665f5504368ce5ddfa5f383faf > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2598584 > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Charlie Lao <cclao@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> TBR=syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com Change-Id: I81f237fa6b10c7d59831363bee8999e7ad2f09be No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:5478 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2633694 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Tim Van Patten <timvp@google.com>
Tim Van Patten e3c35736 2021-01-16T00:12:54 Revert "Vulkan: Generate gl_Position.z correction in SPIR-V" This reverts commit 1e4f8b02ae0603e7034c37e0ff6cee39c38771a9. Reason for revert: Earlier CL breaks pre-rotation: https://chromium-review.googlesource.com/c/angle/angle/+/2598584 Original change's description: > Vulkan: Generate gl_Position.z correction in SPIR-V > > Instead of having the translator output code to transform gl_Position.z > to Vulkan clip space in the vertex stage, this change makes the SPIR-V > transformer perform this operation on the last geometry stage. > > An alternative solution would be to generate this transformation in the > translator in every geometry stage, each controlled by a separate > specialization constant. This change avoids unnecessary modifications > to earlier stages. Additionally, the transformer is already modifying > gl_Position.xy for pre-rotation, so the addition of a small > transformation of gl_Position.z in the same spot is rather trivial. > > Bug: angleproject:5479 > Change-Id: Id971179ba47b206204bfdaf3b2b295ef97dd5117 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2598585 > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Charlie Lao <cclao@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> TBR=syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com Change-Id: I3bdf3d6f743125eaf552608f2664b715bd6935c5 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:5479 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2634203 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Tim Van Patten <timvp@google.com>
Tim Van Patten b4b59726 2021-01-16T00:12:00 Revert "Vulkan: Move xfb position decl to translator in extension path" This reverts commit 8f5ca26678c12d54d2981a84e48a5304746ec824. Reason for revert: Earlier CL breaks pre-rotation: https://chromium-review.googlesource.com/c/angle/angle/+/2598584 Original change's description: > Vulkan: Move xfb position decl to translator in extension path > > This change removes the @@ XFB-DECL @@ marker. The ANGLEXfbPosition > output is unconditionally emitted in VS, TES and GS by the translator, > and is appropriately decorated or removed by the SPIR-V transformer. > > Bug: angleproject:3606 > Change-Id: Ia76224f5a6d147362eeb2d288f05e333aaf75481 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2617658 > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Charlie Lao <cclao@google.com> TBR=syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com Change-Id: Ia03988b9c17639513576e82e8f11cd4c7b52640b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:3606 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2634202 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Tim Van Patten <timvp@google.com>
Tim Van Patten d0906276 2021-01-16T00:11:27 Revert "Vulkan: Generate xfb support code in SPIR-V for extension path" This reverts commit d06feeac1e79d6102e01c123a360bc9099d5bba3. Reason for revert: Earlier CL breaks pre-rotation: https://chromium-review.googlesource.com/c/angle/angle/+/2598584 Original change's description: > Vulkan: Generate xfb support code in SPIR-V for extension path > > The only piece of code that's needed to be generated for the extension > path is the following, at the right spot (right before depth correction > and pre-rotation): > > ANGLEXfbPosition = gl_Position; > > The SPIR-V transformer already has gl_Position loaded for depth > correction and pre-rotation, so this change simply adds an OpStore to > ANGLEXfbPosition. > > As a result of this change, @@ XFB-OUT @@ is no longer emitted if > the transform feedback extension is supported. With the above code now > placed correctly for geometry shaders, transform feedback tests for > geometry shaders are enabled. > > Bug: angleproject:3606 > Change-Id: I13a7956ab62a1a6b4196ff999442b99b50226c0f > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2617659 > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Charlie Lao <cclao@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> TBR=syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com Change-Id: I74fa9fafe3c922cdb7cd09ee6351534e38528da9 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:3606 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2634048 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Tim Van Patten <timvp@google.com>
Tim Van Patten 9173e017 2021-01-16T00:10:34 Revert "Cleanup translator option checks" This reverts commit 9710c4e473c88a38f11eb10c600717181d6e24df. Reason for revert: Earlier CL breaks pre-rotation: https://chromium-review.googlesource.com/c/angle/angle/+/2598584 Original change's description: > Cleanup translator option checks > > Use comparison with 0 for explicit conversion to bool. > > Bug: angleproject:3606 > Change-Id: Ie0a76d7df829227c1376894535813b54e13491b4 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2631689 > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Charlie Lao <cclao@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> TBR=syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com Change-Id: Ib597a62f3c7078d28f7f5b79d1cc9f8d9e469c31 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:3606 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2634047 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 9710c4e4 2021-01-14T22:41:48 Cleanup translator option checks Use comparison with 0 for explicit conversion to bool. Bug: angleproject:3606 Change-Id: Ie0a76d7df829227c1376894535813b54e13491b4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2631689 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Mohan Maiya cea86910 2021-01-14T08:13:00 Vulkan: Support EXT_clip_cull_distance extension EXT_clip_cull_distance extension is supported except for some features related to EXT_tessellation_shader and EXT_geometry_shader. Also added a few compiler tests to validate the transformation from ESSL to GLSL for Vulkan backend. Bug: angleproject:5458 Tests: angle_end2end_tests --gtest_filter=Clip*DistanceTest* angle_unittests --gtest_filter=*Clip*Distance* Change-Id: Ie74e6b2b55112ad92ad111191d629b63506032ab Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2585987 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Shahbaz Youssefi dc99fc40 2021-01-13T00:21:41 Vulkan: Translator pass to monomorphize problematic functions With array of array of samplers and images, we currently require the shader*ArrayDynamicIndexing Vulkan features. With atomic counters, we require the shaderStorageBufferArrayDynamicIndexing feature. The above features are required to enable passing opaque uniforms to functions. This change introduces a translator pass that monomorphizes functions that receive atomic counters, or partially subscripted array of array of samplers or images, etc by removing those arguments and using the opaque uniform directly. Follow up changes will include: - Great simplification to RewriteStructSamplers, and removal of RewriteStructSamplersOld. This will drop dependency to shaderSampledImageArrayDynamicIndexing and shaderStorageImageArrayDynamicIndexing. - Great simplification to RewriteAtomicCounters. This will drop dependency to shaderStorageBufferArrayDynamicIndexing. - Emulation of imageAtomicExchange for r32f formats, but changing the qualifier to r32ui. Note that parts of RewriteStructSampler are obsolete with this change, but will be refactored as a follow up. Bug: angleproject:3881 Bug: angleproject:4071 Bug: angleproject:5535 Change-Id: Ifd1435b2a31ebf364815046886aeded60297da79 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2628127 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi d06feeac 2021-01-08T00:48:18 Vulkan: Generate xfb support code in SPIR-V for extension path The only piece of code that's needed to be generated for the extension path is the following, at the right spot (right before depth correction and pre-rotation): ANGLEXfbPosition = gl_Position; The SPIR-V transformer already has gl_Position loaded for depth correction and pre-rotation, so this change simply adds an OpStore to ANGLEXfbPosition. As a result of this change, @@ XFB-OUT @@ is no longer emitted if the transform feedback extension is supported. With the above code now placed correctly for geometry shaders, transform feedback tests for geometry shaders are enabled. Bug: angleproject:3606 Change-Id: I13a7956ab62a1a6b4196ff999442b99b50226c0f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2617659 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 8f5ca266 2021-01-07T16:04:16 Vulkan: Move xfb position decl to translator in extension path This change removes the @@ XFB-DECL @@ marker. The ANGLEXfbPosition output is unconditionally emitted in VS, TES and GS by the translator, and is appropriately decorated or removed by the SPIR-V transformer. Bug: angleproject:3606 Change-Id: Ia76224f5a6d147362eeb2d288f05e333aaf75481 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2617658 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 1e4f8b02 2020-12-21T23:47:47 Vulkan: Generate gl_Position.z correction in SPIR-V Instead of having the translator output code to transform gl_Position.z to Vulkan clip space in the vertex stage, this change makes the SPIR-V transformer perform this operation on the last geometry stage. An alternative solution would be to generate this transformation in the translator in every geometry stage, each controlled by a separate specialization constant. This change avoids unnecessary modifications to earlier stages. Additionally, the transformer is already modifying gl_Position.xy for pre-rotation, so the addition of a small transformation of gl_Position.z in the same spot is rather trivial. Bug: angleproject:5479 Change-Id: Id971179ba47b206204bfdaf3b2b295ef97dd5117 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2598585 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 0f86b196 2020-12-21T22:54:05 Vulkan: Generate gl_Position pre-rotation in SPIR-V Instead of having the translator output pre-rotation code in the vertex stage based on a specialization constant, this change makes the SPIR-V transformer perform pre-rotation of gl_Position on the last geometry stage. An alternative solution would be to generate pre-rotation code in the translator in every geometry stage, each controlled by a separate specialization constant. This change avoids unnecessary modifications to earlier stages. The generated shaders are also smaller, as they don't contain a mat2[8] pre-rotation constant matrix. The SPIR-V transformer knows the pre-rotation at transformation time, so it can simply use swizzles to achieve the same results. This also ties in with upcoming changes which move gl_Position.z correction to the last geometry shader stage, which is trivially done piggy-backing on the infrastructure in this change. Bug: angleproject:5478 Change-Id: I9d5d9d19f3ccda665f5504368ce5ddfa5f383faf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2598584 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi c07ef602 2021-01-05T12:26:05 Vulkan: Move xfb buffer decl to translator in emulation path This makes @@ XFB-DECL @@ empty on this path. Ultimately, this is working towards removing both @@ XFB-DECL @@ and @@ XFB-OUT @@ macros for both the emulation and extension paths, allowing the shaders to be compiled at compile time rather than link time. Bug: angleproject:3606 Change-Id: If16e9d92c419a04ecd3094481ed546d0708cdb43 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2611305 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi e2a8a69a 2021-01-04T23:52:02 Vulkan: Move xfb emulation offset calculation to translator A new function is added by the translator to calculate the transform feedback offsets in the emulation path. This function makes the generated code for transform feedback smaller. Bug: angleproject:3606 Change-Id: I01460f907e20e2887cb720bddad96697fdcb0cf3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2607492 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 382bf288 2020-12-24T23:56:39 Organize AST transforms per backend Most of the AST transforms are written as a workaround to an issue that affects a single backend. This change identifies such transforms and organizes them by backend. They are then only built if the respective backend is. Additionally, about half of the GL transforms are due to mac workarounds, including the large RewriteRowMajorMatrices transform. Mac-specific workarounds are additionally only built on said platform. This change reduces the ANGLE binary size: - 106KB in a Vulkan-only build on Linux - 27KB in a GL-only build on Android (60KB on Linux) Bug: chromium:1084580 Bug: chromium:1161513 Change-Id: I64b334332c0d4f848756c6538af0d8d96864c7e9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2601346 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Charlie Lao 64508f44 2020-12-12T18:00:10 Vulkan: Reduce driver uniform data to minimum if specConst is used If specialization constant is used, driver uniform data structure should be reduced to minimum to increase cache locality. Bug: b/175479076 Change-Id: I1fc50666542c6763c60bfe011cde5bc77ccc08e1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2588549 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao c75473c2 2020-11-23T14:26:32 Vulkan: Generalize FlipRotationSpecConst to SpecializationConstant Specialization constant are used not just for flip/rotation. It also used for other things. This CL merges all specialization constant usage (lineRasterEmulation, flip, rotation, halfRenderArea) into one class and rename FlipRotationSpecConst to SpecConst. Bug: b/173800146 Change-Id: I8dc3354b6caedbb183cec29855fc1c301ec8872a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2555812 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill f6df8692 2020-12-09T12:46:35 Vulkan: Support XFB in non-Vertex stages. This updates the code in several places to support Geometry and Tessellation Evaluation shaders to output transform feedback. Does not turn on any new tests but enables support for XFB when we turn on GS/TS. Bug: angleproject:3571 Bug: angleproject:3572 Change-Id: I6dcb768f2df4eeee81a4a500e999fcf16716f58f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2581941 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Charlie Lao 067a12f0 2020-11-19T16:47:25 Reland "Vulkan: Use specialization constant for halfRenderAreaWidth" This is a reland of ff38106d62fca2e36ec2db1cd580b546fd53ae43 Original change's description: > Vulkan: Use specialization constant for halfRenderAreaWidth > > halfRenderArea is used by fragment shader to adjust gl_FragCoord for > rotation and yflip compensation. This CL bakes halfRenderAreaWidth into > shader via specialization constant, thus allow compiler to consolidate > the calculation into one MAD instruction. > > Bug: b/173800146 > Change-Id: Id66301278e3389e2582369b695825e632bccecee > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2551541 > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Tim Van Patten <timvp@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> Bug: b/173800146 Change-Id: Ifc36086f4c5d6a44fb5456aa6e31bc8a783bba71 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2579648 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 7354c67b 2020-12-04T12:21:10 Vulkan: Support for geometry shader with max_vertices=0 This is simply done by specifying max_vertices=1. Bug: angleproject:5411 Change-Id: I50318128cca0e96a8b7c7e5d01165b9ef46b4db8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2574823 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Ian Elliott 1ad5791d 2020-12-03T22:05:51 Revert "Vulkan: Use specialization constant for halfRenderAreaWidth" This reverts commit ff38106d62fca2e36ec2db1cd580b546fd53ae43. Reason for revert: Suspect that this CL may be causing win-angle-rel-32 bot failures Original change's description: > Vulkan: Use specialization constant for halfRenderAreaWidth > > halfRenderArea is used by fragment shader to adjust gl_FragCoord for > rotation and yflip compensation. This CL bakes halfRenderAreaWidth into > shader via specialization constant, thus allow compiler to consolidate > the calculation into one MAD instruction. > > Bug: b/173800146 > Change-Id: Id66301278e3389e2582369b695825e632bccecee > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2551541 > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Tim Van Patten <timvp@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> TBR=timvp@google.com,syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com # Not skipping CQ checks because original CL landed > 1 day ago. Bug: b/173800146 Change-Id: I7bc9966ebbe949f3999d7927afa629dd2e3a4187 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2572801 Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Ian Elliott <ianelliott@google.com>
Jamie Madill 720b85e6 2020-12-01T20:45:29 Reland "Vulkan: Use specialization constant for halfRenderAreaWidth" This reverts commit b1917fe1a314709cd9f7f53b2923d6be0e8bbf6c. Reason for revert: Not the root cause. See bug. Original change's description: > Revert "Vulkan: Use specialization constant for halfRenderAreaWidth" > > This reverts commit ff38106d62fca2e36ec2db1cd580b546fd53ae43. > > Reason for revert: Speculative revert to clear up AMD. See bug. > > Bug: chromium:1154356 > > Original change's description: > > Vulkan: Use specialization constant for halfRenderAreaWidth > > > > halfRenderArea is used by fragment shader to adjust gl_FragCoord for > > rotation and yflip compensation. This CL bakes halfRenderAreaWidth into > > shader via specialization constant, thus allow compiler to consolidate > > the calculation into one MAD instruction. > > > > Bug: b/173800146 > > Change-Id: Id66301278e3389e2582369b695825e632bccecee > > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2551541 > > Commit-Queue: Charlie Lao <cclao@google.com> > > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > > Reviewed-by: Tim Van Patten <timvp@google.com> > > Reviewed-by: Jamie Madill <jmadill@chromium.org> > > TBR=timvp@google.com,syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com > > Change-Id: Idab612bcad4f179857c41ffc4bf8fa2355fae946 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: b/173800146 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2568244 > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Commit-Queue: Jamie Madill <jmadill@chromium.org> TBR=timvp@google.com,syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com # Not skipping CQ checks because this is a reland. Bug: chromium:1154356 Bug: b/173800146 Change-Id: I5b86bbee8600c6597620f31d8d7b08ca8b3d2d57 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2568246 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill b1917fe1 2020-12-01T20:42:36 Revert "Vulkan: Use specialization constant for halfRenderAreaWidth" This reverts commit ff38106d62fca2e36ec2db1cd580b546fd53ae43. Reason for revert: Speculative revert to clear up AMD. See bug. Bug: chromium:1154356 Original change's description: > Vulkan: Use specialization constant for halfRenderAreaWidth > > halfRenderArea is used by fragment shader to adjust gl_FragCoord for > rotation and yflip compensation. This CL bakes halfRenderAreaWidth into > shader via specialization constant, thus allow compiler to consolidate > the calculation into one MAD instruction. > > Bug: b/173800146 > Change-Id: Id66301278e3389e2582369b695825e632bccecee > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2551541 > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Tim Van Patten <timvp@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> TBR=timvp@google.com,syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com Change-Id: Idab612bcad4f179857c41ffc4bf8fa2355fae946 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: b/173800146 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2568244 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Charlie Lao ff38106d 2020-11-19T16:47:25 Vulkan: Use specialization constant for halfRenderAreaWidth halfRenderArea is used by fragment shader to adjust gl_FragCoord for rotation and yflip compensation. This CL bakes halfRenderAreaWidth into shader via specialization constant, thus allow compiler to consolidate the calculation into one MAD instruction. Bug: b/173800146 Change-Id: Id66301278e3389e2582369b695825e632bccecee Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2551541 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: 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>
Mohan Maiya c4ca12e3 2020-11-20T09:02:54 Vulkan: Support the single-sampled targets Add support for gl_SampleMask for single-sampled targets. When dealing with a single-sampled target, gl_SampleMask is always be set to 0xFFFFFFFF. And when the target is single-sampled, sample shading is disabled to enable Bresenham line rasterization. Bug: angleproject:3588 Tests: dEQP-GLES31.functional.shaders.sample_variables. sample_mask.discard_half_per_pixel.* sample_mask.discard_half_per_sample.* sample_pos.correctness.* sample_mask_in.bit*_per_two_samples.* sample_mask.discard_half_per_two_samples.* sample_mask.inverse_per_* Change-Id: Ibb471261b8451ff01fab3dc43f2e965ae2999610 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2477909 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Mohan Maiya cc5f7989 2020-11-19T07:59:01 Vulkan: Support gl_SampleMask with non-const index Add support for access to gl_SampleMask or gl_SampleMaskIn with non-constant index. Replace gl_SampleMask with ANGLESampleMask and reassign ANGLESampleMask to gl_SampleMask in the end. Bug: angleproject:3588 Tests: dEQP-GLES31.functional.shaders.sample_variables.sample_mask. discard_half_per_pixel.* discard_half_per_sample.* Change-Id: Ie668c3ccf4d40352574db57f5e43b2f17ef6d8b8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2477908 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 8a401051 2020-11-19T07:58:05 Vulkan: Support OES_sample_variables extension Enable OES_sample_variables extension on Vulkan backend. Add support for built-in variables, uniform state and constants - gl_SampleId, gl_SamplePosition, gl_SampleMask, gl_SampleMaskIn - gl_NumSamples - gl_MaxSamples Bug: angleproject:3588 Tests: dEQP-GLES31.functional.shaders.sample_variables.* KHR-GLES31.core.sample_variables.* Change-Id: Idf37c7b4ccb0331dbda7acd6389ff4e1022ba959 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2477907 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 995493cc 2020-11-18T20:33:33 Revert "Vulkan: Remove rotation related data from driver uniform" This reverts commit fd97c3343e9ff23677124b7528ec945bca65796a. Reason for revert: The specialization constant for rotation causes performance regression with older qualcomm driver. We need to keep the driver uniform code path for the older driver. Original change's description: > Vulkan: Remove rotation related data from driver uniform > > Rotation is now handled in the shader compiler with specialization > constant, it should be removed from driver uniforms. Since Metal is > using the flipXY, flipXY/negFlipXY are still kept in the shader side > implementation, but have moved to TranslatorMetal in this CL. > > Bug: b/171750979 > Change-Id: Ie8d15ef227cb52a6e19e4319ecc9f09bda42e667 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2519863 > Reviewed-by: Ian Elliott <ianelliott@google.com> > Reviewed-by: Tim Van Patten <timvp@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Commit-Queue: Charlie Lao <cclao@google.com> TBR=ianelliott@google.com,timvp@google.com,jmadill@chromium.org,cclao@google.com Bug: b/171750979 Change-Id: Iff9cffb28851ade1d9c5cd23fde73910a19867ce Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2547808 Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao fd97c334 2020-11-12T11:05:40 Vulkan: Remove rotation related data from driver uniform Rotation is now handled in the shader compiler with specialization constant, it should be removed from driver uniforms. Since Metal is using the flipXY, flipXY/negFlipXY are still kept in the shader side implementation, but have moved to TranslatorMetal in this CL. Bug: b/171750979 Change-Id: Ie8d15ef227cb52a6e19e4319ecc9f09bda42e667 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2519863 Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 3a1838a1 2020-11-10T20:30:43 Vulkan: Let RewriteInterpolateAtOffset use FlipRotateSpecConst Instead of using uniform, use flip/rotation specialization constant when available. This allows matrix multiplication calculated at compile time instead of shader execution time. Bug: angleproject:4901 Bug: angleproject:3589 Change-Id: I5a8a82b1cffbbbeba2617cb7e9a0ec38f9984d50 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2530457 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com>
Charlie Lao 15ead5d5 2020-11-02T12:25:32 Reland "Vulkan: Let shader use rotation specialized constant" This is a reland of 47b3db22be33213eea4ad58f2453ee1088324ceb Original change's description: > Vulkan: Let shader use rotation specialized constant > > If use rotation specialized constant is enabled via compiler options, > this CL will use rotation specialized constant to generate flipXY, > rotation matrix and negFlipXY. This allows the driver to optimize for > the minimum instructions for rotation. > > Bug: b/171750979 > Change-Id: I9851ac999d4d35b9f230f796e5445bca0dcb1e77 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2514773 > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Ian Elliott <ianelliott@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Tim Van Patten <timvp@google.com> Bug: b/171750979 Change-Id: I9efde40eb138bacb161cce483a30ec01fee0983b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2533933 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Charlie Lao 3f18ad09 2020-11-11T14:12:18 Vulkan: Factor out DriverUniform code to tree_utils/DriverUniform.cpp The driver uniform code is used by various tree_ops functions. But all driver uniform code are defined and implemented in the TranslatorVulkan.cpp file. There is dependency rule that tree_ops code can not call into vulkan specific function. Right now we are working around this problem by always having TranslatorVulkan creates uniform and pass it down to tree_ops. This creates inefficiency for cases that dFdy/dFdx where we don't know if we will need the driver uniform or not, until we walk the tree and see the dFdx node. This CL refactors driver uniform code into its own file and class under tree_utils so that everybody can use. Mean time we can also make it much easier for metal to expand it to have its own uniform structure. Bug: b/173047182 Change-Id: I06bd9a005ccd6dc0a21321a3010dda1eab9d6fdb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2533443 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Tim Van Patten c3607098 2020-11-11T16:06:51 Revert "Vulkan: Let shader use rotation specialized constant" This reverts commit 47b3db22be33213eea4ad58f2453ee1088324ceb. Reason for revert: Broke the ANGLE roll into Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/2531069 [1875/27343] SOLINK ./libGLESv2.so FAILED: libGLESv2.so libGLESv2.so.TOC /b/s/w/ir/cipd_bin_packages/cpython/bin/python "../../build/toolchain/gcc_solink_wrapper.py" --readelf="readelf" --nm="nm" --sofile="./libGLESv2.so" --tocfile="./libGLESv2.so.TOC" --output="./libGLESv2.so" -- ../../third_party/llvm-build/Release+Asserts/bin/clang++ -shared -Wl,-soname="libGLESv2.so" -Wl,--fatal-warnings -Wl,--build-id -fPIC -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,defs -Wl,--as-needed -fuse-ld=lld -Wl,--color-diagnostics -Wl,--no-call-graph-profile-sort -m64 -Werror -nostdlib++ --sysroot=../../build/linux/debian_sid_amd64-sysroot -L../../build/linux/debian_sid_amd64-sysroot/usr/local/lib/x86_64-linux-gnu -L../../build/linux/debian_sid_amd64-sysroot/lib/x86_64-linux-gnu -L../../build/linux/debian_sid_amd64-sysroot/usr/lib/x86_64-linux-gnu -Wl,-rpath=\$ORIGIN -Wl,--export-dynamic -Wl,-rpath=\$ORIGIN -o "./libGLESv2.so" @"./libGLESv2.so.rsp" ld.lld: error: undefined symbol: sh::TranslatorVulkan::GetDriverUniformFlipXYRef(sh::TVariable const*) >>> referenced by RewriteDfdy.cpp:134 (../../third_party/angle/src/compiler/translator/tree_ops/RewriteDfdy.cpp:134) >>> translator/RewriteDfdy.o:(sh::(anonymous namespace)::Traverser::visitUnaryWithRotation(sh::Visit, sh::TIntermUnary*)) in archive obj/third_party/angle/libtranslator.a >>> referenced by RewriteDfdy.cpp:200 (../../third_party/angle/src/compiler/translator/tree_ops/RewriteDfdy.cpp:200) >>> translator/RewriteDfdy.o:(sh::(anonymous namespace)::Traverser::visitUnaryWithoutRotation(sh::Visit, sh::TIntermUnary*)) in archive obj/third_party/angle/libtranslator.a ld.lld: error: undefined symbol: sh::TranslatorVulkan::GetDriverUniformFragRotationMatrixRef(sh::TVariable const*) >>> referenced by RewriteDfdy.cpp:136 (../../third_party/angle/src/compiler/translator/tree_ops/RewriteDfdy.cpp:136) >>> translator/RewriteDfdy.o:(sh::(anonymous namespace)::Traverser::visitUnaryWithRotation(sh::Visit, sh::TIntermUnary*)) in archive obj/third_party/angle/libtranslator.a clang: error: linker command failed with exit code 1 (use -v to see invocation) Original change's description: > Vulkan: Let shader use rotation specialized constant > > If use rotation specialized constant is enabled via compiler options, > this CL will use rotation specialized constant to generate flipXY, > rotation matrix and negFlipXY. This allows the driver to optimize for > the minimum instructions for rotation. > > Bug: b/171750979 > Change-Id: I9851ac999d4d35b9f230f796e5445bca0dcb1e77 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2514773 > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Ian Elliott <ianelliott@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Tim Van Patten <timvp@google.com> TBR=ianelliott@google.com,timvp@google.com,syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com Change-Id: Id3976259d1f4049aa62b679ad5b25c2ac337c92b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: b/171750979 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2532702 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Tim Van Patten <timvp@google.com>
Charlie Lao 47b3db22 2020-11-02T12:25:32 Vulkan: Let shader use rotation specialized constant If use rotation specialized constant is enabled via compiler options, this CL will use rotation specialized constant to generate flipXY, rotation matrix and negFlipXY. This allows the driver to optimize for the minimum instructions for rotation. Bug: b/171750979 Change-Id: I9851ac999d4d35b9f230f796e5445bca0dcb1e77 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2514773 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Mohan Maiya 34130c2e 2020-11-07T15:11:14 Vulkan: Rewrite interpolateAtOffset to account for Y-flip In order to fully suppot OES_shader_multisample_interpolation rewrite interpolateAtOffset's offset parameter to account for Y-coordinate flip. Bug: angleproject:3589 Tests: dEQP-GLES31.functional.shaders.multisample_interpolation. interpolate_at_offset.*.default_framebuffer Change-Id: I6bf72ceb1c0466ff5d4a92b72d1ec9e2552d6f2a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2524711 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 7bbe497a 2020-10-16T14:46:45 Vulkan: Implement EXT_texture_sRGB_decode Implement EXT_texture_sRGB_decode. This builds on the existing functionality from EXT_texture_sRGB_override, with 2 major edge cases: 1. sRGB_decode allows the texture state to be overridden by sampler state, which is implemented by forcing a a texture state sync during updateActiveTextures if a texture is bound to the same unit as a sampler with that state 2. texelFetch calls require us to reenable decoding, regardless of decode state. We add a new compiler pass (FlagSamplersWithTexelFetch) to mark samplers that are used with texelFetch in order to support this. This change also re-enables EXT_texture_sRGB_R8, which was disabled due to a dEQP bug that this change will bypass. Bug: angleproject:3609 Bug: angleproject:4503 Test: dEQP.GLES31/functional_srgb_texture_decode_skip_decode_* Test: GLES31/functional_state_query_texture_*_srgb_decode_* Test: GLES31/functional_state_query_sampler_*_srgb_decode_* Test: GLES31/functional_debug_negative_coverage_*_srgb_decode_* Test: GLES31/functional_android_extension_pack_extensions_ext_texture_srgb_decode Test: angle_end2end_tests --gtest_filter=SRGBTextureTest.*Vulkan* Change-Id: I4a67e487dc82e2f57c8c87d4bcd8ef442b6fe220 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2359481 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Le Hoang Quyen cbd5bee8 2020-07-13T20:31:29 Disable shader's pre-rotation code on Metal & non-Android. Pre-rotation code were added to transform gl_Position, gl_FragCoords, gl_PointCoords, dFdX, dFdY in shader. However, it is only useful for android's surface pre-rotation and completely un-needed in Metal back-end. This CL disables these pre-rotation code if the platform is not android. Bug: angleproject:4678 Change-Id: I89c42fcf24b49896f4ed9c2f9465da521beaf25f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2295000 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com>
Le Hoang Quyen 9277ee74 2020-07-06T12:40:58 Metal: Implement MSAA default framebuffer. GL_SAMPLE_COVERAGE_VALUE is implemented by inserting gl_SampleMask writing logic to fragment shader. New test added: MultisampleTest.ContentPresevedAfterInterruption. - Skip on D3D11 (Bug: angleproject:4609) Bug: angleproject:2634 Change-Id: Ib44daf0baccc36ea320596d81713156047da059c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2281783 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Ian Elliott 11d7b952 2020-06-02T16:58:26 Vulkan: Pre-rotate dFdx() & dFdy() for Android Test: angle_deqp_gles3_tests --gtest_filter=dEQP.GLES3/functional_shaders_derivate Test: angle_end2end_tests --gtest_filter=*EGLPreRotationSurfaceTest.OrientedWindow Bug: b/157476241 Change-Id: I7b60b7a33313ba91731755d289792bd0968515c6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2222825 Commit-Queue: Ian Elliott <ianelliott@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Ian Elliott 4d7a3993 2020-05-27T14:08:20 Vulkan: Rotate gl_PointCoord for Android pre-rotation This extends the current y-flip that's done for gl_PointCoord. Now, gl_PointCoord is rotated and then flips both the x and y-axis (similar to gl_FragCoord). The tests used to reproduce the problem and the fix are: angle_deqp_gles2_tests --local-output --gtest_filter=dEQP.GLES2/functional_shaders_builtin_variable_pointcoord* --use-angle=vulkan angle_end2end_tests --local-output --gtest_filter=*GLSLTest.PointCoordConsistency*Vulkan* Bug: b/157476696 Change-Id: Iada8680eda8322f7382ff242e4a9422a66114f07 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2216700 Commit-Queue: Ian Elliott <ianelliott@google.com> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Ian Elliott 901045cc 2020-05-26T10:41:18 Vulkan: Rotate gl_FragCoord for Android pre-rotation This extends the current y-flip that's done for gl_FragCoord. Now, gl_FragCoord is rotated and then flips both the x and y-axis. Bug: angleproject:4643 Bug: b/156395519 Change-Id: Iada8680eda8322f7382ff242e4a9422a66114f05 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2210936 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Ian Elliott <ianelliott@google.com>
Le Hoang Quyen dadd1986 2020-04-21T01:50:00 Implement GL_APPLE_clip_distance - Built-in variable gl_ClipDistance has been added to compiler. - Desktop GL: gl_ClipDistance is supported since GL 3.0. Enable/Disable each gl_ClipDistances[i] works out of the box via glEnable(). - Vulkan/Metal: Use uniform variable to control writing to each gl_ClipDistance. One bit flag controls one element in the gl_ClipDistance array. The writing to the disabled element in vertex shader will be ignored, and turned into zero assignment instead. - Direct3D/Mobile GL: Not implemented yet. - Added ClipDistanceTest to gl_tests and compiler unittests. - GL_APPLE_clip_distance is a subset of GL_EXT_clip_cull_distance, so GL_EXT_clip_cull_distance could be implemented in future if needed. Bug: angleproject:4452 Change-Id: I571ac8b56826989808a680226a04bec4cf59988e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2084324 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Cody Northrop a2f9ad39 2020-03-09T14:28:39 Vulkan: Remove unused atomic counter builtins Atomic counters are not supported by Vulkan. Most are already converted by the RewriteAtomicCounters traversal, but that is only invoked when atomic counters are active. This CL introduces another pass that removes any atomic counter builtin that was not handled by the previous pass. It also will assert if it sees any atomic counters active, thus ensuring it is only used when needed. Test: KHR-GLES31.core.compute_shader.shared-struct Test: angle_end2end_tests.exe --gtest_filter="*AtomicCounter*" Bug: angleproject:4189 Bug: b:150310216 Change-Id: I61d10e954886dc94fede8b344f5a0ede3b689adb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2095688 Commit-Queue: Cody Northrop <cnorthrop@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Tobin Ehlis 1a5c7a16 2020-02-25T12:02:31 Reland "Vulkan:Include precision qualifier in GLSL" Currently still ignoring precision qualifiers for Vulkan shaders by default, but have added feature "enablePrecisionQualifiers" that can be enabled in order to include precision qualifiers. With this initial implementation, it's possible to get precision qualifier mis-matches in the generated GLSL 4.50. According to the spec this is allowed. From GLSLangSpec 4.50 section 4.7 "Precision and Precision Qualifiers": For the purposes of determining if an output from one shader stage matches an input of the next stage, the precision qualifier need not match. However, when converted to SPIR-V and run through the shader validation any mismatches will cause shader validation errors. Initially just ignoring those errors with this commit. Bug: angleproject:3078 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2057749 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tobin Ehlis <tobine@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Tobin Ehlis <tobine@google.com> Change-Id: Ieecca604bb2c834c9b1c2bcab85279d1f8755dfa Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2086280
Tobin Ehlis a60e4973 2020-02-27T20:11:20 Revert "Vulkan:Include precision qualifier in GLSL" This reverts commit 93e72f5f0eb80b89334ea8fe577b32901a00b5fb. Reason for revert: This is having a negative impact on gfxbench Manhattan 3.1 tests (20-30%) with only a minor improvement (~4%) in TRex offscreen. Pulling out for now and need to re-evaluate best solution here. Original change's description: > Vulkan:Include precision qualifier in GLSL > > With this initial implementation, it's possible to get precision > qualifier mis-matches in the generated GLSL 4.50. According to the > spec this is allowed. From GLSLangSpec 4.50 section 4.7 "Precision and > Precision Qualifiers": > > For the purposes of determining if an output from one shader stage > matches an input of the next stage, the precision qualifier need not > match. > > However, when converted to SPIR-V and run through the shader validation > any mismatches will cause shader validation errors. Initially just > ignoring those errors with this commit. > > Bug: angleproject:3078 > Change-Id: Ia2b04f90f0a7b6b1302c1b1b3e32bcfd8db9ed49 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2057749 > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Tobin Ehlis <tobine@google.com> > Reviewed-by: Tim Van Patten <timvp@google.com> > Commit-Queue: Tobin Ehlis <tobine@google.com> TBR=tobine@google.com,timvp@google.com,jmadill@chromium.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: angleproject:3078 Change-Id: I84984e2a963bde573f0f1de585001ceb83623c89 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2079334 Reviewed-by: Tobin Ehlis <tobine@google.com> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>