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

Unified Diff: tests/GLProgramsTest.cpp

Issue 12834013: Stop the GLPrograms unit test from generating out of range attrib indices for effects. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/GLProgramsTest.cpp
===================================================================
--- tests/GLProgramsTest.cpp (revision 8284)
+++ tests/GLProgramsTest.cpp (working copy)
@@ -134,7 +134,16 @@
&random,
this->getContext(),
dummyTextures));
- for (int i = 0; i < effect.get()->get()->numVertexAttribs(); ++i) {
+ int numAttribs = (*effect)->numVertexAttribs();
+
+ // If adding this effect would cause to exceed the max attrib count then generate a
+ // new random effect. The explanation for why this check is correct is a bit
+ // convoluted and this code will be removed soon.
+ if (currAttribIndex + numAttribs > GrDrawState::kCoverageOverrideAttribIndexValue) {
+ --s;
+ continue;
+ }
+ for (int i = 0; i < numAttribs; ++i) {
attribIndices[i] = currAttribIndex++;
}
stages[s].setEffect(effect.get(), attribIndices[0], attribIndices[1]);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698