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 kSamplerExternal_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 kSampler2DRect_GrSLType; |
| 22 } else if (GR_GL_TEXTURE_BUFFER == idDesc.fInfo.fTarget) { |
| 23 return kSamplerBuffer_GrSLType; |
22 } else { | 24 } else { |
23 SkASSERT(idDesc.fInfo.fTarget == GR_GL_TEXTURE_2D); | 25 SkASSERT(idDesc.fInfo.fTarget == GR_GL_TEXTURE_2D); |
24 return kSampler2D_GrSLType; | 26 return kSampler2D_GrSLType; |
25 } | 27 } |
26 } | 28 } |
27 | 29 |
28 // Because this class is virtually derived from GrSurface we must explicitly cal
l its constructor. | 30 // Because this class is virtually derived from GrSurface we must explicitly cal
l its constructor. |
29 GrGLTexture::GrGLTexture(GrGLGpu* gpu, const GrSurfaceDesc& desc, const IDDesc&
idDesc) | 31 GrGLTexture::GrGLTexture(GrGLGpu* gpu, const GrSurfaceDesc& desc, const IDDesc&
idDesc) |
30 : GrSurface(gpu, idDesc.fLifeCycle, desc) | 32 : GrSurface(gpu, idDesc.fLifeCycle, desc) |
31 , INHERITED(gpu, idDesc.fLifeCycle, desc, sampler_type(idDesc, gpu), false)
{ | 33 , INHERITED(gpu, idDesc.fLifeCycle, desc, sampler_type(idDesc, gpu), false)
{ |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 #endif | 87 #endif |
86 } | 88 } |
87 | 89 |
88 void GrGLTexture::setMemoryBacking(SkTraceMemoryDump* traceMemoryDump, | 90 void GrGLTexture::setMemoryBacking(SkTraceMemoryDump* traceMemoryDump, |
89 const SkString& dumpName) const { | 91 const SkString& dumpName) const { |
90 SkString texture_id; | 92 SkString texture_id; |
91 texture_id.appendU32(this->textureID()); | 93 texture_id.appendU32(this->textureID()); |
92 traceMemoryDump->setMemoryBacking(dumpName.c_str(), "gl_texture", | 94 traceMemoryDump->setMemoryBacking(dumpName.c_str(), "gl_texture", |
93 texture_id.c_str()); | 95 texture_id.c_str()); |
94 } | 96 } |
OLD | NEW |