Metal: Add check for invalid shader functions

Bug: skia:8243
Change-Id: Ibcf34d72d06d06cbffc411afade277b6d94991b1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/214304
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
Jim Van Verth 2019-05-17 11:05:22 -04:00 committed by Skia Commit-Bot
parent 9b16f81858
commit 9756c36666

View File

@ -347,6 +347,15 @@ GrMtlPipelineState* GrMtlPipelineStateBuilder::finalize(GrRenderTarget* renderTa
id<MTLFunction> vertexFunction = [vertexLibrary newFunctionWithName: @"vertexMain"];
id<MTLFunction> fragmentFunction = [fragmentLibrary newFunctionWithName: @"fragmentMain"];
if (vertexFunction == nil) {
SkDebugf("Couldn't find vertexMain() in library\n");
return nullptr;
}
if (fragmentFunction == nil) {
SkDebugf("Couldn't find fragmentMain() in library\n");
return nullptr;
}
pipelineDescriptor.vertexFunction = vertexFunction;
pipelineDescriptor.fragmentFunction = fragmentFunction;
pipelineDescriptor.vertexDescriptor = create_vertex_descriptor(primProc);