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" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 } | 57 } |
58 INHERITED::onRelease(); | 58 INHERITED::onRelease(); |
59 } | 59 } |
60 | 60 |
61 void GrGLTexture::onAbandon() { | 61 void GrGLTexture::onAbandon() { |
62 fInfo.fTarget = 0; | 62 fInfo.fTarget = 0; |
63 fInfo.fID = 0; | 63 fInfo.fID = 0; |
64 INHERITED::onAbandon(); | 64 INHERITED::onAbandon(); |
65 } | 65 } |
66 | 66 |
| 67 GrSLType GrGLTexture::getSamplerType() const { |
| 68 if (GR_GL_TEXTURE_EXTERNAL == fInfo.fTarget) { |
| 69 return kSamplerExternal_GrSLType; |
| 70 } else if (GR_GL_TEXTURE_RECTANGLE == fInfo.fTarget) { |
| 71 return kSampler2DRect_GrSLType; |
| 72 } else { |
| 73 SkASSERT(GR_GL_TEXTURE_2D == fInfo.fTarget); |
| 74 return kSampler2D_GrSLType; |
| 75 } |
| 76 } |
| 77 |
67 GrBackendObject GrGLTexture::getTextureHandle() const { | 78 GrBackendObject GrGLTexture::getTextureHandle() const { |
68 #ifdef SK_IGNORE_GL_TEXTURE_TARGET | 79 #ifdef SK_IGNORE_GL_TEXTURE_TARGET |
69 return static_cast<GrBackendObject>(this->textureID()); | 80 return static_cast<GrBackendObject>(this->textureID()); |
70 #else | 81 #else |
71 return reinterpret_cast<GrBackendObject>(&fInfo); | 82 return reinterpret_cast<GrBackendObject>(&fInfo); |
72 #endif | 83 #endif |
73 } | 84 } |
74 | 85 |
75 void GrGLTexture::setMemoryBacking(SkTraceMemoryDump* traceMemoryDump, | 86 void GrGLTexture::setMemoryBacking(SkTraceMemoryDump* traceMemoryDump, |
76 const SkString& dumpName) const { | 87 const SkString& dumpName) const { |
77 SkString texture_id; | 88 SkString texture_id; |
78 texture_id.appendU32(this->textureID()); | 89 texture_id.appendU32(this->textureID()); |
79 traceMemoryDump->setMemoryBacking(dumpName.c_str(), "gl_texture", | 90 traceMemoryDump->setMemoryBacking(dumpName.c_str(), "gl_texture", |
80 texture_id.c_str()); | 91 texture_id.c_str()); |
81 } | 92 } |
OLD | NEW |