src/compiler/translator/tree_util/IntermNode_util.h


Log

Author Commit Date CI Message
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>
Kimmo Kinnunen 11724133 2024-08-06T12:02:54 Metal: Separate vars with normal types Separate compound expressions separates expressions as temporary values. Previously creating a temporary variable would copy the entire type. Qualifiers and interface block info but shouldn't ever be applied to temporary variables. This would lead to assertions during MSL output. Fix by copying the type and unsetting qualifiers and interface block info. Bug: angleproject:357622691 Change-Id: Id868cd3eaabe3710121d6c9a565304e282ddb69f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5762605 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com>
Kimmo Kinnunen 197beb4d 2024-02-13T15:47:32 Metal: Crash if for loop body is optimized away Loops might have their bodies optimized away. For case like `for(;;) if(false);` the constant pruning happens at parse phase. The else branch (e.e. no else branch, nullptr) would be selected as the body. Some code treated the body as optional, some code treated it as required. Define it as required, and remove all conditional code related to the loop body. Bug: angleproject:8532 Change-Id: Ic35f1bf78e63ceb2cee7b96ba99e788efc282e6f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5291554 Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Chris Dalton 4a636cdd 2022-07-20T22:44:30 Require all PLS formats to consume exactly 4 bytes of storage D3D 11.0 UAVs only support R32_FLOAT, R32_UINT, R32_SINT formats. EXT_shader_pixel_local_storage explicitly states that all PLS variables consume exactly 4 bytes. ESSL images can only have both read and write access if their format is r32f, r32i, r32ui. (We were able to circumvent this via aliasing, but it was a huge source of bugs.) There is a large precedent for only supporting 4 bytes of storage in the capabilities we use for PLS, so this CL removes support for all PLS storage formats that are not 4 bytes. It also implements an "R32" mode for PLS, that does manual packing and unpacking of r32* image formats. If the application wants larger formats, it can always define multiple PLS planes and piece them together. Next up we ought to be able to support rg16* types with more packing/unpacking. With aliasing gone, and with a bit of tweaking, the PLS tests now pass on the Pixel 4 GLES bot. Bug: angleproject:7279 Bug: angleproject:7388 Bug: angleproject:7524 Bug: angleproject:7527 Change-Id: I6b8f62c2428ade6cb5413e33360d734e55dda0eb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3782579 Reviewed-by: Stephen White <senorblanco@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app>
Chris Dalton 861149c7 2022-08-03T15:43:29 Make PLS coherent on desktop OpenGL Implements ANGLE_shader_pixel_local_storage_coherent using fragment shader synchronization extensions: NV_fragment_shader_interlock INTEL_fragment_shader_ordering ARB_fragment_shader_interlock With these extensions combined, we get coherency all 3 big desktop vendors: NVIDIA, Intel, and AMD. Bug: angleproject:7279 Change-Id: Ie20b251fb772898e89994b799640f1f2806581eb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3773990 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@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 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 40afbe4b 2022-03-20T23:39:57 Translator: Fix SimplifyLoopConditions producing dead code This causes the tree to fail validation. Dead code could be generated if the loop body ended in a branch. In such a case, no additional instructions are added to the transformed loop body after the original body. Bug: chromium:1300782 Change-Id: I4ec46c170ab5a45fa9b9b73d4e2b62c9c4fa24a3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3539442 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 800e82c6 2021-08-23T11:05:23 Translator: Validate precisions When declaring a variable, a struct field, function parameter etc, there's a precision necessarily applied to the entity being declared. AST Validation is added to enforce this. Intermediate nodes derive their precision from these entities automatically. Consistency of intermediate nodes is not validated. This is because AST transformations replace a node with a transformed one, and that may not have the same precision. Take the following code: mediump float x = ...; mediump float y = ...; ... x + y ... and assume is transformed as such: highp float driver_uniform; ... (x * driver_uniform) + y ... The addition was originally done in mediump, but would seemingly need to be done in highp after transformation. There are a number of options here: - Make sure that when nodes are replaced, the precision is unaffected. This can be intrusive, requiring temp variables. - Bubble up the new precision - Accept the discrepancy ANGLE opts for the last option, which actually respects the original shader's intended precision for operations, even if some transformation needs to temporarily evaluate an expression at a higher precision. Bug: angleproject:4889 Bug: angleproject:6132 Change-Id: Ibcde3a230de159157783b1c6d5ef1cd63ceb4d8f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3114027 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 8b869a95 2021-06-13T01:09:27 Translator: Generate Ops for all built-in functions EOpCallBuiltInFunction is removed in this change, as well as the "op": "auto" property in builtin_function_declarations.txt. Instead, gen_builtin_symbols.py automatically generates Ops for every built-in function and generates the TOperator enum accordingly. This simplifies SPIR-V code generation by allowing switches to be used on operators instead of string comparisons. Bug: angleproject:4589 Bug: angleproject:4889 Change-Id: Ia351524400b0e12a10a5572e27e9b88c6ec2e61c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2958869 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Tim Van Patten <timvp@google.com>
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 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>
Le Hoang Quyen dadd1986 2020-04-21T01:50:00 Implement GL_APPLE_clip_distance - Built-in variable gl_ClipDistance has been added to compiler. - Desktop GL: gl_ClipDistance is supported since GL 3.0. Enable/Disable each gl_ClipDistances[i] works out of the box via glEnable(). - Vulkan/Metal: Use uniform variable to control writing to each gl_ClipDistance. One bit flag controls one element in the gl_ClipDistance array. The writing to the disabled element in vertex shader will be ignored, and turned into zero assignment instead. - Direct3D/Mobile GL: Not implemented yet. - Added ClipDistanceTest to gl_tests and compiler unittests. - GL_APPLE_clip_distance is a subset of GL_EXT_clip_cull_distance, so GL_EXT_clip_cull_distance could be implemented in future if needed. Bug: angleproject:4452 Change-Id: I571ac8b56826989808a680226a04bec4cf59988e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2084324 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 3f647b1b 2019-11-09T16:24:50 Vulkan: Improve Bresenham line emulation. Clamps the vertex position to the subpixel grid before interpolation. This will give more correct results on systems that have less than 8 bits of subpixel accuracy. Also uses a more accurate formulation for the emulation filter in the fragment shader using dfdx and dfdy. Fixes line raster CTS tests on SwiftShader. Still does not produce spec conformant lines. Updates the public docs to indicate this. Bug: angleproject:2830 Change-Id: Ib9a268df3e7d986bd2b1348be664389fe8fc0ef2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1826598 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Clemen Deng d7d42540 2019-08-21T15:22:49 Don't build symbol table for GLSL built-ins if on Android The GLSL + ESSL autogenerated symbol table is too large for android, and android also doesn't need desktop GL functionality If on android, compile the ESSL only symbol table Bug: chromium:996286 Change-Id: I14dfc7748dae389e78c35f82a390c67962665356 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1757372 Commit-Queue: Clemen Deng <clemendeng@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Stuart Morgan 9d737966 2019-08-14T12:25:12 Standardize copyright notices to project style For all "ANGLE Project" copyrights, standardize to the format specified by the style guide. Changes: - "Copyright (c)" and "Copyright(c)" changed to just "Copyright". - Removed the second half of date ranges ("Y1Y1-Y2Y2"->"Y1Y1"). - Fixed a small number of files that had no copyright date using the initial commit year from the version control history. - Fixed one instance of copyright being "The ANGLE Project" rather than "The ANGLE Project Authors" These changes are applied both to the copyright of source file, and where applicable to copyright statements that are generated by templates. BUG=angleproject:3811 Change-Id: I973dd65e4ef9deeba232d5be74c768256a0eb2e5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1754397 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 0296e169 2019-08-02T14:38:45 Vulkan: Refactor atomic counter retype code A generic "retyper" class is extracted out of the atomic counter retype code to be used with coverting samplerCube to sampler2DArray for seamful cubemap sampling emulation. Bug: angleproject:3732 Change-Id: I8b5f835125b9513afcfe7baeea48afaf1299a027 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1733807 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi c13ca2af 2019-07-17T15:46:29 Vulkan: Allow more than one atomic counter buffer binding dEQP assumes there are more than one atomic counter buffers available. This is technically not a requirement by the standard, but nevertheless could be what applications expect as well. This change adds support for multiple atomic counter buffer bindings. This is done by declaring an array of storage buffers for the atomic counter buffers (instead of declaring only one) and passing the (binding, offset) pair around to functions instead of just the offset. The atomic counter is found by indexing `binding` into the storage buffer array first before indexing `offset` into its `uint[]`. ProgramVk's default uniform collection is also fixed not to include atomic counter uniforms. A remaining issue is that atomic counter buffer offsets don't have alignment requirements in GLES, but Vulkan does for storage buffers. Similar to emulated transform feedback buffer offsets, these should be sent to the shader through uniform values. This will be done in a follow up change. Bug: angleproject:3566 Change-Id: I5600225c24c38f1a8ecf5c64388073055733197d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1707931 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi b82d8633 2019-07-15T11:23:08 Vulkan: Atomic counter buffer support Vulkan doesn't treat atomic counters especially, and they are emulated with atomic access to storage buffers. A single atomic counter buffer binding per pipeline is supported. All the atomic counters identify an offset within this buffer. The shader is modified to include a storage buffer definition with `uint counters[];` as the only field. A compiler pass replaces atomic counter definitions with variables that hold the corresponding offset parameter, as well as changing atomic_uint types to just uint (as the offset). Where an atomic counter variable is used, it is replaced with the offset variable (plus the array index, if array). At the same time, built-in `atomicCounter*` functions are replaced with a corresponding `atomic*` function and `memoryBarrierAtomicCounter` is replaced with `memoryBarrierBuffer`. Bug: angleproject:3566 Change-Id: Iefb3d47de6a5cb3072bfa0cb94a46ac6a886d369 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1704635 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Olli Etuaho c26214de 2018-03-16T10:43:11 Move AST utilities to a subdirectory Move AST related utilities to compiler/translator/tree_util. BUG=angleproject:2409 TEST=angle_unittests Change-Id: I7567c2f6f2710292029263257c7ac26e2a144ac8 Reviewed-on: https://chromium-review.googlesource.com/966032 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>