OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "gm.h" | 9 #include "gm.h" |
10 #if SK_SUPPORT_GPU | 10 #if SK_SUPPORT_GPU |
11 #include "GrFragmentProcessor.h" | 11 #include "GrFragmentProcessor.h" |
12 #include "GrCoordTransform.h" | 12 #include "GrCoordTransform.h" |
13 #include "effects/GrXfermodeFragmentProcessor.h" | 13 #include "effects/GrXfermodeFragmentProcessor.h" |
14 #include "gl/GrGLProcessor.h" | 14 #include "gl/GrGLProcessor.h" |
15 #include "gl/builders/GrGLProgramBuilder.h" | 15 #include "gl/builders/GrGLProgramBuilder.h" |
| 16 #include "glsl/GrGLSLProgramDataManager.h" |
16 #include "Resources.h" | 17 #include "Resources.h" |
17 #include "SkReadBuffer.h" | 18 #include "SkReadBuffer.h" |
18 #include "SkShader.h" | 19 #include "SkShader.h" |
19 #include "SkStream.h" | 20 #include "SkStream.h" |
20 #include "SkTypeface.h" | 21 #include "SkTypeface.h" |
21 #include "SkWriteBuffer.h" | 22 #include "SkWriteBuffer.h" |
22 | 23 |
23 namespace skiagm { | 24 namespace skiagm { |
24 | 25 |
25 /////////////////////////////////////////////////////////////////////////////// | 26 /////////////////////////////////////////////////////////////////////////////// |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 fpb->codeAppendf("vec2 c = %s;", fpb->ensureFSCoords2D(args.fCoo
rds, 0).c_str()); | 70 fpb->codeAppendf("vec2 c = %s;", fpb->ensureFSCoords2D(args.fCoo
rds, 0).c_str()); |
70 fpb->codeAppend("vec2 r = mod(c, vec2(20.0));"); | 71 fpb->codeAppend("vec2 r = mod(c, vec2(20.0));"); |
71 fpb->codeAppend("vec4 color = vec4(0.5*sin(c.x / 15.0) + 0.5," | 72 fpb->codeAppend("vec4 color = vec4(0.5*sin(c.x / 15.0) + 0.5," |
72 "0.5*cos((c.x + c.y) / 15.0)
+ 0.5," | 73 "0.5*cos((c.x + c.y) / 15.0)
+ 0.5," |
73 "(r.x + r.y) / 20.0," | 74 "(r.x + r.y) / 20.0," |
74 "distance(r, vec2(15.0)) / 2
0.0 + 0.2);"); | 75 "distance(r, vec2(15.0)) / 2
0.0 + 0.2);"); |
75 fpb->codeAppendf("color.rgb *= color.a;" | 76 fpb->codeAppendf("color.rgb *= color.a;" |
76 "%s = color * %s;", | 77 "%s = color * %s;", |
77 args.fOutputColor, GrGLSLExpr4(args.fInputCo
lor).c_str()); | 78 args.fOutputColor, GrGLSLExpr4(args.fInputCo
lor).c_str()); |
78 } | 79 } |
79 void onSetData(const GrGLProgramDataManager&, const GrProcessor&) ov
erride {} | 80 void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&)
override {} |
80 }; | 81 }; |
81 return new DCGLFP; | 82 return new DCGLFP; |
82 } | 83 } |
83 | 84 |
84 const char* name() const override { return "DCFP"; } | 85 const char* name() const override { return "DCFP"; } |
85 | 86 |
86 void onComputeInvariantOutput(GrInvariantOutput* inout) const override { | 87 void onComputeInvariantOutput(GrInvariantOutput* inout) const override { |
87 inout->mulByUnknownFourComponents(); | 88 inout->mulByUnknownFourComponents(); |
88 } | 89 } |
89 | 90 |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 }; | 289 }; |
289 | 290 |
290 SkTArray<Prim*> fPrims; | 291 SkTArray<Prim*> fPrims; |
291 | 292 |
292 typedef GM INHERITED; | 293 typedef GM INHERITED; |
293 }; | 294 }; |
294 | 295 |
295 DEF_GM(return new DCShaderGM;) | 296 DEF_GM(return new DCShaderGM;) |
296 } | 297 } |
297 #endif | 298 #endif |
OLD | NEW |