Skip to content

Commit

Permalink
Lazily initialize default shader library.
Browse files Browse the repository at this point in the history
  • Loading branch information
kakashidinho committed Jul 31, 2020
1 parent 274641f commit 277864a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/libANGLE/renderer/metal/DisplayMtl.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class DisplayMtl : public DisplayImpl
mtl::RenderUtils &getUtils() { return mUtils; }
mtl::StateCache &getStateCache() { return mStateCache; }

id<MTLLibrary> getDefaultShadersLib() const { return mDefaultShaders; }
id<MTLLibrary> getDefaultShadersLib();

id<MTLDepthStencilState> getDepthStencilState(const mtl::DepthStencilDesc &desc)
{
Expand Down
13 changes: 12 additions & 1 deletion src/libANGLE/renderer/metal/DisplayMtl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ bool IsMetalDisplayAvailable()
initializeFeatures();

ANGLE_TRY(mFormatTable.initialize(this));
ANGLE_TRY(initializeShaderLibrary());

return mUtils.initialize();
}
Expand Down Expand Up @@ -744,6 +743,18 @@ bool IsMetalDisplayAvailable()
return angle::Result::Continue;
}

id<MTLLibrary> DisplayMtl::getDefaultShadersLib()
{
if (!mDefaultShaders)
{
if (initializeShaderLibrary() != angle::Result::Continue)
{
return nil;
}
}
return mDefaultShaders;
}

bool DisplayMtl::supportiOSGPUFamily(uint8_t iOSFamily) const
{
#if (!TARGET_OS_IOS && !TARGET_OS_TV) || TARGET_OS_MACCATALYST
Expand Down

0 comments on commit 277864a

Please sign in to comment.