summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaura Ekstrand <laura@jlekstrand.net>2014-12-10 16:33:18 -0800
committerLaura Ekstrand <laura@jlekstrand.net>2015-01-08 11:37:29 -0800
commitabc688e33a6a76223af63e5d34af87e3bbbd97cd (patch)
tree08c6340fc94813fbd649a797b5faf1242597d91c
parent5ad5393f3ba6d34a2fd3e0bf0cb50139c9817175 (diff)
main: Added entry point for glTextureParameterf.
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
-rw-r--r--src/mapi/glapi/gen/ARB_direct_state_access.xml6
-rw-r--r--src/mesa/main/tests/dispatch_sanity.cpp1
-rw-r--r--src/mesa/main/texparam.c49
-rw-r--r--src/mesa/main/texparam.h20
4 files changed, 66 insertions, 10 deletions
diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml b/src/mapi/glapi/gen/ARB_direct_state_access.xml
index f54c3f8b76..0757b98635 100644
--- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
+++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
@@ -75,6 +75,12 @@
<param name="pixels" type="const GLvoid *" />
</function>
+ <function name="TextureParameterf" offset="assign">
+ <param name="texture" type="GLuint" />
+ <param name="pname" type="GLenum" />
+ <param name="param" type="GLfloat" />
+ </function>
+
<function name="BindTextureUnit" offset="assign">
<param name="unit" type="GLuint" />
<param name="texture" type="GLuint" />
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index 0ef48c9b29..af83867392 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -963,6 +963,7 @@ const struct function gl_core_functions_possible[] = {
{ "glTextureSubImage2D", 45, -1 },
{ "glTextureSubImage3D", 45, -1 },
{ "glBindTextureUnit", 45, -1 },
+ { "glTextureParameterf", 45, -1 },
{ NULL, 0, -1 }
};
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index 2f147f54bf..94e4a13520 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -756,16 +756,12 @@ invalid_enum:
}
-void GLAPIENTRY
-_mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param)
+void
+_mesa_texture_parameterf(struct gl_context *ctx,
+ struct gl_texture_object *texObj,
+ GLenum pname, GLfloat 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_FILTER:
@@ -793,16 +789,21 @@ _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param)
((param < INT_MIN) ? INT_MIN : (GLint) (param - 0.5));
p[1] = p[2] = p[3] = 0;
- need_update = set_tex_parameteri(ctx, texObj, pname, p, false);
+ need_update = set_tex_parameteri(ctx, texObj, pname, p, dsa);
}
break;
+ case GL_TEXTURE_BORDER_COLOR:
+ case GL_TEXTURE_SWIZZLE_RGBA:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glTex%sParameterf(non-scalar pname)",
+ dsa ? "ture" : "");
+ return;
default:
{
/* this will generate an error if pname is illegal */
GLfloat p[4];
p[0] = param;
p[1] = p[2] = p[3] = 0.0F;
- need_update = set_tex_parameterf(ctx, texObj, pname, p, false);
+ need_update = set_tex_parameterf(ctx, texObj, pname, p, dsa);
}
}
@@ -982,6 +983,19 @@ _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
}
}
+void GLAPIENTRY
+_mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param)
+{
+ struct gl_texture_object *texObj;
+ GET_CURRENT_CONTEXT(ctx);
+
+ texObj = get_texobj_by_target(ctx, target, GL_FALSE);
+ if (!texObj)
+ return;
+
+ _mesa_texture_parameterf(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).
@@ -1039,6 +1053,21 @@ _mesa_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
/* XXX no driver hook for TexParameterIuiv() yet */
}
+void GLAPIENTRY
+_mesa_TextureParameterf(GLuint texture, GLenum pname, GLfloat 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, "glTextureParameterf(texture)");
+ return;
+ }
+
+ _mesa_texture_parameterf(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 557a7bcb4b..a5f7c4dbb7 100644
--- a/src/mesa/main/texparam.h
+++ b/src/mesa/main/texparam.h
@@ -29,6 +29,23 @@
#include "main/glheader.h"
+/**
+ * \name Internal functions
+ */
+/*@{*/
+
+extern void
+_mesa_texture_parameterf(struct gl_context *ctx,
+ struct gl_texture_object *texObj,
+ GLenum pname, GLfloat param, bool dsa);
+
+/*@}*/
+
+/**
+ * \name API functions
+ */
+/*@{*/
+
extern void GLAPIENTRY
_mesa_GetTexLevelParameterfv( GLenum target, GLint level,
@@ -72,4 +89,7 @@ extern void GLAPIENTRY
_mesa_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params);
+extern void GLAPIENTRY
+_mesa_TextureParameterf(GLuint texture, GLenum pname, GLfloat param);
+
#endif /* TEXPARAM_H */