Title: [288510] branches/safari-613-branch/Source/ThirdParty/ANGLE
Revision
288510
Author
[email protected]
Date
2022-01-24 17:55:32 -0800 (Mon, 24 Jan 2022)

Log Message

Cherry-pick r288105. rdar://problem/87656387

    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.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288105 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-613-branch/Source/ThirdParty/ANGLE/ChangeLog (288509 => 288510)


--- branches/safari-613-branch/Source/ThirdParty/ANGLE/ChangeLog	2022-01-25 01:55:29 UTC (rev 288509)
+++ branches/safari-613-branch/Source/ThirdParty/ANGLE/ChangeLog	2022-01-25 01:55:32 UTC (rev 288510)
@@ -1,5 +1,36 @@
 2022-01-24  Alan Coon  <[email protected]>
 
+        Cherry-pick r288105. rdar://problem/87656387
+
+    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.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288105 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-24  Alan Coon  <[email protected]>
+
         Cherry-pick r288097. rdar://problem/87653812
 
     Follow-up: REGRESSION (r286603): Leak of three NSMutableDictionary objects each time rx::DisplayMtl::getMetalDeviceMatchingAttribute() is called

Modified: branches/safari-613-branch/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/ProgramMtl.mm (288509 => 288510)


--- branches/safari-613-branch/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/ProgramMtl.mm	2022-01-25 01:55:29 UTC (rev 288509)
+++ branches/safari-613-branch/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/ProgramMtl.mm	2022-01-25 01:55:32 UTC (rev 288510)
@@ -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