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

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

Issue 1151693005: Remove uniform view matrix from GrGLPrimitiveProcessor base class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more Created 5 years, 7 months 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/GrGLGeometryProcessor.cpp ('k') | src/gpu/gl/GrGLPrimitiveProcessor.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 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 13
14 class GrBatchTracker; 14 class GrBatchTracker;
15 class GrPrimitiveProcessor; 15 class GrPrimitiveProcessor;
16 class GrGLGPBuilder; 16 class GrGLGPBuilder;
17 17
18 class GrGLPrimitiveProcessor { 18 class GrGLPrimitiveProcessor {
19 public: 19 public:
20 GrGLPrimitiveProcessor() : fViewMatrixName(NULL) { fViewMatrix = SkMatrix::I nvalidMatrix(); }
21 virtual ~GrGLPrimitiveProcessor() {} 20 virtual ~GrGLPrimitiveProcessor() {}
22 21
23 typedef GrGLProgramDataManager::UniformHandle UniformHandle; 22 typedef GrGLProgramDataManager::UniformHandle UniformHandle;
24 typedef GrGLProcessor::TextureSamplerArray TextureSamplerArray; 23 typedef GrGLProcessor::TextureSamplerArray TextureSamplerArray;
25 24
26 typedef SkSTArray<2, const GrCoordTransform*, true> ProcCoords; 25 typedef SkSTArray<2, const GrCoordTransform*, true> ProcCoords;
27 typedef SkSTArray<8, ProcCoords> TransformsIn; 26 typedef SkSTArray<8, ProcCoords> TransformsIn;
28 typedef SkSTArray<8, GrGLProcessor::TransformedCoordsArray> TransformsOut; 27 typedef SkSTArray<8, GrGLProcessor::TransformedCoordsArray> TransformsOut;
29 28
30 struct EmitArgs { 29 struct EmitArgs {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 GrGLPrimitiveProcessor. */ 68 GrGLPrimitiveProcessor. */
70 virtual void setData(const GrGLProgramDataManager&, 69 virtual void setData(const GrGLProgramDataManager&,
71 const GrPrimitiveProcessor&, 70 const GrPrimitiveProcessor&,
72 const GrBatchTracker&) = 0; 71 const GrBatchTracker&) = 0;
73 72
74 static SkMatrix GetTransformMatrix(const SkMatrix& localMatrix, const GrCoor dTransform&); 73 static SkMatrix GetTransformMatrix(const SkMatrix& localMatrix, const GrCoor dTransform&);
75 74
76 protected: 75 protected:
77 void setupUniformColor(GrGLGPBuilder* pb, const char* outputName, UniformHan dle* colorUniform); 76 void setupUniformColor(GrGLGPBuilder* pb, const char* outputName, UniformHan dle* colorUniform);
78 77
79 const char* uViewM() const { return fViewMatrixName; }
80
81 /** a helper function to setup the uniform handle for the uniform view matri x */
82 void addUniformViewMatrix(GrGLGPBuilder*);
83
84
85 /** a helper function to upload a uniform viewmatrix.
86 * TODO we can remove this function when we have deferred geometry in place
87 */
88 void setUniformViewMatrix(const GrGLProgramDataManager&,
89 const SkMatrix& viewMatrix);
90
91 class ShaderVarHandle { 78 class ShaderVarHandle {
92 public: 79 public:
93 bool isValid() const { return fHandle > -1; } 80 bool isValid() const { return fHandle > -1; }
94 ShaderVarHandle() : fHandle(-1) {} 81 ShaderVarHandle() : fHandle(-1) {}
95 ShaderVarHandle(int value) : fHandle(value) { SkASSERT(this->isValid()); } 82 ShaderVarHandle(int value) : fHandle(value) { SkASSERT(this->isValid()); }
96 int handle() const { SkASSERT(this->isValid()); return fHandle; } 83 int handle() const { SkASSERT(this->isValid()); return fHandle; }
97 UniformHandle convertToUniformHandle() { 84 UniformHandle convertToUniformHandle() {
98 SkASSERT(this->isValid()); 85 SkASSERT(this->isValid());
99 return GrGLProgramDataManager::UniformHandle::CreateFromUniformIndex (fHandle); 86 return GrGLProgramDataManager::UniformHandle::CreateFromUniformIndex (fHandle);
100 } 87 }
101 88
102 private: 89 private:
103 int fHandle; 90 int fHandle;
104 }; 91 };
105 92
106 struct Transform { 93 struct Transform {
107 Transform() : fType(kVoid_GrSLType) { fCurrentValue = SkMatrix::InvalidM atrix(); } 94 Transform() : fType(kVoid_GrSLType) { fCurrentValue = SkMatrix::InvalidM atrix(); }
108 ShaderVarHandle fHandle; 95 ShaderVarHandle fHandle;
109 SkMatrix fCurrentValue; 96 SkMatrix fCurrentValue;
110 GrSLType fType; 97 GrSLType fType;
111 }; 98 };
112 99
113 SkSTArray<8, SkSTArray<2, Transform, true> > fInstalledTransforms; 100 SkSTArray<8, SkSTArray<2, Transform, true> > fInstalledTransforms;
114
115 private:
116 UniformHandle fViewMatrixUniform;
117 SkMatrix fViewMatrix;
118 const char* fViewMatrixName;
119 }; 101 };
120 102
121 #endif 103 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLGeometryProcessor.cpp ('k') | src/gpu/gl/GrGLPrimitiveProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698