diff options
author | 2015-01-21 10:16:17 -0800 | |
---|---|---|
committer | 2015-01-21 10:16:18 -0800 | |
commit | b77e4b6bf08b1619982d0a835ab4daf693aefcb6 (patch) | |
tree | b7bfdbd2af809cb3eb1c4e574a8d7d4e19b4dd5c /src/gpu | |
parent | fb62b3d423fa34c672df42f47017dbef087d19e9 (diff) |
remove drawType from optState
BUG=skia:
Review URL: https://codereview.chromium.org/864853002
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/GrGpu.h | 7 | ||||
-rw-r--r-- | src/gpu/GrInOrderDrawBuffer.cpp | 9 | ||||
-rw-r--r-- | src/gpu/GrInOrderDrawBuffer.h | 4 | ||||
-rw-r--r-- | src/gpu/GrOptDrawState.cpp | 6 | ||||
-rw-r--r-- | src/gpu/GrOptDrawState.h | 5 | ||||
-rw-r--r-- | src/gpu/gl/GrGLGpu.cpp | 2 | ||||
-rw-r--r-- | src/gpu/gl/GrGLProgram.cpp | 12 | ||||
-rw-r--r-- | src/gpu/gl/GrGLProgram.h | 4 | ||||
-rw-r--r-- | src/gpu/gl/builders/GrGLProgramBuilder.cpp | 4 | ||||
-rw-r--r-- | src/gpu/gl/builders/GrGLProgramBuilder.h | 1 |
10 files changed, 24 insertions, 30 deletions
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h index cbae83f71f..53ac9c3f91 100644 --- a/src/gpu/GrGpu.h +++ b/src/gpu/GrGpu.h @@ -366,17 +366,20 @@ public: DrawArgs(const GrPrimitiveProcessor* primProc, const GrOptDrawState* optState, const GrProgramDesc* desc, - const GrBatchTracker* batchTracker) + const GrBatchTracker* batchTracker, + DrawType drawType) : fPrimitiveProcessor(primProc) , fOptState(optState) , fDesc(desc) - , fBatchTracker(batchTracker) { + , fBatchTracker(batchTracker) + , fDrawType(drawType) { SkASSERT(primProc && optState && desc && batchTracker); } const GrPrimitiveProcessor* fPrimitiveProcessor; const GrOptDrawState* fOptState; const GrProgramDesc* fDesc; const GrBatchTracker* fBatchTracker; + DrawType fDrawType; }; void draw(const DrawArgs&, const GrDrawTarget::DrawInfo&); diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp index f504f09317..1c7cb25271 100644 --- a/src/gpu/GrInOrderDrawBuffer.cpp +++ b/src/gpu/GrInOrderDrawBuffer.cpp @@ -435,7 +435,7 @@ void GrInOrderDrawBuffer::onFlush() { SetState* ss = reinterpret_cast<SetState*>(iter.get()); this->getGpu()->buildProgramDesc(&ss->fDesc, *ss->fPrimitiveProcessor, ss->fState, - ss->fState.descInfo(), ss->fState.drawType(), + ss->fState.descInfo(), ss->fDrawType, ss->fBatchTracker); currentState = ss; @@ -455,7 +455,7 @@ void GrInOrderDrawBuffer::onFlush() { void GrInOrderDrawBuffer::Draw::execute(GrInOrderDrawBuffer* buf, const SetState* state) { SkASSERT(state); DrawArgs args(state->fPrimitiveProcessor.get(), &state->fState, &state->fDesc, - &state->fBatchTracker); + &state->fBatchTracker, state->fDrawType); buf->getGpu()->draw(args, fInfo); } @@ -473,14 +473,14 @@ void GrInOrderDrawBuffer::StencilPath::execute(GrInOrderDrawBuffer* buf, const S void GrInOrderDrawBuffer::DrawPath::execute(GrInOrderDrawBuffer* buf, const SetState* state) { SkASSERT(state); DrawArgs args(state->fPrimitiveProcessor.get(), &state->fState, &state->fDesc, - &state->fBatchTracker); + &state->fBatchTracker, state->fDrawType); buf->getGpu()->drawPath(args, this->path(), fStencilSettings); } void GrInOrderDrawBuffer::DrawPaths::execute(GrInOrderDrawBuffer* buf, const SetState* state) { SkASSERT(state); DrawArgs args(state->fPrimitiveProcessor.get(), &state->fState, &state->fDesc, - &state->fBatchTracker); + &state->fBatchTracker, state->fDrawType); buf->getGpu()->drawPaths(args, this->pathRange(), &buf->fPathIndexBuffer[fIndicesLocation], fIndexType, &buf->fPathTransformBuffer[fTransformsLocation], fTransformType, @@ -536,6 +536,7 @@ bool GrInOrderDrawBuffer::recordStateAndShouldDraw(const GrDrawState& ds, ss->fState.getInitBatchTracker()); if (fPrevState && + fPrevState->fDrawType == ss->fDrawType && fPrevState->fPrimitiveProcessor->canMakeEqual(fPrevState->fBatchTracker, *ss->fPrimitiveProcessor, ss->fBatchTracker) && diff --git a/src/gpu/GrInOrderDrawBuffer.h b/src/gpu/GrInOrderDrawBuffer.h index 6a6cd88f6a..d94b3111ec 100644 --- a/src/gpu/GrInOrderDrawBuffer.h +++ b/src/gpu/GrInOrderDrawBuffer.h @@ -185,7 +185,8 @@ private: GrGpu::DrawType drawType) : Cmd(kSetState_Cmd) , fPrimitiveProcessor(primProc) - , fState(drawState, primProc, caps, scissor, dstCopy, drawType) {} + , fState(drawState, primProc, caps, scissor, dstCopy) + , fDrawType(drawType) {} void execute(GrInOrderDrawBuffer*, const SetState*) SK_OVERRIDE; @@ -194,6 +195,7 @@ private: const GrOptDrawState fState; GrProgramDesc fDesc; GrBatchTracker fBatchTracker; + GrGpu::DrawType fDrawType; }; typedef void* TCmdAlign; // This wouldn't be enough align if a command used long double. diff --git a/src/gpu/GrOptDrawState.cpp b/src/gpu/GrOptDrawState.cpp index 8d28f446b2..a111007114 100644 --- a/src/gpu/GrOptDrawState.cpp +++ b/src/gpu/GrOptDrawState.cpp @@ -17,10 +17,7 @@ GrOptDrawState::GrOptDrawState(const GrDrawState& drawState, const GrPrimitiveProcessor* primProc, const GrDrawTargetCaps& caps, const GrScissorState& scissorState, - const GrDeviceCoordTexture* dstCopy, - GrGpu::DrawType drawType) { - fDrawType = drawType; - + const GrDeviceCoordTexture* dstCopy) { const GrProcOptInfo& colorPOI = drawState.colorProcInfo(primProc); const GrProcOptInfo& coveragePOI = drawState.coverageProcInfo(primProc); @@ -145,7 +142,6 @@ bool GrOptDrawState::isEqual(const GrOptDrawState& that) const { this->fFragmentStages.count() != that.fFragmentStages.count() || this->fNumColorStages != that.fNumColorStages || this->fScissorState != that.fScissorState || - this->fDrawType != that.fDrawType || this->fFlags != that.fFlags || this->fStencilSettings != that.fStencilSettings || this->fDrawFace != that.fDrawFace || diff --git a/src/gpu/GrOptDrawState.h b/src/gpu/GrOptDrawState.h index 6beeea2f87..626e6d7c61 100644 --- a/src/gpu/GrOptDrawState.h +++ b/src/gpu/GrOptDrawState.h @@ -31,7 +31,7 @@ public: GrOptDrawState(const GrDrawState& drawState, const GrPrimitiveProcessor*, const GrDrawTargetCaps&, const GrScissorState&, - const GrDeviceCoordTexture* dstCopy, GrGpu::DrawType); + const GrDeviceCoordTexture* dstCopy); /* * Returns true if it is possible to combine the two GrOptDrawStates and it will update 'this' @@ -128,8 +128,6 @@ public: /////////////////////////////////////////////////////////////////////////// - GrGpu::DrawType drawType() const { return fDrawType; } - const GrDeviceCoordTexture* getDstCopy() const { return fDstCopy.texture() ? &fDstCopy : NULL; } const GrProgramDesc::DescInfo& descInfo() const { return fDescInfo; } @@ -171,7 +169,6 @@ private: uint32_t fFlags; ProgramXferProcessor fXferProcessor; FragmentStageArray fFragmentStages; - GrGpu::DrawType fDrawType; GrProgramDesc::DescInfo fDescInfo; GrGeometryProcessor::InitBT fInitBT; diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index aa9a3e664c..f489d03334 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -1369,7 +1369,7 @@ bool GrGLGpu::flushGLState(const DrawArgs& args) { this->flushStencil(optState.getStencil()); this->flushScissor(optState.getScissorState(), glRT->getViewport(), glRT->origin()); this->flushHWAAState(glRT, optState.isHWAntialiasState(), - kDrawLines_DrawType == optState.drawType()); + kDrawLines_DrawType == args.fDrawType); // This must come after textures are flushed because a texture may need // to be msaa-resolved (which will modify bound FBO state). diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp index bd36e59896..c018cfe6c1 100644 --- a/src/gpu/gl/GrGLProgram.cpp +++ b/src/gpu/gl/GrGLProgram.cpp @@ -142,7 +142,7 @@ void GrGLProgram::setData(const GrPrimitiveProcessor& primProc, const GrOptDrawS this->setFragmentData(primProc, optState); // Some of GrGLProgram subclasses need to update state here - this->didSetData(optState.drawType()); + this->didSetData(); } void GrGLProgram::setFragmentData(const GrPrimitiveProcessor& primProc, @@ -169,10 +169,6 @@ void GrGLProgram::setTransformData(const GrPrimitiveProcessor& primProc, processor.processor()->coordTransforms()); } -void GrGLProgram::didSetData(GrGpu::DrawType drawType) { - SkASSERT(!GrGpu::IsPathRenderingDrawType(drawType)); -} - void GrGLProgram::setRenderTargetState(const GrPrimitiveProcessor& primProc, const GrOptDrawState& optState) { // Load the RT height uniform if it is needed to y-flip gl_FragCoord. @@ -215,8 +211,7 @@ GrGLNvprProgram::GrGLNvprProgram(GrGLGpu* gpu, : INHERITED(gpu, desc, builtinUniforms, programID, uniforms, primProc, xferProcessor, fragmentProcessors) { } -void GrGLNvprProgram::didSetData(GrGpu::DrawType drawType) { - SkASSERT(GrGpu::IsPathRenderingDrawType(drawType)); +void GrGLNvprProgram::didSetData() { GrGLPathProcessor* pathProc = static_cast<GrGLPathProcessor*>(fGeometryProcessor.get()->fGLProc.get()); pathProc->didSetData(fGpu->glPathRendering()); @@ -234,8 +229,7 @@ void GrGLNvprProgram::setTransformData(const GrPrimitiveProcessor& primProc, void GrGLNvprProgram::onSetRenderTargetState(const GrPrimitiveProcessor& primProc, const GrOptDrawState& optState) { - SkASSERT(GrGpu::IsPathRenderingDrawType(optState.drawType()) && - !primProc.willUseGeoShader() && primProc.numAttribs() == 0); + SkASSERT(!primProc.willUseGeoShader() && primProc.numAttribs() == 0); const GrRenderTarget* rt = optState.getRenderTarget(); SkISize size; size.set(rt->width(), rt->height()); diff --git a/src/gpu/gl/GrGLProgram.h b/src/gpu/gl/GrGLProgram.h index bd4d6a33ae..cce6c2a4d3 100644 --- a/src/gpu/gl/GrGLProgram.h +++ b/src/gpu/gl/GrGLProgram.h @@ -128,7 +128,7 @@ protected: * Legacy NVPR needs a hook here to flush path tex gen settings. * TODO when legacy nvpr is removed, remove this call. */ - virtual void didSetData(GrGpu::DrawType); + virtual void didSetData() {} // Helper for setData() that sets the view matrix and loads the render target height uniform void setRenderTargetState(const GrPrimitiveProcessor&, const GrOptDrawState&); @@ -175,7 +175,7 @@ protected: GrGLInstalledFragProcs* fragmentProcessors); private: - void didSetData(GrGpu::DrawType) SK_OVERRIDE; + void didSetData() SK_OVERRIDE; virtual void setTransformData(const GrPrimitiveProcessor&, const GrPendingFragmentStage&, int index, diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp index e81c079d4a..c26a72ec50 100644 --- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp +++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp @@ -74,7 +74,7 @@ GrGLProgram* GrGLProgramBuilder::CreateProgram(const DrawArgs& args, GrGLGpu* gp GrGLProgramBuilder* GrGLProgramBuilder::CreateProgramBuilder(const DrawArgs& args, GrGLGpu* gpu) { - if (GrGpu::IsPathRenderingDrawType(args.fOptState->drawType())) { + if (GrGpu::IsPathRenderingDrawType(args.fDrawType)) { SkASSERT(gpu->glCaps().pathRenderingSupport() && !args.fPrimitiveProcessor->willUseGeoShader() && args.fPrimitiveProcessor->numAttribs() == 0); @@ -396,7 +396,7 @@ GrGLProgram* GrGLProgramBuilder::finalize() { // Legacy nvpr will not compile with a vertex shader, but newer nvpr requires a dummy vertex // shader - bool useNvpr = GrGpu::IsPathRenderingDrawType(this->optState().drawType()); + bool useNvpr = GrGpu::IsPathRenderingDrawType(this->drawType()); if (!(useNvpr && fGpu->glCaps().nvprSupport() == GrGLCaps::kLegacy_NvprSupport)) { if (!fVS.compileAndAttachShaders(programID, &shadersToDelete)) { this->cleanupProgram(programID, shadersToDelete); diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.h b/src/gpu/gl/builders/GrGLProgramBuilder.h index 612791e078..37cd57f164 100644 --- a/src/gpu/gl/builders/GrGLProgramBuilder.h +++ b/src/gpu/gl/builders/GrGLProgramBuilder.h @@ -287,6 +287,7 @@ protected: const GrProgramDesc& desc() const { return *fArgs.fDesc; } const GrBatchTracker& batchTracker() const { return *fArgs.fBatchTracker; } const GrProgramDesc::KeyHeader& header() const { return fArgs.fDesc->header(); } + GrGpu::DrawType drawType() const { return fArgs.fDrawType; } // Generates a name for a variable. The generated string will be name prefixed by the prefix // char (unless the prefix is '\0'). It also mangles the name to be stage-specific if we're |