diff options
author | Ian Romanick <[email protected]> | 2011-10-03 13:03:47 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2012-08-23 10:15:29 -0700 |
commit | 842efb9447bd4c8c29599f1baeee8a380d5276c2 (patch) | |
tree | a9681669339935ac5722294ed1b13aea39ef7afb /src | |
parent | d53101a9f31e1cba553c80dbafd23c748dd58a1d (diff) |
mesa/es: Validate GL_TEXTURE_WRAP param in Mesa code rather than the ES wrapper
v2: Add proper core-profile filtering.
Signed-off-by: Ian Romanick <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/APIspec.xml | 14 | ||||
-rw-r--r-- | src/mesa/main/es1_conversion.c | 10 | ||||
-rw-r--r-- | src/mesa/main/texparam.c | 14 |
3 files changed, 12 insertions, 26 deletions
diff --git a/src/mesa/main/APIspec.xml b/src/mesa/main/APIspec.xml index c26caf6adb0..6d7dbfdc535 100644 --- a/src/mesa/main/APIspec.xml +++ b/src/mesa/main/APIspec.xml @@ -239,18 +239,8 @@ <value name="GL_TEXTURE_WRAP_S"/> <value name="GL_TEXTURE_WRAP_T"/> <value name="GL_TEXTURE_WRAP_R_OES" category="OES_texture_3D"/> - - <desc name="param"> - <value name="GL_CLAMP_TO_EDGE"/> - <value name="GL_REPEAT"/> - <value name="GL_MIRRORED_REPEAT" category="GLES2.0"/> - <value name="GL_MIRRORED_REPEAT_OES" category="OES_texture_mirrored_repeat"/> - </desc> - </desc> - - <desc name="pname"> - <value name="GL_TEXTURE_MIN_FILTER"/> - <value name="GL_TEXTURE_MAG_FILTER"/> + <value name="GL_TEXTURE_MIN_FILTER"/> + <value name="GL_TEXTURE_MAG_FILTER"/> <value name="GL_TEXTURE_MAX_ANISOTROPY_EXT" category="EXT_texture_filter_anisotropic"/> </desc> diff --git a/src/mesa/main/es1_conversion.c b/src/mesa/main/es1_conversion.c index ebd1e889f8d..0d9f5b4d580 100644 --- a/src/mesa/main/es1_conversion.c +++ b/src/mesa/main/es1_conversion.c @@ -1253,11 +1253,6 @@ _es_TexParameterx(GLenum target, GLenum pname, GLfixed param) switch(pname) { case GL_TEXTURE_WRAP_S: case GL_TEXTURE_WRAP_T: - if (param != GL_CLAMP_TO_EDGE && param != GL_REPEAT && param != GL_MIRRORED_REPEAT) { - _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, - "glTexParameterx(pname=0x%x)", pname); - return; - } convert_param_value = false; break; case GL_TEXTURE_MIN_FILTER: @@ -1310,11 +1305,6 @@ _es_TexParameterxv(GLenum target, GLenum pname, const GLfixed *params) switch(pname) { case GL_TEXTURE_WRAP_S: case GL_TEXTURE_WRAP_T: - if (params[0] != GL_CLAMP_TO_EDGE && params[0] != GL_REPEAT && params[0] != GL_MIRRORED_REPEAT) { - _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM, - "glTexParameterxv(pname=0x%x)", pname); - return; - } convert_params_value = false; n_params = 1; break; diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index a0c508caa3a..a0f736cd913 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -56,11 +56,16 @@ static GLboolean validate_texture_wrap_mode(struct gl_context * ctx, GLenum target, GLenum wrap) { const struct gl_extensions * const e = & ctx->Extensions; + const bool is_desktop_gl = _mesa_is_desktop_gl(ctx); bool supported; switch (wrap) { case GL_CLAMP: - supported = (target != GL_TEXTURE_EXTERNAL_OES); + /* GL_CLAMP was removed in the core profile, and it has never existed in + * OpenGL ES. + */ + supported = (ctx->API == API_OPENGL) + && (target != GL_TEXTURE_EXTERNAL_OES); break; case GL_CLAMP_TO_EDGE: @@ -68,7 +73,7 @@ validate_texture_wrap_mode(struct gl_context * ctx, GLenum target, GLenum wrap) break; case GL_CLAMP_TO_BORDER: - supported = e->ARB_texture_border_clamp + supported = is_desktop_gl && e->ARB_texture_border_clamp && (target != GL_TEXTURE_EXTERNAL_OES); break; @@ -80,13 +85,14 @@ validate_texture_wrap_mode(struct gl_context * ctx, GLenum target, GLenum wrap) case GL_MIRROR_CLAMP_EXT: case GL_MIRROR_CLAMP_TO_EDGE_EXT: - supported = (e->ATI_texture_mirror_once || e->EXT_texture_mirror_clamp) + supported = is_desktop_gl + && (e->ATI_texture_mirror_once || e->EXT_texture_mirror_clamp) && (target != GL_TEXTURE_RECTANGLE_NV) && (target != GL_TEXTURE_EXTERNAL_OES); break; case GL_MIRROR_CLAMP_TO_BORDER_EXT: - supported = e->EXT_texture_mirror_clamp + supported = is_desktop_gl && e->EXT_texture_mirror_clamp && (target != GL_TEXTURE_RECTANGLE_NV) && (target != GL_TEXTURE_EXTERNAL_OES); break; |