Revert "Add a "conservative raster" flag to GrPipeline and implement in Vulkan"
This reverts commit ee6b49b3af
.
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>
This commit is contained in:
parent
0f3a26dd18
commit
368570db19
@ -26,7 +26,6 @@ GrCaps::GrCaps(const GrContextOptions& options) {
|
|||||||
fMultisampleDisableSupport = false;
|
fMultisampleDisableSupport = false;
|
||||||
fInstanceAttribSupport = false;
|
fInstanceAttribSupport = false;
|
||||||
fMixedSamplesSupport = false;
|
fMixedSamplesSupport = false;
|
||||||
fConservativeRasterSupport = false;
|
|
||||||
fMSAAResolvesAutomatically = false;
|
fMSAAResolvesAutomatically = false;
|
||||||
fUsePrimitiveRestart = false;
|
fUsePrimitiveRestart = false;
|
||||||
fPreferClientSideDynamicBuffers = false;
|
fPreferClientSideDynamicBuffers = false;
|
||||||
@ -175,7 +174,6 @@ void GrCaps::dumpJSON(SkJSONWriter* writer) const {
|
|||||||
writer->appendBool("Multisample disable support", fMultisampleDisableSupport);
|
writer->appendBool("Multisample disable support", fMultisampleDisableSupport);
|
||||||
writer->appendBool("Instance Attrib Support", fInstanceAttribSupport);
|
writer->appendBool("Instance Attrib Support", fInstanceAttribSupport);
|
||||||
writer->appendBool("Mixed Samples Support", fMixedSamplesSupport);
|
writer->appendBool("Mixed Samples Support", fMixedSamplesSupport);
|
||||||
writer->appendBool("Conservative Raster Support", fConservativeRasterSupport);
|
|
||||||
writer->appendBool("MSAA Resolves Automatically", fMSAAResolvesAutomatically);
|
writer->appendBool("MSAA Resolves Automatically", fMSAAResolvesAutomatically);
|
||||||
writer->appendBool("Use primitive restart", fUsePrimitiveRestart);
|
writer->appendBool("Use primitive restart", fUsePrimitiveRestart);
|
||||||
writer->appendBool("Prefer client-side dynamic buffers", fPreferClientSideDynamicBuffers);
|
writer->appendBool("Prefer client-side dynamic buffers", fPreferClientSideDynamicBuffers);
|
||||||
|
@ -48,7 +48,6 @@ public:
|
|||||||
bool multisampleDisableSupport() const { return fMultisampleDisableSupport; }
|
bool multisampleDisableSupport() const { return fMultisampleDisableSupport; }
|
||||||
bool instanceAttribSupport() const { return fInstanceAttribSupport; }
|
bool instanceAttribSupport() const { return fInstanceAttribSupport; }
|
||||||
bool mixedSamplesSupport() const { return fMixedSamplesSupport; }
|
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
|
// 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
|
// 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.
|
// extension, and any wrapped render target is the client's responsibility.
|
||||||
@ -466,7 +465,6 @@ protected:
|
|||||||
bool fMultisampleDisableSupport : 1;
|
bool fMultisampleDisableSupport : 1;
|
||||||
bool fInstanceAttribSupport : 1;
|
bool fInstanceAttribSupport : 1;
|
||||||
bool fMixedSamplesSupport : 1;
|
bool fMixedSamplesSupport : 1;
|
||||||
bool fConservativeRasterSupport : 1;
|
|
||||||
bool fMSAAResolvesAutomatically : 1;
|
bool fMSAAResolvesAutomatically : 1;
|
||||||
bool fUsePrimitiveRestart : 1;
|
bool fUsePrimitiveRestart : 1;
|
||||||
bool fPreferClientSideDynamicBuffers : 1;
|
bool fPreferClientSideDynamicBuffers : 1;
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
#include "src/gpu/GrProgramInfo.h"
|
#include "src/gpu/GrProgramInfo.h"
|
||||||
#include "src/gpu/GrRenderTarget.h"
|
#include "src/gpu/GrRenderTarget.h"
|
||||||
#include "src/gpu/GrRenderTargetPriv.h"
|
#include "src/gpu/GrRenderTargetPriv.h"
|
||||||
#include "src/gpu/GrStencilAttachment.h"
|
|
||||||
#include "src/gpu/GrTexturePriv.h"
|
#include "src/gpu/GrTexturePriv.h"
|
||||||
|
|
||||||
void GrOpsRenderPass::clear(const GrFixedClip& clip, const SkPMColor4f& color) {
|
void GrOpsRenderPass::clear(const GrFixedClip& clip, const SkPMColor4f& color) {
|
||||||
@ -45,8 +44,6 @@ bool GrOpsRenderPass::draw(const GrProgramInfo& programInfo,
|
|||||||
#ifdef SK_DEBUG
|
#ifdef SK_DEBUG
|
||||||
SkASSERT(!programInfo.primProc().hasInstanceAttributes() ||
|
SkASSERT(!programInfo.primProc().hasInstanceAttributes() ||
|
||||||
this->gpu()->caps()->instanceAttribSupport());
|
this->gpu()->caps()->instanceAttribSupport());
|
||||||
SkASSERT(!programInfo.pipeline().usesConservativeRaster() ||
|
|
||||||
this->gpu()->caps()->conservativeRasterSupport());
|
|
||||||
|
|
||||||
programInfo.compatibleWithMeshes(meshes, meshCount);
|
programInfo.compatibleWithMeshes(meshes, meshCount);
|
||||||
programInfo.checkAllInstantiated();
|
programInfo.checkAllInstantiated();
|
||||||
|
@ -99,15 +99,7 @@ GrPipeline::GrPipeline(GrScissorTest scissorTest, sk_sp<const GrXferProcessor> x
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrPipeline::genKey(GrProcessorKeyBuilder* b) const {
|
uint32_t GrPipeline::getBlendInfoKey() 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();
|
const GrXferProcessor::BlendInfo& blendInfo = this->getXferProcessor().getBlendInfo();
|
||||||
|
|
||||||
static const uint32_t kBlendWriteShift = 1;
|
static const uint32_t kBlendWriteShift = 1;
|
||||||
@ -115,10 +107,10 @@ void GrPipeline::genKey(GrProcessorKeyBuilder* b) const {
|
|||||||
GR_STATIC_ASSERT(kLast_GrBlendCoeff < (1 << kBlendCoeffShift));
|
GR_STATIC_ASSERT(kLast_GrBlendCoeff < (1 << kBlendCoeffShift));
|
||||||
GR_STATIC_ASSERT(kFirstAdvancedGrBlendEquation - 1 < 4);
|
GR_STATIC_ASSERT(kFirstAdvancedGrBlendEquation - 1 < 4);
|
||||||
|
|
||||||
uint32_t blendKey = blendInfo.fWriteColor;
|
uint32_t key = blendInfo.fWriteColor;
|
||||||
blendKey |= (blendInfo.fSrcBlend << kBlendWriteShift);
|
key |= (blendInfo.fSrcBlend << kBlendWriteShift);
|
||||||
blendKey |= (blendInfo.fDstBlend << (kBlendWriteShift + kBlendCoeffShift));
|
key |= (blendInfo.fDstBlend << (kBlendWriteShift + kBlendCoeffShift));
|
||||||
blendKey |= (blendInfo.fEquation << (kBlendWriteShift + 2 * kBlendCoeffShift));
|
key |= (blendInfo.fEquation << (kBlendWriteShift + 2 * kBlendCoeffShift));
|
||||||
|
|
||||||
b->add32(blendKey);
|
return key;
|
||||||
}
|
}
|
||||||
|
@ -49,17 +49,10 @@ public:
|
|||||||
* the 3D API.
|
* the 3D API.
|
||||||
*/
|
*/
|
||||||
kHWAntialias = (1 << 0),
|
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.
|
* 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 {
|
struct InitArgs {
|
||||||
@ -189,10 +182,9 @@ public:
|
|||||||
|
|
||||||
const GrWindowRectsState& getWindowRectsState() const { return fWindowRectsState; }
|
const GrWindowRectsState& getWindowRectsState() const { return fWindowRectsState; }
|
||||||
|
|
||||||
bool isHWAntialiasState() const { return fFlags & InputFlags::kHWAntialias; }
|
bool isHWAntialiasState() const { return SkToBool(fFlags & InputFlags::kHWAntialias); }
|
||||||
bool usesConservativeRaster() const { return fFlags & InputFlags::kConservativeRaster; }
|
|
||||||
bool snapVerticesToPixelCenters() const {
|
bool snapVerticesToPixelCenters() const {
|
||||||
return fFlags & InputFlags::kSnapVerticesToPixelCenters;
|
return SkToBool(fFlags & InputFlags::kSnapVerticesToPixelCenters);
|
||||||
}
|
}
|
||||||
bool hasStencilClip() const {
|
bool hasStencilClip() const {
|
||||||
return SkToBool(fFlags & Flags::kHasStencilClip);
|
return SkToBool(fFlags & Flags::kHasStencilClip);
|
||||||
@ -205,7 +197,7 @@ public:
|
|||||||
GrXferBarrierType xferBarrierType(GrTexture*, const GrCaps&) const;
|
GrXferBarrierType xferBarrierType(GrTexture*, const GrCaps&) const;
|
||||||
|
|
||||||
// Used by Vulkan and Metal to cache their respective pipeline objects
|
// 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; }
|
const GrSwizzle& outputSwizzle() const { return fOutputSwizzle; }
|
||||||
|
|
||||||
|
@ -115,12 +115,6 @@ void GrProgramInfo::compatibleWithMeshes(const GrMesh meshes[], int meshCount) c
|
|||||||
for (int i = 0; i < meshCount; ++i) {
|
for (int i = 0; i < meshCount; ++i) {
|
||||||
SkASSERT(fPrimProc.hasVertexAttributes() == meshes[i].hasVertexData());
|
SkASSERT(fPrimProc.hasVertexAttributes() == meshes[i].hasVertexData());
|
||||||
SkASSERT(fPrimProc.hasInstanceAttributes() == meshes[i].hasInstanceData());
|
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()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -457,8 +457,6 @@ bool GrMtlPipelineStateBuilder::Desc::Build(Desc* desc,
|
|||||||
|
|
||||||
GrProcessorKeyBuilder b(&desc->key());
|
GrProcessorKeyBuilder b(&desc->key());
|
||||||
|
|
||||||
programInfo.pipeline().genKey(&b);
|
|
||||||
|
|
||||||
int keyLength = desc->key().count();
|
int keyLength = desc->key().count();
|
||||||
SkASSERT(0 == (keyLength % 4));
|
SkASSERT(0 == (keyLength % 4));
|
||||||
desc->fShaderKeyLength = SkToU32(keyLength);
|
desc->fShaderKeyLength = SkToU32(keyLength);
|
||||||
@ -471,6 +469,8 @@ bool GrMtlPipelineStateBuilder::Desc::Build(Desc* desc,
|
|||||||
b.add32((uint32_t)programInfo.pipeline().isStencilEnabled());
|
b.add32((uint32_t)programInfo.pipeline().isStencilEnabled());
|
||||||
// Stencil samples don't seem to be tracked in the MTLRenderPipeline
|
// Stencil samples don't seem to be tracked in the MTLRenderPipeline
|
||||||
|
|
||||||
|
b.add32(programInfo.pipeline().getBlendInfoKey());
|
||||||
|
|
||||||
b.add32((uint32_t)primitiveType);
|
b.add32((uint32_t)primitiveType);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -501,10 +501,6 @@ void GrVkCaps::initGrCaps(const GrVkInterface* vkInterface,
|
|||||||
fSampleLocationsSupport = true;
|
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
|
// 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.
|
// 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);
|
fMaxRenderTargetSize = SkTMin(properties.limits.maxImageDimension2D, (uint32_t)INT_MAX);
|
||||||
|
@ -482,19 +482,6 @@ static void setup_raster_state(const GrPipeline& pipeline,
|
|||||||
rasterInfo->lineWidth = 1.0f;
|
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,
|
static void setup_dynamic_state(VkPipelineDynamicStateCreateInfo* dynamicInfo,
|
||||||
VkDynamicState* dynamicStates) {
|
VkDynamicState* dynamicStates) {
|
||||||
memset(dynamicInfo, 0, sizeof(VkPipelineDynamicStateCreateInfo));
|
memset(dynamicInfo, 0, sizeof(VkPipelineDynamicStateCreateInfo));
|
||||||
@ -544,14 +531,6 @@ GrVkPipeline* GrVkPipeline::Create(
|
|||||||
VkPipelineRasterizationStateCreateInfo rasterInfo;
|
VkPipelineRasterizationStateCreateInfo rasterInfo;
|
||||||
setup_raster_state(programInfo.pipeline(), gpu->caps(), &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];
|
VkDynamicState dynamicStates[3];
|
||||||
VkPipelineDynamicStateCreateInfo dynamicInfo;
|
VkPipelineDynamicStateCreateInfo dynamicInfo;
|
||||||
setup_dynamic_state(&dynamicInfo, dynamicStates);
|
setup_dynamic_state(&dynamicInfo, dynamicStates);
|
||||||
|
@ -337,8 +337,6 @@ bool GrVkPipelineStateBuilder::Desc::Build(Desc* desc,
|
|||||||
|
|
||||||
GrProcessorKeyBuilder b(&desc->key());
|
GrProcessorKeyBuilder b(&desc->key());
|
||||||
|
|
||||||
programInfo.pipeline().genKey(&b);
|
|
||||||
|
|
||||||
b.add32(GrVkGpu::kShader_PersistentCacheKeyType);
|
b.add32(GrVkGpu::kShader_PersistentCacheKeyType);
|
||||||
int keyLength = desc->key().count();
|
int keyLength = desc->key().count();
|
||||||
SkASSERT(0 == (keyLength % 4));
|
SkASSERT(0 == (keyLength % 4));
|
||||||
@ -349,6 +347,8 @@ bool GrVkPipelineStateBuilder::Desc::Build(Desc* desc,
|
|||||||
|
|
||||||
stencil.genKey(&b);
|
stencil.genKey(&b);
|
||||||
|
|
||||||
|
b.add32(programInfo.pipeline().getBlendInfoKey());
|
||||||
|
|
||||||
b.add32((uint32_t)primitiveType);
|
b.add32((uint32_t)primitiveType);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user