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

Side by Side Diff: src/gpu/gl/GrGLShaderBuilder.cpp

Issue 277323002: Make GrGLConfigConversionEffect work for Imagination and some other GPUs. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Only affect PowerVR Rogue Hood Created 6 years, 6 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
« no previous file with comments | « no previous file | src/gpu/gl/GrGLUtil.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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 SkASSERT(NULL != effectStages[e] && NULL != effectStages[e]->getEffect() ); 522 SkASSERT(NULL != effectStages[e] && NULL != effectStages[e]->getEffect() );
523 const GrEffectStage& stage = *effectStages[e]; 523 const GrEffectStage& stage = *effectStages[e];
524 524
525 CodeStage::AutoStageRestore csar(&fCodeStage, &stage); 525 CodeStage::AutoStageRestore csar(&fCodeStage, &stage);
526 526
527 if (inColor.isZeros()) { 527 if (inColor.isZeros()) {
528 SkString inColorName; 528 SkString inColorName;
529 529
530 // Effects have no way to communicate zeros, they treat an empty str ing as ones. 530 // Effects have no way to communicate zeros, they treat an empty str ing as ones.
531 this->nameVariable(&inColorName, '\0', "input"); 531 this->nameVariable(&inColorName, '\0', "input");
532 this->fsCodeAppendf("\tvec4 %s = %s;\n", inColorName.c_str(), inColo r.c_str()); 532 this->fsCodeAppendf("\tvec4 %s = %s;\n", inColorName.c_str(), inColo r.c_str());
changjun.yang 2014/06/10 11:41:16 Sorry I am not quite familiar with the shader.. On
bsalomon 2014/06/10 13:22:18 Question: Is this the variable that needs to be hi
changjun.yang 2014/06/11 08:56:56 Yes, it's the var that would make the conversion w
533 inColor = inColorName; 533 inColor = inColorName;
534 } 534 }
535 535
536 // create var to hold stage result 536 // create var to hold stage result
537 SkString outColorName; 537 SkString outColorName;
538 this->nameVariable(&outColorName, '\0', "output"); 538 this->nameVariable(&outColorName, '\0', "output");
539 this->fsCodeAppendf("\tvec4 %s;\n", outColorName.c_str()); 539 this->fsCodeAppendf("\tvec4 %s;\n", outColorName.c_str());
540 outColor = outColorName; 540 outColor = outColorName;
541 541
542 542
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 // will immediately delete the shader object and free its memory even though it's 686 // will immediately delete the shader object and free its memory even though it's
687 // attached to a program, which then causes glLinkProgram to fail. 687 // attached to a program, which then causes glLinkProgram to fail.
688 GR_GL_CALL(gli, AttachShader(programId, shaderId)); 688 GR_GL_CALL(gli, AttachShader(programId, shaderId));
689 689
690 return shaderId; 690 return shaderId;
691 } 691 }
692 692
693 bool GrGLShaderBuilder::compileAndAttachShaders(GrGLuint programId, SkTDArray<Gr GLuint>* shaderIds) const { 693 bool GrGLShaderBuilder::compileAndAttachShaders(GrGLuint programId, SkTDArray<Gr GLuint>* shaderIds) const {
694 SkString fragShaderSrc(GrGetGLSLVersionDecl(this->ctxInfo())); 694 SkString fragShaderSrc(GrGetGLSLVersionDecl(this->ctxInfo()));
695 fragShaderSrc.append(fFSExtensions); 695 fragShaderSrc.append(fFSExtensions);
696 append_default_precision_qualifier(kDefaultFragmentPrecision, 696
697 fGpu->glStandard(), 697 if (kImagination_GrGLVendor == this->ctxInfo().vendor() &&
698 &fragShaderSrc); 698 kPVRRogueHood_GrGLRenderer == this->ctxInfo().renderer())
699 append_default_precision_qualifier(GrGLShaderVar::kHigh_Precision,
bsalomon 2014/06/09 13:56:45 Can you not just apply highp to the vars emitted b
changjun.yang 2014/06/10 11:41:17 Thanks! Pls see my comments above.
700 fGpu->glStandard(),
701 &fragShaderSrc);
702 else
703 append_default_precision_qualifier(kDefaultFragmentPrecision,
704 fGpu->glStandard(),
705 &fragShaderSrc);
706
699 this->appendUniformDecls(kFragment_Visibility, &fragShaderSrc); 707 this->appendUniformDecls(kFragment_Visibility, &fragShaderSrc);
700 this->appendDecls(fFSInputs, &fragShaderSrc); 708 this->appendDecls(fFSInputs, &fragShaderSrc);
701 // We shouldn't have declared outputs on 1.10 709 // We shouldn't have declared outputs on 1.10
702 SkASSERT(k110_GrGLSLGeneration != fGpu->glslGeneration() || fFSOutputs.empty ()); 710 SkASSERT(k110_GrGLSLGeneration != fGpu->glslGeneration() || fFSOutputs.empty ());
703 this->appendDecls(fFSOutputs, &fragShaderSrc); 711 this->appendDecls(fFSOutputs, &fragShaderSrc);
704 fragShaderSrc.append(fFSFunctions); 712 fragShaderSrc.append(fFSFunctions);
705 fragShaderSrc.append("void main() {\n"); 713 fragShaderSrc.append("void main() {\n");
706 fragShaderSrc.append(fFSCode); 714 fragShaderSrc.append(fFSCode);
707 fragShaderSrc.append("}\n"); 715 fragShaderSrc.append("}\n");
708 716
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 998
991 GrGLPathTexGenProgramEffectsBuilder pathTexGenEffectsBuilder(this, 999 GrGLPathTexGenProgramEffectsBuilder pathTexGenEffectsBuilder(this,
992 effectCnt); 1000 effectCnt);
993 this->INHERITED::createAndEmitEffects(&pathTexGenEffectsBuilder, 1001 this->INHERITED::createAndEmitEffects(&pathTexGenEffectsBuilder,
994 effectStages, 1002 effectStages,
995 effectKeys, 1003 effectKeys,
996 effectCnt, 1004 effectCnt,
997 inOutFSColor); 1005 inOutFSColor);
998 return pathTexGenEffectsBuilder.finish(); 1006 return pathTexGenEffectsBuilder.finish();
999 } 1007 }
OLDNEW
« no previous file with comments | « no previous file | src/gpu/gl/GrGLUtil.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698