src/tests/gl_tests/GLSLTest.cpp


Log

Author Commit Date CI Message
Shahbaz Youssefi 9b1ff7b1 2023-05-25T14:13:13 Translator: Fix SPIR-V translation without "variables" flag This flag is now assumed to always be true for the SPIR-V (and MSL) translators. They use the collected variables during translation. Bug: chromium:1447314 Change-Id: I69d31ce8144aec0bd2a7263bad6e5a366e922740 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4567830 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 3f633521 2023-05-18T21:27:00 Vulkan: Fix handling inactive unnamed I/O blocks in SPIR-V When an unnamed I/O block already exists, later inactive unnamed I/O blocks were not being added to the list of inactive varyings, causing the SPIR-V transformer to trip up Bug: b/283017896 Change-Id: Ida5b38e1a03da2b336d5904caa44f53dbdfb8aa3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4544590 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 336bfd60 2023-03-30T00:16:40 GL: Fix the RewriteRepeatedAssignToSwizzled workaround This transformation splits chained assignments where the LHS is assigning to a swizzle. However, instead of retaining the assignment operator (like *=, += etc), it was accidentally unconditionally using `=`. Bug: chromium:1394345 Change-Id: Icaef159e1fb57e720e08d4b4f6603f08d9cd2bfe Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4381648 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Shahbaz Youssefi 57dd0e5f 2023-03-27T13:05:36 Translator: Initialize out arguments too for WebGL Local variables were initialized for WebGL, but not `out` arguments. However, `out` arguments completely overwrite the passed-in variable at call site, so they should also be zeroed out. Bug: chromium:1425685 Change-Id: Ib2f61a962eea74c4933aafa4d5ad377189cec578 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4375137 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@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 afc1e5dc 2023-03-27T00:00:00 GL: Support OES_sample_variables Bug: angleproject:8097 Change-Id: I983d6e83fe9ca942c91cbdf7274b46306e38f11f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4368476 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Alexey Knyazev f5695244 2023-03-21T00:00:00 Fix sample qualifier validation * `smooth sample` is the same as `sample` * `flat sample` is the same as `flat` Bug: angleproject:3589 Change-Id: I8615fa73f4b0cea729b8e09d86f1b8183669de2b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4356666 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mike Schuchardt 4cbe8548 2023-02-28T21:12:17 Expose shader extensions based on ESSL version Previously, all suported extensions were always exposed in the preprocessor. This broke some games which relied on ESSL1-only extension macros not being defined in ESSL3 shaders. This change adds min/max version information to list of extensions so the preprocessor can conditionally expose extensions based on the shader language version, both via the extension name macros and the #extension directive. Test: angle_unittests --gtest_filter="VersionTest.*" Test: angle_end2end_tests --gtest_filter="*ESSL*ExtensionMacros*" Test: Run com.gameloft.android.ANMP.GloftGGHM on Pixel 6 Bug: b/268091452 Change-Id: I2332a6cb964f54c47d23e2ef6b24e99a0b5c8202 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4304907 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Mike Schuchardt <mikes@lunarg.com>
Shahbaz Youssefi facd07ec 2023-02-14T14:11:00 Vulkan: Prune all statements without side effect Bug: chromium:1417461 Bug: angleproject:6061 Change-Id: I6e2b74589021ee60c99448e43ee3eb7f06796ede Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4250278 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 9d84ad7d 2023-02-14T10:47:54 Translator: Fix sampler-in-struct when struct is unused Standalone symbols as statements are also pruned. For example in the below: ``` x; g(); ``` The line that only contains `x;` is pruned. In particular, this was causing a bug with sampler-in-struct processing where the code ASSERTs that if an instance of the struct is visited during traversal, that it's already processed as part of an index chain (like s.member), but in the above situation that is not true. Bug: chromium:1416152 Change-Id: I49e9a5826fc4d8c1fef1fa6f1d38c65f33f8acfd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4247584 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Kenneth Russell 70b5620e 2023-01-10T17:16:41 Metal: skip out variable rewrite for array element references. ANGLE_elem_ref already returns a reference which is incompatible with the ANGLE_out and ANGLE_inout builtins. Skip the rewrite for this builtin, similarly to swizzle_ref for which it was already skipped. Add a small regression test which catches this bug. Fixed: angleproject:7939 Change-Id: Iff8ead697220466ceb063ea2f8eebdb7d9e5896d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4152866 Commit-Queue: Jamie Madill <jmadill@chromium.org> Auto-Submit: Kenneth Russell <kbr@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 78e28cb8 2022-11-03T11:05:48 Vulkan: Remove glslang fallback ANGLE's SPIR-V generator is battle tested by now. Bug: angleproject:6210 Change-Id: I2ed88642e3ede435e3f906fbd701133be6873fb7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4002868 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Cody Northrop 03eccad2 2022-10-18T10:39:53 Tests: Add reduced crashing shader test Reduced case of a shader that crashes an app during SPIR-V compile. Test: GLSLTest_ES3.NestedPowFromUniform Bug: b/217922015 Change-Id: I8d0ccd8b2c4f4e8e51ac39c9dbfaafbf48423157 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3965051 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Cody Northrop <cnorthrop@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Yuxin Hu 70c434b2 2022-08-29T17:09:23 Check max shader storage blocks support in test If the shader source code uses shader storage buffer objects, we need to check the corresponding GL_MAX_*_SHADER_STORAGE_BLOCKS is at least of size 1. Bug: angleproject:7583 Change-Id: I7f0e537e4dcfca8414cccb0088be8d34735633d1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3863111 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Yuxin Hu ac2aeccd 2022-08-25T17:43:43 Check GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS in test If the vertex shader uses shader storage buffer objects, we need to check GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS is at least of size 1. Bug: angleproject:7185 Change-Id: I98d83f9f0cc30e92fdcaee15541fdde96652b38e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3858144 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Eddie Hatfield 955adb77 2022-08-12T10:14:48 Cache compiled shader By storing the compiled shader in the blob cache, the time to recompile the same shader is reduced. Based on work by <hckim.kim@samsung.com> Bug: angleproject:7036 Change-Id: I884ae40e715c49a9ccd12903012e8327811e3557 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3808235 Commit-Queue: Cody Northrop <cnorthrop@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Kyle Piddington 58392791 2022-04-07T16:14:12 Translator: Fix crashes with monomorphizing loops Monomorphize functions crashes when trying to deep-copy a while loop, and a continue statement. Null check these values before performing a copy, as this is still valid AST syntax. Bug: angleproject:7190 Change-Id: I822c0aa062ed844f86aa2b603899d73cbd48255e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3573079 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Kyle Piddington <kpiddington@apple.com> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Kyle Piddington aef9603f 2022-08-02T18:30:08 Separate Struct declarations earlier Metal translator backend asserts with compound struct definitions. Move SeparateCompoundStructDeclarations before SeparateCompoundExpressions. This change does revert some changes for angleproject:6386, but the tests fixed there continue to pass. Bug: angleproject:6489 Change-Id: I6adc606ac0b14453eb5e3e90f6501bf02c2d2768 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3806616 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Gregg Tavares <gman@chromium.org> Commit-Queue: Kyle Piddington <kpiddington@apple.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>
Shahbaz Youssefi 8474a95e 2022-08-05T22:15:04 Translator: Don't validate structs on non-root nodes Struct validation needs to know about structs that may have been defined outside the scope of the node, so this validation (similar to variable and function call validation) is disabled when validation a subtree of the AST. Bug: angleproject:7531 Bug: b/239207278 Change-Id: Id6dcee041a40f09f0c36a9ef3bfc238433b69c58 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3812047 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Shahbaz Youssefi 4e046256 2022-07-25T17:17:28 Translator: Fix deep copy of loops and branches Fixed nullptr dereference when the loop or branch doesn't have an expression. Bug: angleproject:7518 Change-Id: Ib888634e409dcbc27ef060bb46017e8911097eef Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3785294 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 3baa867c 2022-07-14T23:08:42 Vulkan: Fix image arguments passed to functions in GLSL It's impossible to provide the format qualifier to an image function parameter in GLSL, because `layout()` is not acceptable there. SPIR-V doesn't accept formatless image parameters without the StorageImageReadWithoutFormat and StorageImageWriteWithoutFormat capabilities, which are not universally available. Instead, this change monomorphizes functions with image parameters. Note that this was already previously done for R32F images for emulation purposes. Bug: angleproject:7484 Change-Id: Id287c4a93b32deb3fd8be982c32fa58fd2c848d8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3763074 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Kyle Piddington eaf77ef3 2022-07-07T10:25:16 Metal fails to compile uniform blocks in ternary statements When creating an intermediate type for type expansion, Metal was copying over information about which uniform block a type appeared in. This led to a later pass, RewriteNamelessUniformBlocks, failing. This patch helps address a compile failure in the Godot engine. Bug: angleproject:7487 Change-Id: If0724f93017e41260ff11e59a5c28e8578563891 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3751106 Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Kyle Piddington <kpiddington@apple.com> Reviewed-by: Gregg Tavares <gman@chromium.org>
Chris Dalton 3e5de4ac 2022-07-05T10:22:54 Add a test that passes image2D handles as function args Bug: angleproject:7484 Change-Id: I3565bd42deeefa22566d4556a25ec9778c6f8550 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3747098 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Geoff Lang 785353fd 2022-05-24T12:40:16 Support Desktop OpenGL context creation in end2end tests Validation of Desktop GL versions and profile masks is unimplemented. Bug: angleproject:7360 Change-Id: Ifae94215b6aada895c2b02318a1d05c9515e9b96 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3664916 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Eddie Hatfield 89e38b57 2022-06-22T15:04:08 Refactor to use ANGLETest vs ANGLETestWithParam Bug: angleproject:6747 Change-Id: I72ad52d0268eae0e1a401f12f3e94cc5efa402f2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3719002 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Shahbaz Youssefi 79185677 2022-06-22T16:22:35 Translator: Fix validation of struct with same-name struct field In the following: ``` struct S { S s; }; ``` The `S` in the field refers to a previous declaration of `S` in an outer scope. The validation code mistakenly attempted to ensure it refers to the same `S` being declared. Bug: chromium:1337628 Change-Id: I86184be63bc59e608fe5b24369cd4c40b3bb3b31 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3716965 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org>
Chris Dalton d9a2027f 2022-05-19T16:52:28 Add a test for volatile aliases of the same shader image Bug: angleproject:3032 Bug: angleproject:7343 Bug: angleproject:7398 Change-Id: I6ea6abea0b9dafd93bc297499df23be27904c996 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3656314 Reviewed-by: Stephen White <senorblanco@chromium.org> Commit-Queue: Stephen White <senorblanco@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Rohit Rao 4b911686 2022-06-06T22:25:37 Converts from sprintf() to snprintf(). sprintf() is deprecated in Xcode 14, so update to safer equivalents in order to keep the compiler happy on iOS and macOS. Bug: chromium:1331345 Change-Id: Id5348088bf69cbd360d9251e6323596cb710666d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3690747 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Chris Dalton 9800a3cf 2022-05-19T16:52:28 Add a test for imageLoad after glClear to the texture Bug: angleproject:7355 Change-Id: Ib1ddf685f2fa6cb24161615224971a7185234000 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3659504 Auto-Submit: Chris Dalton <chris@rive.app> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Kenneth Russell <kbr@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 98c2e169 2022-05-20T16:17:49 Vulkan: Reduce pre-rotation spec const to bool The specialization constant now only dictates whether x and y should be swapped. The complete 8 possible states of rotation and y-flip are achieved by using this swap in combination with a driver uniform for x and y flip. Swapping is still a specialization constant to avoid degrading performance of dFdx/dFdy which otherwise would need both to be evaluated instead of one. On platforms which don't support pre-rotation, the specialization constant will never change and driver uniforms entirely govern y-flip. On platforms that do support pre-rotation, only two variations of the pipeline are needed. Bug: angleproject:7366 Change-Id: I73f84e89fa9349d2098fa5b21573aee57d93a30c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3663151 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Lingfeng Yang <lfy@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Stephen White b4ec8eac 2022-04-12T12:16:40 D3D11: implement image load/store for non-compute shaders. Output image metadata and image2d replacement string in other shader types. Implement the actual HLSL transform for fragment shaders. Re-enable problematic test. Bug: angleproject:7121 Change-Id: I49b815695757e822e6fdfe599e07ceb5b1d6a75c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3550544 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Stephen White <senorblanco@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang c8c4109c 2022-05-02T11:29:24 HLSL: Disambiguate functions that have int/uint parameters. If a bit-shift expression is passed as a function parameter in HLSL, the compiler cannot tell if it is intended as a uint or int when doing overload resolution. Explicitly disambiguate functions that have int and uint parameters when generating the HLSL. Bug: chromium:1319332 Change-Id: I11c9518e060e9940550bbb04dd7cb953d99c2bb8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3621316 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Lingfeng Yang <lfy@google.com> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Antonio Caggiano 5b4f180c 2022-04-29T16:56:34 Fix formatting Unrelated changes created by running "git cl format" Bug: None Change-Id: I880c7d50aead70353f22502d953efa7aa60ff5d5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3616882 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi fc828287 2022-04-24T00:12:11 Tests for Nvidia/Vulkan bugs with tessellation control Bug: angleproject:7236 Change-Id: I9fec5ef0fe03e1bb5e11067d6d3cf2e7c0b560fa Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3604077 Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 3b38b379 2022-04-20T10:44:24 Vulkan: Add feature avoid HOST_VISIBLE and DEVICE_LOCAL combination Discrete GPUs device local memory usually is not CPU accessible. This adds a feature flag to control that. Fixed bug in BufferVk that when mapRangeImpl is called from angle internal, unmapImpl was using front end mapping parameters that is incorrect. We have to cache the mapping parameters in the backend to hangle the mapRangeImpl/unmapImpl calls from internal. Fixed the test bug in ComputeShaderTest.BufferImageBufferMapWrite that we are calling glMapBufferRange with GL_MAP_READ_BIT but are actually writing to the map pointer. This should result in undefined behavior per spec. Fixed the test bug in GLSLTest.* that VerifyBuffer calls glMapBufferRange, but was giving incorrect length which result in data only been partially copied. This bug was hidden due to previously all buffers are CPU accessible and there is no copy needed. Fixed the test bug in ReadPixelsPBOTest.* and ReadPixelsPBONVTest.* that calls glMapBufferRangeEXT, but was giving incorrect length which result in data only been partially copied. This bug was hidden due to previously all buffers are CPU accessible and there is no copy needed. Added new skipped syncval messages. Because this CL triggers a copyToBuffer call for some of the buffers and that changes the syncval message signature for the same reasons (i.e, feedback loop or synval does not know the exact range of buffer been used for vertex buffers etc). Bug: angleproject:7047 Change-Id: I28c96ae0f23db8e5b51af8259e5b97e12e8b91f2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3597711 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
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>
Shahbaz Youssefi 797e627e 2022-04-08T22:49:51 Autogenerate list of features as enum The WithX() and WithNoX() helpers are removed and replaced with enable() and disable() member functions that take the name of the feature (as a Feature::X enum constant). This has two benefits: - Adding tests that override a feature no longer requires additional helper functions to be written. - There's no mistaking the feature name. This change doesn't yet fix the main issue in anglebug.com/6435, but does fix the following helpers using an old feature name (so they were ineffective): - WithMetalForcedBufferGPUStorage - WithNoVulkanViewportFlip A follow up would remove the old way of overriding features in tests and replaces them with the new way. Bug: angleproject:6435 Change-Id: Ida02b26ec72bc40d7a8938c76a93815bb903ca05 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3580982 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 6b94a71c 2022-04-01T10:12:07 Vulkan: Lift SwS suppressions. Bug: angleproject:4092 Change-Id: I0e72b95ba5ba2b60420d5b685349c405864c2e6e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3563513 Auto-Submit: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@google.com>
Shahbaz Youssefi cd3c74af 2022-03-30T11:48:41 SPIR-V Gen: Fix aliasing out parameters In ANGLE, when an unindexed lvalue was passed as an out parameter to a function, SPIR-V was generated such that the lvalue is passed in directly. A Skia test revealed a difference in SPIR-V and GLSL semantics where aliasing out parameters are expected to work on local copies until the end of the function. Bug: b/226904235 Change-Id: I476af01eb7d065272825967111cd208faf88c275 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3561278 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Cody Northrop ce964d66 2022-03-26T18:56:50 Vulkan: Add tessellation to GetPipelineStage helper The tessellation stages were missing from a helper, which was silently returning an invalid value. Add a test and an assert, which fires before the fix. Test: GFXBench Car Chase Test: GLSLTest_ES31.TessellationTextureBufferAccess Bug: angleproject:7135 Bug: b/218314686 Change-Id: I2bc8d374300fc1470e52affabab7491698c99cee Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3554575 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Cody Northrop <cnorthrop@google.com>
Shahbaz Youssefi 40afbe4b 2022-03-20T23:39:57 Translator: Fix SimplifyLoopConditions producing dead code This causes the tree to fail validation. Dead code could be generated if the loop body ended in a branch. In such a case, no additional instructions are added to the transformed loop body after the original body. Bug: chromium:1300782 Change-Id: I4ec46c170ab5a45fa9b9b73d4e2b62c9c4fa24a3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3539442 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Xu Xing 7eb7596a 2022-03-10T14:32:58 Ensure non float uniform are actively used In mesa, the non float uniforms are optimized out when they are not active. This change ensures the unforms are active. Reference: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6119 Bug: angleproject:7091 Change-Id: Iedff4a4b72a7204348c226778cfe940374632a4a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3515640 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jiajia Qin <jiajia.qin@intel.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 8dc9e83e 2022-02-16T21:48:53 Translator: Fix RunAtTheEndOfShader w.r.t discard RunAtTheEndOfShader wrapped main() if it ended in discard. However, it didn't account for the fact that the discard instruction could be wrapped in a block. This change makes RunAtTheEndOfShader more conservative w.r.t discard and has it wrap main() on any encounter of discard. The change additionally adds AST validation to ensure transformations don't generate dead code after branches. Test credit to Cody Northrop. Test: GLSLTest_ES3.ConstantConditionGuardingDiscard Test: GLSLTest_ES3.NestedUnconditionalDiscards Bug: angleproject:7033 Change-Id: Ie9d5210a5cfbb13449720a8a3f44666df9443d98 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3471014 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Kyle Piddington eeddb050 2022-01-27T11:36:10 Metal: Incorrect parenthization for assignment expressions Fix for Webgl tests conformance/ogles/GL/build/build_017_to_024.html Create intermediate values for assign-equals operations, as they cause issues on expansion later. Bug: angleproject:6489 Change-Id: I7fea162bd1f59c7c765868af739d6ddfc1c1747f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3421527 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Kyle Piddington <kpiddington@apple.com>
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 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>
Gregg Tavares b9f2d9cc 2021-12-16T13:08:22 Use text expectations to skip a test This instead of exiting the test in C++. Bug: angleproject:6826 Change-Id: I1e91f38f0f581821178b3b54ba809e59570b440a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3345615 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Gregg Tavares <gman@chromium.org>
Gregg Tavares a0924015 2021-11-22T19:44:05 Metal:Fix GLSLTest_ES3.GLVertexIDIntegerTextureDrawElements Metal The test was failing if the "first" argument to glDrawElements was odd. When odd the offset was not a multiple of 2 bytes and the code was going down a different path than when the offset was event. The fix for that just removes a check for alignment to 4 bytes. Checking with UNSIGNED_BYTE indices though and it still failed. That was because it was encoding the index conversion path on one command buffer and the provoking index prep on another and so they were happening out of order. Putting both on the same command buffer fixes that. Bug: angleproject:6688 Change-Id: I89b68ba965d073e0fa70b6d5b444dc743b5e34a7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3296631 Commit-Queue: Gregg Tavares <gman@chromium.org> Reviewed-by: Kyle Piddington <kpiddington@apple.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill edc2cfe5 2021-11-19T14:57:16 Fix signed integer overflow in angle_end2end_tests. The test math was causing an signed overflow in the most extreme case. Test: GLSLTest_ES3.GLVertexIDIntegerTextureDrawArrays/ES3_Vulkan_SwiftShader Bug: angleproject:5795 Change-Id: Id6b845577cb6ce585ec67251dcb6111d5773012f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3289942 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Gregg Tavares d87d10cd 2021-11-12T11:02:01 Fix ASAN issue with GLVertexIDIntegerTextureDrawElements Was GLint clearData[] = {42}; glClearBufferiv(GL_COLOR, 0, clearData); Now GLint clearData[4] = {42}; glClearBufferiv(GL_COLOR, 0, clearData); Bug: angleproject:6688 Change-Id: Ia8fa0c7d406626046a32e613fda3a165a06941b6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3278489 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Gregg Tavares c6d86da2 2021-11-11T15:30:41 Add test for gl_VertexID and DrawElements This fails on the WebGL CTS conformance2/rendering/vertex-id.html. Repoing here to make it easier to debug/find/fix. Bug: angleproject:6688 Change-Id: I0a4bafc5700c77e0b6c44b067167fc4a60e63c22 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3276708 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Gregg Tavares <gman@chromium.org>
Shahbaz Youssefi 5a5996aa 2021-11-09T21:42:43 Vulkan: Handle missing decorations in SPIR-V precision fixer Bug: angleproject:6674 Change-Id: Ibfc72f14b9eeb17d7c70cf6d2384d970b2e66650 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3271551 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 52d6e363 2021-11-03T12:46:10 Translator: Fix zero-init of nameless I/O blocks Bug: angleproject:6609 Change-Id: I680fec85d53709f9abd3680a9dc5794ecfae6588 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3260326 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi e10768f0 2021-11-03T12:23:11 Translator: Fix zero-init of I/O block arrays Bug: angleproject:6609 Change-Id: I8245e868fe6bc4798e74088916e1d8cdd0727b6b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3260325 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 5c914b57 2021-10-28T13:27:04 Vulkan: SPIR-V Gen: Fix float+matrix Found by a fuzzer, float+matrix was not handled correctly by the SPIR-V output. Bug: chromium:1264212 Change-Id: I09b13c3e48374621228f5fab4de68c33973ddfd4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3251585 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 066fb91b 2021-10-18T15:31:27 Vulkan: SPIR-V Gen: Handle scalar(const) produced by index clamp Normally scalar(const) is folded into a constant. The index clamp transformation may produce such a code where the index looks dynamic at first (for example `false ? uniform_value : constant`), but becomes constant after folding. This change makes SPIR-V generation robust in that case. A potential future change could avoid the clamp entirely by making FoldExpressions adjust the op of the EOpIndexIndirect node whose index is being replaced with a constant with EOpIndexDirect (and apply the clamp on the argument). Bug: chromium:1260651 Change-Id: I552b7527d821d1cb52e0e53212cc481285674861 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3226311 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.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>
Shahbaz Youssefi 7f87a326 2021-10-18T13:06:29 Vulkan: SPIR-V Gen: Fix crash in array of struct constant Bug: chromium:1260690 Change-Id: I51fe85a2ebc23c3fcaa3c961c4ebf84688bbed31 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3226309 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi f3d5dac3 2021-08-23T17:25:15 Vulkan: SPIR-V Gen: Drop dependency to glslang The SPIR-V gen path is now made default. Compilation through glslang is still supported for debugging, and is enabled on the GLSL* end2end tests for smoke testing. On release builds, glslang is not supported. To test with glslang, add the following gn arg (only necessary if dcheck is disabled): angle_enable_spirv_gen_through_glslang = true Then enable the generateSPIRVThroughGlslang feature. This can be done by setting an environment variable: ANGLE_FEATURE_OVERRIDES_ENABLED=generateSPIRVThroughGlslang ./angle_deqp_gles2_tests Binary size saving: - 1.3MB on Linux (SPIR-V gen itself: 240KB) - 730KB on Android (SPIR-V gen itself: 140KB) Perf tests: - LinkProgramBenchmark.Run/vulkan_compile_single_thread * Through glslang: truncated mean: 1287033.36 * Direct SPIR-V Gen: truncated mean: 244495.91 (~80% reduction) - LinkProgramBenchmark.Run/vulkan_compile_multi_thread * Through glslang: truncated mean: 4565894.83 * Direct SPIR-V Gen: truncated mean: 1158164.10 (~75% reduction) Bug: angleproject:4889 Bug: angleproject:6210 Change-Id: I486342702977c8114e90073b97183aba115a8b2d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3115140 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill 44bef8ae 2021-10-08T15:01:37 Remove traces of Feature Level 9_3 support from tests. Bug: angleproject:1284 Bug: angleproject:3042 Change-Id: Ic2f77d315e98c3b15c5fc8b0359168bce00867d4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3213294 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 0f66c861 2021-10-07T09:32:35 Add test that covers HLSL compiler bug. Bug: angleproject:2445 Change-Id: I820b2dba3748bd10ca516ef47f226ff537b78849 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3212328 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jonah Ryan-Davis 212f4592 2021-09-22T12:02:47 Enable direct-to-metal backend by default We are switching over to Apple's direct-to-metal backend instead of generating SPIRV in the metal backend. This CL enables the direct-to-metal generation by default, but the SPIRV backend is still accessible by overriding the feature directMetalGeneration. This CL comes with a change in test expectations to catch new failures and clean up newly passing tests. Bug: angleproject:6080 Change-Id: I4b10ad93c641b88857079a08fb45d3dc575d71f1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3175664 Reviewed-by: Gregg Tavares <gman@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Shahbaz Youssefi daaaba0a 2021-10-04T22:28:56 Translator: Fix uniform/struct separation for anonymous arrays When a uniform array of anonymous structs was separated into a struct declaration and uniform array, the uniform symbol was being replaced, but not the intermediate nodes that index it. This caused an AST validation error. Bug: angleproject:4740 Change-Id: Ib9d0115bd01c39d1a007f644e46b5e35c12c9304 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3204590 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi dde409be 2021-10-04T22:05:47 Translator: Produce error on func(void, int) If void is specified, another parameter cannot follow. This change ensures that this produces an error. Bug: angleproject:6338 Change-Id: I18602ea4b52c96e498f4f2dc627d4ba2210d6fa7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3203795 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 234ebd58 2021-10-05T08:34:12 Lift old AMD/Win/GL expectations. No longer tested on the bots. Bug: angleproject:1643 Change-Id: I5e1ca8b9c2f673ebcb44c67879829f9fd346edf0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3205795 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Gregg Tavares 696f8533 2021-09-28T15:21:51 fix GLSLTest_ES3.GLVertexIDIntegerTextureDrawArrays The test was using a gl_PointSize of 1000.0 but GL_POINTS are only required to support a max size of 1.0 Bug: angleproject:6463 Change-Id: I8a44607085583cbc7cef06f21b118121cc1fef24 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3192177 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Gregg Tavares <gman@chromium.org>
Shahbaz Youssefi bc8fe7dd 2021-09-24T22:50:32 Translator: Fix removing inactive output vs SH_INIT_OUTPUT_VARIABLES The code that SH_INIT_OUTPUT_VARIABLES adds for inactive outputs is also removed with this change. Bug: chromium:1253016 Change-Id: I3caeb628487354de943f7b53f7462f58baa3eca8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3183107 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Gregg Tavares d71dc819 2021-09-22T16:01:06 Fixes for RowMajor test failures row_major matrices get translated to column major matrices and the expressions rewritten. To do this temporary variables that contain the column and row index expressions are moved to separte statements before the matrix expression itself. When this happens it breaks side effects and short circuits in the expression. The solution is to call SeparateCompoundExpressions before calling RewriteRowMajorMatrices. Bug: angleproject:6386 Change-Id: I4d819ade959e2a875495f62733e11d86560d3fab Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3177337 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Gregg Tavares <gman@chromium.org>
Shahbaz Youssefi e1a9af6a 2021-09-20T10:42:03 Translator: Fix HLSL vs for loop's init not having initializer The handleExcessiveLoop code expected that if a for loop has an init expression that it must necessarily have an initializer as well. That is not true in (fuzzer-produced) code such as following: for (int i; ...; ...) Bug: chromium:1238182 Change-Id: Id761e937a34a6b2feac1266e22207350a3bd616c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3170114 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 46149c0e 2021-09-17T15:38:47 Translator: Fix pruning functions that declare a struct When pruning unused functions, the entire declaration of the function is removed. If the function declares a struct as part of its return value, the declaration of that struct was lost. This change makes sure that declaration survives the pruning. For example: struct S { vec4 v; } unused_func() { ... } is now replaced with: struct S { vec4 v; }; This change also makes struct usage validation more stringent. Bug: chromium:1248753 Change-Id: Idd9a87fd2e785135775cfea62995fd33adaf3c09 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3169691 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Gregg Tavares 085ab6e8 2021-09-09T10:22:04 Turn on Direct Metal tests Bug: angleproject:5505 Change-Id: I8de95f28698785e5467dd82d04cbc7636d6df042 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3152156 Commit-Queue: Gregg Tavares <gman@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 3ae1f336 2021-09-03T09:34:10 WebGL: Make unsuccessful links fail subsequent draw calls. This protects against incomplete state updates during a failed link call that can interfere with draw calls. Bug: angleproject:6358 Bug: chromium:1241123 Change-Id: Ie892654c3a58c69d6e35ba3c41758ab6269d8193 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3140496 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Gregg Tavares ab187c35 2021-09-02T14:46:29 Handle comparing arrays of scalars/vectors/matrices Fixes: UniformBlockWithOneLargeArrayMemberTest.MemberArrayOperations/ES3_Metal Bug: angleproject:5505 Change-Id: Ife35db2146ac8ce8c0880cdb98df57dc75cb35cb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3140712 Commit-Queue: Gregg Tavares <gman@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill b6e99bb3 2021-09-02T13:47:34 Rename and expand shader variable init feature. This feature now forces both output and unitialized locals to be initialized by the shader translator. This feature is needed by the trace validator to ensure we get deterministic behaviour in traces that exhibit some undefined results. Bug: angleproject:5133 Change-Id: Id1242cd077a57e891eed217f7671976ce1631a58 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3140216 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 9d0e2851 2021-09-01T00:42:58 Fix SeparateDeclarations vs struct specifiers Bug: chromium:1237696 Change-Id: I3b00f3797800e814ca83226a8e4f25b2a43cc641 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3133824 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill a29b07d8 2021-08-26T13:11:29 InitializeVariables: Init shader IO block outputs. These variables were not handled in the pass because we had no prior test coverage of them. Some frame capture testing uncovered this gap. The variables must be initialized field-by-field, since there seems to be no defined way to initialize an entire block at once. Bug: angleproject:6326 Change-Id: Ib7aecfb76b97b4236d786b44b3dfb706c573e221 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3123228 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 800e82c6 2021-08-23T11:05:23 Translator: Validate precisions When declaring a variable, a struct field, function parameter etc, there's a precision necessarily applied to the entity being declared. AST Validation is added to enforce this. Intermediate nodes derive their precision from these entities automatically. Consistency of intermediate nodes is not validated. This is because AST transformations replace a node with a transformed one, and that may not have the same precision. Take the following code: mediump float x = ...; mediump float y = ...; ... x + y ... and assume is transformed as such: highp float driver_uniform; ... (x * driver_uniform) + y ... The addition was originally done in mediump, but would seemingly need to be done in highp after transformation. There are a number of options here: - Make sure that when nodes are replaced, the precision is unaffected. This can be intrusive, requiring temp variables. - Bubble up the new precision - Accept the discrepancy ANGLE opts for the last option, which actually respects the original shader's intended precision for operations, even if some transformation needs to temporarily evaluate an expression at a higher precision. Bug: angleproject:4889 Bug: angleproject:6132 Change-Id: Ibcde3a230de159157783b1c6d5ef1cd63ceb4d8f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3114027 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Gregg Tavares a141cb52 2021-08-23T13:52:57 Test vector and matrix scalarization does not affect output Vector and matrix scalarization was turned off because it affects the rendering output. We need to turn it back on in some form for Metal. This test is added to check that rendering output is not affected. Test adapted from WebGL CTS test https://github.com/KhronosGroup/WebGL/pull/3214 Bug: angleproject:6306 Change-Id: Ic1db18920064726761d6168f9dd5111772028598 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3115013 Commit-Queue: Gregg Tavares <gman@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Kenneth Russell 8ffb4602 2021-08-18T16:55:56 Turn on the first few direct-to-Metal tests by default. All of the subtests of these previously-asserting tests are passing with --bot-mode: ProgramBinaryES3Test UniformTest WebGLGLSLTest so start running them on ANGLE's CQ. Bug: angleproject:5505 Change-Id: Ibdaa814cec846379e2c073117efa816fc871be33 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3105442 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi d20afde4 2021-08-05T23:06:44 Vulkan: Retain precision of uniform variables When gathering in a uniform block, the precision of default uniforms was dropped. Bug: angleproject:4889 Bug: angleproject:6132 Change-Id: Ie6a8e2e7cef7cd3808cee08d20f886fc4e762cd5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3076124 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 63248e7f 2021-08-05T23:49:23 Translator: Fix dead-code-elimination corner case The DCE code had a corner case bug where a switch case containing multiple DCE'ed `break`s followed by another case would cause some of the DCE'ed statements in the first case to be doubly pruned, failing on an assertion. This was due to the fact that visitBlock() was asking traversal to continue if a new case was visited while pruning nodes, but the traversal does not take into account that some statements need to be skipped and so would also visit the pruned statements. If the pruned statements contain a branch instruction, they get re-pruned. The visitBlock() function that does the pruning is reworked so that it more clearly traverses the statements. Bug: chromium:1237200 Change-Id: Ib078c2ea73ade756c7d7ef5a5c489fa53c39f352 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3077659 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 09d5047b 2021-08-03T01:31:03 GL: Remove the rewriteVectorScalarArithmetic workaround This workaround was implemented for a bug in Nvidia driver 387 which is end-of-life. More recent driver branches (390 and 4XX) are fixed, and so this workaround is no longer required. The implementation of the workaround itself could introduce bugs. Bug: chromium:772651 Bug: chromium:1201084 Change-Id: I3db179eb90d9124235bdad2daacc712302906d8e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3067952 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Shahbaz Youssefi aca9f2e2 2021-07-29T17:49:26 Vulkan: SPIR-V Gen: Fix constructors with uniform parameters When the constructor contains parameters from interface blocks, they may have SPIR-V type specializations that was not previously accounted for. The code is made more robust by retrieving the column/component types when generating constructors through TTypes instead of modifying SpirvTypes directly. Bug was caught by the WebGL CTS. Bug: angleproject:4889 Change-Id: I6c9df17a97fac8622dea55ed67c7bae1ce16d1bd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3061640 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi a83c9108 2021-07-29T17:13:41 Vulkan: SPIR-V Gen: Fix nested ternary operators The OpPhi instruction used to implement ternaries referenced to the blocks pregenerated for the true and false cases. However, if there were other code nested inside that could generate blocks (other ternary expressions or short-circuits), that would be wrong. Instead, the last block id is taken every time the true or false case is entirely visited (similar to how it's done in the short-circuit implementation). Bug was caught by the WebGL CTS. Bug: angleproject:4899 Change-Id: I71be86989dfe9596a13940ce657a7e67849e86bf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3061639 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 2b23aae4 2021-07-29T16:39:28 Vulkan: SPIR-V Gen: Support vec(..., mat) Matrices specified in vector constructor arguments were not correctly handled w.r.t to casting (caught by the WebGL CTS). Bug: angleproject:4889 Change-Id: I70253f049a651fc5f439b56d1e4d8f785813b605 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3061638 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Kenneth Russell aec5e65c 2021-07-28T00:36:12 Get direct-to-Metal backend to run angle_end2end_tests. Cherry-pick nameless struct fix from Apple in https://bugs.webkit.org/show_bug.cgi?id=227482 . Fix SeparateCompoundStructDeclarations pass to stop generating multiple declarations; thanks syoussefi@ for advice. Incorporate additional passes from TranslatorVulkan (MonomorphizeUnsupportedFunctionsInVulkanGLSL, RewriteArrayOfArrayOfOpaqueUniforms, SeparateStructFromUniformDeclarations) needed by RewriteStructSamplers pass in TranslatorMetalDirect. Fixes many assertion failures in GLSL tests. Moved these passes out of tree_ops/vulkan. Thanks again to syoussefi@ for advice and help. Disable a validation check related to the RewritePipelines pass. Skip two tests that were failing for other reasons. With these changes, angle_end2end_tests runs to completion when the direct-to-Metal backend is turned on. There are still ~1300 failures of the ~4000 tests which will be investigated next. Bug: angleproject:5505 Change-Id: Ibca77822543e8e8e8d2a8c862e92cdf74bfa3545 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3058524 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Kenneth Russell <kbr@chromium.org>
Shahbaz Youssefi 8bf2e5ec 2021-07-23T16:54:16 Vulkan: SPIR-V Gen: Fix switch with default at the end A minor bug was making a switch with default at the end to jump to the merge block instead of the default block. Bug: angleproject:4889 Change-Id: Ied434fab949b10d45a0db1242c1b8535a5f4f773 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3048321 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi d0c03ff4 2021-07-22T14:55:51 Vulkan: SPIR-V Gen: Fix lvalues passed to in/inout parameters In GLSL, these values are semantically copied when passed to a function as an in or inout parameter. For example in: bool f(inout vec4 a, inout vec4 b) { a = vec4(0); return all(equal(a, b)); } var = vec4(1); bool result = f(var, var); result is expected to be false. In SPIR-V, every parameter is semantically passed by "reference". glslang conservatively uses temporaries to pass to functions. An optimization in ANGLE didn't create temporaries for unindexed lvalues, which did not take into account the above fact. This optimization is limited to out parameters now. Bug: angleproject:4889 Change-Id: Ie1b4b1cecba847ba63d5810d01d0856823b89ddc Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3046103 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 9d23ae62 2021-07-22T12:32:44 Vulkan: SPIR-V Gen: Fix conditionals with pruned blocks Rewored the visitIfElse function to simplify the logic and correctly handle if-else constructs where the true block is pruned. Bug: angleproject:4889 Change-Id: Ib968a2fe65f4b6463158fd76e7d67757115ee832 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3046101 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 951b04bb 2021-07-21T12:20:13 Vulkan: SPIR-V Gen: Support scalar constructors In GLSL, the scalar constructor can be given a vector and matrix, in which case the first element is selected. This case was not previously handled. Bug: angleproject:4889 Change-Id: Ibf276883fc7396b750981a4e469ff9b152c6e700 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3042554 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 6e261453 2021-07-20T22:34:33 Vulkan: SPIR-V Gen: Fix I/O block arrays Since the qualifier on intermediate nodes are EvqTemporary, the code that autodeduced the block storage of I/O blocks was incorrectly assigning them std140 when an indexed I/O block array was encountered. This resulted in duplicate types in the SPIR-V. This is generally benign (other than creating an unnecessary type) except for gl_PerVertex as it adds BuiltIn decorations. gl_PerVertex may be an array in geometry and tessellation shaders. Bug: angleproject:4889 Change-Id: Iaa8e414ae01a4be127dc52df0e9406546b23d24c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3041621 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi a8807cbf 2021-07-17T00:00:27 Vulkan: SPIR-V Gen: Support interpolateAt* The interpolateAt* builtins take their first argument as a pointer, so only the OpAccessChain result should be given to the corresponding SPIR-V instruction. A test is written in this change to handle interpolateAt* when given a swizzled lvalue, which is not representable in SPIR-V. This can be supported by having the AST transform: interpolateAtX(value.zy) to: interpolateAtX(value).zy which can be done right when the function is parsed and the AST node for it is created (by taking the swizzle out of the parameter and applying it to the node). However, swizzled lvalues as parameter to interpolateAt* is only allowed in desktop GLSL, and so the test is disabled. From the GLSL ES3.2 spec: > Component selection operators (e.g. .xy) may not be used when > specifying interpolant. Bug: angleproject:4889 Change-Id: I043969f22011e6171c7ae225ded3a5013e8cfa4e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3035588 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 32196d8f 2021-07-16T14:49:08 Vulkan: SPIR-V Gen: Support built-ins with out parameters Some built-ins have out parameters; modf, frexp, uaddCarry, usubBorrow, umulExtended and imulExtended. In SPIR-V, they are translated as such: - modf and frexp: Returns the same result as GLSL, with a pointer to store the output parameter. Since SPIR-V cannot create pointers to swizzles, a temp variable is used in that case. - uaddCarry, usubBorrow, umulExtended and imulExtended: These return a struct in SPIR-V, which contains the two output parameters; with lsb in field 0 and msb in field 1. Bug: angleproject:4889 Change-Id: Ic5114f74b9c1013093007e91939f78d5218f2a07 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3036088 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi f4ce6d00 2021-07-15T11:07:25 Vulkan: SPIR-V Gen: Support bool in interface blocks SPIR-V doesn't allow bool in interface blocks. Another type specialization is added for this purpose, turning those bools to uint. Bug: angleproject:4889 Change-Id: I803bffcf5ea58c913d4df6e7aae3386c67901b25 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3032021 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 9c6fb52c 2021-07-13T14:10:41 Vulkan: SPIR-V Gen: Assignment between mismatching SPIR-V types In general, GLSL qualifiers translate to SPIR-V decorations on SPIR-V variables. In the case of blocks (struct or interface block), OpMemberDecorate is used, which due to its specification in SPIR-V, can only apply decorations to direct members of a block. This makes it impossible for example to decorate a nested member of a block through its variable id. As such, some decorations such as RowMajor and Invariant apply to members of a block given its _type_ id. Unfortunately SPIR-V requires ArrayStride to also be applied to a type directly, rather than a member of a block. This implies that some types, such as structs used in uniform/buffer interface block, or decorated with invariant or row_major, as well as arrays (of any type) used inside and outside interface blocks to produce different SPIR-V types from the same GLSL type. The SpirvTypeSpec data previously introduced specialize these types. It's necessary to "cast" between these types when needed. The translator handles casts at load/store boundary: - Upon load, the value is cast to the type with the default SpirvTypeSpec. - Upon store, the value is cast from the default to the store target SpirvTypeSpec. - All intermediate results use the default SpirvTypeSpec. Bug: angleproject:4889 Change-Id: I6fa28e518ec6b517ff163f44b6892859eb4b10fd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3026145 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 07c39616 2021-07-08T17:01:31 Vulkan: SPIR-V Gen: Enable GLSLTest* This change includes an assortment of small fixes to enable most of GLSLTest* end2end tests. - User-defined std140 storage buffers were mistakenly turned to std430. - External and WEBGL samplers were redundantly redeclaring the sampler2D type. - `invariant` specified on a field of struct type didn't apply it to said struct's members. - Arrays of struct as a member of an interface block didn't have their size aligned, producing incorrect stride - Interpolation and auxiliary qualifiers are now generated - Arrays of opaque uniforms are now correctly passed to functions when indexed. - atan(x, y)'s built-in Op is fixed - early_fragment_tests is now generated Additionally, the SPIR-V transformer didn't handle the Invariant decoration applied to gl_PerVertex built-ins, which is possible as a result of: #pragma STDGL invariant(all) This bug existed in the transformer due to two bugs: - ANGLE didn't generate this line when generating GLSL to feed to glslang. This is fixed by this change. - glslang itself ignores this line: https://github.com/KhronosGroup/glslang/issues/2689 Bug: angleproject:4889 Change-Id: I15ad9fcc178abc1eae944e7a58f4e6153fa5dfd9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3016762 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi afdf378f 2021-07-01T21:55:58 Vulkan: SPIR-V Gen: Support == and != on complex types In GLSL, == and != produce a bool. In SPIR-V, there are only component-wise comparison operations. For ==, OpAll should be used to reduce it to a single bool, and for !=, OpAny. For matrices, the comparison is done column by column with a similar reduction for each column, and one for the final result. For structs and arrays, the comparison is similarly done field by field or element by element respectively. Bug: angleproject:4889 Change-Id: I8157c1931b7d1dedd74a3825967f5e212d346900 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3001905 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 3b0fcf6a 2021-06-30T15:14:48 Vulkan: SPIR-V Gen: Support type casts in constructors GLSL basic, vector and matrix constructors can convert between types. This was already done for constants used in constructors. This change implements the cast for non-constant expressions. Bug: angleproject:4889 Change-Id: I0a8c1a6e97ffced0d1652032a41fb87c70be16ca Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2999022 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>