src/compiler/translator/TranslatorMetalDirect.h


Log

Author Commit Date CI Message
Shahbaz Youssefi 02e7f967 2023-05-25T14:54:49 Translator: Remove the "variables" option Variable collection is invariably enabled by the front-end as well as other major users of ANGLE such as Firefox. All translator backends except GLSL force-enable variable collection either way. This change removes this compile option and enables variable collection unconditionally. The flag itself remains in ShCompileOptions until references to it are removed from Chromium. Bug: chromium:1447314 Change-Id: I4d3b30c1bfbd345c5ad269abc62c0a6a59de2f56 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4568524 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Alexey Knyazev 7bc4b7e3 2023-03-27T00:00:00 Metal: Implement OES_sample_variables New ESSL built-ins are mapped to their Metal counterparts and tweaked to follow OpenGL ES semantics when needed. Fixed A2C interaction with sample coverage by emulating the former on non-Apple GPUs. Bug: angleproject:8097 Fixed: angleproject:5087 Change-Id: I5d28a941af5cbc14743a3930731529f11f55febd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4404896 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Kyle Piddington <kpiddington@apple.com> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Alexey Knyazev ba845fcf 2023-03-20T00:00:00 Metal: Implement EXT_clip_control * Skipped vertex shader depth correction when clip depth mode is set to GL_ZERO_TO_ONE. * Adjusted front face mode and pre-fragment vertical flip driver uniform based on the clip origin state. * Added more clip control end2end tests. * D3D11: Fixed scissored draws with upper-left clip origin. Fixed: angleproject:8065 Change-Id: Ife82fa2ad39fad463c23ec10b49bff409272ebf2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4356661 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Kyle Piddington <kpiddington@apple.com>
Alexey Knyazev 8c2fcc70 2023-02-02T00:00:00 Metal: Implement EXT_blend_func_extended Fixed: angleproject:8015 Change-Id: Ic92a8823869bf097349aee6241f6cfb86942c945 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4242128 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Kyle Piddington <kpiddington@apple.com>
Chris Dalton a4db9477 2022-10-06T10:35:39 Implement pixel local storage with metal::read_write textures Metal's programmable blending feature isn't available on non-Apple Silicon, so on these devices we have to polyfill pixel local storage using read_write textures, which can also be coherent if raster_order_groups are supported. This change leverages the existing PLS transformation to images, and implements just enough shader image functionality in Metal to support the pixel local storage usecase. Missing shader image features are marked with UNIMPLEMENTED(). Bug: angleproject:7279 Bug: angleproject:7792 Bug: angleproject:7794 Bug: angleproject:7797 Bug: angleproject:7803 Change-Id: Ia96a714693d352d57351a1bae4f45437dde000e4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3993363 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Quyen Le <lehoangquyen@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app> Reviewed-by: Kyle Piddington <kpiddington@apple.com>
Chris Dalton 2d31fe98 2022-09-22T21:04:22 Implement PLS on Apple Silicon Implements a subset of EXT_shader_framebuffer_fetch in the Metal translator that is sufficient to support pixel local storage. Metal's "programmable blending" feature is available on all Apple family GPUs beginning with version 2. Support for non-Apple GPUs will come later via readWrite textures, which can also be coherent by annotating them with [[raster_order_goup(0)]]. Bug: angleproject:7279 Change-Id: Ic74f6c0d21e87eb919e1f487163388d08d126857 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3916794 Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app> Reviewed-by: Gregg Tavares <gman@chromium.org>
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>
Eddie Hatfield 91976352 2022-06-21T15:41:02 Use C++17 attributes instead of custom macros Bug: angleproject:6747 Change-Id: Iad6c7cd8a18d028e01da49b647c5d01af11e0522 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3718999 Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 2df17a12 2022-05-25T16:18:37 Vulkan: Pack driver uniforms Previously 5 vec4s were used for driver uniforms + 2 vec4s if specialization constants couldn't be supported. The driver uniforms are rearranged and packed such that only 2 vec4s are normally used, which include fallback for specialization constants as well. In the future, most of the specialization constants may turn into uniforms, and this change prepares for that. Additional uniforms are used (3 vec4s) only if common extensions are missing; transform feedback and bresenham lines. This change makes it more practical for driver uniforms to be turned into push constants. Additionally, these uniforms could potentially be loaded and cached at the beginning of the shader for more efficient memory access. On Pixel6, with this change, the traces show no difference in wall time. On most traces, CPU time shows up to ~7% improvement. Bug: angleproject:7366 Change-Id: I0f47f863955af06a19c69d1f1d7c45b97d95476e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3668151 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@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>
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>
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>
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>
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>
Kyle Piddington d33a2222 2021-04-26T16:56:15 Upstream Apple's direct-to-Metal backend: compile libANGLE. This change is meant to merge the metal backend changes from Apple's direct-to-Metal backend. Taken from Kyle Piddington's CL: https://chromium-review.googlesource.com/c/angle/angle/+/2857366/ The goal of this CL is to merge the metal backend code in a state that compiles, but not to switch the Metal backend over to using the direct-to-metal backend yet. Bug: angleproject:5505 Bug: angleproject:6127 Change-Id: If6783e06e0086b3a1dd25c6f53caca5cfc96cb86 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2950067 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Kyle Piddington d7aa0130 2021-04-26T16:56:15 Upstream Apple's direct-to-Metal backend: compile translator. This change is meant to merge the translator changes from Apple's direct-to-Metal backend. Taken from Kyle Piddington's CL: https://chromium-review.googlesource.com/c/angle/angle/+/2857366/ The goal of this CL is to merge the translator code in a state that compiles, but not to switch the Metal backend over to use this translator backend yet. Bug: angleproject:5505 Change-Id: I68a6354604498cd5fd1eb96c13fc56f3b38f2bd0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2897536 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>