src/libANGLE/renderer/glslang_wrapper_utils.cpp


Log

Author Commit Date CI Message
Shahbaz Youssefi d524157f 2022-09-28T23:16:02 GLES1/Vulkan: Don't validate SPIR-V as VVL does the same Improves TexCombine runtime by ~15%. Bug: angleproject:6644 Change-Id: I01f580fef0caa91ebf600cfc0bbbeca1aa20eb06 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3926037 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Yuxin Hu cb618b3d 2022-08-25T13:30:26 Vulkan: Remove useRelaxedPrecision Bug: angleproject:7488 Change-Id: I30ca3e2740d8810a01615ca778eb072d77ad34d9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3856658 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Eddie Hatfield 2ebd5100 2022-08-11T10:43:32 Add gl::Context as a parameter to Shader::resolveCompile This prepares us to access the Context's shader cache in resolveCompile in the next commit. Bug: angleproject:7036 Change-Id: I7995c54b290a5a48f0c8985cb56ea0048598ab2f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3827642 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Yuxin Hu 427086a9 2022-07-22T10:45:24 Vulkan: remove SpirvVaryingPrecisionFixer Bug: angleproject:7488 Change-Id: I957839bd8fbdf1cd849d5ed7e9edd65fd1a5f2cb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3780874 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Yuxin Hu <yuxinhu@google.com>
Shahbaz Youssefi 645ee194 2022-07-18T21:48:59 Vulkan: Only modify input attachment images for FF MSAA fix up Previously all OpTypeImages were changed to MSAA, but only the ones with the SubpassData dimension should have been. Bug: angleproject:6195 Change-Id: I1caadd23420f0d9cffdee4e3b9d63cf6fa93982e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3770645 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 6cbf0c01 2022-07-14T11:35:46 Vulkan: Only apply MSAA FF fix up if executable has FF Due to the permanentlySwitchToFramebufferFetchMode feature, framebuffer fetch is permanently enabled on first use. Checking GraphicsPipelineDesc as previously done would thus always return true, even if the executable does not use framebuffer fetch. As a side effect, every multisampled draw turned into a per-sample shading draw. Bug: angleproject:6195 Change-Id: I748abddd2003297d6ff37a98e69cce4621697ad7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3763064 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Yuxin Hu 0d3ecf46 2022-06-24T16:37:17 Vulkan: Multisample Framebuffer Fetch Implement Multisample Framebuffer Fetch. This should fix the deqp failure dEQP.GLES31/functional_blend_equation_advanced_msaa_colorburn Bug: angleproject:7351 Bug: angleproject:3586 Bug: angleproject:6195 Bug: b/234173199 Change-Id: Idd7559dcba3d91e36d8f253f1554fb931a7a6775 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3724165 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Dan Field 3faaded8 2022-06-15T11:28:58 Missing include for std::isdigit Bug: angleproject:7430 Change-Id: I2b374c826c4b29a4e290378a3cd18d2df49268b6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3708312 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Amirali Abdolrashidi 3b988fef 2022-06-01T10:54:03 Vulkan: Remove enableLineRasterEmulation * Removed the Bresenham line raster emulation specialization constant, along with related variables and functions. Bug: angleproject:7366 Change-Id: If17c8ce9b459ad801bae8e887e5674bd9a3ff2bf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3680860 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi ce3c0fe9 2022-06-06T12:09:45 Vulkan: Make depth-correction uniform controlled This change makes sure SPIR-V transformations are not required for depth correction, having the number of potential pipelines. Bug: angleproject:5881 Change-Id: If3f66b34bdd1127ae588cbc822ea7cf01fa8621f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3691801 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 53fb57a6 2022-05-31T12:13:59 Vulkan: Fix xfb emulation bug w.r.t array elements This change handles corner cases where the 0th element of the array is not captured. Bug: angleproject:7376 Change-Id: I358f064abe5e1702985ab0faf7465cef178e7b87 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3679484 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 98c2e169 2022-05-20T16:17:49 Vulkan: Reduce pre-rotation spec const to bool The specialization constant now only dictates whether x and y should be swapped. The complete 8 possible states of rotation and y-flip are achieved by using this swap in combination with a driver uniform for x and y flip. Swapping is still a specialization constant to avoid degrading performance of dFdx/dFdy which otherwise would need both to be evaluated instead of one. On platforms which don't support pre-rotation, the specialization constant will never change and driver uniforms entirely govern y-flip. On platforms that do support pre-rotation, only two variations of the pipeline are needed. Bug: angleproject:7366 Change-Id: I73f84e89fa9349d2098fa5b21573aee57d93a30c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3663151 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Lingfeng Yang <lfy@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Amirali Abdolrashidi fea19567 2022-05-17T17:44:06 Vulkan: Remove removeEarlyFragmentTestsOpt flag * Removed removeEarlyFragmentTestsOptimization and the related SPIRV transformation and variables. * Removed mUsesEarlyFragmentTestsOptimization. * Removed SH_EARLY_FRAGMENT_TESTS_OPTIMIZATION. * Merged updateUsesEarlyFragmentTestsOptimization() into updateFragmentInoutRange(). Bug: angleproject:7347 Change-Id: I7299bd4e8ab5363e5cf06eb48419d4f469106e12 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3648217 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Jamie Madill 0439d9cd 2022-04-21T13:30:53 Vulkan: Update glslang wrapper TODO. Bug: angleproject:4524 Bug: angleproject:7220 Change-Id: I1a59a626409f9acf52d4b43d6695f7119a9077a1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3599595 Auto-Submit: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 55c21842 2022-04-14T05:04:15 Vulkan: Use flat array lookups for shader variables. The array lookups we use after link now are simple array lookups and no longer use string hashing queries. This will make the descriptor cache indexing much faster after the cache key redesign. Bug: angleproject:4524 Change-Id: If19e3a4aa57c415f33c69172dd76c10a207e3264 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3580979 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill bddb944b 2022-04-14T05:04:09 Vulkan: Prep variable info map to remove hashing. The removes all the string-based query APIs from the program executable descriptor set init. The new APIs still use string-keyed maps but will be switched out with non-hashed maps in a future CL. Bug: angleproject:4524 Change-Id: I427efb3ebcf22d5fbdf6d20679bbdaa23cd2dc94 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3573077 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill e77be663 2022-04-14T05:04:13 Use ProgramExecutable directly in GlslangWrapper. Using the ProgramExecutable instead of the state means we can deal with merged samplers and images immediately. This will make it easier to use linear maps when indexing program resources for descriptor sets. Bug: angleproject:3570 Bug: angleproject:4524 Change-Id: Icd8ee9fe61730b81fafa2bdc59a2788a0d92ad12 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3580882 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Mohan Maiya 5094968f 2022-02-24T16:28:00 Vulkan: Account for Invariant in transformDecorate When replacing a varying with a temp variable make sure to propagate the Invariant decorator to the replacement variable. Bug: angleproject:7046 Change-Id: I6e1f9ae5a6045ca963738cfdee5788f04ae620e4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3489812 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Brandon Schade 06edae72 2022-01-11T11:13:20 Vulkan: Allow duplicated block name in different shader interface In OpenGL ES 3.2 Shading Language specification(4.3.9), A block name is allowed to have different definitions in different shader interfaces within the same shader. Bug: angleproject:5557 Test: KHR-GLES32.core.tessellation_shader.single.max_patch_vertices Change-Id: I49f149cfd8f6f063fc5045aa154cc401d3e38cfb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3429684 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Brandon Schade <b.schade@samsung.com>
Kyle Piddington c4a9d416 2022-01-05T15:28:11 Metal: Refactor to build without SPIR-V Refactor ShaderInterfaceInfoMap and constant names to thier own files, allowing Webkit to build without needing to compile SPIRV code via mtl_glslang_utils.cpp. Bug: angleproject:6782 Change-Id: I7a9c7e387145c95807f780e24bd2764e0efb5709 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3364970 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Kyle Piddington <kpiddington@apple.com>
Brandon Schade a5e22715 2021-09-30T17:03:34 Vulkan: Fixed TC shader and gl_PerVertex block interaction TransformSpirV() does not account for the fact that the tessellation control shader's output gl_PerVertex block is a named array. This results in the input and output blocks being sometimes flipped. Added code to track the IdRef of both input and output array gl_PerVertex blocks and swap them if necessary. Bug: angleproject:5557 Tests: KHR-GLES32.core.tessellation_shader.tessellation_control_to_tessellation_evaluation.data_pass_through Change-Id: Ie3823701b4eaa53daa8ca34faab657f54d8aee38 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3208513 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Brandon Schade <b.schade@samsung.com>
Yuly Novikov 17261f3b 2021-11-29T19:53:39 Remove not needed constexpr definitions, deprecated in C++17 Bug: angleproject:6737 Change-Id: I38ead1bd8e5eaace78750505b93a2576e19d0f83 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3307535 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 5a5996aa 2021-11-09T21:42:43 Vulkan: Handle missing decorations in SPIR-V precision fixer Bug: angleproject:6674 Change-Id: Ibfc72f14b9eeb17d7c70cf6d2384d970b2e66650 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3271551 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Brandon Schade d6afeadd 2021-08-30T14:44:59 Vulkan: Make descriptor set bindings consistent across shader stages Previously if a uniform or uniform block was used in a program's shader, a different descriptor set binding index would be used for each linked shader stage. Now, the bindings chosen for uniforms and blocks of the same name will be identical. This change also updates mActiveImagesMask in ProgramExecutable for separable programs. Bug: angleproject:4512 Tests: KHR-GLES3*.core.geometry_shader.api.max_image_uniforms ProgramPipelineTest31.MaxFragmentShaderStorageBufferObjects ProgramPipelineTest31.MaxFragmentUniformBufferObjects ProgramPipelineTest32.MaxGeometryImageUniforms GeometryShaderTestES32.MaxGeometryImageUniforms Change-Id: I3662d06b4dec284f4c51c6047e6b684b82925e3f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3068381 Commit-Queue: Brandon Schade <b.schade@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 210773db 2021-08-05T10:41:59 Translator: Be more explicit about precisions GLSL ES requires that every symbol (variable, block member, function parameter and return value) is appropriately qualified with a precision, either individually or through the global precision specifier. Some tree transformations however produced symbols with EbpUndefined precision. In text GLSL output, these would produce unqualified symbols which was often incorrect. In this change, the transformations are made to produce explicit / more consistent precisions. The validation (that caught these issues) is not included in this change as there are still a few corner cases left to address. Bug: angleproject:4889 Bug: angleproject:6132 Change-Id: Icca8a0a5476f8646226e7243aa8f501f44acc164 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3075127 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 3036e090 2021-07-29T15:55:39 Vulkan: Direct SPIR-V Gen: Support the precise keyword The precise keyword is different in GLSL in that it defines what arithmetic operations _that have led to the value being assigned to a variable_ should be done precisely (i.e. not "contracted"). A tree traverser is implemented that detects precise access chains and applies precise-ness to the right hand side of assignment expressions to said access chains. This is only done if the shader uses the precise keyword in the first place. The algorithm for this is inspired by the implementation in glslang. This change additionally: - Fixes parser to allow precise on function parameters - Fixes GLSL code generation to output precise on struct members and function parameters. Bug: angleproject:4889 Change-Id: Ie3808c3c8c08da308e88af20f5f90379d9d14d47 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3056369 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 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 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 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 683064b7 2021-06-02T02:59:55 Vulkan: Fix missing operand list in OpExecutionMode parser & builder Bug: angleproject:4889 Change-Id: Ie864031caeddfcf5202044b0f9c197b3883ceaf7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2934782 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@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>
Mohan Maiya 4cdbdf90 2021-03-25T18:54:50 Vulkan: Assign XFB location first then assign varying location Varying location is determined based on XFB location. If the transform feedback stage is Vertex, there is no problem. But if the transform feedback stage is GS or TES, previous implementation can cause shader interface mismatch. Bug: angleproject:5557 Test: KHR-GLES32.core.tessellation_shader.tessellation_control_to_tessellation_evaluation.gl_in Change-Id: I1ecc7913a178c9e674307c528d1bdf13aabcb665 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2784713 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
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>
Shahbaz Youssefi cb5441ed 2021-03-11T16:15:01 Vulkan: Don't let glslang link shaders The translator outputs intermediate shaders for Vulkan that are later to be modified by the SPIR-V transformer. glslang has no business trying to link them. Bug: angleproject:5740 Change-Id: I9ae418f54b91312b5fd0ef794acbc46a40261a0e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2753096 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi c7c38731 2021-03-04T15:04:07 Vulkan: Move SpirvBlob definition to common/ For use by the translator. Bug: angleproject:4889 Change-Id: Ie95cafd3cfcdde50acc5d26d3c00e6574186a805 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2737276 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 8844599f 2020-09-11T22:41:36 Vulkan: Create unresolve shader directly in SPIR-V Per issue 4889, dependency to glslang is being dropped. This change generates the unresolve UtilsVk shader directly in SPIR-V. This shader is trivial and contains repeating patterns per attachment. As a result, generating its SPIR-V is exceptionally simple. The SPIR-V in this change is first generated by glslang validator and is then adapted for autogeneration. See comments in the code for details. Bug: angleproject:4889 Change-Id: I48dd77ae04e1035c05a8aef7bf2f161e105ae2a4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2407179 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi da4aa8b8 2021-02-25T16:26:53 Vulkan: Move SPIR-V validation function to common/ For future use by the translator. Bug: angleproject:4889 Change-Id: I051ad48e6edb58ce3055c5fd276c18a6e29a66ac Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2717020 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Stephan Hartmann 46df78dc 2021-02-25T20:30:42 GCC: add missing static constexpr member definition C++14 requires to definition of static constexpr members to emit a linker symbol. Bug: chromium:819294 Change-Id: I06b7f1f7a6260982cf07a71c67295789c1f03084 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2720261 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
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>
Shahbaz Youssefi df0a92e6 2021-02-22T06:39:32 Assert valid when using SPIR-V ids Useful for debugging when an uninitialized id is used in the SPIR-V transformer. Bug: angleproject:4888 Change-Id: If446187a8a27a06f5958d5df5bc00d02e98d20e3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2713268 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi c2d14d03 2021-02-18T13:55:23 Vulkan: Refactor prerotation out of SPIR-V transformer The SPIR-V transformer performs multiple transformations in one pass. This is part of a series of refactoring changes that detangle these transformations and encapsulate them, while allowing the transformation to remain single-pass. Bug: angleproject:4888 Change-Id: Ia971da6d814b5d7c4f51132fe63b58675163c15f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2705026 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 4a95488c 2021-02-18T12:21:26 Vulkan: Refactor xfb codegen out of SPIR-V transformer The SPIR-V transformer performs multiple transformations in one pass. This is part of a series of refactoring changes that detangle these transformations and encapsulate them, while allowing the transformation to remain single-pass. Bug: angleproject:4888 Change-Id: I3e3164803863c4d477364f5b2ed0679ed501ea3c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2705025 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi bd9a3b29 2021-02-18T11:52:39 Vulkan: Refactor varying precision fix out of SPIR-V transformer The SPIR-V transformer performs multiple transformations in one pass. This is part of a series of refactoring changes that detangle these transformations and encapsulate them, while allowing the transformation to remain single-pass. Bug: angleproject:4888 Change-Id: I587d601e02164c1372a09565d1713aac27cfbebb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2705024 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 454194e4 2021-02-17T23:14:30 Vulkan: Refactor inactive varying removal out of SPIR-V transformer The SPIR-V transformer performs multiple transformations in one pass. This is part of a series of refactoring changes that detangle these transformations and encapsulate them, while allowing the transformation to remain single-pass. Bug: angleproject:4888 Change-Id: Ifd52be302c25392d3e8fc1c589795c113e44d354 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2703792 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi c342647f 2021-02-17T22:46:09 Vulkan: Refactor gl_PerVertex trimming out of SPIR-V transformer The SPIR-V transformer performs multiple transformations in one pass. This is part of a series of refactoring changes that detangle these transformations and encapsulate them, while allowing the transformation to remain single-pass. Bug: angleproject:4888 Change-Id: I41ba9165336487819dcf915af0d1ed868f73f724 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2703791 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 8f65bb39 2021-02-17T17:11:44 Vulkan: Typed return value in SPIR-V transformer transform funcs Use an enum class instead of a bool for readability. Bug: angleproject:4888 Change-Id: I5fddec4ccc1cb7e28940c0566979f5fd5e051d60 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2702652 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi d3d30921 2021-02-17T16:33:20 Vulkan: Refactor ID-discovery out of SPIR-V transformer The SPIR-V transformer performs multiple transformations in one pass. This is the first of a series of refactoring changes that detangle these transformations and encapsulate them, while allowing the transformation to remain single-pass. Bug: angleproject:4888 Change-Id: I327f693d99496a0b89028abe627119e4a2b07c42 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2702651 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill a8a2a71b 2021-02-01T17:18:18 Vulkan: Support y-flip with no driver support. We can reuse the surface rotation matrix code to do the y-flip. This requires the SPIR-V transformation support. Because not all rotations are encoded into the table we can only support rotation with the driver support for y-flip (currently). Includes some very minimal regression testing. This work is targeted towards supporting vk-portability implementations which are not as up-to-date with Vulkan features. Bug: angleproject:5596 Change-Id: I270fa1efc03267551d28df33ddac9972e1343d60 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2665892 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
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 de53e308 2021-01-26T12:44:04 Metal: Fix XFB failures on ARM. Metal back-end needs to generate 2 versions of XFB shader: - one version without XFB emulation code for rasterized draw. - one version with XFB emulation code for draws with rasterization disabled. Based on a change by le.hoang.q@gmail.com Bug: chromium:1167763 Change-Id: I2858859e15b18701fadff09092bb08778c4a7e64 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2648636 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Le Hoang Quyen <le.hoang.q@gmail.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 6689a54d 2021-01-21T00:36:14 Vulkan: autogen for SPIR-V instruction build and parse Handwritten SPIR-V instruction parse and build code is replaced with autogenerated functions based on the SPIR-V grammar. Bug: angleproject:4889 Change-Id: I09d724fd944e79c03fe4eadca3ee3e3ef0b49872 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2644721 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi bb3adfa4 2020-12-01T15:43:13 Rename ShaderVariable::structName to structOrBlockName Bug: angleproject:3580 Change-Id: Ic53a5267972f153dad2e20948e493e9767a45d16 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2568247 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 382f016d 2021-01-19T15:35:19 Vulkan: Retain OpSource in SPIR-V Needed by AGI. It's a small instruction, and there's only one of it. This change makes the SPIR-V transformer retain this instruction even on release. Bug: b/177556123 Change-Id: I0a2ba8afe55018b08f25abd8a139b64b2a5f6f11 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2636691 Reviewed-by: Ian Elliott <ianelliott@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill b912eec5 2020-11-27T11:08:41 Vulkan: Support GL_EXT_tessellation_shader. Shader translator changes done in http://crrev.com/c/2633936 Adds a new DIRTY_BIT_PATCH_VERTICES state to Context. Supportes state query and transform feedback. 4 test suppressions remain as follow-up fixes. Adds a new varying packing mode for a simple Vulkan rule set. Based on work by Mohan Maiya (m.maiya@samsung.com). Test: dEQP-GLES31.functional.tessellation.* Bug: angleproject:3572 Change-Id: I4cad2cca30adb754fd12c83027673906541f566a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2568234 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Mohan Maiya <m.maiya@samsung.com> Commit-Queue: Jamie Madill <jmadill@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>
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>
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 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>
Jamie Madill d654ac9b 2020-12-30T12:28:41 Program: Support multiple varying packings. Instead of using a single varying packing for all program stages, we switch to using a varying register packing for each pair of input/output shaders. This allows several valid use cases that use many varying to succeed. For instance Geometry Shaders have both an input and output varying packing. With tessellation shaders the upper bound of valid varying packings in one Program goes up even more. We keep multiple varying packings at once inside a new "ProgramVaryingPacking" class. Internally the class keeps a unique varying mapping for each input/output interface in the program. Separable programs with "open" interfaces are handled specially. Fixes a bug where varying counting was artificially limited for programs with more than two shaders. This CL also disables GS support when we're emulating line raster so we don't have to figure out the details on how to place the special position varying. Bug: angleproject:5496 Change-Id: I1f9a327c4750caef570c608d86953e9d0cc5eea3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2606532 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@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 ca94d1da 2021-01-04T21:51:33 Vulkan: Refactor generated code in xfb emulation path The index expression was regenerated for every component written to the output. This change refactors the generated code such that common values are calculated once. This is in preparation for moving some of this code to the translator and reducing the amount of code generated at link time. Bug: angleproject:3606 Change-Id: Ib180d245218f8f6f18c57c0ea092e8c45cbffd1a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2607490 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill 92e7bc89 2020-12-23T15:18:42 Remove ProgramLinkedResources from ProgramExecutable. Instead of storing the entire LinkedResources struct, we can keep it only for the duration of the linking calls. Refactoring change only. It sets the stage for more refactoring. This change also switches the link call to use LinkingState's ProgramLinkedResources directly to avoid the need to copy the varying packing or use a pointer. Bug: angleproject:4514 Bug: angleproject:5496 Change-Id: Iefea3c16a33213dc338cc54efaa7c3064ea6ae08 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2601403 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi bf6cc88a 2021-01-05T22:17:41 Vulkan: Remove duplicate shaderType parameter to SPIR-V transformer The passed-in GlslangSpirvOptions already has the shaderType, so this extra parameter was not necessary. Bug: angleproject:4524 Change-Id: Ibbc7442b3173b26825f3cb9e2365789fade92cfc Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2611311 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi aff17499 2020-12-23T14:40:06 Vulkan: Directly capture non-gl_Postion builtins Building on support for transform feedback capture of I/O block members, this change optimizes capture of builtins other than gl_Position by directly decorating members of gl_PerVertex. Most importantly, this allows us to reserve only one varying for transform feedback, instead of as many builtins there could be (up to 4). Bug: angleproject:3606 Change-Id: Ie0957802c657ed6c5aac538d92b860582ed6da45 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2601072 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 093250e0 2020-12-23T12:07:46 Vulkan: Make shader variable info maps a class. Instead of using a map type directly we abstract the info maps into an encapsulated class. We can enforce a specific API set instead of using the same API as the map class. This also cleans up a few of the APIs related to these maps. This change will allow future changes to the way the variables are stored in the class without drastically changing the interface. Bug: angleproject:3572 Bug: angleproject:4524 Change-Id: Ic1a63e1776c39f49b895a1274bae8282d7a6b9b5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2600080 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi eeb14308 2020-12-23T01:45:35 Vulkan: Support xfb capture of I/O block fields In the emulation path, it's ensured that the generated code references the I/O block field correctly (using the instance name if provided, and without it otherwise). In the extension path, the info map is augmented with an array of xfb decorations for its fields. Then when `OpDecorate %IOBlockId Block` is encountered, the transform feedback decorations on the fields are inserted: OpMemberDecorate %IOBlockId MemberN XfbBuffer buffer OpMemberDecorate %IOBlockId MemberN XfbStride stride OpMemberDecorate %IOBlockId MemberN Offset offset Future work includes removing the duplicate varying added for gl_PointSize and use this mechanism to decorate gl_PerVertex directly. Bug: angleproject:3606 Change-Id: I6fed0b1ee7245fe695337043b40b281fb01a1fb0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2599953 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 85707f7f 2020-12-21T14:52:38 Vulkan: Pass in SPIR-V transform options in a struct Clean up change in preparation for changes that add more options. Bug: angleproject:5478 Change-Id: Id35825b337dba153a5c28dfcc311b344ce257f78 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2599941 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
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>
Shahbaz Youssefi 8789457d 2020-12-09T00:21:08 Fix varying packing of I/O block fields The sorting algorithm didn't keep the fields in order, which made them receive arbitrary locations. The SPIR-V transformer assigns the location on the whole block instead of individual members, which was incorrect in this situation. The SPIR-V transformer could have been modified to decorate each field of the I/O block with a location. This change instead sorts the fields in such a way that I/O block fields are allocated contiguously, which allows the SPIR-V transformer to function unchanged. Bug: angleproject:3580 Change-Id: I27df9e8122dd4207835bad448ffb8015692a1635 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2581076 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 56f4a501 2020-12-07T14:41:32 Vulkan: Add debugging code for SPIRV transformer. Requires a custom define for output. Bug: angleproject:3572 Change-Id: I3721c4067c61f3e22ce7c047054b74d3fe468d8f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2578058 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi dfdf90a7 2020-12-01T16:09:41 Create helper for identifying builtin names Bug: angleproject:5405 Change-Id: I652f2d6d3af4468b9662cdea5d2706d36e118239 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2568550 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 8797714c 2020-12-01T11:39:25 Vulkan: Support OES_shader_io_blocks Enables OES/EXT_shader_io_blocks extensions in Vulkan backends. With shader I/O blocks, the varyings can now be an array of struct (the block itself) of struct (nested in the block). This change is missing a number of features. In particular, if the shader I/O block has a location decoration in the middle of the block, that is not handled yet. Based on changes from m.maiya@samsung.com and jmadill@chromium.org. Bug: angleproject:3580 Tests: dEQP-GLES31.functional.shaders.linkage.es31.io_block.* dEQP-GLES31.functional.separate_shader.validation.es31.io_blocks.* dEQP-GLES31.functional.program_interface_query.program_input.* dEQP-GLES31.functional.program_interface_query.program_output.* Change-Id: I593840475d2365ff6c9ce7b2290f5ee462a30dfb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2567645 Reviewed-by: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 06c39376 2020-11-27T12:45:33 Vulkan: Minimize gl_PerVertex members As ANGLE doesn't redeclare gl_PerVertex, glslang always defines it with: gl_Position gl_PointSize gl_ClipDistance gl_CullDistance The unused members here contribute to varying component limits. The last two are unlikely to be used, and the second member is rarely used as well. This change keeps it simple and strips the trailing inactive members, which for all intents and purposes accurately minimizes this struct. Bug: angleproject:5405 Change-Id: I59c22af4988a3da7b1e428913d0ea13be9031cea Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2562754 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi fcb6b5a5 2020-11-25T22:16:15 Vulkan: Fix precision transformation for geometry shaders When a varying precision mismatch is present between two stages, the SPIR-V transformer transforms the following: in precision1 type1 inVar; out precision2 type2 outVar; void main() { f(inVar); outVar = g(); } to: in precision3 type1 inVarModified; out precision4 type2 outVarModified; precision1 type1 inVarTurnedPrivate; precision2 type2 outVarTurnedPrivate; void main() { // Input preamble inVarTurnedPrivate = inVarModified; f(inVarTurnedPrivate); outVarTurnedPrivate = g(); // Output preamble outVarModified = outVarTurnedPrivate; } This doesn't work for geometry shaders as they take the varying outputs on EmitVertex() as opposed to return from main. This change simply places the output preamble before every EmitVertex() instead of at the end of the shader, if it's a geometry shader. Bug: angleproject:5403 Change-Id: Ie395a3270c6903c54b49f64a26bc5297044cbaeb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2561939 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 9c6f7385 2020-11-25T22:01:33 Vulkan: Move SPIR-V generators to base transformer class Moves the generators from SpirvVertexAttributeAliasingTransformer to the base class, and makes SpirvTransformer use the same functions. Bug: angleproject:4889 Change-Id: I1f105e2ac764fc7b36c8c75d2cf5f30dec841f97 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2561938 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: 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>
Shahbaz Youssefi 62d010f9 2020-10-22T13:31:50 Vulkan: Assert that attributes in shader info map are active Attributes that are not active shouldn't have made it to the ShaderInterfaceVariableInfoMap of gl::ShaderType::Vertex. This change turns a few ifs to ASSERT in SpirvVertexAttributeAliasingTransformer. Bug: angleproject:4249 Change-Id: I3da4ea773eae20fe2f126b82f7790e9f2cab0bc1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2491929 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi cb5c0b01 2020-10-21T00:12:57 Vulkan: Drop RelaxedPrecision from aliased attributes Take the following example: attribute mediump vec4 a; // location 0 attribute highp vec2 b; // location 0 f(b) This was previously translated to: attribute mediump vec4 a; // location 0 f(a.xy) That difference here is that b was previously highp, but a.xy is mediump. This change drops RelaxedPrecision from attributes so that they are all highp. Note that the temporary SPIR-V ids these attributes are loaded into still retain their RelaxedPrecision decoration (if any), and the precision of calculations in the shader is not increased by this change. Bug: angleproject:4249 Change-Id: Idca0fc667ad6e36ddf428b65ea03706272a9ed9c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2488131 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Shahbaz Youssefi d7475437 2020-10-20T15:04:18 Vulkan: Support vertex attribute aliasing for matrix types This change builds on vertex attribute aliasing SPIR-V tranformation for non-matrix types to add support for matrix attribute types. This is done by turning every matrix attribute declaration into multiple vector attribute declarations, and reusing the same mechanism for resolving aliasing between non-matrix types. Take the following example: attribute mat4 a; // location 0 attribute vec3 b; // location 1 attribute mat3 c; // location 1 attribute vec4 d; // location 2 The shader is modified as such: attribute vec4 a_0; // location 0 attribute vec4 a_1; // location 1 attribute vec4 a_2; // location 2 attribute vec4 a_3; // location 3 attribute vec3 c_0; // location 4 attribute vec4 d; // location 5 attribute vec3 c_2; // location 6 mat4 a; mat3 c; and in the beginning of main(), the following code is inserted: a = mat4(a_0, a_1, a_2, a_3); c = mat3(c_0, d.xyz, c_2); The shader continues to use a and c as before. Bug: angleproject:4249 Change-Id: Idfcb8c6037ca0c1f21de8203d7e2a1b66fed6e7e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2488128 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Shahbaz Youssefi 3fb490a7 2020-10-19T23:33:47 Vulkan: Faster check for vertex attribute aliasing In preparation for matrix attribute aliasing support, where CalculateAliasingAttributes would get a bit more complex. This change adds a fast-check function to determine if there is any aliasing at all. Bug: angleproject:4249 Change-Id: Ib2aa08b2da29a194baa905ba8f9aa2cdef0ae2c5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2488127 Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 9091de43 2020-10-17T00:33:57 Vulkan: Support vertex attribute aliasing for non-matrix types Initial implementation that supports float and vecN types. In this case, every attribute occupies a single location. When two attributes alias, they are either the same size, or one is bigger than the other. Take the following example: attribute vec3 a; // location 0 attribute vec3 b; // location 0 attribute vec4 c; // location 1 attribute vec2 d; // location 1 The shader may access either a or b (but not both). Similarly, it can access either c or d (but not both). The shader can be modified such that: - f(b) is replaced with f(a). - g(d) is replaced with g(c.xy). - b and d are removed As a result, there are no longer any aliasing attributes. In other words, when attributes alias, the larger attribute can be retained and the other attributes can be replaced by selecting the appropriate number of components from the retained attribute. Bug: angleproject:4249 Change-Id: I7c5461f777d659c92977e2572091a8ce5e422704 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2482286 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 1bf0b917 2020-10-16T12:13:24 Vulkan: Pull generic SPIR-V transform functionality into base class This is in preparation for adding another transformation for vertex attribute aliasing. This transformation is not merged with the existing one, because in practice vertex attribute aliasing is rare so this transformation would be rarely done. This makes sure the efficiency of the main transformer is not affected, and avoids complicating it further. Bug: angleproject:4249 Change-Id: I9c3f6cefbec99a355596579f4471d7ada810927e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2482285 Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Trevor David Black e815afbf 2020-09-07T22:09:22 First pass at increasing inclusivity Link to the inclusivity rules https://source.android.com/setup/contribute/respectful-code Bug: b/162834212 Bug: chromium:1097198 Change-Id: Ied5a9e3879d72bff3f77ea6fcda9b82f30c32c2f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2396737 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Trevor Black <vantablack@google.com>
Le Hoang Quyen 6136cbcb 2020-09-23T21:31:05 Metal: Implement transform feedback - XFB is currently emulated by writing to storage buffers. - Metal doesn't allow vertex shader to both write to storage buffers and to stage output (i.e clip position). So if GL_RASTERIZER_DISCARD is NOT enabled, the draw with XFB enabled will have 2 passes: + First pass: vertex shader writes to XFB buffers + not write to stage output + disable rasterizer. + Second pass: vertex shader writes to stage output (i.e. [[position]]) + enable rasterizer. If GL_RASTERIZER_DISCARD is enabled, the second pass is omitted. + This effectively executes the same vertex shader twice. TODO: possible improvement is writing vertex outputs to buffer in first pass then re-use that buffer as input for second pass which has a passthrough vertex shader. - If GL_RASTERIZER_DISCARD is enabled, and XFB is enabled: + Only first pass above will be executed, and the render pass will use an empty 1x1 texture attachment since rasterization is not needed. - If GL_RASTERIZER_DISCARD is enabled, but XFB is NOT enabled: + we still enable Metal rasterizer. + but vertex shader must emulate the discard by writing gl_Position = (-3, -3, -3, 1). This effectively moves the vertex out of clip space's visible area. + This is because GLSL still allows vertex shader to write to stage output when rasterizer is disabled. However, Metal doesn't allow that. In Metal, if rasterizer is disabled, then vertex shader must not write to stage output. - See src/libANGLE/renderer/metal/doc/TransformFeedback.md for more details. Bug: angleproject:2634 Change-Id: I6c700e031052560326b7f660ee7597202d38e6aa Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2408594 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Shahbaz Youssefi f39e0f01 2020-09-07T23:07:37 Vulkan: Use subpass to unresolve render-to-texture attachments GL_EXT_multisampled_render_to_texture allows singlesampled textures to be used with multisampled framebuffers in such a way that the final resolve operation is automatically done. In Vulkan terminology, the render-to-texture GL attachment is used as a Vulkan subpass resolve attachment with an implicit (ideally-)lazy-memory multisampled image as the color attachment. This extension expects that if the texture is drawn to after the automatic resolve, the implicit multisampled image would take its fragment colors from the singlesampled image. In other words, the opposite of a resolve operation should be automatically performed at the start of the render pass. This change refers to this operation as "unresolve". The goal of this extension is to allow tiling GPUs to always keep multisampled data on tile memory and only ever load/store singlesampled data. The latter is achieved by using a subpass resolve attachment and setting storeOp of the multisampled color attachment to DONT_CARE. This change achieves the former by using an initial subpass that uses the resolve attachment as input attachment, draws into the multisampled color attachment and sets loadOp of said attachment to DONT_CARE. Bug: angleproject:4881 Change-Id: I99f410530365963567c77a7d62fc9db1500e5e3e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2397206 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tim Van Patten 233cc31b 2020-09-15T11:05:17 Vulkan: Use linkedShaderStages in GlslangGetShaderSpirvCode() The parameter linkedShaderStages is passed to GlslangGetShaderSpirvCode(), but is unused. This CL uses the parameter, rather than gl::AllShaderTypes(). This CL also removes the unused parameter variableInfoMap from the call chain. Bug: angleproject:3570 Change-Id: Ic60084e87cb2aa2a245e3e963598851331379e89 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2412364 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Courtney Goeltzenleuchter ae09e889 2020-09-10T17:00:13 Fix mismatch issue with precision qualifiers. GLSL allows varyings passed from one stage to another to not match in precision (e.g. float & half-float). Vulkan doesn't allow that so adjust those mismatches to use the higher precision. To fix we keep track of the precision of varyings and in the Vulkan backend if we see they are different patch up the SPIR-V to make them match. Bug: angleproject:3078 Change-Id: I385d31e082da46ccdd4817b6612f5f9d9cbce17c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2337755 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Tim Van Patten d29d4c6b 2020-08-25T12:40:06 Vulkan: Avoid linking to SPIR-V validation if possible We unconditionally link to $angle_spirv_tools_dir:spvtools_val, but we only use SPIR-V validation with ASSERTs. This CL removes this dependency when ASSERTs are disabled. Bug: angleproject:4887 Test: CQ Change-Id: Ic403b78196ecd895e4a0cdefb54ab4497651ccac Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2375872 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>