| OLD | NEW |
| 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 2801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2832 vshaderTxt.append( | 2833 vshaderTxt.append( |
| 2833 "// Copy Program VS\n" | 2834 "// Copy Program VS\n" |
| 2834 "void main() {" | 2835 "void main() {" |
| 2835 " v_texCoord = a_vertex.xy * u_texCoordXform.xy + u_texCoordXform.zw;" | 2836 " v_texCoord = a_vertex.xy * u_texCoordXform.xy + u_texCoordXform.zw;" |
| 2836 " gl_Position.xy = a_vertex * u_posXform.xy + u_posXform.zw;" | 2837 " gl_Position.xy = a_vertex * u_posXform.xy + u_posXform.zw;" |
| 2837 " gl_Position.zw = vec2(0, 1);" | 2838 " gl_Position.zw = vec2(0, 1);" |
| 2838 "}" | 2839 "}" |
| 2839 ); | 2840 ); |
| 2840 | 2841 |
| 2841 SkString fshaderTxt(version); | 2842 SkString fshaderTxt(version); |
| 2842 GrGLAppendGLSLDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision, this-
>glStandard(), | 2843 GrGLSLAppendDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision, |
| 2843 &fshaderTxt); | 2844 *this->glCaps().glslCaps(), |
| 2845 &fshaderTxt); |
| 2844 vTexCoord.setTypeModifier(GrShaderVar::kVaryingIn_TypeModifier); | 2846 vTexCoord.setTypeModifier(GrShaderVar::kVaryingIn_TypeModifier); |
| 2845 vTexCoord.appendDecl(this->glCaps().glslCaps(), &fshaderTxt); | 2847 vTexCoord.appendDecl(this->glCaps().glslCaps(), &fshaderTxt); |
| 2846 fshaderTxt.append(";"); | 2848 fshaderTxt.append(";"); |
| 2847 uTexture.appendDecl(this->glCaps().glslCaps(), &fshaderTxt); | 2849 uTexture.appendDecl(this->glCaps().glslCaps(), &fshaderTxt); |
| 2848 fshaderTxt.append(";"); | 2850 fshaderTxt.append(";"); |
| 2849 const char* fsOutName; | 2851 const char* fsOutName; |
| 2850 if (this->glCaps().glslCaps()->mustDeclareFragmentShaderOutput()) { | 2852 if (this->glCaps().glslCaps()->mustDeclareFragmentShaderOutput()) { |
| 2851 oFragColor.appendDecl(this->glCaps().glslCaps(), &fshaderTxt); | 2853 oFragColor.appendDecl(this->glCaps().glslCaps(), &fshaderTxt); |
| 2852 fshaderTxt.append(";"); | 2854 fshaderTxt.append(";"); |
| 2853 fsOutName = oFragColor.c_str(); | 2855 fsOutName = oFragColor.c_str(); |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3182 this->setVertexArrayID(gpu, 0); | 3184 this->setVertexArrayID(gpu, 0); |
| 3183 } | 3185 } |
| 3184 int attrCount = gpu->glCaps().maxVertexAttributes(); | 3186 int attrCount = gpu->glCaps().maxVertexAttributes(); |
| 3185 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 3187 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
| 3186 fDefaultVertexArrayAttribState.resize(attrCount); | 3188 fDefaultVertexArrayAttribState.resize(attrCount); |
| 3187 } | 3189 } |
| 3188 attribState = &fDefaultVertexArrayAttribState; | 3190 attribState = &fDefaultVertexArrayAttribState; |
| 3189 } | 3191 } |
| 3190 return attribState; | 3192 return attribState; |
| 3191 } | 3193 } |
| OLD | NEW |