src/compiler/translator/tree_util/IntermNodePatternMatcher.h


Log

Author Commit Date CI Message
Shahbaz Youssefi f5ad056b 2023-07-10T22:13:34 GL: Fix ScalarizeVecAndMatConstructorArgs and move to gl/ This transformation was buggy and was disabled. Originally, it was intended to be used everywhere. It is now needed for a GL driver workaround. This change reimplements this transformation and uses it as a GL workaround. Bug: chromium:1420130 Change-Id: I42d63fa5844bcf683ac41e61925aa637e033ca2e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4676634 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi 6f80f0f0 2022-08-06T02:29:19 Translator: Clean up the compile flag passing interface Historically, compile flags were sent to the translator as a bitmask. Recently, we were getting close to running out of bits. Additionally, direct-to-metal work had started to introduce constants to be passed to the translator, which were misplaced in ShBuiltInResources and Caps. Recent work on Pixel Local Storage adds even more constants, aggravating the situation. In this change, the interface to passing compile flags is reworked. A struct is passed (instead of a bitmask) that has one bit for each flag. This can be indefinitely extended. Additionally, the constants needed by metal and PLS are also placed in this struct. In turn, the backends can set these options directly, and don't have to hack them into Caps to further get hacked into ShBuiltInResources. Bug: angleproject:7559 Change-Id: If93f1e1b8818ad3a0ac708ab04ab93b4b397d114 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3812562 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org>
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>
jchen10 b3070102 2019-10-18T16:01:34 Add SH_REMOVE_DYNAMIC_INDEXING_OF_SWIZZLED_VECTOR This is a workaround for the webgl2 conformance test case WebglConformance_conformance2_glsl3_vector_dynamic_indexing_swizzled_lvalue. Dynamic indexing of swizzled lvalue like "v.zyx[i] = 0.0" is problematic on various platforms. This removes the indexing by translating it this way: void dyn_index_write_vec3(inout vec3 base, in int index, in float value){ switch (index) { case (0): (base[0] = value); return ; case (1): (base[1] = value); return ; case (2): (base[2] = value); return ; default: break; } if ((index < 0)) { (base[0] = value); return ; } { (base[2] = value); } } ... dyn_index_write_vec3(v.zyx, i, 0.0); ... Bug: chromium:709351 Change-Id: I971b38eb404209b56e6764af1063878c078a7e88 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1869109 Commit-Queue: Jie A Chen <jie.a.chen@intel.com> 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>
Qin Jiajia a735ee2f 2018-05-18T13:29:09 ES31: Support shader storage block in D3D11 compiler - Part1 This patch is the first step to implement a basic skeleton to translate shader storage block to HLSL RWByteAddressBuffer. In GLSL each shader storage block is just one structured block and in API side it corresponds to a buffer range where stores the whole structure. RWStructuredBuffer is an array-like object and can have many structured elements. The structured element doesn't support unsized array and also have a small limitation on the element size. So we choose RWByteAddressBuffer as the counterpart of shader storage block in HLSL. Due to RWByteAddressBuffer does not support using an index to reference a specific location, we must use Load and Store to process the read/write operation of a buffer variable. Moreover, in the compiler tree, since we can't use variable name to get the resource value in RWByteAddressBuffer, we have to calculate the offset of buffer variable in a shader storage block, then call the corresponding wrapper function to get the right value. In this patch, we only process below situations: assign_to_ssbo := ssbo_access_chain = expr_no_ssbo; assign_from_ssbo := lvalue_no_ssbo = ssbo_access_chain; The translation is like below: // GLSL #version 310 es layout(local_size_x=8) in; layout(std140, binding = 0) buffer blockA { float f[8]; } instanceA; layout(std140, binding = 1) buffer blockB { float f[8]; }; void main() { float data = instanceA.f[gl_LocalInvocationIndex]; f[gl_LocalInvocationIndex] = data; } // HLSL RWByteAddressBuffer _instanceA: register(u0); RWByteAddressBuffer _blockB: register(u1); float float_Load(RWByteAddressBuffer buffer, uint loc) { float result = asfloat(buffer.Load(loc)); return result; } void float_Store(RWByteAddressBuffer buffer, uint loc, float value) { buffer.Store(loc, asuint(value)); } void gl_main() { float _data = float_Load(_instanceA, 0 + 16 * gl_LocalInvocationIndex); float_Store(_blockB, 0 + 16 * gl_LocalInvocationIndex, _data); } We will do below things in the following patches: 1. Modify the intermediate tree to flatten all ssbo usages to: assign_to_ssbo := ssbo_access_chain = expr_no_ssbo; assign_from_ssbo := lvalue_no_ssbo = ssbo_access_chain; e.g. intanceA.a +=1; ->tmp = intanceA.a; intanceA.a = tmp + 1; while(++instanceA.a < 16) { } -> int PreIncrement(out int a) { a += 1; return a; } tmp = instanceA.a; while(PreIncrement(tmp) < 16) { instanceA.a = tmp } 2. Add offset calculation for structure and array of arrays. TODOs have been marked in the corresponding places in this patch. 3. Improve helper functions so that they can process all possible types. TODOs have been marked in the corresponding places in this patch. 4. Process the swizzle situation. TODOs have been marked in the corresponding places in this patch. A possible method is to extend current helper functions like below: *_Load(RWByteAddressBuffer buffer, uint loc, bool isSwizzle, uint4 swizzleOffset) Bug: angleproject:1951 Test: angle_end2end_tests Change-Id: I68ae68d5bb77d0d5627c8272627a7f689b8dc38b Reviewed-on: https://chromium-review.googlesource.com/848215 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jiajia Qin <jiajia.qin@intel.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>