summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorLaura Ekstrand <[email protected]>2015-01-05 16:48:34 -0800
committerLaura Ekstrand <[email protected]>2015-01-08 11:37:29 -0800
commit354d789f3b6212402b880ba8ef9ba9a57afea038 (patch)
tree4b27a529cea28fc27dd5d5e58dc45c52c4dfbb2b /src/mesa
parent2ce5db3930ca3441b5647b907531c24e058b45ff (diff)
main: Added entry point for glTextureParameteri.
Reviewed-by: Anuj Phogat <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/texparam.c54
-rw-r--r--src/mesa/main/texparam.h9
2 files changed, 52 insertions, 11 deletions
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index 4843f9c49ab..0121ddd26ec 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -880,17 +880,12 @@ _mesa_texture_parameterfv(struct gl_context *ctx,
}
-void GLAPIENTRY
-_mesa_TexParameteri(GLenum target, GLenum pname, GLint param)
+void
+_mesa_texture_parameteri(struct gl_context *ctx,
+ struct gl_texture_object *texObj,
+ GLenum pname, GLint param, 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_MIN_LOD:
case GL_TEXTURE_MAX_LOD:
@@ -903,16 +898,24 @@ _mesa_TexParameteri(GLenum target, GLenum pname, GLint param)
fparam[0] = (GLfloat) param;
fparam[1] = fparam[2] = fparam[3] = 0.0F;
/* convert int param to float */
- need_update = set_tex_parameterf(ctx, texObj, pname, fparam, false);
+ need_update = set_tex_parameterf(ctx, texObj, pname, fparam, dsa);
}
break;
+ case GL_TEXTURE_BORDER_COLOR:
+ case GL_TEXTURE_SWIZZLE_RGBA:
+ {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTex%sParameteri(non-scalar pname)",
+ dsa ? "ture" : "");
+ return;
+ }
default:
/* this will generate an error if pname is illegal */
{
GLint iparam[4];
iparam[0] = param;
iparam[1] = iparam[2] = iparam[3] = 0;
- need_update = set_tex_parameteri(ctx, texObj, pname, iparam, false);
+ need_update = set_tex_parameteri(ctx, texObj, pname, iparam, dsa);
}
}
@@ -1004,6 +1007,19 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
_mesa_texture_parameterfv(ctx, texObj, pname, params, false);
}
+void GLAPIENTRY
+_mesa_TexParameteri(GLenum target, GLenum pname, GLint param)
+{
+ struct gl_texture_object *texObj;
+ GET_CURRENT_CONTEXT(ctx);
+
+ texObj = get_texobj_by_target(ctx, target, GL_FALSE);
+ if (!texObj)
+ return;
+
+ _mesa_texture_parameteri(ctx, texObj, pname, param, false);
+}
+
/**
* Set tex parameter to integer value(s). Primarily intended to set
* integer-valued texture border color (for integer-valued textures).
@@ -1094,6 +1110,22 @@ _mesa_TextureParameterf(GLuint texture, GLenum pname, GLfloat param)
_mesa_texture_parameterf(ctx, texObj, pname, param, true);
}
+void GLAPIENTRY
+_mesa_TextureParameteri(GLuint texture, GLenum pname, GLint param)
+{
+ 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, "glTextureParameteri(texture)");
+ return;
+ }
+
+ _mesa_texture_parameteri(ctx, texObj, pname, param, 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 cf3efec88f6..98b9068ae72 100644
--- a/src/mesa/main/texparam.h
+++ b/src/mesa/main/texparam.h
@@ -44,6 +44,12 @@ _mesa_texture_parameterfv(struct gl_context *ctx,
struct gl_texture_object *texObj,
GLenum pname, const GLfloat *params, bool dsa);
+
+extern void
+_mesa_texture_parameteri(struct gl_context *ctx,
+ struct gl_texture_object *texObj,
+ GLenum pname, GLint param, bool dsa);
+
/*@}*/
/**
@@ -99,4 +105,7 @@ _mesa_TextureParameterfv(GLuint texture, GLenum pname, const GLfloat *params);
extern void GLAPIENTRY
_mesa_TextureParameterf(GLuint texture, GLenum pname, GLfloat param);
+extern void GLAPIENTRY
+_mesa_TextureParameteri(GLuint texture, GLenum pname, GLint param);
+
#endif /* TEXPARAM_H */