mesa: add glTextureParameteri/iv/f/fvEXT
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Tue, 4 Jun 2019 12:11:46 +0000 (14:11 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Fri, 28 Jun 2019 19:41:34 +0000 (15:41 -0400)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
src/mapi/glapi/gen/EXT_direct_state_access.xml
src/mapi/glapi/gen/static_data.py
src/mesa/main/dlist.c
src/mesa/main/tests/dispatch_sanity.cpp
src/mesa/main/texparam.c
src/mesa/main/texparam.h

index 37f443bb9b50ebbd1c41e0d17a55e9e64724474d..63ce189c766cc1eba143ec3c3385e9814a0e6cb4 100644 (file)
 
    <!-- OpenGL 1.1 -->
 
+    <function name="GetTextureParameterivEXT">
+       <param name="texture" type="GLuint" />
+       <param name="target" type="GLenum" />
+       <param name="pname" type="GLenum" />
+       <param name="params" type="GLint *" />
+    </function>
+
+    <function name="GetTextureParameterfvEXT">
+       <param name="texture" type="GLuint" />
+       <param name="target" type="GLenum" />
+       <param name="pname" type="GLenum" />
+       <param name="params" type="float *" />
+    </function>
+
+    <function name="TextureParameteriEXT">
+       <param name="texture" type="GLuint" />
+       <param name="target" type="GLenum" />
+       <param name="pname" type="GLenum" />
+       <param name="param" type="int" />
+    </function>
+
+    <function name="TextureParameterivEXT">
+       <param name="texture" type="GLuint" />
+       <param name="target" type="GLenum" />
+       <param name="pname" type="GLenum" />
+       <param name="params" type="const GLint *" />
+    </function>
+
+    <function name="TextureParameterfEXT">
+       <param name="texture" type="GLuint" />
+       <param name="target" type="GLenum" />
+       <param name="pname" type="GLenum" />
+       <param name="param" type="float" />
+    </function>
+
+    <function name="TextureParameterfvEXT">
+       <param name="texture" type="GLuint" />
+       <param name="target" type="GLenum" />
+       <param name="pname" type="GLenum" />
+       <param name="params" type="const float *" />
+    </function>
+
    <function name="TextureSubImage2DEXT">
       <param name="texture" type="GLuint" />
       <param name="target" type="GLenum" />
index 006b5bb8152636890f1dad3fa34b8729f83c6d22..2372f991edd969ca6604ecb059f96fc97598c7ed 100644 (file)
@@ -1481,6 +1481,12 @@ offsets = {
     "TextureSubImage2DEXT": 1445,
     "CompressedTextureSubImage2DEXT": 1446,
     "MapNamedBufferEXT": 1447,
+    "GetTextureParameterivEXT": 1448,
+    "GetTextureParameterfvEXT": 1449,
+    "TextureParameteriEXT": 1450,
+    "TextureParameterivEXT": 1451,
+    "TextureParameterfEXT": 1452,
+    "TextureParameterfvEXT": 1453,
 }
 
 functions = [
index 0b035aa7b1bdc186ec25d3d4d04ae06c2e8eebd7..b07449b2133d2924a6a8ce77c544d007892deaa4 100644 (file)
@@ -568,6 +568,8 @@ typedef enum
    OPCODE_MATRIX_FRUSTUM,
    OPCODE_MATRIX_PUSH,
    OPCODE_MATRIX_POP,
+   OPCODE_TEXTUREPARAMETER_F,
+   OPCODE_TEXTUREPARAMETER_I,
 
    /* The following three are meta instructions */
    OPCODE_ERROR,                /* raise compiled-in error */
@@ -9461,6 +9463,68 @@ save_MatrixMultTransposedEXT(GLenum matrixMode, const GLdouble m[16])
    save_MatrixMultfEXT(matrixMode, tm);
 }
 
+static void GLAPIENTRY
+save_TextureParameterfvEXT(GLuint texture, GLenum target, GLenum pname,
+                           const GLfloat *params)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+   n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_F, 7);
+   if (n) {
+      n[1].ui = texture;
+      n[2].e = target;
+      n[3].e = pname;
+      n[4].f = params[0];
+      n[5].f = params[1];
+      n[6].f = params[2];
+      n[7].f = params[3];
+   }
+   if (ctx->ExecuteFlag) {
+      CALL_TextureParameterfvEXT(ctx->Exec, (texture, target, pname, params));
+   }
+}
+
+
+static void GLAPIENTRY
+save_TextureParameterfEXT(GLuint texture, GLenum target, GLenum pname, GLfloat param)
+{
+   GLfloat parray[4];
+   parray[0] = param;
+   parray[1] = parray[2] = parray[3] = 0.0F;
+   save_TextureParameterfvEXT(texture, target, pname, parray);
+}
+
+static void GLAPIENTRY
+save_TextureParameterivEXT(GLuint texture, GLenum target, GLenum pname, const GLint *params)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+   n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_I, 7);
+   if (n) {
+      n[1].ui = texture;
+      n[2].e = target;
+      n[3].e = pname;
+      n[4].i = params[0];
+      n[5].i = params[1];
+      n[6].i = params[2];
+      n[7].i = params[3];
+   }
+   if (ctx->ExecuteFlag) {
+      CALL_TextureParameterivEXT(ctx->Exec, (texture, target, pname, params));
+   }
+}
+
+static void GLAPIENTRY
+save_TextureParameteriEXT(GLuint texture, GLenum target, GLenum pname, GLint param)
+{
+   GLint fparam[4];
+   fparam[0] = param;
+   fparam[1] = fparam[2] = fparam[3] = 0;
+   save_TextureParameterivEXT(texture, target, pname, fparam);
+}
+
 
 /**
  * Save an error-generating command into display list.
@@ -11027,6 +11091,26 @@ execute_list(struct gl_context *ctx, GLuint list)
          case OPCODE_MATRIX_POP:
             CALL_MatrixPopEXT(ctx->Exec, (n[1].e));
             break;
+         case OPCODE_TEXTUREPARAMETER_F:
+            {
+               GLfloat params[4];
+               params[0] = n[4].f;
+               params[1] = n[5].f;
+               params[2] = n[6].f;
+               params[3] = n[7].f;
+               CALL_TextureParameterfvEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
+            }
+            break;
+         case OPCODE_TEXTUREPARAMETER_I:
+            {
+               GLint params[4];
+               params[0] = n[4].i;
+               params[1] = n[5].i;
+               params[2] = n[6].i;
+               params[3] = n[7].i;
+               CALL_TextureParameterivEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
+            }
+            break;
 
          case OPCODE_CONTINUE:
             n = (Node *) get_pointer(&n[1]);
@@ -12019,6 +12103,10 @@ _mesa_initialize_save_table(const struct gl_context *ctx)
    SET_MatrixLoadTransposedEXT(table, save_MatrixLoadTransposedEXT);
    SET_MatrixMultTransposefEXT(table, save_MatrixMultTransposefEXT);
    SET_MatrixMultTransposedEXT(table, save_MatrixMultTransposedEXT);
+   SET_TextureParameteriEXT(table, save_TextureParameteriEXT);
+   SET_TextureParameterivEXT(table, save_TextureParameterivEXT);
+   SET_TextureParameterfEXT(table, save_TextureParameterfEXT);
+   SET_TextureParameterfvEXT(table, save_TextureParameterfvEXT);
 }
 
 
index a524c58caf4014a312058a01c4d175e0661d7bbc..a8751e3b69e6fd7ba4f78e1266cc2483b3fbcf91 100644 (file)
@@ -1033,10 +1033,10 @@ const struct function common_desktop_functions_possible[] = {
    /* GL_EXT_direct_state_access - GL 1.1 */
    //{ "glClientAttribDefaultEXT", 11, -1 },
    //{ "glPushClientAttribDefaultEXT", 11, -1 },
