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

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

Issue 1403373012: Make appending default precision be controled by GLSL (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 1 month 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/GrGLGLSL.cpp ('k') | src/gpu/gl/builders/GrGLFragmentShaderBuilder.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 8
9 #include "GrGLGpu.h" 9 #include "GrGLGpu.h"
10 #include "GrGLGLSL.h" 10 #include "GrGLGLSL.h"
11 #include "GrGLStencilAttachment.h" 11 #include "GrGLStencilAttachment.h"
12 #include "GrGLTextureRenderTarget.h" 12 #include "GrGLTextureRenderTarget.h"
13 #include "GrGpuResourcePriv.h" 13 #include "GrGpuResourcePriv.h"
14 #include "GrPipeline.h" 14 #include "GrPipeline.h"
15 #include "GrRenderTargetPriv.h" 15 #include "GrRenderTargetPriv.h"
16 #include "GrSurfacePriv.h" 16 #include "GrSurfacePriv.h"
17 #include "GrTexturePriv.h" 17 #include "GrTexturePriv.h"
18 #include "GrTypes.h" 18 #include "GrTypes.h"
19 #include "GrVertices.h" 19 #include "GrVertices.h"
20 #include "builders/GrGLShaderStringBuilder.h" 20 #include "builders/GrGLShaderStringBuilder.h"
21 #include "glsl/GrGLSL.h"
21 #include "glsl/GrGLSLCaps.h" 22 #include "glsl/GrGLSLCaps.h"
22 #include "SkStrokeRec.h" 23 #include "SkStrokeRec.h"
23 #include "SkTemplates.h" 24 #include "SkTemplates.h"
24 25
25 #define GL_CALL(X) GR_GL_CALL(this->glInterface(), X) 26 #define GL_CALL(X) GR_GL_CALL(this->glInterface(), X)
26 #define GL_CALL_RET(RET, X) GR_GL_CALL_RET(this->glInterface(), RET, X) 27 #define GL_CALL_RET(RET, X) GR_GL_CALL_RET(this->glInterface(), RET, X)
27 28
28 #define SKIP_CACHE_CHECK true 29 #define SKIP_CACHE_CHECK true
29 30
30 #if GR_GL_CHECK_ALLOC_WITH_GET_ERROR 31 #if GR_GL_CHECK_ALLOC_WITH_GET_ERROR
(...skipping 2914 matching lines...) Expand 10 before | Expand all | Expand 10 after
2945 vshaderTxt.append( 2946 vshaderTxt.append(
2946 "// Copy Program VS\n" 2947 "// Copy Program VS\n"
2947 "void main() {" 2948 "void main() {"
2948 " v_texCoord = a_vertex.xy * u_texCoordXform.xy + u_texCoordXform.zw;" 2949 " v_texCoord = a_vertex.xy * u_texCoordXform.xy + u_texCoordXform.zw;"
2949 " gl_Position.xy = a_vertex * u_posXform.xy + u_posXform.zw;" 2950 " gl_Position.xy = a_vertex * u_posXform.xy + u_posXform.zw;"
2950 " gl_Position.zw = vec2(0, 1);" 2951 " gl_Position.zw = vec2(0, 1);"
2951 "}" 2952 "}"
2952 ); 2953 );
2953 2954
2954 SkString fshaderTxt(version); 2955 SkString fshaderTxt(version);
2955 GrGLAppendGLSLDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision, this- >glStandard(), 2956 GrGLSLAppendDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision,
2956 &fshaderTxt); 2957 *this->glCaps().glslCaps(),
2958 &fshaderTxt);
2957 vTexCoord.setTypeModifier(GrShaderVar::kVaryingIn_TypeModifier); 2959 vTexCoord.setTypeModifier(GrShaderVar::kVaryingIn_TypeModifier);
2958 vTexCoord.appendDecl(this->glCaps().glslCaps(), &fshaderTxt); 2960 vTexCoord.appendDecl(this->glCaps().glslCaps(), &fshaderTxt);
2959 fshaderTxt.append(";"); 2961 fshaderTxt.append(";");
2960 uTexture.appendDecl(this->glCaps().glslCaps(), &fshaderTxt); 2962 uTexture.appendDecl(this->glCaps().glslCaps(), &fshaderTxt);
2961 fshaderTxt.append(";"); 2963 fshaderTxt.append(";");
2962 const char* fsOutName; 2964 const char* fsOutName;
2963 if (this->glCaps().glslCaps()->mustDeclareFragmentShaderOutput()) { 2965 if (this->glCaps().glslCaps()->mustDeclareFragmentShaderOutput()) {
2964 oFragColor.appendDecl(this->glCaps().glslCaps(), &fshaderTxt); 2966 oFragColor.appendDecl(this->glCaps().glslCaps(), &fshaderTxt);
2965 fshaderTxt.append(";"); 2967 fshaderTxt.append(";");
2966 fsOutName = oFragColor.c_str(); 2968 fsOutName = oFragColor.c_str();
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
3295 this->setVertexArrayID(gpu, 0); 3297 this->setVertexArrayID(gpu, 0);
3296 } 3298 }
3297 int attrCount = gpu->glCaps().maxVertexAttributes(); 3299 int attrCount = gpu->glCaps().maxVertexAttributes();
3298 if (fDefaultVertexArrayAttribState.count() != attrCount) { 3300 if (fDefaultVertexArrayAttribState.count() != attrCount) {
3299 fDefaultVertexArrayAttribState.resize(attrCount); 3301 fDefaultVertexArrayAttribState.resize(attrCount);
3300 } 3302 }
3301 attribState = &fDefaultVertexArrayAttribState; 3303 attribState = &fDefaultVertexArrayAttribState;
3302 } 3304 }
3303 return attribState; 3305 return attribState;
3304 } 3306 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLGLSL.cpp ('k') | src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698