Title: [275649] trunk/Source/ThirdParty/ANGLE
Revision
275649
Author
[email protected]
Date
2021-04-07 18:55:47 -0700 (Wed, 07 Apr 2021)

Log Message

Crash in conformance2/textures/misc/compressed-tex-image.html with ANGLE+METAL
Handle uploading a compressed texture with a non-aligned offset. Path requires that we still fill the entire level of a
compressed texture.
https://bugs.webkit.org/show_bug.cgi?id=223925

Patch by Kyle Piddington <[email protected]> on 2021-04-07
Reviewed by Dean Jackson.

* src/libANGLE/renderer/metal/TextureMtl.mm:
(rx::TextureMtl::convertAndSetPerSliceSubImage):

Modified Paths

Diff

Modified: trunk/Source/ThirdParty/ANGLE/ChangeLog (275648 => 275649)


--- trunk/Source/ThirdParty/ANGLE/ChangeLog	2021-04-08 00:30:15 UTC (rev 275648)
+++ trunk/Source/ThirdParty/ANGLE/ChangeLog	2021-04-08 01:55:47 UTC (rev 275649)
@@ -1,3 +1,15 @@
+2021-04-07  Kyle Piddington  <[email protected]>
+
+        Crash in conformance2/textures/misc/compressed-tex-image.html with ANGLE+METAL
+        Handle uploading a compressed texture with a non-aligned offset. Path requires that we still fill the entire level of a 
+        compressed texture.
+        https://bugs.webkit.org/show_bug.cgi?id=223925
+
+        Reviewed by Dean Jackson.
+
+        * src/libANGLE/renderer/metal/TextureMtl.mm:
+        (rx::TextureMtl::convertAndSetPerSliceSubImage):
+
 2021-04-07  John Cunningham  <[email protected]>
 
         [METAL ANGLE] Interface block declerations need to have children marked as struct accesses. Add implicit backing textures for multisample render targets

Modified: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/TextureMtl.mm (275648 => 275649)


--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/TextureMtl.mm	2021-04-08 00:30:15 UTC (rev 275648)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/TextureMtl.mm	2021-04-08 01:55:47 UTC (rev 275649)
@@ -1746,23 +1746,36 @@
         // Check if original image data is compressed:
         if (mFormat.intendedAngleFormat().isBlock)
         {
-            ASSERT(loadFunctionInfo.loadFunction);
+            if(mFormat.intendedFormatId != mFormat.actualFormatId)
+            {
+                ASSERT(loadFunctionInfo.loadFunction);
 
-            // Need to create a buffer to hold entire decompressed image.
-            const size_t dstDepthPitch = dstRowPitch * mtlArea.size.height;
-            angle::MemoryBuffer decompressBuf;
-            ANGLE_CHECK_GL_ALLOC(contextMtl,
-                                 decompressBuf.resize(dstDepthPitch * mtlArea.size.depth));
+                // Need to create a buffer to hold entire decompressed image.
+                const size_t dstDepthPitch = dstRowPitch * mtlArea.size.height;
+                angle::MemoryBuffer decompressBuf;
+                ANGLE_CHECK_GL_ALLOC(contextMtl,
+                                     decompressBuf.resize(dstDepthPitch * mtlArea.size.depth));
 
-            // Decompress
-            loadFunctionInfo.loadFunction(
-                mtlArea.size.width, mtlArea.size.height, mtlArea.size.depth, pixels, pixelsRowPitch,
-                pixelsDepthPitch, decompressBuf.data(), dstRowPitch, dstDepthPitch);
+                // Decompress
+                loadFunctionInfo.loadFunction(
+                    mtlArea.size.width, mtlArea.size.height, mtlArea.size.depth, pixels, pixelsRowPitch,
+                    pixelsDepthPitch, decompressBuf.data(), dstRowPitch, dstDepthPitch);
 
-            // Upload to texture
-            ANGLE_TRY(UploadTextureContents(context, dstFormat, mtlArea, mtl::kZeroNativeMipLevel,
-                                            slice, decompressBuf.data(), dstRowPitch, dstDepthPitch,
-                                            image));
+                // Upload to texture
+                ANGLE_TRY(UploadTextureContents(context, dstFormat, mtlArea, mtl::kZeroNativeMipLevel,
+                                                slice, decompressBuf.data(), dstRowPitch, dstDepthPitch,
+                                                image));
+            }
+            else
+            {
+                //Assert that we're filling the level in it's entierety.
+                ASSERT(mtlArea.size.width == image->sizeAt0().width);
+                ASSERT(mtlArea.size.height == image->sizeAt0().height);
+                const size_t dstDepthPitch = dstRowPitch * mtlArea.size.height;
+                ANGLE_TRY(UploadTextureContents(context, dstFormat, mtlArea, mtl::kZeroNativeMipLevel,
+                                                slice, pixels, dstRowPitch, dstDepthPitch,
+                                                image));
+            }
         }  // if (mFormat.intendedAngleFormat().isBlock)
         else
         {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to