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

Unified Diff: tests/GLProgramsTest.cpp

Issue 732693002: Drawstate on stack (Closed) Base URL: https://skia.googlesource.com/skia.git@real_def_gp
Patch Set: tiny fix Created 6 years, 1 month 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/gl/GrGpuGL.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/GLProgramsTest.cpp
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index a3ef323e41ba5448f782e0520059d183fb111154..7c3ba0fb276af5d9b7e81bbc446a24ab1b78793d 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -429,8 +429,8 @@ bool GrDrawTarget::programUnitTest(int maxStages) {
return false;
}
- GrDrawState* ds = this->drawState();
- ds->setRenderTarget(rt.get());
+ GrDrawState ds;
+ ds.setRenderTarget(rt.get());
// if path rendering we have to setup a couple of things like the draw type
bool usePathRendering = gpu->glCaps().pathRenderingSupport() && random.nextBool();
@@ -441,36 +441,35 @@ bool GrDrawTarget::programUnitTest(int maxStages) {
// twiddle drawstate knobs randomly
bool hasGeometryProcessor = !usePathRendering;
if (hasGeometryProcessor) {
- set_random_gp(fContext, gpu->glCaps(), ds, &random, dummyTextures);
+ set_random_gp(fContext, gpu->glCaps(), &ds, &random, dummyTextures);
}
set_random_color_coverage_stages(gpu,
- ds,
+ &ds,
maxStages - hasGeometryProcessor,
usePathRendering,
&random,
dummyTextures);
- set_random_color(ds, &random);
- set_random_coverage(ds, &random);
- set_random_hints(ds, &random);
- set_random_state(ds, &random);
- set_random_blend_func(ds, &random);
- set_random_stencil(ds, &random);
+ set_random_color(&ds, &random);
+ set_random_coverage(&ds, &random);
+ set_random_hints(&ds, &random);
+ set_random_state(&ds, &random);
+ set_random_blend_func(&ds, &random);
+ set_random_stencil(&ds, &random);
GrDeviceCoordTexture dstCopy;
- if (!this->setupDstReadIfNecessary(&dstCopy, NULL)) {
+ if (!this->setupDstReadIfNecessary(&ds, &dstCopy, NULL)) {
SkDebugf("Couldn't setup dst read texture");
return false;
}
// create optimized draw state, setup readDst texture if required, and build a descriptor
// and program. ODS creation can fail, so we have to check
- SkAutoTUnref<GrOptDrawState> ods(GrOptDrawState::Create(this->getDrawState(),
+ SkAutoTUnref<GrOptDrawState> ods(GrOptDrawState::Create(ds,
gpu,
&dstCopy,
drawType));
if (!ods.get()) {
- ds->reset();
continue;
}
SkAutoTUnref<GrGLProgram> program(GrGLProgramBuilder::CreateProgram(*ods, drawType, gpu));
@@ -479,9 +478,6 @@ bool GrDrawTarget::programUnitTest(int maxStages) {
return false;
}
- // We have to reset the drawstate because we might have added a gp
- ds->reset();
-
// because occasionally optimized drawstate creation will fail for valid reasons, we only
// want to increment on success
++t;
« no previous file with comments | « src/gpu/gl/GrGpuGL.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698