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

Side by Side Diff: src/gpu/gl/builders/GrGLProgramBuilder.h

Issue 1462123003: Create GrGLSLVaryingHandler class for program building (Closed) Base URL: https://skia.googlesource.com/skia.git@putCapsOnArgs
Patch Set: fix release builder 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/GrGLVaryingHandler.cpp ('k') | src/gpu/gl/builders/GrGLProgramBuilder.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 #ifndef GrGLProgramBuilder_DEFINED 8 #ifndef GrGLProgramBuilder_DEFINED
9 #define GrGLProgramBuilder_DEFINED 9 #define GrGLProgramBuilder_DEFINED
10 10
11 #include "GrPipeline.h" 11 #include "GrPipeline.h"
12 #include "gl/GrGLProgramDataManager.h" 12 #include "gl/GrGLProgramDataManager.h"
13 #include "gl/GrGLVaryingHandler.h"
13 #include "glsl/GrGLSLPrimitiveProcessor.h" 14 #include "glsl/GrGLSLPrimitiveProcessor.h"
14 #include "glsl/GrGLSLProgramBuilder.h" 15 #include "glsl/GrGLSLProgramBuilder.h"
15 #include "glsl/GrGLSLProgramDataManager.h" 16 #include "glsl/GrGLSLProgramDataManager.h"
16 #include "glsl/GrGLSLTextureSampler.h" 17 #include "glsl/GrGLSLTextureSampler.h"
17 #include "glsl/GrGLSLXferProcessor.h" 18 #include "glsl/GrGLSLXferProcessor.h"
18 19
19 class GrFragmentProcessor; 20 class GrFragmentProcessor;
20 class GrGLContextInfo; 21 class GrGLContextInfo;
21 class GrGLSLShaderBuilder; 22 class GrGLSLShaderBuilder;
22 class GrGLSLCaps; 23 class GrGLSLCaps;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 } 63 }
63 64
64 const char* getUniformCStr(UniformHandle u) const override { 65 const char* getUniformCStr(UniformHandle u) const override {
65 return this->getUniformVariable(u).c_str(); 66 return this->getUniformVariable(u).c_str();
66 } 67 }
67 68
68 const GrGLSLCaps* glslCaps() const override; 69 const GrGLSLCaps* glslCaps() const override;
69 70
70 GrGLGpu* gpu() const { return fGpu; } 71 GrGLGpu* gpu() const { return fGpu; }
71 72
72 void addVarying(
73 const char* name,
74 GrGLSLVarying*,
75 GrSLPrecision precision = kDefault_GrSLPrecision) override;
76
77 void addPassThroughAttribute(const GrPrimitiveProcessor::Attribute*,
78 const char* output) override;
79
80 SeparableVaryingHandle addSeparableVarying(
81 const char* name,
82 GrGLSLVertToFrag*,
83 GrSLPrecision fsPrecision = kDefault_GrSLPrecision) override;
84
85 private: 73 private:
86 typedef GrGLProgramDataManager::UniformInfo UniformInfo; 74 typedef GrGLProgramDataManager::UniformInfo UniformInfo;
87 typedef GrGLProgramDataManager::UniformInfoArray UniformInfoArray; 75 typedef GrGLProgramDataManager::UniformInfoArray UniformInfoArray;
88 typedef GrGLProgramDataManager::SeparableVaryingInfo SeparableVaryingInfo;
89 typedef GrGLProgramDataManager::SeparableVaryingInfoArray SeparableVaryingIn foArray;
90 76
91 GrGLProgramBuilder(GrGLGpu*, const DrawArgs&); 77 GrGLProgramBuilder(GrGLGpu*, const DrawArgs&);
92 78
93 UniformHandle internalAddUniformArray(uint32_t visibility, 79 UniformHandle internalAddUniformArray(uint32_t visibility,
94 GrSLType type, 80 GrSLType type,
95 GrSLPrecision precision, 81 GrSLPrecision precision,
96 const char* name, 82 const char* name,
97 bool mangleName, 83 bool mangleName,
98 int arrayCount, 84 int arrayCount,
99 const char** outName) override; 85 const char** outName) override;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 bool checkLinkStatus(GrGLuint programID); 127 bool checkLinkStatus(GrGLuint programID);
142 void resolveProgramResourceLocations(GrGLuint programID); 128 void resolveProgramResourceLocations(GrGLuint programID);
143 void cleanupProgram(GrGLuint programID, const SkTDArray<GrGLuint>& shaderIDs ); 129 void cleanupProgram(GrGLuint programID, const SkTDArray<GrGLuint>& shaderIDs );
144 void cleanupShaders(const SkTDArray<GrGLuint>& shaderIDs); 130 void cleanupShaders(const SkTDArray<GrGLuint>& shaderIDs);
145 131
146 // Subclasses create different programs 132 // Subclasses create different programs
147 GrGLProgram* createProgram(GrGLuint programID); 133 GrGLProgram* createProgram(GrGLuint programID);
148 134
149 void onAppendUniformDecls(ShaderVisibility visibility, SkString* out) const override; 135 void onAppendUniformDecls(ShaderVisibility visibility, SkString* out) const override;
150 136
137 GrGLSLVaryingHandler* varyingHandler() override { return &fVaryingHandler; }
138
151 // reset is called by program creator between each processor's emit code. I t increments the 139 // reset is called by program creator between each processor's emit code. I t increments the
152 // stage offset for variable name mangling, and also ensures verfication var iables in the 140 // stage offset for variable name mangling, and also ensures verfication var iables in the
153 // fragment shader are cleared. 141 // fragment shader are cleared.
154 void reset() { 142 void reset() {
155 this->addStage(); 143 this->addStage();
156 fFS.reset(); 144 fFS.reset();
157 } 145 }
158 void addStage() { fStageIndex++; } 146 void addStage() { fStageIndex++; }
159 147
160 class AutoStageAdvance { 148 class AutoStageAdvance {
(...skipping 11 matching lines...) Expand all
172 160
173 GrGLInstalledGeoProc* fGeometryProcessor; 161 GrGLInstalledGeoProc* fGeometryProcessor;
174 GrGLInstalledXferProc* fXferProcessor; 162 GrGLInstalledXferProc* fXferProcessor;
175 SkAutoTUnref<GrGLInstalledFragProcs> fFragmentProcessors; 163 SkAutoTUnref<GrGLInstalledFragProcs> fFragmentProcessors;
176 164
177 GrGLGpu* fGpu; 165 GrGLGpu* fGpu;
178 UniformInfoArray fUniforms; 166 UniformInfoArray fUniforms;
179 GrGLSLPrimitiveProcessor::TransformsIn fCoordTransforms; 167 GrGLSLPrimitiveProcessor::TransformsIn fCoordTransforms;
180 GrGLSLPrimitiveProcessor::TransformsOut fOutCoords; 168 GrGLSLPrimitiveProcessor::TransformsOut fOutCoords;
181 SkTArray<UniformHandle> fSamplerUniforms; 169 SkTArray<UniformHandle> fSamplerUniforms;
182 SeparableVaryingInfoArray fSeparableVaryingInfos;
183 170
184 friend class GrGLSLShaderBuilder; 171 GrGLVaryingHandler fVaryingHandler;
185 friend class GrGLSLVertexBuilder;
186 friend class GrGLSLFragmentShaderBuilder;
187 friend class GrGLSLGeometryBuilder;
188 172
189 typedef GrGLSLProgramBuilder INHERITED; 173 friend class GrGLVaryingHandler;
174
175 typedef GrGLSLProgramBuilder INHERITED;
190 }; 176 };
191 #endif 177 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLVaryingHandler.cpp ('k') | src/gpu/gl/builders/GrGLProgramBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698