src/compiler/translator/ParseContext.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>
Amirali Abdolrashidi ebb56cee 2024-05-31T15:10:37 Implement OES_tessellation_shader Based on the specs, there are no functional differences between OES and EXT. * Added validation for glPatchParameteriOES() and the core glPatchParameteri(). * Added the extension support for GLSL. * EXT_shader_io_blocks is implicitly enabled for the EXT geometry and tessellation shader extensions. * OES_shader_io_blocks is implicitly enabled for the OES versions of said extensions. * Added a test to make sure using this extension works instead of EXT. * Turned the repeated test code into a function: * testTessellationTextureBufferAccess * Skipped the tests that fail on various platforms. * It seems that these tests were being skipped before enabling this extension ("Not supported"). Bug: b/344030760 Bug: angleproject:345306326 Bug: angleproject:345304850 Bug: angleproject:345312771 Change-Id: I905da0132bf6525cb453dcaa613e4deb3155c4dd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5595611 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Amirali Abdolrashidi 25374c90 2024-05-31T16:08:58 Implement OES_gpu_shader5 Based on the specs, there is no difference between the OES version and the EXT version. * Added support for use in shaders * Added test to make sure the OES extension works. * Turned the repeated test code into a function: * testArrayOfArrayOfSamplerDynamicIndex() Bug: b/344031022 Change-Id: Ifda4fa5495983d254f598940a95d0797e8a9ce67 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5595609 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
Shahbaz Youssefi c33c6cd3 2024-05-27T00:06:18 Vulkan: Use OpSelect with all types with SPIR-V 1.4 SPIR-V 1.4 relaxes the types that can be used as arguments of OpSelect. Previously, the types were limited to scalars and vectors, but since SPIR-V 1.4, it's unrestricted. Writing tests for this change, another bug was discovered where support for structs and arrays with the ternary operator was disabled due to ESSL 1.0, even though that support is mandatory in ESSL 3.2. Bug: angleproject:342316794 Bug: angleproject:343218491 Bug: angleproject:3830 Change-Id: I6cff2f8178634369f773c4fb16a1ddde96928c8d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5570154 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.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>
Shahbaz Youssefi a0fa06f6 2024-03-25T14:46:56 Translator: Disallow samplers in structs in interface blocks As disallowed by the spec: > Types and declarators are the same as for other uniform variable > declarations outside blocks, with these exceptions: > > * opaque types are not allowed Bug: chromium:328859176 Change-Id: Ib94977860102329e520e635c3757827c93ca2163 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5391986 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 96f44329 2024-03-25T14:16:10 Revert "Remove few redundant ImmutableString to std::string conversions" This reverts commit ebb94b807f184f2d36cb0843c429667cd80e0675. Reason for revert: Needs a different implementation of std::string::size() to pass C++17 compilers. Original change's description: > Remove few redundant ImmutableString to std::string conversions > > Maybe removes few strlen calls. > > Bug: angleproject:8614 > Change-Id: I4fbb5f6abb8e8d21ff44a34975bab379127a0a11 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5372715 > Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> > Commit-Queue: Geoff Lang <geofflang@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Geoff Lang <geofflang@chromium.org> Bug: angleproject:8614 Change-Id: I1a635b74674a2e1b635972bb4372c43340527a2f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5391900 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Kimmo Kinnunen ebb94b80 2024-03-16T09:11:51 Remove few redundant ImmutableString to std::string conversions Maybe removes few strlen calls. Bug: angleproject:8614 Change-Id: I4fbb5f6abb8e8d21ff44a34975bab379127a0a11 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5372715 Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@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>
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 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>
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>
Alexey Knyazev 6d9f0aee 2023-11-30T00:00:00 Metal: Ensure helper invocations when derivatives are used Set sample coverage mask to ensure that fragment shader helper invocations are performed when derivatives are used. Fixed the following tests on Apple silicon: dEQP-GLES2.functional.texture.mipmap .2d.projected.nearest_linear_repeat .2d.projected.linear_linear_repeat .cube.projected.linear_nearest .cube.projected.linear_linear dEQP-GLES3.functional.texture.mipmap .2d.projected.nearest_nearest_mirror .2d.projected.linear_nearest_clamp .2d.projected.linear_nearest_repeat .2d.projected.linear_nearest_mirror .2d.projected.nearest_linear_repeat .2d.projected.linear_linear_clamp .2d.projected.linear_linear_repeat .3d.projected.nearest_nearest_mirror .3d.projected.linear_nearest_clamp .3d.projected.linear_nearest_repeat .3d.projected.nearest_linear_clamp .3d.projected.nearest_linear_mirror .3d.projected.linear_linear_clamp .3d.projected.linear_linear_repeat Fixed: angleproject:8443 Fixed: angleproject:7023 Change-Id: I13fc52532b94de098dcf3e9f5f02d48a6c8913c7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5089131 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Shahbaz Youssefi caa5e4ea 2023-11-30T14:12:42 Translator: Fail compilation if too many struct fields If there are too many struct fields, SPIR-V cannot be produced (as it has a hard limit of 16383 fields). The Nvidia GL driver has also been observed to fail when there are too many fields. Bug: chromium:1505009 Change-Id: If9b01716c1cab35a6e537da64421e29fe0eda91e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5074629 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Roman Lavrov <romanl@google.com>
Shahbaz Youssefi 6df603ed 2023-11-30T13:53:00 Translator: Optimize field-name-collision check As each field of the struct was encountered, its name was linearly checked against previously added fields. That's O(n^2). The name collision check is now moved to when the struct is completely defined, and is done with an unordered_map. Bug: chromium:1505009 Change-Id: If28d738254a541450912eba4ed168424dad9d8be Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5077407 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Roman Lavrov <romanl@google.com>
Alexey Knyazev 9666d4d5 2023-09-01T00:00:00 Disallow dynamic indexing of SecondaryFragData in WebGL 2.0 WebGL 2.0 disallows dynamic indexing of gl_FragData in ESSL 1.00 shaders. By extension, this rule should also apply to gl_SecondaryFragDataEXT. Bug: angleproject:1085 Change-Id: I5859356f72d25c4ffd1db92466dffc6eeacb6a64 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4843628 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi e394cb46 2023-06-10T23:12:35 Vulkan: Refactor framebuffer fetch shader emulation This change fixes simultaneous usage of EXT_shader_framebuffer_fetch and ARM_shader_framebuffer_fetch, which previously declared two identical input attachment variables. The code is additionally greatly simplified. Bug: angleproject:8196 Bug: angleproject:8197 Bug: angleproject:8198 Change-Id: Iaaa2a5539a95727e67001a4da1d45092c9db4f2c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4615187 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: mohan maiya <m.maiya@samsung.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Alexey Knyazev 2780cb0b 2023-06-05T00:00:00 Disallow 'depth_unchanged' qualifier for WebGL contexts This qualifier has no equivalents in HLSL or MSL. Bug: angleproject:8046 Change-Id: I1e79c8d725306efb859152b8083d72019c982149 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4595017 Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Brandon Schade 80e60bbc 2023-05-09T12:46:18 Validate non-precision qualifiers in GLSL shaders Add validation to reject non-precision qualifiers on struct members in GLSL shaders, as per the GLSL ES 3.2 specification, section 4.1.8: Structures Tests: KHR-GLES3*.shaders.negative.non_precision_qualifiers_in_struct_members Bug: angleproject:8045 Change-Id: I863ae631b09ff773a826d542f387072491489699 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4534656 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Brandon Schade <b.schade@samsung.com>
Chris Dalton 7aadc962 2023-05-05T19:28:17 Ban transform feedback and blend extensions with PLS Transform feedback can lead to render pass breaks in the Vulkan backend. EXT_blend_func_extended may restrict the number of draw buffers depending on API state, which can invalidate a PLS implementation. KHR_blend_equation_advanced does not allow multiple draw buffers, which is required by some PLS implementations. Bug: angleproject:7279 Change-Id: Id89f0e485ee65f55d802b121018f13b0028d8029 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4510716 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Kenneth Russell <kbr@chromium.org>
Alexey Knyazev 1ee27fcd 2023-03-24T00:00:00 Fix translation of noperspective interpolation qualifier Auxiliary storage qualifiers used with 'noperspective' interpolation must be retained during ESSL translation * Added new qualifiers: * EvqNoPerspectiveCentroid * EvqNoPerspectiveCentroidIn * EvqNoPerspectiveCentroidOut * EvqNoPerspectiveSample * EvqNoPerspectiveSampleIn * EvqNoPerspectiveSampleOut * Adjusted GLSL and SPIR-V output * Adjusted 'sample' rank to be the same as 'centroid' Fixed: angleproject:4388 Change-Id: Iffc80a7a3b057beffd3bcbbc9446eeed77183c99 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4368471 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Alexey Knyazev ad52f12e 2023-03-21T00:00:00 Implement EXT_conservative_depth Added translator frontend and GLSL backend support for gl_FragDepth redeclaration and layout qualifiers. Added mappings to DepthGreater, DepthLess, and DepthUnchanged SPIR-V execution modes. Bug: angleproject:8046 Change-Id: I23f19ff54380741107970a44055ea269eef179f6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4355028 Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Sean Risser b96d1955 2023-01-20T16:06:34 Implement GL_ARM_shader_framebuffer_fetch GL_ARM_shader_framebuffer_fetch allows fragment shaders to read gl_LastFragColorARM. The extension is similar to GL_EXT_shader_framebuffer_fetch, but is more limited in its capabilities. GL_ARM_shader_framebuffer_fetch was removed from HasFramebufferFetch() because it acts differently from GL_EXT_shader_framebuffer_fetch in significant enough ways that it should not be included in that single-use function. Tests: FramebufferFetchES31.*_ARM Bug: b/242419750 Bug: angleproject:7882 Change-Id: Id3a25c8ee50ca3e2a4c30a2261f507b0b53511ec Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4083108 Commit-Queue: Sean Risser <srisser@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Alexey Knyazev d0c936cf 2022-12-23T00:00:00 Check clip and cull distance storage qualifiers When redeclared, these built-ins must be outputs in vertex shaders and inputs in fragment shaders. Bug: angleproject:4452 Change-Id: I811764009669ec358f05eb7a26297742baf2de63 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4120264 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Alexey Knyazev 0103213e 2022-12-05T00:00:00 GL: Support clip and cull distance redeclarations * Fixed gl_PerVertex qualifier string. * Updated ValidateClipCullDistanceTraverser to output redeclared array sizes and maximum constant indices. * Made DeclarePerVertexBlocks available for non-Vulkan outputs. * Updated DeclarePerVertexBlocks to remove gl_ClipDistance and gl_CullDistance redeclarations. * Enabled DeclarePerVertexBlocks for ESSL output when gl_ClipDistance or gl_CullDistance are redeclared. * Updated ESSL output to use 3.10 shading language version, when the context has GL_EXT_clip_cull_distance enabled. * Updated ESSL output to enable GL_EXT_shader_io_blocks when gl_ClipDistance or gl_CullDistance are redeclared. * Updated extension exposure conditions. * Fixed typos in ParseContext. Bug: angleproject:7763 Change-Id: Ib87368a1953ad546a407d634d8b00f71cf92c40c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4083705 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi fa37af38 2022-07-12T22:47:22 Translator: Support SSO's built-in redeclaration EXT_separate_shader_objects requires that gl_Position and gl_PointSize be redeclared in the vertex shader. This is not adopted by GLES3.2, but is nevertheless required to be supported if the shader enables this extension explicitly. Bug: angleproject:6590 Change-Id: I3428851ff9f00fb63573e4322bb62fe04bf0a095 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3757918 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
George Burgess IV 54d094fe 2022-05-23T13:05:46 angle: fix potential nullptr dereference `checkIsScalarBool` immediately deref's `typedCond`, which may be NULL. Prevent that. Caught by the static analyzer: > device/generic/vulkan-cereal/third-party/angle/src/compiler/translator/ParseContext.cpp:893:9: warning: Called C++ object pointer is null [clang-analyzer-core.CallAndMessage] Bug: b/206470603 Test: None Change-Id: I2c055d637fb3ef254c0cebfae32bfbe17bf850ea Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3935460 Auto-Submit: Greg Schlomoff <gregschlom@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Chris Dalton b5514bb2 2022-09-21T20:47:00 Support pixel local storage on ES 3.0 Now that the application-facing API is implemented, we don't have to rely on ES 3.1 anymore. Expose and test the extension on ES 3.0. Bug: angleproject:7279 Change-Id: I5635620b9088201c20bafd283813092a329225d6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3915327 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Chris Dalton <chris@rive.app> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app>
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>
Shahbaz Youssefi 493b5aff 2022-08-09T14:57:24 Vulkan: Workaround ARM bug with stencil write mask Bug: angleproject:7556 Change-Id: I0aa17c178071cc15d8ee15f700b0c4932819c72a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3821367 Reviewed-by: Ian Elliott <ianelliott@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
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>
Chris Dalton c460c299 2022-06-21T11:20:45 Implement GLSL additions for ANGLE_shader_pixel_local_storage Specs out, implements, and thoroughly tests the GLSL additions for ANGLE_shader_pixel_local_storage. Adds a simple transformation that rewrites PLS directly into shader images. Updates the existing PLS tests to use the newly built-in PLS features and ensures they continue passing. For now, applications call glBindImageTexture to configure their pixel local storage. The OpenGL ES API side of this extension will follow shortly. Bug: angleproject:7279 Change-Id: I141183069b5cbfcca01cbb77b5b36d3e5f834bf5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3761876 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Shahbaz Youssefi 87ea0c7d 2022-05-17T22:33:57 Vulkan: SPIR-V Gen: Apply Flat to gl_Layer in FS Not directly specified by the spec on gl_Layer itself, but required according to this more generic statement: > Fragment shader inputs that are, or contain, integral types must be > qualified with the interpolation qualifier flat. Bug: angleproject:7332 Change-Id: Ieaa389e9b1318d3f13147cba7949cff6491c4b61 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3652746 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Brandon Schade <b.schade@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 5113ae8e 2022-04-29T22:42:59 Vulkan: Explicitly enable per-sample shading if `sample` used The Vulkan spec is not explicit about the `Sample` decoration implicitly enabling per-sample shading. While this is being corrected in the spec, the ARM Vulkan driver does not have this implicit behavior. A workaround is added such that the usage of the `sample` qualifier is reported, and used to explicitly enable per-sample shading through the API. Bug: angleproject:6876 Change-Id: Idb8345aacdcfa45cb37fefcd30aa5405168d21e3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3615738 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Lubosz Sarnecki 039660a0 2022-04-14T13:32:33 Translator: Drop const from opaque parameter types `const` is ineffective on opaque types like sampler2D. That qualifier is now dropped as it was tripping SPIR-V gen up. New validation is added to make sure such parameters are not reintroduced. Test credit of Lubosz Sarnecki <lubosz.sarnecki@collabora.com> Test: angle_end2end_tests --gtest_filter="GLSLTest.ConstSamplerParameter*/*_Vulkan" Bug: angleproject:7201 Bug: angleproject:7205 Change-Id: I310a47a8eb162ddafb2ab44682520f546f8a5512 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3587345 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Cody Northrop e10803f7 2022-01-20T09:03:55 Compiler: Allow deferred array sizing in geometry shaders Based on work by Brandon Schade <b.schade@samsung.com>. When a shader sets an array input size in a GS after declaring input variables, compilation would fail. Example shader - in vec3 normal[]; in vec3 view_dir[]; in float patch_dist[]; in float e_patch_wire_scale[]; ... layout(triangles) in; layout(triangle_strip, max_vertices=3) out; void main() { ... Update translator to handle such cases. Also add a new check that there are no remaining unsized arrays when compilation has completed. Test: GeometryShaderTest.DeferredSetOfArrayInputSize Bug: angleproject:3571 Bug: angleproject:7125 Change-Id: I4853832c27f9551284bcca92b98cbf5f3a63aaf5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3564259 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Cody Northrop <cnorthrop@google.com>
Shahbaz Youssefi 1e773db9 2022-02-22T10:51:15 Vulkan: Shader support for KHR_blend_equation_advanced Translator can accept the layout qualifiers for the advanced blend equation. No emulation code is currently generated, and ANGLE will initially rely on the corresponding Vulkan extension. Based on change by Brandon Schade <b.schade@samsung.com> Bug: angleproject:3586 Test: angle_unittests --gtest_filter=*KHRBlendEquationAdvanced* Change-Id: I3b728c5f144386d7030bbbb301ddb07daa1492b9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3481309 Reviewed-by: Brandon Schade <b.schade@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Brandon Schade 06edae72 2022-01-11T11:13:20 Vulkan: Allow duplicated block name in different shader interface In OpenGL ES 3.2 Shading Language specification(4.3.9), A block name is allowed to have different definitions in different shader interfaces within the same shader. Bug: angleproject:5557 Test: KHR-GLES32.core.tessellation_shader.single.max_patch_vertices Change-Id: I49f149cfd8f6f063fc5045aa154cc401d3e38cfb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3429684 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Brandon Schade <b.schade@samsung.com>
Shahbaz Youssefi 72529c19 2022-01-31T14:37:42 Vulkan: Fix a few framebuffer fetch bugs A few fixes to framebuffer fetch: - The built-in symbol for coherent and non-coherent are now the same for gl_LastFragData, so extension check can choose one or the other. - The temporary variable used in a transformation is renamed to not be gl_LastFragData. - inout usage is now validated correctly for shader type and version. Bug: angleproject:6951 Bug: angleproject:6905 Bug: angleproject:6907 Change-Id: I9af341a3e8e01ed375a8230618184494813d3ece Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3427577 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Brandon Schade 91b383e8 2022-01-27T10:22:17 Translator: Emit warning when identifier has double underscores OpenGL ES Shader Language 3.2 specification states that two consecutive underscores (__) are reserved. It doesn't result in an error if used but could result in unintended behavior. Update the translator accordingly. Bug: angleproject:6577 Tests: ShaderVariableTest.DoubleUnderscores* Change-Id: Ice7e0eca4f770400061f4b8f7f65106cb1926f1a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3421411 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Brandon Schade <b.schade@samsung.com>
Brandon Schade aadc6434 2022-01-24T18:28:19 Vulkan: Fix to correctly redefine gl_PerVertex in GS Angle translator structures were inconsistent of data lookup of gl_PerVertex data when it is user defined. Bug: angleproject:5579 Test: KHR-GLES32.core.geometry_shader.api.getProgramiv3 Test: GLSLTest_ES31.PerVertex* Change-Id: Ied9ea25ce86ade29261f4f75ce0b48af15061760 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2962352 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Brandon Schade <b.schade@samsung.com>
Brandon Schade 5da062ba 2021-10-06T11:15:00 Translator: Fixed textureGatherOffsets validation The parser only considered the case where the input to the textureGatherOffsets() function is an aggregate constructor node, but not if it is a pre-initialized constant variable. Added code to handle the constant variable case. Tests:KHR-GLES32.core.gpu_shader5.texture_gather_offsets_color KHR-GLES32.core.gpu_shader5.texture_gather_offsets_depth Bug: angleproject:5362 Change-Id: Ib1dd3450071341082ea6f0f2a243c3bb3ef6b95a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3217852 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Brandon Schade <b.schade@samsung.com>
Shahbaz Youssefi ef237faf 2021-10-18T16:22:40 Translator: Validate precision for function args In fragment shaders, float does not have a default precision. Any declaration of this type must therefore specify the precision if a default one is not provided. This was not validated for function arguments. Bug: chromium:1255089 Change-Id: I0d17e226ec88610692ec7dd18793cf4d471f12e7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3226314 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill b196eec0 2021-08-20T12:32:03 translator: Fix InitializeVariables with gl_ClipDistance. The extension allows for the shader to redeclare this variable with a different size. This would sometimes put the tree in an inconsistent state when used with the InitializeVariables feature. Fix this by using the user declaration of gl_ClipDistance when available. Found when working on trace validation, where using the init output variables option in the compiler would then cause tree validation to fail for one specific test. Test: ClipDistanceTest.ThreeClipDistancesRedeclared Bug: angleproject:5133 Change-Id: I42c9bfbe313826ac5d391068d9fc18eb5793375f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3110752 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 1ce78397 2021-07-30T16:51:45 Remove support for WEBGL_debug_shader_precision This extension was rejected, and the implementation was hacky. This clean up is part of an ongoing work to improve precision handling. Bug: angleproject:6059 Change-Id: If08581ec6f19cf1698ffa3dd6d248dc5e68a1d31 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3064303 Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi f9942640 2021-08-03T11:45:31 Translator: Fix fuzzer crashing on assertion An assertion was triggered by the fuzzer when generating an invalid shader that redeclared a built-in. The assertion itself was unnecessary and the parser would appropriately generate an error if that assertion would have fired. Bug: angleproject:4889 Bug: chromium:1235229 Change-Id: I294b2e329491c75d4e87622b602570252555869f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3063910 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@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 ebe943e2 2021-07-29T11:19:33 Vulkan: SPIR-V Gen: Fix gl_Clip/CullDistance These built-ins can be redeclared in the shader. The translator took these redeclarations (and gl_LastFragData) as UserDefined symbols. There were a number of hacks such as in name generation and CollectVariables, to special-case these redeclarations. This change instead makes sure that these variables continue to be considered built-ins with the appropriate qualifiers. A number of fixes are made accordingly: - Hacks are removed. - In fragment shaders, ANGLEClipDistance was initialized with gl_ClipDistance for further use by the shader. The code generation however mistakenly produced `gl_ClipDistance[0] = ANGLEClipDistance[0];`, which caused compilation failures by glslang, but passed the tests accidentally because they expected link failures (see next item). - CollectVariables is fixed to correctly collect gl_Clip/CullDistance in fragment shaders; previously they were collected as output varyings, and therefore the aforementioned link error was not produced in the tests after the compilation error was fixed. Additional fixes: - The transformation of gl_Clip/CullDistance was always ever done on one of them due to misplaced breaks in the loop that detected their presence. - The transformation of gl_CullDistance was skipped when it was not redeclared. Validation is added to make sure these built-ins always have the correct qualifier even when redeclared. SPIR-V gen support for these variables have been fixed as well. Bug: angleproject:4889 Change-Id: Ic8bf2c508357035cb937ef41a28ae22ffc533ebe Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3059921 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 3036e090 2021-07-29T15:55:39 Vulkan: Direct SPIR-V Gen: Support the precise keyword The precise keyword is different in GLSL in that it defines what arithmetic operations _that have led to the value being assigned to a variable_ should be done precisely (i.e. not "contracted"). A tree traverser is implemented that detects precise access chains and applies precise-ness to the right hand side of assignment expressions to said access chains. This is only done if the shader uses the precise keyword in the first place. The algorithm for this is inspired by the implementation in glslang. This change additionally: - Fixes parser to allow precise on function parameters - Fixes GLSL code generation to output precise on struct members and function parameters. Bug: angleproject:4889 Change-Id: Ie3808c3c8c08da308e88af20f5f90379d9d14d47 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3056369 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi c8c9e15b 2021-07-26T22:51:49 Translator: Fix sizing of tessellation shader arrays If layout(vertices=N) is specified after implicitly sized array declarations, the correct size was not being specified on them. Bug: angleproject:4889 Change-Id: I86ccf45a7f264b493a137b87316eff744079ed6c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3054614 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 7f199d75 2021-07-20T00:11:23 Vulkan: SPIR-V Gen: Support geometry shaders Geometry shader built-ins are implemented. A bug in DeclarePerVertexBlocks is fixed w.r.t to gl_PerVertex arrays and a new AST validation option is added to catch that sort of error. Bug: angleproject:4889 Change-Id: I40b2929e450eac8ae840bbf1a1583e6c4c047c88 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3041623 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
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 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>
Brandon Schade 69f2fb00 2021-03-08T10:49:31 Vulkan: Expose OES_geometry_shader extension Modify the symbol table generation script to accept a list of supported extensions. This allows for the EXT and OES versions of the geometry shader extension to be exposed. Test: angle_deqp_khr_gles31_tests --deqp-case=*geometry_shader* Bug: angleproject:3571 Change-Id: Ia7127a03dbd3fce78957f0505d3ce0c9bab6cb15 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2765011 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 013613ea 2021-06-08T01:33:30 Translator: Allow invariant on I/O block members The GLSL ES 3.2 spec says: > Only variables output from a shader can be candidates for invariance. And: > All uses of invariant must be at global scope or on block members, and > before any use of the variables being declared as invariant. As a result, it's possible to specify `invariant` on a member of an output I/O block. Bug: angleproject:4889 Change-Id: I8822ed214813db8424d6a67dfef7f069a448b19d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2946115 Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Brandon Schade dee8dad4 2021-04-20T23:26:55 Vulkan: Fix geometry shader qualifier validation Added missing validation to handle in/out qualifier for geometry shaders Test: KHR-GLES32.core.geometry_shader.nonarray_input.* Bug: angleproject:5579 Change-Id: I9ee0853526ce296df1f56fb7783f9847b31e49bc Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2901256 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi daeac238 2021-05-08T22:09:38 Translator: Ensure structs and blocks are uniquely defined A new AST validation is added to ensure that the same TStructure or TInterfaceBlock is not redundantly defined. This helps with SPIR-V generation by allowing the id to be used as key in a hash map that looks up the corresponding SPIR-V type id. A bug is fixed where the Vulkan driver uniform declaration created two identical declarations for ANGLEDepthRangeParams. A number of other bugs are also fixed in this change, where if a variable declaration is eliminated (for example due to constant folding, or inactive interface variable removal) and it contained a struct specifier, the struct declaration was also removed. OutputGLSLBase had a hack where structs were declared on first encounter, which was incorrect as the scope of the declaration could change. Those bugs are fixed and this hack is removed. Bug: angleproject:2733 Bug: angleproject:4889 Bug: angleproject:5936 Change-Id: I8e13748c0bf552ae8b052249282769a1f0775603 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2881942 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 2aa68eba 2021-04-20T10:37:45 Vulkan: Update unsized array error Update the error condition to reflect actual usecase - an unsized array is declared in a shader other than tessellation shader. Bug: angleproject:5557 Test: KHR-GLES32.core.texture_cube_map_array.texture_size_tesselation_con_sh Change-Id: I3547f52a26a5c450ac7b6df65d026c3c38f7c71d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2823576 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi c2d1a464 2021-04-09T16:53:30 Translator: Track nameless interface block field indices in type Fields of nameless interface blocks are stored as TVariables and referenced through a TIntermSymbols (unlike named blocks which use EOpIndexDirectInterfaceBlock with a constant field indices). With this change, the field index is stored in the variable's type which let's the TField of the TInterfaceBlock be directly accessible (and not need a search by name). This will be helpful in translation to SPIR-V as interface block members are accessed by field index. Bug: angleproject:4889 Change-Id: If3ab45b1e5f5f9576721dc52e2bdf1161882514f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2818242 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 58eabfd7 2021-04-08T23:57:04 Translator: Validate consistent variable references Some transformations change variable declarations. This validation ensures that all references to said variables are appropriately replaced as well. Bug: angleproject:2733 Change-Id: I6c2873968eeed4cba66e70069f84eb69a1f77074 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2818140 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Mohan Maiya dd5705e7 2021-03-24T08:18:24 Add missing qualifier type handling in translator Translator checks tessellation shader unsized array type qualifier. sample in/sample out were missing in handling qualifier type. Bug: angleproject:5557 Test: GLSLTest_ES31.VaryingTessellationSampleInAndOut* Change-Id: I8a2f2c4c4fcc9cc88000d3b2d448ab51fb9e5d38 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2776263 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Mohan Maiya 570970f9 2021-03-19T13:43:35 Vulkan: Handle compilation error involving gl_InvocationID We need to generate a compiler error only when the vertex index of an output variable as an l-value, in a tessellation control shader, is not the indentifier gl_InvocationID. Bug: angleproject:5557 Tests: dEQP-GLES31.functional.tessellation.shader_input_output.barrier Change-Id: Ica075b8d85916caa228f057b203ae81b27f65e2d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2758915 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Mohan Maiya 550f2a3e 2021-02-24T09:49:42 Vulkan: Shader support for EXT_shader_framebuffer_fetch_non_coherent Translator can accept gl_LastFragData and 'inout' variable to gain access to framebuffer attachment data. The Vulkan translator replaces it with the SubpassInput type variable. Note that this works only for the noncoherent version of the extension. Bug: angleproject:5454 Test: *EXTShaderFramebufferFetchNoncoherent*.* Change-Id: I392f84ee3ad3eb9fbd09d0b7ff83731a9a3f33f6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2598060 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Shahbaz Youssefi 5e0a8f9b 2021-01-27T13:46:08 Translator: Enable geometry and tessellation in ES3.2 Symbols that these extensions introduced were only accepted if the extension directive was present. This is not necessary for es 320 shaders. This change adds a new tag to builtin variable and function declarations in the translator, namely "essl_extension_becomes_core_in" which makes gen_builtin_symbols.py automatically create two entries for the builtin; one with the specified level and extension, one with the core level and without extension. Entries in builtin_function_declarations.txt can potentially be deduplicated as a follow up to take advantage of this tag, though likely an anologous "glsl_extension_becomes_core_in" needs to be introduced. Bug: angleproject:5557 Bug: angleproject:5579 Change-Id: I84c19f48a3ccc89d82d80a4f35f7833205bbc88f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2649449 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill e670fc72 2021-01-18T15:51:42 Implement shader compiler changes for Tessellation. Numerous rule changes to support validating Tessellation Control and Evaluation shaders. New per-patch inputs and output variable support. Includes a new traverser step that validates barrier function calls. Functionality changes upcoming in http://crrev.com/c/2568234 Bug: angleproject:3572 Change-Id: If8da1c21d30efa12c60ed0d6c3f8cf0b27e4c86f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2633936 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Mohan Maiya <m.maiya@samsung.com>
Shahbaz Youssefi bd2954a9 2021-01-16T11:33:12 Reland "Cleanup translator option checks" This reverts commit 9173e01730923823846348e513bb8cbe7eddbbe5. Reason for revert: This was in a chain of reverts, but is unrelated to the issue. Original change's description: > Revert "Cleanup translator option checks" > > This reverts commit 9710c4e473c88a38f11eb10c600717181d6e24df. > > Reason for revert: > Earlier CL breaks pre-rotation: > https://chromium-review.googlesource.com/c/angle/angle/+/2598584 > > Original change's description: > > Cleanup translator option checks > > > > Use comparison with 0 for explicit conversion to bool. > > > > Bug: angleproject:3606 > > Change-Id: Ie0a76d7df829227c1376894535813b54e13491b4 > > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2631689 > > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > > Reviewed-by: Charlie Lao <cclao@google.com> > > Reviewed-by: Jamie Madill <jmadill@chromium.org> > > TBR=syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com > > Change-Id: Ib597a62f3c7078d28f7f5b79d1cc9f8d9e469c31 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: angleproject:3606 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2634047 > Reviewed-by: Tim Van Patten <timvp@google.com> > Commit-Queue: Tim Van Patten <timvp@google.com> TBR=timvp@google.com,syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com Bug: angleproject:3606 Change-Id: I10ecca63a3db6dbc3ddedf5bb7e5319a82a80a30 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2633712 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Tim Van Patten 9173e017 2021-01-16T00:10:34 Revert "Cleanup translator option checks" This reverts commit 9710c4e473c88a38f11eb10c600717181d6e24df. Reason for revert: Earlier CL breaks pre-rotation: https://chromium-review.googlesource.com/c/angle/angle/+/2598584 Original change's description: > Cleanup translator option checks > > Use comparison with 0 for explicit conversion to bool. > > Bug: angleproject:3606 > Change-Id: Ie0a76d7df829227c1376894535813b54e13491b4 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2631689 > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Charlie Lao <cclao@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> TBR=syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com Change-Id: Ib597a62f3c7078d28f7f5b79d1cc9f8d9e469c31 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:3606 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2634047 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 9710c4e4 2021-01-14T22:41:48 Cleanup translator option checks Use comparison with 0 for explicit conversion to bool. Bug: angleproject:3606 Change-Id: Ie0a76d7df829227c1376894535813b54e13491b4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2631689 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Mohan Maiya cea86910 2021-01-14T08:13:00 Vulkan: Support EXT_clip_cull_distance extension EXT_clip_cull_distance extension is supported except for some features related to EXT_tessellation_shader and EXT_geometry_shader. Also added a few compiler tests to validate the transformation from ESSL to GLSL for Vulkan backend. Bug: angleproject:5458 Tests: angle_end2end_tests --gtest_filter=Clip*DistanceTest* angle_unittests --gtest_filter=*Clip*Distance* Change-Id: Ie74e6b2b55112ad92ad111191d629b63506032ab Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2585987 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Jamie Madill 2c90a90a 2020-12-04T12:39:50 Geometry Shaders: Don't require 'flat' for integer varyings. The 3.2 spec and the dEQP tests are quite clear in only requiring the 'flat' on fragment shader inputs. This restriction remains on older shader versions. Bug: angleproject:5409 Change-Id: Icc4b113b404280c2867a3e0bf6f77256a4316bff Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2574826 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi abe96578 2020-11-30T14:09:11 Vulkan: I/O blocks: Support unsized arrays Geometry shader inputs have an extra array dimension, which can be unsized as it can be derived from the primitive type. This change fixes the grammar to support such arrays. Additionally, it enables EXT_shader_io_blocks automatically with EXT_geometry_shader and EXT_tessellation_shader per spec. Bug: angleproject:3580 Change-Id: Ia7eb3e8be28c2eef2072dbe2a546fa34973104ab Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2568242 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 8797714c 2020-12-01T11:39:25 Vulkan: Support OES_shader_io_blocks Enables OES/EXT_shader_io_blocks extensions in Vulkan backends. With shader I/O blocks, the varyings can now be an array of struct (the block itself) of struct (nested in the block). This change is missing a number of features. In particular, if the shader I/O block has a location decoration in the middle of the block, that is not handled yet. Based on changes from m.maiya@samsung.com and jmadill@chromium.org. Bug: angleproject:3580 Tests: dEQP-GLES31.functional.shaders.linkage.es31.io_block.* dEQP-GLES31.functional.separate_shader.validation.es31.io_blocks.* dEQP-GLES31.functional.program_interface_query.program_input.* dEQP-GLES31.functional.program_interface_query.program_output.* Change-Id: I593840475d2365ff6c9ce7b2290f5ee462a30dfb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2567645 Reviewed-by: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 8a401051 2020-11-19T07:58:05 Vulkan: Support OES_sample_variables extension Enable OES_sample_variables extension on Vulkan backend. Add support for built-in variables, uniform state and constants - gl_SampleId, gl_SamplePosition, gl_SampleMask, gl_SampleMaskIn - gl_NumSamples - gl_MaxSamples Bug: angleproject:3588 Tests: dEQP-GLES31.functional.shaders.sample_variables.* KHR-GLES31.core.sample_variables.* Change-Id: Idf37c7b4ccb0331dbda7acd6389ff4e1022ba959 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2477907 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya e895ced6 2020-10-29T09:06:00 Vulkan: Add OES_shader_image_atomic support Add support for shader builtins and enable the extension. Bug: angleproject:3578 Tests: dEQP-GLES31.functional.*image_atomic* Change-Id: Idd45b2ee62efe1474c6c5947c77da64ff2221bf6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2505540 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 5d0458fa 2020-10-23T12:52:34 Vulkan: Add OES_shader_multisample_interpolation support Support OES_shader_multisample_interpolation extension if maxInterpolationOffset >= 0.5 Bug: angleproject:3589 Tests: dEQP-GLES31.functional.shaders.multisample_interpolation.* dEQP-GLES31.functional.state_query.multisample_interpolation.* Change-Id: I42997f10be82e3be8b63c56833cbbf791bf4be9b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2477905 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Trevor David Black e815afbf 2020-09-07T22:09:22 First pass at increasing inclusivity Link to the inclusivity rules https://source.android.com/setup/contribute/respectful-code Bug: b/162834212 Bug: chromium:1097198 Change-Id: Ied5a9e3879d72bff3f77ea6fcda9b82f30c32c2f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2396737 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Trevor Black <vantablack@google.com>
Nicolas Capens 07c03b6d 2020-09-11T14:43:37 Validate GLSL attribute location range The location index of a vertex shader input's layout qualifier must be less than GL_MAX_VERTEX_ATTRIBS to link successfully. We can check for this during shader compilation to not rely on other layers to handle pathological cases. While strictly speaking only 'active' attributes are considered during shader linking, this is merely intended to allow for 'uber' shaders to declare more inputs than GL_MAX_VERTEX_ATTRIBS but only use a subset of them. There is no known reasonable use case for a manually specified location to exceed the valid range. Note that according to http://opengl.gpuinfo.org, the highest GL_MAX_VERTEX_ATTRIBS value at the time of writing is 32. Also, D3D12_VS_INPUT_REGISTER_COUNT = 32. Hence the unit test's value of 1000 should be sufficiently future proof. Also address the case where the uniform location might be close to INT_MAX and not be detected as out-of-range due to numeric overflow. Bug: chromium:1110800 Change-Id: I9985c8eab3bb8a2a59b8f985e8f5b6884756383c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2405368 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Nicolas Capens <capn@chromium.org>
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>
Mohan Maiya 96c26c68 2020-04-03T07:52:52 Add support for NV_shader_noperspective_interpolation Added support for GL_NV_shader_noperspective_interpolation on the Vulkan and Desktop OpenGL backends Bug: angleproject:4388 Test: angle_end2end_tests --gtest_filter=ShaderInterpTest.NoPerspective/* Change-Id: I12473830c0ea8b4fffeae9c4a8ec92d979c8e18c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2107234 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Mohan Maiya ca2b6e1f 2020-03-19T16:30:21 Vulkan: Implement EXT_shader_non_constant_global_initializers Enables the translator to handle non-constant global initializers in all essl versions iff the shader enables the extension to do so. Bug: angleproject:4468 Test: angle_end2end_tests --gtest_filter=ShaderNonConstGlobalInitializerTest.* Change-Id: I8f138c12fc83d2f38ff8f45ca9133222b01e4087 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2102959 Reviewed-by: Tobin Ehlis <tobine@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Ian Elliott 3797fc85 2020-03-05T11:44:28 Generate new compiler errors for array-of-arrays The GLES GLSL 3.1 spec states that it is an error to use array-of-arrays in the following cases: - Vertex shader outputs - Fragment shader inputs - Fragment shader outputs ANGLE currently generates errors in the case of vertex shader inputs. It needs to add the above cases. Reproduce by running "angle_deqp_khr_gles31_tests" with: --gtest_filter=dEQP.KHR_GLES31/core_arrays_of_arrays_InteractionInterfaceArrays2* --use-angle=swiftshader Bug: angleproject:4148 Change-Id: I1147fc7d4755e5b6c07d2ab5d14566d919dec530 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2087647 Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Ian Elliott <ianelliott@google.com>
Shahbaz Youssefi 2d1d9d35 2020-01-27T12:09:41 Fix atomicAdd validation w.r.t to swizzles Bug: angleproject:4150 Change-Id: I22c0c0382a2b208dd983fa1981ffc75f1b1945e9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2022359 Reviewed-by: Ian Elliott <ianelliott@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 230e14dd 2020-01-21T23:32:06 Add support for layout(early_fragment_tests) in; Bug: angleproject:4314 Change-Id: I37b228f37201cc4188834e68459cd7294727c3ac Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2014240 Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi a35aa03a 2019-12-20T16:15:53 Vulkan: EXT_gpu_shader5: textureGatherOffsets The validation of the offsets parameter is added in this change. Bug: angleproject:3569 Change-Id: Ide2ea4b9e88b28ca5ef34d5f3f5203f6e48d5f74 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1979133 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Jiajia Qin <jiajia.qin@intel.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 86d9c93a 2019-12-16T16:07:04 Use TSpan for TType's array sizes Until C++20, std::vector doesn't have a constexpr constructor, which means TType cannot use a `TVector` for `mArraySizes` if an arrayed type needs to be created constexpr. This is needed for the upcoming textureGatherOffsets implementation. A new TSpan class is introduced, based on std::span (from C++20) that holds the pointer/size allocated from a TVector without owning it. Since TVector's allocation are made from a pool, the allocated memory will live beyond the vector's destruction. `TType::mArraySizes` is changed to this type. This change will allow a new constexpr constructor to be added to TType that takes a TSpan as array directly, a value which is constexpr initialized from a static array (instead of TVector). Bug: angleproject:3569 Change-Id: I78793b0f4c64519e0ebe30cf6e0de995ba70035d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1968260 Reviewed-by: Jiajia Qin <jiajia.qin@intel.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi d674e1e5 2019-12-12T14:47:24 Vulkan: EXT_gpu_shader5: non-const offset in textureGatherOffset This change includes preparatory work for textureGatherOffsets as well, though that requires special handling which is addressed in a follow-up change. This special handling is due to the fact that this family of functions is the only built-in with an array parameter, and our built-in table generation doesn't handle it correctly. Bug: angleproject:3569 Change-Id: Ic1c8dd03878a184be00f578ab9fc42af8f6e47ea Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1965435 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Jiajia Qin <jiajia.qin@intel.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi e181f2f7 2019-12-10T22:57:42 Validate that image array indices are constant Also adds compiler tests for dynamic indexing of SSBOs and images. Bug: angleproject:3569 Change-Id: I84b90813840ffad5a9a3cd8e7f12bd637a57b327 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1961095 Reviewed-by: Jiajia Qin <jiajia.qin@intel.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi e4eb75da 2019-12-06T11:10:47 Vulkan: EXT_gpu_shader5 support: dynamically uniform indexing Bug: angleproject:3569 Change-Id: I5abb7f2889fa5173457497d4156a3dadbcf77640 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1954613 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Courtney Goeltzenleuchter 4ad8b55e 2019-12-03T10:07:41 Return valid qualifier after error Using EvqLast for the variable causes us to hit an assert in sh::getQualifierString when we try to print a later error message. Just use the appropriate qualifier regardless that it's not valid for a compute shader, we've output the error. Bug: angleproject:4187 Change-Id: If6fa5dea07d7b6e0d3307485f41d59c5ea7f1c4c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1948525 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Shahbaz Youssefi 795a3559 2019-12-03T11:31:18 Vulkan: EXT_gpu_shader5 support: precise The precise keyword is used in tessellation shaders but introduced in this extension. EXT_gpu_shader5 introduces a handful of features to shaders. This change only implements the `precise` keyword. Bug: angleproject:3569 Change-Id: I2252b79098eb8ba2d2faa040d7eaed7548b7051e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1939851 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 249cb200 2019-12-03T11:10:06 Translator: Rename TIntermInvariantDeclaration to ..GlobalQualifier.. This is to support the upcoming `precise` keyword. Bug: angleproject:3569 Change-Id: Idbcc8fd6f261757dbbf81b381e7a2dae938d8101 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1947451 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Tobin Ehlis 240befe5 2019-11-15T14:40:31 Add support for gl_HelperInvocation Added HelperInvocation to builtin_variables.json, regenerate the codegen portions of compiler, and plumb support for HelperInvocation through the rest of the compiler. Skipping some fails on Android and Swiftshader for this initial change and will debug/fix those issues in a follow-on. Bug: angleproject:4110 Change-Id: I781a2782ace84200bc615a2cc26b908a62e2aa26 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1922061 Commit-Queue: Tobin Ehlis <tobine@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>