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

Unified Diff: tests/GLProgramsTest.cpp

Issue 32403002: Fix GrProgramsTest to not generate tests with too many TexCoord references (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: adress Created 7 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/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 13d0d2ee5be91f8e45fc077a24ef476c46e87cd3..12107f435615371231f85524f54a7827fe9de2aa 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -158,6 +158,7 @@ bool GrGpuGL::programUnitTest(int maxStages) {
GrGLProgramDesc pdesc;
int currAttribIndex = 1; // we need to always leave room for position
+ int currTextureCoordSet = 0;
int attribIndices[2];
GrTexture* dummyTextures[] = {dummyTexture1.get(), dummyTexture2.get()};
@@ -167,7 +168,9 @@ bool GrGpuGL::programUnitTest(int maxStages) {
SkAutoSTMalloc<8, const GrEffectStage*> stages(numStages);
- for (int s = 0; s < numStages; ++s) {
+ bool useFixedFunctionTexturing = this->shouldUseFixedFunctionTexturing();
+
+ for (int s = 0; s < numStages;) {
SkAutoTUnref<const GrEffectRef> effect(GrEffectTestFactory::CreateStage(
&random,
this->getContext(),
@@ -178,15 +181,29 @@ bool GrGpuGL::programUnitTest(int maxStages) {
// If adding this effect would exceed the max attrib count then generate a
// new random effect.
if (currAttribIndex + numAttribs > GrDrawState::kMaxVertexAttribCnt) {
- --s;
continue;
}
+
+
+ // If adding this effect would exceed the max texture coord set count then generate a
+ // new random effect.
+ if (useFixedFunctionTexturing && !(*effect)->hasVertexCode()) {
+ int numTransforms = (*effect)->numTransforms();
+ if (currTextureCoordSet + numTransforms > this->glCaps().maxFixedFunctionTextureCoords()) {
+ continue;
+ }
+ currTextureCoordSet += numTransforms;
+ }
+
+ useFixedFunctionTexturing = useFixedFunctionTexturing && !(*effect)->hasVertexCode();
+
for (int i = 0; i < numAttribs; ++i) {
attribIndices[i] = currAttribIndex++;
}
GrEffectStage* stage = SkNEW_ARGS(GrEffectStage,
(effect.get(), attribIndices[0], attribIndices[1]));
stages[s] = stage;
+ ++s;
}
const GrTexture* dstTexture = random.nextBool() ? dummyTextures[0] : dummyTextures[1];
pdesc.setRandom(&random,
« 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