src/compiler/translator/spirv/TranslatorSPIRV.cpp


Log

Author Commit Date CI Message
Shahbaz Youssefi f128872e 2025-09-16T23:37:08 Translator: Compare variables by unique id instead of pointer Bug: angleproject:349994211 Change-Id: I32ab2ffe9a04e196330949484e704913d0f4e41d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6955119 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Yuxin Hu <yuxinhu@google.com>
Tom Sepez 25390156 2025-08-21T00:13:19 Suppress unsafe buffers on a file-by-file basis in src/ [1 of N] In this CL, we suppress many files but stop short of actually enabling the warning by not removing the line from the unsafe_buffers_paths.txt file. That will happen in a follow-on CL, along with resolving any stragglers missed here. This is mostly a manual change so as to familiarize myself with the kinds of issues faced by the Angle codebase when applying buffer safety warnings. -- Re-generate affected hashes. -- Clang-format applied to all changed files. -- Add a few missing .reserve() calls to vectors as noticed. -- Fix some mismatches between file names and header comments. -- Be more consistent with header comment format (blank lines and trailing //-only lines when a filename comment adjoins license boilerplate). Bug: b/436880895 Change-Id: I3bde5cc2059acbe8345057289214f1a26f1c34aa Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6869022 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Yuxin Hu 20dca0b9 2025-08-14T13:54:37 Add a new TInterfaceBlock class member to hint ANGLE default Uniform In later change, we will transform floats in ANGLE default uniform struct from 32-bit to 16-bit in SPIRV. The new class member mIsDefaultUniformBlock will help us identify this special struct. This change is no op. Bug: angleproject:405795981 Change-Id: I939caf7491ab5d7de130ba6a2fd8b1202958c375 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6852398 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Yuxin Hu <yuxinhu@google.com>
Matthew Denton 63d8f74c 2025-08-12T19:39:03 WGSL: move DeclareDefaultUniforms() out of SPIR-V WGSL needs the same thing (default uniforms gathered into an interface block). Changes 3 things in the file move: 1. Now capable of adding a named interface block (Vulkan's is nameless) to hold the default uniforms. 2. Removes inactive uniforms 3. Deals with the case where there are no active default uniforms, by not declaring an interface block at all. Bug: angleproject:376553328 Change-Id: Ia25318b4db93068010c3c44414cd00803b783799 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6843929 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Matthew Denton <mpdenton@chromium.org>
Shahbaz Youssefi bc2c85a6 2025-05-27T11:40:33 Translator: Set correct qualifiers on user-declared gl_PerVertex Bug: angleproject:409439499 Change-Id: Ia4bc1335d977f2b138af877e5d698914b182ff52 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6592612 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 671f55d8 2025-04-03T22:54:44 Vulkan: Fix texelFetch(externalSampler) behavior GLES expects YUV decoding to happen with texelFetch when an external sampler is used, but texelFetch's translation (OpImageFetch) does not do such a thing. A transformation is added to replace that with a texture call at the right coordinate. Bug: angleproject:405149439 Change-Id: I3a8d07a6399705ec07718b38085ee4bc1ad2af6c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6431570 Reviewed-by: Cody Northrop <cnorthrop@google.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com>
Shahbaz Youssefi f355e2b3 2025-04-15T18:58:25 Vulkan: Remove preferDriverUniformOverSpecConst This was practically true for every vendor on Android (where rotation matters). For Qualcomm, it was also true due to a bug in version checking and didn't seem to be causing any concerns. Where pre-rotation is supported, it is better to enable this feature to avoid excessive pipeline creation. This change removes the feature and makes sure ANGLE always uses uniforms for rotation instead of spec consts. While technically this may have an adverse effect on platforms that never need pre-rotation, the ability is retained for all vendors since pre-rotation is finding its way into more platforms and would likely eventually be needed everywhere anyway. Bug: angleproject:42265878 Bug: angleproject:42262166 Change-Id: I4b64c04da46db08cfdd44b60789b66d93d8e8b17 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6459025 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: mohan maiya <m.maiya@samsung.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Cody Northrop <cnorthrop@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Shahbaz Youssefi 02ae054c 2025-04-07T13:48:29 Translator: Fix init of inactive output variables Bug: chromium:398401939 Change-Id: I0df494b945b8d0e805a62cf7645d06bf233f36ca Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6438495 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Aurora Zhang 3972cfa1 2025-02-18T19:52:06 YUV should support on all the shader stages * The spec requires all shader stages should support YUV. Therefore, move YUV related functions out of the switch. * Add a new end2end test that sampling YUV in the vertex shader. Bug: angleproject:391919465 Change-Id: I7811d419d5f1461c2499c522a902c3b2149289a1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6263325 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Kimmo Kinnunen b8d546b2 2024-10-30T15:40:58 Fix immutable string concats with ints `BuildConcatenatedImmutableString("a", 10, "b")` would construct "a\nb" because the implementation lacked int overloads and ints would be promoted to chars implicitly. Fix by implementing simpler way to calculate digits for numbers and then add useful overloads. Remove ImmutableStringBuilder::appendDecimal() since the code is already expecting << for all other types, and the bug was due to this expectation. Bug: angleproject:376417347 Change-Id: Iea5e14a6e2fede068b704754b9203db794dd5bf0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5972641 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com>
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 a8138547 2024-10-09T23:33:24 Translator: Support GL_ARM_shader_framebuffer_fetch_depth_stencil Bug: angleproject:352364582 Change-Id: I46ce6d75a76bdf04a9e8feea1a480e8a0badba2a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5924140 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi ae5c3b96 2024-10-08T17:02:21 Boilerplate for GL_ARM_shader_framebuffer_fetch_depth_stencil Bug: angleproject:352364582 Change-Id: I94c670db5546564a6f60bb513a6d7f3f5bd5778c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5916771 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Mohan Maiya f2eb8781 2024-09-14T16:16:53 Vulkan: Selectively enable emulateR32fImageAtomicExchange Only emulate R32F imageAtomicExchange if shaderImageFloat32Atomics feature is not supported Bug: angleproject:42264071 Change-Id: I305ab88bf3ac918eff5d8c399f0ed02ec8c60c2d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5860814 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 7691cea7 2024-07-22T13:46:14 Vulkan: Remove seamful cubemap emulation Practically, the Vulkan backend is never expected to run on ES2 hardware. It _may_ for WebGL, but seamful cubemap emulation was disabled for webgl anyway. Bug: angleproject:354729454 Change-Id: Iafa20fbdbe232c4df4c777b12e7698ef7a87cf24 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5730143 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi c6fbf93d 2024-01-19T09:57:12 Vulkan: Fix input attachments leaking into uniform list To communicate the existence of input attachments added to the shader, the translator was adding `ShaderVariable`s for each to the list of uniforms exported from the shader. This was incorrect, as this list is visible to the application through `glGetActiveUniform`. Additionally, this was unnecessarily causing these uniforms to go through program link. Reserving SPIR-V ids for these uniforms, all that is needed from the translator is the mere existence of these input attachments. This change removes the addition of uniforms, and instead exports a bitset. Elsewhere, that bitset is consulted and reserved SPIR-V ids are used. Bug: b/320563594 Bug: angleproject:5792 Change-Id: Id93846cbc3996248f391fd2d5a65af1e48d6d46e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5215089 Reviewed-by: mohan maiya <m.maiya@samsung.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao acb0ae09 2023-10-27T13:38:09 Vulkan: Swizzle YUV output from GL component order to vulkan Since OpenGL and vulkan has different YUV component ordering, we need to swizzle the component form GL to vulkan when we write YUV data to output variable. The computation in shader will still carry out in OpenGL order. This CL swizzles component for the YUV output variable. Bug: b/223456677 Change-Id: Ie34bbc723bf3723ac65f7931aeab086c92610271 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4985622 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Chris Forbes <chrisforbes@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Chris Forbes 9e5f5188 2023-10-24T18:43:12 Reswizzle results of YUV sampling operations Change-Id: Id6eee9e0d9e2b80d48c80f27bc8e670a5621d263 Test: ImageTestES3.* 24 -> 15 failures Bug: b/223456677 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4970337 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 4a195ce0 2023-08-10T11:28:31 Vulkan: Fix SPIR-V id assignment to user-defined webgl_* names The code was incorrectly assuming that webgl_* names are only from ANGLE variables. An explicit check that the symbols are AngleInternal was missing. Bug: b/287166117 Change-Id: Ib8140cfabd74000492d12c11163f318a9ec3b98f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4770236 Commit-Queue: Solti Ho <solti@google.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Solti Ho <solti@google.com>
Mohan Maiya 05ea1147 2023-07-14T16:49:24 Vulkan: Bugfix in gl_FragData array redeclaration Both OpenGL ES and Vulkan spec allows implementations to limit the number of output attachments when dual-source blending is enabled. Account for this limit when setting gl_FragData array length by re-declaring the gl_FragData array size to match maxFragmentDualSrcAttachments value. Bug: angleproject:5537 Test: EXTBlendFuncExtendedDrawTest.FragData/ES2_Vulkan Change-Id: I5a462344f4c4faf850f56e9c5d4c392370d3d010 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4688396 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Shahbaz Youssefi 9b63700b 2023-07-11T10:25:40 Translator: Reorganize files This change makes the translator files more organized by: - Grouping files that are specific to a certain output under their own directory, - Moving transformations under tree_ops - Removing Direct from metal translation now that that SPIR-V Cross path is removed Bug: angleproject:6394 Change-Id: Iaf5bb8d5604b84748dece029821b1f77b2813967 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4678780 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>