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

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

Issue 2387643003: Revert of Turned on SkSL->GLSL compiler (Closed)
Patch Set: Created 4 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
« 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 3772 matching lines...) Expand 10 before | Expand all | Expand 10 after
3783 fshaderTxt.appendf("#extension %s : require\n", 3783 fshaderTxt.appendf("#extension %s : require\n",
3784 glslCaps->externalTextureExtensionString()); 3784 glslCaps->externalTextureExtensionString());
3785 } 3785 }
3786 GrGLSLAppendDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision, *glslCa ps, 3786 GrGLSLAppendDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision, *glslCa ps,
3787 &fshaderTxt); 3787 &fshaderTxt);
3788 vTexCoord.setTypeModifier(GrShaderVar::kVaryingIn_TypeModifier); 3788 vTexCoord.setTypeModifier(GrShaderVar::kVaryingIn_TypeModifier);
3789 vTexCoord.appendDecl(glslCaps, &fshaderTxt); 3789 vTexCoord.appendDecl(glslCaps, &fshaderTxt);
3790 fshaderTxt.append(";"); 3790 fshaderTxt.append(";");
3791 uTexture.appendDecl(glslCaps, &fshaderTxt); 3791 uTexture.appendDecl(glslCaps, &fshaderTxt);
3792 fshaderTxt.append(";"); 3792 fshaderTxt.append(";");
3793 const char* fsOutName;
3794 if (glslCaps->mustDeclareFragmentShaderOutput()) {
3795 oFragColor.appendDecl(glslCaps, &fshaderTxt);
3796 fshaderTxt.append(";");
3797 fsOutName = oFragColor.c_str();
3798 } else {
3799 fsOutName = "gl_FragColor";
3800 }
3793 fshaderTxt.appendf( 3801 fshaderTxt.appendf(
3794 "// Copy Program FS\n" 3802 "// Copy Program FS\n"
3795 "void main() {" 3803 "void main() {"
3796 " sk_FragColor = %s(u_texture, v_texCoord);" 3804 " %s = %s(u_texture, v_texCoord);"
3797 "}", 3805 "}",
3806 fsOutName,
3798 GrGLSLTexture2DFunctionName(kVec2f_GrSLType, kSamplerTypes[progIdx], thi s->glslGeneration()) 3807 GrGLSLTexture2DFunctionName(kVec2f_GrSLType, kSamplerTypes[progIdx], thi s->glslGeneration())
3799 ); 3808 );
3800 3809
3801 const char* str; 3810 const char* str;
3802 GrGLint length; 3811 GrGLint length;
3803 3812
3804 str = vshaderTxt.c_str(); 3813 str = vshaderTxt.c_str();
3805 length = SkToInt(vshaderTxt.size()); 3814 length = SkToInt(vshaderTxt.size());
3806 GrGLuint vshader = GrGLCompileAndAttachShader(*fGLContext, fCopyPrograms[pro gIdx].fProgram, 3815 GrGLuint vshader = GrGLCompileAndAttachShader(*fGLContext, fCopyPrograms[pro gIdx].fProgram,
3807 GR_GL_VERTEX_SHADER, &str, &le ngth, 1, 3816 GR_GL_VERTEX_SHADER, &str, &le ngth, 1,
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
3920 } 3929 }
3921 GrGLSLAppendDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision, *glslCa ps, 3930 GrGLSLAppendDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision, *glslCa ps,
3922 &fshaderTxt); 3931 &fshaderTxt);
3923 for (int i = 0; i < numTaps; ++i) { 3932 for (int i = 0; i < numTaps; ++i) {
3924 vTexCoords[i].setTypeModifier(GrShaderVar::kVaryingIn_TypeModifier); 3933 vTexCoords[i].setTypeModifier(GrShaderVar::kVaryingIn_TypeModifier);
3925 vTexCoords[i].appendDecl(glslCaps, &fshaderTxt); 3934 vTexCoords[i].appendDecl(glslCaps, &fshaderTxt);
3926 fshaderTxt.append(";"); 3935 fshaderTxt.append(";");
3927 } 3936 }
3928 uTexture.appendDecl(glslCaps, &fshaderTxt); 3937 uTexture.appendDecl(glslCaps, &fshaderTxt);
3929 fshaderTxt.append(";"); 3938 fshaderTxt.append(";");
3939 const char* fsOutName;
3940 if (glslCaps->mustDeclareFragmentShaderOutput()) {
3941 oFragColor.appendDecl(glslCaps, &fshaderTxt);
3942 fshaderTxt.append(";");
3943 fsOutName = oFragColor.c_str();
3944 } else {
3945 fsOutName = "gl_FragColor";
3946 }
3930 const char* sampleFunction = GrGLSLTexture2DFunctionName(kVec2f_GrSLType, 3947 const char* sampleFunction = GrGLSLTexture2DFunctionName(kVec2f_GrSLType,
3931 kTexture2DSampler_G rSLType, 3948 kTexture2DSampler_G rSLType,
3932 this->glslGeneratio n()); 3949 this->glslGeneratio n());
3933 fshaderTxt.append( 3950 fshaderTxt.append(
3934 "// Mipmap Program FS\n" 3951 "// Mipmap Program FS\n"
3935 "void main() {" 3952 "void main() {"
3936 ); 3953 );
3937 3954
3938 if (oddWidth && oddHeight) { 3955 if (oddWidth && oddHeight) {
3939 fshaderTxt.appendf( 3956 fshaderTxt.appendf(
3940 " sk_FragColor = (%s(u_texture, v_texCoord0) + %s(u_texture, v_texC oord1) + " 3957 " %s = (%s(u_texture, v_texCoord0) + %s(u_texture, v_texCoord1) + "
3941 " %s(u_texture, v_texCoord2) + %s(u_texture, v_texC oord3)) * 0.25;", 3958 " %s(u_texture, v_texCoord2) + %s(u_texture, v_texCoord3)) * 0.25;",
3942 sampleFunction, sampleFunction, sampleFunction, sampleFunction 3959 fsOutName, sampleFunction, sampleFunction, sampleFunction, sampleFun ction
3943 ); 3960 );
3944 } else if (oddWidth || oddHeight) { 3961 } else if (oddWidth || oddHeight) {
3945 fshaderTxt.appendf( 3962 fshaderTxt.appendf(
3946 " sk_FragColor = (%s(u_texture, v_texCoord0) + %s(u_texture, v_texC oord1)) * 0.5;", 3963 " %s = (%s(u_texture, v_texCoord0) + %s(u_texture, v_texCoord1)) * 0.5;",
3947 sampleFunction, sampleFunction 3964 fsOutName, sampleFunction, sampleFunction
3948 ); 3965 );
3949 } else { 3966 } else {
3950 fshaderTxt.appendf( 3967 fshaderTxt.appendf(
3951 " sk_FragColor = %s(u_texture, v_texCoord0);", 3968 " %s = %s(u_texture, v_texCoord0);",
3952 sampleFunction 3969 fsOutName, sampleFunction
3953 ); 3970 );
3954 } 3971 }
3955 3972
3956 fshaderTxt.append("}"); 3973 fshaderTxt.append("}");
3957 3974
3958 const char* str; 3975 const char* str;
3959 GrGLint length; 3976 GrGLint length;
3960 3977
3961 str = vshaderTxt.c_str(); 3978 str = vshaderTxt.c_str();
3962 length = SkToInt(vshaderTxt.size()); 3979 length = SkToInt(vshaderTxt.size());
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
4029 ); 4046 );
4030 4047
4031 GrGLSLShaderVar oFragColor("o_FragColor", kVec4f_GrSLType, GrShaderVar::kOut _TypeModifier); 4048 GrGLSLShaderVar oFragColor("o_FragColor", kVec4f_GrSLType, GrShaderVar::kOut _TypeModifier);
4032 4049
4033 SkString fshaderTxt(version); 4050 SkString fshaderTxt(version);
4034 GrGLSLAppendDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision, 4051 GrGLSLAppendDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision,
4035 *this->glCaps().glslCaps(), 4052 *this->glCaps().glslCaps(),
4036 &fshaderTxt); 4053 &fshaderTxt);
4037 uColor.appendDecl(this->glCaps().glslCaps(), &fshaderTxt); 4054 uColor.appendDecl(this->glCaps().glslCaps(), &fshaderTxt);
4038 fshaderTxt.append(";"); 4055 fshaderTxt.append(";");
4056 const char* fsOutName;
4057 if (this->glCaps().glslCaps()->mustDeclareFragmentShaderOutput()) {
4058 oFragColor.appendDecl(this->glCaps().glslCaps(), &fshaderTxt);
4059 fshaderTxt.append(";");
4060 fsOutName = oFragColor.c_str();
4061 } else {
4062 fsOutName = "gl_FragColor";
4063 }
4039 fshaderTxt.appendf( 4064 fshaderTxt.appendf(
4040 "// Write Rect Program FS\n" 4065 "// Write Rect Program FS\n"
4041 "void main() {" 4066 "void main() {"
4042 " sk_FragColor = %s;" 4067 " %s = %s;"
4043 "}", 4068 "}",
4069 fsOutName,
4044 uColor.c_str() 4070 uColor.c_str()
4045 ); 4071 );
4046 4072
4047 const char* str; 4073 const char* str;
4048 GrGLint length; 4074 GrGLint length;
4049 4075
4050 str = vshaderTxt.c_str(); 4076 str = vshaderTxt.c_str();
4051 length = SkToInt(vshaderTxt.size()); 4077 length = SkToInt(vshaderTxt.size());
4052 GrGLuint vshader = GrGLCompileAndAttachShader(*fGLContext, fWireRectProgram. fProgram, 4078 GrGLuint vshader = GrGLCompileAndAttachShader(*fGLContext, fWireRectProgram. fProgram,
4053 GR_GL_VERTEX_SHADER, &str, &le ngth, 1, 4079 GR_GL_VERTEX_SHADER, &str, &le ngth, 1,
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
4661 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || 4687 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() ||
4662 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { 4688 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) {
4663 copyParams->fFilter = GrTextureParams::kNone_FilterMode; 4689 copyParams->fFilter = GrTextureParams::kNone_FilterMode;
4664 copyParams->fWidth = texture->width(); 4690 copyParams->fWidth = texture->width();
4665 copyParams->fHeight = texture->height(); 4691 copyParams->fHeight = texture->height();
4666 return true; 4692 return true;
4667 } 4693 }
4668 } 4694 }
4669 return false; 4695 return false;
4670 } 4696 }
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