src/libANGLE/renderer/metal/mtl_render_utils.mm


Log

Author Commit Date CI Message
Geoff Lang 8f76a7eb 2023-06-20T16:15:22 Metal: Use the pipeline cache for RenderUtils compute shaders This ensures that all pipelines created in the Metal backend are stored in the single pipeline cache. Bug: chromium:1329376 Change-Id: I99db93426acb3467be41d1fca5238b34553f6684 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4628680 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Quyen Le <lehoangquyen@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Alexey Knyazev 817f4b81 2023-07-10T00:00:00 Restrict color writemasks for RGB9_E5 color buffers Per-channel write operations to shared exponent color buffers are loosely defined and may cause driver validation errors. Restricted the set of allowed color writemasks for RGB9_E5 color buffers so that RGB channels must be either all enabled or all disabled. Added a Metal-specific adjustment to ignore alpha writemask for RGB9_E5 color buffers. Removed an unused function from RenderPipelineColorAttachmentDesc. Bug: angleproject:8043 Change-Id: I902c3b70ddc6d8e65069d98a4a02a82122f413a5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4685566 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Geoff Lang fbf9e3c7 2023-06-12T16:58:04 Metal: Use the per-context pipeline cache for RenderUtils The various RenderUtils classes created hundreds of RenderPipelineCache objects which did not reliquish their pipelines for the life of the Display. Hook them into the per-context PipelineCache so that they share the total pipeline limit with programs. Make RenderUtils fully RAII and store it in a unique_ptr in DisplayMtl. Remove RenderPipelineCache. Bug: chromium:1329376 Change-Id: I265e4e05fd3fd1da34932de36803cfe977f1f6a0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4607153 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Quyen Le <lehoangquyen@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Geoff Lang 7f9e9fce 2023-06-12T15:02:58 Metal: Remove copy constructors in various util classes By using a different array initializer in RenderUtils, the copies are not neccessary. Bug: chromium:1329376 Change-Id: Iec98a31741457f8d76a84f0340772167d7b9700a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4607151 Reviewed-by: Quyen Le <lehoangquyen@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Kenneth Russell aea88562 2023-05-19T16:52:43 Reland "Metal: Optimized BufferSubData per device" This reverts commit ee64836f702332adaca58d9f452063a04b2da955 , relanding the patch stack described there. Between patchsets 1 and 5: - The shadow buffer allocation has been replaced with a multimap of precisely-sized buffers, rather than rounding up buffer sizes. - Garbage collection of shadow buffers is triggered in three situations: - A certain number of context switches have occurred; this number was hand-tuned to avoid GC every frame. - A certain number of command buffer submissions has occurred; this number was hand-tuned to GC no more often than every few seconds on representative workloads. - The total size of the allocated shadow buffers is more than 1 MB, and either more than twice the size at the last garbage collection, or 64 MB more than at the last garbage collection. In this case, aggressive GC is performed in order to reclaim shadow buffers more quickly. Performance before and after these changes appears identical on microbenchmarks. On one Figma test case, comparing GPU memory allocated inside the BufferManager, peak consumption is decreased by over 75%, and steady-state consumption decreases by over 88%. Patchset 6 adds a needed workaround for a bug in the AMDMTLBronzeDriver affecting uploads of client-side data, and therefore some dEQP tests. It also streamlines the aggressive GC. Bug: angleproject:7544 Change-Id: I81b061f0b33c27fa403527fa12d626f4e9c88ebe Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4497413 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Geoff Lang ae6b2d11 2023-04-25T14:23:30 Metal: Gracefully fail compilation of stencil blit shaders. ANGLE only supports stencil blits on Metal 2.1 and greater. Generate useful error messages and fail the blit gracefully when these shaders are not supported instead of asserting/crashing. Bug: chromium:1385510 Change-Id: I11df34d38f203c1498164def274135d8f1d14635 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4476346 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Quyen Le <lehoangquyen@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Kenneth Russell ee64836f 2023-02-11T17:56:06 Revert "Metal: Optimized BufferSubData per device" This reverts commit 968041b54770af8917001d8fe9b52a881cfed0b2. Includes the following patches: git revert -n 995db1f66bcf87fc9e47d908fb2a885e810d2567 \ 9a6c90c8f802b4d107a081bfccaf4be007e7af54 \ dbd47e378582ef86db52c7379cd220cf0b2c8193 \ 369b320f92f54774879e8b8faff834fc8db0793e \ 4abae6f97586448712e2dc1cced4a678b0901d7b \ 968041b54770af8917001d8fe9b52a881cfed0b2 Several conflicts with top-of-tree were resolved during this revert. The aim is to reland this with additional code which will reduce the amount of excess buffer memory allocated, and release the resources associated with temporary buffer allocations. Bug: angleproject:7544 Change-Id: Ib7a6bc2ab1c2f23cb43112cd980106e2898c3826 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4240556 Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Gregg Tavares <gman@chromium.org> Commit-Queue: Kenneth Russell <kbr@chromium.org>
Gregg Tavares 968041b5 2022-08-19T12:11:23 Metal: Optimized BufferSubData per device Adds a staging buffer path which means there are 4 paths for bufferSubData. 1. direct copy * get a pointer to the buffer * copy the new data to the buffer * if the buffer is managed, tell metal which part was updated 2. use a shadow copy * copy the data to a shadow copy * copy the entire shadow to a new buffer * start using the new buffer 3. use a new buffer * get a new buffer (or unused) * put the new data in the new buffer * blit any unchanged data from the old buffer to the new buffer * start using the new buffer 4. use a staging buffer * get a staging buffer * put the new data in the staging buffer * blit from the staging buffer to the existing buffer. Further, there are 3 types of memory storage modes. Managed, Staged, Private. Based on the GPU type different storage modes and different paths in different sitatutions are more performant. So, add feature flags to select paths by GPU. Bug: angleproject:7544 Change-Id: I741dd1874201043416374194bd2001ded8dbd9b4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3842641 Reviewed-by: Kyle Piddington <kpiddington@apple.com> Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Quyen Le <lehoangquyen@chromium.org> Commit-Queue: Gregg Tavares <gman@chromium.org>
Geoff Lang 6ddbfa39 2022-05-09T09:06:16 Metal: Log the shader source when a shader fails to translate Refactor Metal logging to include a message string. Bug: chromium:1322521 Change-Id: I3a7b5c36fcf140b3664ad96a9da924819326bf94 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3634725 Reviewed-by: Quyen Le <lehoangquyen@chromium.org> Commit-Queue: Kenneth Russell <kbr@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Shahbaz Youssefi fcec6904 2022-04-13T14:18:06 Generate feature variable names from display names The json file now only contains the feature display name. The variable name is automaticaly derived. For consistence with Chromium and other Chromium-based projects, the display name is now always snake_case, and that's what's specified in the json files. This also makes camelCase variable name generation trivial (as opposed to the other way around). Feature overrides now accept both snake_case and camelCase names to ensure compatibility with existing scripts. This is done by removing _ and comparing override names with feature names in lower case. Bug: angleproject:6435 Change-Id: I0b6ed2bbf5c312bc4f4be7b3c7d55dbaca2a9886 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3584630 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Kimmo Kinnunen 624e3c3d 2021-12-17T15:30:54 Fix dangerous use of AutoObjCPtr after ownership identity change Metal new* methods create objects with +1 retain count. AutoObjCPtr is intended to adopt this reference. Otherwise, like before this patch, the AutoObjCPtr holds object with +2 count. Before this patch, some but not all call sites donated the extra retain count to autoreleasepool "out of band", and as such the code did not leak that much. Bug: angleproject:6831 Change-Id: I72bcbc712f2cadbcbc6148c6aedfa7e151314518 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3347641 Reviewed-by: John Cunningham <johncunningham@apple.com> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Kimmo Kinnunen ede0b8b7 2021-12-17T14:35:47 Avoid ANGLE_MTL_AUTORELEASE inside ASSERT, it leaks on Release Avoid ANGLE_MTL_AUTORELEASE inside ASSERT, it leaks on Release. The create functions already return retained, instead of autoreleasepool retained, so owning the reference via adopting AutoObjCObj is as efficient as autoreleasepool on possible future ARC. Thus use AutoObjCObj, that is safer than autoreleasepool with C++ and works towards being able to perhaps remove use of autoreleasepool. Bug: angleproject:6830 Change-Id: I80f523d9a6846097a593fe94b5ea9715fa88ea15 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3347640 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: John Cunningham <johncunningham@apple.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
John Cunningham 42bd4fc2 2021-12-10T14:58:17 Metal: add ANGLE_metal_create_context_ownership_identity. This Metal-specific EGL extension allows a given context and the GPU resources it allocates to be associated with a particular task ID on the system, for system-level bookkeeping purposes. Bug: angleproject:6795 Change-Id: I19ee0993564169b01c4a450e63dcfacd339b98b5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3335172 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Kenneth Russell <kbr@chromium.org>
Gregg Tavares a0924015 2021-11-22T19:44:05 Metal:Fix GLSLTest_ES3.GLVertexIDIntegerTextureDrawElements Metal The test was failing if the "first" argument to glDrawElements was odd. When odd the offset was not a multiple of 2 bytes and the code was going down a different path than when the offset was event. The fix for that just removes a check for alignment to 4 bytes. Checking with UNSIGNED_BYTE indices though and it still failed. That was because it was encoding the index conversion path on one command buffer and the provoking index prep on another and so they were happening out of order. Putting both on the same command buffer fixes that. Bug: angleproject:6688 Change-Id: I89b68ba965d073e0fa70b6d5b444dc743b5e34a7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3296631 Commit-Queue: Gregg Tavares <gman@chromium.org> Reviewed-by: Kyle Piddington <kpiddington@apple.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Gregg Tavares 20ddb802 2021-10-28T11:01:12 Fix Blitting in Metal backend. The Metal backend was clipping in integer space. If the src and dst are not the same size, say src is 3 wide and dst is 4 wide, and src starts at -1, then src will be clipped by one making the src 2 wide. It got 1/3 smaller so the dst get 1/3 smaller making it 2.666 pixels wide. The dst then needs to be expanded to pixels so 3 wide. But, that means the src also needs to be expanded 0.3333 * 3(originalSrcWidth) / 4(originalDstWidth) so its new left edge is -0.245 which is not an integer. Bug: angleproject:6598 Change-Id: I2faa966b18b457f474a3e7f6844ef64bfa66dbe8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3251683 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Kyle Piddington <kpiddington@apple.com> Commit-Queue: Gregg Tavares <gman@chromium.org>
Kyle Piddington fab88343 2021-10-07T15:02:35 WebGL Aquarium doesn't render with ANGLE Metal Blits should not be using the context's write mask, this leads to missed color information on blits. Bug: chromium:1257769 Change-Id: Iaf4ff00a727b1bec2424b4d3939fddd4c802a8ea Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3212644 Reviewed-by: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Kyle Piddington <kpiddington@apple.com>
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>
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>
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>
Alexey Knyazev 9bc86c50 2020-10-13T13:26:08 Metal: Implement OES_draw_buffers_indexed Bug: angleproject:2634 Bug: angleproject:4394 Change-Id: Id6e6c6bdea2b1ff3d974e92e067ed63e1b4e4582 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2465919 Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Le Hoang Quyen <le.hoang.q@gmail.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Le Hoang Quyen cb6176f3 2020-09-29T01:08:00 Metal: Support tri-fan & line-loop with primitive restart Triangle fan: - If primitive restart is NOT enabled and there is no active render pass, use Compute Shader to generate indices. - If primitive restart is enabled, use CPU to generate indices. Line loop: - If draw non-instanced without primitive restart, generate and draw only one additional last segment (fastest). - If draw instanced, primitive restart is NOT enabled, and there is no active render pass, use Compute Shader to generate indices (OK). - Otherwise, use CPU to generate indices (slowest). Also Disable OcclusionQueriesTest.ClearNotCounted failure on NVIDIA. Bug: angleproject:2634 Bug: angleproject:5307 Change-Id: Ia5529825807a964f5fcb2a4af8844778896cd42a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2435859 Commit-Queue: Le Hoang Quyen <le.hoang.q@gmail.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Le Hoang Quyen 8a50b42b 2020-10-24T19:29:12 Metal: Convert index & vertex format on GPU when possible. - When converting vertex buffer: - if there is no render pass active, use compute shader to convert. - if there is a render pass active and device supports explicit memory barrier then convert the buffer in vertex shader with direct buffer write and insert a memory barrier. - if there is a render pass active and device doesn't support explicit memory barrier then convert the buffer on CPU. Bug: angleproject:2634 Change-Id: I5346e3a2adb855f40e46a3912d9db404a4482e0f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2434025 Commit-Queue: Le Hoang Quyen <le.hoang.q@gmail.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Le Hoang Quyen 80d4901a 2020-09-26T19:22:00 Metal: Support integer textures. Bug: angleproject:2634 Bug: angleproject:5154 Change-Id: Iffea26fe2c683557b4fa7c13fddf3523294b47d4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2433329 Commit-Queue: Le Hoang Quyen <le.hoang.q@gmail.com> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Le Hoang Quyen 119d867c 2020-09-26T18:27:39 Metal: autogen blit & clear shaders for integer textures Bug: angleproject:2634 Change-Id: I20d0bf3fca354a7964ce5893a605ab72a8a9012d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2433328 Commit-Queue: Le Hoang Quyen <le.hoang.q@gmail.com> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Le Hoang Quyen 0e5e6078 2020-09-26T23:31:24 Metal: Use MipmapNativeLevel class to store native mip lvl This is to avoid wrong native level in Metal, for example, not taking into account the OpenGL base level. Bug: angleproject:2634 Change-Id: I3a7a3ac41bdbd91a47755bb4ca11bd579c182e04 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2433326 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Le Hoang Quyen bdecaf33 2020-08-04T20:16:27 Metal: Implement PBO. Bug: angleproject:2634 Change-Id: I77f085227298bf46361825d1886e04830dc9987a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2336558 Commit-Queue: Le Hoang Quyen <le.hoang.q@gmail.com> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Le Hoang Quyen 50704dc3 2020-08-04T12:08:00 Metal: Implement EXT_occlusion_query_boolean. - Metal's occlusion(called visibility) query operates per render pass. Implementation details are in src/libANGLE/renderer/metal/doc/OcclusionQueries.md. - New tests: - OcclusionQueriesTest.ClearNotCounted. - OcclusionQueriesTest.MultiQueries (failure on OpenGL/D3D11 back-end). Bug: angleproject:2634 Change-Id: Idd1327b5472d0e8c2b69307a7f04a1da4a847a40 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2336121 Commit-Queue: Le Hoang Quyen <le.hoang.q@gmail.com> Reviewed-by: back sept 10 - Jamie Madill <jmadill@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Le Hoang Quyen 91004654 2020-08-25T01:08:00 Metal: Implement ANGLE_robust_resource_initialization. Bug: angleproject:4929 Bug: angleproject:2634 Change-Id: Ib99b810059420e69d939f1bbb644c2b95de62850 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2374826 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Le Hoang Quyen a4f706b2 2020-08-04T12:08:00 Metal: Use compute to generate 3D texture's mipmap. - Metal's built-in blit based mipmap generator doesn't use box filtering. Hence manual generation using compute is needed. - Compute based mipmap gen can generate up to 4 mips per pass if the base level is power of 2. - This approach can be extended to 2D/cube texture's mipmap generation in future. Bug: angleproject:4921 Bug: angleproject:2634 Change-Id: I7f997669fe39afef075b2bca2406e9424cbb3016 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2336120 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Le Hoang Quyen <le.hoang.q@gmail.com>
Le Hoang Quyen 4f247baf 2020-08-23T22:58:56 Metal: Implement EXT_draw_buffers & ANGLE_framebuffer_blit Bug: angleproject:2634 Change-Id: I769ca7e113e660870e9b31dafb706c313db8ac24 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2332146 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Le Hoang Quyen defeda29 2020-08-04T12:08:00 Metal: autogen for EXT_draw_buffers & ANGLE_framebuffer_blit Bug: angleproject:2634 Change-Id: I8f8ee91fb673301b8bd97c359ee39c411e2bf8da Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2336124 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Le Hoang Quyen 663075ac 2020-07-31T01:54:45 Metal: Fix Intel's LOD clamp and blit shader's filtering. 1. Setting max LOD clamp = FLT_MAX via setSamplerState caused mipmap tests failure on Intel. It always picked wrong mipmap level during texture sampling. Fix: Use value from SamplerState::getMaxLod() instead. 2. Also set default linear filtering for blit shader's sampler. Previously there was no sampler set for this shader. It caused black fragments on Intel. This CL is a prerequisite for enabling end2end tests on Intel & Metal. Bug: angleproject:4133 Bug: angleproject:4915 Bug: angleproject:2634 Change-Id: I9e6b669712a294e09ab692a3c65f3956a799ef8b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2329089 Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Le Hoang Quyen 9277ee74 2020-07-06T12:40:58 Metal: Implement MSAA default framebuffer. GL_SAMPLE_COVERAGE_VALUE is implemented by inserting gl_SampleMask writing logic to fragment shader. New test added: MultisampleTest.ContentPresevedAfterInterruption. - Skip on D3D11 (Bug: angleproject:4609) Bug: angleproject:2634 Change-Id: Ib44daf0baccc36ea320596d81713156047da059c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2281783 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Le Hoang Quyen 113c5e29 2020-05-11T22:49:03 Metal: deferred render command encoder creation. MTLRenderCommandEncoder creation will be deferred until a render pass ends. Commands will be stored into a back-end owned buffer during render pass. At the end of the render pass, those commands will be re-encoded into an actual MTLRenderCommandEncoder. Benefits: - Useful for future implementation of occlusion query buffer where it could be allocated right before the end of a render pass to be big enough to store all queries within the render pass. - It's possible to change load option (deferred clear) as long as there is no draw call issued yet. This is not implemented yet. - Possibility of commands' re-ordering. Bug: angleproject:2634 Change-Id: I1348716aa882c0540d9120bf175d8dac13fb58bd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2193196 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Le Hoang Quyen ab372311 2020-05-14T23:27:06 Metal: refactor RenderUtils to split into multiple util classes. This is useful for later modifications where blit/clear could be further categorized based on texture format type (float/integer). Bug: angleproject:2634 Change-Id: I877abd21761af9e91657686a60e189a43a33e3f4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2193195 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Le Hoang Quyen c0c938af 2020-05-11T00:50:00 Metal: draw 1 triangle instead of 2 for fullscreen shaders. Reference article in favour of one big triangle instead of 2: https://michaldrobot.com/2014/04/01/gcn-execution-patterns-in-full-screen-passes/ According to this article, the performance could be increased by ~10% for fullscreen shaders. Bug: angleproject:2634 Change-Id: Ia5b04c40f0587e3cb8680c0f30f7b68d9d7a3efe Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2193192 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Le Hoang Quyen 3e1e1087 2020-05-11T00:50:00 Metal: Use 2d array for caching index conversion's pipeline state. For index conversion utils, use 2d array for caching compute pipeline state based on DrawElementsType & source offset is aligned or not, instead of using std::map as previously. Also moved default shader's initialization to DisplayMtl. New test added: IndexBufferOffsetTest.DrawAtDifferentOffsetAlignments Bug: angleproject:2634 Change-Id: I1bd77aca88e03229ef8053e32add66733e33b06e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2192569 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Le Hoang Quyen ab42afa6 2019-11-21T10:13:44 Metal: fix vertex attribute's conversion lost after changing buffer binding. After vertex buffer's attribute is converted and stored in conversion buffer. Binding the same attribute to another buffer, then binding it back to previous buffer will result in previous conversion information lost. The conversion method would skip the conversion due to buffer's content hadn't been changed, however it didn't reuse the old conversion result. This CL also changed the way binding offset is used in Metal backend. - Previous, the offset would be assigned to the offset field of MTLVertexAttributeDescriptor, then the buffer would simply be bound to the command encoder with offset=0 i.e. setVertexBuffer(buffer, index, 0) - However this approach has several disadvantages. Since Metal doesn't allow MTLVertexAttributeDescriptor's offset to be larger than the vertex attribute's stride, the old approach would force the back-end to convert the attribute and store in conversion buffer. New approach: - MTLVertexAttributeDescriptor's offset will be zero. The offset will be used to bind the buffer itself to the render command encoder. i.e. setVertexBuffer(buffer, index, offset) This way the "offset <= stride" restriction no longer exists. The only restriction is the offset must be multiple of attribute's size. Added 3 new tests: - SimpleStateChangeTest.RebindTranslatedAttribute - VertexAttributeTest.DrawWithLargeBufferOffset - VertexAttributeTest.DrawWithLargeBufferOffsetAndLessComponents Bug: angleproject:2634 Change-Id: I6c2fa8091436e4a24405d791f86d17d97df02d64 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1940009 Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Le Hoang Quyen 405d4cf3 2019-11-09T02:28:49 Metal: multiple bug fixes - ContextMtl: triangle fan draws should call setupDraw() with original parameters. Not the modified parameters. - SurfaceMtl: should initialize metal layer's drawableSize after layer's creation. - TextureMtl & FrameBufferMtl: Fix texture copySubImage CPU path incorrectly copied unflipped area. - mtl_render_utils: Fix wrong variable name used for trifan compute pipeline cache table. - mtl_resources: Fix texture & buffer memory leaks due to missing ANGLE_MTL_AUTORELEASE. - mtl_utils: Fix viewport flipping error due to arithmetic between unsigned & signed values. These bugs were discovered during dEQP tests running. Bug: angleproject:2634 Change-Id: Ie01380910ab68a2b876718d9dac0b5b4c41b607c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1906608 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Le Quyen fe26bae4 2019-10-29T18:38:53 Metal backend implementation pt 2 This is without Metal specific shader translator implemented yet. Bug: angleproject:2634 Change-Id: I95d589442251c9ba111bd05a2dc379a36739046c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1855069 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>