aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-12-09 19:40:36 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-12-09 19:40:36 +0000
commit07dd2bfd7451ef7052cf53958e6561fd6c5563a3 (patch)
treef225a40fa94d3ca876a3d6b46f5d1d8dbccaedbe /src/gpu
parentb1d14fd63df83b40f1161473134319d13b733284 (diff)
Add support for GL_ANGLE_texture_usage
Review URL: http://codereview.appspot.com/5478052/ git-svn-id: http://skia.googlecode.com/svn/trunk@2845 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrGpuGL.cpp9
-rw-r--r--src/gpu/GrGpuGL.h6
2 files changed, 14 insertions, 1 deletions
diff --git a/src/gpu/GrGpuGL.cpp b/src/gpu/GrGpuGL.cpp
index 190a41230b..fb16b22ec3 100644
--- a/src/gpu/GrGpuGL.cpp
+++ b/src/gpu/GrGpuGL.cpp
@@ -336,6 +336,9 @@ void GrGpuGL::initCaps() {
fCaps.fNPOTTextureTileSupport = this->hasExtension("GL_OES_texture_npot");
}
+ fGLCaps.fTextureUsageSupport = (kES2_GrGLBinding == this->glBinding()) &&
+ this->hasExtension("GL_ANGLE_texture_usage");
+
fCaps.fHWAALineSupport = (kDesktop_GrGLBinding == this->glBinding());
////////////////////////////////////////////////////////////////////////////
@@ -1044,6 +1047,12 @@ GrTexture* GrGpuGL::onCreateTexture(const GrTextureDesc& desc,
}
GL_CALL(GenTextures(1, &glTexDesc.fTextureID));
+ if (renderTarget && this->glCaps().fTextureUsageSupport) {
+ // provides a hint about how this texture will be used
+ GL_CALL(TexParameteri(GR_GL_TEXTURE_2D,
+ GR_GL_TEXTURE_USAGE,
+ GR_GL_FRAMEBUFFER_ATTACHMENT));
+ }
if (!glTexDesc.fTextureID) {
return return_null_texture();
}
diff --git a/src/gpu/GrGpuGL.h b/src/gpu/GrGpuGL.h
index 57a4d97e78..5f9180fe95 100644
--- a/src/gpu/GrGpuGL.h
+++ b/src/gpu/GrGpuGL.h
@@ -57,7 +57,8 @@ protected:
, fUnpackRowLengthSupport(false)
, fUnpackFlipYSupport(false)
, fPackRowLengthSupport(false)
- , fPackFlipYSupport(false) {
+ , fPackFlipYSupport(false)
+ , fTextureUsageSupport(false) {
memset(fAASamples, 0, sizeof(fAASamples));
}
SkTArray<GrGLStencilBuffer::Format, true> fStencilFormats;
@@ -113,6 +114,9 @@ protected:
// Is there support for GL_PACK_REVERSE_ROW_ORDER
bool fPackFlipYSupport;
+ // Is there support for texture parameter GL_TEXTURE_USAGE
+ bool fTextureUsageSupport;
+
void print() const;
} fGLCaps;