From d954f6023b80d9dd87f697c831f21ecdb831d13b Mon Sep 17 00:00:00 2001 From: Laura Ekstrand Date: Wed, 10 Dec 2014 16:57:50 -0800 Subject: [PATCH] main: Added entry points for glTextureParameteriv, Iiv, Iuiv. Reviewed-by: Anuj Phogat --- .../glapi/gen/ARB_direct_state_access.xml | 18 +++ src/mesa/main/tests/dispatch_sanity.cpp | 3 + src/mesa/main/texparam.c | 145 ++++++++++++++---- src/mesa/main/texparam.h | 24 +++ 4 files changed, 156 insertions(+), 34 deletions(-) diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml b/src/mapi/glapi/gen/ARB_direct_state_access.xml index 68c6ebe3882..9658fd18e67 100644 --- a/src/mapi/glapi/gen/ARB_direct_state_access.xml +++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml @@ -93,6 +93,24 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp index 8d7f37a4e54..fdb1febf78d 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -966,6 +966,9 @@ const struct function gl_core_functions_possible[] = { { "glTextureParameterf", 45, -1 }, { "glTextureParameterfv", 45, -1 }, { "glTextureParameteri", 45, -1 }, + { "glTextureParameterIiv", 45, -1 }, + { "glTextureParameterIuiv", 45, -1 }, + { "glTextureParameteriv", 45, -1 }, { NULL, 0, -1 } }; diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 0121ddd26ec..8527a6464c9 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -926,16 +926,12 @@ _mesa_texture_parameteri(struct gl_context *ctx, } -void GLAPIENTRY -_mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params) +void +_mesa_texture_parameteriv(struct gl_context *ctx, + struct gl_texture_object *texObj, + GLenum pname, const GLint *params, bool dsa) { GLboolean need_update; - struct gl_texture_object *texObj; - GET_CURRENT_CONTEXT(ctx); - - texObj = get_texobj_by_target(ctx, target, GL_FALSE); - if (!texObj) - return; switch (pname) { case GL_TEXTURE_BORDER_COLOR: @@ -946,7 +942,7 @@ _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params) fparams[1] = INT_TO_FLOAT(params[1]); fparams[2] = INT_TO_FLOAT(params[2]); fparams[3] = INT_TO_FLOAT(params[3]); - need_update = set_tex_parameterf(ctx, texObj, pname, fparams, false); + need_update = set_tex_parameterf(ctx, texObj, pname, fparams, dsa); } break; case GL_TEXTURE_MIN_LOD: @@ -960,12 +956,12 @@ _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params) GLfloat fparams[4]; fparams[0] = (GLfloat) params[0]; fparams[1] = fparams[2] = fparams[3] = 0.0F; - need_update = set_tex_parameterf(ctx, texObj, pname, fparams, false); + need_update = set_tex_parameterf(ctx, texObj, pname, fparams, dsa); } break; default: /* this will generate an error if pname is illegal */ - need_update = set_tex_parameteri(ctx, texObj, pname, params, false); + need_update = set_tex_parameteri(ctx, texObj, pname, params, dsa); } if (ctx->Driver.TexParameter && need_update) { @@ -981,6 +977,43 @@ _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params) } } +void +_mesa_texture_parameterIiv(struct gl_context *ctx, + struct gl_texture_object *texObj, + GLenum pname, const GLint *params, bool dsa) +{ + switch (pname) { + case GL_TEXTURE_BORDER_COLOR: + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + /* set the integer-valued border color */ + COPY_4V(texObj->Sampler.BorderColor.i, params); + break; + default: + _mesa_texture_parameteriv(ctx, texObj, pname, params, dsa); + break; + } + /* XXX no driver hook for TexParameterIiv() yet */ +} + +void +_mesa_texture_parameterIuiv(struct gl_context *ctx, + struct gl_texture_object *texObj, + GLenum pname, const GLuint *params, bool dsa) +{ + switch (pname) { + case GL_TEXTURE_BORDER_COLOR: + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + /* set the unsigned integer-valued border color */ + COPY_4V(texObj->Sampler.BorderColor.ui, params); + break; + default: + _mesa_texture_parameteriv(ctx, texObj, pname, (const GLint *) params, + dsa); + break; + } + /* XXX no driver hook for TexParameterIuiv() yet */ +} + void GLAPIENTRY _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param) { @@ -1020,6 +1053,19 @@ _mesa_TexParameteri(GLenum target, GLenum pname, GLint param) _mesa_texture_parameteri(ctx, texObj, pname, param, false); } +void GLAPIENTRY +_mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params) +{ + struct gl_texture_object *texObj; + GET_CURRENT_CONTEXT(ctx); + + texObj = get_texobj_by_target(ctx, target, GL_FALSE); + if (!texObj) + return; + + _mesa_texture_parameteriv(ctx, texObj, pname, params, false); +} + /** * Set tex parameter to integer value(s). Primarily intended to set * integer-valued texture border color (for integer-valued textures). @@ -1035,20 +1081,9 @@ _mesa_TexParameterIiv(GLenum target, GLenum pname, const GLint *params) if (!texObj) return; - switch (pname) { - case GL_TEXTURE_BORDER_COLOR: - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - /* set the integer-valued border color */ - COPY_4V(texObj->Sampler.BorderColor.i, params); - break; - default: - _mesa_TexParameteriv(target, pname, params); - break; - } - /* XXX no driver hook for TexParameterIiv() yet */ + _mesa_texture_parameterIiv(ctx, texObj, pname, params, false); } - /** * Set tex parameter to unsigned integer value(s). Primarily intended to set * uint-valued texture border color (for integer-valued textures). @@ -1064,17 +1099,7 @@ _mesa_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params) if (!texObj) return; - switch (pname) { - case GL_TEXTURE_BORDER_COLOR: - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - /* set the unsigned integer-valued border color */ - COPY_4V(texObj->Sampler.BorderColor.ui, params); - break; - default: - _mesa_TexParameteriv(target, pname, (const GLint *) params); - break; - } - /* XXX no driver hook for TexParameterIuiv() yet */ + _mesa_texture_parameterIuiv(ctx, texObj, pname, params, false); } @@ -1126,6 +1151,58 @@ _mesa_TextureParameteri(GLuint texture, GLenum pname, GLint param) _mesa_texture_parameteri(ctx, texObj, pname, param, true); } +void GLAPIENTRY +_mesa_TextureParameteriv(GLuint texture, GLenum pname, + const GLint *params) +{ + struct gl_texture_object *texObj; + GET_CURRENT_CONTEXT(ctx); + + texObj = get_texobj_by_name(ctx, texture, GL_FALSE); + if (!texObj) { + /* User passed a non-generated name. */ + _mesa_error(ctx, GL_INVALID_OPERATION, "glTextureParameteriv(texture)"); + return; + } + + _mesa_texture_parameteriv(ctx, texObj, pname, params, true); +} + + +void GLAPIENTRY +_mesa_TextureParameterIiv(GLuint texture, GLenum pname, const GLint *params) +{ + struct gl_texture_object *texObj; + GET_CURRENT_CONTEXT(ctx); + + texObj = get_texobj_by_name(ctx, texture, GL_FALSE); + if (!texObj) { + /* User passed a non-generated name. */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTextureParameterIiv(texture)"); + return; + } + + _mesa_texture_parameterIiv(ctx, texObj, pname, params, true); +} + +void GLAPIENTRY +_mesa_TextureParameterIuiv(GLuint texture, GLenum pname, const GLuint *params) +{ + struct gl_texture_object *texObj; + GET_CURRENT_CONTEXT(ctx); + + texObj = get_texobj_by_name(ctx, texture, GL_FALSE); + if (!texObj) { + /* User passed a non-generated name. */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTextureParameterIuiv(texture)"); + return; + } + + _mesa_texture_parameterIuiv(ctx, texObj, pname, params, true); +} + static GLboolean legal_get_tex_level_parameter_target(struct gl_context *ctx, GLenum target) { diff --git a/src/mesa/main/texparam.h b/src/mesa/main/texparam.h index 98b9068ae72..8911219d1f1 100644 --- a/src/mesa/main/texparam.h +++ b/src/mesa/main/texparam.h @@ -50,6 +50,21 @@ _mesa_texture_parameteri(struct gl_context *ctx, struct gl_texture_object *texObj, GLenum pname, GLint param, bool dsa); +extern void +_mesa_texture_parameteriv(struct gl_context *ctx, + struct gl_texture_object *texObj, + GLenum pname, const GLint *params, bool dsa); + +extern void +_mesa_texture_parameterIiv(struct gl_context *ctx, + struct gl_texture_object *texObj, + GLenum pname, const GLint *params, bool dsa); + +extern void +_mesa_texture_parameterIuiv(struct gl_context *ctx, + struct gl_texture_object *texObj, + GLenum pname, const GLuint *params, bool dsa); + /*@}*/ /** @@ -108,4 +123,13 @@ _mesa_TextureParameterf(GLuint texture, GLenum pname, GLfloat param); extern void GLAPIENTRY _mesa_TextureParameteri(GLuint texture, GLenum pname, GLint param); +extern void GLAPIENTRY +_mesa_TextureParameteriv(GLuint texture, GLenum pname, const GLint *params); + +extern void GLAPIENTRY +_mesa_TextureParameterIiv(GLuint texture, GLenum pname, const GLint *params); + +extern void GLAPIENTRY +_mesa_TextureParameterIuiv(GLuint texture, GLenum pname, const GLuint *params); + #endif /* TEXPARAM_H */ -- 2.30.2