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/gl/GrGLShaderBuilder.cpp

Issue 25846002: Use vertexless shaders when NVpr is available (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix mac build Created 7 years, 2 months 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 | Annotate | Revision Log
« no previous file with comments | « src/gpu/gl/GrGLShaderBuilder.h ('k') | src/gpu/gl/GrGpuGL.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 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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 434
435 this->fFSCode.prependf("\tvec4 %s = vec4(gl_FragCoord.x, %s - gl_Fra gCoord.y, gl_FragCoord.zw);\n", 435 this->fFSCode.prependf("\tvec4 %s = vec4(gl_FragCoord.x, %s - gl_Fra gCoord.y, gl_FragCoord.zw);\n",
436 kCoordName, rtHeightName); 436 kCoordName, rtHeightName);
437 fSetupFragPosition = true; 437 fSetupFragPosition = true;
438 } 438 }
439 SkASSERT(fRTHeightUniform.isValid()); 439 SkASSERT(fRTHeightUniform.isValid());
440 return kCoordName; 440 return kCoordName;
441 } 441 }
442 } 442 }
443 443
444
445 void GrGLShaderBuilder::fsEmitFunction(GrSLType returnType, 444 void GrGLShaderBuilder::fsEmitFunction(GrSLType returnType,
446 const char* name, 445 const char* name,
447 int argCnt, 446 int argCnt,
448 const GrGLShaderVar* args, 447 const GrGLShaderVar* args,
449 const char* body, 448 const char* body,
450 SkString* outName) { 449 SkString* outName) {
451 fFSFunctions.append(GrGLSLTypeString(returnType)); 450 fFSFunctions.append(GrGLSLTypeString(returnType));
452 this->nameVariable(outName, '\0', name); 451 this->nameVariable(outName, '\0', name);
453 fFSFunctions.appendf(" %s", outName->c_str()); 452 fFSFunctions.appendf(" %s", outName->c_str());
454 fFSFunctions.append("("); 453 fFSFunctions.append("(");
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 GL_CALL(BindAttribLocation(programId, 912 GL_CALL(BindAttribLocation(programId,
914 header.fCoverageAttributeIndex, 913 header.fCoverageAttributeIndex,
915 coverage_attribute_name())); 914 coverage_attribute_name()));
916 } 915 }
917 916
918 const AttributePair* attribEnd = fEffectAttributes.end(); 917 const AttributePair* attribEnd = fEffectAttributes.end();
919 for (const AttributePair* attrib = fEffectAttributes.begin(); attrib != attr ibEnd; ++attrib) { 918 for (const AttributePair* attrib = fEffectAttributes.begin(); attrib != attr ibEnd; ++attrib) {
920 GL_CALL(BindAttribLocation(programId, attrib->fIndex, attrib->fName.c_s tr())); 919 GL_CALL(BindAttribLocation(programId, attrib->fIndex, attrib->fName.c_s tr()));
921 } 920 }
922 } 921 }
922
923 ////////////////////////////////////////////////////////////////////////////////
924
925 GrGLFragmentOnlyShaderBuilder::GrGLFragmentOnlyShaderBuilder(GrGpuGL* gpu,
926 GrGLUniformManager& uniformManager,
927 const GrGLProgramDe sc& desc)
928 : INHERITED(gpu, uniformManager, desc)
929 , fNumTexCoordSets(0) {
930
931 SkASSERT(!desc.getHeader().fHasVertexCode);
932 SkASSERT(gpu->glCaps().fixedFunctionSupport());
933 SkASSERT(gpu->glCaps().pathStencilingSupport());
934 SkASSERT(GrGLProgramDesc::kAttribute_ColorInput != desc.getHeader().fColorIn put);
935 SkASSERT(GrGLProgramDesc::kAttribute_ColorInput != desc.getHeader().fCoverag eInput);
936 }
937
938 GrGLProgramEffects* GrGLFragmentOnlyShaderBuilder::createAndEmitEffects(
939 const GrEffectStage* effectStages[],
940 const EffectKey effectKeys[],
941 int effectCnt,
942 SkString* inOutFSColor,
943 GrSLConstantVec* fsInOutColorKnownValue) {
944
945 GrGLTexGenProgramEffectsBuilder texGenEffectsBuilder(this, effectCnt);
946 this->INHERITED::createAndEmitEffects(&texGenEffectsBuilder,
947 effectStages,
948 effectKeys,
949 effectCnt,
950 inOutFSColor,
951 fsInOutColorKnownValue);
952 return texGenEffectsBuilder.finish();
953 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLShaderBuilder.h ('k') | src/gpu/gl/GrGpuGL.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698