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

Side by Side Diff: src/gpu/GrProgramDesc.h

Issue 901663007: Revert of Move DstCopy on gpu into the GrXferProcessor. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 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 | « src/gpu/GrPipelineBuilder.cpp ('k') | src/gpu/GrTest.cpp » ('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
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 bool operator!= (const GrProgramDesc& other) const { 49 bool operator!= (const GrProgramDesc& other) const {
50 return !(*this == other); 50 return !(*this == other);
51 } 51 }
52 52
53 static bool Less(const GrProgramDesc& a, const GrProgramDesc& b) { 53 static bool Less(const GrProgramDesc& a, const GrProgramDesc& b) {
54 return memcmp(a.asKey(), b.asKey(), a.keyLength() & ~0x3) < 0; 54 return memcmp(a.asKey(), b.asKey(), a.keyLength() & ~0x3) < 0;
55 } 55 }
56 56
57 struct KeyHeader { 57 struct KeyHeader {
58 uint8_t fDstReadKey; // set by GrGLShaderBuilder i f there
59 // are effects that must read the dst.
60 // Otherwise, 0.
58 uint8_t fFragPosKey; // set by GrGLShaderBuilder i f there are 61 uint8_t fFragPosKey; // set by GrGLShaderBuilder i f there are
59 // effects that read the frag ment position. 62 // effects that read the frag ment position.
60 // Otherwise, 0. 63 // Otherwise, 0.
61 64
62 int8_t fColorEffectCnt; 65 int8_t fColorEffectCnt;
63 int8_t fCoverageEffectCnt; 66 int8_t fCoverageEffectCnt;
64 }; 67 };
65 68
66 int numColorEffects() const { 69 int numColorEffects() const {
67 return this->header().fColorEffectCnt; 70 return this->header().fColorEffectCnt;
68 } 71 }
69 72
70 int numCoverageEffects() const { 73 int numCoverageEffects() const {
71 return this->header().fCoverageEffectCnt; 74 return this->header().fCoverageEffectCnt;
72 } 75 }
73 76
74 int numTotalEffects() const { return this->numColorEffects() + this->numCove rageEffects(); } 77 int numTotalEffects() const { return this->numColorEffects() + this->numCove rageEffects(); }
75 78
76 // This should really only be used internally, base classes should return th eir own headers 79 // 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>(); } 80 const KeyHeader& header() const { return *this->atOffset<KeyHeader, kHeaderO ffset>(); }
78 81
82 // A struct to communicate descriptor information to the program descriptor builder
83 struct DescInfo {
84 bool operator==(const DescInfo& that) const {
85 return fReadsDst == that.fReadsDst &&
86 fReadsFragPosition == that.fReadsFragPosition;
87 }
88 bool operator!=(const DescInfo& that) const { return !(*this == that); } ;
89
90 // These flags give aggregated info on the processor stages that are use d when building
91 // programs.
92 bool fReadsDst;
93 bool fReadsFragPosition;
94 };
95
79 private: 96 private:
80 template<typename T, size_t OFFSET> T* atOffset() { 97 template<typename T, size_t OFFSET> T* atOffset() {
81 return reinterpret_cast<T*>(reinterpret_cast<intptr_t>(fKey.begin()) + O FFSET); 98 return reinterpret_cast<T*>(reinterpret_cast<intptr_t>(fKey.begin()) + O FFSET);
82 } 99 }
83 100
84 template<typename T, size_t OFFSET> const T* atOffset() const { 101 template<typename T, size_t OFFSET> const T* atOffset() const {
85 return reinterpret_cast<const T*>(reinterpret_cast<intptr_t>(fKey.begin( )) + OFFSET); 102 return reinterpret_cast<const T*>(reinterpret_cast<intptr_t>(fKey.begin( )) + OFFSET);
86 } 103 }
87 104
88 void finalize() { 105 void finalize() {
(...skipping 27 matching lines...) Expand all
116 kPreAllocSize = kHeaderOffset + kHeaderSize + 133 kPreAllocSize = kHeaderOffset + kHeaderSize +
117 kMaxPreallocProcessors * sizeof(uint32_t) * kIntsPerProc essor, 134 kMaxPreallocProcessors * sizeof(uint32_t) * kIntsPerProc essor,
118 }; 135 };
119 136
120 SkSTArray<kPreAllocSize, uint8_t, true> fKey; 137 SkSTArray<kPreAllocSize, uint8_t, true> fKey;
121 138
122 friend class GrGLProgramDescBuilder; 139 friend class GrGLProgramDescBuilder;
123 }; 140 };
124 141
125 #endif 142 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrPipelineBuilder.cpp ('k') | src/gpu/GrTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698