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

Side by Side Diff: src/gpu/GrDefaultGeoProcFactory.cpp

Issue 1441683008: Move GrGLPrimitive/GeometryProc to GLSL (Closed) Base URL: https://skia.googlesource.com/skia.git@xferProcs
Patch Set: nits Created 5 years, 1 month 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 | « gyp/gpu.gypi ('k') | src/gpu/GrOvalRenderer.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 #include "GrDefaultGeoProcFactory.h" 8 #include "GrDefaultGeoProcFactory.h"
9 9
10 #include "GrInvariantOutput.h" 10 #include "GrInvariantOutput.h"
11 #include "gl/GrGLGeometryProcessor.h"
12 #include "glsl/GrGLSLFragmentShaderBuilder.h" 11 #include "glsl/GrGLSLFragmentShaderBuilder.h"
12 #include "glsl/GrGLSLGeometryProcessor.h"
13 #include "glsl/GrGLSLProgramBuilder.h" 13 #include "glsl/GrGLSLProgramBuilder.h"
14 #include "glsl/GrGLSLVertexShaderBuilder.h" 14 #include "glsl/GrGLSLVertexShaderBuilder.h"
15 #include "glsl/GrGLSLUtil.h" 15 #include "glsl/GrGLSLUtil.h"
16 16
17 /* 17 /*
18 * The default Geometry Processor simply takes position and multiplies it by the uniform view 18 * The default Geometry Processor simply takes position and multiplies it by the uniform view
19 * matrix. It also leaves coverage untouched. Behind the scenes, we may add per vertex color or 19 * matrix. It also leaves coverage untouched. Behind the scenes, we may add per vertex color or
20 * local coords. 20 * local coords.
21 */ 21 */
22 22
(...skipping 26 matching lines...) Expand all
49 GrColor color() const { return fColor; } 49 GrColor color() const { return fColor; }
50 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; } 50 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; }
51 bool hasVertexColor() const { return SkToBool(fInColor); } 51 bool hasVertexColor() const { return SkToBool(fInColor); }
52 const SkMatrix& viewMatrix() const { return fViewMatrix; } 52 const SkMatrix& viewMatrix() const { return fViewMatrix; }
53 const SkMatrix& localMatrix() const { return fLocalMatrix; } 53 const SkMatrix& localMatrix() const { return fLocalMatrix; }
54 bool localCoordsWillBeRead() const { return fLocalCoordsWillBeRead; } 54 bool localCoordsWillBeRead() const { return fLocalCoordsWillBeRead; }
55 uint8_t coverage() const { return fCoverage; } 55 uint8_t coverage() const { return fCoverage; }
56 bool coverageWillBeIgnored() const { return fCoverageWillBeIgnored; } 56 bool coverageWillBeIgnored() const { return fCoverageWillBeIgnored; }
57 bool hasVertexCoverage() const { return SkToBool(fInCoverage); } 57 bool hasVertexCoverage() const { return SkToBool(fInCoverage); }
58 58
59 class GLProcessor : public GrGLGeometryProcessor { 59 class GLProcessor : public GrGLSLGeometryProcessor {
60 public: 60 public:
61 GLProcessor() 61 GLProcessor()
62 : fViewMatrix(SkMatrix::InvalidMatrix()), fColor(GrColor_ILLEGAL), f Coverage(0xff) {} 62 : fViewMatrix(SkMatrix::InvalidMatrix()), fColor(GrColor_ILLEGAL), f Coverage(0xff) {}
63 63
64 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override { 64 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
65 const DefaultGeoProc& gp = args.fGP.cast<DefaultGeoProc>(); 65 const DefaultGeoProc& gp = args.fGP.cast<DefaultGeoProc>();
66 GrGLSLGPBuilder* pb = args.fPB; 66 GrGLSLGPBuilder* pb = args.fPB;
67 GrGLSLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder(); 67 GrGLSLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder();
68 GrGLSLFragmentBuilder* fs = args.fPB->getFragmentShaderBuilder(); 68 GrGLSLFragmentBuilder* fs = args.fPB->getFragmentShaderBuilder();
69 69
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 } 166 }
167 167
168 private: 168 private:
169 SkMatrix fViewMatrix; 169 SkMatrix fViewMatrix;
170 GrColor fColor; 170 GrColor fColor;
171 uint8_t fCoverage; 171 uint8_t fCoverage;
172 UniformHandle fViewMatrixUniform; 172 UniformHandle fViewMatrixUniform;
173 UniformHandle fColorUniform; 173 UniformHandle fColorUniform;
174 UniformHandle fCoverageUniform; 174 UniformHandle fCoverageUniform;
175 175
176 typedef GrGLGeometryProcessor INHERITED; 176 typedef GrGLSLGeometryProcessor INHERITED;
177 }; 177 };
178 178
179 void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) con st override { 179 void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) con st override {
180 GLProcessor::GenKey(*this, caps, b); 180 GLProcessor::GenKey(*this, caps, b);
181 } 181 }
182 182
183 GrGLPrimitiveProcessor* createGLInstance(const GrGLSLCaps&) const override { 183 GrGLSLPrimitiveProcessor* createGLInstance(const GrGLSLCaps&) const override {
184 return new GLProcessor(); 184 return new GLProcessor();
185 } 185 }
186 186
187 private: 187 private:
188 DefaultGeoProc(uint32_t gpTypeFlags, 188 DefaultGeoProc(uint32_t gpTypeFlags,
189 GrColor color, 189 GrColor color,
190 const SkMatrix& viewMatrix, 190 const SkMatrix& viewMatrix,
191 const SkMatrix& localMatrix, 191 const SkMatrix& localMatrix,
192 uint8_t coverage, 192 uint8_t coverage,
193 bool localCoordsWillBeRead, 193 bool localCoordsWillBeRead,
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 } 312 }
313 313
314 if (localCoords.hasLocalMatrix()) { 314 if (localCoords.hasLocalMatrix()) {
315 invert.preConcat(*localCoords.fMatrix); 315 invert.preConcat(*localCoords.fMatrix);
316 } 316 }
317 } 317 }
318 318
319 LocalCoords inverted(LocalCoords::kUsePosition_Type, &invert); 319 LocalCoords inverted(LocalCoords::kUsePosition_Type, &invert);
320 return Create(color, coverage, inverted, SkMatrix::I()); 320 return Create(color, coverage, inverted, SkMatrix::I());
321 } 321 }
OLDNEW
« no previous file with comments | « gyp/gpu.gypi ('k') | src/gpu/GrOvalRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698