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

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

Issue 2337553002: Revert of Turned on SkSL->GLSL compiler (Closed)
Patch Set: Created 4 years, 3 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 | « src/gpu/gl/GrGLContext.cpp ('k') | src/gpu/gl/builders/GrGLShaderStringBuilder.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 2011 Google Inc. 2 * Copyright 2011 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 "GrGLGpu.h" 8 #include "GrGLGpu.h"
9 #include "GrGLBuffer.h" 9 #include "GrGLBuffer.h"
10 #include "GrGLGLSL.h" 10 #include "GrGLGLSL.h"
(...skipping 3757 matching lines...) Expand 10 before | Expand all | Expand 10 after
3768 fshaderTxt.appendf("#extension %s : require\n", 3768 fshaderTxt.appendf("#extension %s : require\n",
3769 glslCaps->externalTextureExtensionString()); 3769 glslCaps->externalTextureExtensionString());
3770 } 3770 }
3771 GrGLSLAppendDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision, *glslCa ps, 3771 GrGLSLAppendDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision, *glslCa ps,
3772 &fshaderTxt); 3772 &fshaderTxt);
3773 vTexCoord.setTypeModifier(GrShaderVar::kVaryingIn_TypeModifier); 3773 vTexCoord.setTypeModifier(GrShaderVar::kVaryingIn_TypeModifier);
3774 vTexCoord.appendDecl(glslCaps, &fshaderTxt); 3774 vTexCoord.appendDecl(glslCaps, &fshaderTxt);
3775 fshaderTxt.append(";"); 3775 fshaderTxt.append(";");
3776 uTexture.appendDecl(glslCaps, &fshaderTxt); 3776 uTexture.appendDecl(glslCaps, &fshaderTxt);
3777 fshaderTxt.append(";"); 3777 fshaderTxt.append(";");
3778 const char* fsOutName;
3779 if (glslCaps->mustDeclareFragmentShaderOutput()) {
3780 oFragColor.appendDecl(glslCaps, &fshaderTxt);
3781 fshaderTxt.append(";");
3782 fsOutName = oFragColor.c_str();
3783 } else {
3784 fsOutName = "gl_FragColor";
3785 }
3778 fshaderTxt.appendf( 3786 fshaderTxt.appendf(
3779 "// Copy Program FS\n" 3787 "// Copy Program FS\n"
3780 "void main() {" 3788 "void main() {"
3781 " sk_FragColor = %s(u_texture, v_texCoord);" 3789 " %s = %s(u_texture, v_texCoord);"
3782 "}", 3790 "}",
3791 fsOutName,
3783 GrGLSLTexture2DFunctionName(kVec2f_GrSLType, kSamplerTypes[progIdx], thi s->glslGeneration()) 3792 GrGLSLTexture2DFunctionName(kVec2f_GrSLType, kSamplerTypes[progIdx], thi s->glslGeneration())
3784 ); 3793 );
3785 3794
3786 const char* str; 3795 const char* str;
3787 GrGLint length; 3796 GrGLint length;
3788 3797
3789 str = vshaderTxt.c_str(); 3798 str = vshaderTxt.c_str();
3790 length = SkToInt(vshaderTxt.size()); 3799 length = SkToInt(vshaderTxt.size());
3791 GrGLuint vshader = GrGLCompileAndAttachShader(*fGLContext, fCopyPrograms[pro gIdx].fProgram, 3800 GrGLuint vshader = GrGLCompileAndAttachShader(*fGLContext, fCopyPrograms[pro gIdx].fProgram,
3792 GR_GL_VERTEX_SHADER, &str, &le ngth, 1, 3801 GR_GL_VERTEX_SHADER, &str, &le ngth, 1,
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
3905 } 3914 }
3906 GrGLSLAppendDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision, *glslCa ps, 3915 GrGLSLAppendDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision, *glslCa ps,
3907 &fshaderTxt); 3916 &fshaderTxt);
3908 for (int i = 0; i < numTaps; ++i) { 3917 for (int i = 0; i < numTaps; ++i) {
3909 vTexCoords[i].setTypeModifier(GrShaderVar::kVaryingIn_TypeModifier); 3918 vTexCoords[i].setTypeModifier(GrShaderVar::kVaryingIn_TypeModifier);
3910 vTexCoords[i].appendDecl(glslCaps, &fshaderTxt); 3919 vTexCoords[i].appendDecl(glslCaps, &fshaderTxt);
3911 fshaderTxt.append(";"); 3920 fshaderTxt.append(";");
3912 } 3921 }
3913 uTexture.appendDecl(glslCaps, &fshaderTxt); 3922 uTexture.appendDecl(glslCaps, &fshaderTxt);
3914 fshaderTxt.append(";"); 3923 fshaderTxt.append(";");
3924 const char* fsOutName;
3925 if (glslCaps->mustDeclareFragmentShaderOutput()) {
3926 oFragColor.appendDecl(glslCaps, &fshaderTxt);
3927 fshaderTxt.append(";");
3928 fsOutName = oFragColor.c_str();
3929 } else {
3930 fsOutName = "gl_FragColor";
3931 }
3915 const char* sampleFunction = GrGLSLTexture2DFunctionName(kVec2f_GrSLType, 3932 const char* sampleFunction = GrGLSLTexture2DFunctionName(kVec2f_GrSLType,
3916 kTexture2DSampler_G rSLType, 3933 kTexture2DSampler_G rSLType,
3917 this->glslGeneratio n()); 3934 this->glslGeneratio n());
3918 fshaderTxt.append( 3935 fshaderTxt.append(
3919 "// Mipmap Program FS\n" 3936 "// Mipmap Program FS\n"
3920 "void main() {" 3937 "void main() {"
3921 ); 3938 );
3922 3939
3923 if (oddWidth && oddHeight) { 3940 if (oddWidth && oddHeight) {
3924 fshaderTxt.appendf( 3941 fshaderTxt.appendf(
3925 " sk_FragColor = (%s(u_texture, v_texCoord0) + %s(u_texture, v_texC oord1) + " 3942 " %s = (%s(u_texture, v_texCoord0) + %s(u_texture, v_texCoord1) + "
3926 " %s(u_texture, v_texCoord2) + %s(u_texture, v_texC oord3)) * 0.25;", 3943 " %s(u_texture, v_texCoord2) + %s(u_texture, v_texCoord3)) * 0.25;",
3927 sampleFunction, sampleFunction, sampleFunction, sampleFunction 3944 fsOutName, sampleFunction, sampleFunction, sampleFunction, sampleFun ction
3928 ); 3945 );
3929 } else if (oddWidth || oddHeight) { 3946 } else if (oddWidth || oddHeight) {
3930 fshaderTxt.appendf( 3947 fshaderTxt.appendf(
3931 " sk_FragColor = (%s(u_texture, v_texCoord0) + %s(u_texture, v_texC oord1)) * 0.5;", 3948 " %s = (%s(u_texture, v_texCoord0) + %s(u_texture, v_texCoord1)) * 0.5;",
3932 sampleFunction, sampleFunction 3949 fsOutName, sampleFunction, sampleFunction
3933 ); 3950 );
3934 } else { 3951 } else {
3935 fshaderTxt.appendf( 3952 fshaderTxt.appendf(
3936 " sk_FragColor = %s(u_texture, v_texCoord0);", 3953 " %s = %s(u_texture, v_texCoord0);",
3937 sampleFunction 3954 fsOutName, sampleFunction
3938 ); 3955 );
3939 } 3956 }
3940 3957
3941 fshaderTxt.append("}"); 3958 fshaderTxt.append("}");
3942 3959
3943 const char* str; 3960 const char* str;
3944 GrGLint length; 3961 GrGLint length;
3945 3962
3946 str = vshaderTxt.c_str(); 3963 str = vshaderTxt.c_str();
3947 length = SkToInt(vshaderTxt.size()); 3964 length = SkToInt(vshaderTxt.size());
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
4014 ); 4031 );
4015 4032
4016 GrGLSLShaderVar oFragColor("o_FragColor", kVec4f_GrSLType, GrShaderVar::kOut _TypeModifier); 4033 GrGLSLShaderVar oFragColor("o_FragColor", kVec4f_GrSLType, GrShaderVar::kOut _TypeModifier);
4017 4034
4018 SkString fshaderTxt(version); 4035 SkString fshaderTxt(version);
4019 GrGLSLAppendDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision, 4036 GrGLSLAppendDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision,
4020 *this->glCaps().glslCaps(), 4037 *this->glCaps().glslCaps(),
4021 &fshaderTxt); 4038 &fshaderTxt);
4022 uColor.appendDecl(this->glCaps().glslCaps(), &fshaderTxt); 4039 uColor.appendDecl(this->glCaps().glslCaps(), &fshaderTxt);
4023 fshaderTxt.append(";"); 4040 fshaderTxt.append(";");
4041 const char* fsOutName;
4042 if (this->glCaps().glslCaps()->mustDeclareFragmentShaderOutput()) {
4043 oFragColor.appendDecl(this->glCaps().glslCaps(), &fshaderTxt);
4044 fshaderTxt.append(";");
4045 fsOutName = oFragColor.c_str();
4046 } else {
4047 fsOutName = "gl_FragColor";
4048 }
4024 fshaderTxt.appendf( 4049 fshaderTxt.appendf(
4025 "// Write Rect Program FS\n" 4050 "// Write Rect Program FS\n"
4026 "void main() {" 4051 "void main() {"
4027 " sk_FragColor = %s;" 4052 " %s = %s;"
4028 "}", 4053 "}",
4054 fsOutName,
4029 uColor.c_str() 4055 uColor.c_str()
4030 ); 4056 );
4031 4057
4032 const char* str; 4058 const char* str;
4033 GrGLint length; 4059 GrGLint length;
4034 4060
4035 str = vshaderTxt.c_str(); 4061 str = vshaderTxt.c_str();
4036 length = SkToInt(vshaderTxt.size()); 4062 length = SkToInt(vshaderTxt.size());
4037 GrGLuint vshader = GrGLCompileAndAttachShader(*fGLContext, fWireRectProgram. fProgram, 4063 GrGLuint vshader = GrGLCompileAndAttachShader(*fGLContext, fWireRectProgram. fProgram,
4038 GR_GL_VERTEX_SHADER, &str, &le ngth, 1, 4064 GR_GL_VERTEX_SHADER, &str, &le ngth, 1,
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
4646 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || 4672 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() ||
4647 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { 4673 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) {
4648 copyParams->fFilter = GrTextureParams::kNone_FilterMode; 4674 copyParams->fFilter = GrTextureParams::kNone_FilterMode;
4649 copyParams->fWidth = texture->width(); 4675 copyParams->fWidth = texture->width();
4650 copyParams->fHeight = texture->height(); 4676 copyParams->fHeight = texture->height();
4651 return true; 4677 return true;
4652 } 4678 }
4653 } 4679 }
4654 return false; 4680 return false;
4655 } 4681 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLContext.cpp ('k') | src/gpu/gl/builders/GrGLShaderStringBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698