#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 */
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());
////////////////////////////////////////////////////////////////////////////
}
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();
}
, fUnpackRowLengthSupport(false)
, fUnpackFlipYSupport(false)
, fPackRowLengthSupport(false)
- , fPackFlipYSupport(false) {
+ , fPackFlipYSupport(false)
+ , fTextureUsageSupport(false) {
memset(fAASamples, 0, sizeof(fAASamples));
}
SkTArray<GrGLStencilBuffer::Format, true> fStencilFormats;
// 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;