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

Unified Diff: tests/GLProgramsTest.cpp

Issue 394213002: Revert of Makes GrGLProgramDesc's key store the lengths as well as offsets of the effect keys. (Closed) Base URL: https://skia.googlesource.com/skia.git@key
Patch Set: Created 6 years, 5 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/GrGLProgramEffects.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 2264385902b3471f65576540c3ffc1a3f28521cc..dd0f80f42f0815aa8b7c7c91c5c9da01ced9cbda 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -35,33 +35,42 @@
int numStages = numColorStages + numCoverageStages;
fKey.reset();
- GR_STATIC_ASSERT(0 == kEffectKeyOffsetsAndLengthOffset % sizeof(uint32_t));
+ GR_STATIC_ASSERT(0 == kEffectKeyLengthsOffset % sizeof(uint32_t));
// Make room for everything up to and including the array of offsets to effect keys.
- fKey.push_back_n(kEffectKeyOffsetsAndLengthOffset + 2 * sizeof(uint16_t) * numStages);
+ fKey.push_back_n(kEffectKeyLengthsOffset + sizeof(uint32_t) * numStages);
+
+ size_t offset = fKey.count();
+ int offsetIndex = 0;
bool dstRead = false;
bool fragPos = false;
bool vertexCode = false;
for (int s = 0; s < numStages; ++s) {
- uint16_t* offsetAndSize = reinterpret_cast<uint16_t*>(fKey.begin() +
- kEffectKeyOffsetsAndLengthOffset +
- s * 2 * sizeof(uint16_t));
- uint32_t effectKeyOffset = fKey.count();
- if (effectKeyOffset > SK_MaxU16) {
+ uint32_t* offsetLocation = reinterpret_cast<uint32_t*>(fKey.begin() +
+ kEffectKeyLengthsOffset +
+ offsetIndex * sizeof(uint32_t));
+ *offsetLocation = offset;
+ ++offsetIndex;
+
+ const GrBackendEffectFactory& factory = stages[s]->getEffect()->getFactory();
+ GrDrawEffect drawEffect(*stages[s], useLocalCoords);
+ GrEffectKeyBuilder b(&fKey);
+ if (!factory.getGLEffectKey(drawEffect, gpu->glCaps(), &b)) {
fKey.reset();
return false;
}
- GrDrawEffect drawEffect(*stages[s], useLocalCoords);
- GrEffectKeyBuilder b(&fKey);
- uint16_t effectKeySize;
- if (!GetEffectKeyAndUpdateStats(*stages[s], gpu->glCaps(), useLocalCoords, &b,
- &effectKeySize, &dstRead, &fragPos, &vertexCode)) {
- fKey.reset();
- return false;
- }
- offsetAndSize[0] = effectKeyOffset;
- offsetAndSize[1] = effectKeySize;
+ if (stages[s]->getEffect()->willReadDstColor()) {
+ dstRead = true;
+ }
+ if (stages[s]->getEffect()->willReadFragmentPosition()) {
+ fragPos = true;
+ }
+ if (stages[s]->getEffect()->hasVertexCode()) {
+ vertexCode = true;
+ }
+
+ offset += b.size();
}
KeyHeader* header = this->header();
« no previous file with comments | « src/gpu/gl/GrGLProgramEffects.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698