src/compiler


Log

Author Commit Date CI Message
Brandon Schade 7dda50fc 2022-01-13T12:09:20 Add frontend for ANDROID_extension_pack_es31a - Add entry to registry_xml file - Add handling in the DirectiveHandler Bug: angleproject:3608 Change-Id: I1cc32a4a97fd9974f65786a9a972b4b541abf658 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3388405 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Brandon Schade <b.schade@samsung.com>
Brandon Schade 28f223ac 2022-01-14T16:11:32 Vulkan: Add missing ESSL 3.2 builtin functions Builtin functions from the "OES_shader_image_atomic" and "OES_texture_storage_multisample_2d_array" extensions were missing from ESSL 3.2 builtins. Bug: angleproject:3578 Bug: angleproject:3583 Change-Id: Id372f0dcffee1eb376c66b9e4886ed50a08b1b0e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3391048 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Brandon Schade <b.schade@samsung.com>
Alexey Knyazev f4b0a95f 2021-12-16T02:38:26 Metal: Implement EXT_shader_texture_lod Added CubeMapTextureTest.SampleCoordinateTransformGrad_ES3 Bug: angleproject:6815 Bug: angleproject:6824 Bug: angleproject:3814 Bug: angleproject:6891 Change-Id: I9007bf8ba91309fb9b597e2d1bd33281ff59644a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3343488 Reviewed-by: Gregg Tavares <gman@chromium.org> Reviewed-by: Kyle Piddington <kpiddington@apple.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Brandon Schade 0ab15998 2022-01-07T09:59:23 Translator: Don't promote precision for assignment operation lvalues Assignment operations should use the precision of their lvalue-expression, even if their rvalue-expression has higher precision. Bug: angleproject:6889 Change-Id: I9a105631defb6c1e27870c96517aa66fbd95543e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3381906 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Brandon Schade <b.schade@samsung.com>
John Cunningham 0b02a592 2022-01-10T20:27:25 Metal: Generated Metal shaders do not compile offline Add an explicit include for the Metal stdlib to fix missing symbol errors Bug: angleproject:6886 Change-Id: Ie84ef1c16f964387b63e36490d7e9abc0c1763f2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3379238 Reviewed-by: Kyle Piddington <kpiddington@apple.com> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Kenneth Russell <kbr@chromium.org>
Shahbaz Youssefi 095d7c0a 2022-01-06T01:20:53 Translator: Clean up spec const / driver uniform types Bug: angleproject:6755 Change-Id: I8fb1557a5e29fcc28d5cb2f3aaa2c4a14b72583d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3369125 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Tim Van Patten <timvp@google.com>
Kyle Piddington f13f440e 2021-12-15T15:11:05 Reland: Metal: Fix Webkit warnings in ANGLE build Fix nullable warnings, unused functions Add in additional function specification to FormatStringIntoVector to correctly fix warning Bug: angleproject:6781 Change-Id: I26af2d698f14d353832802aa7b5ce34c5a1f4b95 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3366796 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Kyle Piddington <kpiddington@apple.com>
Shahbaz Youssefi 4114fe23 2021-11-20T22:05:56 Vulkan: Simplify transform feedback emulation logic In [1], the program is transformed to not output transform feedback logic when transform feedback is inactive. With that change, it's no longer necessary to dedicate a driver uniform to indicate if transform feedback is active. [1]: https://chromium-review.googlesource.com/c/angle/angle/+/3294661 Bug: chromium:1209285 Change-Id: Ica725d0da08e2676f442fe6307962d367b443535 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3294702 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 1da7e3af 2021-12-21T15:55:38 Revert "Metal: Fix Webkit warnings in ANGLE build" This reverts commit 6706799186683dd3733c4610de09d84721aa08c8. Reason for revert: Includes pragma that disables a warning. Original change's description: > Metal: Fix Webkit warnings in ANGLE build > > Fix nullable warnings, unused functions > > Bug: angleproject:6781 > Change-Id: I063331e60d31a55b3cc9df0b41ace014d7d13659 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3343174 > Reviewed-by: Kenneth Russell <kbr@chromium.org> > Commit-Queue: Kenneth Russell <kbr@chromium.org> Bug: angleproject:6781 Change-Id: Id5fce2afd0381030a974871b99e8adf075677bd1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3352086 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Gregg Tavares b26bb13a 2021-12-15T15:46:00 Metal: Remove references to xfbActiveUnpaused uniform Metal chooses a shader with or without support for transformfeedback so there's no point in checking in the shader if it's enabled or not. Bug: angleproject:6823 Change-Id: Iacd26b1e55b311a7cc7987dcd8b2f8c0c8727d62 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3343179 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Gregg Tavares <gman@chromium.org>
Kyle Piddington 67067991 2021-12-15T15:11:05 Metal: Fix Webkit warnings in ANGLE build Fix nullable warnings, unused functions Bug: angleproject:6781 Change-Id: I063331e60d31a55b3cc9df0b41ace014d7d13659 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3343174 Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Kenneth Russell <kbr@chromium.org>
Gregg Tavares 1642b4a3 2021-12-10T16:01:10 Metal: Fix Instanced Draw feature support on Simulator Bug: angleproject:6786 Change-Id: I4c567bf2ec61df581ae0e8eeb1c36c7d37e15d04 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3331637 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Kyle Piddington <kpiddington@apple.com> Commit-Queue: Gregg Tavares <gman@chromium.org>
Gregg Tavares 2e669566 2021-12-09T18:21:02 Metal: Refactors from Webkit Mostly renaming, typos, cleanup bug: angleproject:6787 Change-Id: Ic71c296d7849244cae2ca29b264a10cb96bca612 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3329261 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Gregg Tavares <gman@chromium.org>
Yuly Novikov f64f9546 2021-12-07T20:17:32 Reland "Decouple gl_BaseVertex/gl_BaseInstance uniforms" This reverts commit 10e5f34d1439f0bcd5b30bea5bfbf6bdaafd4935. Reason for revert: exonerated from flaky crash suspect Original change's description: > Revert "Decouple gl_BaseVertex/gl_BaseInstance uniforms" > > This reverts commit 36bf1ebe5e9500704dd235254bd22a1f2bbd7059. > > Reason for revert: suspect causing flaky crashes > > Bug: angleproject:6763 > > Original change's description: > > Decouple gl_BaseVertex/gl_BaseInstance uniforms > > > > These are builtin uniforms removed in > > https://github.com/KhronosGroup/WebGL/pull/3278 > > > > Decouple them from the original ANGLE_base_vertex_base_instance > > extension. > > > > Make a new ANGLE_base_vertex_base_instance_shader_builtin > > extension for these builtin uniforms. > > > > Bug: angleproject:3402 > > Change-Id: I77b93917976ce435db9c578c0ade37bff18a42b0 > > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3290304 > > Commit-Queue: Shrek Shao <shrekshao@google.com> > > Reviewed-by: Geoff Lang <geofflang@chromium.org> > > Reviewed-by: Kenneth Russell <kbr@chromium.org> > > Bug: angleproject:3402 > Change-Id: I75830baa14cf4e7c53750fd14ff76501145b4823 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3315610 > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> > Reviewed-by: Yuly Novikov <ynovikov@chromium.org> > Reviewed-by: Kenneth Russell <kbr@chromium.org> > Commit-Queue: Shrek Shao <shrekshao@google.com> Bug: angleproject:6763 Bug: angleproject:3402 Change-Id: Ie436dc5d55364e464897d407a53b793941cd5d0b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3321703 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Shrek Shao 10e5f34d 2021-12-04T00:10:21 Revert "Decouple gl_BaseVertex/gl_BaseInstance uniforms" This reverts commit 36bf1ebe5e9500704dd235254bd22a1f2bbd7059. Reason for revert: suspect causing flaky crashes Bug: angleproject:6763 Original change's description: > Decouple gl_BaseVertex/gl_BaseInstance uniforms > > These are builtin uniforms removed in > https://github.com/KhronosGroup/WebGL/pull/3278 > > Decouple them from the original ANGLE_base_vertex_base_instance > extension. > > Make a new ANGLE_base_vertex_base_instance_shader_builtin > extension for these builtin uniforms. > > Bug: angleproject:3402 > Change-Id: I77b93917976ce435db9c578c0ade37bff18a42b0 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3290304 > Commit-Queue: Shrek Shao <shrekshao@google.com> > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Reviewed-by: Kenneth Russell <kbr@chromium.org> Bug: angleproject:3402 Change-Id: I75830baa14cf4e7c53750fd14ff76501145b4823 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3315610 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Shrek Shao <shrekshao@google.com>
Shrek Shao 36bf1ebe 2021-11-17T13:31:17 Decouple gl_BaseVertex/gl_BaseInstance uniforms These are builtin uniforms removed in https://github.com/KhronosGroup/WebGL/pull/3278 Decouple them from the original ANGLE_base_vertex_base_instance extension. Make a new ANGLE_base_vertex_base_instance_shader_builtin extension for these builtin uniforms. Bug: angleproject:3402 Change-Id: I77b93917976ce435db9c578c0ade37bff18a42b0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3290304 Commit-Queue: Shrek Shao <shrekshao@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Mohan Maiya 6c172e4b 2021-11-20T16:27:14 Add support for memory cleanup on process exit This patch adds a callback to cleanup memory on process exit. Bug: angleproject:6723 Test: Android CTS WrapperTest.testThreadCleanup Change-Id: Ia517d4c6ae280ddc1f17a3b6f77d437aaaad0678 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3294581 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Shahbaz Youssefi 7d33e71a 2021-11-15T11:20:25 Vulkan: SPIR-V Gen: Don't generate names for constants Multiple constant variables can have the same value, and they are coalesced to the same SPIR-V id. It's not useful to attempt to generate multiple constants with different names, especially as those names don't make it into the SPIR-V-Cross-generated GLSL. Additionally, most constants in the translator don't retain their name, only the ones that are not folded do (and which are folded is a rather arbitrary decision). By generating names for these constants, the SPIR-V gen code was introducing a bug where multiple OpNames could be generated for the same OpConstant* id. This change removes OpNames generated for constants in the first place. Bug: angleproject:6644 Change-Id: Ife2f4bee8e2eb095dc0b22994420ee1dfc6023c6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3282425 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Gert Wollny 5f7c3ba6 2021-11-01T13:27:15 Capture/Replay: Don't force initialization of FS inout vars Since these variables are to be considered inputs as well as outputs initializing them would overwrite the valid input values, hence skip initialization. Bug: angleproject:6608 Change-Id: Id8baf856a23ac84d18c61dd54cd6095128190075 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3253377 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Gert Wollny <gert.wollny@collabora.com>
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>
Kyle Piddington 0e9e321b 2021-11-01T17:04:05 Metal: Anonymous unused uniform structs not named. Due to some upstream changes, unused uniform structs are not being given a name. These structs cause compilation failures, which has completely caused shadertoy.com to fail to render. Skip the check when naming embedded structs to allow uniform struct types to still be named, even when no uniform exists. Unskip targeted tests on the Metal backend which were added previously in Issue 6641. These still need to be fixed more generically for the Vulkan backend. Also suppress flaky WebGLCompatibilityTest.RG32FTextures test on Mac Intel OpenGL, which affected this CL. Bug: angleproject:6642 Bug: angleproject:6641 Bug: angleproject:6570 Change-Id: I598fc212f4db3d3b7c5617bd8a87f8b7db60706c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3258341 Commit-Queue: Kenneth Russell <kbr@chromium.org> Reviewed-by: Gregg Tavares <gman@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Stephen White 0b56267f 2021-11-02T12:25:40 Implement ANGLE_FALLTHROUGH macro. Use it instead of ABSL_FALLTHROUGH_INTENDED. (ANGLE shouldn't use absl unless angle_enable_absl is true. This is breaking the roll of ANGLE into Dawn.) Bug: angleproject:6647 Change-Id: I47f9a00841c4605fca52b17eeb68c0b1da5004c0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3258008 Commit-Queue: Stephen White <senorblanco@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Kyle Piddington 50fc2909 2021-10-27T21:37:02 Merge Webkit up to Oct 27 2021 Merge the following commits from Webkit. This change merges webkit from the following git commits Previous: commit 703b234524e75109ca3e94febbf63098314022f5 Author: Alex Christensen <achristensen@webkit.org> Date: Tue Sep 28 16:22:30 2021 +0000 Mostly fix Mac CMake build https://bugs.webkit.org/show_bug.cgi?id=230868 Current: commit 43d2e637f84b1e6b75c139ac64c26ca108b4f12f Author: Kimmo Kinnunen <kkinnunen@apple.com> Date: Wed Oct 27 17:43:38 2021 +0000 REGRESSION (Safari 15): Poor WebGL performance on https://downloads.scirra.com/labs/particles Commits: commit 8238f462c96e515dabd3db0e26c143b18f47340c Author: Kyle Piddington <kpiddington@apple.com> Date: Wed Oct 6 21:45:18 2021 +0000 Shadertoy "truchet district" fails to compile with error: Internal error compiling shader with Metal backend" commit 2fcb9af290e4b6c804f11ad4359555507c1492f9 Author: Kyle Piddington <kpiddington@apple.com> Date: Thu Oct 14 21:14:26 2021 +0000 https://tankionline.com/play/ html5 engine not working: crashes. (Metal shader not working) https://bugs.webkit.org/show_bug.cgi?id=231490 commit e11955a258380a875115ded16ab8963142c4023b Author: Kyle Piddington <kpiddington@apple.com> Date: Fri Oct 15 23:57:12 2021 +0000 REGRESSION (r283667): webgl/2.0.0/deqp/functional/gles3/lifetime.html fails https://bugs.webkit.org/show_bug.cgi?id=231682 commit 43d2e637f84b1e6b75c139ac64c26ca108b4f12f Author: Kimmo Kinnunen <kkinnunen@apple.com> Date: Wed Oct 27 17:43:38 2021 +0000 REGRESSION (Safari 15): Poor WebGL performance on https://downloads.scirra.com/labs/particles https://bugs.webkit.org/show_bug.cgi?id=230749 Bug: angleproject:6630 Change-Id: Icca411dc429538f839f05834f1851fbc54ef8a1d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3248573 Commit-Queue: Kyle Piddington <kpiddington@apple.com> Reviewed-by: Gregg Tavares <gman@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill c31855ea 2021-10-28T13:29:17 translator: Always report gl_FragData array size. Previously we would report it as size 1 always if the extension was missing. This was breaking a dEQP. The test may have a bug, but we need to work around the issue until the upstream test is fixed. See https://gitlab.khronos.org/Tracker/vk-gl-cts/-/issues/3259 Bug: angleproject:6566 Change-Id: I5ac654f472f0e227d63804896ecc388081bec5e8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3251586 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@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>
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>
Kyle Piddington db83279a 2021-10-27T10:45:23 Metal: Use 'fast' normalize to match DEQP expectations Normalize' has a fast math option that more conformantly deals with INF in normalize functions. Use metal::fast::normalize instead of metal::normalize This also matches SPIRV-Cross behavior for normalization Bug: angleproject:6629 Change-Id: I61392ecd6f61b612d21f2832e07a135e26b53ad6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3248145 Commit-Queue: Kyle Piddington <kpiddington@apple.com> Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Gregg Tavares <gman@chromium.org>
Shahbaz Youssefi 55bd8d8f 2021-10-26T10:38:28 Translator: Fix precision bug in HLSL generation Bug: chromium:1263487 Change-Id: I60bc3dc93867e4269756b6f54eb39cf29ad77d5f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3244887 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 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>
Cody Northrop e2e77baa 2021-10-18T16:04:43 Revert "Revert "Translator: Remove the SH_VALIDATE flag"" This reverts commit 701e8892f45e6f416dcbb0d23a155d346d0280fa. Reason for revert: Chromium dependency fixed in http://crrev/c/3214440 Original change's description: > Translator: Remove the SH_VALIDATE flag > > The SH_VALIDATE flag is a noop, defined as zero (0). > > Also move option descriptions up in the file. > > Bug: angleproject:6501 > Change-Id: I898106eb68b4508d8f94534cbff66652a69f4f3e > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3207360 > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Cody Northrop <cnorthrop@google.com> Bug: angleproject:6501 Change-Id: I4d1514d6ac04e5bedf3624facf8e9339828fa291 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3229955 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 57b73c07 2021-10-14T15:51:18 Vulkan: SPIR-V Gen: TODO clean up This change removes a number of stale TODOs. Bug: angleproject:4889 Change-Id: If21d55717e61383ffdd58a7f88da5961988e035f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3223643 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi b3d77208 2021-10-14T15:38:51 Vulkan: SPIR-V Gen: Make unfolded constants SPIR-V constants If a constant is not folded by the translator, for example because it's an array, this change makes sure that it becomes a constant in SPIR-V anyway. This is particularly important to support cases where a constant is required, for example as argument to textureGatherOffsets(). Bug: angleproject:4889 Bug: angleproject:5362 Change-Id: Ic43e4be13a8917bb100ea64902ba90048cfbb9ee Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3223642 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
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>
Steven Noonan 01341f94 2021-10-11T19:26:07 D3D11: implement EXT_clip_control This implements EXT_clip_control for the D3D11 renderer, so that I can use a reversed-Z depth buffer with ANGLE. Tested with angle_deqp_gles2_tests.exe --deqp-egl-display-type=angle-d3d11 --deqp-case=dEQP-GLES2.functional.clip_control.* and angle_end2end_tests.exe --gtest_filter=*D3D11* Bug: angleproject:6554 Change-Id: I1d11cd04a6654c28530b11104470f0cad0009abe Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3218659 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi bcc89703 2021-10-07T11:26:42 Translator: Remove disableValidateFunctionCall from transformation This validation is disabled in three transformations and re-enabled afterwards. Two of these benefit from the simplicity it brings, and this change removes it from the other transformation. Bug: angleproject:6506 Change-Id: I946b547ed0e2ed39062914a7771e9635ff5e406d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3212289 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Tim Van Patten 4349703b 2021-10-06T11:00:53 Compiler: Remove unnecessary TODO Remove the TODO related to removing the global pool allocator, since that work won't be chased any further. For more details in this area, see: http://anglebug.com/1286 Bug: angleproject:6497 Change-Id: Ie9952e1c0e481c8d553cfdcf4a1d8ded8b64a95b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3208510 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Tim Van Patten <timvp@google.com>
Lingfeng Yang 9ba5dcf6 2021-10-07T06:56:14 Vulkan: Fix inconsistency in half render area width/height The half render area rotation matrix should be removed. DrawableArea is constant over rotations. The frag coord rotation matrix is still needed because the frag coord generated by GPU is still rotated. Test: DISPLAY=:0 out/Debug/angle_deqp_gles3_rotate90_tests Using test config with: linux nvidia debug vulkan prerotation prerotation270 Test: Cuttlefish SwANGLE ./cts-tradefed run cts -m CtsDeqpTestCases -t dEQP-GLES3.functional.shaders.builtin_variable.fragcoord_xyz Bug: angleproject:6504 Change-Id: I37a6308fdb7586200b19a6138affc78c2c329a96 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3212427 Commit-Queue: Lingfeng Yang <lfy@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Yuly Novikov 701e8892 2021-10-08T02:56:38 Revert "Translator: Remove the SH_VALIDATE flag" This reverts commit 4ca3d7d64388f043dab688d536776495df40532d. Reason for revert: breaks roll into Chromium crrev.com/c/3213239 SH_VALIDATE is used in gpu_unittests. Original change's description: > Translator: Remove the SH_VALIDATE flag > > The SH_VALIDATE flag is a noop, defined as zero (0). > > Also move option descriptions up in the file. > > Bug: angleproject:6501 > Change-Id: I898106eb68b4508d8f94534cbff66652a69f4f3e > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3207360 > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Cody Northrop <cnorthrop@google.com> Bug: angleproject:6501 Change-Id: Ia9983eac58a07e2a6e3d5fe4d1bfccfb9c48ccd0 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3212709 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Cody Northrop 4ca3d7d6 2021-10-05T23:10:09 Translator: Remove the SH_VALIDATE flag The SH_VALIDATE flag is a noop, defined as zero (0). Also move option descriptions up in the file. Bug: angleproject:6501 Change-Id: I898106eb68b4508d8f94534cbff66652a69f4f3e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3207360 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Cody Northrop <cnorthrop@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>
Kyle Piddington 54d4bfe5 2021-09-28T17:27:57 Update ANGLE Metal to Webkit at Sept 29 2021 This commit merges changes from Webkit into ANGLE upstream. The following commits were used: Current: https://git.webkit.org/?p=WebKit.git;a=commit;h=e01d0bda8f4b7dc2fd834b92802d15d8c15735f Previous: https://git.webkit.org/?p=WebKit.git;a=commit;h=492f078198748e8ff248eea0bb979cf79e5f5adfj The following commits were merged in from the Webkit Repository: (Hashes from git://git.webkit.org/WebKit-https.git) 03ea44c78ce5665d4ec9add271260121cbc7bc6c Problems with drawElements in some conditions https://bugs.webkit.org/show_bug.cgi?id=230107 c8dc8e0c4d1109d39a62eb197b45e95132380290 ANGLE Metal: single-component swizzles do not compile https://bugs.webkit.org/show_bug.cgi?id=230472 7285dbaaf5af15877d6c332b30ef7a4d67225460 webgl-compressed-texture-s3tc-srgb.html fails on Intel+AMD Metal https://bugs.webkit.org/show_bug.cgi?id=229941 4c72f92967ecd2a095666fef431384c4f5f60fb4 fragcolor-fragdata-invariant.html fails https://bugs.webkit.org/show_bug.cgi?id=223317 cd943145467f54e5928793c0dd3dfa2313c007dd ANGLE Metal index buffer restart range cache could be maintained.. https://bugs.webkit.org/show_bug.cgi?id=227451 f075ff77e592eabd54dd659a8e13617cc5faedc8 ANGLE Metal infinities and NaNs generated with incorrect syntax https://bugs.webkit.org/show_bug.cgi?id=229439 5862073269122f4b2d43d96d3922757557755e86 [Metal ANGLE] Fix over-autorelease of rx::DisplayMtl::getMetalDeviceMatchingAttribute()... <https://webkit.org/b/229128> 85f797ad31db048cb82cbafd428ef77f0b839312 ANGLE Cocoa compiles.... https://bugs.webkit.org/show_bug.cgi?id=228987 a67918ba279ad4842b6ae84a79c3f1c0cdc35ace Avoid infinite recursion... https://bugs.webkit.org/show_bug.cgi?id=228978 d341f67de0033adcf1ec6373ace6a54b06c4a031 Cherry-pick ANGLE: Revise WebGL's shaderSource validation https://bugs.webkit.org/show_bug.cgi?id=228951 1e2714d981e97de8234ba055570dfdf56e8b6944 3.5 MB system-wide footprint impact due to thread-locals... https://bugs.webkit.org/show_bug.cgi?id=228240 d32e5cca34081997d32504b0b56c18b9703ff3be Build Default Metal library offline https://bugs.webkit.org/show_bug.cgi?id=227333 33702279faccfd4c8d1c8a6d549925f9ca9a4e8f WebGL2 demo doesn't work due to failing compilation.... https://bugs.webkit.org/show_bug.cgi?id=226865 0a075885d242db38c4e435a6597173dc3b082173 rAF driven WebGL submits excessive amount of GPU work... https://bugs.webkit.org/show_bug.cgi?id=227059 f38a92b3e7c17efda269caa7066e7ffe2f828e72 WebGL shader link error in iOS 15 beta: "Internal error..." https://bugs.webkit.org/show_bug.cgi?id=227723 98d48f011d561531470d97f26a022767b5452fb7 REGRESSION (r279466): [Big Sur] webgl/1.0.3/conformance &... https://bugs.webkit.org/show_bug.cgi?id=227596 Bug: angleproject:6471 Change-Id: I07166d0dc4b5c3579d98353485b3245b81c7b882 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3194322 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Kyle Piddington <kpiddington@apple.com>
Kyle Piddington d3764f08 2021-09-30T13:46:15 Fix dEQP.GLES3/functional_fragment_out_array* on Direct to Metal Fragment arrays with locations assigned were not being correctly transformed. Fix ModifyStruct to handle the changing location when locations are set Bug: angleproject:6477 Change-Id: Icbacd50e265abdbaff3be230b2ec201eaa868a14 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3198807 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 32d6e806 2021-09-24T23:50:54 Vulkan: Fix rotation of interpolateAtOffset interpolateAtOffset's offset was multiplied by flipXY*rotationMatrix, which is a vector. This was unable to actually apply rotation to the offset. The multiplier is changed to a matrix. Can be tested by running interpolate_at_offset*default_framebuffer tests in deqp gles3.1 together with pre-rotation: ./angle_deqp_gles31_tests --deqp-case=dEQP.GLES31/functional_shaders_multisample_interpolation_interpolate_at_offset_no_qualifiers_default_framebuffer --emulated-pre-rotation=90 Bug: angleproject:5843 Change-Id: I9727371375e999f07463b69153df3fd8b28c2a71 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3183108 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Kenneth Russell da3db87e 2021-07-06T14:00:58 Upstream latest changes to Metal backend from Apple to 7/1/2021 This CL merges in the ANGLE changes between these two WebKit commits: https://git.webkit.org/?p=WebKit.git;a=commit;h=8648b353ab1d7730438c2e08319e1a4d64982c31 https://git.webkit.org/?p=WebKit.git;a=commit;h=166e4924a52971d6a32ad48247a439b16c00e062 Include provoking vertex buffer out of bounds fix from https://bugs.webkit.org/show_bug.cgi?id=230107 Fix bad merge of resetting of dirty bits, breaking DepthStencilFormatsTest.DepthTextureRender test and perhaps others. Disable GL_APPLE_clip_distance when the direct-to-Metal compiler is active. It can not yet handle the gl_ClipDistance array. Disable use of rectangular textures for IOSurfaces. Metal can bind IOSurfaces to 2D textures, and this was passing all tests in the SPIR-V Metal backend. Introducing rectangular textures breaks the SPIR-V Metal backend, and the tests currently fail on the direct-to-Metal backend. Fix several bugs with ProvokingVertex, which was causing both the SpirV and Direct backends to incorrectly draw indices. (https://bugs.webkit.org/show_bug.cgi?id=230107) Skip the following tests on the Metal backend which is still failing RobustResourceInitTestES3.BlitDepthStencilAfterClearBuffer GLSLTest_ES3.GLVertexIDIntegerTextureDrawArrays/ES3_Metal With these changes, angle_end2end_tests again runs to completion. Bug: angleproject:6395 Change-Id: I3cc58f531426a95fc8f177a4ad87f56c1855a546 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3167010 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Kyle Piddington <kpiddington@apple.com>
Shahbaz Youssefi 1a0a0764 2021-09-27T12:56:57 Translator: Fix outputting anonymous struct types Anonymous struct types have an "empty" symbol name, so instead of outputting their name, it's specified that they are anonymous. Bug: chromium:1253208 Change-Id: Ic70767ba32bda6ceb214dfc3d0b4928173665d81 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3187810 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@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>
Gregg Tavares 6106da49 2021-09-22T16:18:21 Indent Generated GLSL Before: in vec4 _ua_position; void main(){ (gl_Position = vec4(0.0, 0.0, 0.0, 0.0)); (gl_Position = _ua_position); } layout(shared) uniform _uG{ float _ufoobar; } _ug; struct _uS { int _ufoo; float _ubar; }; layout(shared) uniform _uT{ _uS _us; float _um; } _ut; float _ufunc(in _uS _ustructVar){ return _ustructVar._ubar; } out vec4 _uoutColor; void main(){ float _uv = 0.0; for (int _ui = 0; (_ui < _ut._us._ufoo); (++_ui)) { int _uk = 0; while ((_uk < _ut._us._ufoo)) { (_uv += _ufunc(_ut._us)); if ((_uv > 100.0)) { break; } else { (_uv += 5.0); } switch (_uk) { case (0): (_uv += 3.0); break; case (1): (_uv += 1.0); break; default: (_uv -= 2.0); break; } } } (_uoutColor = (vec4(_uv) + vec4(_ug._ufoobar))); } After: in vec4 _ua_position; void main(){ (gl_Position = vec4(0.0, 0.0, 0.0, 0.0)); (gl_Position = _ua_position); } layout(shared) uniform _uG{ float _ufoobar; } _ug; struct _uS { int _ufoo; float _ubar; }; layout(shared) uniform _uT{ _uS _us; float _um; } _ut; float _ufunc(in _uS _ustructVar){ return _ustructVar._ubar; } out vec4 _uoutColor; void main(){ float _uv = 0.0; for (int _ui = 0; (_ui < _ut._us._ufoo); (++_ui)) { int _uk = 0; while ((_uk < _ut._us._ufoo)) { (_uv += _ufunc(_ut._us)); if ((_uv > 100.0)) { break; } else { (_uv += 5.0); } switch (_uk) { case (0): (_uv += 3.0); break; case (1): (_uv += 1.0); break; default: (_uv -= 2.0); break; } } } (_uoutColor = (vec4(_uv) + vec4(_ug._ufoobar))); } Bug: angleproject:6428 Change-Id: Ica25151e68eb0defd85a3b6241db442d8eb84743 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3177339 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@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>
Kyle Piddington f6616c71 2021-09-14T17:42:22 Reimplement transform feedback on direct-to-Metal backend Connect the Transform Feedback code generation from Webkit ANGLE to the shader specialization code. Bug: angleproject:6393 Change-Id: I090c44c6ee97e8e0af8c38433bfb74c2080784f9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3161455 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Gregg Tavares <gman@chromium.org> Commit-Queue: Kenneth Russell <kbr@chromium.org>
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>
Alexis Hetu 158ef351 2021-09-15T13:40:28 Fix integer overflow in BlockLayoutEncoder BlockLayoutEncoder::mCurrentOffset's computation had the possibility of causing integer overflows in multiple places, so this CL adds CheckedNumeric variables in a number of these occurrences in order to prevent integer overflows and causing issues. The issue in this case was an integer overflow causing the code in ValidateTypeSizeLimitations.cpp to use an invalid result from "layoutEncoder.getCurrentOffset()", which ended up compiling a shader which would later cause an OOM error. Bug: chromium:1248665 Change-Id: I688d669f21c6dc2957e43bdf91f8f8f08180a6f7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3163356 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexis Hétu <sugoi@chromium.org>
Shahbaz Youssefi 9112b1a9 2021-09-13T15:39:53 Vulkan: SPIR-V Gen: Fix precision of findMsb In GLSL, findMsb operates on a highp operand, while returning a lowp result. In SPIR-V, RelaxedPrecision cannot be applied on the FindSMsb instruction as that affects the operand as well. This change makes sure RelaxedPrecision is not applied to a FindSMsb instruction. Bug: angleproject:4889 Bug: angleproject:6132 Change-Id: I6a0defbbd53ec703c7ecbad5cd5c79d215b11c32 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3158506 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Gregg Tavares 9c6f6c39 2021-09-10T14:46:18 nullptr_t to std::nullptr_t The Skia build requires std::nullptr_t Bug: angleproject:6377 Change-Id: Ic41955e1dfefcf24bc39240d164ad938f523717c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3154997 Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Gregg Tavares <gman@chromium.org>
Gregg Tavares 2795866c 2021-09-10T02:08:40 Fix ConvertUnsupportedConstructorsToFunctionCalls The code was not hanlding nested expressions. For example: mat4(vec4(mat2x2), ...) Switched to using TIntermRebuild Bug: angleproject:5505 Change-Id: I845d94326324ac48d7489225d42d0c6e38622492 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3152168 Commit-Queue: Kenneth Russell <kbr@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Gregg Tavares 958dce52 2021-09-09T14:36:37 Move IntermRebuild.h/cpp to tree_util Bug: angleproject:5505 Change-Id: I7b68057fff0a0eb0d86c1aed01599fa9dbb7db3b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3152167 Commit-Queue: Gregg Tavares <gman@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 13e9817b 2021-09-08T11:57:00 Translator: Fix assert in ScalarizeVecAndMatConstructorArgs This transformation assumed that precision can be derived for constants in every possible scenario, but that's not true. The fuzzer produced the following code: void main() { mat4 m; mat2(0, bvec3(m)); } In the above, the constant 0 legimitately has no precision. The assert was in a function that attempted to make a temporary out of the constant, which this commit changes to use the original constant as-is. Bug: chromium:1246781 Change-Id: I6f247264e5213cfd9449fdfb1dc312d02b99f2f1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3149191 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Gregg Tavares fa9f4cf3 2021-09-08T12:58:59 Fix AST validation error with gl_FragCoord Bug: angleproject:6370 Change-Id: Ia575e0329da74c84365b74b39398551b572b91a5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3149725 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Gregg Tavares <gman@chromium.org>
Gregg Tavares c9acd799 2021-09-07T22:25:23 Only rewrite constructors for scalars/vectors/matrices Bug: angleproject:5505 Change-Id: I50b3a9a585b2eec6e4d7bd9b3197206a973d4400 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3147071 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Gregg Tavares <gman@chromium.org>
Shahbaz Youssefi 8b2fd983 2021-09-08T11:36:17 Translator: Fix validation failure in RemoveDynamicIndexing This transformation adds function definitions to the tree after the fact, so function call validation is disabled until the transformation is complete. Bug: chromium:1246686 Change-Id: I40f77cb25cf272d5ebc42ece572371ce5161e819 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3148850 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 0bb3fcbb 2021-09-07T14:28:09 Translator: Fix precision of gl_PointSize on ES3+ In ESSL100, gl_PointSize is declared as mediump. In ESSL300+, it's declared as highp. Bug: angleproject:4889 Bug: angleproject:6132 Change-Id: Ie904a12fdaaca04e2507f1796d9d0fe34b154eab Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3145615 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi ae555e85 2021-09-05T21:43:03 Translator: Fix uninitialized TStructure::mAtGlobalScope This flag was not set in SeparateDeclarations when creating a struct. Bug: chromium:1246301 Change-Id: I673a7158bcc8ead0fd36a5b00696dd990950a8c0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3139663 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@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>
Tim Van Patten 8bb3c827 2021-07-22T19:06:40 Fix Multithreaded eglDestroyContext()/eglTerminate() The following EGL calls can lead to a crash in eglMakeCurrent(): Thread A: eglMakeCurrent(context A) Thread B: eglDestroyContext(context A) B: eglTerminate() <<--- this release context A Thread A: eglMakeCurrent(context B) The eglMakeCurrent(context B) call will assert when attempting to unMakeCurrent(), since thread A doesn't know that context A was already destroyed by thread B. To fix this: 1.) A Context will only be released once there are no Threads that currently have a reference to it (no longer have the Context current). - Context::mIsCurrent is being removed, since it was inaccurate and not thread-safe. For example, when eglTerminate() was called, the eglTerminate()'ing-Thread would "steal" the Context that was current on another Thread to destroy it. 2.) A Display will only be fully terminated and its resources released once all Contexts have been destroyed and are no longer current. Otherwise, Display::terminate() will return if any Contexts are still in use by a Thread. EGL 1.5 Specification 3.2 Initialization If contexts or surfaces, created with respect to dpy are current (see section 3.7.3) to any thread, then they are not actually destroyed while they remain current. If other resources created with respect to dpy are in use by any current context or surface, then they are also not destroyed until the corresponding context or surface is no longer current. With this fix, the app com.netmarble.sknightsmmo can start. This also exposed an issue with GlslangFinalize(), since glslang can only be initialized/finalized once per process. Otherwise, the following EGL commands will call GlslangFinalize() without ever being able to GlslangInitialize() again, leading to crashes since GlslangFinalize() cleans up glslang for the entire process. dpy1 = eglGetPlatformDisplay() | eglInitialize(dpy1) | GlslangInitialize() dpy2 = eglGetPlatformDisplay() | eglInitialize(dpy2) | GlslangInitialize() eglTerminate(dpy2) | GlslangFinalize() eglInitialize(dpy1) | isInitialized() == true Since Display::isInitialized() == true, the rest of Display::initialize() is skipped and GlslangInitialize() is not called. Later, the next test that attempts to compile a program will crash due to glslang no longer being initialized. Finally, this exposed the following tests leaking EGLContext handles: - EGLSurfaceTest::initializeContext() - EGLContextSharingTest.DisplayShareGroupContextCreation - EGLCreateContextAttribsTest.IMGContextPriorityExtension - EGLMultiContextTest.TestContextDestroySimple Other tests were failing to reset the context, preventing the Display from being terminated since there were still references to Contexts owned by the display: eglMakeCurrent(dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); Bug: angleproject:6208 Bug: angleproject:6304 Bug: angleproject:6322 Test: EGLContextSharingTest.EglTerminateMultiThreaded Test: EGLContextSharingTestNoFixture.EglDestoryContextManyTimesSameContext Test: Load com.netmarble.sknightsmmo Change-Id: I160922af93db6cabe0ed396be77762fa8dfc7656 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3046961 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi fefbc3fb 2021-09-01T16:26:20 Vulkan: SPIR-V Gen: Re-fix precision of constructors In f3aea7447eae7f5a4a5ad1425ab375b66048ba3f, the precision of constructors was changed such that it would be derived from its operands, but also be able to be promoted based on neighboring operands. Based on https://gitlab.khronos.org/opengl/GLSL/-/issues/58 this is incorrect, and indeed the precision of the constructor (when possible) solely depends on its own operands. Bug: angleproject:4889 Bug: angleproject:6132 Change-Id: Ic2560d17973f56d4d836e3c7112d6649197a306c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3138534 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Gregg Tavares e02753fc 2021-08-31T21:09:45 Convert constructors to function calls where needed. MSL does not do as many conversions between types and has more strict constructors than GLSL so convert to function calls where necessary. Fixes: GLSLTest_ES3.AmbiguousConstructorCall2x2/ES3_Metal GLSLTest_ES3.AmbiguousConstructorCall2x3/ES3_Metal GLSLTest_ES3.ConstructMatrixFromNonFloat/ES3_Metal GLSLTest_ES3.ConstructNonFloatVectorFromMatrix/ES3_Metal GLSLTest_ES3.ScalarConstructor/ES3_Metal UniformBufferTest.Std140UniformBlockWithRowMajorQualifier/ES3_Metal UniformBufferTest.Std140UniformBlockWithPerMemberRowMajorQualifier/ES3_Metal UniformBufferTest.Std140UniformBlockWithPerMemberColumnMajorQualifier/ES3_Metal UniformBufferTest.Std140UniformBlockWithRowMajorQualifierOnStruct/ES3_Metal SimpleUniformTest.FloatMatrix2UniformStateQuery/ES2_Metal SimpleUniformTest.FloatMatrix2UniformStateQuery/ES3_Metal SimpleUniformTest.FloatMatrix3UniformStateQuery/ES2_Metal SimpleUniformTest.FloatMatrix3UniformStateQuery/ES3_Metal SimpleUniformTest.ArrayOfMat3UniformStateQuery/ES2_Metal SimpleUniformTest.ArrayOfMat3UniformStateQuery/ES3_Metal UniformTestES3.MatrixArrayUniformStateQuery/ES3_Metal Bug: angleproject:6306 Change-Id: Iea8a9a261f94f121f482c2ea9678192ca056570c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3134963 Commit-Queue: Gregg Tavares <gman@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Kenneth Russell <kbr@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>
Shahbaz Youssefi f3aea744 2021-08-25T22:09:58 Vulkan: SPIR-V Gen: Fix precision of constructors According to the spec, constructors don't have a precision (and thus their precision is derived from the operands they are used in. Bug: angleproject:4889 Bug: angleproject:6132 Change-Id: I557386764abf5493fbe59803dc8e260312c04b48 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3119352 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi fbdd0516 2021-08-27T00:04:11 Vulkan: SPIR-V Gen: Fix precision of imageLoad According to the spec, imageLoad should return highp. However, glslang produces the same precision as the image (which makes more sense). This seems to be a spec bug per the discussion in this issue: https://gitlab.khronos.org/opengl/GLSL/-/issues/57 This change aligns ANGLE with glslang w.r.t to the precision of imageLoad. Bug: angleproject:4889 Bug: angleproject:6132 Change-Id: Ia0ce493a0deab21810458da6b48fdf51dfbd41a2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3122317 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
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>
Gregg Tavares 4c56534f 2021-08-25T15:56:59 Include globals when defering global initializers Fixes these tests: GLSLTest.StructWithInitializer/ES2_Metal GLSLTest.StructWithInitializer/ES3_Metal GLSLTest.StructWithUniformInitializer/ES2_Metal GLSLTest.StructWithUniformInitializer/ES3_Metal GLSLTest_ES3.SequenceOperatorEvaluationOrderDynamicVectorIndexingInLValue/ES3_Metal WebGL2GLSLTest.InitUninitializedLocals/ES3_Metal Bug: angleproject:5505 Change-Id: Ib8258898c60b9e9ffbb71f0024f8189dc6cf4d5b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3120093 Commit-Queue: Gregg Tavares <gman@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Shahbaz Youssefi 9c271645 2021-08-27T13:07:06 Vulkan: SPIR-V Gen: Fix gl_PerVertex without clip/cull support When the clip/cull distance extension is not supported, the gl_ClipDistances and gl_CullDistances arrays were given a size of 0, which made them translate as OpRuntimeArray. This change makes sure that these arrays always have a non-zero size. Bug: angleproject:4889 Change-Id: I8d2ffe3a7c1df9316e91eebc2aa53bdc2c87ccc1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3123354 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi f9d261f5 2021-08-25T10:23:48 Translator: Don't promote precision from initializer Take the following GLSL code: precision mediump float; uniform highp float u; float x = u; When `x` is declared, its precision is mediump due to `precision mediump float`. Its initializer (`u`) however is highp. Previously, ANGLE generated the following code to ensure the precision of the initializer is applied to the variable: highp float x = u; Compiling the same code with glslang and looking at the SPIR-V (both SPIR-V for OpenGL and SPIR-V for Vulkan), such a promotion is not done. The generated SPIR-V is equivalent to: mediump float x = u; This change aligns ANGLE's output with glslang's by outputting the precision of the variable itself instead of the precision of the assignment (which is highp due to promotion from the two operands). Bug: angleproject:4889 Bug: angleproject:6132 Change-Id: I6f338a865c0a7710329fc13bc171fd245dd30b31 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3118965 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 3408ea3e 2021-08-24T11:41:42 Translator: Fix precision of gl_FragCoord on ES3+ In ESSL100, gl_FragCoord is declared as mediump. In ESSL300+, it's declared as highp. Bug: angleproject:4889 Bug: angleproject:6132 Change-Id: I42583d07fb745421f195be95fa404c617227b02e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3116307 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: 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>
Shahbaz Youssefi a08b667d 2021-08-24T12:13:23 Translator: Stabilize autogenerated builtin function parameters When pruning the list of builtin function parameters, sorted() is used to stabilize the result. This makes reviews of changes to the autogenerated output easier. Bug: angleproject:4889 Change-Id: I97afc31de2a62b34a0a8183bb5a47eab9e62d9fc Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3116306 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Gregg Tavares 411137bf 2021-08-24T11:46:51 Emit INFINITY for infinite constants GLSL had `v = 1.0e40` which was output as `v = inff` in MSL. Changed to output `v = INFINITY`. Fixes Tests: GLSLTest_ES3.LiteralInfinityOutput/ES3_Metal GLSLTest_ES3.LiteralNegativeInfinityOutput/ES3_Metal Bug: angleproject:5505 Change-Id: Ib651583e608351784dcd49d602a23b5ecb8475cb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3116548 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org> Commit-Queue: Gregg Tavares <gman@chromium.org>
Shahbaz Youssefi 210773db 2021-08-05T10:41:59 Translator: Be more explicit about precisions GLSL ES requires that every symbol (variable, block member, function parameter and return value) is appropriately qualified with a precision, either individually or through the global precision specifier. Some tree transformations however produced symbols with EbpUndefined precision. In text GLSL output, these would produce unqualified symbols which was often incorrect. In this change, the transformations are made to produce explicit / more consistent precisions. The validation (that caught these issues) is not included in this change as there are still a few corner cases left to address. Bug: angleproject:4889 Bug: angleproject:6132 Change-Id: Icca8a0a5476f8646226e7243aa8f501f44acc164 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3075127 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
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>
Jamie Madill 49af677a 2021-08-16T07:59:18 Capture/Replay: Update serialization logic. - Uses more common toString methods instead of custom ones. - Uses enum to string in more places intsead of numeric enums. - Adds missing group scopes in several places. - Skips serializing empty image levels. Bug: angleproject:5133 Change-Id: I2c9523981aba4ec0afb5f0623cb34154db263e6b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3097805 Reviewed-by: Gert Wollny <gert.wollny@collabora.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Gregg Tavares 5ca0953d 2021-08-18T13:22:22 Use the correct attribute locations in Metal Fixes these tests: BlendIntegerTest.MRTSigned/ES3_Metal BlendIntegerTest.MRTUnsigned/ES3_Metal DrawBuffersTest.Gaps/ES3_Metal DrawBuffersTest.BlendWithGaps/ES3_Metal DrawBuffersTest.FirstAndLast/ES3_Metal DrawBuffersTest.FirstHalfNULL/ES3_Metal DrawBuffersWebGL2Test.TwoProgramsWithDifferentOutputsAndClear/ES3_Metal WebGLCompatibilityTest.DrawBuffers/ES3_Metal Bug: angleproject:5505 Change-Id: I9ea82a8c7a0c5bbc78eb69eb92552909e3f437f3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3105439 Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Kenneth Russell <kbr@chromium.org>
Gregg Tavares 63bb0e53 2021-08-16T16:30:32 Add depth fix to convert from GL to Metal Vertex shaders need to convert from GL's -1 to +1 z range to Metal's 0 to +1 z range with: z = (z + w) * 0.5 This code is being upstreamed from WebKit. It fixes these end to end tests. BlitFramebufferTest.MultisampleDepthClear/ES3_Metal BlitFramebufferTest.MultisampleDepthClear/ES3_Metal_NoStencilOutput BlitFramebufferTest.BlitDepthStencilPixelByPixel/ES3_Metal BlitFramebufferTest.BlitDepthStencilPixelByPixel/ES3_Metal_NoStencilOutput ClearTest.ClearStencilMask/ES2_Metal ClearTest.ClearStencilMask/ES3_Metal ClearTestES3.ClearMultipleAttachmentsIndividually/ES3_Metal ClearTestES3.MaskedClearHeterogeneousAttachments/ES3_Metal ClearTestES3.ScissoredClearHeterogeneousAttachments/ES3_Metal ClearTestES3.ClearBufferivStencilMask/ES3_Metal ClearTestES3.ClearBufferfiNoStencilAttachment/ES3_Metal MaskedScissoredClearTest.Test/ES2_Metal__clear_s MaskedScissoredClearTest.Test/ES2_Metal__clear_s_mask_s MaskedScissoredClearTest.Test/ES2_Metal__scissored_clear_s_mask_s MaskedScissoredClearTest.Test/ES2_Metal__clear_d MaskedScissoredClearTest.Test/ES2_Metal__scissored_clear_d MaskedScissoredClearTest.Test/ES2_Metal__clear_ds MaskedScissoredClearTest.Test/ES2_Metal__scissored_clear_ds MaskedScissoredClearTest.Test/ES2_Metal__clear_ds_mask_s MaskedScissoredClearTest.Test/ES2_Metal__scissored_clear_ds_mask_s MaskedScissoredClearTest.Test/ES2_Metal__clear_cs MaskedScissoredClearTest.Test/ES2_Metal__clear_cs_mask_s MaskedScissoredClearTest.Test/ES2_Metal__scissored_clear_cs_mask_s MaskedScissoredClearTest.Test/ES2_Metal__clear_cd MaskedScissoredClearTest.Test/ES2_Metal__scissored_clear_cd MaskedScissoredClearTest.Test/ES2_Metal__clear_cds MaskedScissoredClearTest.Test/ES2_Metal__scissored_clear_cds MaskedScissoredClearTest.Test/ES2_Metal__clear_cds_mask_s MaskedScissoredClearTest.Test/ES2_Metal__scissored_clear_cds_mask_s MaskedScissoredClearTest.Test/ES2_Metal__clear_cs_mask_cs MaskedScissoredClearTest.Test/ES2_Metal__scissored_clear_cs_mask_cs MaskedScissoredClearTest.Test/ES2_Metal__clear_cd_mask_c MaskedScissoredClearTest.Test/ES2_Metal__scissored_clear_cd_mask_c MaskedScissoredClearTest.Test/ES2_Metal__clear_cds_mask_c MaskedScissoredClearTest.Test/ES2_Metal__scissored_clear_cds_mask_c MaskedScissoredClearTest.Test/ES2_Metal__clear_cds_mask_cs MaskedScissoredClearTest.Test/ES2_Metal__scissored_clear_cds_mask_cs MaskedScissoredClearTest.Test/ES3_Metal__clear_s MaskedScissoredClearTest.Test/ES3_Metal__clear_s_mask_s MaskedScissoredClearTest.Test/ES3_Metal__scissored_clear_s_mask_s MaskedScissoredClearTest.Test/ES3_Metal__clear_d MaskedScissoredClearTest.Test/ES3_Metal__scissored_clear_d MaskedScissoredClearTest.Test/ES3_Metal__clear_ds MaskedScissoredClearTest.Test/ES3_Metal__scissored_clear_ds MaskedScissoredClearTest.Test/ES3_Metal__clear_ds_mask_s MaskedScissoredClearTest.Test/ES3_Metal__scissored_clear_ds_mask_s MaskedScissoredClearTest.Test/ES3_Metal__clear_cs MaskedScissoredClearTest.Test/ES3_Metal__clear_cs_mask_s MaskedScissoredClearTest.Test/ES3_Metal__scissored_clear_cs_mask_s MaskedScissoredClearTest.Test/ES3_Metal__clear_cd MaskedScissoredClearTest.Test/ES3_Metal__scissored_clear_cd MaskedScissoredClearTest.Test/ES3_Metal__clear_cds MaskedScissoredClearTest.Test/ES3_Metal__scissored_clear_cds MaskedScissoredClearTest.Test/ES3_Metal__clear_cds_mask_s MaskedScissoredClearTest.Test/ES3_Metal__scissored_clear_cds_mask_s MaskedScissoredClearTest.Test/ES3_Metal__clear_cs_mask_cs MaskedScissoredClearTest.Test/ES3_Metal__scissored_clear_cs_mask_cs MaskedScissoredClearTest.Test/ES3_Metal__clear_cd_mask_c MaskedScissoredClearTest.Test/ES3_Metal__scissored_clear_cd_mask_c MaskedScissoredClearTest.Test/ES3_Metal__clear_cds_mask_c MaskedScissoredClearTest.Test/ES3_Metal__scissored_clear_cds_mask_c MaskedScissoredClearTest.Test/ES3_Metal__clear_cds_mask_cs MaskedScissoredClearTest.Test/ES3_Metal__scissored_clear_cds_mask_cs DepthStencilFormatsTest.DepthTextureRender/ES2_Metal DepthStencilFormatsTest.DepthBuffer16/ES2_Metal DepthStencilFormatsTest.DepthBuffer24/ES2_Metal DepthStencilFormatsTest.VerifyDepth32UploadData/ES2_Metal DepthStencilFormatsTest.VerifyDepth16UploadData/ES2_Metal TinyDepthStencilWorkaroundTest.DepthTexturesStick/ES3_Metal DiscardFramebufferEXTTest.ClearDepthThenDrawWithDepthTestThenDiscard/ES2_Metal DiscardFramebufferEXTTest.ClearDepthThenDrawWithDepthTestThenDiscard/ES3_Metal Bug: angleproject:5505 Change-Id: I9b52bb46569678636afc6a243bfa8779f101b6af Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3097161 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Kenneth Russell <kbr@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>
Kenneth Russell 1654537d 2021-08-06T17:49:52 Fix default and driver uniforms' binding indices. These abstractions were introduced in the SymbolTable during upstreaming of the direct-to-Metal compiler and were accidentally swapped, leading to widespread test failures. Fix the comment reference in ContextMtl's DriverUniforms struct. Add missing emulatedInstance field, and add a TODO about its missing support in direct-to-Metal translator. Define it in SPIR-V Metal translator; the driver uniforms for the two must match. Bug: angleproject:6259 Change-Id: I0330ab4efca5b64a749b9cca90564fdbc84d7a80 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3078998 Commit-Queue: Kenneth Russell <kbr@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Kenneth Russell d191bc32 2021-08-06T12:59:39 Reintroduce TType::isRank0. This concept was used in the direct-to-Metal compiler, and its replacement with isScalar wasn't completely correct. Fixes several assertion failures in tests. Bug: angleproject:4889 Bug: angleproject:5505 Change-Id: I9b8800ed50591560c8e53faa81eca581c4f07a02 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3078474 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Kenneth Russell <kbr@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 0cd99779 2021-08-05T10:35:10 Translator: Propagate precision to children nodes Similarly to glslang, when the precision of a node is determined, propagate that precision to any of its children that doesn't already have a precision. Ultimately these should only include TIntermConstantUnion nodes. Bug: angleproject:4889 Bug: angleproject:6132 Change-Id: I121231d04c7cf92fc3f07716019ffe88eca48b88 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3075126 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 2e8a2d3c 2021-08-04T11:04:44 Translator: Helpers to derive precision Bug: angleproject:4889 Bug: angleproject:6132 Change-Id: I75e2084c76139ccb24b266f262d5e5597d8aa4ca Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3071599 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 061188a7 2021-08-04T10:07:47 Translator: General clean up General clean up done as part of other changes, split to simplify review. Bug: angleproject:4889 Bug: angleproject:6132 Change-Id: Iade9954d187a759be9edd0e3754be007f4133c56 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3071598 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 6fe91881 2021-08-02T11:13:13 Translator: Simplify RecordConstantPrecision Just before ESSL output, this transformation made some constants specified through temp variables such that their precision can be specified. This was done in cases where the precision actually affected the expression being evaluated. This transformation is simplified by declaring constants more conservatively as variables, and not stringently attempting to identify whether that's necessary. This is still not done in trivial cases. This change is in preparation for another change that overhauls precision propagation through the nodes. This change removes all references to TIntermTyped::getPrecision() outside the precision promotion code itself. Bug: angleproject:4889 Change-Id: I135b2b3241aa2f76219b209241c3844f1d09ccd2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3067948 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 798c5200 2021-07-31T22:17:48 Translator: Make precise-ness a property of AST nodes Instead of creating a "set of precise nodes", the nodes themselves are marked precise. This change is preparation for another change that overhauls precision propagation through the nodes, and which would also be storing the promoted precision in the nodes. Bug: angleproject:4889 Change-Id: Ieec8864be5cd2e95ed6fb4d90b367946d9f33fa1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3065569 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@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 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>
Brandon Schade 217acac2 2021-07-21T12:42:56 Vulkan: Add support for EXT_primitive_bounding_box 1. Added support for EXT_primitive_bounding_box extension 2. Renamed shader variable gl_BoundingBoxEXT[] to ANGLEBoundingBox[] Bug: angleproject:3576 Test: dEQP-GLES31.functional.primitive_bounding_box.* Change-Id: I15fa9af50c6fd8e86d225670ddd8eb39f6e65d35 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3053618 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: 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>