| 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 #include "GrGLGpu.h" | 8 #include "GrGLGpu.h" |
| 9 #include "GrGLGLSL.h" | 9 #include "GrGLGLSL.h" |
| 10 #include "GrGLStencilAttachment.h" | 10 #include "GrGLStencilAttachment.h" |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 } | 184 } |
| 185 | 185 |
| 186 static bool gPrintStartupSpew; | 186 static bool gPrintStartupSpew; |
| 187 | 187 |
| 188 GrGLGpu::GrGLGpu(GrGLContext* ctx, GrContext* context) | 188 GrGLGpu::GrGLGpu(GrGLContext* ctx, GrContext* context) |
| 189 : GrGpu(context) | 189 : GrGpu(context) |
| 190 , fGLContext(ctx) { | 190 , fGLContext(ctx) { |
| 191 SkASSERT(ctx); | 191 SkASSERT(ctx); |
| 192 fCaps.reset(SkRef(ctx->caps())); | 192 fCaps.reset(SkRef(ctx->caps())); |
| 193 | 193 |
| 194 fHWBoundTextureUniqueIDs.reset(this->glCaps().maxFragmentTextureUnits()); | 194 fHWBoundTextureUniqueIDs.reset(this->glCaps().glslCaps()->maxCombinedSampler
s()); |
| 195 | 195 |
| 196 GrGLClearErr(this->glInterface()); | 196 GrGLClearErr(this->glInterface()); |
| 197 if (gPrintStartupSpew) { | 197 if (gPrintStartupSpew) { |
| 198 const GrGLubyte* vendor; | 198 const GrGLubyte* vendor; |
| 199 const GrGLubyte* renderer; | 199 const GrGLubyte* renderer; |
| 200 const GrGLubyte* version; | 200 const GrGLubyte* version; |
| 201 GL_CALL_RET(vendor, GetString(GR_GL_VENDOR)); | 201 GL_CALL_RET(vendor, GetString(GR_GL_VENDOR)); |
| 202 GL_CALL_RET(renderer, GetString(GR_GL_RENDERER)); | 202 GL_CALL_RET(renderer, GetString(GR_GL_RENDERER)); |
| 203 GL_CALL_RET(version, GetString(GR_GL_VERSION)); | 203 GL_CALL_RET(version, GetString(GR_GL_VERSION)); |
| 204 SkDebugf("------------------------- create GrGLGpu %p --------------\n", | 204 SkDebugf("------------------------- create GrGLGpu %p --------------\n", |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 idDesc.fInfo.fTarget = GR_GL_TEXTURE_2D; | 565 idDesc.fInfo.fTarget = GR_GL_TEXTURE_2D; |
| 566 #else | 566 #else |
| 567 idDesc.fInfo = *info; | 567 idDesc.fInfo = *info; |
| 568 #endif | 568 #endif |
| 569 | 569 |
| 570 if (GR_GL_TEXTURE_EXTERNAL == idDesc.fInfo.fTarget) { | 570 if (GR_GL_TEXTURE_EXTERNAL == idDesc.fInfo.fTarget) { |
| 571 if (renderTarget) { | 571 if (renderTarget) { |
| 572 // This combination is not supported. | 572 // This combination is not supported. |
| 573 return nullptr; | 573 return nullptr; |
| 574 } | 574 } |
| 575 if (!this->glCaps().externalTextureSupport()) { | 575 if (!this->glCaps().glslCaps()->externalTextureSupport()) { |
| 576 return nullptr; | 576 return nullptr; |
| 577 } | 577 } |
| 578 } else if (GR_GL_TEXTURE_RECTANGLE == idDesc.fInfo.fTarget) { | 578 } else if (GR_GL_TEXTURE_RECTANGLE == idDesc.fInfo.fTarget) { |
| 579 if (!this->glCaps().rectangleTextureSupport()) { | 579 if (!this->glCaps().rectangleTextureSupport()) { |
| 580 return nullptr; | 580 return nullptr; |
| 581 } | 581 } |
| 582 } else if (GR_GL_TEXTURE_2D != idDesc.fInfo.fTarget) { | 582 } else if (GR_GL_TEXTURE_2D != idDesc.fInfo.fTarget) { |
| 583 return nullptr; | 583 return nullptr; |
| 584 } | 584 } |
| 585 | 585 |
| (...skipping 3091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3677 for (size_t i = 0; i < SK_ARRAY_COUNT(fCopyPrograms); ++i) { | 3677 for (size_t i = 0; i < SK_ARRAY_COUNT(fCopyPrograms); ++i) { |
| 3678 fCopyPrograms[i].fProgram = 0; | 3678 fCopyPrograms[i].fProgram = 0; |
| 3679 } | 3679 } |
| 3680 const GrGLSLCaps* glslCaps = this->glCaps().glslCaps(); | 3680 const GrGLSLCaps* glslCaps = this->glCaps().glslCaps(); |
| 3681 const char* version = glslCaps->versionDeclString(); | 3681 const char* version = glslCaps->versionDeclString(); |
| 3682 static const GrSLType kSamplerTypes[3] = { kSampler2D_GrSLType, kSamplerExte
rnal_GrSLType, | 3682 static const GrSLType kSamplerTypes[3] = { kSampler2D_GrSLType, kSamplerExte
rnal_GrSLType, |
| 3683 kSampler2DRect_GrSLType }; | 3683 kSampler2DRect_GrSLType }; |
| 3684 SkASSERT(3 == SK_ARRAY_COUNT(fCopyPrograms)); | 3684 SkASSERT(3 == SK_ARRAY_COUNT(fCopyPrograms)); |
| 3685 for (int i = 0; i < 3; ++i) { | 3685 for (int i = 0; i < 3; ++i) { |
| 3686 if (kSamplerExternal_GrSLType == kSamplerTypes[i] && | 3686 if (kSamplerExternal_GrSLType == kSamplerTypes[i] && |
| 3687 !this->glCaps().externalTextureSupport()) { | 3687 !this->glCaps().glslCaps()->externalTextureSupport()) { |
| 3688 continue; | 3688 continue; |
| 3689 } | 3689 } |
| 3690 if (kSampler2DRect_GrSLType == kSamplerTypes[i] && | 3690 if (kSampler2DRect_GrSLType == kSamplerTypes[i] && |
| 3691 !this->glCaps().rectangleTextureSupport()) { | 3691 !this->glCaps().rectangleTextureSupport()) { |
| 3692 continue; | 3692 continue; |
| 3693 } | 3693 } |
| 3694 GrGLSLShaderVar aVertex("a_vertex", kVec2f_GrSLType, GrShaderVar::kAttri
bute_TypeModifier); | 3694 GrGLSLShaderVar aVertex("a_vertex", kVec2f_GrSLType, GrShaderVar::kAttri
bute_TypeModifier); |
| 3695 GrGLSLShaderVar uTexCoordXform("u_texCoordXform", kVec4f_GrSLType, | 3695 GrGLSLShaderVar uTexCoordXform("u_texCoordXform", kVec4f_GrSLType, |
| 3696 GrShaderVar::kUniform_TypeModifier); | 3696 GrShaderVar::kUniform_TypeModifier); |
| 3697 GrGLSLShaderVar uPosXform("u_posXform", kVec4f_GrSLType, | 3697 GrGLSLShaderVar uPosXform("u_posXform", kVec4f_GrSLType, |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4352 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || | 4352 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || |
| 4353 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { | 4353 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { |
| 4354 copyParams->fFilter = GrTextureParams::kNone_FilterMode; | 4354 copyParams->fFilter = GrTextureParams::kNone_FilterMode; |
| 4355 copyParams->fWidth = texture->width(); | 4355 copyParams->fWidth = texture->width(); |
| 4356 copyParams->fHeight = texture->height(); | 4356 copyParams->fHeight = texture->height(); |
| 4357 return true; | 4357 return true; |
| 4358 } | 4358 } |
| 4359 } | 4359 } |
| 4360 return false; | 4360 return false; |
| 4361 } | 4361 } |
| OLD | NEW |