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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/gpu/gl/GrGLProgramDesc.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrProgramDesc_DEFINED 8 #ifndef GrProgramDesc_DEFINED
9 #define GrProgramDesc_DEFINED 9 #define GrProgramDesc_DEFINED
10 10
11 #include "GrColor.h" 11 #include "GrColor.h"
12 #include "GrTypesPriv.h" 12 #include "GrTypesPriv.h"
13 #include "SkChecksum.h" 13 #include "SkChecksum.h"
14 14
15 class GrGLGpu;
16
17 /** This class describes a program to generate. It also serves as a program cach e key. Very little 15 /** This class describes a program to generate. It also serves as a program cach e key. Very little
18 of this is GL-specific. The GL-specific parts could be factored out into a s ubclass. */ 16 of this is GL-specific. The GL-specific parts could be factored out into a s ubclass. */
19 class GrProgramDesc { 17 class GrProgramDesc {
20 public: 18 public:
21 // Creates an uninitialized key that must be populated by GrGpu::buildProgra mDesc() 19 // Creates an uninitialized key that must be populated by GrGpu::buildProgra mDesc()
22 GrProgramDesc() {} 20 GrProgramDesc() {}
23 21
24 // Returns this as a uint32_t array to be used as a key in the program cache . 22 // Returns this as a uint32_t array to be used as a key in the program cache .
25 const uint32_t* asKey() const { 23 const uint32_t* asKey() const {
26 return reinterpret_cast<const uint32_t*>(fKey.begin()); 24 return reinterpret_cast<const uint32_t*>(fKey.begin());
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 67
70 int numCoverageEffects() const { 68 int numCoverageEffects() const {
71 return this->header().fCoverageEffectCnt; 69 return this->header().fCoverageEffectCnt;
72 } 70 }
73 71
74 int numTotalEffects() const { return this->numColorEffects() + this->numCove rageEffects(); } 72 int numTotalEffects() const { return this->numColorEffects() + this->numCove rageEffects(); }
75 73
76 // This should really only be used internally, base classes should return th eir own headers 74 // This should really only be used internally, base classes should return th eir own headers
77 const KeyHeader& header() const { return *this->atOffset<KeyHeader, kHeaderO ffset>(); } 75 const KeyHeader& header() const { return *this->atOffset<KeyHeader, kHeaderO ffset>(); }
78 76
79 private: 77 protected:
80 template<typename T, size_t OFFSET> T* atOffset() { 78 template<typename T, size_t OFFSET> T* atOffset() {
81 return reinterpret_cast<T*>(reinterpret_cast<intptr_t>(fKey.begin()) + O FFSET); 79 return reinterpret_cast<T*>(reinterpret_cast<intptr_t>(fKey.begin()) + O FFSET);
82 } 80 }
83 81
84 template<typename T, size_t OFFSET> const T* atOffset() const { 82 template<typename T, size_t OFFSET> const T* atOffset() const {
85 return reinterpret_cast<const T*>(reinterpret_cast<intptr_t>(fKey.begin( )) + OFFSET); 83 return reinterpret_cast<const T*>(reinterpret_cast<intptr_t>(fKey.begin( )) + OFFSET);
86 } 84 }
87 85
88 void finalize() { 86 void finalize() {
89 int keyLength = fKey.count(); 87 int keyLength = fKey.count();
(...skipping 20 matching lines...) Expand all
110 kHeaderSize = SkAlign4(2 * sizeof(KeyHeader)), 108 kHeaderSize = SkAlign4(2 * sizeof(KeyHeader)),
111 }; 109 };
112 110
113 enum { 111 enum {
114 kMaxPreallocProcessors = 8, 112 kMaxPreallocProcessors = 8,
115 kIntsPerProcessor = 4, // This is an overestimate of the average effect key size. 113 kIntsPerProcessor = 4, // This is an overestimate of the average effect key size.
116 kPreAllocSize = kHeaderOffset + kHeaderSize + 114 kPreAllocSize = kHeaderOffset + kHeaderSize +
117 kMaxPreallocProcessors * sizeof(uint32_t) * kIntsPerProc essor, 115 kMaxPreallocProcessors * sizeof(uint32_t) * kIntsPerProc essor,
118 }; 116 };
119 117
118 SkSTArray<kPreAllocSize, uint8_t, true>& key() { return fKey; }
119 const SkSTArray<kPreAllocSize, uint8_t, true>& key() const { return fKey; }
120
121 private:
120 SkSTArray<kPreAllocSize, uint8_t, true> fKey; 122 SkSTArray<kPreAllocSize, uint8_t, true> fKey;
121
122 friend class GrGLProgramDescBuilder;
123 }; 123 };
124 124
125 #endif 125 #endif
OLDNEW
« 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