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

Unified Diff: src/gpu/GrProgramDesc.h

Issue 1100483003: Minor modifications to GrProgramDesc.h. (Closed) Base URL: https://chromium.googlesource.com/skia@master
Patch Set: Cleanup Created 5 years, 8 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 | src/gpu/gl/GrGLProgramDesc.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrProgramDesc.h
diff --git a/src/gpu/GrProgramDesc.h b/src/gpu/GrProgramDesc.h
index 66e0e06b8c88ed629c1ba7eeb06c795923895ce7..b837ceea95fd9f4a4f0db15858bb8a5bc3822a2e 100644
--- a/src/gpu/GrProgramDesc.h
+++ b/src/gpu/GrProgramDesc.h
@@ -12,8 +12,6 @@
#include "GrTypesPriv.h"
#include "SkChecksum.h"
-class GrGLGpu;
-
/** This class describes a program to generate. It also serves as a program cache key. Very little
of this is GL-specific. The GL-specific parts could be factored out into a subclass. */
class GrProgramDesc {
@@ -76,7 +74,7 @@ public:
// This should really only be used internally, base classes should return their own headers
const KeyHeader& header() const { return *this->atOffset<KeyHeader, kHeaderOffset>(); }
-private:
+protected:
template<typename T, size_t OFFSET> T* atOffset() {
return reinterpret_cast<T*>(reinterpret_cast<intptr_t>(fKey.begin()) + OFFSET);
}
@@ -95,21 +93,21 @@ private:
*checksum = SkChecksum::Compute(reinterpret_cast<uint32_t*>(fKey.begin()), keyLength);
}
- // The key, stored in fKey, is composed of four parts:
- // 1. uint32_t for total key length.
- // 2. uint32_t for a checksum.
- // 3. Header struct defined above. Also room for extensions to the header
- // 4. A Backend specific payload. Room is preallocated for this
- enum KeyOffsets {
- // Part 1.
- kLengthOffset = 0,
- // Part 2.
- kChecksumOffset = kLengthOffset + sizeof(uint32_t),
- // Part 3.
- kHeaderOffset = kChecksumOffset + sizeof(uint32_t),
- kHeaderSize = SkAlign4(2 * sizeof(KeyHeader)),
- };
-
+ // The key, stored in fKey, is composed of four parts:
+ // 1. uint32_t for total key length.
+ // 2. uint32_t for a checksum.
+ // 3. Header struct defined above. Also room for extensions to the header
+ // 4. A Backend specific payload. Room is preallocated for this
+ enum KeyOffsets {
+ // Part 1.
+ kLengthOffset = 0,
+ // Part 2.
+ kChecksumOffset = kLengthOffset + sizeof(uint32_t),
+ // Part 3.
+ kHeaderOffset = kChecksumOffset + sizeof(uint32_t),
+ kHeaderSize = SkAlign4(2 * sizeof(KeyHeader)),
+ };
+
enum {
kMaxPreallocProcessors = 8,
kIntsPerProcessor = 4, // This is an overestimate of the average effect key size.
@@ -117,9 +115,11 @@ private:
kMaxPreallocProcessors * sizeof(uint32_t) * kIntsPerProcessor,
};
- SkSTArray<kPreAllocSize, uint8_t, true> fKey;
+ SkSTArray<kPreAllocSize, uint8_t, true>& key() { return fKey; }
+ const SkSTArray<kPreAllocSize, uint8_t, true>& key() const { return fKey; }
- friend class GrGLProgramDescBuilder;
+private:
+ SkSTArray<kPreAllocSize, uint8_t, true> fKey;
};
#endif
« no previous file with comments | « no previous file | src/gpu/gl/GrGLProgramDesc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698