src/compiler/translator/tree_util/DriverUniform.cpp


Log

Author Commit Date CI Message
Shahbaz Youssefi 47c66901 2024-10-21T12:47:22 Vulkan: Set gl_Layer to 0 if the framebuffer is not layered Bug: angleproject:372390039 Change-Id: I29067c9488e06f6dd2e90f207fecb843267fb77c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5949263 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi b16d105f 2024-10-03T10:25:32 Remove Desktop GL front-end support For Desktop GL applications, please use Zink! Bug: angleproject:370937467 Change-Id: Ie734634bb62a2e98c80e1b32d8b3d34624da3c04 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5905428 Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi 24f4007b 2023-06-08T00:41:55 Vulkan: Use SPIR-V ids instead of names in the transformer This change removes the SPIR-V transformer's reliance on type and variable names. As a result: - String hashing is removed from the info map data structure and the SPIR-V transformer - The ID discovery class is entirely removed - Internal variable names have become a detail of the compiler alone (and are no longer exposed as part of the compiler interface) - Some front-end name tracking is removed ("parentStructMappedName", etc) This change also properly cleans up xfb emulation types that were previously left over. This change allows the SPIR-V compiler to emit user strings as-is instead of prefixing them with `u_` leading to more readable debug shaders. Additionally, it will make it possible not to emit debug info at all. Both of these changes will be done in follow ups. Bug: angleproject:7220 Change-Id: Iaa127496209a27aaae2e0d14c41b22fffb0b72a2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4600610 Reviewed-by: Roman Lavrov <romanl@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 76b0e7f3 2023-06-01T11:25:54 Vulkan: Use reserved SPIR-V ids for internal variables With this change, the SPIR-V transformer does not need to discover these ids through name matching. Ultimately, user variables would also be identified by their SPIR-V ids (instead of name), removing the Vulkan backend's reliance on strings. Bug: angleproject:7220 Change-Id: I241c3247b89a28f9eed28f23c06b7c8b7fbbeaa0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4583133 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Alexey Knyazev 7bc4b7e3 2023-03-27T00:00:00 Metal: Implement OES_sample_variables New ESSL built-ins are mapped to their Metal counterparts and tweaked to follow OpenGL ES semantics when needed. Fixed A2C interaction with sample coverage by emulating the former on non-Apple GPUs. Bug: angleproject:8097 Fixed: angleproject:5087 Change-Id: I5d28a941af5cbc14743a3930731529f11f55febd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4404896 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Kyle Piddington <kpiddington@apple.com> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Amirali Abdolrashidi 8050079c 2022-08-08T16:35:10 Vulkan: Remove basicGLLineRasterization * Removed basicGLLineRasterization from the ANGLE features. * Removed "viewport" from the extended driver uniform classes. Bug: angleproject:2830 Bug: angleproject:7558 Change-Id: I289b1e2b536a6bd0c1ab24844835221e617a296d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3818165 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Amirali Abdolrashidi 7fe0694c 2022-07-14T16:42:30 Vulkan: Use push constants for driver uniforms * Updated the driver uniforms so they would be defined as push constants in SPIR-V. Their data would be updated via pushConstants() when handling the driver uniform dirty bits. * Updated TOutputVulkanGLSL to be able to generate the push constants as required. * When handling the driver uniform dirty bits, we no longer allocate a buffer. * Removed the driver uniform descriptor set from the pipeline layout. * Removed the binding-related functions and flags for the driver uniforms. * In invalidateGraphicsDescriptorSet(), DIRTY_BIT_DESCRIPTOR_SETS is used instead of DIRTY_BIT_DRIVER_UNIFORMS_BINDING. (Same for invalidateComputeDescriptorSet()) * DIRTY_BIT_DRIVER_UNIFORMS_BINDING is replaced with DIRTY_BIT_DRIVER_UNIFORMS in other places. * Removed mDriverUniform and DriverUniformsDescriptorSet from ContextVk. * Added mSupportedVulkanShaderStageMask to RendererVk, which is used in creating the pipeline layout and updating the push constants. * Added a TODO note for driverUniformsDescriptorSetIndex. Bug: angleproject:6858 Change-Id: I91037d378528962a816b12ff3f21249ee17b7652 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3782570 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang 785353fd 2022-05-24T12:40:16 Support Desktop OpenGL context creation in end2end tests Validation of Desktop GL versions and profile masks is unimplemented. Bug: angleproject:7360 Change-Id: Ifae94215b6aada895c2b02318a1d05c9515e9b96 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3664916 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@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 2df17a12 2022-05-25T16:18:37 Vulkan: Pack driver uniforms Previously 5 vec4s were used for driver uniforms + 2 vec4s if specialization constants couldn't be supported. The driver uniforms are rearranged and packed such that only 2 vec4s are normally used, which include fallback for specialization constants as well. In the future, most of the specialization constants may turn into uniforms, and this change prepares for that. Additional uniforms are used (3 vec4s) only if common extensions are missing; transform feedback and bresenham lines. This change makes it more practical for driver uniforms to be turned into push constants. Additionally, these uniforms could potentially be loaded and cached at the beginning of the shader for more efficient memory access. On Pixel6, with this change, the traces show no difference in wall time. On most traces, CPU time shows up to ~7% improvement. Bug: angleproject:7366 Change-Id: I0f47f863955af06a19c69d1f1d7c45b97d95476e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3668151 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
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>
Shahbaz Youssefi c5271e8e 2022-04-04T23:28:35 Vulkan: Emulate GL_KHR_blend_equation_advanced Based on a change by Brandon Schade <b.schade@samsung.com> In the translator, when advanced blend is enabled, an input attachment is added. Based on the listed advanced blend equations, emulation code is added that performs those equations' functions. The blend equation itself is passed through a driver uniform. Note that the advanced blend extension only allows a single output to use advanced blend, and that should be at location 0. In the Vulkan backend, when advanced blend is used, the driver uniform to select the equation is updated and normal blending is disabled. Bug: angleproject:3586 Change-Id: Icc42e8be238d34fca149087eb9cfe616a7643a6b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3575738 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 665ddccd 2021-12-09T23:06:39 Vulkan: Emulate dithering Dithering in OpenGL is vaguely defined, to the extent that no dithering is also a valid dithering algorithm. Dithering is enabled by default, but emulating it has a non-negligible cost. Similarly to some other GLES drivers, ANGLE enables dithering only on low-bit formats where visual banding is particularly common; namely RGBA4444, RGBA5551 and RGB565. Dithering is emulated in the fragment shader and is controlled by a spec constant. Every 2 bits of the spec constant correspond to one attachment, with the value indicating: - 00: No dithering - 01: Dither for RGBA4444 - 10: Dither for RGBA5551 - 11: Dither for RGB565 The translator appends code to the shader that, based on the format specified by the specialization constant, adds dithering to each color attachment output. A 2x2 Bayer matrix is used for dithering, indexed by gl_FragCoord.xy % 2. Bug: angleproject:6755 Change-Id: Ib45da5938e299b6626bff921119d63e7357dd353 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3374261 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 095d7c0a 2022-01-06T01:20:53 Translator: Clean up spec const / driver uniform types Bug: angleproject:6755 Change-Id: I8fb1557a5e29fcc28d5cb2f3aaa2c4a14b72583d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3369125 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 4114fe23 2021-11-20T22:05:56 Vulkan: Simplify transform feedback emulation logic In [1], the program is transformed to not output transform feedback logic when transform feedback is inactive. With that change, it's no longer necessary to dedicate a driver uniform to indicate if transform feedback is active. [1]: https://chromium-review.googlesource.com/c/angle/angle/+/3294661 Bug: chromium:1209285 Change-Id: Ica725d0da08e2676f442fe6307962d367b443535 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3294702 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Kenneth Russell da3db87e 2021-07-06T14:00:58 Upstream latest changes to Metal backend from Apple to 7/1/2021 This CL merges in the ANGLE changes between these two WebKit commits: https://git.webkit.org/?p=WebKit.git;a=commit;h=8648b353ab1d7730438c2e08319e1a4d64982c31 https://git.webkit.org/?p=WebKit.git;a=commit;h=166e4924a52971d6a32ad48247a439b16c00e062 Include provoking vertex buffer out of bounds fix from https://bugs.webkit.org/show_bug.cgi?id=230107 Fix bad merge of resetting of dirty bits, breaking DepthStencilFormatsTest.DepthTextureRender test and perhaps others. Disable GL_APPLE_clip_distance when the direct-to-Metal compiler is active. It can not yet handle the gl_ClipDistance array. Disable use of rectangular textures for IOSurfaces. Metal can bind IOSurfaces to 2D textures, and this was passing all tests in the SPIR-V Metal backend. Introducing rectangular textures breaks the SPIR-V Metal backend, and the tests currently fail on the direct-to-Metal backend. Fix several bugs with ProvokingVertex, which was causing both the SpirV and Direct backends to incorrectly draw indices. (https://bugs.webkit.org/show_bug.cgi?id=230107) Skip the following tests on the Metal backend which is still failing RobustResourceInitTestES3.BlitDepthStencilAfterClearBuffer GLSLTest_ES3.GLVertexIDIntegerTextureDrawArrays/ES3_Metal With these changes, angle_end2end_tests again runs to completion. Bug: angleproject:6395 Change-Id: I3cc58f531426a95fc8f177a4ad87f56c1855a546 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3167010 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Kyle Piddington <kpiddington@apple.com>
Shahbaz Youssefi 46149c0e 2021-09-17T15:38:47 Translator: Fix pruning functions that declare a struct When pruning unused functions, the entire declaration of the function is removed. If the function declares a struct as part of its return value, the declaration of that struct was lost. This change makes sure that declaration survives the pruning. For example: struct S { vec4 v; } unused_func() { ... } is now replaced with: struct S { vec4 v; }; This change also makes struct usage validation more stringent. Bug: chromium:1248753 Change-Id: Idd9a87fd2e785135775cfea62995fd33adaf3c09 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3169691 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 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 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>
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>
Kyle Piddington d33a2222 2021-04-26T16:56:15 Upstream Apple's direct-to-Metal backend: compile libANGLE. This change is meant to merge the metal backend changes from Apple's direct-to-Metal backend. Taken from Kyle Piddington's CL: https://chromium-review.googlesource.com/c/angle/angle/+/2857366/ The goal of this CL is to merge the metal backend code in a state that compiles, but not to switch the Metal backend over to using the direct-to-metal backend yet. Bug: angleproject:5505 Bug: angleproject:6127 Change-Id: If6783e06e0086b3a1dd25c6f53caca5cfc96cb86 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2950067 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
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 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 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 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>
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>
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>
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 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>
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>
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 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>