[Mesa-dev] [PATCH 24/41] main: Added entry point for glGetTextureParameterfv.

Laura Ekstrand laura at jlekstrand.net
Mon Dec 15 17:22:39 PST 2014


---
 src/mapi/glapi/gen/ARB_direct_state_access.xml |  6 +++
 src/mesa/main/texparam.c                       | 51 +++++++++++++++++++++-----
 src/mesa/main/texparam.h                       |  5 ++-
 3 files changed, 50 insertions(+), 12 deletions(-)

diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml b/src/mapi/glapi/gen/ARB_direct_state_access.xml
index c4213eb..b70380a 100644
--- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
+++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
@@ -130,5 +130,11 @@
       <param name="params" type="GLint *" />
    </function>
 
+   <function name="GetTextureParameterfv" offset="assign">
+      <param name="texture" type="GLuint" />
+      <param name="pname" type="GLenum" />
+      <param name="params" type="GLfloat *" />
+   </function>
+
 </category>
 </OpenGLAPI>
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index 51fbd2a..a4dd751 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -1691,16 +1691,15 @@ _mesa_GetTextureLevelParameteriv( GLuint texture, GLint level,
                              pname, params, "glGetTextureLevelParameteriv");
 }
 
-void GLAPIENTRY
-_mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
+/**
+ * This isn't exposed to the rest of the driver because it is a part of the
+ * OpenGL API that is rarely used.
+ */
+static void
+get_tex_parameterfv( struct gl_context *ctx,
+                     struct gl_texture_object *obj,
+                     GLenum pname, GLfloat *params, bool dsa )
 {
-   struct gl_texture_object *obj;
-   GET_CURRENT_CONTEXT(ctx);
-
-   obj = get_texobj(ctx, target, GL_TRUE);
-   if (!obj)
-      return;
-
    _mesa_lock_context_textures(ctx);
    switch (pname) {
       case GL_TEXTURE_MAG_FILTER:
@@ -1913,7 +1912,8 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
 
 invalid_pname:
    _mesa_unlock_context_textures(ctx);
-   _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameterfv(pname=0x%x)", pname);
+   _mesa_error(ctx, GL_INVALID_ENUM, "glGetTex%sParameterfv(pname=0x%x)",
+               dsa ? "ture" : "", pname);
 }
 
 
@@ -2138,6 +2138,19 @@ invalid_pname:
    _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameteriv(pname=0x%x)", pname);
 }
 
+void GLAPIENTRY
+_mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
+{
+   struct gl_texture_object *obj;
+   GET_CURRENT_CONTEXT(ctx);
+
+   obj = get_texobj(ctx, target, GL_TRUE);
+   if (!obj)
+      return;
+
+   get_tex_parameterfv(ctx, obj, pname, params, false);
+}
+
 
 /** New in GL 3.0 */
 void GLAPIENTRY
@@ -2189,3 +2202,21 @@ _mesa_GetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params)
       }
    }
 }
+
+
+void GLAPIENTRY
+_mesa_GetTextureParameterfv( GLuint texture, GLenum pname, GLfloat *params )
+{
+   struct gl_texture_object *obj;
+   GET_CURRENT_CONTEXT(ctx);
+
+   obj = get_texobj_by_name(ctx, texture, GL_TRUE);
+   if (!obj) {
+      /* User passed a non-generated name. */
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "glGetTextureParameterfv(texture)");
+      return;
+   }
+
+   get_tex_parameterfv(ctx, obj, pname, params, true);
+}
diff --git a/src/mesa/main/texparam.h b/src/mesa/main/texparam.h
index 05aeb8a..a3fefce 100644
--- a/src/mesa/main/texparam.h
+++ b/src/mesa/main/texparam.h
@@ -103,19 +103,20 @@ _mesa_GetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params);
 
 
 extern void GLAPIENTRY
+_mesa_GetTextureParameterfv( GLuint texture, GLenum pname, GLfloat *params );
+
+extern void GLAPIENTRY
 _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params );
 
 extern void GLAPIENTRY
 _mesa_TexParameterf( GLenum target, GLenum pname, GLfloat param );
 
-
 extern void GLAPIENTRY
 _mesa_TexParameteri( GLenum target, GLenum pname, GLint param );
 
 extern void GLAPIENTRY
 _mesa_TexParameteriv( GLenum target, GLenum pname, const GLint *params );
 
-
 extern void GLAPIENTRY
 _mesa_TexParameterIiv(GLenum target, GLenum pname, const GLint *params);
 
-- 
2.1.0



More information about the mesa-dev mailing list