Title: [288105] trunk/Source/ThirdParty/ANGLE
Revision
288105
Author
[email protected]
Date
2022-01-17 16:56:11 -0800 (Mon, 17 Jan 2022)

Log Message

REGRESSION (r286603): rx::ProgramMtl::getSpecializedShader() leaks MTLFunctionConstantValues object due early return when an error occurs in ANGLE_TRY() macro
<https://webkit.org/b/235281>
<rdar://problem/87656387>

Reviewed by Darin Adler.

* src/libANGLE/renderer/metal/ProgramMtl.mm:
(rx::ProgramMtl::getSpecializedShader):
- Use mtl::AutoObjCObj<> to release MTLFunctionConstantValues
  object on early return.

Modified Paths

Diff

Modified: trunk/Source/ThirdParty/ANGLE/ChangeLog (288104 => 288105)


--- trunk/Source/ThirdParty/ANGLE/ChangeLog	2022-01-18 00:50:09 UTC (rev 288104)
+++ trunk/Source/ThirdParty/ANGLE/ChangeLog	2022-01-18 00:56:11 UTC (rev 288105)
@@ -1,5 +1,18 @@
 2022-01-17  David Kilzer  <[email protected]>
 
+        REGRESSION (r286603): rx::ProgramMtl::getSpecializedShader() leaks MTLFunctionConstantValues object due early return when an error occurs in ANGLE_TRY() macro
+        <https://webkit.org/b/235281>
+        <rdar://problem/87656387>
+
+        Reviewed by Darin Adler.
+
+        * src/libANGLE/renderer/metal/ProgramMtl.mm:
+        (rx::ProgramMtl::getSpecializedShader):
+        - Use mtl::AutoObjCObj<> to release MTLFunctionConstantValues
+          object on early return.
+
+2022-01-17  David Kilzer  <[email protected]>
+
         Follow-up: REGRESSION (r286603): Leak of three NSMutableDictionary objects each time rx::DisplayMtl::getMetalDeviceMatchingAttribute() is called
         <https://webkit.org/b/235278>
         <rdar://problem/87653812>

Modified: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/ProgramMtl.mm (288104 => 288105)


--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/ProgramMtl.mm	2022-01-18 00:50:09 UTC (rev 288104)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/ProgramMtl.mm	2022-01-18 00:56:11 UTC (rev 288105)
@@ -589,7 +589,7 @@
 
     mtl::TranslatedShaderInfo *translatedMslInfo = &mMslShaderTranslateInfo[shaderType];
     ProgramShaderObjVariantMtl *shaderVariant;
-    MTLFunctionConstantValues *funcConstants = nil;
+    mtl::AutoObjCObj<MTLFunctionConstantValues> funcConstants;
 
     if (shaderType == gl::ShaderType::Vertex)
     {
@@ -639,7 +639,7 @@
                     [NSString stringWithUTF8String:sh::mtl::kRasterizerDiscardEnabledConstName];
             }
 
-            funcConstants = [[MTLFunctionConstantValues alloc] init];
+            funcConstants = mtl::adoptObjCObj([[MTLFunctionConstantValues alloc] init]);
             [funcConstants setConstantValue:&emulateDiscard
                                        type:MTLDataTypeBool
                                    withName:discardEnabledStr];
@@ -675,7 +675,7 @@
                     [NSString stringWithUTF8String:sh::mtl::kCoverageMaskEnabledConstName];
             }
 
-            funcConstants = [[MTLFunctionConstantValues alloc] init];
+            funcConstants = mtl::adoptObjCObj([[MTLFunctionConstantValues alloc] init]);
             [funcConstants setConstantValue:&emulateCoverageMask
                                        type:MTLDataTypeBool
                                    withName:coverageMaskEnabledStr];
@@ -695,12 +695,12 @@
         setConstantValue:&(context->getDisplay()->getFeatures().allowSamplerCompareLod.enabled)
                     type:MTLDataTypeBool
                 withName:@"ANGLEUseSampleCompareLod"];
+
     // Create Metal shader object
     ANGLE_MTL_OBJC_SCOPE
     {
         ANGLE_TRY(CreateMslShader(context, translatedMslInfo->metalLibrary, SHADER_ENTRY_NAME,
-                                  funcConstants, &shaderVariant->metalShader));
-        [funcConstants ANGLE_MTL_AUTORELEASE];
+                                  funcConstants.get(), &shaderVariant->metalShader));
     }
 
     // Store reference to the translated source for easily querying mapped bindings later.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to