Only use GrRenderTarget for sample locations in GrGLSLProgramBuilder

The idea here is to separate information we can have at opList time:
   numSamples, origin, primProc, primProcProxies and pipeline
and what we can only have at flush time:
   sample locations

The opList-available parameters will then be moved into a descriptor (GrProgramInfo).

Change-Id: Iae044a98a0cfc8685569c923d154a6f9dabfeb75
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245621
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Robert Phillips 2019-10-02 15:22:24 -04:00 committed by Skia Commit-Bot
parent cb55010652
commit 65a77757a2
26 changed files with 89 additions and 56 deletions

View File

@ -50,7 +50,7 @@ void GrPathRendering::stencilPath(const StencilPathArgs& args, const GrPath* pat
this->onStencilPath(args, path);
}
void GrPathRendering::drawPath(GrRenderTarget* renderTarget, GrSurfaceOrigin origin,
void GrPathRendering::drawPath(GrRenderTarget* renderTarget, int numSamples, GrSurfaceOrigin origin,
const GrPrimitiveProcessor& primProc,
const GrPipeline& pipeline,
const GrPipeline::FixedDynamicState& fixedDynamicState,
@ -62,6 +62,6 @@ void GrPathRendering::drawPath(GrRenderTarget* renderTarget, GrSurfaceOrigin ori
*fGpu->caps())) {
fGpu->xferBarrier(renderTarget, barrierType);
}
this->onDrawPath(renderTarget, origin, primProc, pipeline, fixedDynamicState,
this->onDrawPath(renderTarget, numSamples, origin, primProc, pipeline, fixedDynamicState,
stencilPassSettings, path);
}

View File

@ -108,7 +108,7 @@ public:
void stencilPath(const StencilPathArgs& args, const GrPath* path);
void drawPath(GrRenderTarget*, GrSurfaceOrigin,
void drawPath(GrRenderTarget*, int numSamples, GrSurfaceOrigin,
const GrPrimitiveProcessor& primProc,
const GrPipeline& pipeline,
const GrPipeline::FixedDynamicState&,
@ -119,7 +119,7 @@ protected:
GrPathRendering(GrGpu* gpu) : fGpu(gpu) { }
virtual void onStencilPath(const StencilPathArgs&, const GrPath*) = 0;
virtual void onDrawPath(GrRenderTarget*, GrSurfaceOrigin,
virtual void onDrawPath(GrRenderTarget*, int numSamples, GrSurfaceOrigin,
const GrPrimitiveProcessor&,
const GrPipeline&,
const GrPipeline::FixedDynamicState&,

View File

@ -42,7 +42,7 @@ void GrGLPathRendering::setProjectionMatrix(const SkMatrix&, const SkISize&, GrS
sk_sp<GrPath> GrGLPathRendering::createPath(const SkPath&, const GrStyle&) { return nullptr; }
void GrGLPathRendering::onDrawPath(GrRenderTarget*, GrSurfaceOrigin,
void GrGLPathRendering::onDrawPath(GrRenderTarget*, int numSamples, GrSurfaceOrigin,
const GrPrimitiveProcessor&,
const GrPipeline&,
const GrPipeline::FixedDynamicState&,

View File

@ -1658,6 +1658,7 @@ void GrGLGpu::disableWindowRectangles() {
}
bool GrGLGpu::flushGLState(GrRenderTarget* renderTarget,
int numSamples,
GrSurfaceOrigin origin,
const GrPrimitiveProcessor& primProc,
const GrPipeline& pipeline,
@ -1677,7 +1678,8 @@ bool GrGLGpu::flushGLState(GrRenderTarget* renderTarget,
SkASSERT(SkToBool(primProcProxies) == SkToBool(primProc.numTextureSamplers()));
sk_sp<GrGLProgram> program(fProgramCache->refProgram(
this, renderTarget, origin, primProc, primProcProxies, pipeline, willDrawPoints));
this, renderTarget, numSamples, origin, primProc, primProcProxies, pipeline,
willDrawPoints));
if (!program) {
GrCapsDebugf(this->caps(), "Failed to create program!\n");
return false;
@ -2178,7 +2180,7 @@ void GrGLGpu::flushViewport(int width, int height) {
#endif
#endif
void GrGLGpu::draw(GrRenderTarget* renderTarget, GrSurfaceOrigin origin,
void GrGLGpu::draw(GrRenderTarget* renderTarget, int numSamples, GrSurfaceOrigin origin,
const GrPrimitiveProcessor& primProc,
const GrPipeline& pipeline,
const GrPipeline::FixedDynamicState* fixedDynamicState,
@ -2194,7 +2196,7 @@ void GrGLGpu::draw(GrRenderTarget* renderTarget, GrSurfaceOrigin origin,
break;
}
}
if (!this->flushGLState(renderTarget, origin, primProc, pipeline, fixedDynamicState,
if (!this->flushGLState(renderTarget, numSamples, origin, primProc, pipeline, fixedDynamicState,
dynamicStateArrays, meshCount, hasPoints)) {
return;
}

View File

@ -75,7 +75,7 @@ public:
// The GrGLOpsRenderPass does not buffer up draws before submitting them to the gpu.
// Thus this is the implementation of the draw call for the corresponding passthrough function
// on GrGLOpsRenderPass.
void draw(GrRenderTarget*, GrSurfaceOrigin,
void draw(GrRenderTarget*, int numSamples, GrSurfaceOrigin,
const GrPrimitiveProcessor&,
const GrPipeline&,
const GrPipeline::FixedDynamicState*,
@ -280,7 +280,7 @@ private:
// willDrawPoints must be true if point primitives will be rendered after setting the GL state.
// If DynamicStateArrays is not null then dynamicStateArraysLength is the number of dynamic
// state entries in each array.
bool flushGLState(GrRenderTarget*, GrSurfaceOrigin, const GrPrimitiveProcessor&,
bool flushGLState(GrRenderTarget*, int numSamples, GrSurfaceOrigin, const GrPrimitiveProcessor&,
const GrPipeline&, const GrPipeline::FixedDynamicState*,
const GrPipeline::DynamicStateArrays*, int dynamicStateArraysLength,
bool willDrawPoints);
@ -321,7 +321,7 @@ private:
void abandon();
void reset();
GrGLProgram* refProgram(GrGLGpu*, GrRenderTarget*, GrSurfaceOrigin,
GrGLProgram* refProgram(GrGLGpu*, GrRenderTarget*, int numSamples, GrSurfaceOrigin,
const GrPrimitiveProcessor&,
const GrTextureProxy* const primProcProxies[],
const GrPipeline&, bool hasPointSize);

View File

@ -47,6 +47,7 @@ void GrGLGpu::ProgramCache::reset() {
GrGLProgram* GrGLGpu::ProgramCache::refProgram(GrGLGpu* gpu,
GrRenderTarget* renderTarget,
int numSamples,
GrSurfaceOrigin origin,
const GrPrimitiveProcessor& primProc,
const GrTextureProxy* const primProcProxies[],
@ -67,7 +68,7 @@ GrGLProgram* GrGLGpu::ProgramCache::refProgram(GrGLGpu* gpu,
// We've pre-compiled the GL program, but don't have the GrGLProgram scaffolding
const GrGLPrecompiledProgram* precompiledProgram = &((*entry)->fPrecompiledProgram);
SkASSERT(precompiledProgram->fProgramID != 0);
GrGLProgram* program = GrGLProgramBuilder::CreateProgram(renderTarget, origin,
GrGLProgram* program = GrGLProgramBuilder::CreateProgram(renderTarget, numSamples, origin,
primProc, primProcProxies,
pipeline, &desc, fGpu,
precompiledProgram);
@ -79,7 +80,7 @@ GrGLProgram* GrGLGpu::ProgramCache::refProgram(GrGLGpu* gpu,
(*entry)->fProgram.reset(program);
} else if (!entry) {
// We have a cache miss
GrGLProgram* program = GrGLProgramBuilder::CreateProgram(renderTarget, origin,
GrGLProgram* program = GrGLProgramBuilder::CreateProgram(renderTarget, numSamples, origin,
primProc, primProcProxies,
pipeline, &desc, fGpu);
if (nullptr == program) {

View File

@ -59,8 +59,8 @@ private:
const GrMesh mesh[],
int meshCount,
const SkRect& bounds) override {
fGpu->draw(fRenderTarget, fOrigin, primProc, pipeline, fixedDynamicState,
dynamicStateArrays, mesh, meshCount);
fGpu->draw(fRenderTarget, fRenderTarget->numSamples(), fOrigin, primProc, pipeline,
fixedDynamicState, dynamicStateArrays, mesh, meshCount);
}
void onClear(const GrFixedClip& clip, const SkPMColor4f& color) override {

View File

@ -111,13 +111,14 @@ void GrGLPathRendering::onStencilPath(const StencilPathArgs& args, const GrPath*
}
}
void GrGLPathRendering::onDrawPath(GrRenderTarget* renderTarget, GrSurfaceOrigin origin,
void GrGLPathRendering::onDrawPath(GrRenderTarget* renderTarget,
int numSamples, GrSurfaceOrigin origin,
const GrPrimitiveProcessor& primProc,
const GrPipeline& pipeline,
const GrPipeline::FixedDynamicState& fixedDynamicState,
const GrStencilSettings& stencilPassSettings,
const GrPath* path) {
if (!this->gpu()->flushGLState(renderTarget, origin, primProc, pipeline,
if (!this->gpu()->flushGLState(renderTarget, numSamples, origin, primProc, pipeline,
&fixedDynamicState, nullptr, 1, false)) {
return;
}

View File

@ -65,7 +65,7 @@ public:
protected:
void onStencilPath(const StencilPathArgs&, const GrPath*) override;
void onDrawPath(GrRenderTarget*, GrSurfaceOrigin,
void onDrawPath(GrRenderTarget*, int numSamples, GrSurfaceOrigin,
const GrPrimitiveProcessor&,
const GrPipeline&,
const GrPipeline::FixedDynamicState&,

View File

@ -45,7 +45,9 @@ static void cleanup_program(GrGLGpu* gpu, GrGLuint programID,
cleanup_shaders(gpu, shaderIDs);
}
GrGLProgram* GrGLProgramBuilder::CreateProgram(GrRenderTarget* renderTarget, GrSurfaceOrigin origin,
GrGLProgram* GrGLProgramBuilder::CreateProgram(GrRenderTarget* renderTarget,
int numSamples,
GrSurfaceOrigin origin,
const GrPrimitiveProcessor& primProc,
const GrTextureProxy* const primProcProxies[],
const GrPipeline& pipeline,
@ -59,7 +61,7 @@ GrGLProgram* GrGLProgramBuilder::CreateProgram(GrRenderTarget* renderTarget, GrS
// create a builder. This will be handed off to effects so they can use it to add
// uniforms, varyings, textures, etc
GrGLProgramBuilder builder(gpu, renderTarget, origin,
GrGLProgramBuilder builder(gpu, renderTarget, numSamples, origin,
pipeline, primProc, primProcProxies, desc);
auto persistentCache = gpu->getContext()->priv().getPersistentCache();
@ -80,12 +82,13 @@ GrGLProgram* GrGLProgramBuilder::CreateProgram(GrRenderTarget* renderTarget, GrS
GrGLProgramBuilder::GrGLProgramBuilder(GrGLGpu* gpu,
GrRenderTarget* renderTarget,
int numSamples,
GrSurfaceOrigin origin,
const GrPipeline& pipeline,
const GrPrimitiveProcessor& primProc,
const GrTextureProxy* const primProcProxies[],
GrProgramDesc* desc)
: INHERITED(renderTarget, origin, primProc, primProcProxies, pipeline, desc)
: INHERITED(renderTarget, numSamples, origin, primProc, primProcProxies, pipeline, desc)
, fGpu(gpu)
, fVaryingHandler(this)
, fUniformHandler(this)

View File

@ -47,7 +47,9 @@ public:
* be supplied to skip the shader compilation.
* @return true if generation was successful.
*/
static GrGLProgram* CreateProgram(GrRenderTarget*, GrSurfaceOrigin,
static GrGLProgram* CreateProgram(GrRenderTarget*,
int numSamples,
GrSurfaceOrigin,
const GrPrimitiveProcessor&,
const GrTextureProxy* const primProcProxies[],
const GrPipeline&,
@ -62,7 +64,7 @@ public:
GrGLGpu* gpu() const { return fGpu; }
private:
GrGLProgramBuilder(GrGLGpu*, GrRenderTarget*, GrSurfaceOrigin,
GrGLProgramBuilder(GrGLGpu*, GrRenderTarget*, int numSamples, GrSurfaceOrigin,
const GrPipeline&, const GrPrimitiveProcessor&,
const GrTextureProxy* const primProcProxies[], GrProgramDesc*);

View File

@ -295,8 +295,7 @@ void GrGLSLFragmentShaderBuilder::onFinalize() {
== fUsedProcessorFeaturesAllStages_DebugOnly);
if (CustomFeatures::kSampleLocations & fProgramBuilder->header().processorFeatures()) {
const SkTArray<SkPoint>& sampleLocations =
fProgramBuilder->renderTarget()->renderTargetPriv().getSampleLocations();
const SkTArray<SkPoint>& sampleLocations = fProgramBuilder->getSampleLocations();
this->definitions().append("const float2 _sampleOffsets[] = float2[](");
for (int i = 0; i < sampleLocations.count(); ++i) {
SkPoint offset = sampleLocations[i] - SkPoint::Make(.5f, .5f);

View File

@ -20,7 +20,9 @@
const int GrGLSLProgramBuilder::kVarsPerBlock = 8;
GrGLSLProgramBuilder::GrGLSLProgramBuilder(GrRenderTarget* renderTarget, GrSurfaceOrigin origin,
GrGLSLProgramBuilder::GrGLSLProgramBuilder(GrRenderTarget* renderTarget,
int numSamples,
GrSurfaceOrigin origin,
const GrPrimitiveProcessor& primProc,
const GrTextureProxy* const primProcProxies[],
const GrPipeline& pipeline,
@ -30,6 +32,7 @@ GrGLSLProgramBuilder::GrGLSLProgramBuilder(GrRenderTarget* renderTarget, GrSurfa
, fFS(this)
, fStageIndex(-1)
, fRenderTarget(renderTarget)
, fNumSamples(numSamples)
, fOrigin(origin)
, fPipeline(pipeline)
, fPrimProc(primProc)

View File

@ -38,12 +38,14 @@ public:
const GrPrimitiveProcessor& primitiveProcessor() const { return fPrimProc; }
const GrTextureProxy* const* primProcProxies() const { return fPrimProcProxies; }
const GrRenderTarget* renderTarget() const { return fRenderTarget; }
GrPixelConfig config() const { return fRenderTarget->config(); }
int effectiveSampleCnt() const {
SkASSERT(GrProcessor::CustomFeatures::kSampleLocations & header().processorFeatures());
return fRenderTarget->renderTargetPriv().getSampleLocations().count();
}
const SkTArray<SkPoint>& getSampleLocations() const {
return fRenderTarget->renderTargetPriv().getSampleLocations();
}
int numSamples() const { return fNumSamples; }
GrSurfaceOrigin origin() const { return fOrigin; }
const GrPipeline& pipeline() const { return fPipeline; }
GrProgramDesc* desc() { return fDesc; }
@ -94,6 +96,7 @@ public:
int fStageIndex;
const GrRenderTarget* fRenderTarget;
const int fNumSamples;
const GrSurfaceOrigin fOrigin;
const GrPipeline& fPipeline;
const GrPrimitiveProcessor& fPrimProc;
@ -109,7 +112,9 @@ public:
int fFragmentProcessorCnt;
protected:
explicit GrGLSLProgramBuilder(GrRenderTarget* renderTarget, GrSurfaceOrigin origin,
explicit GrGLSLProgramBuilder(GrRenderTarget* renderTarget,
int numSamples,
GrSurfaceOrigin origin,
const GrPrimitiveProcessor&,
const GrTextureProxy* const primProcProxies[],
const GrPipeline&,

View File

@ -67,7 +67,9 @@ GrMtlPipelineState* GrMtlOpsRenderPass::prepareDrawState(
SkASSERT(SkToBool(primProcProxies) == SkToBool(primProc.numTextureSamplers()));
GrMtlPipelineState* pipelineState =
fGpu->resourceProvider().findOrCreateCompatiblePipelineState(fRenderTarget, fOrigin,
fGpu->resourceProvider().findOrCreateCompatiblePipelineState(fRenderTarget,
fRenderTarget->numSamples(),
fOrigin,
pipeline,
primProc,
primProcProxies,

View File

@ -59,14 +59,14 @@ public:
* @return true if generation was successful.
*/
static GrMtlPipelineState* CreatePipelineState(GrMtlGpu*,
GrRenderTarget*, GrSurfaceOrigin,
GrRenderTarget*, int numSamples, GrSurfaceOrigin,
const GrPrimitiveProcessor&,
const GrTextureProxy* const primProcProxies[],
const GrPipeline&,
Desc*);
private:
GrMtlPipelineStateBuilder(GrMtlGpu*, GrRenderTarget*, GrSurfaceOrigin,
GrMtlPipelineStateBuilder(GrMtlGpu*, GrRenderTarget*, int numSamples, GrSurfaceOrigin,
const GrPipeline&,
const GrPrimitiveProcessor&,
const GrTextureProxy* const primProcProxies[],

View File

@ -24,12 +24,12 @@
GrMtlPipelineState* GrMtlPipelineStateBuilder::CreatePipelineState(
GrMtlGpu* gpu,
GrRenderTarget* renderTarget, GrSurfaceOrigin origin,
GrRenderTarget* renderTarget, int numSamples, GrSurfaceOrigin origin,
const GrPrimitiveProcessor& primProc,
const GrTextureProxy* const primProcProxies[],
const GrPipeline& pipeline,
Desc* desc) {
GrMtlPipelineStateBuilder builder(gpu, renderTarget, origin, pipeline, primProc,
GrMtlPipelineStateBuilder builder(gpu, renderTarget, numSamples, origin, pipeline, primProc,
primProcProxies, desc);
if (!builder.emitAndInstallProcs()) {
@ -40,12 +40,13 @@ GrMtlPipelineState* GrMtlPipelineStateBuilder::CreatePipelineState(
GrMtlPipelineStateBuilder::GrMtlPipelineStateBuilder(GrMtlGpu* gpu,
GrRenderTarget* renderTarget,
int numSamples,
GrSurfaceOrigin origin,
const GrPipeline& pipeline,
const GrPrimitiveProcessor& primProc,
const GrTextureProxy* const primProcProxies[],
GrProgramDesc* desc)
: INHERITED(renderTarget, origin, primProc, primProcProxies, pipeline, desc)
: INHERITED(renderTarget, numSamples, origin, primProc, primProcProxies, pipeline, desc)
, fGpu(gpu)
, fUniformHandler(this)
, fVaryingHandler(this) {
@ -363,7 +364,8 @@ GrMtlPipelineState* GrMtlPipelineStateBuilder::finalize(GrRenderTarget* renderTa
pipelineDescriptor.vertexFunction = vertexFunction;
pipelineDescriptor.fragmentFunction = fragmentFunction;
pipelineDescriptor.vertexDescriptor = create_vertex_descriptor(primProc);
pipelineDescriptor.colorAttachments[0] = create_color_attachment(this->config(), pipeline);
pipelineDescriptor.colorAttachments[0] = create_color_attachment(renderTarget->config(),
pipeline);
pipelineDescriptor.sampleCount = renderTarget->numSamples();
bool hasStencilAttachment = SkToBool(renderTarget->renderTargetPriv().getStencilAttachment());
GrMtlCaps* mtlCaps = (GrMtlCaps*)this->caps();

View File

@ -25,7 +25,7 @@ public:
GrMtlResourceProvider(GrMtlGpu* gpu);
GrMtlPipelineState* findOrCreateCompatiblePipelineState(
GrRenderTarget*, GrSurfaceOrigin,
GrRenderTarget*, int numSamples, GrSurfaceOrigin,
const GrPipeline&,
const GrPrimitiveProcessor&,
const GrTextureProxy* const primProcProxies[],
@ -55,7 +55,7 @@ private:
~PipelineStateCache();
void release();
GrMtlPipelineState* refPipelineState(GrRenderTarget*, GrSurfaceOrigin,
GrMtlPipelineState* refPipelineState(GrRenderTarget*, int numSamples, GrSurfaceOrigin,
const GrPrimitiveProcessor&,
const GrTextureProxy* const primProcProxies[],
const GrPipeline&,

View File

@ -38,11 +38,11 @@ GrMtlResourceProvider::GrMtlResourceProvider(GrMtlGpu* gpu)
}
GrMtlPipelineState* GrMtlResourceProvider::findOrCreateCompatiblePipelineState(
GrRenderTarget* renderTarget, GrSurfaceOrigin origin,
GrRenderTarget* renderTarget, int numSamples, GrSurfaceOrigin origin,
const GrPipeline& pipeline, const GrPrimitiveProcessor& proc,
const GrTextureProxy* const primProcProxies[], GrPrimitiveType primType) {
return fPipelineStateCache->refPipelineState(renderTarget, origin, proc, primProcProxies,
pipeline, primType);
return fPipelineStateCache->refPipelineState(renderTarget, numSamples, origin, proc,
primProcProxies, pipeline, primType);
}
////////////////////////////////////////////////////////////////////////////////////////////////
@ -137,6 +137,7 @@ void GrMtlResourceProvider::PipelineStateCache::release() {
GrMtlPipelineState* GrMtlResourceProvider::PipelineStateCache::refPipelineState(
GrRenderTarget* renderTarget,
int numSamples,
GrSurfaceOrigin origin,
const GrPrimitiveProcessor& primProc,
const GrTextureProxy* const primProcProxies[],
@ -162,7 +163,7 @@ GrMtlPipelineState* GrMtlResourceProvider::PipelineStateCache::refPipelineState(
++fCacheMisses;
#endif
GrMtlPipelineState* pipelineState(GrMtlPipelineStateBuilder::CreatePipelineState(
fGpu, renderTarget, origin, primProc, primProcProxies, pipeline, &desc));
fGpu, renderTarget, numSamples, origin, primProc, primProcProxies, pipeline, &desc));
if (nullptr == pipelineState) {
return nullptr;
}

View File

@ -95,6 +95,7 @@ void GrDrawPathOp::onExecute(GrOpFlushState* state, const SkRect& chainBounds) {
GrStencilSettings stencil;
init_stencil_pass_settings(*state, this->fillType(), &stencil);
state->gpu()->pathRendering()->drawPath(state->drawOpArgs().renderTarget(),
state->drawOpArgs().renderTarget()->numSamples(),
state->drawOpArgs().origin(),
*pathProc, pipeline, fixedDynamicState, stencil,
fPath.get());

View File

@ -449,7 +449,9 @@ GrVkPipelineState* GrVkOpsRenderPass::prepareDrawState(
SkASSERT(SkToBool(primProcProxies) == SkToBool(primProc.numTextureSamplers()));
GrVkPipelineState* pipelineState =
fGpu->resourceProvider().findOrCreateCompatiblePipelineState(fRenderTarget, fOrigin,
fGpu->resourceProvider().findOrCreateCompatiblePipelineState(fRenderTarget,
fRenderTarget->numSamples(),
fOrigin,
pipeline,
primProc,
primProcProxies,

View File

@ -21,7 +21,9 @@ typedef size_t shader_size;
GrVkPipelineState* GrVkPipelineStateBuilder::CreatePipelineState(
GrVkGpu* gpu,
GrRenderTarget* renderTarget, GrSurfaceOrigin origin,
GrRenderTarget* renderTarget,
int numSamples,
GrSurfaceOrigin origin,
const GrPrimitiveProcessor& primProc,
const GrTextureProxy* const primProcProxies[],
const GrPipeline& pipeline,
@ -31,7 +33,7 @@ GrVkPipelineState* GrVkPipelineStateBuilder::CreatePipelineState(
VkRenderPass compatibleRenderPass) {
// create a builder. This will be handed off to effects so they can use it to add
// uniforms, varyings, textures, etc
GrVkPipelineStateBuilder builder(gpu, renderTarget, origin, pipeline, primProc,
GrVkPipelineStateBuilder builder(gpu, renderTarget, numSamples, origin, pipeline, primProc,
primProcProxies, desc);
if (!builder.emitAndInstallProcs()) {
@ -43,12 +45,13 @@ GrVkPipelineState* GrVkPipelineStateBuilder::CreatePipelineState(
GrVkPipelineStateBuilder::GrVkPipelineStateBuilder(GrVkGpu* gpu,
GrRenderTarget* renderTarget,
int numSamples,
GrSurfaceOrigin origin,
const GrPipeline& pipeline,
const GrPrimitiveProcessor& primProc,
const GrTextureProxy* const primProcProxies[],
GrProgramDesc* desc)
: INHERITED(renderTarget, origin, primProc, primProcProxies, pipeline, desc)
: INHERITED(renderTarget, numSamples, origin, primProc, primProcProxies, pipeline, desc)
, fGpu(gpu)
, fVaryingHandler(this)
, fUniformHandler(this) {}
@ -292,7 +295,7 @@ GrVkPipelineState* GrVkPipelineStateBuilder::finalize(const GrStencilSettings& s
}
}
GrVkPipeline* pipeline = resourceProvider.createPipeline(
this->renderTarget()->numSamples(), fPrimProc, fPipeline, stencil, this->origin(),
fNumSamples, fPrimProc, fPipeline, stencil, this->origin(),
shaderStageInfo, numShaderStages, primitiveType, compatibleRenderPass, pipelineLayout);
for (int i = 0; i < kGrShaderTypeCount; ++i) {
// This if check should not be needed since calling destroy on a VK_NULL_HANDLE is allowed.

View File

@ -63,7 +63,9 @@ public:
* @return true if generation was successful.
*/
static GrVkPipelineState* CreatePipelineState(GrVkGpu*,
GrRenderTarget*, GrSurfaceOrigin,
GrRenderTarget*,
int numSamples,
GrSurfaceOrigin,
const GrPrimitiveProcessor&,
const GrTextureProxy* const primProcProxies[],
const GrPipeline&,
@ -80,7 +82,9 @@ public:
void finalizeFragmentSecondaryColor(GrShaderVar& outputColor) override;
private:
GrVkPipelineStateBuilder(GrVkGpu*, GrRenderTarget*, GrSurfaceOrigin,
GrVkPipelineStateBuilder(GrVkGpu*, GrRenderTarget*,
int numSamples,
GrSurfaceOrigin,
const GrPipeline&,
const GrPrimitiveProcessor&,
const GrTextureProxy* const primProcProxies[],

View File

@ -78,6 +78,7 @@ void GrVkResourceProvider::PipelineStateCache::release() {
GrVkPipelineState* GrVkResourceProvider::PipelineStateCache::refPipelineState(
GrRenderTarget* renderTarget,
int numSamples,
GrSurfaceOrigin origin,
const GrPrimitiveProcessor& primProc,
const GrTextureProxy* const primProcProxies[],
@ -112,8 +113,8 @@ GrVkPipelineState* GrVkResourceProvider::PipelineStateCache::refPipelineState(
++fCacheMisses;
#endif
GrVkPipelineState* pipelineState(GrVkPipelineStateBuilder::CreatePipelineState(
fGpu, renderTarget, origin, primProc, primProcProxies, pipeline, stencil,
primitiveType, &desc, compatibleRenderPass));
fGpu, renderTarget, numSamples, origin, primProc, primProcProxies, pipeline,
stencil, primitiveType, &desc, compatibleRenderPass));
if (nullptr == pipelineState) {
return nullptr;
}

View File

@ -228,12 +228,13 @@ GrVkSamplerYcbcrConversion* GrVkResourceProvider::findOrCreateCompatibleSamplerY
}
GrVkPipelineState* GrVkResourceProvider::findOrCreateCompatiblePipelineState(
GrRenderTarget* renderTarget, GrSurfaceOrigin origin,
GrRenderTarget* renderTarget, int numSamples, GrSurfaceOrigin origin,
const GrPipeline& pipeline, const GrPrimitiveProcessor& proc,
const GrTextureProxy* const primProcProxies[], GrPrimitiveType primitiveType,
VkRenderPass compatibleRenderPass) {
return fPipelineStateCache->refPipelineState(renderTarget, origin, proc, primProcProxies,
pipeline, primitiveType, compatibleRenderPass);
return fPipelineStateCache->refPipelineState(renderTarget, numSamples, origin, proc,
primProcProxies, pipeline, primitiveType,
compatibleRenderPass);
}
void GrVkResourceProvider::getSamplerDescriptorSetHandle(VkDescriptorType type,

View File

@ -114,7 +114,7 @@ public:
const GrVkYcbcrConversionInfo& ycbcrInfo);
GrVkPipelineState* findOrCreateCompatiblePipelineState(
GrRenderTarget*, GrSurfaceOrigin,
GrRenderTarget*, int numSamples, GrSurfaceOrigin,
const GrPipeline&,
const GrPrimitiveProcessor&,
const GrTextureProxy* const primProcProxies[],
@ -197,7 +197,7 @@ private:
void abandon();
void release();
GrVkPipelineState* refPipelineState(GrRenderTarget*, GrSurfaceOrigin,
GrVkPipelineState* refPipelineState(GrRenderTarget*, int numSamples, GrSurfaceOrigin,
const GrPrimitiveProcessor&,
const GrTextureProxy* const primProcProxies[],
const GrPipeline&,