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

Unified Diff: tests/GLProgramsTest.cpp

Issue 14925010: Move loops that chain together effects into GrGLShaderBuilder from GrGLProgram. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Address comments and fix for emitting code for skipped effects Created 7 years, 7 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/gl/GrGLShaderBuilder.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 ae6fe7b3c4fecbcde464a88584e3a261569a66f7..95187a6e39a2559005644e30353dcd7c4459ed48 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -24,7 +24,7 @@
void GrGLProgramDesc::setRandom(SkMWCRandom* random,
const GrGpuGL* gpu,
const GrTexture* dstTexture,
- const GrEffectStage stages[GrDrawState::kNumStages],
+ const GrEffectStage* stages[GrDrawState::kNumStages],
int currAttribIndex) {
fEmitsPointSize = random->nextBool();
@@ -59,11 +59,11 @@ void GrGLProgramDesc::setRandom(SkMWCRandom* random,
bool dstRead = false;
for (int s = 0; s < GrDrawState::kNumStages; ++s) {
- if (NULL != stages[s].getEffect()) {
- const GrBackendEffectFactory& factory = (*stages[s].getEffect())->getFactory();
- GrDrawEffect drawEffect(stages[s], useLocalCoords);
+ if (NULL != stages[s]) {
+ const GrBackendEffectFactory& factory = (*stages[s]->getEffect())->getFactory();
+ GrDrawEffect drawEffect(*stages[s], useLocalCoords);
fEffectKeys[s] = factory.glEffectKey(drawEffect, gpu->glCaps());
- if ((*stages[s].getEffect())->willReadDst()) {
+ if ((*stages[s]->getEffect())->willReadDst()) {
dstRead = true;
}
}
@@ -113,7 +113,8 @@ bool GrGpuGL::programUnitTest(int maxStages) {
#endif
GrGLProgramDesc pdesc;
- GrEffectStage stages[GrDrawState::kNumStages];
+ const GrEffectStage* stages[GrDrawState::kNumStages];
+ memset(stages, 0, sizeof(stages));
int currAttribIndex = 1; // we need to always leave room for position
int attribIndices[2];
@@ -137,19 +138,20 @@ bool GrGpuGL::programUnitTest(int maxStages) {
for (int i = 0; i < numAttribs; ++i) {
attribIndices[i] = currAttribIndex++;
}
- stages[s].setEffect(effect.get(), attribIndices[0], attribIndices[1]);
+ GrEffectStage* stage = SkNEW(GrEffectStage);
+ stage->setEffect(effect.get(), attribIndices[0], attribIndices[1]);
+ stages[s] = stage;
}
}
const GrTexture* dstTexture = random.nextBool() ? dummyTextures[0] : dummyTextures[1];
pdesc.setRandom(&random, this, dstTexture, stages, currAttribIndex);
- const GrEffectStage* stagePtrs[GrDrawState::kNumStages];
- for (int s = 0; s < GrDrawState::kNumStages; ++s) {
- stagePtrs[s] = &stages[s];
- }
SkAutoTUnref<GrGLProgram> program(GrGLProgram::Create(this->glContext(),
pdesc,
- stagePtrs));
+ stages));
+ for (int s = 0; s < maxStages; ++s) {
+ SkDELETE(stages[s]);
+ }
if (NULL == program.get()) {
return false;
}
« no previous file with comments | « src/gpu/gl/GrGLShaderBuilder.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698