aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/texparam.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-11-04 09:28:39 +0100
committermarha <marha@users.sourceforge.net>2011-11-04 09:28:39 +0100
commit23e2767dc3e6b8891d4b55b711c70c6bc85a6f85 (patch)
tree04c538697c3afbd401afb1bb614460b16be28844 /mesalib/src/mesa/main/texparam.c
parent125500b44d0253d7fd7a59905ab730151d4f66e2 (diff)
parent02f377d5e2dd18537d0807ad63675a0970b5a37d (diff)
downloadvcxsrv-23e2767dc3e6b8891d4b55b711c70c6bc85a6f85.tar.gz
vcxsrv-23e2767dc3e6b8891d4b55b711c70c6bc85a6f85.tar.bz2
vcxsrv-23e2767dc3e6b8891d4b55b711c70c6bc85a6f85.zip
Merge remote-tracking branch 'origin/released'
Conflicts: mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h xorg-server/hw/xwin/InitOutput.c xorg-server/hw/xwin/ddraw.h xorg-server/hw/xwin/winclipboardwndproc.c xorg-server/hw/xwin/winglobals.c xorg-server/hw/xwin/winmonitors.c xorg-server/hw/xwin/winprocarg.c xorg-server/hw/xwin/winwin32rootlesswndproc.c xorg-server/include/scrnintstr.h xorg-server/xkb/ddxList.c xorg-server/xkb/ddxLoad.c
Diffstat (limited to 'mesalib/src/mesa/main/texparam.c')
-rw-r--r--mesalib/src/mesa/main/texparam.c112
1 files changed, 90 insertions, 22 deletions
diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c
index dc5ee33a2..17eac5fc9 100644
--- a/mesalib/src/mesa/main/texparam.c
+++ b/mesalib/src/mesa/main/texparam.c
@@ -55,22 +55,38 @@ validate_texture_wrap_mode(struct gl_context * ctx, GLenum target, GLenum wrap)
{
const struct gl_extensions * const e = & ctx->Extensions;
- if (wrap == GL_CLAMP || wrap == GL_CLAMP_TO_EDGE ||
- (wrap == GL_CLAMP_TO_BORDER && e->ARB_texture_border_clamp)) {
- /* any texture target */
- return GL_TRUE;
+ if (target == GL_TEXTURE_RECTANGLE_NV) {
+ if (wrap == GL_CLAMP || wrap == GL_CLAMP_TO_EDGE ||
+ (wrap == GL_CLAMP_TO_BORDER && e->ARB_texture_border_clamp))
+ return GL_TRUE;
}
- else if (target != GL_TEXTURE_RECTANGLE_NV &&
- (wrap == GL_REPEAT ||
- wrap == GL_MIRRORED_REPEAT ||
- (wrap == GL_MIRROR_CLAMP_EXT &&
- (e->ATI_texture_mirror_once || e->EXT_texture_mirror_clamp)) ||
- (wrap == GL_MIRROR_CLAMP_TO_EDGE_EXT &&
- (e->ATI_texture_mirror_once || e->EXT_texture_mirror_clamp)) ||
- (wrap == GL_MIRROR_CLAMP_TO_BORDER_EXT &&
- (e->EXT_texture_mirror_clamp)))) {
- /* non-rectangle texture */
- 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:
+ case GL_REPEAT:
+ case GL_CLAMP_TO_EDGE:
+ case GL_MIRRORED_REPEAT:
+ return GL_TRUE;
+ case GL_CLAMP_TO_BORDER:
+ if (e->ARB_texture_border_clamp)
+ return GL_TRUE;
+ break;
+ case GL_MIRROR_CLAMP_EXT:
+ case GL_MIRROR_CLAMP_TO_EDGE_EXT:
+ if (e->ATI_texture_mirror_once || e->EXT_texture_mirror_clamp)
+ return GL_TRUE;
+ break;
+ case GL_MIRROR_CLAMP_TO_BORDER_EXT:
+ if (e->EXT_texture_mirror_clamp)
+ return GL_TRUE;
+ break;
+ default:
+ break;
+ }
}
_mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(param=0x%x)", wrap );
@@ -127,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:
;
}
@@ -226,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;
@@ -307,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;
@@ -394,12 +418,11 @@ set_tex_parameteri(struct gl_context *ctx,
return GL_FALSE;
}
ASSERT(comp < 4);
- if (swz >= 0) {
- flush(ctx);
- texObj->Swizzle[comp] = params[0];
- set_swizzle_component(&texObj->_Swizzle, comp, swz);
- return GL_TRUE;
- }
+
+ flush(ctx);
+ texObj->Swizzle[comp] = params[0];
+ set_swizzle_component(&texObj->_Swizzle, comp, swz);
+ return GL_TRUE;
}
goto invalid_pname;
@@ -597,6 +620,17 @@ _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param)
need_update = set_tex_parameteri(ctx, texObj, pname, p);
}
break;
+ case GL_TEXTURE_SWIZZLE_R_EXT:
+ case GL_TEXTURE_SWIZZLE_G_EXT:
+ case GL_TEXTURE_SWIZZLE_B_EXT:
+ case GL_TEXTURE_SWIZZLE_A_EXT:
+ {
+ GLint p[4];
+ p[0] = (GLint) param;
+ p[1] = p[2] = p[3] = 0;
+ need_update = set_tex_parameteri(ctx, texObj, pname, p);
+ }
+ break;
default:
{
/* this will generate an error if pname is illegal */
@@ -662,6 +696,22 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
break;
#endif
+ case GL_TEXTURE_SWIZZLE_R_EXT:
+ case GL_TEXTURE_SWIZZLE_G_EXT:
+ case GL_TEXTURE_SWIZZLE_B_EXT:
+ case GL_TEXTURE_SWIZZLE_A_EXT:
+ case GL_TEXTURE_SWIZZLE_RGBA_EXT:
+ {
+ GLint p[4] = {0, 0, 0, 0};
+ p[0] = (GLint) params[0];
+ if (pname == GL_TEXTURE_SWIZZLE_RGBA_EXT) {
+ p[1] = (GLint) params[1];
+ p[2] = (GLint) params[2];
+ p[3] = (GLint) params[3];
+ }
+ need_update = set_tex_parameteri(ctx, texObj, pname, p);
+ }
+ break;
default:
/* this will generate an error if pname is illegal */
need_update = set_tex_parameterf(ctx, texObj, pname, params);
@@ -1204,6 +1254,12 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
*params = (GLfloat) obj->Sampler.CubeMapSeamless;
break;
+ case GL_TEXTURE_IMMUTABLE_FORMAT:
+ if (!ctx->Extensions.ARB_texture_storage)
+ goto invalid_pname;
+ *params = (GLfloat) obj->Immutable;
+ break;
+
default:
goto invalid_pname;
}
@@ -1338,6 +1394,18 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
*params = (GLint) obj->Sampler.CubeMapSeamless;
break;
+ case GL_TEXTURE_IMMUTABLE_FORMAT:
+ if (!ctx->Extensions.ARB_texture_storage)
+ goto invalid_pname;
+ *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;
}