Revert "Add a "conservative raster" flag to GrPipeline and implement in Vulkan"

This reverts commit ee6b49b3af0b16aeb2076537a19b23d214e1fa15.

Reason for revert: I believe this is blocking the revert of Ethan's CL

Original change's description:
> 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>

TBR=egdaniel@google.com,csmartdalton@google.com

Change-Id: I01792817e7298470a3dc17e3687f1e8e0bc5d726
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252918
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrCaps.cpp b/src/gpu/GrCaps.cpp
index 4941e85..dd2aa36 100644
--- a/src/gpu/GrCaps.cpp
+++ b/src/gpu/GrCaps.cpp
@@ -26,7 +26,6 @@
     fMultisampleDisableSupport = false;
     fInstanceAttribSupport = false;
     fMixedSamplesSupport = false;
-    fConservativeRasterSupport = false;
     fMSAAResolvesAutomatically = false;
     fUsePrimitiveRestart = false;
     fPreferClientSideDynamicBuffers = false;
@@ -175,7 +174,6 @@
     writer->appendBool("Multisample disable support", fMultisampleDisableSupport);
     writer->appendBool("Instance Attrib Support", fInstanceAttribSupport);
     writer->appendBool("Mixed Samples Support", fMixedSamplesSupport);
-    writer->appendBool("Conservative Raster Support", fConservativeRasterSupport);
     writer->appendBool("MSAA Resolves Automatically", fMSAAResolvesAutomatically);
     writer->appendBool("Use primitive restart", fUsePrimitiveRestart);
     writer->appendBool("Prefer client-side dynamic buffers", fPreferClientSideDynamicBuffers);
diff --git a/src/gpu/GrCaps.h b/src/gpu/GrCaps.h
index 23d9f44..27f0ec4 100644
--- a/src/gpu/GrCaps.h
+++ b/src/gpu/GrCaps.h
@@ -48,7 +48,6 @@
     bool multisampleDisableSupport() const { return fMultisampleDisableSupport; }
     bool instanceAttribSupport() const { return fInstanceAttribSupport; }
     bool mixedSamplesSupport() const { return fMixedSamplesSupport; }
-    bool conservativeRasterSupport() const { return fConservativeRasterSupport; }
     // This flag indicates that we never have to resolve MSAA. In practice, it means that we have
     // an MSAA-render-to-texture extension: Any render target we create internally will use the
     // extension, and any wrapped render target is the client's responsibility.
@@ -466,7 +465,6 @@
     bool fMultisampleDisableSupport                  : 1;
     bool fInstanceAttribSupport                      : 1;
     bool fMixedSamplesSupport                        : 1;
-    bool fConservativeRasterSupport                  : 1;
     bool fMSAAResolvesAutomatically                  : 1;
     bool fUsePrimitiveRestart                        : 1;
     bool fPreferClientSideDynamicBuffers             : 1;
diff --git a/src/gpu/GrOpsRenderPass.cpp b/src/gpu/GrOpsRenderPass.cpp
index 680c013..1b8ebea 100644
--- a/src/gpu/GrOpsRenderPass.cpp
+++ b/src/gpu/GrOpsRenderPass.cpp
@@ -18,7 +18,6 @@
 #include "src/gpu/GrProgramInfo.h"
 #include "src/gpu/GrRenderTarget.h"
 #include "src/gpu/GrRenderTargetPriv.h"
-#include "src/gpu/GrStencilAttachment.h"
 #include "src/gpu/GrTexturePriv.h"
 
 void GrOpsRenderPass::clear(const GrFixedClip& clip, const SkPMColor4f& color) {
@@ -45,8 +44,6 @@
 #ifdef SK_DEBUG
     SkASSERT(!programInfo.primProc().hasInstanceAttributes() ||
              this->gpu()->caps()->instanceAttribSupport());
-    SkASSERT(!programInfo.pipeline().usesConservativeRaster() ||
-             this->gpu()->caps()->conservativeRasterSupport());
 
     programInfo.compatibleWithMeshes(meshes, meshCount);
     programInfo.checkAllInstantiated();
diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp
index 8f3eaa9..a246c85 100644
--- a/src/gpu/GrPipeline.cpp
+++ b/src/gpu/GrPipeline.cpp
@@ -99,15 +99,7 @@
     }
 }
 
