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

Unified Diff: src/gpu/GrDrawState.cpp

Issue 498483002: Store vertex size in DrawState when setVertexAttribs is called (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add size assert Created 6 years, 4 months 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/GrDrawState.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDrawState.cpp
diff --git a/src/gpu/GrDrawState.cpp b/src/gpu/GrDrawState.cpp
index ba5d62876c6936fdf5279e9dc2e5001e61090f68..de97f68291701451f5560fb07d3f3d7c83a6a197 100644
--- a/src/gpu/GrDrawState.cpp
+++ b/src/gpu/GrDrawState.cpp
@@ -53,6 +53,7 @@ GrDrawState::CombinedState GrDrawState::CombineIfPossible(
}
}
+ SkASSERT(a.fVertexSize == b.fVertexSize);
SkASSERT(0 == memcmp(a.fFixedFunctionVertexAttribIndices,
b.fFixedFunctionVertexAttribIndices,
sizeof(a.fFixedFunctionVertexAttribIndices)));
@@ -112,6 +113,7 @@ GrDrawState& GrDrawState::operator=(const GrDrawState& that) {
fFlagBits = that.fFlagBits;
fVACount = that.fVACount;
fVAPtr = that.fVAPtr;
+ fVertexSize = that.fVertexSize;
fStencilSettings = that.fStencilSettings;
fCoverage = that.fCoverage;
fDrawFace = that.fDrawFace;
@@ -236,7 +238,7 @@ static size_t vertex_size(const GrVertexAttrib* attribs, int count) {
}
size_t GrDrawState::getVertexSize() const {
- return vertex_size(fVAPtr, fVACount);
+ return fVertexSize;
}
////////////////////////////////////////////////////////////////////////////////
@@ -246,6 +248,7 @@ void GrDrawState::setVertexAttribs(const GrVertexAttrib* attribs, int count) {
fVAPtr = attribs;
fVACount = count;
+ fVertexSize = vertex_size(fVAPtr, fVACount);
// Set all the indices to -1
memset(fFixedFunctionVertexAttribIndices,
@@ -283,6 +286,7 @@ void GrDrawState::setDefaultVertexAttribs() {
fVAPtr = &kPositionAttrib;
fVACount = 1;
+ fVertexSize = GrVertexAttribTypeSize(kVec2f_GrVertexAttribType);
// set all the fixed function indices to -1 except position.
memset(fFixedFunctionVertexAttribIndices,
« no previous file with comments | « src/gpu/GrDrawState.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698