summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/texparam.c
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2011-10-23 18:52:38 +0800
committerChia-I Wu <[email protected]>2011-11-03 15:09:45 +0800
commit0c87f16817ff0bf1f05e0d634944fd47b097faee (patch)
tree35549c03e8f4c41b90a31abf50b068271deff4a2 /src/mesa/main/texparam.c
parent79463f18ac91b2b0f1ed6dcdb26f84b942543d80 (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/texparam.c')
-rw-r--r--src/mesa/main/texparam.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index 226aba03769..17eac5fc996 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -60,6 +60,10 @@ validate_texture_wrap_mode(struct gl_context * ctx, GLenum target, GLenum wrap)
(wrap == GL_CLAMP_TO_BORDER && e->ARB_texture_border_clamp))
return GL_TRUE;
}
+ else if (target == GL_TEXTURE_EXTERNAL_OES) {
+ if (wrap == GL_CLAMP_TO_EDGE)
+ return GL_TRUE;
+ }
else {
switch (wrap) {
case GL_CLAMP:
@@ -139,6 +143,11 @@ get_texobj(struct gl_context *ctx, GLenum target, GLboolean get)
return texUnit->CurrentTex[TEXTURE_2D_ARRAY_INDEX];
}
break;
+ case GL_TEXTURE_EXTERNAL_OES:
+ if (ctx->Extensions.OES_EGL_image_external) {
+ return texUnit->CurrentTex[TEXTURE_EXTERNAL_INDEX];
+ }
+ break;
default:
;
}
@@ -238,7 +247,8 @@ set_tex_parameteri(struct gl_context *ctx,
case GL_LINEAR_MIPMAP_NEAREST:
case GL_NEAREST_MIPMAP_LINEAR:
case GL_LINEAR_MIPMAP_LINEAR:
- if (texObj->Target != GL_TEXTURE_RECTANGLE_NV) {
+ if (texObj->Target != GL_TEXTURE_RECTANGLE_NV &&
+ texObj->Target != GL_TEXTURE_EXTERNAL_OES) {
incomplete(ctx, texObj);
texObj->Sampler.MinFilter = params[0];
return GL_TRUE;
@@ -319,6 +329,8 @@ set_tex_parameteri(struct gl_context *ctx,
return GL_TRUE;
case GL_GENERATE_MIPMAP_SGIS:
+ if (params[0] && texObj->Target == GL_TEXTURE_EXTERNAL_OES)
+ goto invalid_param;
if (texObj->GenerateMipmap != params[0]) {
/* no flush() */
texObj->GenerateMipmap = params[0] ? GL_TRUE : GL_FALSE;
@@ -1388,6 +1400,12 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
*params = (GLint) obj->Immutable;
break;
+ case GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES:
+ if (!ctx->Extensions.OES_EGL_image_external)
+ goto invalid_pname;
+ *params = obj->RequiredTextureImageUnits;
+ break;
+
default:
goto invalid_pname;
}