-   //{ "glTextureParameteriEXT", 11, -1 },
-   //{ "glTextureParameterivEXT", 11, -1 },
-   //{ "glTextureParameterfEXT", 11, -1 },
-   //{ "glTextureParameterfvEXT", 11, -1 },
+   { "glTextureParameteriEXT", 11, -1 },
+   { "glTextureParameterivEXT", 11, -1 },
+   { "glTextureParameterfEXT", 11, -1 },
+   { "glTextureParameterfvEXT", 11, -1 },
    //{ "glTextureImage1DEXT", 11, -1 },
    //{ "glTextureImage2DEXT", 11, -1 },
    //{ "glTextureSubImage1DEXT", 11, -1 },
@@ -1046,8 +1046,8 @@ const struct function common_desktop_functions_possible[] = {
    //{ "glCopyTextureSubImage1DEXT", 11, -1 },
    //{ "glCopyTextureSubImage2DEXT", 11, -1 },
    //{ "glGetTextureImageEXT", 11, -1 },
-   //{ "glGetTextureParameterfvEXT", 11, -1 },
-   //{ "glGetTextureParameterivEXT", 11, -1 },
+   { "glGetTextureParameterfvEXT", 11, -1 },
+   { "glGetTextureParameterivEXT", 11, -1 },
    //{ "glGetTextureLevelParameterfvEXT", 11, -1 },
    //{ "glGetTextureLevelParameterivEXT", 11, -1 },
    /* GL_EXT_direct_state_access - GL 1.2 */
index a81036041d112996c85d48482667c9e86e67fc8a..64bd0b63566e6320ca0fedee63f9d21bf49e2eb8 100644 (file)
@@ -1178,6 +1178,24 @@ _mesa_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
    _mesa_texture_parameterIuiv(ctx, texObj, pname, params, false);
 }
 
