src/tests/compiler_tests/Parse_test.cpp


Log

Author Commit Date CI Message
Kimmo Kinnunen 8409b41e 2024-11-20T14:38:30 Report error on unsized interface block array GLSL of forms: uniform S{...} a[]; in R{...} b[]; out Q{...} c[]; Should produce error unless the shader is tesselation or geometry shader. Fix the errors for VS and FS. GS and TS likely need more work. Bug: angleproject:379996129 Change-Id: Ib31c9a81717a8cd1c984eb4ce2e993d563bb3c4f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6038333 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com>
Kimmo Kinnunen ec773865 2024-11-19T14:46:29 Qualifier in const for sampler2D fails validation The commit 039660a0757e8e5b661c1850747b688b6642f56d failed to special cased "const in". Fix by special casing also on EvqParamConst. Bug: angleproject:379762012 Change-Id: Ife6966ea536972874645ae22b504712249817638 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6035505 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 770242db 2024-11-20T17:03:07 Translator: Remove the `gimage1D` base type This is a desktop GL type, whose removal was left out of b16d105fc6. Bug: angleproject:370937467 Change-Id: I0bda5453b95ddf924ba0583de346902b333603a6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6037776 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 1f0ac74a 2024-11-20T16:43:50 Translator: Remove SubpassInputMS ANGLE never generates multisampled input attachments, because it cannot know if the shader will be used with a single-sampled or multisampled framebuffer. The SPIR-V transformer takes care of changing the type and ops to be multisampled if needed. Bug: angleproject:37093746 Change-Id: Ic9c3057536c0a5d543512dbd3c347033453a29f4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6039437 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com>
Kimmo Kinnunen 7ba69645 2024-11-14T10:07:31 Fix unnamed outs w/ initializeUninitializedLocals Fix translator initializeUninitializedLocals pass for anonymous out parameters. The parameters should be initialized to zero, similar to named but unassigned parameters. Initialization would be skipped on GLSL output, assert on Metal. Functions need to be replaced if their parameter names change. In case the function had a prototype declaration, that has to be replaced too. All calls to old functions must be replaced with calls to new function. Bug: angleproject:378584780 Change-Id: I9a990fa3840f6e26cd30f35bf6c99d9a8816f272 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6020245 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com>
Kimmo Kinnunen df61fc7f 2024-11-14T13:31:24 Avoid reordering structs when separating from func Avoid reordering structs when separating struct declarations and function declarations. Consider: struct S1 { ... }; struct S2 { S1 a; } f(); SeparateStructFromFunctionDeclarations would insert the S2 to the beginning of the containg block, so before S1 definition. Fix by not inserting the structs to the parent block. Instead, return the nodes from multi-replacement, so that the struct definition is inserted at the site of the replaced function. Bug: angleproject:378966971 Change-Id: I47582660610c1fcb28a9b5bd592ac020b5c48e34 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6022856 Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Kimmo Kinnunen b8b962d2 2024-11-08T14:53:00 Parse function parameters into TPublicType Parse function parameters into TPublicType instead of TType. TType holds the type info, TPublicType holds the type specification info. This helps in moving the TType::isStructSpecifier into the AST nodes, away from the type system which it is not part of. Removes duplicated code where unnamed unsized arrays would cause different error message than named unsized arrays. Bug: angleproject:377330017 Change-Id: I102b9e87823a545f7e64f971aafbdcd313a542fb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6000009 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com>
Kimmo Kinnunen 4a5b0284 2024-10-24T11:46:54 Disallow discarded uniform block references Uniform block instances cannot be used by themselves, as there is no way to refer to their type. Disallow the only typeless access pattern, discarding via expression statement: uniform MyBlock { int x; } b; void main() { b; 0, b; } Explained as disallowed in newer GLSL 300: https://github.com/KhronosGroup/WebGL/issues/3644 The comma expression form would ASSERT in CollectVariables. Bug: angleproject:42267026 Change-Id: I6c8b835482fd551bd97576c1bd24f005874da6af Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5961498 Reviewed-by: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com>
ericali 016ef60d 2024-06-24T17:41:30 ValidateAST asserts when refers to builtIn struct type name Refers to build in type name looks allowed by GL but currently VK and Metal backends do not support, i.e.: refers to gl_DepthRangeParameters, this change is to add temporary check to make using reserved type name an error during parsing. Bug: angleproject:348313398 Change-Id: I6522566b1f590fe2b24534fb065625c4ac3b06c6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5645265 Auto-Submit: Erica Li <lerica@apple.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com>
Scott Marcy 4ebb28d7 2024-05-30T11:36:58 Fix stack overflow crash by traversing a too-deep AST This simply moves the check for a too-deep AST before the first attempts to traverse the AST (i.e., `validateAST()`). Bug: angleproject:343505104 Change-Id: Iafb658a30f74a666beab8c69745ca53d17d70dd3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5585186 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com> Auto-Submit: Scott M <mscott@apple.com>
Scott Marcy b793888a 2024-05-09T11:40:18 Deeply nested switch statements -> ambiguous error Improve the error reported (and potentially avoid a stack overflow crash) when parsing deeply nested `switch` statements. Limits the total number of nested switch and/or iterator statements to `mMaxStatementDepth` (defaults to 256). Bug: angleproject:8645 Change-Id: Iba4795db15c3859d172df8366bc7de3125c2d472 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5527630 Auto-Submit: Scott M <mscott@apple.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com>
Scott Marcy 2ecfc5a1 2024-05-03T18:29:12 Issue 8644: Deeply nested iterator declarations can crash Avoid stack overflow crash when parsing nested iterators (especially `while` statements). Limits the number of nested iterator statements to `mMaxStatementDepth` (defaults to 256). Bug: angleproject:8644 Change-Id: I9b0fd2ab456c3cdd731b41ab97f495ae4dc0b0bb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5519169 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com> Auto-Submit: Scott M <mscott@apple.com>
Scott Marcy e088af30 2024-03-28T15:30:59 Parsing very long array declarations crash Avoid stack overflow crash when parsing arrays with a huge number of dimensions. Limits the number of array dimensions to `mMaxExpressionComplexity` (typically 256). Use `YYABORT` to abort parsing. Bug: angleproject:8610 Change-Id: Icf3914871b167c820b84ae8f3acba80dbd698af3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5424330 Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Nisha Jain ab6dd5b2 2024-03-07T14:19:58 Avoid asserts when const folding binary ops on void variables Fix asserts for example with / and % during constant folding when the operands might be voids. Bug: angleproject:8592 Change-Id: I22275642dbcdf9066940d3a94114e8daa5cbbe41 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5416376 Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com>
Kimmo Kinnunen 18fa02be 2024-03-12T10:23:55 Rewrite exprs using separated decl variables Rewrite expressions that use the rewritten struct declaration variables. Declaration that specfies a struct and defines multiple variables will get its variable declarations separated. The type of the variable changes when a struct specifier is removed for the second and rest of the variable declarations. The type of the variable changes also when a anonymous struct is named. The expressions that used the separated variables used the old struct as their types. Fix by using TIntermRebuild. Upon creating a new symbol node referencing the new type, the rebuilder will instantiate also all the needed intermediate nodes, which then get the correct struct type. For consistency, fix the case of anonymous struct -> named struct transform naming the variables similar to named struct separation. Consider base case: struct S { .. } a, b; -> struct S { .. } a; S b; Compare against case: struct { .. } a, b; Before, inconsistency: struct s1 { .. }; s1 a; s1 b; After, fixed: struct s1 { .. } a; s1 b; Bug: angleproject:8590 Change-Id: Iffb0ef4441d6021e076b04485b808b26a7fa4dcb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5365201 Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Kimmo Kinnunen 11a2d27f 2024-03-08T14:26:56 Check array index against unsigned array size Fix an assert during GLSL parsing when a very large array (~1U) type is indexed. Bug: angleproject:8596 Change-Id: I219ac5c8f3fa58aa4c7d679eade6f32b59eb1103 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5352653 Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com>
Erica Li 0f110098 2024-03-08T12:40:09 Avoid assert with multiple memory qualifiers Add missing qualifier strings. Bug: angleproject:8593 Change-Id: I484571c33effd85d52712b4876f6a3a5c73d8fde Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5352255 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Kimmo Kinnunen 39f29f65 2024-03-05T21:42:32 Ensure unary math op parse to an node on error Return the error node for ops like radians(). The math op parse can fail in multiple ways. Fixed: angleproject:8583 Change-Id: Ief7e150dffefe711f567d95c62d1023fc7fa1c91 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5344716 Reviewed-by: Kenneth Russell <kbr@chromium.org> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Kenneth Russell <kbr@chromium.org>
Kimmo Kinnunen 871a309c 2024-03-04T14:43:10 Fix layout(index=) parse assert on es 100 shaders Remove invalid assert about layout index qualifier being present only if EXT_blend_func_extended is present. The layout qualifier gets parsed to support EXT_shader_framebuffer_fetch in ES 100 shaders to support "layout(incoherent) mediump vec4 gl_FragData[gl_MaxDrawBuffers]" Fixed: angleproject:8570 Change-Id: I0d0d99bcc882a0befd97c2510dec4a8ccf1690bd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5340249 Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Kenneth Russell <kbr@chromium.org> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com>
Kimmo Kinnunen 9d453e57 2024-02-16T22:28:18 Fix ASSERT in non-global precise var decls Precise was treated as invariant. Precise can be declared for non-global variables. Bug: angleproject:8550 Change-Id: Ia0d00d67d0d1504b78294ee2256785fe3da3e399 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5300976 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Kimmo Kinnunen 9d344b5c 2024-02-13T17:54:12 Uniform block reference in constuctors crash Passing uniform block instance name to a built-in constructor would cause type confusion. Block this by failing to parse. Bug: angleproject:8533 Change-Id: I5a676b41e2f3d766ece4ed472debc1c874753293 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5290897 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com>
Kimmo Kinnunen ab71d751 2024-02-07T14:25:32 Fix an assert on multidim array constructors Fail early instead of asserting when trying to parse a multidimensional array constructor call with unsized argument array argument. int A[]; int B[int[][](A)]; Bug: angleproject:8519 Change-Id: Iee2c70318eebd2def57ffab8db709d1076692922 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5272434 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>