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

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

Issue 1202293002: Move GLSL-specific routines/classes to separate glsl directory (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rename GrGLGLSL.{cpp,h} Created 5 years, 5 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/GrGLGLSL.cpp ('k') | src/gpu/gl/GrGLProgram.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 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 "GrGLStencilAttachment.h" 11 #include "GrGLStencilAttachment.h"
11 #include "GrGLTextureRenderTarget.h" 12 #include "GrGLTextureRenderTarget.h"
12 #include "GrGpuResourcePriv.h" 13 #include "GrGpuResourcePriv.h"
13 #include "GrPipeline.h" 14 #include "GrPipeline.h"
14 #include "GrRenderTargetPriv.h" 15 #include "GrRenderTargetPriv.h"
15 #include "GrSurfacePriv.h" 16 #include "GrSurfacePriv.h"
16 #include "GrTemplates.h" 17 #include "GrTemplates.h"
17 #include "GrTexturePriv.h" 18 #include "GrTexturePriv.h"
18 #include "GrTypes.h" 19 #include "GrTypes.h"
19 #include "GrVertices.h" 20 #include "GrVertices.h"
20 #include "builders/GrGLShaderStringBuilder.h" 21 #include "builders/GrGLShaderStringBuilder.h"
22 #include "glsl/GrGLSLCaps.h"
21 #include "SkStrokeRec.h" 23 #include "SkStrokeRec.h"
22 #include "SkTemplates.h" 24 #include "SkTemplates.h"
23 25
24 #define GL_CALL(X) GR_GL_CALL(this->glInterface(), X) 26 #define GL_CALL(X) GR_GL_CALL(this->glInterface(), X)
25 #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)
26 28
27 #define SKIP_CACHE_CHECK true 29 #define SKIP_CACHE_CHECK true
28 30
29 #if GR_GL_CHECK_ALLOC_WITH_GET_ERROR 31 #if GR_GL_CHECK_ALLOC_WITH_GET_ERROR
30 #define CLEAR_ERROR_BEFORE_ALLOC(iface) GrGLClearErr(iface) 32 #define CLEAR_ERROR_BEFORE_ALLOC(iface) GrGLClearErr(iface)
(...skipping 2699 matching lines...) Expand 10 before | Expand all | Expand 10 after
2730 2732
2731 if (can_blit_framebuffer(dst, src, this)) { 2733 if (can_blit_framebuffer(dst, src, this)) {
2732 return this->copySurfaceAsBlitFramebuffer(dst, src, srcRect, dstPoint); 2734 return this->copySurfaceAsBlitFramebuffer(dst, src, srcRect, dstPoint);
2733 } 2735 }
2734 2736
2735 return false; 2737 return false;
2736 } 2738 }
2737 2739
2738 2740
2739 void GrGLGpu::createCopyProgram() { 2741 void GrGLGpu::createCopyProgram() {
2740 const char* version = GrGetGLSLVersionDecl(this->ctxInfo()); 2742 const char* version = GrGLGetGLSLVersionDecl(this->ctxInfo());
2741 2743
2742 GrGLShaderVar aVertex("a_vertex", kVec2f_GrSLType, GrShaderVar::kAttribute_T ypeModifier); 2744 GrGLShaderVar aVertex("a_vertex", kVec2f_GrSLType, GrShaderVar::kAttribute_T ypeModifier);
2743 GrGLShaderVar uTexCoordXform("u_texCoordXform", kVec4f_GrSLType, 2745 GrGLShaderVar uTexCoordXform("u_texCoordXform", kVec4f_GrSLType,
2744 GrShaderVar::kUniform_TypeModifier); 2746 GrShaderVar::kUniform_TypeModifier);
2745 GrGLShaderVar uPosXform("u_posXform", kVec4f_GrSLType, GrShaderVar::kUniform _TypeModifier); 2747 GrGLShaderVar uPosXform("u_posXform", kVec4f_GrSLType, GrShaderVar::kUniform _TypeModifier);
2746 GrGLShaderVar uTexture("u_texture", kSampler2D_GrSLType, GrShaderVar::kUnifo rm_TypeModifier); 2748 GrGLShaderVar uTexture("u_texture", kSampler2D_GrSLType, GrShaderVar::kUnifo rm_TypeModifier);
2747 GrGLShaderVar vTexCoord("v_texCoord", kVec2f_GrSLType, GrShaderVar::kVarying Out_TypeModifier); 2749 GrGLShaderVar vTexCoord("v_texCoord", kVec2f_GrSLType, GrShaderVar::kVarying Out_TypeModifier);
2748 GrGLShaderVar oFragColor("o_FragColor", kVec4f_GrSLType, GrShaderVar::kOut_T ypeModifier); 2750 GrGLShaderVar oFragColor("o_FragColor", kVec4f_GrSLType, GrShaderVar::kOut_T ypeModifier);
2749 2751
2750 SkString vshaderTxt(version); 2752 SkString vshaderTxt(version);
2751 aVertex.appendDecl(this->ctxInfo(), &vshaderTxt); 2753 aVertex.appendDecl(this->ctxInfo(), &vshaderTxt);
2752 vshaderTxt.append(";"); 2754 vshaderTxt.append(";");
2753 uTexCoordXform.appendDecl(this->ctxInfo(), &vshaderTxt); 2755 uTexCoordXform.appendDecl(this->ctxInfo(), &vshaderTxt);
2754 vshaderTxt.append(";"); 2756 vshaderTxt.append(";");
2755 uPosXform.appendDecl(this->ctxInfo(), &vshaderTxt); 2757 uPosXform.appendDecl(this->ctxInfo(), &vshaderTxt);
2756 vshaderTxt.append(";"); 2758 vshaderTxt.append(";");
2757 vTexCoord.appendDecl(this->ctxInfo(), &vshaderTxt); 2759 vTexCoord.appendDecl(this->ctxInfo(), &vshaderTxt);
2758 vshaderTxt.append(";"); 2760 vshaderTxt.append(";");
2759 2761
2760 vshaderTxt.append( 2762 vshaderTxt.append(
2761 "// Copy Program VS\n" 2763 "// Copy Program VS\n"
2762 "void main() {" 2764 "void main() {"
2763 " v_texCoord = a_vertex.xy * u_texCoordXform.xy + u_texCoordXform.zw;" 2765 " v_texCoord = a_vertex.xy * u_texCoordXform.xy + u_texCoordXform.zw;"
2764 " gl_Position.xy = a_vertex * u_posXform.xy + u_posXform.zw;" 2766 " gl_Position.xy = a_vertex * u_posXform.xy + u_posXform.zw;"
2765 " gl_Position.zw = vec2(0, 1);" 2767 " gl_Position.zw = vec2(0, 1);"
2766 "}" 2768 "}"
2767 ); 2769 );
2768 2770
2769 SkString fshaderTxt(version); 2771 SkString fshaderTxt(version);
2770 GrGLSLAppendDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision, this->g lStandard(), 2772 GrGLAppendGLSLDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision, this- >glStandard(),
2771 &fshaderTxt); 2773 &fshaderTxt);
2772 vTexCoord.setTypeModifier(GrShaderVar::kVaryingIn_TypeModifier); 2774 vTexCoord.setTypeModifier(GrShaderVar::kVaryingIn_TypeModifier);
2773 vTexCoord.appendDecl(this->ctxInfo(), &fshaderTxt); 2775 vTexCoord.appendDecl(this->ctxInfo(), &fshaderTxt);
2774 fshaderTxt.append(";"); 2776 fshaderTxt.append(";");
2775 uTexture.appendDecl(this->ctxInfo(), &fshaderTxt); 2777 uTexture.appendDecl(this->ctxInfo(), &fshaderTxt);
2776 fshaderTxt.append(";"); 2778 fshaderTxt.append(";");
2777 const char* fsOutName; 2779 const char* fsOutName;
2778 if (this->glCaps().glslCaps()->mustDeclareFragmentShaderOutput()) { 2780 if (this->glCaps().glslCaps()->mustDeclareFragmentShaderOutput()) {
2779 oFragColor.appendDecl(this->ctxInfo(), &fshaderTxt); 2781 oFragColor.appendDecl(this->ctxInfo(), &fshaderTxt);
2780 fshaderTxt.append(";"); 2782 fshaderTxt.append(";");
2781 fsOutName = oFragColor.c_str(); 2783 fsOutName = oFragColor.c_str();
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
3104 this->setVertexArrayID(gpu, 0); 3106 this->setVertexArrayID(gpu, 0);
3105 } 3107 }
3106 int attrCount = gpu->glCaps().maxVertexAttributes(); 3108 int attrCount = gpu->glCaps().maxVertexAttributes();
3107 if (fDefaultVertexArrayAttribState.count() != attrCount) { 3109 if (fDefaultVertexArrayAttribState.count() != attrCount) {
3108 fDefaultVertexArrayAttribState.resize(attrCount); 3110 fDefaultVertexArrayAttribState.resize(attrCount);
3109 } 3111 }
3110 attribState = &fDefaultVertexArrayAttribState; 3112 attribState = &fDefaultVertexArrayAttribState;
3111 } 3113 }
3112 return attribState; 3114 return attribState;
3113 } 3115 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLGLSL.cpp ('k') | src/gpu/gl/GrGLProgram.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698