OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "GrBezierEffect.h" | 8 #include "GrBezierEffect.h" |
9 | 9 |
10 #include "gl/GrGLFragmentProcessor.h" | |
11 #include "gl/GrGLGeometryProcessor.h" | 10 #include "gl/GrGLGeometryProcessor.h" |
12 #include "gl/GrGLUtil.h" | 11 #include "glsl/GrGLSLFragmentProcessor.h" |
13 #include "glsl/GrGLSLProgramBuilder.h" | 12 #include "glsl/GrGLSLProgramBuilder.h" |
14 #include "glsl/GrGLSLProgramDataManager.h" | 13 #include "glsl/GrGLSLProgramDataManager.h" |
| 14 #include "glsl/GrGLSLUtil.h" |
15 | 15 |
16 class GrGLConicEffect : public GrGLGeometryProcessor { | 16 class GrGLConicEffect : public GrGLGeometryProcessor { |
17 public: | 17 public: |
18 GrGLConicEffect(const GrGeometryProcessor&); | 18 GrGLConicEffect(const GrGeometryProcessor&); |
19 | 19 |
20 void onEmitCode(EmitArgs&, GrGPArgs*) override; | 20 void onEmitCode(EmitArgs&, GrGPArgs*) override; |
21 | 21 |
22 static inline void GenKey(const GrGeometryProcessor&, | 22 static inline void GenKey(const GrGeometryProcessor&, |
23 const GrGLSLCaps&, | 23 const GrGLSLCaps&, |
24 GrProcessorKeyBuilder*); | 24 GrProcessorKeyBuilder*); |
25 | 25 |
26 void setData(const GrGLSLProgramDataManager& pdman, | 26 void setData(const GrGLSLProgramDataManager& pdman, |
27 const GrPrimitiveProcessor& primProc) override { | 27 const GrPrimitiveProcessor& primProc) override { |
28 const GrConicEffect& ce = primProc.cast<GrConicEffect>(); | 28 const GrConicEffect& ce = primProc.cast<GrConicEffect>(); |
29 | 29 |
30 if (!ce.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(ce.viewMa
trix())) { | 30 if (!ce.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(ce.viewMa
trix())) { |
31 fViewMatrix = ce.viewMatrix(); | 31 fViewMatrix = ce.viewMatrix(); |
32 float viewMatrix[3 * 3]; | 32 float viewMatrix[3 * 3]; |
33 GrGLGetMatrix<3>(viewMatrix, fViewMatrix); | 33 GrGLSLGetMatrix<3>(viewMatrix, fViewMatrix); |
34 pdman.setMatrix3f(fViewMatrixUniform, viewMatrix); | 34 pdman.setMatrix3f(fViewMatrixUniform, viewMatrix); |
35 } | 35 } |
36 | 36 |
37 if (ce.color() != fColor) { | 37 if (ce.color() != fColor) { |
38 float c[4]; | 38 float c[4]; |
39 GrColorToRGBAFloat(ce.color(), c); | 39 GrColorToRGBAFloat(ce.color(), c); |
40 pdman.set4fv(fColorUniform, 1, c); | 40 pdman.set4fv(fColorUniform, 1, c); |
41 fColor = ce.color(); | 41 fColor = ce.color(); |
42 } | 42 } |
43 | 43 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 const GrGLSLCaps&, | 239 const GrGLSLCaps&, |
240 GrProcessorKeyBuilder*); | 240 GrProcessorKeyBuilder*); |
241 | 241 |
242 void setData(const GrGLSLProgramDataManager& pdman, | 242 void setData(const GrGLSLProgramDataManager& pdman, |
243 const GrPrimitiveProcessor& primProc) override { | 243 const GrPrimitiveProcessor& primProc) override { |
244 const GrQuadEffect& qe = primProc.cast<GrQuadEffect>(); | 244 const GrQuadEffect& qe = primProc.cast<GrQuadEffect>(); |
245 | 245 |
246 if (!qe.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(qe.viewMa
trix())) { | 246 if (!qe.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(qe.viewMa
trix())) { |
247 fViewMatrix = qe.viewMatrix(); | 247 fViewMatrix = qe.viewMatrix(); |
248 float viewMatrix[3 * 3]; | 248 float viewMatrix[3 * 3]; |
249 GrGLGetMatrix<3>(viewMatrix, fViewMatrix); | 249 GrGLSLGetMatrix<3>(viewMatrix, fViewMatrix); |
250 pdman.setMatrix3f(fViewMatrixUniform, viewMatrix); | 250 pdman.setMatrix3f(fViewMatrixUniform, viewMatrix); |
251 } | 251 } |
252 | 252 |
253 if (qe.color() != fColor) { | 253 if (qe.color() != fColor) { |
254 float c[4]; | 254 float c[4]; |
255 GrColorToRGBAFloat(qe.color(), c); | 255 GrColorToRGBAFloat(qe.color(), c); |
256 pdman.set4fv(fColorUniform, 1, c); | 256 pdman.set4fv(fColorUniform, 1, c); |
257 fColor = qe.color(); | 257 fColor = qe.color(); |
258 } | 258 } |
259 | 259 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 const GrGLSLCaps&, | 441 const GrGLSLCaps&, |
442 GrProcessorKeyBuilder*); | 442 GrProcessorKeyBuilder*); |
443 | 443 |
444 void setData(const GrGLSLProgramDataManager& pdman, | 444 void setData(const GrGLSLProgramDataManager& pdman, |
445 const GrPrimitiveProcessor& primProc) override { | 445 const GrPrimitiveProcessor& primProc) override { |
446 const GrCubicEffect& ce = primProc.cast<GrCubicEffect>(); | 446 const GrCubicEffect& ce = primProc.cast<GrCubicEffect>(); |
447 | 447 |
448 if (!ce.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(ce.viewMa
trix())) { | 448 if (!ce.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(ce.viewMa
trix())) { |
449 fViewMatrix = ce.viewMatrix(); | 449 fViewMatrix = ce.viewMatrix(); |
450 float viewMatrix[3 * 3]; | 450 float viewMatrix[3 * 3]; |
451 GrGLGetMatrix<3>(viewMatrix, fViewMatrix); | 451 GrGLSLGetMatrix<3>(viewMatrix, fViewMatrix); |
452 pdman.setMatrix3f(fViewMatrixUniform, viewMatrix); | 452 pdman.setMatrix3f(fViewMatrixUniform, viewMatrix); |
453 } | 453 } |
454 | 454 |
455 if (ce.color() != fColor) { | 455 if (ce.color() != fColor) { |
456 float c[4]; | 456 float c[4]; |
457 GrColorToRGBAFloat(ce.color(), c); | 457 GrColorToRGBAFloat(ce.color(), c); |
458 pdman.set4fv(fColorUniform, 1, c); | 458 pdman.set4fv(fColorUniform, 1, c); |
459 fColor = ce.color(); | 459 fColor = ce.color(); |
460 } | 460 } |
461 } | 461 } |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 do { | 630 do { |
631 GrPrimitiveEdgeType edgeType = | 631 GrPrimitiveEdgeType edgeType = |
632 static_cast<GrPrimitiveEdgeType>( | 632 static_cast<GrPrimitiveEdgeType>( |
633 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); | 633 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); |
634 gp = GrCubicEffect::Create(GrRandomColor(d->fRandom), | 634 gp = GrCubicEffect::Create(GrRandomColor(d->fRandom), |
635 GrTest::TestMatrix(d->fRandom), edgeType, *d-
>fCaps); | 635 GrTest::TestMatrix(d->fRandom), edgeType, *d-
>fCaps); |
636 } while (nullptr == gp); | 636 } while (nullptr == gp); |
637 return gp; | 637 return gp; |
638 } | 638 } |
639 | 639 |
OLD | NEW |