OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkArithmeticMode_gpu.h" | 8 #include "SkArithmeticMode_gpu.h" |
9 | 9 |
10 #if SK_SUPPORT_GPU | 10 #if SK_SUPPORT_GPU |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 ~GLArithmeticXP() override {} | 199 ~GLArithmeticXP() override {} |
200 | 200 |
201 static void GenKey(const GrProcessor& processor, const GrGLSLCaps& caps, | 201 static void GenKey(const GrProcessor& processor, const GrGLSLCaps& caps, |
202 GrProcessorKeyBuilder* b) { | 202 GrProcessorKeyBuilder* b) { |
203 const ArithmeticXP& arith = processor.cast<ArithmeticXP>(); | 203 const ArithmeticXP& arith = processor.cast<ArithmeticXP>(); |
204 uint32_t key = arith.enforcePMColor() ? 1 : 0; | 204 uint32_t key = arith.enforcePMColor() ? 1 : 0; |
205 b->add32(key); | 205 b->add32(key); |
206 } | 206 } |
207 | 207 |
208 private: | 208 private: |
209 void emitBlendCodeForDstRead(GrGLXPBuilder* pb, const char* srcColor, const
char* dstColor, | 209 void emitBlendCodeForDstRead(GrGLSLXPBuilder* pb, const char* srcColor, cons
t char* dstColor, |
210 const char* outColor, const GrXferProcessor& pr
oc) override { | 210 const char* outColor, const GrXferProcessor& pr
oc) override { |
211 GrGLXPFragmentBuilder* fsBuilder = pb->getFragmentShaderBuilder(); | 211 GrGLXPFragmentBuilder* fsBuilder = pb->getFragmentShaderBuilder(); |
212 | 212 |
213 fKUni = pb->addUniform(GrGLProgramBuilder::kFragment_Visibility, | 213 fKUni = pb->addUniform(GrGLProgramBuilder::kFragment_Visibility, |
214 kVec4f_GrSLType, kDefault_GrSLPrecision, | 214 kVec4f_GrSLType, kDefault_GrSLPrecision, |
215 "k"); | 215 "k"); |
216 const char* kUni = pb->getUniformCStr(fKUni); | 216 const char* kUni = pb->getUniformCStr(fKUni); |
217 | 217 |
218 add_arithmetic_code(fsBuilder, srcColor, dstColor, outColor, kUni, fEnfo
rcePMColor); | 218 add_arithmetic_code(fsBuilder, srcColor, dstColor, outColor, kUni, fEnfo
rcePMColor); |
219 } | 219 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 float k1 = d->fRandom->nextF(); | 292 float k1 = d->fRandom->nextF(); |
293 float k2 = d->fRandom->nextF(); | 293 float k2 = d->fRandom->nextF(); |
294 float k3 = d->fRandom->nextF(); | 294 float k3 = d->fRandom->nextF(); |
295 float k4 = d->fRandom->nextF(); | 295 float k4 = d->fRandom->nextF(); |
296 bool enforcePMColor = d->fRandom->nextBool(); | 296 bool enforcePMColor = d->fRandom->nextBool(); |
297 | 297 |
298 return GrArithmeticXPFactory::Create(k1, k2, k3, k4, enforcePMColor); | 298 return GrArithmeticXPFactory::Create(k1, k2, k3, k4, enforcePMColor); |
299 } | 299 } |
300 | 300 |
301 #endif | 301 #endif |
OLD | NEW |