| 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 "GrGLTexture.h" | 8 #include "GrGLTexture.h" |
| 9 #include "GrGLGpu.h" | 9 #include "GrGLGpu.h" |
| 10 #include "SkTraceMemoryDump.h" | 10 #include "SkTraceMemoryDump.h" |
| 11 | 11 |
| 12 #define GPUGL static_cast<GrGLGpu*>(this->getGpu()) | 12 #define GPUGL static_cast<GrGLGpu*>(this->getGpu()) |
| 13 #define GL_CALL(X) GR_GL_CALL(GPUGL->glInterface(), X) | 13 #define GL_CALL(X) GR_GL_CALL(GPUGL->glInterface(), X) |
| 14 | 14 |
| 15 inline static GrSLType sampler_type(const GrGLTexture::IDDesc& idDesc, const GrG
LGpu* gpu) { | 15 inline static GrSLType sampler_type(const GrGLTexture::IDDesc& idDesc, const GrG
LGpu* gpu) { |
| 16 if (idDesc.fInfo.fTarget == GR_GL_TEXTURE_EXTERNAL) { | 16 if (idDesc.fInfo.fTarget == GR_GL_TEXTURE_EXTERNAL) { |
| 17 SkASSERT(gpu->glCaps().glslCaps()->externalTextureSupport()); | 17 SkASSERT(gpu->glCaps().glslCaps()->externalTextureSupport()); |
| 18 return kSamplerExternal_GrSLType; | 18 return kTextureExternalSampler_GrSLType; |
| 19 } else if (idDesc.fInfo.fTarget == GR_GL_TEXTURE_RECTANGLE) { | 19 } else if (idDesc.fInfo.fTarget == GR_GL_TEXTURE_RECTANGLE) { |
| 20 SkASSERT(gpu->glCaps().rectangleTextureSupport()); | 20 SkASSERT(gpu->glCaps().rectangleTextureSupport()); |
| 21 return kSampler2DRect_GrSLType; | 21 return kTexture2DRectSampler_GrSLType; |
| 22 } else { | 22 } else { |
| 23 SkASSERT(idDesc.fInfo.fTarget == GR_GL_TEXTURE_2D); | 23 SkASSERT(idDesc.fInfo.fTarget == GR_GL_TEXTURE_2D); |
| 24 return kSampler2D_GrSLType; | 24 return kTexture2DSampler_GrSLType; |
| 25 } | 25 } |
| 26 } | 26 } |
| 27 | 27 |
| 28 // Because this class is virtually derived from GrSurface we must explicitly cal
l its constructor. | 28 // Because this class is virtually derived from GrSurface we must explicitly cal
l its constructor. |
| 29 GrGLTexture::GrGLTexture(GrGLGpu* gpu, SkBudgeted budgeted, const GrSurfaceDesc&
desc, | 29 GrGLTexture::GrGLTexture(GrGLGpu* gpu, SkBudgeted budgeted, const GrSurfaceDesc&
desc, |
| 30 const IDDesc& idDesc) | 30 const IDDesc& idDesc) |
| 31 : GrSurface(gpu, desc) | 31 : GrSurface(gpu, desc) |
| 32 , INHERITED(gpu, desc, sampler_type(idDesc, gpu), false) { | 32 , INHERITED(gpu, desc, sampler_type(idDesc, gpu), false) { |
| 33 this->init(desc, idDesc); | 33 this->init(desc, idDesc); |
| 34 this->registerWithCache(budgeted); | 34 this->registerWithCache(budgeted); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 texture_id.appendU32(this->textureID()); | 94 texture_id.appendU32(this->textureID()); |
| 95 traceMemoryDump->setMemoryBacking(dumpName.c_str(), "gl_texture", | 95 traceMemoryDump->setMemoryBacking(dumpName.c_str(), "gl_texture", |
| 96 texture_id.c_str()); | 96 texture_id.c_str()); |
| 97 } | 97 } |
| 98 | 98 |
| 99 GrGLTexture* GrGLTexture::CreateWrapped(GrGLGpu* gpu, const GrSurfaceDesc& desc, | 99 GrGLTexture* GrGLTexture::CreateWrapped(GrGLGpu* gpu, const GrSurfaceDesc& desc, |
| 100 const IDDesc& idDesc) { | 100 const IDDesc& idDesc) { |
| 101 return new GrGLTexture(gpu, kWrapped, desc, idDesc); | 101 return new GrGLTexture(gpu, kWrapped, desc, idDesc); |
| 102 } | 102 } |
| 103 | 103 |
| OLD | NEW |