From: bsalomon@google.com Date: Fri, 9 Dec 2011 19:40:36 +0000 (+0000) Subject: Add support for GL_ANGLE_texture_usage X-Git-Tag: accepted/tizen/5.0/unified/20181102.025319~17153 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=07dd2bfd7451ef7052cf53958e6561fd6c5563a3;p=platform%2Fupstream%2FlibSkiaSharp.git 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 --- diff --git a/include/gpu/GrGLDefines.h b/include/gpu/GrGLDefines.h index 4dc6278..6a57982 100644 --- a/include/gpu/GrGLDefines.h +++ b/include/gpu/GrGLDefines.h @@ -369,11 +369,15 @@ #define GR_GL_NEAREST_MIPMAP_LINEAR 0x2702 #define GR_GL_LINEAR_MIPMAP_LINEAR 0x2703 +/* TextureUsage */ +#define GR_GL_FRAMEBUFFER_ATTACHMENT 0x93A3 + /* TextureParameterName */ #define GR_GL_TEXTURE_MAG_FILTER 0x2800 #define GR_GL_TEXTURE_MIN_FILTER 0x2801 #define GR_GL_TEXTURE_WRAP_S 0x2802 #define GR_GL_TEXTURE_WRAP_T 0x2803 +#define GR_GL_TEXTURE_USAGE 0x93A2 /* TextureTarget */ /* GL_TEXTURE_2D */ diff --git a/src/gpu/GrGpuGL.cpp b/src/gpu/GrGpuGL.cpp index 190a412..fb16b22 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 57a4d97..5f9180f 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 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;