src/libANGLE/renderer/metal


Log

Author Commit Date CI Message
Alexey Knyazev e6c8f06a 2024-11-29T00:00:00 Metal: Remove line markers from internal shaders Line markers generated by Clang preprocessor are platform-dependent and cause extra git noise. Metal shader compiler does not need them anyway. Fixed: angleproject:382564808 Change-Id: I792a523ac9269a097c7f52a4cd64a24ed6145567 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6074518 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Quyen Le <lehoangquyen@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Panfeng Hou a504b6a2 2024-11-25T15:59:05 Support GL_OES_required_internalformat Enable GL_OES_required_internalformat GLES extension. Bug: angleproject:364069034 Change-Id: Ia57548469abff189472aa20b13ca99179c45f2c0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6038448 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Panfeng Hou <panfeng.hou@arm.com>
Kimmo Kinnunen 4aaeffd8 2024-11-25T11:33:30 Metal: Limit simulator texture size to 8k Regressed in commit d44204893a1725a74cd20b332fbb6f595b0975c3. Bug: angleproject:380712807 Change-Id: Ic5e298412b35451e87b76f70d5b1b253ed1406cb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6039222 Reviewed-by: Quyen Le <lehoangquyen@chromium.org> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com>
Alexey Knyazev 239ef680 2024-11-21T00:00:00 Metal: Support ANGLE_texture_multisample * Added explicit multisample texture creation support * Added support for SAMPLE_MASK frontend state * Adjusted Metal backend caps Fixed: angleproject:380475003 Change-Id: I90250e14da52869cb954b5a61d9c670e958a526c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6048958 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Kimmo Kinnunen 8e9dc1a6 2024-11-19T11:08:31 Validate anonymous struct names with namespace Consider GLSL: struct { vec4 e; } g; struct sbbf { vec4 f; }; The struct name validation would fail if user chosen struct name would clash with a symbol name that ANGLE internally gave to an anonymous struct. Fix by importing Name abstraction from MSL backend. A symbol name is a pair (namespace, string). Move operator<<(std::ostream &os, const ImmutableString &str) to sh namespace because that is more natural for operator overloading name resolution. MSVC works with this. Bug: angleproject:379758201 Change-Id: Icc9b02aa8cb532e1d925e2fba4c45468f01b9144 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6035029 Reviewed-by: Geoff Lang <geofflang@chromium.org> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com>
Kimmo Kinnunen a402f9cb 2024-11-11T15:08:41 Metal: Do not use number digit separator in .mm The review system turns ' to strings for Obj-C syntax highlighting. Bug: angleproject:378421872 Change-Id: I201f6561def7c4b945f37e3e02ec0b8915954e8e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6011209 Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Kimmo Kinnunen eb614d7e 2024-11-11T13:24:35 Metal: Avoid leaking library and binary sources Reland: Fix build with metal_internal_shader_compilation_supported = false Fix leak of dispatch_data during binary load. The dispatch object was not released. Dispatch objects are Obj-C objects, so hold with AutoObjCPtr. Fix leak of MTLLibrary objects when creating the objects. The method newLibraryWithData returns +1 due to being "new" type method. This ref must be adopted. Avoid using autoreleased objects, use AutoObjCPtr. Some leaks regressed in commit c5ab1cebccaab0f8de466e5f797faa3d5a84bea5. Bug: angleproject:351165323 Change-Id: I08bc6bcb787cdc3f71e9487d80a44e24b01b6b4c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6017845 Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Solti Ho b2d84a66 2024-11-12T20:14:48 Revert "Metal: Avoid leaking library and binary sources" This reverts commit 6359ec111595c57e6be04b0468ca866f91593f2f. Reason for revert: https://chromium-review.googlesource.com/c/angle/angle/+/6011208/comments/c1453ef2_2c6a5e49 Original change's description: > Metal: Avoid leaking library and binary sources > > Fix leak of dispatch_data during binary load. The dispatch object > was not released. Dispatch objects are Obj-C objects, so hold with > AutoObjCPtr. > > Fix leak of MTLLibrary objects when creating the objects. > The method newLibraryWithData returns +1 due to being "new" type > method. This ref must be adopted. > > Avoid using autoreleased objects, use AutoObjCPtr. > > Some leaks regressed in c5ab1cebccaab0f8de466e5f797faa3d5a84bea5. > > Bug: angleproject:351165323 > Change-Id: If23859fbddd21693d923f66f6fb015eed494f06e > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6011208 > Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> > Commit-Queue: Geoff Lang <geofflang@chromium.org> > Reviewed-by: Geoff Lang <geofflang@chromium.org> Note: the revert merges the changes of https://crrev.com/c/6011902 Bug: angleproject:351165323 Change-Id: Iec1a14c8043e0883190723edf7302127c27f2de4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6013090 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Kimmo Kinnunen f5b9e0ed 2024-11-11T16:06:30 Metal: Query MSL print env var with bool getter Use angle::GetBoolEnvironmentVar. Bug: angleproject:378404988 Change-Id: I45778690e215325e9e4eb67c6feefa9b17941f49 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6011902 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com>
Kimmo Kinnunen 6359ec11 2024-11-11T13:24:35 Metal: Avoid leaking library and binary sources Fix leak of dispatch_data during binary load. The dispatch object was not released. Dispatch objects are Obj-C objects, so hold with AutoObjCPtr. Fix leak of MTLLibrary objects when creating the objects. The method newLibraryWithData returns +1 due to being "new" type method. This ref must be adopted. Avoid using autoreleased objects, use AutoObjCPtr. Some leaks regressed in c5ab1cebccaab0f8de466e5f797faa3d5a84bea5. Bug: angleproject:351165323 Change-Id: If23859fbddd21693d923f66f6fb015eed494f06e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6011208 Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Lichen Liu d4420489 2024-10-25T08:53:17 Add check for iOS simulator when initializing caps in metal On Intel-arch MacBook, the system API [supportsFamily:MTLGPUFamilyApple3] returns false on the iOS simulator, causing maxVertexOutputComponents to be set to 60, which is below than the required value of 64, resulting in WebGL2 initialization failure on chromium iOS. Add a TARGET_OS_SIMULATOR check to ensure the values of caps can be set correctly in the siumulator environment. Bug: angleproject:375244081 Change-Id: Iafc44a2aa62130b09127bbec7ea6940506a4165c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5961039 Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Kimmo Kinnunen 4397ff2f 2024-10-25T16:55:30 Metal: SeparateCompoundStructDeclarations fails validation Consider GLSL: struct S { int i; } s; s=s; SeparateCompoundStructDeclarations would rewrite this to: struct S { int i; }; S s'; s=s; The interm rewrite would rewrite the specification and declaration of s, but not the use sites. The use sites would use the old type, and thus something that was not in the tree anymore. This would fail the validation. This kind of bug was previously fixed for SeparateDeclarations in commit 18fa02bebf901dd8501de3176f6052ae4ce984be. Fix by adding the logic to SeparateDeclarations, as it is already doing almost the exact task, separating `struct S { ..} a, b`. The separation is tested in GLSLTests.StructInShader and various other draw tests. These pass with MSL, but these would also fail validation if that was enabled. Bug: angleproject:375523825 Change-Id: I1697103d0ba47616dbd3159f36f9e71cb2831c4b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5964899 Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Kimmo Kinnunen 12584049 2024-10-21T14:04:55 Make SimplifyLoopConditions testable Add ShCompileOptions::simplifyLoopConditions, so that tests can turn it on. Later edits to simplify loop condition logic are simpler to review when the testing related edits are landed separately. Test the feature by having ESSL as the input and ESSL as the natural output, to reflect how AST changes. To make the test expectations more deterministic across code changes, change SymbolTable::kLastBuiltInId to SymbolTable::kFirstUserDefinedSymbolId. This is simpler as no code needs to know exact last built in id, so we can just ensure that the user defined symbol ids do not clash with the builtin ids. Bug: angleproject:374585769 Change-Id: Iea0efb8ac2878691d0fd5ff5cfe9a49ac754515d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5946724 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com>
Alexey Knyazev 4aa12e9e 2024-10-07T00:00:00 Metal: Remove macOS 11.0 availability checks Chromium now requires at least macOS 11.0. This also implies MSL 2.3 support. Bug: angleproject:371829506 Change-Id: I6aaf4d9775bfe58747df28173d3931aa11fa8d25 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5912903 Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Le Hoang Quyen 182aa407 2024-08-14T19:52:30 Reland "Metal: translate IOSurface pbuffer's GL_RGB to RGBX/BGRX format." This is a reland of commit f102d75a39ec8980a617c179034c24f337b12d1c Nothing changed, it's just that the root cause was already fixed in https://chromium-review.googlesource.com/c/angle/angle/+/5937060. Original change's description: > Metal: translate IOSurface pbuffer's GL_RGB to RGBX/BGRX format. > > Currently when IOSurface is bound to a pbuffer with GL_RGB internal > format, we asign angle format=B8G8R8A8_UNORM/R8G8B8A8_UNORM to it. > And then disable alpha write to the respective MTLTexture. > > However, when an implicit MSAA texture is created for the above > pbuffer, it will be assigned B8G8R8A8_UNORM/R8G8B8A8_UNORM angle format > but has no knowledge about alpha write disable. Consequently, when a > render pass uses this implicit MSAA texture, its alpha channel won't be > cleared properly and would contain garbage values. > > In order to avoid the above bug, we should use > B8G8R8X8_UNORM/R8G8B8X8_UNORM angle format for the IOSurface pbuffer. > > This will fix the render corruptions found in chromium:358957665. > > Bug: angleproject:42261786 > Bug: chromium:358957665 > Change-Id: I8aa1e24ace2de80dd08e21711445515ba4b339ff > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5788801 > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Commit-Queue: Quyen Le <lehoangquyen@chromium.org> Bug: angleproject:42261786 Bug: chromium:358957665 Change-Id: I1e090886ed493eafce35d2ba98010c3be7bc16c9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5937061 Reviewed-by: Kenneth Russell <kbr@chromium.org> Auto-Submit: Quyen Le <lehoangquyen@chromium.org> Commit-Queue: Quyen Le <lehoangquyen@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Le Hoang Quyen 2b329ee4 2024-10-18T01:37:10 Metal: fix memory leaks in Texture::getStencilView The leaks were because we stored a strong ref to the texture itself in mStencilView member if the texture already has a stencil format. This caused a circular reference preventing the texture from being released. This indirectly caused MSRTT's memory leaks in chromium:374072906 due to MSRTT using getStencilView for blitting step. Bug: chromium:374072906 Change-Id: I8ced300c2da2de1282c623780dd1affd9d45fb05 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5937060 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org> Commit-Queue: Quyen Le <lehoangquyen@chromium.org> Auto-Submit: Quyen Le <lehoangquyen@chromium.org>
Alexey Knyazev 78f146e3 2024-10-14T00:00:00 Remove EAGL support Fixed: angleproject:362530620 Change-Id: I6157655a7ad5b1e30c5d0a155d3ae3e8a81997e8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5938872 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com>
Geoff Lang 5b96316b 2024-10-17T14:00:41 Revert "Metal: translate IOSurface pbuffer's GL_RGB to RGBX/BGRX format." This reverts commit f102d75a39ec8980a617c179034c24f337b12d1c. Reason for revert: Suspecting this caused an GPU memory regression on Mac. Bug: chromium:374072906 Original change's description: > Metal: translate IOSurface pbuffer's GL_RGB to RGBX/BGRX format. > > Currently when IOSurface is bound to a pbuffer with GL_RGB internal > format, we asign angle format=B8G8R8A8_UNORM/R8G8B8A8_UNORM to it. > And then disable alpha write to the respective MTLTexture. > > However, when an implicit MSAA texture is created for the above > pbuffer, it will be assigned B8G8R8A8_UNORM/R8G8B8A8_UNORM angle format > but has no knowledge about alpha write disable. Consequently, when a > render pass uses this implicit MSAA texture, its alpha channel won't be > cleared properly and would contain garbage values. > > In order to avoid the above bug, we should use > B8G8R8X8_UNORM/R8G8B8X8_UNORM angle format for the IOSurface pbuffer. > > This will fix the render corruptions found in chromium:358957665. > > Bug: angleproject:42261786 > Bug: chromium:358957665 > Change-Id: I8aa1e24ace2de80dd08e21711445515ba4b339ff > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5788801 > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Commit-Queue: Quyen Le <lehoangquyen@chromium.org> Bug: angleproject:42261786 Bug: chromium:358957665 Change-Id: I29238588f78f2d01c77a317b2a22670a8036d2e3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5939455 Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Kenneth Russell 831a52f2 2024-10-16T13:46:04 Hold on to error message in LinkTaskMtl as C++ string. Make a copy of the incoming C string because the error message might be dynamically allocated and deallocated by the caller. Bug: angleproject:370425451 Change-Id: If4aaa93a90a1da8bc60f7839e29b705b0d2864e5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5938484 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org> Auto-Submit: Kenneth Russell <kbr@chromium.org>
hoonee.cho 2ee914a4 2024-03-04T06:54:29 CL: Add cl_image_format map autogeneration * Added map JSON files containing CL image formats * Updated ANGLE format table generator to include CL foramts Tests-Passing: GN Build Signed-off-by: hoonee.cho <hoonee.cho@samsung.com> Bug: angleproject:42266936 Change-Id: I2967ea6d26f69223ffa3ca12d469c05a3844200f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5798054 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Rafay Khurram <r.khurram@samsung.com>
Geoff Lang 166b72c9 2024-09-30T19:07:26 GL_ANGLE_blob_cache implementation. Bug: chromium:370538323 Change-Id: Ic51a951e78b48b315e36f518bcc39ff2d54660a6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5900761 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Alexey Knyazev cd10ad46 2024-09-30T00:00:00 Metal: Rework allowSamplerCompareGradient feature * AMD drivers may fail when a sample_compare function is used with explicit derivatives. To avoid such failures, the effective level is computed from the texture size, passed derivatives, and texture coordinates, if needed. The level value is then used for sample_compare instead of the explicit derivatives. * Apple2 GPUs do not support setting texture sampler compare state via Metal API. As a result, all sample_compare functions including those without LOD options do not work on Apple2 GPUs. This feature was attempting to incorrectly emulate a subset of sample_compare functions with a hard-coded compare state. There are no plans to support shadow samplers on Apple2 GPUs, as it would require non-trivial emulation, so this feature is no longer relevant for that platform. * Metal on macOS 10.15 only supports constant zero as the level parameter for sample_compare functions. Ignoring the passed derivatives and using zero LOD on old OS versions is a better fallback than dropping the derivatives altogether because many applications use the derivatives to set the level to zero anyway. Bug: angleproject:365066518 Bug: angleproject:368059227 Change-Id: I4028421b785ae49328b72658e0a9783275461779 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5903970 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Alexey Knyazev a921694b 2024-09-30T00:00:00 Metal: Support EXT_texture_shadow_lod Bug: angleproject:365108862 Change-Id: Ieb0b53253c5d9091e0c74baccf808622d9578d5f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5907407 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Alexey Knyazev d550d96f 2024-09-30T00:00:00 Metal: Remove allowSamplerCompareLod feature * Apple2 GPUs do not support setting texture sampler compare state via Metal API. As a result, all sample_compare functions including those without LOD options do not work on Apple2 GPUs. This feature was attempting to incorrectly emulate a subset of sample_compare functions with a hard-coded compare state. There are no plans to support shadow samplers on Apple2 GPUs, as it would require non-trivial emulation, so this feature is not needed. * Metal on macOS 10.15 only supports constant zero as the level parameter for sample_compare functions. Ignoring the requested level and using zero on old OS versions is a better fallback than dropping the parameter altogether because many applications set the level to zero anyway. Bug: angleproject:365066518 Bug: angleproject:368059227 Change-Id: I2cdc0bda5842842d62ad5663427da7f1f37bddda Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5907619 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Shahbaz Youssefi b16d105f 2024-10-03T10:25:32 Remove Desktop GL front-end support For Desktop GL applications, please use Zink! Bug: angleproject:370937467 Change-Id: Ie734634bb62a2e98c80e1b32d8b3d34624da3c04 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5905428 Reviewed-by: Geoff Lang <geofflang@chromium.org>
Hailin Zhang 8c12874c 2024-09-12T11:26:29 vulkan: add double buffer swapchain for fifo mode. Double buffer swapchain usually drop the performance. But at B* the default fps cap for silver device still at 30fps. This change is for reduce latency. Bug: b/311022968 Change-Id: Ida4044f439bbe3f235d53f5d1d2f945533cbb094 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5858255 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Dan Glastonbury d40d1a67 2024-09-05T14:56:46 Metal: Fix OverrideMTLClearColor handling of no texture It's possible for OverrideMTLClearColor to be called with no texture. This can happen with multiple draw buffers where the bound program executable and framebuffer has incompatible component types. When the render pass is prepared by a drawing command, these incompatible attachments are skipped. As demonstated by the new test case, when switching to the framebuffer that has previously been prepared by such a draw, if the state is clean, the render pass attachments are not updated and |texture| is unavailable for use in determining any emulated clear color. Fixed: angleproject:364687937 Change-Id: I1ec9b564dc8cdb5faf7a1ed0f935d38502ca5514 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5836314 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Dan Glastonbury a0126d55 2024-09-06T11:58:58 Metal: Clear mRenderPassesSinceFlush to avoid infinite recursion When there is more than kMaxRenderPassesPerCommandBuffer render passes with active occlusion query, it's possible for the Metal backend to end up in infinite recursion of the following call sequence: `ensureCommandBufferReady` -> `flushCommandBufferIfNeeded` -> `flushCommandBuffer` -> `endEncoding` -> `endRenderEncoding` -> `prepareRenderPassVisibilityPoolBuffer` -> `getBlitCommandEncoderWithoutEndingRenderEncoder` -> `ensureCommandBufferReady` This recursion is caused by the checks in flushCommandBufferIfNeeded not being disarmed once the flush has started and is most likely caused by |mRenderPassesSinceFlush| exceeding |kMaxRenderPassesPerCommandBuffer|. This change moves the clearing of |mRenderPassesSinceFlush| to the top of of `flushCommandBuffer`, before any calls to `endEncoding`, breaking the need to call `flushCommandBuffer` via `getBlitCommandEncoderWithoutEndingRenderEncoder`. Additionally, |OcclusionQueryPool::mUsed| is set to false before the results are cleared. This will also break the recursion and is added for the `mCmdBuffer.needsFlushForDrawCallLimits` case in `flushCommandBufferIfNeeded`. Change-Id: Ib54c0a87ae9c5365ae56d487b6bef99b681d9f59 Fixed: chromium:362791944 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5839224 Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Kenneth Russell <kbr@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Kimmo Kinnunen edc6d2fc 2024-09-02T19:02:11 Metal: Fix watchOS supports32BitFloatFiltering use Avoid using supports32BitFloatFiltering on watchOS, turns out it is not available. Bug: angleproject:360147119 Change-Id: I9ac7101b72d05e06807ba2d18e0fabe7579f62a5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5830352 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Alexey Knyazev <lexa.knyazev@gmail.com> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Kimmo Kinnunen 8b8b3d4d 2024-09-02T21:04:11 Metal: Flush with NoWait on iOS when hitting renderpass count limits Avoid deviating between iOS and macOS in this regard. The behavior should be the same for the caller as well as the implementation. Bug: chromium:1466696 Bug: angleproject:363984104 Change-Id: I39160bcc0a54ea9c767e1109d80cb4d71ecdf207 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5830799 Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Kimmo Kinnunen 8c211b10 2024-06-20T13:51:20 Metal: Clear depth pbuffers to 1 for robust init Robust resource initialization would init depth pbuffers as 0.0 instead of 1.0. This would differ from the FBO initialization, where the uninitialized depth buffers would be initialized to 1.0. Bug: angleproject:348199042 Change-Id: I0f251e85d6e08ce992fe323b257a0906d237f5b1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5642763 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Quyen Le <lehoangquyen@chromium.org>
Alexey Knyazev e2afdd3c 2024-08-29T00:00:00 Metal: Fix depth/stencil FBO attachments validation Simplified and fixed depth/stencil attachments validation to match Metal behavior; added a new error message. Updated allowSeparateDepthStencilBuffers feature condition to enable it on Apple silicon Macs. Fixed: angleproject:362901599 Change-Id: Ib60020f157976240ebfd652254d63380341cddbd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5823534 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Alexey Knyazev 3f5ede8f 2024-08-20T00:00:00 Metal: Remove obsolete availability macros from context MTLSharedEvent * macOS 10.14 (min deploy 10.15) * iOS/tvOS 12.0 (min deploy 15.0) MTLDevice.hasUnifiedMemory * macOS 10.15 (min deploy 10.15) * iOS/tvOS 13.0 (min deploy 15.0) Bug: angleproject:360147119 Change-Id: I8c7e09b1fd9d16cf2bc9dcdca50a7fe577ad25a2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5816833 Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Alexey Knyazev e39d08b9 2024-08-20T00:00:00 Metal: Remove obsolete code from caps and extensions init MSL 2.1 * macOS 10.14 (min deploy 10.15) * iOS/tvOS 12.0 (min deploy 15.0) MSL 2.2 * macOS 10.15 (min deploy 10.15) * iOS/tvOS 13.0 (min deploy 15.0) Volume BC textures * macOS 10.15 (min deploy 10.15) Depth clipping mode * macOS 10.11 (min deploy 10.15) * iOS/tvOS 11.0 (min deploy 15.0) Dual-source blending * macOS 10.12 (min deploy 10.15) * iOS/tvOS 11.0 (min deploy 15.0) Bug: angleproject:360147119 Change-Id: I00d33d2b6b5c80a305bfbe9316c0ea670b9a4b04 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5814950 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Alexey Knyazev b52f281a 2024-08-20T00:00:00 Metal: Remove unused and obsolete availability macros * Both usages of ANGLE_APPLE_AVAILABLE_XC are obsolete. * ANGLE_APPLE_AVAILABLE_CI and ANGLE_APPLE_AVAILABLE_I are unused. * iOS and tvOS SDK version ranges are supported without redefinitions. * Mac Catalyst is defined in the supported SDK versions. Bug: angleproject:360147119 Change-Id: I8e7730c31f73c03d491373a0a5d316432513d8a2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5817148 Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Alexey Knyazev 2609e02c 2024-08-20T00:00:00 Metal: Remove unused branches from StartFrameCapture The used APIs are supported on all deployment targets. Bug: angleproject:360147119 Change-Id: Ieaa8662e97b71e97bdab3cd0f5c5ef6db3d1b305 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5817150 Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Alexey Knyazev 8cfb9ea2 2024-08-20T00:00:00 Metal: Align OS macro usage Consistenty used TARGET_OS_* macro instead of ANGLE_PLATFORM_* in the Metal backend code for better searchability. Bug: angleproject:360147119 Change-Id: I754ddc158daa6b1894b0b4fb0489d59f14605b66 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5816828 Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Alexey Knyazev 6ef39db0 2024-08-20T00:00:00 Metal: Remove obsolete compile guards for texture helpers MTLDevice.supports32BitFloatFiltering - macOS 11.0 (min compile 12.0, min deploy 10.15) - iOS 14.0 (min compile 17.0, min deploy 15.0) - tvOS 16.0 (min compile 17.0, min deploy 17.0) MTLDevice.supportsBCTextureCompression - macOS 11.0 (min compile 12.0, min deploy 10.15) - iOS 16.4 (min compile 17.0, min deploy 15.0) - tvOS 16.4 (min compile 17.0, min deploy 17.0) MTLPixelFormatPVRTC* enums - macOS 11.0 (min compile 12.0) - iOS 8.0 (min compile 17.0) - tvOS 9.0 (min compile 17.0) Bug: angleproject:360147119 Change-Id: Iafb010efc233f9c677a2c6f65cb4efdf0bb9cf9c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5805290 Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Alexey Knyazev 939fafc8 2024-08-20T00:00:00 Metal: Remove MSL version compile guards MTLLanguageVersion1_0 - Deprecated MTLLanguageVersion2_3 - macOS 11.0 (min compile 12.0, min deploy 10.15) - iOS/tvOS 14.0 (min compile 17.0, min deploy 15.0) MTLLanguageVersion2_4 - macOS 12.0 (min compile 12.0, min deploy 10.15) - iOS/tvOS 15.0 (min compile 17.0, min deploy 15.0) Bug: angleproject:360147119 Change-Id: I4a0da9d92ef86e899766bc860f3bc6e7e614f4a9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5806332 Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Alexey Knyazev 966d0a1a 2024-08-20T00:00:00 Metal: Cleanup memoryless storage mode support detection Bug: angleproject:360147119 Change-Id: Ic47f1d84e748f65194aa819a39418db66b1948c3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5802956 Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com>
Alexey Knyazev 003737c8 2024-08-20T00:00:00 Metal: Adjust texture storage mode compile guards Used managed mode only for macOS and Mac Catalyst compile targets. Fixed compilation for visionOS. Bug: angleproject:360147119 Change-Id: I88fae28ff6d1ecb5ba303d32c4a3874bf3f8aa87 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5802959 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Alexey Knyazev a36c459e 2024-08-20T00:00:00 Metal: Remove redundant symbol redeclarations MTLBlitOptionRowLinearPVRTC - macOS 11.0 (min compile 12.0) - iOS/tvOS 9.0 (min compile 17.0) MTLBarrierScope - macOS 10.14 (min compile 12.0) - iOS/tvOS 12.0 (min compile 17.0) MTLBarrierScopeRenderTargets - Moved compile guards to call sites MTLRenderStages, MTLRenderStageVertex, MTLRenderStageFragment - macOS 10.13 (min compile 12.0) - iOS/tvOS 10.0 (min compile 17.0) Bug: angleproject:360147119 Change-Id: I7dac46accde63be486a7de918284bbd6e8367a4e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5806896 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Alexey Knyazev 1f1b7426 2024-08-20T00:00:00 Metal: Remove compile guards for preserveInvariance MTLCompileOptions.preserveInvariance - macOS 11.0 (min compile 12.0, min deploy 10.15) - iOS/tvOS 14.0 (min compile 17.0, min deploy 15.0) Bug: angleproject:360147119 Change-Id: I54bd75f3136e907ebb738b855f12b80f3c161b41 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5806898 Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Alexey Knyazev 33c2ff07 2024-08-20T00:00:00 Metal: Remove obsolete watchOS compile guards MTLSamplerAddressModeMirrorClampToEdge: - macOS 10.11 (min compile 12.0, min deploy 10.15) - iOS 14.0 (min compile 17.0, min deploy 15.0) - tvOS 16.0 (min compile 17.0, min deploy 17.0) Bug: angleproject:360147119 Change-Id: I21457e7f0694d09857153199037929f9739eded0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5803986 Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Alexey Knyazev 1dabe52c 2024-08-20T00:00:00 Metal: Remove texture swizzle compile guards Texture swizzle support: - macOS 10.15 (min compile 12.0, min deploy 10.15) - iOS/tvOS 13.0 (min compile 17.0, min deploy 15.0) Bug: angleproject:360147119 Change-Id: If7e59cc094e5bcdb145a54541662d0fe0a989e8d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5803984 Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Alexey Knyazev f551a112 2024-08-20T00:00:00 Metal: Remove obsolete compile guards from the command buffer memoryBarrierWithScope and memoryBarrierWithResources: - macOS 10.14 (min compile 12.0, min deploy 10.15) - iOS/tvOS 12.0 (min compile 17.0, min deploy 15.0) dispatchThreads: - macOS 10.13 (min compile 12.0, min deploy 10.15) - iOS 11.0 (min compile 17.0, min deploy 15.0) - tvOS 14.5 (min compile 17.0, min deploy 15.0) Bug: angleproject:360147119 Change-Id: I05e4e5dac81b4e07c47e0f3a1b7d165ff9406cc3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5804021 Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Le Hoang Quyen f102d75a 2024-08-14T19:52:30 Metal: translate IOSurface pbuffer's GL_RGB to RGBX/BGRX format. Currently when IOSurface is bound to a pbuffer with GL_RGB internal format, we asign angle format=B8G8R8A8_UNORM/R8G8B8A8_UNORM to it. And then disable alpha write to the respective MTLTexture. However, when an implicit MSAA texture is created for the above pbuffer, it will be assigned B8G8R8A8_UNORM/R8G8B8A8_UNORM angle format but has no knowledge about alpha write disable. Consequently, when a render pass uses this implicit MSAA texture, its alpha channel won't be cleared properly and would contain garbage values. In order to avoid the above bug, we should use B8G8R8X8_UNORM/R8G8B8X8_UNORM angle format for the IOSurface pbuffer. This will fix the render corruptions found in chromium:358957665. Bug: angleproject:42261786 Bug: chromium:358957665 Change-Id: I8aa1e24ace2de80dd08e21711445515ba4b339ff Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5788801 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Kimmo Kinnunen 5cf94ffa 2024-08-20T10:41:40 Metal: Use pipeline rasterSampleCount Use MTLRenderPipelineDescriptor rasterSampleCount instead of sampleCount. This avoids the use of the deprecation macro. Availability: iOS 8.0 (min: 15.0), mac Catalyst 13.1 (min: 16.5), macOS 10.11 (min: 10.15), tvOS 11.0 (min: 15.0), visionOS 1.0+ Bug: angleproject:360147118 Change-Id: I7009a7d7b39ecb763e23f4b97441fb45a64a891d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5797134 Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Alexey Knyazev <lexa.knyazev@gmail.com> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com>
Kimmo Kinnunen 25237423 2024-08-20T15:22:32 Metal: Remove ifdefs for primitive topology class MTLPrimitiveTopologyClass availability iOS 12.0, minimum runtime 15.0. Remove the ifdefs. Hardcoding ANGLE_IOS_DEPLOY_TARGET is dangerous, likely it has never been correct. Remove. Should use __IPHONE_OS_VERSION_MIN_REQUIRED. Bug: angleproject:360147118 Change-Id: I43d7a364fa0237af1ee1f546015ae884fc373b15 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5797141 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Alexey Knyazev <lexa.knyazev@gmail.com> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com>
Kimmo Kinnunen eb6c4bfe 2024-08-20T09:58:11 Metal: Fix availabilities of MTLGPUFamily use Fixes compile in case of targeting only the newer SDKS. [MTLDevice supportsFamily:] is supported on all minimum runtimes: - macOS 10.15 (minimum runtime 10.15) - macCatalyst 13.1 (minimum runtime 16.5) - iOS/tvOS 13.0 (minimum runtime 15.0) Remove the ifdefs and fallbacks. MTLGPUFamilyMacCatalyst1 is deprecated on macCatalyst 16.0. Replace with MTLGPUFamilyMac2. MTLGPUFamilyMac1 is deprecated on macOS 13.0. Replace with MTLGPUFamilyMac2. MTLGPUFamilyApple7 is present on iOS/tvOS 14.0, minimum runtime 15.0. Remove ifdefs. MTLGPUFamilyApple6,7 are present on macOS 11.0 SDK, minimum SDK 12.0. Remove ifdefs. Bug: angleproject:360147118 Change-Id: I337d1ad44940a2f39a57ba8a28de0e1d7387658c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5797050 Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Alexey Knyazev <lexa.knyazev@gmail.com> Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Kimmo Kinnunen 2758d4dc 2024-08-20T16:00:07 Metal: Remove shared event related ifdefs Shared events are supported by iOS 12, macOS 10.14, included in the minimum versions iOS 15, macOS 10.15. Bug: angleproject:360147118 Change-Id: I5b62dade045f9d50864ef1906cb22a18fd09e4da Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5797150 Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Alexey Knyazev <lexa.knyazev@gmail.com> Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Le Hoang Quyen 1a191b1d 2024-08-16T17:31:38 Metal: add an option to emulate DontCare loadOp with randomized Clear. This is useful for testing undefined initial values caused by DontCare MTLLoadAction on non-tiled GPUs. Bug: angleproject:42261786 Change-Id: Id5c4a9ee8510a8a9143bdd67e276bfcf2bd7eaa5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5791386 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Alexey Knyazev 57a3e9a7 2024-08-15T00:00:00 Prevent compilation with unsupported Apple SDK versions Bug: angleproject:360147119 Change-Id: Ie9924cb49ffa729d454a2869a2d19d957500bd10 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5793513 Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Kimmo Kinnunen 62cc3790 2024-08-19T11:05:52 Metal: Remove UseResource old SDK fallbacks Fixes deprecation compile errors on newer SDKs. Remove the version guards, the useResource API is available on: macOS 10.15, minimum supported version 10.15 iOS 13, minimum supported version 15 macCatalyst 13.1, minimum supported version 16.6 (for macOS 13.5) Bug: angleproject:360147118 Change-Id: I6d2dd7cb510d6134b75d4479ae7159b8fbcfc96b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5796002 Commit-Queue: Geoff Lang <geofflang@chromium.org> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Alexey Knyazev <lexa.knyazev@gmail.com>
Kimmo Kinnunen 26c842fc 2024-08-15T14:51:22 Metal: use injectAsmStatementIntoLoopBodies on iOS The setting should be enabled for iOS. Bug: chromium:1513738 Change-Id: I5efd4126711eff6df8f5d84689f7f3310d7e8487 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5788428 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com>
Geoff Lang 072dc5d1 2024-08-13T13:53:52 Metal: Disable multisampled render to texture. Corruption has been seen on M1 Macs for WebGL content which uses a multisampled backbuffer. Bug: chromium:358957665, angleproject:42261786 Change-Id: Ia17581b15cd032e91e2642d80abace8d57ceb23b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5783540 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Quyen Le <lehoangquyen@chromium.org>
Le Hoang Quyen ee25dddb 2024-08-09T01:03:26 Metal: Properly clear render pass' attachment with an emulated alpha. When a texture is created with emulated format such as RGB, its alpha channel is initialized to 1 and the write mask is configured such that the alpha value won't be overwritten or set to other values. However, if we use this texture as an attachment in a render pass, and DontCare loadAction is used, the alpha value would be initialized with garbage values. No draw calls within the render pass would change these garbage values because the configured write mask already prevents that. Thus the garbage alpha values would be stored in the memory after the render pass ends. This bug also affects MSRTT's unresolve step, because it uses a draw call to blit the resolve texture to the MSAA texture. However, the alpha write is disabled thus the MSAA texture will remain having garbage alpha values. The fix for this bug is that: if we detect that the texture has emulated format and its loadAction is DontCare, we change it to Clear action to clear the alpha channel to 1. Bug: angleproject:42261786 Change-Id: I994849bd4b3c3ab51698833d1cc520376ae6de44 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5773347 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Auto-Submit: Quyen Le <lehoangquyen@chromium.org> Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Alexey Knyazev 6e248bcb 2024-06-20T00:00:00 Metal: Fix ASTC on visionOS Adjusted compile guards to include visionOS target. Fixed: angleproject:358393363 Change-Id: If7ead234f5deaee524172d2fb38d4a041c915716 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5777140 Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Alexey Knyazev 7bab5bce 2024-06-20T00:00:00 Metal: Support BC texture formats with non-macOS targets Used supportsBCTextureCompression device query to check BC formats support on Apple GPUs. Fixed: angleproject:42266573 Change-Id: I60fd5614d10d0c4558992e2c5d3e4b4c1a396aaa Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5771136 Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Kimmo Kinnunen cb27b4a4 2024-08-08T10:17:47 Metal: Remove MTLGPUFamilyApple9, it is unused Fixes visionOS compiles, the SDKs do not define the symbols. Changes the SDK #if checks to be more consistent: - Remove version checks from WATCHOS, as it's expected to be compiled with fairly recent SDK (Metal is not supported). - Compile fallbacks only when needed by the minimum deployment target. - Add Apple3 -> :MTLFeatureSet_tvOS_GPUFamily2_v1 mapping just for consistency. Bug: angleproject:347739670 Change-Id: I054c9faeba4245be8be6cfa7128f17df03f448da Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5771352 Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Alexey Knyazev <lexa.knyazev@gmail.com>
Alexey Knyazev 8a8b85bb 2024-06-20T00:00:00 Metal: Adjust supports32BitFloatFiltering compile guards * Used MAX_ALLOWED instead of MIN_REQUIRED macros. * Explicitly enabled visionOS SDK. * Used correct tvOS SDK version. Bug: angleproject:347739670 Change-Id: I599ce31c66fc4341a43607c46df67740b8478670 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5756573 Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Dan Glastonbury 0592b897 2024-08-02T14:50:08 Metal: fix frame capture bundle file permissions Capturing Metal frame captures of ANGLE end2end test results in a .gputrace bundle devoid of any posix file permissions. This causes Xcode to throw an error when trying to open the frame capture. On |StopFrameCapture|, ensure that the .gputrace files are RW for the user and the bundle directory is RWX. Fixed: angleproject:356907817 Change-Id: Ia994aa5b8bd09a3dc34fd79aac831a6f7dcc792f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5759063 Reviewed-by: Quyen Le <lehoangquyen@chromium.org> Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Shahbaz Youssefi 70f2e203 2024-08-06T17:21:50 Metal: Fix memoryless usage on ios on tv Bug: angleproject:42261786 Change-Id: I8a289eb888dbb9b2d28066850f2218a1aa92da3b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5765976 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Quyen Le <lehoangquyen@chromium.org> Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Le Hoang Quyen a89ca6c8 2024-07-30T17:14:50 Metal: Fully implement unresolve step for MSRTT. This CL also uses memoryless for implicit MS textures in EXT_multisampled_render_to_texture render passes. Bug: angleproject:42261786 Change-Id: Ic20450574c4c670d05ca846587ced05488012270 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5746181 Reviewed-by: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Quyen Le <lehoangquyen@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Le Hoang Quyen 1bfe5c57 2024-07-30T15:58:47 Metal: partially implement EXT_multisampled_render_to_texture. Implement by implicitly attaching a multisampled texture to the render pass. The content will be preserved across render passes by loading/storing to the implicit multisampled texture. However this won't work if the single sampled texture is used in multiple render passes with different glFramebufferTexture2DMultisampleEXT's sample counts. For that to work we need to implement unresolve step to load the resolve texture's texels into the implicit multisampled texture. That will be implemented in a separate CL. Bug: angleproject:42261786 Change-Id: I12be75af17ce5b98266946846417d0a43fcba455 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5746180 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Alexey Knyazev 26aa4df5 2024-06-20T00:00:00 Metal: Update floating-point texture format caps * Fixed detection of Apple7+ GPUs. Added support for Apple8 and Apple9 GPUs. * Adjusted filterability and resolvability caps for R32F, RG32F, and RGBA32F formats. This enables GL_OES_texture_float_linear on capable devices. * Adjusted RGBA32F blendability cap. This enables GL_EXT_float_blend on capable devices. Bug: angleproject:347739670 Change-Id: I84d23814d119452f47fff5a1d7dc33f614c35bb7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5646489 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com>
Kimmo Kinnunen aee59926 2024-06-28T17:00:56 Metal: Enable GL_ANGLE_reverse_row_order for Metal The feature is already implemented due to generic pack parameters handling and FramebufferMtl::setFlipY(). Bug: angleproject:349980052 Change-Id: I08cc81dcb26ae81e8d81b060d986e01479487dbe Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5667597 Reviewed-by: Quyen Le <lehoangquyen@chromium.org> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com>
Le Hoang Quyen 198de044 2024-07-30T15:44:03 Metal: fix wrong render encoder's serial assignment mtl::RenderCommandEncoder object is created once and reused multiple times. We should re-assign a new serial whenever we reuse it, instead of assigning once in constructor. bug: angleproject:40644888 Change-Id: I18120c91dddd5b279fcec7a9099833e97ec1c37c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5746179 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Le Hoang Quyen 2bc1519c 2024-07-28T05:16:07 Metal: fix base/max level change for mutable textures. Previously, the following scenario would accidentally delete and recreate the native texture storage for a non-immutable TextureMtl: 1. set a texture base/max level. 2. attach the texture to a FBO and clear it. - native storage is created. 3. sample the texture. - native storage is accidentally deleted and recreated. This happened because front-end only notifies the backend about the base/max level dirty bits at step 3. At this point, Metal backend thought that the native storage created at step 2 is no longer valid and attempted to recreate the storage. This CL fixes the bug by checking whether the base/max level is still compatible with the existing native texture storage. If it is then the dirty bits result in no-op. Bug: chromium:355605685 Change-Id: I1daac80a74219109631a101e18e944560606d926 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5741121 Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Quyen Le <lehoangquyen@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Alexey Knyazev fc381db4 2024-07-23T00:00:00 Metal: Treat link jobs as thread-safe Fixed: angleproject:351165323 Change-Id: I2ad7b8bd4b89be7d98876287c641b86a33e1108e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5735475 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Alexey Knyazev 6eda2557 2024-07-22T00:00:00 Metal: Pass an existing context to CompileMslTask Bug: angleproject:351165323 Change-Id: Icd4a2c8f9e158dc1989d720dc8235ba09dc0d82a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5736272 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Alexey Knyazev 975674ea 2024-07-18T00:00:00 Metal: Fix PBO readback failures with small row length Do not use blits when the row length is smaller than the source area width to avoid Metal validation failures. Bug: angleproject:354005999 Change-Id: Ifa0f29a0d1d2fb3275ea254957c24f36807e6f66 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5724790 Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Quyen Le <lehoangquyen@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Gregg Tavares 62d9f847 2024-07-17T13:27:07 Speed up UniformBuffer support on Metal If the sizes are different but all fields match then only padding remains. So, as long as the buffer can safely handle the offset and size of usage, allow drawing without converting the uniform buffer. Fixed: angleproject:348270693 Change-Id: I91196ca9839cf064b573d912f125ff4879a85b02 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5719193 Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Quyen Le <lehoangquyen@chromium.org> Auto-Submit: Gregg Tavares <gman@chromium.org> Reviewed-by: Quyen Le <lehoangquyen@chromium.org>
Alexey Knyazev 9968e98c 2024-07-16T00:00:00 Metal: Fix compute path for 16-bit PBO readbacks Added 16-bit normalized pixel formats to internal copy shaders. Fixed and simplified floatToNormalized usage for signed inputs. Bug: angleproject:352700368 Change-Id: Icbb79381991c6621004d53706b97662d33c25cd8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5717929 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Quyen Le <lehoangquyen@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Alexey Knyazev 8ed4d427 2024-07-11T00:00:00 Metal: Remove link tasks dependency on context Bug: angleproject:351165323 Change-Id: If9e5d141cb15a6fc6df8a5fd9a2cfe70efe19dfc Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5701902 Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Alexey Knyazev c5ab1ceb 2024-07-11T00:00:00 Metal: Remove library creation dependency on ContextDevice Bug: angleproject:351165323 Change-Id: Idc560a75e569fe917685bb247625d7df8472af46 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5698885 Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Roman Lavrov eda67d7e 2024-07-11T11:16:08 Avoid including fstream from angleutils.h SaveFileHelper is mostly useful for / specific to FrameCapture, so move it there. The other couple of uses just write a string. Bug: angleproject:42266508 Change-Id: Ia1dcd4531f9d5671f40611a1887dcfe7c5dbc1ef Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5696025 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Roman Lavrov <romanl@google.com>
Alexey Knyazev fe02de25 2024-07-04T00:00:00 Metal: Remove MTLGetMSL dependency on context Bug: angleproject:351165323 Change-Id: Idf56665cce67dcf51ac4d6148212786bcc398b67 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5678417 Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang fcf3a1c0 2024-07-02T16:33:28 GL: Allow shader compilation with cached translated source Write the translated shader source when serializing shaders. This does not increase the size of the shader cache because Vulkan only uses the compiledBinary field. Spawn a ShaderTranslateTask for loading shaders so the GL backend can compile the shader on the native driver. Bug: angleproject:350779978 Change-Id: I14413a7ca2a0d99653a1082f2c8b4a94cf58626a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5672740 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Alexey Knyazev b7d4c5d1 2024-07-04T00:00:00 Metal: Disable fast math if isinf or isnan are used Fixed: angleproject:42266714 Fixed: angleproject:42267063 Change-Id: Ibf6508ffc7d458a6b91b9218b2b488b6aa5b1001 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5678416 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Liza Burakova 3e997419 2024-06-25T18:41:03 Add format conversions for WebGPU formats. This CL adds a Format class, as well as a generator script to generate methods to map between WebGPU and ANGLE formats. Fallback mappings are listed but this CL only implements support for required webgpu formats. Bug: angleproject:344814096 Change-Id: I2588a57353eafc4e87f40df3bbe3f9375e5ed8c6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5598178 Reviewed-by: Matthew Denton <mpdenton@chromium.org> Commit-Queue: Liza Burakova <liza@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Alexey Knyazev 12028222 2024-06-20T00:00:00 Metal: Clear visibility result buffer before use Ensured that the current visibility pool buffer does not contain previous results if it was used before. Fixed: angleproject:348206830 Change-Id: I8dbc36626ef8267d5466c96405dac0da2754cb6d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5643453 Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Quyen Le <lehoangquyen@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi d193d51b 2024-06-17T22:46:08 Replace issue ids post migration to new issue tracker This change replaces anglebug.com/NNNN links. Bug: None Change-Id: I8ac3aec8d2a8a844b3d7b99fc0a6b2be8da31761 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5637912 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Alexey Knyazev d521dd08 2024-06-13T00:00:00 Metal: Set write dependency when calling fillBuffer Ensured that resetting the visibility buffer completes before next operations. Fixed: angleproject:347193640 Change-Id: Ib44322ca36c056a71a828e45cea435f51394cc0a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5632318 Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Alexey Knyazev 18bb6e54 2024-06-06T00:00:00 Metal: Support non-layered 2D array shader images Fixed: angleproject:8125 Change-Id: Id148c09d948487bb677c4a3af746e6ea151d84a7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5604225 Reviewed-by: Quyen Le <lehoangquyen@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Amirali Abdolrashidi 1db5581d 2024-05-21T13:07:44 Implement KHR_robustness * Added implementation for the validation layers for the added functions, and updated some of the existing ones. * The core functions require GLES 3.2. * The KHR functions have been limited to GLES 2.0+. * KHR_robustness requires GLES 2.0 and removes support for GLES 1.1 for logistical reasons. * Some functions require GLES 3.0 with this extension, which become core in GLES 3.2. * glGetnUniformuivKHR() * Enabled robustnessKHR on several platforms. * Added unit tests similar to ContextLostTest.BasicUsage for the new cases. * Added ContextLostTestES32 for the core usage in GLES 3.2. Bug: angleproject:42262244 Change-Id: Id1425c39d9a1a66ae1a90048b673cb1ae391c0ef Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5555985 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Le Hoang Quyen 4d4c99b1 2024-05-31T02:07:11 Metal: skip copying via parentTexture on iOS simulator. iOS simulator has bug in [MTLTexture parentRelativeSlice] so don't use it to upload data to the texture. Bug: angleproject:343734719 Change-Id: I78cf0066c1120c04f9b62c30e280ad866c2096d7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5584042 Reviewed-by: Kenneth Russell <kbr@chromium.org> Auto-Submit: Quyen Le <lehoangquyen@chromium.org> Commit-Queue: Kenneth Russell <kbr@chromium.org> Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Le Hoang Quyen 8db2d61a 2024-05-14T00:39:47 Metal: properly handle base/max level for immutable textures. Previously, we treat every texture the same as a non-immutable texture. Every texture has a native mtl::Texture containing mipmap levels from base GL level to max GL level. And base GL level would be mapped to level 0 of the native texture. However, this is not correct for immutable textures, pbuffer or EGLImage bound textures. Such textures have mipmaps pre-allocated either via glTexStorage calls or externally. Base and max GL levels don't affect their allocated mipmap levels, only limit the levels a shader can sample. For example, a texture has 8 levels allocated via glTexStorage. Its base level is set 1, and max level is set to 2. Shaders will only be able to sample from level 1 to level 2 of this texture. However, it's valid to attach level 0 or level > 2 of this texture to an FBO. This CL addresses this bug by separating internal mtl::Texture into two main objects: - A native storage will contain the actual mipmap levels of the texture. FBO attachment or data uploads can refer to a level in this object. - A view of the native storage from base GL level to max GL level. This view will be used in shader sampling and mipmap generations. Bug: angleproject:6447 Bug: angleproject:8355 Bug: b/42265945 Change-Id: I186b69f02e9e40c75830ffe4b48bd5a3c8d49cf2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5531392 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Quyen Le <lehoangquyen@chromium.org> Auto-Submit: Quyen Le <lehoangquyen@chromium.org>
Alexey Knyazev 59adc191 2024-05-23T00:00:00 Metal: Ensure valid vertex buffer layout stride Metal Validation causes runtime failures if the sum of the vertex buffer binding offset and the related vertex layout stride is greater than the buffer's length. Fixed: angleproject:342350849 Change-Id: I531f092c6130b37cb8b0b89b20804a222160ceb7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5565528 Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Quyen Le <lehoangquyen@chromium.org>
Alexey Knyazev 6cf3c96d 2024-05-23T00:00:00 Metal: Handle empty vertex buffers Use the current attribute value when the bound array buffer has no data to avoid Metal Validation errors. Drive-by: do not emit empty client data upload commands. Fixed: angleproject:40050025 Change-Id: I813725322c52bc16ca432f617a40fe7cee24dd6d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5569091 Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Quyen Le <lehoangquyen@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Geoff Lang ccd9a43b 2024-05-22T11:15:39 Split EGL_ANGLE_device_d3d into D3D9 and D3D11 versions. Add EGL_ANGLE_device_d3d9 and EGL_ANGLE_device_d3d11 which make it possible to know what type of device can be queried ahead of time without generating EGL errors. Refactor the DeviceD3D class into Device9 and Device11. Remove the getType method now that it's not needed for internal validation. Keep EGL_ANGLE_device_d3d for backwards compatibility. Bug: angleproject:342096132 Change-Id: Ib950abad58e46a5be269891ea7afd0cb8534cbe8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5559163 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Alexey Knyazev 0ac0603e 2024-05-14T00:00:00 Fold nested std::max calls When a maximum of three values is needed, an initializer list with all three values is more readable than two std::max calls. Fixed: angleproject:8695 Change-Id: I073ea1af07b215610c85981eea03f6e73107bce6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5541974 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Le Hoang Quyen 0044f4d1 2024-05-13T00:29:30 Metal: fix IOSurface's render targets invalidated by max level change. This CL fixes a bug in the following tricky situation: - Client binds an IOSurface to a texture. - Previously this would internally intialize the texture's max level to the default value 1000. - Client changes the texture's max level to 0. - Client attachs the texture to FBO 1. - Client binds FBO 1 and clear it. - This triggers TextureMtl::getAttachmentRenderTarget() that initializes the RenderTargetMtl of the texture. - Client binds FBO 0 and sample the texture. - Previously this could trigger TextureMtl::onBaseMaxLevelsChanged() which would invalidate the texture's RenderTargetMtl. - Client binds FBO 1. - Client blits FBO 0 to FBO 1. - This will set DIRTY_BIT_COLOR_BUFFER_CONTENTS_0 in FBO 1. - Client calls glFlush to restart render command encoder. - Client issues a draw call. - DIRTY_BIT_COLOR_BUFFER_CONTENTS_0 would cause FrameBufferMtl to re-initialize RenderPassDesc from invalid RenderTargetMtl. - A new render encoder would be created from the invalid RenderPassDesc. - the draw call would be encoded to a render command encoder without any valid color attachment. The fix in this CL is that when we bind an IOSurface to a texture, the texture's max level will be automatically set to 0. This will avoid its RenderTargetMtl from being invalidated if users explicitly change the max level to 0 in future. Note: this is not a foolproof fix for every scenario concerning the base/max level in IOSurface bound/or immutable textures. We will fix them in future CLs. Bug: b/335353385 Change-Id: I3a2da6991764f22393178f40c1d7bbe60503cba4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5531388 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Le Hoang Quyen f3089d1d 2024-05-07T00:14:53 Metal: fix UBO data update undetected between draw calls. This CL fixes an issue where an UBO was updated between two draw calls. This would internally allocate a new metal buffer however ContextMtl didn't know that hence it didn't rebind with new buffers. Bug: b/338348430 Change-Id: I3d8ce22921811e49ae1b8016ae4a20d770f6f372 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5515858 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Le Hoang Quyen a951e0e0 2024-05-05T23:29:33 Metal: add test for active blit/compute & render encoder mistracking. The bug was already fixed but we need to add the test to avoid the issue from resurfacing in future. Bug: angleproject:8685 Change-Id: Ia10c0954ef39b20b1d891389b7e7a1c81cdc758d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5514529 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Le Hoang Quyen 251067ed 2024-05-03T22:36:11 Metal: don't break render pass when uploading a texture. Bug: b/337214693 Change-Id: Ib2dc77c364a72f2973cbc3882f6125bffbc0a11b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5514948 Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Le Hoang Quyen 9ccb9b41 2024-05-03T22:23:03 Metal: fix incorrect tracking if blit & render encoder coexist Currently mtl::CommandBuffer tracks only one active command encoder. However this tracking is wrong if a blit/compute encoder is created without ending the current render encoder. Blit/compute and render encoders are allowed to coexist because the actual rendering encoding is deferred. The bug would happen for e.g. if: - There is an active render encoder. - ContextMtl::getBlitCommandEncoderWithoutEndingRenderEncoder() is called. - In this case, active encoder will be set to the blit encoder. - Later when blit encoder is ended, tracked active encoder would be set to null even though it should be the render encoder. This CL fixes the bug by tracking separate active blit/compute & render encoders. Bug: angleproject:7643 Bug: angleproject:8685 Change-Id: I9893402ecd4c0388aa0153acdb2be04315563086 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5514184 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Dan Glastonbury d9a00875 2024-02-21T16:57:43 Metal: Override internal format of images Add support for overriding the internal format when binding Metal textures to EGL images. Fixed: angleproject:8552 Change-Id: I364a88a2e608e462c5216c92927679814ab91ca5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5310305 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Kenneth Russell <kbr@chromium.org>
Roman Lavrov 4109a90e 2024-04-16T17:31:11 LinkedUniform: avoid frequent GLenum -> index conversion Certain functions such as getElementComponents() are frequently called in driver_overhead benchmark, causing repeated GLenum -> index conversion of the uniform type which shows up in profiling (driver_overhead_2 trace) Change LinkedUniform.pod.type to LinkedUniform.pod.typeIndex storing the UniformTypeInfo index with conversion helpers. Bug: b/335295728 Change-Id: Iae5cd58f4e2703589d23b8e52991fc4b97c5fb08 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5458741 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Roman Lavrov <romanl@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Mohan Maiya ac654931 2024-04-04T15:42:47 ProgramExecutable manages post-link tasks Post-link tasks are now owned and managed by ProgramExecutable. Also, update `LinkTask::link` API so backends have a choice to populate either the linkSubTask or postLinkSubTask containers (but not both). Bug: angleproject:8297 Change-Id: I5dbed6a070efe851fc1376699e9eccd3a21bd03f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5406487 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com> Reviewed-by: Charlie Lao <cclao@google.com>