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

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

Issue 1490283004: Create GLSLUniformHandler class for gpu backend (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: clean up public api of uniformhandler Created 5 years 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.cpp ('k') | src/gpu/glsl/GrGLSLUniformHandler.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 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 "glsl/GrGLSLShaderBuilder.h" 8 #include "glsl/GrGLSLShaderBuilder.h"
9 #include "glsl/GrGLSLCaps.h" 9 #include "glsl/GrGLSLCaps.h"
10 #include "glsl/GrGLSLShaderVar.h" 10 #include "glsl/GrGLSLShaderVar.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 110 }
111 this->functions().append(") {\n"); 111 this->functions().append(") {\n");
112 this->functions().append(body); 112 this->functions().append(body);
113 this->functions().append("}\n\n"); 113 this->functions().append("}\n\n");
114 } 114 }
115 115
116 void GrGLSLShaderBuilder::appendTextureLookup(SkString* out, 116 void GrGLSLShaderBuilder::appendTextureLookup(SkString* out,
117 const GrGLSLTextureSampler& sample r, 117 const GrGLSLTextureSampler& sample r,
118 const char* coordName, 118 const char* coordName,
119 GrSLType varyingType) const { 119 GrSLType varyingType) const {
120 GrGLSLUniformHandler* uniformHandler = fProgramBuilder->uniformHandler();
120 append_texture_lookup(out, 121 append_texture_lookup(out,
121 fProgramBuilder->glslCaps(), 122 fProgramBuilder->glslCaps(),
122 fProgramBuilder->getUniformCStr(sampler.fSamplerUnifor m), 123 uniformHandler->getUniformCStr(sampler.fSamplerUniform ),
123 coordName, 124 coordName,
124 sampler.config(), 125 sampler.config(),
125 sampler.swizzle(), 126 sampler.swizzle(),
126 varyingType); 127 varyingType);
127 } 128 }
128 129
129 void GrGLSLShaderBuilder::appendTextureLookup(const GrGLSLTextureSampler& sample r, 130 void GrGLSLShaderBuilder::appendTextureLookup(const GrGLSLTextureSampler& sample r,
130 const char* coordName, 131 const char* coordName,
131 GrSLType varyingType) { 132 GrSLType varyingType) {
132 this->appendTextureLookup(&this->code(), sampler, coordName, varyingType); 133 this->appendTextureLookup(&this->code(), sampler, coordName, varyingType);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 181
181 GR_STATIC_ASSERT(0 == GrGLSLShaderBuilder::kOut_InterfaceQualifier); 182 GR_STATIC_ASSERT(0 == GrGLSLShaderBuilder::kOut_InterfaceQualifier);
182 GR_STATIC_ASSERT(SK_ARRAY_COUNT(interfaceQualifierNames) == kLastInterfaceQu alifier + 1); 183 GR_STATIC_ASSERT(SK_ARRAY_COUNT(interfaceQualifierNames) == kLastInterfaceQu alifier + 1);
183 } 184 }
184 185
185 void GrGLSLShaderBuilder::finalize(uint32_t visibility) { 186 void GrGLSLShaderBuilder::finalize(uint32_t visibility) {
186 SkASSERT(!fFinalized); 187 SkASSERT(!fFinalized);
187 this->versionDecl() = fProgramBuilder->glslCaps()->versionDeclString(); 188 this->versionDecl() = fProgramBuilder->glslCaps()->versionDeclString();
188 this->compileAndAppendLayoutQualifiers(); 189 this->compileAndAppendLayoutQualifiers();
189 SkASSERT(visibility); 190 SkASSERT(visibility);
190 fProgramBuilder->appendUniformDecls((GrGLSLProgramBuilder::ShaderVisibility) visibility, 191 fProgramBuilder->appendUniformDecls((GrGLSLUniformHandler::ShaderVisibility) visibility,
191 &this->uniforms()); 192 &this->uniforms());
192 this->appendDecls(fInputs, &this->inputs()); 193 this->appendDecls(fInputs, &this->inputs());
193 this->appendDecls(fOutputs, &this->outputs()); 194 this->appendDecls(fOutputs, &this->outputs());
194 this->onFinalize(); 195 this->onFinalize();
195 // append the 'footer' to code 196 // append the 'footer' to code
196 this->code().append("}"); 197 this->code().append("}");
197 198
198 for (int i = 0; i <= fCodeIndex; i++) { 199 for (int i = 0; i <= fCodeIndex; i++) {
199 fCompilerStrings[i] = fShaderStrings[i].c_str(); 200 fCompilerStrings[i] = fShaderStrings[i].c_str();
200 fCompilerStringLengths[i] = (int)fShaderStrings[i].size(); 201 fCompilerStringLengths[i] = (int)fShaderStrings[i].size();
201 } 202 }
202 203
203 fFinalized = true; 204 fFinalized = true;
204 } 205 }
205 206
OLDNEW
« no previous file with comments | « src/gpu/glsl/GrGLSLProgramBuilder.cpp ('k') | src/gpu/glsl/GrGLSLUniformHandler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698