+void GLAPIENTRY
+_mesa_TextureParameterfvEXT(GLuint texture, GLenum target, GLenum pname, const GLfloat *params)
+{
+   struct gl_texture_object *texObj;
+   GET_CURRENT_CONTEXT(ctx);
+
+   texObj = _mesa_lookup_or_create_texture(ctx, target, texture, false, true,
+                                           "glTextureParameterfvEXT");
+   if (!texObj)
+      return;
+
+   if (!is_texparameteri_target_valid(texObj->Target)) {
+      _mesa_error(ctx, GL_INVALID_OPERATION, "glTextureParameterfvEXT");
+      return;
+   }
+
+   _mesa_texture_parameterfv(ctx, texObj, pname, params, true);
+}
 
 void GLAPIENTRY
 _mesa_TextureParameterfv(GLuint texture, GLenum pname, const GLfloat *params)
@@ -1192,6 +1210,25 @@ _mesa_TextureParameterfv(GLuint texture, GLenum pname, const GLfloat *params)
    _mesa_texture_parameterfv(ctx, texObj, pname, params, true);
 }
 
+void GLAPIENTRY
+_mesa_TextureParameterfEXT(GLuint texture, GLenum target, GLenum pname, GLfloat param)
+{
+   struct gl_texture_object *texObj;
+   GET_CURRENT_CONTEXT(ctx);
+
+   texObj = _mesa_lookup_or_create_texture(ctx, target, texture, false, true,
+                                           "glTextureParameterfEXT");
+   if (!texObj)
+      return;
+
+   if (!is_texparameteri_target_valid(texObj->Target)) {
+      _mesa_error(ctx, GL_INVALID_OPERATION, "glTextureParameterfEXT");
+      return;
+   }
+
+   _mesa_texture_parameterf(ctx, texObj, pname, param, true);
+}
+
 void GLAPIENTRY
 _mesa_TextureParameterf(GLuint texture, GLenum pname, GLfloat param)
 {
@@ -1205,6 +1242,25 @@ _mesa_TextureParameterf(GLuint texture, GLenum pname, GLfloat param)
    _mesa_texture_parameterf(ctx, texObj, pname, param, true);
 }
 
+void GLAPIENTRY
+_mesa_TextureParameteriEXT(GLuint texture, GLenum target, GLenum pname, GLint param)
+{
+   struct gl_texture_object *texObj;
+   GET_CURRENT_CONTEXT(ctx);
+
+   texObj = _mesa_lookup_or_create_texture(ctx, target, texture, false, true,
+                                           "glTextureParameteriEXT");
+   if (!texObj)
+      return;
+
+   if (!is_texparameteri_target_valid(texObj->Target)) {
+      _mesa_error(ctx, GL_INVALID_OPERATION, "glTextureParameteriEXT(target)");
+      return;
+   }
+
+   _mesa_texture_parameteri(ctx, texObj, pname, param, true);
+}
+
 void GLAPIENTRY
 _mesa_TextureParameteri(GLuint texture, GLenum pname, GLint param)
 {
@@ -1218,6 +1274,26 @@ _mesa_TextureParameteri(GLuint texture, GLenum pname, GLint param)
    _mesa_texture_parameteri(ctx, texObj, pname, param, true);
 }
 
+void GLAPIENTRY
+_mesa_TextureParameterivEXT(GLuint texture, GLenum target, GLenum pname,
+                         const GLint *params)
+{
+   struct gl_texture_object *texObj;
+   GET_CURRENT_CONTEXT(ctx);
+
+   texObj = _mesa_lookup_or_create_texture(ctx, target, texture, false, true,
+                                           "glTextureParameterivEXT");
+   if (!texObj)
+      return;
+
+   if (!is_texparameteri_target_valid(texObj->Target)) {
+      _mesa_error(ctx, GL_INVALID_OPERATION, "glTextureParameterivEXT(target)");
+      return;
+   }
+
+   _mesa_texture_parameteriv(ctx, texObj, pname, params, true);
+}
+
 void GLAPIENTRY
 _mesa_TextureParameteriv(GLuint texture, GLenum pname,
                          const GLint *params)
