Add a "conservative raster" flag to GrPipeline and implement in Vulkan
This flag is not yet used or tested. Both will come next when we
enable mixed sampled ccpr.
Change-Id: Ic242010b1f0b8d81b83731960283e4231f301fd1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252258
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp
index a246c85..8f3eaa9 100644
--- a/src/gpu/GrPipeline.cpp
+++ b/src/gpu/GrPipeline.cpp
@@ -99,7 +99,15 @@
}
}
-uint32_t GrPipeline::getBlendInfoKey() const {
+void GrPipeline::genKey(GrProcessorKeyBuilder* b) const {
+ // Currently kHWAntialias and kSnapVerticesToPixelCenters don't affect the pipeline key:
+ // You can't disable msaa on vulkan or metal, and kSnapVerticesToPixelCenters is implemented
+ // in a shader. Ideally, the client would not set kHWAntialias without
+ // multisampleDisableSupport, but this is not currently the case.
+ constexpr static uint32_t kFlagsMask = ~(uint32_t)(
+ InputFlags::kHWAntialias | InputFlags::kSnapVerticesToPixelCenters);
+ b->add32((uint32_t)fFlags & kFlagsMask);
+
const GrXferProcessor::BlendInfo& blendInfo = this->getXferProcessor().getBlendInfo();
static const uint32_t kBlendWriteShift = 1;
@@ -107,10 +115,10 @@
GR_STATIC_ASSERT(kLast_GrBlendCoeff < (1 << kBlendCoeffShift));
GR_STATIC_ASSERT(kFirstAdvancedGrBlendEquation - 1 < 4);
- uint32_t key = blendInfo.fWriteColor;
- key |= (blendInfo.fSrcBlend << kBlendWriteShift);
- key |= (blendInfo.fDstBlend << (kBlendWriteShift + kBlendCoeffShift));
- key |= (blendInfo.fEquation << (kBlendWriteShift + 2 * kBlendCoeffShift));
+ uint32_t blendKey = blendInfo.fWriteColor;
+ blendKey |= (blendInfo.fSrcBlend << kBlendWriteShift);
+ blendKey |= (blendInfo.fDstBlend << (kBlendWriteShift + kBlendCoeffShift));
+ blendKey |= (blendInfo.fEquation << (kBlendWriteShift + 2 * kBlendCoeffShift));
- return key;
+ b->add32(blendKey);
}