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

Side by Side Diff: src/gpu/glsl/GrGLSLShaderBuilder.h

Issue 1438003003: Move all ShaderBuilder files to GLSL (Closed) Base URL: https://skia.googlesource.com/skia.git@glslProgBuild
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 | « src/gpu/glsl/GrGLSLProgramBuilder.h ('k') | src/gpu/glsl/GrGLSLShaderBuilder.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 GrGLShaderBuilder_DEFINED 8 #ifndef GrGLSLShaderBuilder_DEFINED
9 #define GrGLShaderBuilder_DEFINED 9 #define GrGLSLShaderBuilder_DEFINED
10 10
11 #include "GrAllocator.h" 11 #include "GrAllocator.h"
12 #include "glsl/GrGLSLShaderVar.h" 12 #include "glsl/GrGLSLShaderVar.h"
13 #include "SkTDArray.h" 13 #include "SkTDArray.h"
14 14
15 #include <stdarg.h> 15 #include <stdarg.h>
16 16
17 class GrGLSLProgramBuilder; 17 class GrGLSLProgramBuilder;
18 class GrGLSLTextureSampler; 18 class GrGLSLTextureSampler;
19 19
20 /** 20 /**
21 base class for all shaders builders 21 base class for all shaders builders
22 */ 22 */
23 class GrGLShaderBuilder { 23 class GrGLSLShaderBuilder {
24 public: 24 public:
25 GrGLShaderBuilder(GrGLSLProgramBuilder* program); 25 GrGLSLShaderBuilder(GrGLSLProgramBuilder* program);
26 virtual ~GrGLShaderBuilder() {} 26 virtual ~GrGLSLShaderBuilder() {}
27 27
28 void addInput(const GrGLSLShaderVar& input) { fInputs.push_back(input); } 28 void addInput(const GrGLSLShaderVar& input) { fInputs.push_back(input); }
29 void addOutput(const GrGLSLShaderVar& output) { fOutputs.push_back(output); } 29 void addOutput(const GrGLSLShaderVar& output) { fOutputs.push_back(output); }
30 30
31 /* 31 /*
32 * We put texture lookups in the base class because it is TECHNICALLY possib le to do texture 32 * We put texture lookups in the base class because it is TECHNICALLY possib le to do texture
33 * lookups in any kind of shader. However, for the time being using these c alls on non-fragment 33 * lookups in any kind of shader. However, for the time being using these c alls on non-fragment
34 * shaders will result in a shader compilation error as texture sampler unif orms are only 34 * shaders will result in a shader compilation error as texture sampler unif orms are only
35 * visible to the fragment shader. It would not be hard to change this beha vior, if someone 35 * visible to the fragment shader. It would not be hard to change this beha vior, if someone
36 * actually wants to do texture lookups in a non-fragment shader 36 * actually wants to do texture lookups in a non-fragment shader
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 /* 102 /*
103 * Get parent builder for adding uniforms 103 * Get parent builder for adding uniforms
104 */ 104 */
105 GrGLSLProgramBuilder* getProgramBuilder() { return fProgramBuilder; } 105 GrGLSLProgramBuilder* getProgramBuilder() { return fProgramBuilder; }
106 106
107 /** 107 /**
108 * Helper for begining and ending a block in the shader code. 108 * Helper for begining and ending a block in the shader code.
109 */ 109 */
110 class ShaderBlock { 110 class ShaderBlock {
111 public: 111 public:
112 ShaderBlock(GrGLShaderBuilder* builder) : fBuilder(builder) { 112 ShaderBlock(GrGLSLShaderBuilder* builder) : fBuilder(builder) {
113 SkASSERT(builder); 113 SkASSERT(builder);
114 fBuilder->codeAppend("{"); 114 fBuilder->codeAppend("{");
115 } 115 }
116 116
117 ~ShaderBlock() { 117 ~ShaderBlock() {
118 fBuilder->codeAppend("}"); 118 fBuilder->codeAppend("}");
119 } 119 }
120 private: 120 private:
121 GrGLShaderBuilder* fBuilder; 121 GrGLSLShaderBuilder* fBuilder;
122 }; 122 };
123 123
124 protected: 124 protected:
125 typedef GrTAllocator<GrGLSLShaderVar> VarArray; 125 typedef GrTAllocator<GrGLSLShaderVar> VarArray;
126 void appendDecls(const VarArray& vars, SkString* out) const; 126 void appendDecls(const VarArray& vars, SkString* out) const;
127 127
128 /* 128 /*
129 * A general function which enables an extension in a shader if the feature bit is not present 129 * A general function which enables an extension in a shader if the feature bit is not present
130 */ 130 */
131 void addFeature(uint32_t featureBit, const char* extensionName); 131 void addFeature(uint32_t featureBit, const char* extensionName);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 VarArray fOutputs; 191 VarArray fOutputs;
192 uint32_t fFeaturesAddedMask; 192 uint32_t fFeaturesAddedMask;
193 SkSTArray<1, SkString> fLayoutParams[kLastInterfaceQualifier + 1]; 193 SkSTArray<1, SkString> fLayoutParams[kLastInterfaceQualifier + 1];
194 int fCodeIndex; 194 int fCodeIndex;
195 bool fFinalized; 195 bool fFinalized;
196 196
197 friend class GrGLProgramBuilder; 197 friend class GrGLProgramBuilder;
198 friend class GrGLPathProgramBuilder; // to access fInputs. 198 friend class GrGLPathProgramBuilder; // to access fInputs.
199 }; 199 };
200 #endif 200 #endif
OLDNEW
« no previous file with comments | « src/gpu/glsl/GrGLSLProgramBuilder.h ('k') | src/gpu/glsl/GrGLSLShaderBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698