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 3082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3668 for (size_t i = 0; i < SK_ARRAY_COUNT(fCopyPrograms); ++i) { | 3668 for (size_t i = 0; i < SK_ARRAY_COUNT(fCopyPrograms); ++i) { |
3669 fCopyPrograms[i].fProgram = 0; | 3669 fCopyPrograms[i].fProgram = 0; |
3670 } | 3670 } |
3671 const GrGLSLCaps* glslCaps = this->glCaps().glslCaps(); | 3671 const GrGLSLCaps* glslCaps = this->glCaps().glslCaps(); |
3672 const char* version = glslCaps->versionDeclString(); | 3672 const char* version = glslCaps->versionDeclString(); |
3673 static const GrSLType kSamplerTypes[3] = { kSampler2D_GrSLType, kSamplerExte
rnal_GrSLType, | 3673 static const GrSLType kSamplerTypes[3] = { kSampler2D_GrSLType, kSamplerExte
rnal_GrSLType, |
3674 kSampler2DRect_GrSLType }; | 3674 kSampler2DRect_GrSLType }; |
3675 SkASSERT(3 == SK_ARRAY_COUNT(fCopyPrograms)); | 3675 SkASSERT(3 == SK_ARRAY_COUNT(fCopyPrograms)); |
3676 for (int i = 0; i < 3; ++i) { | 3676 for (int i = 0; i < 3; ++i) { |
3677 if (kSamplerExternal_GrSLType == kSamplerTypes[i] && | 3677 if (kSamplerExternal_GrSLType == kSamplerTypes[i] && |
3678 !this->glCaps().externalTextureSupport()) { | 3678 !this->glCaps().glslCaps()->externalTextureSupport()) { |
3679 continue; | 3679 continue; |
3680 } | 3680 } |
3681 if (kSampler2DRect_GrSLType == kSamplerTypes[i] && | 3681 if (kSampler2DRect_GrSLType == kSamplerTypes[i] && |
3682 !this->glCaps().rectangleTextureSupport()) { | 3682 !this->glCaps().rectangleTextureSupport()) { |
3683 continue; | 3683 continue; |
3684 } | 3684 } |
3685 GrGLSLShaderVar aVertex("a_vertex", kVec2f_GrSLType, GrShaderVar::kAttri
bute_TypeModifier); | 3685 GrGLSLShaderVar aVertex("a_vertex", kVec2f_GrSLType, GrShaderVar::kAttri
bute_TypeModifier); |
3686 GrGLSLShaderVar uTexCoordXform("u_texCoordXform", kVec4f_GrSLType, | 3686 GrGLSLShaderVar uTexCoordXform("u_texCoordXform", kVec4f_GrSLType, |
3687 GrShaderVar::kUniform_TypeModifier); | 3687 GrShaderVar::kUniform_TypeModifier); |
3688 GrGLSLShaderVar uPosXform("u_posXform", kVec4f_GrSLType, | 3688 GrGLSLShaderVar uPosXform("u_posXform", kVec4f_GrSLType, |
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4343 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || | 4343 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || |
4344 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { | 4344 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { |
4345 copyParams->fFilter = GrTextureParams::kNone_FilterMode; | 4345 copyParams->fFilter = GrTextureParams::kNone_FilterMode; |
4346 copyParams->fWidth = texture->width(); | 4346 copyParams->fWidth = texture->width(); |
4347 copyParams->fHeight = texture->height(); | 4347 copyParams->fHeight = texture->height(); |
4348 return true; | 4348 return true; |
4349 } | 4349 } |
4350 } | 4350 } |
4351 return false; | 4351 return false; |
4352 } | 4352 } |
OLD | NEW |