Make GrPipeline hold a GrRenderTargetProxy (instead of a GrRenderTarget)
In a future world where GrSurface no longer has an origin it will be useful for the GrPipeline to be holding the GrRenderTargetProxy (which will still have an origin). Change-Id: I743a8cc07b6b92f8116227fb77b7c37da43cde8a Reviewed-on: https://skia-review.googlesource.com/26804 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
parent
480c90afc4
commit
2890fbfe14
@ -245,7 +245,7 @@ void CCPRGeometryView::Op::onExecute(GrOpFlushState* state) {
|
||||
return;
|
||||
}
|
||||
|
||||
GrPipeline pipeline(state->drawOpArgs().fRenderTarget, GrPipeline::ScissorState::kDisabled,
|
||||
GrPipeline pipeline(state->drawOpArgs().fProxy, GrPipeline::ScissorState::kDisabled,
|
||||
SkBlendMode::kSrcOver);
|
||||
|
||||
GrCCPRCoverageProcessor ccprProc(fView->fMode, pointsBuffer.get());
|
||||
|
@ -457,7 +457,7 @@ void GrGpu::didWriteToSurface(GrSurface* surface, const SkIRect* bounds, uint32_
|
||||
}
|
||||
|
||||
const GrGpu::MultisampleSpecs& GrGpu::queryMultisampleSpecs(const GrPipeline& pipeline) {
|
||||
GrRenderTarget* rt = pipeline.getRenderTarget();
|
||||
GrRenderTarget* rt = pipeline.renderTarget();
|
||||
SkASSERT(rt->numStencilSamples() > 1);
|
||||
|
||||
GrStencilSettings stencil;
|
||||
|
@ -97,7 +97,9 @@ public:
|
||||
|
||||
/** Additional data required on a per-op basis when executing GrDrawOps. */
|
||||
struct DrawOpArgs {
|
||||
GrRenderTarget* fRenderTarget;
|
||||
GrRenderTarget* renderTarget() const { return fProxy->priv().peekRenderTarget(); }
|
||||
|
||||
GrRenderTargetProxy* fProxy;
|
||||
const GrAppliedClip* fAppliedClip;
|
||||
GrXferProcessor::DstProxy fDstProxy;
|
||||
};
|
||||
@ -232,7 +234,7 @@ public:
|
||||
this->state()->putBackVertexSpace(vertices * vertexStride);
|
||||
}
|
||||
|
||||
GrRenderTarget* renderTarget() const { return this->state()->drawOpArgs().fRenderTarget; }
|
||||
GrRenderTargetProxy* proxy() const { return this->state()->drawOpArgs().fProxy; }
|
||||
|
||||
const GrAppliedClip* clip() const { return this->state()->drawOpArgs().fAppliedClip; }
|
||||
|
||||
@ -253,7 +255,7 @@ public:
|
||||
GrPipeline::InitArgs pipelineArgs;
|
||||
pipelineArgs.fFlags = pipelineFlags;
|
||||
pipelineArgs.fProcessors = processorSet;
|
||||
pipelineArgs.fRenderTarget = this->renderTarget();
|
||||
pipelineArgs.fProxy = this->proxy();
|
||||
pipelineArgs.fAppliedClip = this->clip();
|
||||
pipelineArgs.fDstProxy = this->dstProxy();
|
||||
pipelineArgs.fCaps = &this->caps();
|
||||
|
@ -118,7 +118,7 @@ void GrPathRendering::drawPath(const GrPipeline& pipeline,
|
||||
const GrPath* path) {
|
||||
fGpu->handleDirtyContext();
|
||||
if (GrXferBarrierType barrierType = pipeline.xferBarrierType(*fGpu->caps())) {
|
||||
fGpu->xferBarrier(pipeline.getRenderTarget(), barrierType);
|
||||
fGpu->xferBarrier(pipeline.renderTarget(), barrierType);
|
||||
}
|
||||
this->onDrawPath(pipeline, primProc, stencilPassSettings, path);
|
||||
}
|
||||
@ -135,7 +135,7 @@ void GrPathRendering::drawPaths(const GrPipeline& pipeline,
|
||||
int count) {
|
||||
fGpu->handleDirtyContext();
|
||||
if (GrXferBarrierType barrierType = pipeline.xferBarrierType(*fGpu->caps())) {
|
||||
fGpu->xferBarrier(pipeline.getRenderTarget(), barrierType);
|
||||
fGpu->xferBarrier(pipeline.renderTarget(), barrierType);
|
||||
}
|
||||
#ifdef SK_DEBUG
|
||||
pathRange->assertPathsLoaded(indices, indexType, count);
|
||||
|
@ -18,11 +18,11 @@
|
||||
#include "ops/GrOp.h"
|
||||
|
||||
void GrPipeline::init(const InitArgs& args) {
|
||||
SkASSERT(args.fRenderTarget);
|
||||
SkASSERT(args.fProxy);
|
||||
SkASSERT(args.fProcessors);
|
||||
SkASSERT(args.fProcessors->isFinalized());
|
||||
|
||||
fRenderTarget.reset(args.fRenderTarget);
|
||||
fProxy.reset(args.fProxy);
|
||||
|
||||
fFlags = args.fFlags;
|
||||
if (args.fAppliedClip) {
|
||||
@ -99,21 +99,21 @@ void GrPipeline::addDependenciesTo(GrOpList* opList, const GrCaps& caps) const {
|
||||
|
||||
GrXferBarrierType GrPipeline::xferBarrierType(const GrCaps& caps) const {
|
||||
if (fDstTextureProxy.get() &&
|
||||
fDstTextureProxy.get()->priv().peekTexture() == fRenderTarget.get()->asTexture()) {
|
||||
fDstTextureProxy.get()->priv().peekTexture() == fProxy.get()->priv().peekTexture()) {
|
||||
return kTexture_GrXferBarrierType;
|
||||
}
|
||||
return this->getXferProcessor().xferBarrierType(caps);
|
||||
}
|
||||
|
||||
GrPipeline::GrPipeline(GrRenderTarget* rt, ScissorState scissorState, SkBlendMode blendmode)
|
||||
: fRenderTarget(rt)
|
||||
, fScissorState()
|
||||
, fWindowRectsState()
|
||||
, fUserStencilSettings(&GrUserStencilSettings::kUnused)
|
||||
, fFlags()
|
||||
, fXferProcessor(GrPorterDuffXPFactory::MakeNoCoverageXP(blendmode))
|
||||
, fFragmentProcessors()
|
||||
, fNumColorProcessors(0) {
|
||||
GrPipeline::GrPipeline(GrRenderTargetProxy* proxy, ScissorState scissorState, SkBlendMode blendmode)
|
||||
: fProxy(proxy)
|
||||
, fScissorState()
|
||||
, fWindowRectsState()
|
||||
, fUserStencilSettings(&GrUserStencilSettings::kUnused)
|
||||
, fFlags()
|
||||
, fXferProcessor(GrPorterDuffXPFactory::MakeNoCoverageXP(blendmode))
|
||||
, fFragmentProcessors()
|
||||
, fNumColorProcessors(0) {
|
||||
if (ScissorState::kEnabled == scissorState) {
|
||||
fScissorState.set({0, 0, 0, 0}); // caller will use the DynamicState struct.
|
||||
}
|
||||
@ -124,7 +124,7 @@ GrPipeline::GrPipeline(GrRenderTarget* rt, ScissorState scissorState, SkBlendMod
|
||||
bool GrPipeline::AreEqual(const GrPipeline& a, const GrPipeline& b) {
|
||||
SkASSERT(&a != &b);
|
||||
|
||||
if (a.getRenderTarget() != b.getRenderTarget() ||
|
||||
if (a.proxy() != b.proxy() ||
|
||||
a.fFragmentProcessors.count() != b.fFragmentProcessors.count() ||
|
||||
a.fNumColorProcessors != b.fNumColorProcessors ||
|
||||
a.fScissorState != b.fScissorState ||
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "GrProcessorSet.h"
|
||||
#include "GrProgramDesc.h"
|
||||
#include "GrRect.h"
|
||||
#include "GrRenderTarget.h"
|
||||
#include "GrRenderTargetProxy.h"
|
||||
#include "GrScissorState.h"
|
||||
#include "GrUserStencilSettings.h"
|
||||
#include "GrWindowRectsState.h"
|
||||
@ -79,7 +79,7 @@ public:
|
||||
const GrProcessorSet* fProcessors = nullptr; // Must be finalized
|
||||
const GrUserStencilSettings* fUserStencil = &GrUserStencilSettings::kUnused;
|
||||
const GrAppliedClip* fAppliedClip = nullptr;
|
||||
GrRenderTarget* fRenderTarget = nullptr;
|
||||
GrRenderTargetProxy* fProxy = nullptr;
|
||||
const GrCaps* fCaps = nullptr;
|
||||
GrResourceProvider* fResourceProvider = nullptr;
|
||||
GrXferProcessor::DstProxy fDstProxy;
|
||||
@ -105,7 +105,7 @@ public:
|
||||
* must be "Porter Duff" (<= kLastCoeffMode). If using ScissorState::kEnabled, the caller must
|
||||
* specify a scissor rectangle through the DynamicState struct.
|
||||
**/
|
||||
GrPipeline(GrRenderTarget*, ScissorState, SkBlendMode);
|
||||
GrPipeline(GrRenderTargetProxy*, ScissorState, SkBlendMode);
|
||||
|
||||
GrPipeline(const InitArgs& args) { this->init(args); }
|
||||
|
||||
@ -116,7 +116,7 @@ public:
|
||||
void init(const InitArgs&);
|
||||
|
||||
/** True if the pipeline has been initialized. */
|
||||
bool isInitialized() const { return SkToBool(fRenderTarget.get()); }
|
||||
bool isInitialized() const { return SkToBool(fProxy.get()); }
|
||||
|
||||
/// @}
|
||||
|
||||
@ -212,7 +212,8 @@ public:
|
||||
*
|
||||
* @return The currently set render target.
|
||||
*/
|
||||
GrRenderTarget* getRenderTarget() const { return fRenderTarget.get(); }
|
||||
GrRenderTargetProxy* proxy() const { return fProxy.get(); }
|
||||
GrRenderTarget* renderTarget() const { return fProxy.get()->priv().peekRenderTarget(); }
|
||||
|
||||
const GrUserStencilSettings* getUserStencil() const { return fUserStencilSettings; }
|
||||
|
||||
@ -270,14 +271,14 @@ private:
|
||||
kIsBad_Flag = 0x40,
|
||||
};
|
||||
|
||||
using RenderTarget = GrPendingIOResource<GrRenderTarget, kWrite_GrIOType>;
|
||||
using RenderTargetProxy = GrPendingIOResource<GrRenderTargetProxy, kWrite_GrIOType>;
|
||||
using DstTextureProxy = GrPendingIOResource<GrTextureProxy, kRead_GrIOType>;
|
||||
using PendingFragmentProcessor = GrPendingProgramElement<const GrFragmentProcessor>;
|
||||
using FragmentProcessorArray = SkAutoSTArray<8, PendingFragmentProcessor>;
|
||||
|
||||
DstTextureProxy fDstTextureProxy;
|
||||
SkIPoint fDstTextureOffset;
|
||||
RenderTarget fRenderTarget;
|
||||
RenderTargetProxy fProxy;
|
||||
GrScissorState fScissorState;
|
||||
GrWindowRectsState fWindowRectsState;
|
||||
const GrUserStencilSettings* fUserStencilSettings;
|
||||
|
@ -218,17 +218,19 @@ bool GrProgramDesc::Build(GrProgramDesc* desc,
|
||||
// make sure any padding in the header is zeroed.
|
||||
memset(header, 0, kHeaderSize);
|
||||
|
||||
GrRenderTarget* rt = pipeline.getRenderTarget();
|
||||
GrRenderTargetProxy* proxy = pipeline.proxy();
|
||||
|
||||
if (requiredFeatures & GrProcessor::kSampleLocations_RequiredFeature) {
|
||||
SkASSERT(pipeline.isHWAntialiasState());
|
||||
|
||||
GrRenderTarget* rt = pipeline.renderTarget();
|
||||
header->fSamplePatternKey =
|
||||
rt->renderTargetPriv().getMultisampleSpecs(pipeline).fUniqueID;
|
||||
} else {
|
||||
header->fSamplePatternKey = 0;
|
||||
}
|
||||
|
||||
header->fOutputSwizzle = shaderCaps.configOutputSwizzle(rt->config()).asKey();
|
||||
header->fOutputSwizzle = shaderCaps.configOutputSwizzle(proxy->config()).asKey();
|
||||
|
||||
header->fSnapVerticesToPixelCenters = pipeline.snapVerticesToPixelCenters();
|
||||
header->fColorFragmentProcessorCnt = pipeline.numColorFragmentProcessors();
|
||||
|
@ -91,7 +91,7 @@ int GrRenderTargetPriv::numStencilBits() const {
|
||||
|
||||
const GrGpu::MultisampleSpecs&
|
||||
GrRenderTargetPriv::getMultisampleSpecs(const GrPipeline& pipeline) const {
|
||||
SkASSERT(fRenderTarget == pipeline.getRenderTarget()); // TODO: remove RT from pipeline.
|
||||
SkASSERT(fRenderTarget == pipeline.renderTarget()); // TODO: remove RT from pipeline.
|
||||
GrGpu* gpu = fRenderTarget->getGpu();
|
||||
if (auto id = fRenderTarget->fMultisampleSpecsID) {
|
||||
SkASSERT(gpu->queryMultisampleSpecs(pipeline).fUniqueID == id);
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
class GrFixedClip;
|
||||
class GrPath;
|
||||
class GrRenderTargetPriv;
|
||||
struct GrUserStencilSettings;
|
||||
|
||||
/** Class that adds methods to GrRenderTargetContext that are only intended for use internal to
|
||||
|
@ -68,7 +68,7 @@ void GrRenderTargetOpList::prepareOps(GrOpFlushState* flushState) {
|
||||
for (int i = 0; i < fRecordedOps.count(); ++i) {
|
||||
if (fRecordedOps[i].fOp) {
|
||||
GrOpFlushState::DrawOpArgs opArgs = {
|
||||
fTarget.get()->priv().peekRenderTarget(),
|
||||
fTarget.get()->asRenderTargetProxy(),
|
||||
fRecordedOps[i].fAppliedClip,
|
||||
fRecordedOps[i].fDstProxy
|
||||
};
|
||||
@ -138,7 +138,7 @@ bool GrRenderTargetOpList::executeOps(GrOpFlushState* flushState) {
|
||||
}
|
||||
|
||||
GrOpFlushState::DrawOpArgs opArgs {
|
||||
fTarget.get()->priv().peekRenderTarget(),
|
||||
fTarget.get()->asRenderTargetProxy(),
|
||||
fRecordedOps[i].fAppliedClip,
|
||||
fRecordedOps[i].fDstProxy
|
||||
};
|
||||
|
@ -498,9 +498,9 @@ GrCCPRCoverageOpsBuilder::CoverageOp::CoverageOp(const SkISize& drawBounds,
|
||||
void CoverageOp::onExecute(GrOpFlushState* flushState) {
|
||||
using Mode = GrCCPRCoverageProcessor::Mode;
|
||||
|
||||
SkDEBUGCODE(GrCCPRCoverageProcessor::Validate(flushState->drawOpArgs().fRenderTarget));
|
||||
SkDEBUGCODE(GrCCPRCoverageProcessor::Validate(flushState->drawOpArgs().fProxy));
|
||||
|
||||
GrPipeline pipeline(flushState->drawOpArgs().fRenderTarget, GrPipeline::ScissorState::kEnabled,
|
||||
GrPipeline pipeline(flushState->drawOpArgs().fProxy, GrPipeline::ScissorState::kEnabled,
|
||||
SkBlendMode::kPlus);
|
||||
|
||||
fMeshesScratchBuffer.reserve(1 + fScissorBatches.count());
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "GrCCPRCoverageProcessor.h"
|
||||
|
||||
#include "GrRenderTargetProxy.h"
|
||||
#include "ccpr/GrCCPRTriangleProcessor.h"
|
||||
#include "ccpr/GrCCPRQuadraticProcessor.h"
|
||||
#include "ccpr/GrCCPRCubicProcessor.h"
|
||||
@ -346,10 +347,10 @@ int PrimitiveProcessor::defineSoftSampleLocations(GrGLSLFragmentBuilder* f,
|
||||
|
||||
#include "GrRenderTarget.h"
|
||||
|
||||
void GrCCPRCoverageProcessor::Validate(GrRenderTarget* atlasTexture) {
|
||||
SkASSERT(kAtlasOrigin == atlasTexture->origin());
|
||||
SkASSERT(GrPixelConfigIsAlphaOnly(atlasTexture->config()));
|
||||
SkASSERT(GrPixelConfigIsFloatingPoint(atlasTexture->config()));
|
||||
void GrCCPRCoverageProcessor::Validate(GrRenderTargetProxy* atlasProxy) {
|
||||
SkASSERT(kAtlasOrigin == atlasProxy->origin());
|
||||
SkASSERT(GrPixelConfigIsAlphaOnly(atlasProxy->config()));
|
||||
SkASSERT(GrPixelConfigIsFloatingPoint(atlasProxy->config()));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -104,7 +104,7 @@ public:
|
||||
void enableDebugVisualizations() { fDebugVisualizations = true; }
|
||||
bool debugVisualizations() const { return fDebugVisualizations; }
|
||||
|
||||
static void Validate(GrRenderTarget* atlasTexture);
|
||||
static void Validate(GrRenderTargetProxy* atlasProxy);
|
||||
#endif
|
||||
|
||||
class PrimitiveProcessor;
|
||||
|
@ -298,7 +298,7 @@ void DrawPathsOp::onExecute(GrOpFlushState* flushState) {
|
||||
args.fCaps = &flushState->caps();
|
||||
args.fProcessors = &fProcessors;
|
||||
args.fFlags = fSRGBFlags;
|
||||
args.fRenderTarget = flushState->drawOpArgs().fRenderTarget;
|
||||
args.fProxy = flushState->drawOpArgs().fProxy;
|
||||
args.fDstProxy = flushState->drawOpArgs().fDstProxy;
|
||||
pipeline.init(args);
|
||||
|
||||
|
@ -1845,13 +1845,13 @@ bool GrGLGpu::flushGLState(const GrPipeline& pipeline, const GrPrimitiveProcesso
|
||||
if (blendInfo.fWriteColor) {
|
||||
// Swizzle the blend to match what the shader will output.
|
||||
const GrSwizzle& swizzle = this->caps()->shaderCaps()->configOutputSwizzle(
|
||||
pipeline.getRenderTarget()->config());
|
||||
pipeline.proxy()->config());
|
||||
this->flushBlend(blendInfo, swizzle);
|
||||
}
|
||||
|
||||
program->setData(primProc, pipeline);
|
||||
|
||||
GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(pipeline.getRenderTarget());
|
||||
GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(pipeline.renderTarget());
|
||||
GrStencilSettings stencil;
|
||||
if (pipeline.isStencilEnabled()) {
|
||||
// TODO: attach stencil and create settings during render target flush.
|
||||
@ -2546,12 +2546,12 @@ void GrGLGpu::draw(const GrPipeline& pipeline,
|
||||
|
||||
for (int i = 0; i < meshCount; ++i) {
|
||||
if (GrXferBarrierType barrierType = pipeline.xferBarrierType(*this->caps())) {
|
||||
this->xferBarrier(pipeline.getRenderTarget(), barrierType);
|
||||
this->xferBarrier(pipeline.renderTarget(), barrierType);
|
||||
}
|
||||
|
||||
if (dynamicStates) {
|
||||
if (pipeline.getScissorState().enabled()) {
|
||||
GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(pipeline.getRenderTarget());
|
||||
GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(pipeline.renderTarget());
|
||||
this->flushScissor(dynamicStates[i].fScissorRect,
|
||||
glRT->getViewport(), glRT->origin());
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ private:
|
||||
const GrPipeline::DynamicState dynamicStates[],
|
||||
int meshCount,
|
||||
const SkRect& bounds) override {
|
||||
GrGLRenderTarget* target = static_cast<GrGLRenderTarget*>(pipeline.getRenderTarget());
|
||||
GrGLRenderTarget* target = static_cast<GrGLRenderTarget*>(pipeline.renderTarget());
|
||||
if (!fRenderTarget) {
|
||||
fRenderTarget = target;
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ GrGLProgram* GrGLGpu::ProgramCache::refProgram(const GrGLGpu* gpu,
|
||||
std::unique_ptr<Entry>* entry = fMap.find(desc);
|
||||
if (!entry) {
|
||||
// Didn't find an origin-independent version, check with the specific origin
|
||||
GrSurfaceOrigin origin = pipeline.getRenderTarget()->origin();
|
||||
GrSurfaceOrigin origin = pipeline.proxy()->origin();
|
||||
desc.setSurfaceOriginKey(GrGLSLFragmentShaderBuilder::KeyForSurfaceOrigin(origin));
|
||||
desc.finalize();
|
||||
entry = fMap.find(desc);
|
||||
|
@ -70,7 +70,7 @@ void GrGLProgram::abandon() {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void GrGLProgram::setData(const GrPrimitiveProcessor& primProc, const GrPipeline& pipeline) {
|
||||
this->setRenderTargetState(primProc, pipeline.getRenderTarget());
|
||||
this->setRenderTargetState(primProc, pipeline.renderTarget());
|
||||
|
||||
// we set the textures, and uniforms for installed processors in a generic way, but subclasses
|
||||
// of GLProgram determine how to set coord transforms
|
||||
|
@ -90,7 +90,7 @@ bool GrGLProgramBuilder::compileAndAttachShaders(GrGLSLShaderBuilder& shader,
|
||||
if (outInputs->fFlipY) {
|
||||
GrProgramDesc* d = this->desc();
|
||||
d->setSurfaceOriginKey(GrGLSLFragmentShaderBuilder::KeyForSurfaceOrigin(
|
||||
this->pipeline().getRenderTarget()->origin()));
|
||||
this->pipeline().proxy()->origin()));
|
||||
d->finalize();
|
||||
}
|
||||
|
||||
@ -113,7 +113,7 @@ GrGLProgram* GrGLProgramBuilder::finalize() {
|
||||
// compile shaders and bind attributes / uniforms
|
||||
SkSL::Program::Settings settings;
|
||||
settings.fCaps = this->gpu()->glCaps().shaderCaps();
|
||||
settings.fFlipY = this->pipeline().getRenderTarget()->origin() != kTopLeft_GrSurfaceOrigin;
|
||||
settings.fFlipY = this->pipeline().proxy()->origin() != kTopLeft_GrSurfaceOrigin;
|
||||
SkSL::Program::Inputs inputs;
|
||||
SkTDArray<GrGLuint> shadersToDelete;
|
||||
if (!this->compileAndAttachShaders(fVS, programID, GR_GL_VERTEX_SHADER, &shadersToDelete,
|
||||
|
@ -300,7 +300,7 @@ void GrGLSLFragmentShaderBuilder::onFinalize() {
|
||||
void GrGLSLFragmentShaderBuilder::defineSampleOffsetArray(const char* name, const SkMatrix& m) {
|
||||
SkASSERT(fProgramBuilder->caps()->sampleLocationsSupport());
|
||||
const GrPipeline& pipeline = fProgramBuilder->pipeline();
|
||||
const GrRenderTargetPriv& rtp = pipeline.getRenderTarget()->renderTargetPriv();
|
||||
const GrRenderTargetPriv& rtp = pipeline.renderTarget()->renderTargetPriv();
|
||||
const GrGpu::MultisampleSpecs& specs = rtp.getMultisampleSpecs(pipeline);
|
||||
SkSTArray<16, SkPoint, true> offsets;
|
||||
offsets.push_back_n(specs.fEffectiveSampleCnt);
|
||||
|
@ -1681,7 +1681,7 @@ GLSLInstanceProcessor::Backend* GLSLInstanceProcessor::Backend::Create(const GrP
|
||||
return new BackendCoverage(opInfo, inputs);
|
||||
case GrAAType::kMSAA:
|
||||
case GrAAType::kMixedSamples: {
|
||||
const GrRenderTargetPriv& rtp = pipeline.getRenderTarget()->renderTargetPriv();
|
||||
const GrRenderTargetPriv& rtp = pipeline.renderTarget()->renderTargetPriv();
|
||||
const GrGpu::MultisampleSpecs& specs = rtp.getMultisampleSpecs(pipeline);
|
||||
return new BackendMultisample(opInfo, inputs, specs.fEffectiveSampleCnt);
|
||||
}
|
||||
|
@ -238,12 +238,12 @@ void InstancedOp::onExecute(GrOpFlushState* state) {
|
||||
if (fDisableSRGBOutputConversion) {
|
||||
args.fFlags |= GrPipeline::kDisableOutputConversionToSRGB_Flag;
|
||||
}
|
||||
args.fRenderTarget = state->drawOpArgs().fRenderTarget;
|
||||
args.fProxy = state->drawOpArgs().fProxy;
|
||||
args.fDstProxy = state->drawOpArgs().fDstProxy;
|
||||
pipeline.init(args);
|
||||
|
||||
if (GrXferBarrierType barrierType = pipeline.xferBarrierType(*state->gpu()->caps())) {
|
||||
state->gpu()->xferBarrier(pipeline.getRenderTarget(), barrierType);
|
||||
state->gpu()->xferBarrier(pipeline.renderTarget(), barrierType);
|
||||
}
|
||||
fInstancedRendering->draw(pipeline, fInfo, this);
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
#define GrMockGpu_DEFINED
|
||||
|
||||
#include "GrGpu.h"
|
||||
#include "GrRenderTarget.h"
|
||||
#include "GrSemaphore.h"
|
||||
#include "GrTexture.h"
|
||||
#include "SkTHash.h"
|
||||
|
@ -8,6 +8,7 @@
|
||||
#define GrMockTexture_DEFINED
|
||||
|
||||
#include "GrMockGpu.h"
|
||||
#include "GrRenderTarget.h"
|
||||
#include "GrTexture.h"
|
||||
#include "GrTexturePriv.h"
|
||||
#include "mock/GrMockTypes.h"
|
||||
|
@ -32,7 +32,7 @@ GrClearOp::GrClearOp(const GrFixedClip& clip, GrColor color, GrSurfaceProxy* pro
|
||||
}
|
||||
|
||||
void GrClearOp::onExecute(GrOpFlushState* state) {
|
||||
SkASSERT(state->drawOpArgs().fRenderTarget);
|
||||
SkASSERT(state->drawOpArgs().renderTarget());
|
||||
|
||||
state->commandBuffer()->clear(state->drawOpArgs().fRenderTarget, fClip, fColor);
|
||||
state->commandBuffer()->clear(state->drawOpArgs().renderTarget(), fClip, fColor);
|
||||
}
|
||||
|
@ -55,10 +55,10 @@ private:
|
||||
void onPrepare(GrOpFlushState*) override {}
|
||||
|
||||
void onExecute(GrOpFlushState* state) override {
|
||||
SkASSERT(state->drawOpArgs().fRenderTarget);
|
||||
SkASSERT(state->drawOpArgs().renderTarget());
|
||||
|
||||
state->commandBuffer()->clearStencilClip(state->drawOpArgs().fRenderTarget,
|
||||
fClip, fInsideStencilMask);
|
||||
GrRenderTarget* rt = state->drawOpArgs().renderTarget();
|
||||
state->commandBuffer()->clearStencilClip(rt, fClip, fInsideStencilMask);
|
||||
}
|
||||
|
||||
const GrFixedClip fClip;
|
||||
|
@ -40,9 +40,9 @@ private:
|
||||
void onPrepare(GrOpFlushState*) override {}
|
||||
|
||||
void onExecute(GrOpFlushState* state) override {
|
||||
SkASSERT(state->drawOpArgs().fRenderTarget);
|
||||
SkASSERT(state->drawOpArgs().renderTarget());
|
||||
|
||||
state->commandBuffer()->discard(state->drawOpArgs().fRenderTarget);
|
||||
state->commandBuffer()->discard(state->drawOpArgs().renderTarget());
|
||||
}
|
||||
|
||||
typedef GrOp INHERITED;
|
||||
|
@ -46,7 +46,7 @@ void GrDrawPathOpBase::initPipeline(const GrOpFlushState& state, GrPipeline* pip
|
||||
}
|
||||
args.fUserStencil = &kCoverPass;
|
||||
args.fAppliedClip = state.drawOpArgs().fAppliedClip;
|
||||
args.fRenderTarget = state.drawOpArgs().fRenderTarget;
|
||||
args.fProxy = state.drawOpArgs().fProxy;
|
||||
args.fCaps = &state.caps();
|
||||
args.fResourceProvider = state.resourceProvider();
|
||||
args.fDstProxy = state.drawOpArgs().fDstProxy;
|
||||
@ -61,7 +61,7 @@ void init_stencil_pass_settings(const GrOpFlushState& flushState,
|
||||
const GrAppliedClip* appliedClip = flushState.drawOpArgs().fAppliedClip;
|
||||
bool stencilClip = appliedClip && appliedClip->hasStencilClip();
|
||||
stencil->reset(GrPathRendering::GetStencilPassSettings(fillType), stencilClip,
|
||||
flushState.drawOpArgs().fRenderTarget->renderTargetPriv().numStencilBits());
|
||||
flushState.drawOpArgs().renderTarget()->renderTargetPriv().numStencilBits());
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -70,10 +70,10 @@ void GrMeshDrawOp::onExecute(GrOpFlushState* state) {
|
||||
while (currUploadIdx < fInlineUploads.count() &&
|
||||
fInlineUploads[currUploadIdx].fUploadBeforeToken == drawToken) {
|
||||
state->commandBuffer()->inlineUpload(state, fInlineUploads[currUploadIdx++].fUpload,
|
||||
state->drawOpArgs().fRenderTarget);
|
||||
state->drawOpArgs().renderTarget());
|
||||
}
|
||||
const QueuedDraw& draw = fQueuedDraws[currDrawIdx];
|
||||
SkASSERT(draw.fPipeline->getRenderTarget() == state->drawOpArgs().fRenderTarget);
|
||||
SkASSERT(draw.fPipeline->proxy() == state->drawOpArgs().fProxy);
|
||||
state->commandBuffer()->draw(*draw.fPipeline, *draw.fGeometryProcessor.get(),
|
||||
fMeshes.begin() + currMeshIdx, nullptr, draw.fMeshCnt,
|
||||
this->bounds());
|
||||
|
@ -126,7 +126,7 @@ GrPipeline::InitArgs GrSimpleMeshDrawOpHelper::pipelineInitArgs(
|
||||
GrPipeline::InitArgs args;
|
||||
args.fFlags = this->pipelineFlags();
|
||||
args.fProcessors = &this->processors();
|
||||
args.fRenderTarget = target->renderTarget();
|
||||
args.fProxy = target->proxy();
|
||||
args.fAppliedClip = target->clip();
|
||||
args.fDstProxy = target->dstProxy();
|
||||
args.fCaps = &target->caps();
|
||||
|
@ -11,9 +11,9 @@
|
||||
#include "GrOpFlushState.h"
|
||||
|
||||
void GrStencilPathOp::onExecute(GrOpFlushState* state) {
|
||||
SkASSERT(state->drawOpArgs().fRenderTarget);
|
||||
SkASSERT(state->drawOpArgs().renderTarget());
|
||||
|
||||
GrPathRendering::StencilPathArgs args(fUseHWAA, state->drawOpArgs().fRenderTarget,
|
||||
GrPathRendering::StencilPathArgs args(fUseHWAA, state->drawOpArgs().renderTarget(),
|
||||
&fViewMatrix, &fScissor, &fStencil);
|
||||
state->gpu()->pathRendering()->stencilPath(args, fPath.get());
|
||||
}
|
||||
|
@ -493,7 +493,7 @@ sk_sp<GrVkPipelineState> GrVkGpuCommandBuffer::prepareDrawState(
|
||||
|
||||
pipelineState->bind(fGpu, cbInfo.currentCmdBuf());
|
||||
|
||||
GrRenderTarget* rt = pipeline.getRenderTarget();
|
||||
GrRenderTarget* rt = pipeline.renderTarget();
|
||||
|
||||
if (!pipeline.getScissorState().enabled()) {
|
||||
GrVkPipeline::SetDynamicScissorRectState(fGpu, cbInfo.currentCmdBuf(), rt,
|
||||
@ -549,7 +549,7 @@ void GrVkGpuCommandBuffer::onDraw(const GrPipeline& pipeline,
|
||||
const GrPipeline::DynamicState dynamicStates[],
|
||||
int meshCount,
|
||||
const SkRect& bounds) {
|
||||
GrVkRenderTarget* target = static_cast<GrVkRenderTarget*>(pipeline.getRenderTarget());
|
||||
GrVkRenderTarget* target = static_cast<GrVkRenderTarget*>(pipeline.renderTarget());
|
||||
if (!fRenderTarget) {
|
||||
this->init(target);
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ static void setup_multisample_state(const GrPipeline& pipeline,
|
||||
multisampleInfo->sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
|
||||
multisampleInfo->pNext = nullptr;
|
||||
multisampleInfo->flags = 0;
|
||||
int numSamples = pipeline.getRenderTarget()->numColorSamples();
|
||||
int numSamples = pipeline.proxy()->numColorSamples();
|
||||
SkAssertResult(GrSampleCountToVkSampleCount(numSamples,
|
||||
&multisampleInfo->rasterizationSamples));
|
||||
float sampleShading = primProc.getSampleShading();
|
||||
|
@ -236,7 +236,7 @@ void GrVkPipelineState::setData(GrVkGpu* gpu,
|
||||
// freeing the tempData between calls.
|
||||
this->freeTempResources(gpu);
|
||||
|
||||
this->setRenderTargetState(pipeline.getRenderTarget());
|
||||
this->setRenderTargetState(pipeline.proxy());
|
||||
|
||||
SkSTArray<8, const GrResourceIOProcessor::TextureSampler*> textureBindings;
|
||||
SkSTArray<8, const GrResourceIOProcessor::BufferAccess*> bufferAccesses;
|
||||
@ -461,7 +461,9 @@ void GrVkPipelineState::writeTexelBuffers(
|
||||
}
|
||||
}
|
||||
|
||||
void GrVkPipelineState::setRenderTargetState(const GrRenderTarget* rt) {
|
||||
void GrVkPipelineState::setRenderTargetState(const GrRenderTargetProxy* proxy) {
|
||||
GrRenderTarget* rt = proxy->priv().peekRenderTarget();
|
||||
|
||||
// Load the RT height uniform if it is needed to y-flip gl_FragCoord.
|
||||
if (fBuiltinUniformHandles.fRTHeightUni.isValid() &&
|
||||
fRenderTargetState.fRenderTargetSize.fHeight != rt->height()) {
|
||||
@ -472,10 +474,10 @@ void GrVkPipelineState::setRenderTargetState(const GrRenderTarget* rt) {
|
||||
SkISize size;
|
||||
size.set(rt->width(), rt->height());
|
||||
SkASSERT(fBuiltinUniformHandles.fRTAdjustmentUni.isValid());
|
||||
if (fRenderTargetState.fRenderTargetOrigin != rt->origin() ||
|
||||
if (fRenderTargetState.fRenderTargetOrigin != proxy->origin() ||
|
||||
fRenderTargetState.fRenderTargetSize != size) {
|
||||
fRenderTargetState.fRenderTargetSize = size;
|
||||
fRenderTargetState.fRenderTargetOrigin = rt->origin();
|
||||
fRenderTargetState.fRenderTargetOrigin = proxy->origin();
|
||||
|
||||
float rtAdjustmentVec[4];
|
||||
fRenderTargetState.getRTAdjustmentVec(rtAdjustmentVec);
|
||||
@ -576,7 +578,7 @@ bool GrVkPipelineState::Desc::Build(Desc* desc,
|
||||
}
|
||||
|
||||
GrProcessorKeyBuilder b(&desc->key());
|
||||
GrVkRenderTarget* vkRT = (GrVkRenderTarget*)pipeline.getRenderTarget();
|
||||
GrVkRenderTarget* vkRT = (GrVkRenderTarget*)pipeline.renderTarget();
|
||||
vkRT->simpleRenderPass()->genKey(&b);
|
||||
|
||||
stencil.genKey(&b);
|
||||
|
@ -152,7 +152,7 @@ private:
|
||||
};
|
||||
|
||||
// Helper for setData() that sets the view matrix and loads the render target height uniform
|
||||
void setRenderTargetState(const GrRenderTarget*);
|
||||
void setRenderTargetState(const GrRenderTargetProxy*);
|
||||
|
||||
// GrVkResources
|
||||
GrVkPipeline* fPipeline;
|
||||
|
@ -80,7 +80,7 @@ bool GrVkPipelineStateBuilder::createVkShaderModule(VkShaderStageFlagBits stage,
|
||||
}
|
||||
if (inputs.fFlipY) {
|
||||
desc->setSurfaceOriginKey(GrGLSLFragmentShaderBuilder::KeyForSurfaceOrigin(
|
||||
this->pipeline().getRenderTarget()->origin()));
|
||||
this->pipeline().proxy()->origin()));
|
||||
desc->finalize();
|
||||
}
|
||||
return result;
|
||||
@ -140,7 +140,7 @@ GrVkPipelineState* GrVkPipelineStateBuilder::finalize(const GrStencilSettings& s
|
||||
VkPipelineShaderStageCreateInfo shaderStageInfo[3];
|
||||
SkSL::Program::Settings settings;
|
||||
settings.fCaps = this->caps()->shaderCaps();
|
||||
settings.fFlipY = this->pipeline().getRenderTarget()->origin() != kTopLeft_GrSurfaceOrigin;
|
||||
settings.fFlipY = this->pipeline().proxy()->origin() != kTopLeft_GrSurfaceOrigin;
|
||||
SkAssertResult(this->createVkShaderModule(VK_SHADER_STAGE_VERTEX_BIT,
|
||||
fVS,
|
||||
&vertShaderModule,
|
||||
|
@ -83,7 +83,7 @@ sk_sp<GrVkPipelineState> GrVkResourceProvider::PipelineStateCache::refPipelineSt
|
||||
#endif
|
||||
GrStencilSettings stencil;
|
||||
if (pipeline.isStencilEnabled()) {
|
||||
GrRenderTarget* rt = pipeline.getRenderTarget();
|
||||
GrRenderTarget* rt = pipeline.renderTarget();
|
||||
// TODO: attach stencil and create settings during render target flush.
|
||||
SkASSERT(rt->renderTargetPriv().getStencilAttachment());
|
||||
stencil.reset(*pipeline.getUserStencil(), pipeline.hasStencilClip(),
|
||||
@ -102,7 +102,7 @@ sk_sp<GrVkPipelineState> GrVkResourceProvider::PipelineStateCache::refPipelineSt
|
||||
std::unique_ptr<Entry>* entry = fMap.find(desc);
|
||||
if (!entry) {
|
||||
// Didn't find an origin-independent version, check with the specific origin
|
||||
GrSurfaceOrigin origin = pipeline.getRenderTarget()->origin();
|
||||
GrSurfaceOrigin origin = pipeline.proxy()->origin();
|
||||
desc.setSurfaceOriginKey(GrGLSLFragmentShaderBuilder::KeyForSurfaceOrigin(origin));
|
||||
desc.finalize();
|
||||
entry = fMap.find(desc);
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include "GrBackendSurface.h"
|
||||
#include "GrContextPriv.h"
|
||||
#include "GrRenderTarget.h"
|
||||
#include "GrRenderTargetContextPriv.h"
|
||||
#include "GrTexture.h"
|
||||
|
||||
|
@ -132,7 +132,7 @@ void test_sampleLocations(skiatest::Reporter* reporter, TestSampleLocationsInter
|
||||
for (int i = 0; i < numTestPatterns; ++i) {
|
||||
testInterface->overrideSamplePattern(kTestPatterns[i]);
|
||||
for (GrRenderTargetContext* rtc : {bottomUps[i].get(), topDowns[i].get()}) {
|
||||
GrPipeline dummyPipeline(rtc->accessRenderTarget(),
|
||||
GrPipeline dummyPipeline(rtc->asRenderTargetProxy(),
|
||||
GrPipeline::ScissorState::kDisabled,
|
||||
SkBlendMode::kSrcOver);
|
||||
GrRenderTarget* rt = rtc->accessRenderTarget();
|
||||
|
@ -367,8 +367,8 @@ sk_sp<const GrBuffer> DrawMeshHelper::getIndexBuffer() {
|
||||
}
|
||||
|
||||
void DrawMeshHelper::drawMesh(const GrMesh& mesh) {
|
||||
GrRenderTarget* rt = fState->drawOpArgs().fRenderTarget;
|
||||
GrPipeline pipeline(rt, GrPipeline::ScissorState::kDisabled, SkBlendMode::kSrc);
|
||||
GrRenderTargetProxy* proxy = fState->drawOpArgs().fProxy;
|
||||
GrPipeline pipeline(proxy, GrPipeline::ScissorState::kDisabled, SkBlendMode::kSrc);
|
||||
GrMeshTestProcessor mtp(mesh.isInstanced(), mesh.hasVertexData());
|
||||
fState->commandBuffer()->draw(pipeline, mtp, &mesh, nullptr, 1,
|
||||
SkRect::MakeIWH(kImageWidth, kImageHeight));
|
||||
|
@ -125,8 +125,8 @@ private:
|
||||
bool onCombineIfPossible(GrOp* other, const GrCaps& caps) override { return false; }
|
||||
void onPrepare(GrOpFlushState*) override {}
|
||||
void onExecute(GrOpFlushState* state) override {
|
||||
GrRenderTarget* rt = state->drawOpArgs().fRenderTarget;
|
||||
GrPipeline pipeline(rt, fScissorState, SkBlendMode::kSrc);
|
||||
GrRenderTargetProxy* proxy = state->drawOpArgs().fProxy;
|
||||
GrPipeline pipeline(proxy, fScissorState, SkBlendMode::kSrc);
|
||||
SkSTArray<kNumMeshes, GrMesh> meshes;
|
||||
for (int i = 0; i < kNumMeshes; ++i) {
|
||||
GrMesh& mesh = meshes.emplace_back(GrPrimitiveType::kTriangleStrip);
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "GrContext.h"
|
||||
#include "GrContextPriv.h"
|
||||
#include "GrGpu.h"
|
||||
#include "GrRenderTarget.h"
|
||||
#include "GrResourceProvider.h"
|
||||
#include "GrTest.h"
|
||||
#include "GrTexture.h"
|
||||
|
@ -12,6 +12,7 @@
|
||||
#if SK_SUPPORT_GPU && defined(SK_VULKAN)
|
||||
|
||||
#include "GrContextFactory.h"
|
||||
#include "GrRenderTarget.h"
|
||||
#include "GrTest.h"
|
||||
#include "GrTexture.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user