diff options
author | Chia-I Wu <[email protected]> | 2011-10-23 18:52:38 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2011-11-03 15:09:45 +0800 |
commit | 0c87f16817ff0bf1f05e0d634944fd47b097faee (patch) | |
tree | 35549c03e8f4c41b90a31abf50b068271deff4a2 /src/mesa/main/texobj.c | |
parent | 79463f18ac91b2b0f1ed6dcdb26f84b942543d80 (diff) |
mesa: add support for GL_OES_EGL_image_external
This is an OpenGL ES specific extension. External textures are textures that
may be sampled from, but not be updated (no glTexSubImage* and etc.). The
image data are taken from an EGLImage.
Reviewed-by: Brian Paul <[email protected]>
Acked-by: Jakob Bornecrantz <[email protected]>
Diffstat (limited to 'src/mesa/main/texobj.c')
-rw-r--r-- | src/mesa/main/texobj.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index a8c0b8ee8b9..e2f0dc8b643 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -107,6 +107,7 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj, target == GL_TEXTURE_RECTANGLE_NV || target == GL_TEXTURE_1D_ARRAY_EXT || target == GL_TEXTURE_2D_ARRAY_EXT || + target == GL_TEXTURE_EXTERNAL_OES || target == GL_TEXTURE_BUFFER); memset(obj, 0, sizeof(*obj)); @@ -119,8 +120,12 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj, obj->BaseLevel = 0; obj->MaxLevel = 1000; + /* must be one; no support for (YUV) planes in separate buffers */ + obj->RequiredTextureImageUnits = 1; + /* sampler state */ - if (target == GL_TEXTURE_RECTANGLE_NV) { + if (target == GL_TEXTURE_RECTANGLE_NV || + target == GL_TEXTURE_EXTERNAL_OES) { obj->Sampler.WrapS = GL_CLAMP_TO_EDGE; obj->Sampler.WrapT = GL_CLAMP_TO_EDGE; obj->Sampler.WrapR = GL_CLAMP_TO_EDGE; @@ -161,7 +166,8 @@ finish_texture_init(struct gl_context *ctx, GLenum target, { assert(obj->Target == 0); - if (target == GL_TEXTURE_RECTANGLE_NV) { + if (target == GL_TEXTURE_RECTANGLE_NV || + target == GL_TEXTURE_EXTERNAL_OES) { /* have to init wrap and filter state here - kind of klunky */ obj->Sampler.WrapS = GL_CLAMP_TO_EDGE; obj->Sampler.WrapT = GL_CLAMP_TO_EDGE; @@ -259,6 +265,8 @@ _mesa_copy_texture_object( struct gl_texture_object *dest, dest->_Complete = src->_Complete; COPY_4V(dest->Swizzle, src->Swizzle); dest->_Swizzle = src->_Swizzle; + + dest->RequiredTextureImageUnits = src->RequiredTextureImageUnits; } @@ -306,6 +314,7 @@ valid_texture_object(const struct gl_texture_object *tex) case GL_TEXTURE_1D_ARRAY_EXT: case GL_TEXTURE_2D_ARRAY_EXT: case GL_TEXTURE_BUFFER: + case GL_TEXTURE_EXTERNAL_OES: return GL_TRUE; case 0x99: _mesa_problem(NULL, "invalid reference to a deleted texture object"); @@ -470,7 +479,8 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx, t->Image[0][baseLevel]->HeightLog2); maxLevels = ctx->Const.MaxCubeTextureLevels; } - else if (t->Target == GL_TEXTURE_RECTANGLE_NV) { + else if (t->Target == GL_TEXTURE_RECTANGLE_NV || + t->Target == GL_TEXTURE_EXTERNAL_OES) { maxLog2 = 0; /* not applicable */ maxLevels = 1; /* no mipmapping */ } @@ -1005,6 +1015,8 @@ target_enum_to_index(GLenum target) return TEXTURE_2D_ARRAY_INDEX; case GL_TEXTURE_BUFFER_ARB: return TEXTURE_BUFFER_INDEX; + case GL_TEXTURE_EXTERNAL_OES: + return TEXTURE_EXTERNAL_INDEX; default: return -1; } |