@@ -2376,6 +2452,24 @@ _mesa_GetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params)
    get_tex_parameterIiv(ctx, texObj, pname, (GLint *) params, false);
 }
 
+void GLAPIENTRY
+_mesa_GetTextureParameterfvEXT(GLuint texture, GLenum target, GLenum pname, GLfloat *params)
+{
+   struct gl_texture_object *texObj;
+   GET_CURRENT_CONTEXT(ctx);
+
+   texObj = _mesa_lookup_or_create_texture(ctx, target, texture, false, true,
+                                           "glGetTextureParameterfvEXT");
+   if (!texObj)
+      return;
+
+   if (!is_texparameteri_target_valid(texObj->Target)) {
+      _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTextureParameterfvEXT");
+      return;
+   }
+
+   get_tex_parameterfv(ctx, texObj, pname, params, true);
+}
 
 void GLAPIENTRY
 _mesa_GetTextureParameterfv(GLuint texture, GLenum pname, GLfloat *params)
@@ -2390,6 +2484,24 @@ _mesa_GetTextureParameterfv(GLuint texture, GLenum pname, GLfloat *params)
    get_tex_parameterfv(ctx, obj, pname, params, true);
 }
 
+void GLAPIENTRY
+_mesa_GetTextureParameterivEXT(GLuint texture, GLenum target, GLenum pname, GLint *params)
+{
+   struct gl_texture_object *texObj;
+   GET_CURRENT_CONTEXT(ctx);
+
+   texObj = _mesa_lookup_or_create_texture(ctx, target, texture, false, true,
+                                           "glGetTextureParameterivEXT");
+   if (!texObj)
+      return;
+
+   if (!is_texparameteri_target_valid(texObj->Target)) {
+      _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTextureParameterivEXT");
+      return;
+   }
+   get_tex_parameteriv(ctx, texObj, pname, params, true);
+ }
+
 void GLAPIENTRY
 _mesa_GetTextureParameteriv(GLuint texture, GLenum pname, GLint *params)
 {
index b2f6a847337950cdcfdaef542fcc4d9c7055023e..130d32f2c761e1b0b02ac268b9eb4e06c541f862 100644 (file)
@@ -109,10 +109,15 @@ _mesa_GetTexParameterIiv(GLenum target, GLenum pname, GLint *params);
 extern void GLAPIENTRY
 _mesa_GetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params);
 
+extern void GLAPIENTRY
+_mesa_GetTextureParameterfvEXT(GLuint texture, GLenum target, GLenum pname, GLfloat *params);
 
 extern void GLAPIENTRY
 _mesa_GetTextureParameterfv(GLuint texture, GLenum pname, GLfloat *params);
 
+extern void GLAPIENTRY
+_mesa_GetTextureParameterivEXT(GLuint texture, GLenum target, GLenum pname, GLint *params );
+
 extern void GLAPIENTRY
 _mesa_GetTextureParameteriv(GLuint texture, GLenum pname, GLint *params);
 
@@ -141,15 +146,27 @@ _mesa_TexParameterIiv(GLenum target, GLenum pname, const GLint *params);
 extern void GLAPIENTRY
 _mesa_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params);
 
+extern void GLAPIENTRY
+_mesa_TextureParameterfvEXT(GLuint texture, GLenum target, GLenum pname, const GLfloat *params);
+
 extern void GLAPIENTRY
 _mesa_TextureParameterfv(GLuint texture, GLenum pname, const GLfloat *params);
 
+extern void GLAPIENTRY
+_mesa_TextureParameterfEXT(GLuint texture, GLenum target, GLenum pname, GLfloat param);
+
 extern void GLAPIENTRY
 _mesa_TextureParameterf(GLuint texture, GLenum pname, GLfloat param);
 
+extern void GLAPIENTRY
+_mesa_TextureParameteriEXT(GLuint texture, GLenum target, GLenum pname, GLint param);
+
 extern void GLAPIENTRY
 _mesa_TextureParameteri(GLuint texture, GLenum pname, GLint param);
 
+extern void GLAPIENTRY
+_mesa_TextureParameterivEXT(GLuint texture, GLenum target, GLenum pname, const GLint *params);
+
 extern void GLAPIENTRY
 _mesa_TextureParameteriv(GLuint texture, GLenum pname, const GLint *params);