Fix PatchAttribs issues with explicit curve type

- PathTessellator was accidentally not updating its own attribs when
  kExplicitCurveType was needed.

- GrPathTessellationShader was asserting too broadly surrounding
  kExplicitCurveType.

Bug: skia:12524
Change-Id: Iafe543cbc65c2225a9a99f14d7172182033e92c9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/470518
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Jorge Betancourt <jmbetancourt@google.com>
Auto-Submit: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
This commit is contained in:
Chris Dalton 2021-11-11 18:54:21 -07:00 committed by SkCQ
parent c0ff5a8560
commit 32451cf9bc
4 changed files with 10 additions and 9 deletions

View File

@ -118,7 +118,7 @@ protected:
PathTessellator(bool infinitySupport, PatchAttribs attribs) : fAttribs(attribs) {
if (!infinitySupport) {
attribs |= PatchAttribs::kExplicitCurveType;
fAttribs |= PatchAttribs::kExplicitCurveType;
}
}

View File

@ -115,12 +115,6 @@ float2 eval_rational_cubic(float4x3 P, float T) {
void GrPathTessellationShader::Impl::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
const auto& shader = args.fGeomProc.cast<GrPathTessellationShader>();
// We should use explicit curve type when, and only when, there isn't infinity support.
// Otherwise the GPU can infer curve type based on infinity.
SkASSERT(args.fShaderCaps->infinitySupport() !=
(shader.fAttribs & PatchAttribs::kExplicitCurveType));
args.fVaryingHandler->emitAttributes(shader);
// Vertex shader.

View File

@ -343,6 +343,7 @@ GrPathTessellationShader* GrPathTessellationShader::MakeHardwareTessellationShad
SkArenaAlloc* arena, const SkMatrix& viewMatrix, const SkPMColor4f& color,
PatchAttribs attribs) {
SkASSERT(!(attribs & PatchAttribs::kColor)); // Not yet implemented.
SkASSERT(!(attribs & PatchAttribs::kExplicitCurveType)); // Not yet implemented.
if (attribs & PatchAttribs::kFanPoint) {
return arena->make<HardwareWedgeShader>(viewMatrix, color, attribs);
} else {

View File

@ -210,7 +210,13 @@ std::unique_ptr<GrGeometryProcessor::ProgramImpl> MiddleOutShader::makeProgramIm
} // namespace
GrPathTessellationShader* GrPathTessellationShader::MakeMiddleOutFixedCountShader(
const GrShaderCaps& shaderCaps, SkArenaAlloc* arena, const SkMatrix& viewMatrix,
const SkPMColor4f& color, PatchAttribs attribs) {
const GrShaderCaps& shaderCaps,
SkArenaAlloc* arena,
const SkMatrix& viewMatrix,
const SkPMColor4f& color,
PatchAttribs attribs) {
// We should use explicit curve type when, and only when, there isn't infinity support.
// Otherwise the GPU can infer curve type based on infinity.
SkASSERT(shaderCaps.infinitySupport() != (attribs & PatchAttribs::kExplicitCurveType));
return arena->make<MiddleOutShader>(shaderCaps, viewMatrix, color, attribs);
}