-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);
-
+uint32_t GrPipeline::getBlendInfoKey() const {
     const GrXferProcessor::BlendInfo& blendInfo = this->getXferProcessor().getBlendInfo();
 
     static const uint32_t kBlendWriteShift = 1;
@@ -115,10 +107,10 @@
     GR_STATIC_ASSERT(kLast_GrBlendCoeff < (1 << kBlendCoeffShift));
     GR_STATIC_ASSERT(kFirstAdvancedGrBlendEquation - 1 < 4);
 
-    uint32_t blendKey = blendInfo.fWriteColor;
-    blendKey |= (blendInfo.fSrcBlend << kBlendWriteShift);
-    blendKey |= (blendInfo.fDstBlend << (kBlendWriteShift + kBlendCoeffShift));
-    blendKey |= (blendInfo.fEquation << (kBlendWriteShift + 2 * kBlendCoeffShift));
+    uint32_t key = blendInfo.fWriteColor;
+    key |= (blendInfo.fSrcBlend << kBlendWriteShift);
+    key |= (blendInfo.fDstBlend << (kBlendWriteShift + kBlendCoeffShift));
+    key |= (blendInfo.fEquation << (kBlendWriteShift + 2 * kBlendCoeffShift));
 
-    b->add32(blendKey);
+    return key;
 }
diff --git a/src/gpu/GrPipeline.h b/src/gpu/GrPipeline.h
index 1d36bc5..ea409c1 100644
--- a/src/gpu/GrPipeline.h
+++ b/src/gpu/GrPipeline.h
@@ -50,16 +50,9 @@
          */
         kHWAntialias = (1 << 0),
         /**
-         * Cause every pixel to be rasterized that is touched by the triangle anywhere (not just at
-         * pixel center). Additionally, if using MSAA, the sample mask will always have 100%
-         * coverage.
-         * NOTE: The primitive type must be a triangle type.
-         */
-        kConservativeRaster = (1 << 1),
-        /**
          * Modifies the vertex shader so that vertices will be positioned at pixel centers.
          */
-        kSnapVerticesToPixelCenters = (1 << 2),  // This value must be last. (See kLastInputFlag.)
+        kSnapVerticesToPixelCenters = (1 << 1),  // This value must be last. (See kLastInputFlag.)
     };
 
     struct InitArgs {
@@ -189,10 +182,9 @@
 
     const GrWindowRectsState& getWindowRectsState() const { return fWindowRectsState; }
 
-    bool isHWAntialiasState() const { return fFlags & InputFlags::kHWAntialias; }
-    bool usesConservativeRaster() const { return fFlags & InputFlags::kConservativeRaster; }
+    bool isHWAntialiasState() const { return SkToBool(fFlags & InputFlags::kHWAntialias); }
     bool snapVerticesToPixelCenters() const {
-        return fFlags & InputFlags::kSnapVerticesToPixelCenters;
+        return SkToBool(fFlags & InputFlags::kSnapVerticesToPixelCenters);
     }
     bool hasStencilClip() const {
         return SkToBool(fFlags & Flags::kHasStencilClip);
@@ -205,7 +197,7 @@
     GrXferBarrierType xferBarrierType(GrTexture*, const GrCaps&) const;
 
     // Used by Vulkan and Metal to cache their respective pipeline objects
-    void genKey(GrProcessorKeyBuilder*) const;
+    uint32_t getBlendInfoKey() const;
 
     const GrSwizzle& outputSwizzle() const { return fOutputSwizzle; }
 
diff --git a/src/gpu/GrProgramInfo.cpp b/src/gpu/GrProgramInfo.cpp
index 0adecb0..3391b61 100644
--- a/src/gpu/GrProgramInfo.cpp
+++ b/src/gpu/GrProgramInfo.cpp
@@ -115,12 +115,6 @@
     for (int i = 0; i < meshCount; ++i) {
         SkASSERT(fPrimProc.hasVertexAttributes() == meshes[i].hasVertexData());
         SkASSERT(fPrimProc.hasInstanceAttributes() == meshes[i].hasInstanceData());
-        if (fPipeline.usesConservativeRaster()) {
-            // Conservative raster, by default, only supports triangles. Implementations can
-            // optionally indicate that they also support points and lines, but we don't currently
-            // query or track that info.
-            SkASSERT(GrIsPrimTypeTris(meshes[i].primitiveType()));
-        }
     }
 }
 
diff --git a/src/gpu/mtl/GrMtlPipelineStateBuilder.mm b/src/gpu/mtl/GrMtlPipelineStateBuilder.mm
index 7a20531..854d50e 100644
--- a/src/gpu/mtl/GrMtlPipelineStateBuilder.mm
+++ b/src/gpu/mtl/GrMtlPipelineStateBuilder.mm
@@ -457,8 +457,6 @@
 
     GrProcessorKeyBuilder b(&desc->key());
 
-    programInfo.pipeline().genKey(&b);
-
     int keyLength = desc->key().count();
     SkASSERT(0 == (keyLength % 4));
     desc->fShaderKeyLength = SkToU32(keyLength);
@@ -471,6 +469,8 @@
     b.add32((uint32_t)programInfo.pipeline().isStencilEnabled());
     // Stencil samples don't seem to be tracked in the MTLRenderPipeline
 
+    b.add32(programInfo.pipeline().getBlendInfoKey());
+
     b.add32((uint32_t)primitiveType);
 
     return true;
diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp
index 6d19fc6..4e6c77c 100644
--- a/src/gpu/vk/GrVkCaps.cpp
+++ b/src/gpu/vk/GrVkCaps.cpp
@@ -501,10 +501,6 @@
         fSampleLocationsSupport = true;
     }
 
