| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "gl/GrGLShaderBuilder.h" | 8 #include "gl/GrGLShaderBuilder.h" |
| 9 #include "gl/GrGLProgram.h" | 9 #include "gl/GrGLProgram.h" |
| 10 #include "gl/GrGLUniformHandle.h" | 10 #include "gl/GrGLUniformHandle.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 const GrGLShaderBuilder::TextureSamp
ler& sampler, | 151 const GrGLShaderBuilder::TextureSamp
ler& sampler, |
| 152 const char* coordName, | 152 const char* coordName, |
| 153 GrSLType varyingType) const { | 153 GrSLType varyingType) const { |
| 154 GrAssert(NULL != sampler.textureAccess()); | 154 GrAssert(NULL != sampler.textureAccess()); |
| 155 GrAssert(NULL != coordName); | 155 GrAssert(NULL != coordName); |
| 156 | 156 |
| 157 out->appendf("%s(%s, %s)", | 157 out->appendf("%s(%s, %s)", |
| 158 sample_function_name(varyingType, fCtxInfo.glslGeneration()), | 158 sample_function_name(varyingType, fCtxInfo.glslGeneration()), |
| 159 this->getUniformCStr(sampler.fSamplerUniform), | 159 this->getUniformCStr(sampler.fSamplerUniform), |
| 160 coordName); | 160 coordName); |
| 161 append_swizzle(out, *sampler.textureAccess(), fCtxInfo.caps()); | 161 append_swizzle(out, *sampler.textureAccess(), *fCtxInfo.caps()); |
| 162 } | 162 } |
| 163 | 163 |
| 164 void GrGLShaderBuilder::appendTextureLookup(ShaderType type, | 164 void GrGLShaderBuilder::appendTextureLookup(ShaderType type, |
| 165 const GrGLShaderBuilder::TextureSamp
ler& sampler, | 165 const GrGLShaderBuilder::TextureSamp
ler& sampler, |
| 166 const char* coordName, | 166 const char* coordName, |
| 167 GrSLType varyingType) { | 167 GrSLType varyingType) { |
| 168 GrAssert(kFragment_ShaderType == type); | 168 GrAssert(kFragment_ShaderType == type); |
| 169 this->appendTextureLookup(&fFSCode, sampler, coordName, varyingType); | 169 this->appendTextureLookup(&fFSCode, sampler, coordName, varyingType); |
| 170 } | 170 } |
| 171 | 171 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 fFSInputs.back().setType(type); | 325 fFSInputs.back().setType(type); |
| 326 fFSInputs.back().setTypeModifier(GrGLShaderVar::kIn_TypeModifier); | 326 fFSInputs.back().setTypeModifier(GrGLShaderVar::kIn_TypeModifier); |
| 327 fFSInputs.back().setName(*fsName); | 327 fFSInputs.back().setName(*fsName); |
| 328 if (fsInName) { | 328 if (fsInName) { |
| 329 *fsInName = fsName->c_str(); | 329 *fsInName = fsName->c_str(); |
| 330 } | 330 } |
| 331 } | 331 } |
| 332 | 332 |
| 333 const char* GrGLShaderBuilder::fragmentPosition() { | 333 const char* GrGLShaderBuilder::fragmentPosition() { |
| 334 #if 1 | 334 #if 1 |
| 335 if (fCtxInfo.caps().fragCoordConventionsSupport()) { | 335 if (fCtxInfo.caps()->fragCoordConventionsSupport()) { |
| 336 if (!fSetupFragPosition) { | 336 if (!fSetupFragPosition) { |
| 337 if (fCtxInfo.glslGeneration() < k150_GrGLSLGeneration) { | 337 if (fCtxInfo.glslGeneration() < k150_GrGLSLGeneration) { |
| 338 fFSHeader.append("#extension GL_ARB_fragment_coord_conventions:
require\n"); | 338 fFSHeader.append("#extension GL_ARB_fragment_coord_conventions:
require\n"); |
| 339 } | 339 } |
| 340 fFSInputs.push_back().set(kVec4f_GrSLType, | 340 fFSInputs.push_back().set(kVec4f_GrSLType, |
| 341 GrGLShaderVar::kIn_TypeModifier, | 341 GrGLShaderVar::kIn_TypeModifier, |
| 342 "gl_FragCoord", | 342 "gl_FragCoord", |
| 343 GrGLShaderVar::kDefault_Precision, | 343 GrGLShaderVar::kDefault_Precision, |
| 344 GrGLShaderVar::kUpperLeft_Origin); | 344 GrGLShaderVar::kUpperLeft_Origin); |
| 345 fSetupFragPosition = true; | 345 fSetupFragPosition = true; |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 for (const AttributePair* attrib = this->getEffectAttributes().begin(); | 552 for (const AttributePair* attrib = this->getEffectAttributes().begin(); |
| 553 attrib != attribEnd; | 553 attrib != attribEnd; |
| 554 ++attrib) { | 554 ++attrib) { |
| 555 if (attrib->fIndex == attributeIndex) { | 555 if (attrib->fIndex == attributeIndex) { |
| 556 return &attrib->fName; | 556 return &attrib->fName; |
| 557 } | 557 } |
| 558 } | 558 } |
| 559 | 559 |
| 560 return NULL; | 560 return NULL; |
| 561 } | 561 } |
| OLD | NEW |