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

Side by Side Diff: src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp

Issue 1417993004: Add version string and force highp NDS transfrom to GLSLCaps (Closed) Base URL: https://skia.googlesource.com/skia.git@renameShaderVar
Patch Set: Fix glslInit 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/GrGLGpu.cpp ('k') | src/gpu/gl/builders/GrGLVertexShaderBuilder.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 #include "GrGLFragmentShaderBuilder.h" 8 #include "GrGLFragmentShaderBuilder.h"
9 #include "GrGLProgramBuilder.h" 9 #include "GrGLProgramBuilder.h"
10 #include "gl/GrGLGpu.h" 10 #include "gl/GrGLGpu.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 fSetupFragPosition = true; 185 fSetupFragPosition = true;
186 } 186 }
187 SkASSERT(fProgramBuilder->fUniformHandles.fRTHeightUni.isValid()); 187 SkASSERT(fProgramBuilder->fUniformHandles.fRTHeightUni.isValid());
188 return kCoordName; 188 return kCoordName;
189 } 189 }
190 } 190 }
191 191
192 const char* GrGLFragmentShaderBuilder::dstColor() { 192 const char* GrGLFragmentShaderBuilder::dstColor() {
193 fHasReadDstColor = true; 193 fHasReadDstColor = true;
194 194
195 GrGLGpu* gpu = fProgramBuilder->gpu(); 195 const GrGLSLCaps* glslCaps = fProgramBuilder->glslCaps();
196 if (gpu->glCaps().glslCaps()->fbFetchSupport()) { 196 if (glslCaps->fbFetchSupport()) {
197 this->addFeature(1 << (GrGLFragmentShaderBuilder::kLastGLSLPrivateFeatur e + 1), 197 this->addFeature(1 << (GrGLFragmentShaderBuilder::kLastGLSLPrivateFeatur e + 1),
198 gpu->glCaps().glslCaps()->fbFetchExtensionString()); 198 glslCaps->fbFetchExtensionString());
199 199
200 // Some versions of this extension string require declaring custom color output on ES 3.0+ 200 // Some versions of this extension string require declaring custom color output on ES 3.0+
201 const char* fbFetchColorName = gpu->glCaps().glslCaps()->fbFetchColorNam e(); 201 const char* fbFetchColorName = glslCaps->fbFetchColorName();
202 if (gpu->glCaps().glslCaps()->fbFetchNeedsCustomOutput()) { 202 if (glslCaps->fbFetchNeedsCustomOutput()) {
203 this->enableCustomOutput(); 203 this->enableCustomOutput();
204 fOutputs[fCustomColorOutputIndex].setTypeModifier(GrShaderVar::kInOu t_TypeModifier); 204 fOutputs[fCustomColorOutputIndex].setTypeModifier(GrShaderVar::kInOu t_TypeModifier);
205 fbFetchColorName = declared_color_output_name(); 205 fbFetchColorName = declared_color_output_name();
206 } 206 }
207 return fbFetchColorName; 207 return fbFetchColorName;
208 } else { 208 } else {
209 return kDstTextureColorName; 209 return kDstTextureColorName;
210 } 210 }
211 } 211 }
212 212
213 void GrGLFragmentShaderBuilder::enableAdvancedBlendEquationIfNeeded(GrBlendEquat ion equation) { 213 void GrGLFragmentShaderBuilder::enableAdvancedBlendEquationIfNeeded(GrBlendEquat ion equation) {
214 SkASSERT(GrBlendEquationIsAdvanced(equation)); 214 SkASSERT(GrBlendEquationIsAdvanced(equation));
215 215
216 const GrGLSLCaps& caps = *fProgramBuilder->gpu()->glCaps().glslCaps(); 216 const GrGLSLCaps& caps = *fProgramBuilder->glslCaps();
217 if (!caps.mustEnableAdvBlendEqs()) { 217 if (!caps.mustEnableAdvBlendEqs()) {
218 return; 218 return;
219 } 219 }
220 220
221 this->addFeature(1 << kBlendEquationAdvanced_GLSLPrivateFeature, 221 this->addFeature(1 << kBlendEquationAdvanced_GLSLPrivateFeature,
222 "GL_KHR_blend_equation_advanced"); 222 "GL_KHR_blend_equation_advanced");
223 if (caps.mustEnableSpecificAdvBlendEqs()) { 223 if (caps.mustEnableSpecificAdvBlendEqs()) {
224 this->addLayoutQualifier(specific_layout_qualifier_name(equation), kOut_ InterfaceQualifier); 224 this->addLayoutQualifier(specific_layout_qualifier_name(equation), kOut_ InterfaceQualifier);
225 } else { 225 } else {
226 this->addLayoutQualifier("blend_support_all_equations", kOut_InterfaceQu alifier); 226 this->addLayoutQualifier("blend_support_all_equations", kOut_InterfaceQu alifier);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 261
262 const char* GrGLFragmentShaderBuilder::getSecondaryColorOutputName() const { 262 const char* GrGLFragmentShaderBuilder::getSecondaryColorOutputName() const {
263 const GrGLSLCaps& caps = *fProgramBuilder->gpu()->glCaps().glslCaps(); 263 const GrGLSLCaps& caps = *fProgramBuilder->gpu()->glCaps().glslCaps();
264 return caps.mustDeclareFragmentShaderOutput() ? declared_secondary_color_out put_name() 264 return caps.mustDeclareFragmentShaderOutput() ? declared_secondary_color_out put_name()
265 : "gl_SecondaryFragColorEXT"; 265 : "gl_SecondaryFragColorEXT";
266 } 266 }
267 267
268 bool GrGLFragmentShaderBuilder::compileAndAttachShaders(GrGLuint programId, 268 bool GrGLFragmentShaderBuilder::compileAndAttachShaders(GrGLuint programId,
269 SkTDArray<GrGLuint>* sha derIds) { 269 SkTDArray<GrGLuint>* sha derIds) {
270 GrGLGpu* gpu = fProgramBuilder->gpu(); 270 GrGLGpu* gpu = fProgramBuilder->gpu();
271 this->versionDecl() = GrGLGetGLSLVersionDecl(gpu->ctxInfo()); 271 this->versionDecl() = fProgramBuilder->glslCaps()->versionDeclString();
272 GrGLAppendGLSLDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision, 272 GrGLAppendGLSLDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision,
273 gpu->glStandard(), 273 gpu->glStandard(),
274 &this->precisionQualifier()); 274 &this->precisionQualifier());
275 this->compileAndAppendLayoutQualifiers(); 275 this->compileAndAppendLayoutQualifiers();
276 fProgramBuilder->appendUniformDecls(GrGLProgramBuilder::kFragment_Visibility , 276 fProgramBuilder->appendUniformDecls(GrGLProgramBuilder::kFragment_Visibility ,
277 &this->uniforms()); 277 &this->uniforms());
278 this->appendDecls(fInputs, &this->inputs()); 278 this->appendDecls(fInputs, &this->inputs());
279 // We shouldn't have declared outputs on 1.10 279 // We shouldn't have declared outputs on 1.10
280 SkASSERT(k110_GrGLSLGeneration != gpu->glslGeneration() || fOutputs.empty()) ; 280 SkASSERT(k110_GrGLSLGeneration != gpu->glslGeneration() || fOutputs.empty()) ;
281 this->appendDecls(fOutputs, &this->outputs()); 281 this->appendDecls(fOutputs, &this->outputs());
(...skipping 27 matching lines...) Expand all
309 fMangleString.appendf("_c%d", fSubstageIndices[fSubstageIndices.count() - 2] ); 309 fMangleString.appendf("_c%d", fSubstageIndices[fSubstageIndices.count() - 2] );
310 } 310 }
311 311
312 void GrGLFragmentBuilder::onAfterChildProcEmitCode() { 312 void GrGLFragmentBuilder::onAfterChildProcEmitCode() {
313 SkASSERT(fSubstageIndices.count() >= 2); 313 SkASSERT(fSubstageIndices.count() >= 2);
314 fSubstageIndices.pop_back(); 314 fSubstageIndices.pop_back();
315 fSubstageIndices.back()++; 315 fSubstageIndices.back()++;
316 int removeAt = fMangleString.findLastOf('_'); 316 int removeAt = fMangleString.findLastOf('_');
317 fMangleString.remove(removeAt, fMangleString.size() - removeAt); 317 fMangleString.remove(removeAt, fMangleString.size() - removeAt);
318 } 318 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLGpu.cpp ('k') | src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698