diff options
author | 2014-12-09 13:31:14 -0800 | |
---|---|---|
committer | 2014-12-09 13:31:15 -0800 | |
commit | 2e3b3e369d79e78f7635d4c20e83a47ab571bdf2 (patch) | |
tree | 95378f3e35a21192f0db62e60bc6e408803050b7 /src/gpu/GrInOrderDrawBuffer.cpp | |
parent | f3c78ccf5694d22d2e4a7061a80399a7e69b59db (diff) |
This cl moves color and coverage off of drawstate. In an effort to keep this CL manageable, I have left the compute invariant input / output in a bit of a strange state(fixing this will be complicated).
In addition, NVPR makes this very complicated, and I haven't quite figured out a good way to handle it, so for now color and coverage DO live on optstate, but I will figure out some way to refactor that in future CLs.
BUG=skia:
Review URL: https://codereview.chromium.org/783763002
Diffstat (limited to 'src/gpu/GrInOrderDrawBuffer.cpp')
-rw-r--r-- | src/gpu/GrInOrderDrawBuffer.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp index 3c7b14677b..493420db0b 100644 --- a/src/gpu/GrInOrderDrawBuffer.cpp +++ b/src/gpu/GrInOrderDrawBuffer.cpp @@ -66,7 +66,7 @@ static void set_vertex_attributes(GrDrawState* drawState, bool hasLocalCoords, G uint32_t flags = GrDefaultGeoProcFactory::kPosition_GPType | GrDefaultGeoProcFactory::kColor_GPType; flags |= hasLocalCoords ? GrDefaultGeoProcFactory::kLocalCoord_GPType : 0; - drawState->setGeometryProcessor(GrDefaultGeoProcFactory::Create(flags))->unref(); + drawState->setGeometryProcessor(GrDefaultGeoProcFactory::Create(color, flags))->unref(); if (0xFF == GrColorUnpackA(color)) { drawState->setHint(GrDrawState::kVertexColorsAreOpaque_Hint, true); } @@ -110,12 +110,12 @@ static inline uint8_t strip_trace_bit(uint8_t cmd) { return cmd & kCmdMask; } static inline bool cmd_has_trace_marker(uint8_t cmd) { return SkToBool(cmd & kTraceCmdBit); } void GrInOrderDrawBuffer::onDrawRect(GrDrawState* ds, + GrColor color, const SkRect& rect, const SkRect* localRect, const SkMatrix* localMatrix) { GrDrawState::AutoRestoreEffects are(ds); - GrColor color = ds->getColor(); set_vertex_attributes(ds, SkToBool(localRect), color); size_t vstride = ds->getGeometryProcessor()->getVertexStride(); @@ -226,7 +226,9 @@ void GrInOrderDrawBuffer::onDraw(const GrDrawState& ds, const GrDeviceCoordTexture* dstCopy) { SkASSERT(info.vertexBuffer() && (!info.isIndexed() || info.indexBuffer())); - if (!this->recordStateAndShouldDraw(ds, GrGpu::PrimTypeToDrawType(info.primitiveType()), + const GrGeometryProcessor* gp = ds.getGeometryProcessor(); + if (!this->recordStateAndShouldDraw(ds, gp->getColor(), gp->getCoverage(), + GrGpu::PrimTypeToDrawType(info.primitiveType()), scissorState, dstCopy)) { return; } @@ -251,7 +253,8 @@ void GrInOrderDrawBuffer::onStencilPath(const GrDrawState& ds, const GrClipMaskManager::ScissorState& scissorState, const GrStencilSettings& stencilSettings) { // Only compare the subset of GrDrawState relevant to path stenciling? - if (!this->recordStateAndShouldDraw(ds, GrGpu::kStencilPath_DrawType, scissorState, NULL)) { + if (!this->recordStateAndShouldDraw(ds, GrColor_WHITE, 0xff, GrGpu::kStencilPath_DrawType, + scissorState, NULL)) { return; } StencilPath* sp = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, StencilPath, (path)); @@ -260,12 +263,14 @@ void GrInOrderDrawBuffer::onStencilPath(const GrDrawState& ds, } void GrInOrderDrawBuffer::onDrawPath(const GrDrawState& ds, + GrColor color, const GrPath* path, const GrClipMaskManager::ScissorState& scissorState, const GrStencilSettings& stencilSettings, const GrDeviceCoordTexture* dstCopy) { // TODO: Only compare the subset of GrDrawState relevant to path covering? - if (!this->recordStateAndShouldDraw(ds, GrGpu::kDrawPath_DrawType, scissorState, dstCopy)) { + if (!this->recordStateAndShouldDraw(ds, color, 0xff, GrGpu::kDrawPath_DrawType, scissorState, + dstCopy)) { return; } DrawPath* dp = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, DrawPath, (path)); @@ -274,6 +279,7 @@ void GrInOrderDrawBuffer::onDrawPath(const GrDrawState& ds, } void GrInOrderDrawBuffer::onDrawPaths(const GrDrawState& ds, + GrColor color, const GrPathRange* pathRange, const void* indices, PathIndexType indexType, @@ -287,7 +293,8 @@ void GrInOrderDrawBuffer::onDrawPaths(const GrDrawState& ds, SkASSERT(indices); SkASSERT(transformValues); - if (!this->recordStateAndShouldDraw(ds, GrGpu::kDrawPath_DrawType, scissorState, dstCopy)) { + if (!this->recordStateAndShouldDraw(ds, color, 0xff, GrGpu::kDrawPath_DrawType, scissorState, + dstCopy)) { return; } @@ -317,7 +324,7 @@ void GrInOrderDrawBuffer::onDrawPaths(const GrDrawState& ds, transformType == previous->fTransformType && stencilSettings == previous->fStencilSettings && path_fill_type_is_winding(stencilSettings) && - !ds.willBlendWithDst()) { + !ds.willBlendWithDst(color, GrColor_WHITE)) { // Fold this DrawPaths call into the one previous. previous->fCount += count; return; @@ -483,12 +490,14 @@ bool GrInOrderDrawBuffer::onCopySurface(GrSurface* dst, } bool GrInOrderDrawBuffer::recordStateAndShouldDraw(const GrDrawState& ds, + GrColor color, + uint8_t coverage, GrGpu::DrawType drawType, const GrClipMaskManager::ScissorState& scissor, const GrDeviceCoordTexture* dstCopy) { SetState* ss = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, SetState, - (ds, *this->getGpu()->caps(), scissor, dstCopy, - drawType)); + (ds, color, coverage, *this->getGpu()->caps(), scissor, + dstCopy, drawType)); if (ss->fState.mustSkip()) { fCmdBuffer.pop_back(); return false; |