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

Unified Diff: src/gpu/gl/GrGpuGL_program.cpp

Issue 630063002: Make createOptDrawState return NULL if we would end up not drawing (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase and Nits Created 6 years, 2 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/GrOptDrawState.cpp ('k') | tests/GLProgramsTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGpuGL_program.cpp
diff --git a/src/gpu/gl/GrGpuGL_program.cpp b/src/gpu/gl/GrGpuGL_program.cpp
index 363d87fbfbf1089ccfe2f0007209d6b086c1e9f4..4529a1c22e151bf0a2f3f82b1ff19b4580300e7d 100644
--- a/src/gpu/gl/GrGpuGL_program.cpp
+++ b/src/gpu/gl/GrGpuGL_program.cpp
@@ -206,7 +206,13 @@ GrGLProgram* GrGpuGL::ProgramCache::getProgram(const GrOptDrawState& optState,
#define GL_CALL(X) GR_GL_CALL(this->glInterface(), X)
bool GrGpuGL::flushGraphicsState(DrawType type, const GrDeviceCoordTexture* dstCopy) {
- SkAutoTUnref<GrOptDrawState> optState(this->getDrawState().createOptState(*this->caps()));
+ SkAutoTUnref<GrOptDrawState> optState(GrOptDrawState::Create(this->getDrawState(),
+ *this->caps(),
+ type));
+
+ if (!optState) {
+ return false;
+ }
// GrGpu::setupClipAndFlushState should have already checked this and bailed if not true.
SkASSERT(optState->getRenderTarget());
@@ -294,7 +300,13 @@ bool GrGpuGL::flushGraphicsState(DrawType type, const GrDeviceCoordTexture* dstC
}
void GrGpuGL::setupGeometry(const DrawInfo& info, size_t* indexOffsetInBytes) {
- SkAutoTUnref<GrOptDrawState> optState(this->getDrawState().createOptState(*this->caps()));
+ SkAutoTUnref<GrOptDrawState> optState(
+ GrOptDrawState::Create(this->getDrawState(), *this->caps(),
+ PrimTypeToDrawType(info.primitiveType())));
+
+ // If the optState would is NULL it should have been caught in flushGraphicsState before getting
+ // here.
+ SkASSERT(optState);
GrGLsizei stride = static_cast<GrGLsizei>(optState->getVertexStride());
« no previous file with comments | « src/gpu/GrOptDrawState.cpp ('k') | tests/GLProgramsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698