Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Unified Diff: src/gpu/GrInOrderDrawBuffer.cpp

Issue 791743003: Remove GP from drawstate, revision of invariant output for GP (Closed) Base URL: https://skia.googlesource.com/skia.git@color-to-gp
Patch Set: more windows fix Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrInOrderDrawBuffer.h ('k') | src/gpu/GrOptDrawState.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrInOrderDrawBuffer.cpp
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp
index 493420db0b1d111448f078383cf249918f3b02c9..68d2e3bc9a4fdf3ebf495721624788f81acefa4d 100644
--- a/src/gpu/GrInOrderDrawBuffer.cpp
+++ b/src/gpu/GrInOrderDrawBuffer.cpp
@@ -62,14 +62,13 @@ void get_vertex_bounds(const void* vertices,
The vertex attrib order is always pos, color, [local coords].
*/
-static void set_vertex_attributes(GrDrawState* drawState, bool hasLocalCoords, GrColor color) {
+static const GrGeometryProcessor* create_rect_gp(GrDrawState* drawState,
+ bool hasLocalCoords,
+ GrColor color) {
uint32_t flags = GrDefaultGeoProcFactory::kPosition_GPType |
GrDefaultGeoProcFactory::kColor_GPType;
flags |= hasLocalCoords ? GrDefaultGeoProcFactory::kLocalCoord_GPType : 0;
- drawState->setGeometryProcessor(GrDefaultGeoProcFactory::Create(color, flags))->unref();
- if (0xFF == GrColorUnpackA(color)) {
- drawState->setHint(GrDrawState::kVertexColorsAreOpaque_Hint, true);
- }
+ return GrDefaultGeoProcFactory::Create(color, flags, GrColorIsOpaque(color));
}
static bool path_fill_type_is_winding(const GrStencilSettings& pathStencilSettings) {
@@ -116,9 +115,9 @@ void GrInOrderDrawBuffer::onDrawRect(GrDrawState* ds,
const SkMatrix* localMatrix) {
GrDrawState::AutoRestoreEffects are(ds);
- set_vertex_attributes(ds, SkToBool(localRect), color);
+ SkAutoTUnref<const GrGeometryProcessor> gp(create_rect_gp(ds, SkToBool(localRect), color));
- size_t vstride = ds->getGeometryProcessor()->getVertexStride();
+ size_t vstride = gp->getVertexStride();
SkASSERT(vstride == sizeof(SkPoint) + sizeof(GrColor) + (SkToBool(localRect) ? sizeof(SkPoint) :
0));
AutoReleaseGeometry geo(this, 4, vstride, 0);
@@ -165,7 +164,7 @@ void GrInOrderDrawBuffer::onDrawRect(GrDrawState* ds,
}
this->setIndexSourceToBuffer(this->getContext()->getQuadIndexBuffer());
- this->drawIndexedInstances(ds, kTriangles_GrPrimitiveType, 1, 4, 6, &devBounds);
+ this->drawIndexedInstances(ds, gp, kTriangles_GrPrimitiveType, 1, 4, 6, &devBounds);
}
int GrInOrderDrawBuffer::concatInstancedDraw(const GrDrawState& ds, const DrawInfo& info) {
@@ -221,13 +220,13 @@ int GrInOrderDrawBuffer::concatInstancedDraw(const GrDrawState& ds, const DrawIn
}
void GrInOrderDrawBuffer::onDraw(const GrDrawState& ds,
+ const GrGeometryProcessor* gp,
const DrawInfo& info,
const ScissorState& scissorState,
const GrDeviceCoordTexture* dstCopy) {
SkASSERT(info.vertexBuffer() && (!info.isIndexed() || info.indexBuffer()));
- const GrGeometryProcessor* gp = ds.getGeometryProcessor();
- if (!this->recordStateAndShouldDraw(ds, gp->getColor(), gp->getCoverage(),
+ if (!this->recordStateAndShouldDraw(ds, gp, NULL,
GrGpu::PrimTypeToDrawType(info.primitiveType()),
scissorState, dstCopy)) {
return;
@@ -249,11 +248,12 @@ void GrInOrderDrawBuffer::onDraw(const GrDrawState& ds,
}
void GrInOrderDrawBuffer::onStencilPath(const GrDrawState& ds,
+ const GrPathProcessor* pathProc,
const GrPath* path,
const GrClipMaskManager::ScissorState& scissorState,
const GrStencilSettings& stencilSettings) {
// Only compare the subset of GrDrawState relevant to path stenciling?
- if (!this->recordStateAndShouldDraw(ds, GrColor_WHITE, 0xff, GrGpu::kStencilPath_DrawType,
+ if (!this->recordStateAndShouldDraw(ds, NULL, pathProc, GrGpu::kStencilPath_DrawType,
scissorState, NULL)) {
return;
}
@@ -263,14 +263,14 @@ void GrInOrderDrawBuffer::onStencilPath(const GrDrawState& ds,
}
void GrInOrderDrawBuffer::onDrawPath(const GrDrawState& ds,
- GrColor color,
+ const GrPathProcessor* pathProc,
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, color, 0xff, GrGpu::kDrawPath_DrawType, scissorState,
- dstCopy)) {
+ if (!this->recordStateAndShouldDraw(ds, NULL, pathProc, GrGpu::kDrawPath_DrawType,
+ scissorState, dstCopy)) {
return;
}
DrawPath* dp = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, DrawPath, (path));
@@ -279,7 +279,7 @@ void GrInOrderDrawBuffer::onDrawPath(const GrDrawState& ds,
}
void GrInOrderDrawBuffer::onDrawPaths(const GrDrawState& ds,
- GrColor color,
+ const GrPathProcessor* pathProc,
const GrPathRange* pathRange,
const void* indices,
PathIndexType indexType,
@@ -293,7 +293,7 @@ void GrInOrderDrawBuffer::onDrawPaths(const GrDrawState& ds,
SkASSERT(indices);
SkASSERT(transformValues);
- if (!this->recordStateAndShouldDraw(ds, color, 0xff, GrGpu::kDrawPath_DrawType, scissorState,
+ if (!this->recordStateAndShouldDraw(ds, NULL, pathProc, GrGpu::kDrawPath_DrawType, scissorState,
dstCopy)) {
return;
}
@@ -324,7 +324,7 @@ void GrInOrderDrawBuffer::onDrawPaths(const GrDrawState& ds,
transformType == previous->fTransformType &&
stencilSettings == previous->fStencilSettings &&
path_fill_type_is_winding(stencilSettings) &&
- !ds.willBlendWithDst(color, GrColor_WHITE)) {
+ !ds.willBlendWithDst(pathProc)) {
// Fold this DrawPaths call into the one previous.
previous->fCount += count;
return;
@@ -490,13 +490,13 @@ bool GrInOrderDrawBuffer::onCopySurface(GrSurface* dst,
}
bool GrInOrderDrawBuffer::recordStateAndShouldDraw(const GrDrawState& ds,
- GrColor color,
- uint8_t coverage,
+ const GrGeometryProcessor* gp,
+ const GrPathProcessor* pathProc,
GrGpu::DrawType drawType,
const GrClipMaskManager::ScissorState& scissor,
const GrDeviceCoordTexture* dstCopy) {
SetState* ss = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, SetState,
- (ds, color, coverage, *this->getGpu()->caps(), scissor,
+ (ds, gp, pathProc, *this->getGpu()->caps(), scissor,
dstCopy, drawType));
if (ss->fState.mustSkip()) {
fCmdBuffer.pop_back();
« no previous file with comments | « src/gpu/GrInOrderDrawBuffer.h ('k') | src/gpu/GrOptDrawState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698