⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 288105 in webkit


Ignore:
Timestamp:
Jan 17, 2022, 4:56:11 PM (5 years ago)
Author:
ddkilzer@apple.com
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.
Location:
trunk/Source/ThirdParty/ANGLE
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/ThirdParty/ANGLE/ChangeLog

    r288097 r288105  
     12022-01-17  David Kilzer  <ddkilzer@apple.com>
     2
     3        REGRESSION (r286603): rx::ProgramMtl::getSpecializedShader() leaks MTLFunctionConstantValues object due early return when an error occurs in ANGLE_TRY() macro
     4        <https://webkit.org/b/235281>
     5        <rdar://problem/87656387>
     6
     7        Reviewed by Darin Adler.
     8
     9        * src/libANGLE/renderer/metal/ProgramMtl.mm:
     10        (rx::ProgramMtl::getSpecializedShader):
     11        - Use mtl::AutoObjCObj<> to release MTLFunctionConstantValues
     12          object on early return.
     13
    1142022-01-17  David Kilzer  <ddkilzer@apple.com>
    215
  • trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/ProgramMtl.mm

    r287068 r288105  
    590590    mtl::TranslatedShaderInfo *translatedMslInfo = &mMslShaderTranslateInfo[shaderType];
    591591    ProgramShaderObjVariantMtl *shaderVariant;
    592     MTLFunctionConstantValues *funcConstants = nil;
     592    mtl::AutoObjCObj<MTLFunctionConstantValues> funcConstants;
    593593
    594594    if (shaderType == gl::ShaderType::Vertex)
    … …  
    640640            }
    641641
    642             funcConstants = [[MTLFunctionConstantValues alloc] init];
     642            funcConstants = mtl::adoptObjCObj([[MTLFunctionConstantValues alloc] init]);
    643643            [funcConstants setConstantValue:&emulateDiscard
    644644                                       type:MTLDataTypeBool
    … …  
    676676            }
    677677
    678             funcConstants = [[MTLFunctionConstantValues alloc] init];
     678            funcConstants = mtl::adoptObjCObj([[MTLFunctionConstantValues alloc] init]);
    679679            [funcConstants setConstantValue:&emulateCoverageMask
    680680                                       type:MTLDataTypeBool
    … …  
    696696                    type:MTLDataTypeBool
    697697                withName:@"ANGLEUseSampleCompareLod"];
     698
    698699    // Create Metal shader object
    699700    ANGLE_MTL_OBJC_SCOPE
    700701    {
    701702        ANGLE_TRY(CreateMslShader(context, translatedMslInfo->metalLibrary, SHADER_ENTRY_NAME,
    702                                   funcConstants, &shaderVariant->metalShader));
    703         [funcConstants ANGLE_MTL_AUTORELEASE];
     703                                  funcConstants.get(), &shaderVariant->metalShader));
    704704    }
    705705
Note: See TracChangeset for help on using the changeset viewer.