src/compiler/translator/tree_ops/RemoveDynamicIndexing.cpp


Log

Author Commit Date CI Message
Shahbaz Youssefi d193d51b 2024-06-17T22:46:08 Replace issue ids post migration to new issue tracker This change replaces anglebug.com/NNNN links. Bug: None Change-Id: I8ac3aec8d2a8a844b3d7b99fc0a6b2be8da31761 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5637912 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Eddie Hatfield 91976352 2022-06-21T15:41:02 Use C++17 attributes instead of custom macros Bug: angleproject:6747 Change-Id: Iad6c7cd8a18d028e01da49b647c5d01af11e0522 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3718999 Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 0f00fbae 2022-01-21T00:28:48 Translator: Make vec/matrix size getters unsigned TType stored type's primary and secondary sizes as `unsigned char`, but the getters returned `int`. This caused unnecessary casts when the size was passed from one TType to another, as well as comparisons with other unsigned numbers. This change specifies the type of these members as `uint8_t` and makes the getters return the same type. The call sites are accordingly adjusted to remove unnecessary casts, use the correct type in local variables, and add casts when passed to ostream::operator<<. Bug: angleproject:6755 Change-Id: Ia4d86bd4ccb5c1a2ae1e10a0085a5166c3a6bcf7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3402850 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 55bd8d8f 2021-10-26T10:38:28 Translator: Fix precision bug in HLSL generation Bug: chromium:1263487 Change-Id: I60bc3dc93867e4269756b6f54eb39cf29ad77d5f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3244887 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 8b2fd983 2021-09-08T11:36:17 Translator: Fix validation failure in RemoveDynamicIndexing This transformation adds function definitions to the tree after the fact, so function call validation is disabled until the transformation is complete. Bug: chromium:1246686 Change-Id: I40f77cb25cf272d5ebc42ece572371ce5161e819 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3148850 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 a65b4056 2021-07-30T23:00:57 Reland "Translator: Clean up type cloning" This is a reland of f016c4352f5203c10511df078b1ed5359afc1b35 Original change's description: > Translator: Clean up type cloning > > TType has a constructor that aids cloning + helpers to convert between > types. A number of places where a type is constructed from the > information gathered from another type is changed to clone the type and > then use one of these helpers. > > This clean up is part of an ongoing work to improve precision handling. > This change removes many references to TType::getPrecision(). > > Bug: angleproject:4889 > Change-Id: Ib85659ab5363b56ad298f8648fca856edc1ebf8b > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3063944 > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Tim Van Patten <timvp@google.com> Bug: angleproject:4889 Change-Id: I35772f178eb4f6cf2b64bfeb37a4a144acdb4daf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3067802 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Austin Eng c5c8a25a 2021-08-03T14:40:33 Revert "Translator: Clean up type cloning" This reverts commit f016c4352f5203c10511df078b1ed5359afc1b35. Reason for revert: Suspect for crbug.com/1236060 Original change's description: > Translator: Clean up type cloning > > TType has a constructor that aids cloning + helpers to convert between > types. A number of places where a type is constructed from the > information gathered from another type is changed to clone the type and > then use one of these helpers. > > This clean up is part of an ongoing work to improve precision handling. > This change removes many references to TType::getPrecision(). > > Bug: angleproject:4889 > Change-Id: Ib85659ab5363b56ad298f8648fca856edc1ebf8b > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3063944 > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Tim Van Patten <timvp@google.com> Bug: angleproject:4889 Change-Id: I9b5ecacc410b41be382232292ceae2f7ea7906c7 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3064393 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Austin Eng <enga@chromium.org>
Shahbaz Youssefi f016c435 2021-07-30T23:00:57 Translator: Clean up type cloning TType has a constructor that aids cloning + helpers to convert between types. A number of places where a type is constructed from the information gathered from another type is changed to clone the type and then use one of these helpers. This clean up is part of an ongoing work to improve precision handling. This change removes many references to TType::getPrecision(). Bug: angleproject:4889 Change-Id: Ib85659ab5363b56ad298f8648fca856edc1ebf8b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3063944 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 0e1c90cf 2021-07-21T10:24:26 Translator: Validate function parameter qualifiers This change cleans up a confusion in EvqConst and EvqConstReadOnly, where the former was frequently used instead of the latter for function parameters. The change makes the following renames to make the intent of the relevant qualifiers clearer: EvqIn -> EvqParamIn EvqOut -> EvqParamOut EvqInOut -> EvqParamInOut EvqConstReadOnly -> EvqParamConst Bug: angleproject:4889 Change-Id: Idedd32c08a91de069b91b1657d6b783dddece04a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3041622 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi f0286e63 2021-01-19T12:38:46 Translator: Stop allocating TIntermSequence The functions that take a TIntermSequence always copy out / Swap the contents away. This change makes all TIntermSequences live on the stack instead of being newed. Bug: angleproject:5535 Change-Id: I942f1c5e57b00199d5308183f71bd9e18b0608bd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2636679 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
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>
Shahbaz Youssefi 472c74c6 2019-08-19T16:32:13 Translator: Allow tree validation in children of TCompiler This is to be able to perform validation inside TranslatorVulkan, even if it's through ASSERTs. Additionally, every transformation is changed such that they do their validation themselves. TIntermTraverser::updateTree() performs the validation, which indirectly validates many of three tree transformations. Some of the more ancient transformations that don't use this function directly call TCompiler::validateAST. Bug: angleproject:2733 Change-Id: Ie4af029d34e053c5ad1dc8c2c2568eecd625d344 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1761149 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@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>
Jamie Madill b980c563 2018-11-27T11:34:27 Reformat all cpp and h files. This applies git cl format --full to all ANGLE sources. Bug: angleproject:2986 Change-Id: Ib504e618c1589332a37e97696cdc3515d739308f Reviewed-on: https://chromium-review.googlesource.com/c/1351367 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@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 a07b4213 2018-03-22T16:13:13 Move AST transformations to a subdirectory Move AST transformations to compiler/translator/tree_ops. BUG=angleproject:2409 TEST=angle_unittests Change-Id: I9c620e98707d22d005da6192fe7d1b4e8030aadd Reviewed-on: https://chromium-review.googlesource.com/975550 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>