-    if (extensions.hasExtension(VK_EXT_CONSERVATIVE_RASTERIZATION_EXTENSION_NAME, 1)) {
-        fConservativeRasterSupport = true;
-    }
-
     // We could actually query and get a max size for each config, however maxImageDimension2D will
     // give the minimum max size across all configs. So for simplicity we will use that for now.
     fMaxRenderTargetSize = SkTMin(properties.limits.maxImageDimension2D, (uint32_t)INT_MAX);
diff --git a/src/gpu/vk/GrVkPipeline.cpp b/src/gpu/vk/GrVkPipeline.cpp
index effcfba..6868ff5 100644
--- a/src/gpu/vk/GrVkPipeline.cpp
+++ b/src/gpu/vk/GrVkPipeline.cpp
@@ -482,19 +482,6 @@
     rasterInfo->lineWidth = 1.0f;
 }
 
-static void setup_conservative_raster_info(
-        VkPipelineRasterizationConservativeStateCreateInfoEXT* conservativeRasterInfo) {
-    memset(conservativeRasterInfo, 0,
-           sizeof(VkPipelineRasterizationConservativeStateCreateInfoEXT));
-    conservativeRasterInfo->sType =
-            VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_CONSERVATIVE_STATE_CREATE_INFO_EXT;
-    conservativeRasterInfo->pNext = nullptr;
-    conservativeRasterInfo->flags = 0;
-    conservativeRasterInfo->conservativeRasterizationMode =
-            VK_CONSERVATIVE_RASTERIZATION_MODE_OVERESTIMATE_EXT;
-    conservativeRasterInfo->extraPrimitiveOverestimationSize = 0;
-}
-
 static void setup_dynamic_state(VkPipelineDynamicStateCreateInfo* dynamicInfo,
                                 VkDynamicState* dynamicStates) {
     memset(dynamicInfo, 0, sizeof(VkPipelineDynamicStateCreateInfo));
@@ -544,14 +531,6 @@
     VkPipelineRasterizationStateCreateInfo rasterInfo;
     setup_raster_state(programInfo.pipeline(), gpu->caps(), &rasterInfo);
 
-    VkPipelineRasterizationConservativeStateCreateInfoEXT conservativeRasterInfo;
-    if (programInfo.pipeline().usesConservativeRaster()) {
-        SkASSERT(gpu->caps()->conservativeRasterSupport());
-        setup_conservative_raster_info(&conservativeRasterInfo);
-        conservativeRasterInfo.pNext = rasterInfo.pNext;
-        rasterInfo.pNext = &conservativeRasterInfo;
-    }
-
     VkDynamicState dynamicStates[3];
     VkPipelineDynamicStateCreateInfo dynamicInfo;
     setup_dynamic_state(&dynamicInfo, dynamicStates);
diff --git a/src/gpu/vk/GrVkPipelineStateBuilder.cpp b/src/gpu/vk/GrVkPipelineStateBuilder.cpp
index 0cd3c8b..52c7c52 100644
--- a/src/gpu/vk/GrVkPipelineStateBuilder.cpp
+++ b/src/gpu/vk/GrVkPipelineStateBuilder.cpp
@@ -337,8 +337,6 @@
 
     GrProcessorKeyBuilder b(&desc->key());
 
-    programInfo.pipeline().genKey(&b);
-
     b.add32(GrVkGpu::kShader_PersistentCacheKeyType);
     int keyLength = desc->key().count();
     SkASSERT(0 == (keyLength % 4));
@@ -349,6 +347,8 @@
 
     stencil.genKey(&b);
 
+    b.add32(programInfo.pipeline().getBlendInfoKey());
+
     b.add32((uint32_t)primitiveType);
 
     return true;