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

Side by Side Diff: src/gpu/gl/GrGLPrimitiveProcessor.h

Issue 1428543003: Create GLSL base class for ProgramDataManager (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add space 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 | « src/gpu/gl/GrGLPathRendering.cpp ('k') | src/gpu/gl/GrGLProcessor.h » ('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 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 #ifndef GrGLPrimitiveProcessor_DEFINED 8 #ifndef GrGLPrimitiveProcessor_DEFINED
9 #define GrGLPrimitiveProcessor_DEFINED 9 #define GrGLPrimitiveProcessor_DEFINED
10 10
11 #include "GrPrimitiveProcessor.h" 11 #include "GrPrimitiveProcessor.h"
12 #include "GrGLProcessor.h" 12 #include "GrGLProcessor.h"
13 #include "glsl/GrGLSLProgramDataManager.h"
13 14
14 class GrBatchTracker; 15 class GrBatchTracker;
15 class GrPrimitiveProcessor; 16 class GrPrimitiveProcessor;
16 class GrGLGPBuilder; 17 class GrGLGPBuilder;
17 18
18 class GrGLPrimitiveProcessor { 19 class GrGLPrimitiveProcessor {
19 public: 20 public:
20 virtual ~GrGLPrimitiveProcessor() {} 21 virtual ~GrGLPrimitiveProcessor() {}
21 22
22 typedef GrGLProgramDataManager::UniformHandle UniformHandle; 23 typedef GrGLSLProgramDataManager::UniformHandle UniformHandle;
23 typedef GrGLProcessor::TextureSamplerArray TextureSamplerArray; 24 typedef GrGLProcessor::TextureSamplerArray TextureSamplerArray;
24 25
25 typedef SkSTArray<2, const GrCoordTransform*, true> ProcCoords; 26 typedef SkSTArray<2, const GrCoordTransform*, true> ProcCoords;
26 typedef SkSTArray<8, ProcCoords> TransformsIn; 27 typedef SkSTArray<8, ProcCoords> TransformsIn;
27 typedef SkSTArray<8, GrGLProcessor::TransformedCoordsArray> TransformsOut; 28 typedef SkSTArray<8, GrGLProcessor::TransformedCoordsArray> TransformsOut;
28 29
29 struct EmitArgs { 30 struct EmitArgs {
30 EmitArgs(GrGLGPBuilder* pb, 31 EmitArgs(GrGLGPBuilder* pb,
31 const GrPrimitiveProcessor& gp, 32 const GrPrimitiveProcessor& gp,
32 const char* outputColor, 33 const char* outputColor,
(...skipping 23 matching lines...) Expand all
56 */ 57 */
57 virtual void emitCode(EmitArgs&) = 0; 58 virtual void emitCode(EmitArgs&) = 0;
58 59
59 60
60 /** A GrGLPrimitiveProcessor instance can be reused with any GrGLPrimitivePr ocessor that 61 /** A GrGLPrimitiveProcessor instance can be reused with any GrGLPrimitivePr ocessor that
61 produces the same stage key; this function reads data from a GrGLPrimiti veProcessor and 62 produces the same stage key; this function reads data from a GrGLPrimiti veProcessor and
62 uploads any uniform variables required by the shaders created in emitCo de(). The 63 uploads any uniform variables required by the shaders created in emitCo de(). The
63 GrPrimitiveProcessor parameter is guaranteed to be of the same type that created this 64 GrPrimitiveProcessor parameter is guaranteed to be of the same type that created this
64 GrGLPrimitiveProcessor and to have an identical processor key as the one that created this 65 GrGLPrimitiveProcessor and to have an identical processor key as the one that created this
65 GrGLPrimitiveProcessor. */ 66 GrGLPrimitiveProcessor. */
66 virtual void setData(const GrGLProgramDataManager&, const GrPrimitiveProcess or&) = 0; 67 virtual void setData(const GrGLSLProgramDataManager&, const GrPrimitiveProce ssor&) = 0;
67 68
68 static SkMatrix GetTransformMatrix(const SkMatrix& localMatrix, const GrCoor dTransform&); 69 static SkMatrix GetTransformMatrix(const SkMatrix& localMatrix, const GrCoor dTransform&);
69 70
70 virtual void setTransformData(const GrPrimitiveProcessor&, 71 virtual void setTransformData(const GrPrimitiveProcessor&,
71 const GrGLProgramDataManager& pdman, 72 const GrGLSLProgramDataManager& pdman,
72 int index, 73 int index,
73 const SkTArray<const GrCoordTransform*, true>& transforms) = 0; 74 const SkTArray<const GrCoordTransform*, true>& transforms) = 0;
74 75
75 protected: 76 protected:
76 void setupUniformColor(GrGLGPBuilder* pb, const char* outputName, UniformHan dle* colorUniform); 77 void setupUniformColor(GrGLGPBuilder* pb, const char* outputName, UniformHan dle* colorUniform);
77 78
78 struct Transform { 79 struct Transform {
79 Transform() : fType(kVoid_GrSLType) { fCurrentValue = SkMatrix::InvalidM atrix(); } 80 Transform() : fType(kVoid_GrSLType) { fCurrentValue = SkMatrix::InvalidM atrix(); }
80 GrGLProgramDataManager::UniformHandle fHandle; 81 GrGLSLProgramDataManager::UniformHandle fHandle;
81 SkMatrix fCurrentValue; 82 SkMatrix fCurrentValue;
82 GrSLType fType; 83 GrSLType fType;
83 }; 84 };
84 85
85 SkSTArray<8, SkSTArray<2, Transform, true> > fInstalledTransforms; 86 SkSTArray<8, SkSTArray<2, Transform, true> > fInstalledTransforms;
86 }; 87 };
87 88
88 #endif 89 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLPathRendering.cpp ('k') | src/gpu/gl/GrGLProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698