Add wireframe support to Metal.

Also fixes segfault with cached shaders.

Change-Id: I32be8c3dd28e93ffabc61437e62be729e4fc2d32
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261085
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
This commit is contained in:
Jim Van Verth 2019-12-19 10:55:02 -05:00 committed by Skia Commit-Bot
parent e6d31bd089
commit 73d4615160
2 changed files with 8 additions and 1 deletions

View File

@ -87,6 +87,11 @@ void GrMtlOpsRenderPass::onDraw(const GrProgramInfo& programInfo,
pipelineState->setDrawState(fActiveRenderCmdEncoder,
programInfo.pipeline().outputSwizzle(),
programInfo.pipeline().getXferProcessor());
if (this->gpu()->caps()->wireframeMode() || programInfo.pipeline().isWireframe()) {
[fActiveRenderCmdEncoder setTriangleFillMode:MTLTriangleFillModeLines];
} else {
[fActiveRenderCmdEncoder setTriangleFillMode:MTLTriangleFillModeFill];
}
bool hasDynamicScissors = programInfo.hasDynamicScissors();
bool hasDynamicTextures = programInfo.hasDynamicPrimProcTextures();

View File

@ -469,8 +469,10 @@ GrMtlPipelineState* GrMtlPipelineStateBuilder::finalize(GrRenderTarget* renderTa
if (fGpu->getContext()->priv().options().fShaderCacheStrategy ==
GrContextOptions::ShaderCacheStrategy::kSkSL) {
for (int i = 0; i < kGrShaderTypeCount; ++i) {
if (sksl[i]) {
shaders[i] = GrShaderUtils::PrettyPrint(*sksl[i]);
}
}
isSkSL = true;
}
this->storeShadersInCache(shaders, inputs, isSkSL);