OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 #include "GrProcessor.h" | 8 #include "GrProcessor.h" |
9 #include "GrBackendProcessorFactory.h" | 9 #include "GrBackendProcessorFactory.h" |
10 #include "GrContext.h" | 10 #include "GrContext.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 GrBackendProcessorFactory::kIllegalEffectClassID; | 96 GrBackendProcessorFactory::kIllegalEffectClassID; |
97 | 97 |
98 /////////////////////////////////////////////////////////////////////////////// | 98 /////////////////////////////////////////////////////////////////////////////// |
99 | 99 |
100 GrProcessor::~GrProcessor() {} | 100 GrProcessor::~GrProcessor() {} |
101 | 101 |
102 const char* GrProcessor::name() const { | 102 const char* GrProcessor::name() const { |
103 return this->getFactory().name(); | 103 return this->getFactory().name(); |
104 } | 104 } |
105 | 105 |
106 void GrProcessor::addCoordTransform(const GrCoordTransform* transform) { | |
107 fCoordTransforms.push_back(transform); | |
108 SkDEBUGCODE(transform->setInEffect();) | |
109 } | |
110 | |
111 void GrProcessor::addTextureAccess(const GrTextureAccess* access) { | 106 void GrProcessor::addTextureAccess(const GrTextureAccess* access) { |
112 fTextureAccesses.push_back(access); | 107 fTextureAccesses.push_back(access); |
113 this->addGpuResource(access->getProgramTexture()); | 108 this->addGpuResource(access->getProgramTexture()); |
114 } | 109 } |
115 | 110 |
116 void* GrProcessor::operator new(size_t size) { | 111 void* GrProcessor::operator new(size_t size) { |
117 return GrProcessor_Globals::GetTLS()->allocate(size); | 112 return GrProcessor_Globals::GetTLS()->allocate(size); |
118 } | 113 } |
119 | 114 |
120 void GrProcessor::operator delete(void* target) { | 115 void GrProcessor::operator delete(void* target) { |
121 GrProcessor_Globals::GetTLS()->release(target); | 116 GrProcessor_Globals::GetTLS()->release(target); |
122 } | 117 } |
123 | 118 |
124 #ifdef SK_DEBUG | 119 #ifdef SK_DEBUG |
125 void GrProcessor::assertEquality(const GrProcessor& other) const { | 120 void GrProcessor::assertEquality(const GrProcessor& other) const { |
126 SkASSERT(this->numTransforms() == other.numTransforms()); | |
127 for (int i = 0; i < this->numTransforms(); ++i) { | |
128 SkASSERT(this->coordTransform(i) == other.coordTransform(i)); | |
129 } | |
130 SkASSERT(this->numTextures() == other.numTextures()); | 121 SkASSERT(this->numTextures() == other.numTextures()); |
131 for (int i = 0; i < this->numTextures(); ++i) { | 122 for (int i = 0; i < this->numTextures(); ++i) { |
132 SkASSERT(this->textureAccess(i) == other.textureAccess(i)); | 123 SkASSERT(this->textureAccess(i) == other.textureAccess(i)); |
133 } | 124 } |
134 } | 125 } |
135 | 126 |
136 void GrProcessor::InvariantOutput::validate() const { | 127 void GrProcessor::InvariantOutput::validate() const { |
137 if (fIsSingleComponent) { | 128 if (fIsSingleComponent) { |
138 SkASSERT(0 == fValidFlags || kRGBA_GrColorComponentFlags == fValidFlags)
; | 129 SkASSERT(0 == fValidFlags || kRGBA_GrColorComponentFlags == fValidFlags)
; |
139 if (kRGBA_GrColorComponentFlags == fValidFlags) { | 130 if (kRGBA_GrColorComponentFlags == fValidFlags) { |
(...skipping 26 matching lines...) Expand all Loading... |
166 } | 157 } |
167 } | 158 } |
168 if (kB_GrColorComponentFlag & fValidFlags) { | 159 if (kB_GrColorComponentFlag & fValidFlags) { |
169 if (c[2] > c[3]) { | 160 if (c[2] > c[3]) { |
170 return false; | 161 return false; |
171 } | 162 } |
172 } | 163 } |
173 } | 164 } |
174 return true; | 165 return true; |
175 } | 166 } |
176 #endif | 167 #endif // end DEBUG |
177 | 168 |
| 169 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 170 |
| 171 void GrFragmentProcessor::addCoordTransform(const GrCoordTransform* transform) { |
| 172 fCoordTransforms.push_back(transform); |
| 173 SkDEBUGCODE(transform->setInEffect();) |
| 174 } |
OLD | NEW |