mesa: add EXT_dsa glCompressedMultiTex* functions
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Mon, 6 May 2019 13:23:53 +0000 (15:23 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Mon, 19 Aug 2019 22:50:05 +0000 (18:50 -0400)
Reviewed-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/tests/dispatch_sanity.cpp
src/mesa/main/texgetimage.c
src/mesa/main/texgetimage.h
src/mesa/main/teximage.c
src/mesa/main/teximage.h

index 108bbad875799c8111cebb709c608365ab87eafa..ae25bb61fddf21e97e9efc07040122cf5f37acb0 100644 (file)
       <param name="img" type="GLvoid *" />
    </function>
 
+   <function name="CompressedMultiTexImage1DEXT">
+      <param name="texunit" type="GLenum" />
+      <param name="target" type="GLenum" />
+      <param name="level" type="GLint" />
+      <param name="internalFormat" type="GLenum" />
+      <param name="width" type="GLsizei" />
+      <param name="border" type="GLsizei" />
+      <param name="imageSize" type="GLsizei" />
+      <param name="data" type="const GLvoid *" />
+   </function>
+
+   <function name="CompressedMultiTexImage2DEXT">
+      <param name="texunit" type="GLenum" />
+      <param name="target" type="GLenum" />
+      <param name="level" type="GLint" />
+      <param name="internalFormat" type="GLenum" />
+      <param name="width" type="GLsizei" />
+      <param name="height" type="GLsizei" />
+      <param name="border" type="GLsizei" />
+      <param name="imageSize" type="GLsizei" />
+      <param name="data" type="const GLvoid *" />
+   </function>
+
+   <function name="CompressedMultiTexImage3DEXT">
+      <param name="texunit" type="GLenum" />
+      <param name="target" type="GLenum" />
+      <param name="level" type="GLint" />
+      <param name="internalFormat" type="GLenum" />
+      <param name="width" type="GLsizei" />
+      <param name="height" type="GLsizei" />
+      <param name="depth" type="GLsizei" />
+      <param name="border" type="GLsizei" />
+      <param name="imageSize" type="GLsizei" />
+      <param name="data" type="const GLvoid *" />
+   </function>
+
+   <function name="CompressedMultiTexSubImage1DEXT">
+      <param name="texunit" type="GLenum" />
+      <param name="target" type="GLenum" />
+      <param name="level" type="GLint" />
+      <param name="xoffset" type="GLint" />
+      <param name="width" type="GLsizei" />
+      <param name="format" type="GLenum" />
+      <param name="imageSize" type="GLsizei" />
+      <param name="data" type="const GLvoid *" />
+   </function>
+
+   <function name="CompressedMultiTexSubImage2DEXT">
+      <param name="texunit" type="GLenum" />
+      <param name="target" type="GLenum" />
+      <param name="level" type="GLint" />
+      <param name="xoffset" type="GLint" />
+      <param name="yoffset" type="GLint" />
+      <param name="width" type="GLsizei" />
+      <param name="height" type="GLsizei" />
+      <param name="format" type="GLenum" />
+      <param name="imageSize" type="GLsizei" />
+      <param name="data" type="const GLvoid *" />
+   </function>
+
+   <function name="CompressedMultiTexSubImage3DEXT">
+      <param name="texunit" type="GLenum" />
+      <param name="target" type="GLenum" />
+      <param name="level" type="GLint" />
+      <param name="xoffset" type="GLint" />
+      <param name="yoffset" type="GLint" />
+      <param name="zoffset" type="GLint" />
+      <param name="width" type="GLsizei" />
+      <param name="height" type="GLsizei" />
+      <param name="depth" type="GLsizei" />
+      <param name="format" type="GLenum" />
+      <param name="imageSize" type="GLsizei" />
+      <param name="data" type="const GLvoid *" />
+   </function>
+
+   <function name="GetCompressedMultiTexImageEXT">
+      <param name="texunit" type="GLenum" />
+      <param name="target" type="GLenum" />
+      <param name="level" type="GLint" />
+      <param name="img" type="GLvoid *" />
+   </function>
+
    <!-- OpenGL 1.5 -->
 
    <function name="NamedBufferDataEXT">
index c9b59988864b3fd9e8b76fa85a7123d87858c29d..0c53ef1ac456f76fb7ae80e6cc1ba4de0e5a5f25 100644 (file)
@@ -1558,6 +1558,13 @@ offsets = {
     "CompressedTextureSubImage2DEXT": 1522,
     "CompressedTextureSubImage3DEXT": 1523,
     "GetCompressedTextureImageEXT": 1524,
+    "CompressedMultiTexImage1DEXT": 1525,
+    "CompressedMultiTexImage2DEXT": 1526,
+    "CompressedMultiTexImage3DEXT": 1527,
+    "CompressedMultiTexSubImage1DEXT": 1528,
+    "CompressedMultiTexSubImage2DEXT": 1529,
+    "CompressedMultiTexSubImage3DEXT": 1530,
+    "GetCompressedMultiTexImageEXT": 1531,
 }
 
 functions = [
index 6b478fded885df7f182a5a16f139dae292564816..6ccdf3f83f82b8a0ade5f7e79356ba6616611709 100644 (file)
@@ -1113,13 +1113,13 @@ const struct function common_desktop_functions_possible[] = {
    { "glCompressedTextureSubImage2DEXT", 13, -1 },
    { "glCompressedTextureSubImage3DEXT", 13, -1 },
    { "glGetCompressedTextureImageEXT", 13, -1 },
-   //{ "glCompressedMultiTexImage1DEXT", 13, -1 },
-   //{ "glCompressedMultiTexImage2DEXT", 13, -1 },
-   //{ "glCompressedMultiTexImage3DEXT", 13, -1 },
-   //{ "glCompressedMultiTexSubImage1DEXT", 13, -1 },
-   //{ "glCompressedMultiTexSubImage2DEXT", 13, -1 },
-   //{ "glCompressedMultiTexSubImage3DEXT", 13, -1 },
-   //{ "glGetCompressedMultiTexImageEXT", 13, -1 },
+   { "glCompressedMultiTexImage1DEXT", 13, -1 },
+   { "glCompressedMultiTexImage2DEXT", 13, -1 },
+   { "glCompressedMultiTexImage3DEXT", 13, -1 },
+   { "glCompressedMultiTexSubImage1DEXT", 13, -1 },
+   { "glCompressedMultiTexSubImage2DEXT", 13, -1 },
+   { "glCompressedMultiTexSubImage3DEXT", 13, -1 },
+   { "glGetCompressedMultiTexImageEXT", 13, -1 },
    { "glMatrixLoadTransposefEXT", 13, -1 },
    { "glMatrixLoadTransposedEXT", 13, -1 },
    { "glMatrixMultTransposefEXT", 13, -1 },
index 749d0b2131310c01e8772006ca98284a7fd04e7e..e43f33677fd3af8a71f60caa4b6441fec7e2d90a 100644 (file)
@@ -1895,6 +1895,36 @@ _mesa_GetCompressedTextureImageEXT(GLuint texture, GLenum target, GLint level,
 
    texObj = _mesa_lookup_or_create_texture(ctx, target, texture,
                                            false, true, caller);
+
+   get_texture_image_dims(texObj, texObj->Target, level,
+                          &width, &height, &depth);
+
+   if (getcompressedteximage_error_check(ctx, texObj, texObj->Target, level,
+                                         0, 0, 0, width, height, depth,
+                                         INT_MAX, pixels, caller)) {
+      return;
+   }
+
+   get_compressed_texture_image(ctx, texObj, texObj->Target, level,
+                                0, 0, 0, width, height, depth,
+                                pixels, caller);
+}
+
+
+void GLAPIENTRY
+_mesa_GetCompressedMultiTexImageEXT(GLenum texunit, GLenum target, GLint level,
+                                    GLvoid *pixels)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   struct gl_texture_object*  texObj;
+   GLsizei width, height, depth;
+   static const char *caller = "glGetCompressedMultiTexImageEXT";
+
+   texObj = _mesa_get_texobj_by_target_and_texunit(ctx, target,
+                                                   texunit - GL_TEXTURE0,
+                                                   false,
+                                                   caller);
+
    get_texture_image_dims(texObj, texObj->Target, level,
                           &width, &height, &depth);
 
index da87cbeea9ea4a425e943b375728fd0ccc36a00c..ab31eaa8f442fd4069450792e9c03c0e04d6186f 100644 (file)
@@ -92,6 +92,10 @@ extern void GLAPIENTRY
 _mesa_GetCompressedTextureImageEXT(GLuint texture, GLenum target, GLint level,
                                    GLvoid *pixels);
 
+extern void GLAPIENTRY
+_mesa_GetCompressedMultiTexImageEXT(GLenum texunit, GLenum target, GLint level,
+                                    GLvoid *pixels);
+
 extern void APIENTRY
 _mesa_GetCompressedTextureSubImage(GLuint texture, GLint level,
                                    GLint xoffset, GLint yoffset,
index 875d2226ad99cfadd677b9ed3de8a9cc24d9836c..498b6ae4c44ec1216e02810158e701820c04dbab 100644 (file)
@@ -5376,6 +5376,26 @@ _mesa_CompressedTextureImage1DEXT(GLuint texture, GLenum target, GLint level,
 }
 
 
+void GLAPIENTRY
+_mesa_CompressedMultiTexImage1DEXT(GLenum texunit, GLenum target, GLint level,
+                                   GLenum internalFormat, GLsizei width,
+                                   GLint border, GLsizei imageSize,
+                                   const GLvoid *pixels)
+{
+   struct gl_texture_object*  texObj;
+   GET_CURRENT_CONTEXT(ctx);
+
+   texObj = _mesa_get_texobj_by_target_and_texunit(ctx, target,
+                                                   texunit - GL_TEXTURE0,
+                                                   true,
+                                                   "glCompressedMultiTexImage1DEXT");
+   if (!texObj)
+      return;
+   teximage(ctx, GL_TRUE, 1, texObj, target, level, internalFormat,
+            width, 1, 1, border, GL_NONE, GL_NONE, imageSize, pixels, false);
+}
+
+
 void GLAPIENTRY
 _mesa_CompressedTexImage2D(GLenum target, GLint level,
                               GLenum internalFormat, GLsizei width,
@@ -5406,6 +5426,26 @@ _mesa_CompressedTextureImage2DEXT(GLuint texture, GLenum target, GLint level,
 }
 
 
+void GLAPIENTRY
+_mesa_CompressedMultiTexImage2DEXT(GLenum texunit, GLenum target, GLint level,
+                                   GLenum internalFormat, GLsizei width,
+                                   GLsizei height, GLint border, GLsizei imageSize,
+                                   const GLvoid *pixels)
+{
+   struct gl_texture_object*  texObj;
+   GET_CURRENT_CONTEXT(ctx);
+
+   texObj = _mesa_get_texobj_by_target_and_texunit(ctx, target,
+                                                   texunit - GL_TEXTURE0,
+                                                   true,
+                                                   "glCompressedMultiTexImage2DEXT");
+   if (!texObj)
+      return;
+   teximage(ctx, GL_TRUE, 2, texObj, target, level, internalFormat,
+            width, height, 1, border, GL_NONE, GL_NONE, imageSize, pixels, false);
+}
+
+
 void GLAPIENTRY
 _mesa_CompressedTexImage3D(GLenum target, GLint level,
                               GLenum internalFormat, GLsizei width,
@@ -5436,6 +5476,25 @@ _mesa_CompressedTextureImage3DEXT(GLuint texture, GLenum target, GLint level,
 }
 
 
+void GLAPIENTRY
+_mesa_CompressedMultiTexImage3DEXT(GLenum texunit, GLenum target, GLint level,
+                                   GLenum internalFormat, GLsizei width,
+                                   GLsizei height, GLsizei depth, GLint border,
+                                   GLsizei imageSize, const GLvoid *pixels)
+{
+   struct gl_texture_object*  texObj;
+   GET_CURRENT_CONTEXT(ctx);
+
+   texObj = _mesa_get_texobj_by_target_and_texunit(ctx, target,
+                                                   texunit - GL_TEXTURE0,
+                                                   true,
+                                                   "glCompressedMultiTexImage3DEXT");
+   if (!texObj)
+      return;
+   teximage(ctx, GL_TRUE, 3, texObj, target, level, internalFormat,
+            width, height, depth, border, GL_NONE, GL_NONE, imageSize, pixels, false);
+}
+
 
 void GLAPIENTRY
 _mesa_CompressedTexImage1D_no_error(GLenum target, GLint level,
@@ -5516,11 +5575,13 @@ enum tex_mode {
    TEX_MODE_DSA_ERROR,
    /* Use the specified texture name + target */
    TEX_MODE_EXT_DSA_TEXTURE,
+   /* Use the specified texture unit + target */
+   TEX_MODE_EXT_DSA_TEXUNIT,
 };
 
 
 static void
-compressed_tex_sub_image(unsigned dim, GLenum target, GLuint texture,
+compressed_tex_sub_image(unsigned dim, GLenum target, GLuint textureOrIndex,
                          GLint level, GLint xoffset, GLint yoffset,
                          GLint zoffset, GLsizei width, GLsizei height,
                          GLsizei depth, GLenum format, GLsizei imageSize,
@@ -5535,26 +5596,32 @@ compressed_tex_sub_image(unsigned dim, GLenum target, GLuint texture,
    switch (mode) {
       case TEX_MODE_DSA_ERROR:
          assert(target == 0);
-         texObj = _mesa_lookup_texture_err(ctx, texture, caller);
+         texObj = _mesa_lookup_texture_err(ctx, textureOrIndex, caller);
          if (texObj)
             target = texObj->Target;
          break;
       case TEX_MODE_DSA_NO_ERROR:
          assert(target == 0);
-         texObj = _mesa_lookup_texture(ctx, texture);
+         texObj = _mesa_lookup_texture(ctx, textureOrIndex);
          if (texObj)
             target = texObj->Target;
          no_error = true;
          break;
       case TEX_MODE_EXT_DSA_TEXTURE:
-         texObj = _mesa_lookup_or_create_texture(ctx, target, texture,
+         texObj = _mesa_lookup_or_create_texture(ctx, target, textureOrIndex,
                                                  false, true, caller);
          break;
+      case TEX_MODE_EXT_DSA_TEXUNIT:
+         texObj = _mesa_get_texobj_by_target_and_texunit(ctx, target,
+                                                         textureOrIndex,
+                                                         false,
+                                                         caller);
+         break;
       case TEX_MODE_CURRENT_ERROR:
          no_error = true;
       case TEX_MODE_CURRENT_NO_ERROR:
       default:
-         assert(texture == 0);
+         assert(textureOrIndex == 0);
          texObj = _mesa_get_current_tex_object(ctx, target);
          break;
    }
@@ -5695,6 +5762,20 @@ _mesa_CompressedTextureSubImage1DEXT(GLuint texture, GLenum target,
 }
 
 
+void GLAPIENTRY
+_mesa_CompressedMultiTexSubImage1DEXT(GLenum texunit, GLenum target,
+                                      GLint level, GLint xoffset,
+                                      GLsizei width, GLenum format,
+                                      GLsizei imageSize, const GLvoid *data)
+{
+   compressed_tex_sub_image(1, target, texunit - GL_TEXTURE0, level,
+                            xoffset, 0, 0, width, 1, 1, format, imageSize,
+                            data,
+                            TEX_MODE_EXT_DSA_TEXUNIT,
+                            "glCompressedMultiTexSubImage1DEXT");
+}
+
+
 void GLAPIENTRY
 _mesa_CompressedTexSubImage2D_no_error(GLenum target, GLint level,
                                        GLint xoffset, GLint yoffset,
@@ -5739,6 +5820,20 @@ _mesa_CompressedTextureSubImage2DEXT(GLuint texture, GLenum target,
 }
 
 
+void GLAPIENTRY
+_mesa_CompressedMultiTexSubImage2DEXT(GLenum texunit, GLenum target,
+                                      GLint level, GLint xoffset, GLint yoffset,
+                                      GLsizei width, GLsizei height, GLenum format,
+                                      GLsizei imageSize, const GLvoid *data)
+{
+   compressed_tex_sub_image(2, target, texunit - GL_TEXTURE0, level,
+                            xoffset, yoffset, 0, width, height, 1, format,
+                            imageSize, data,
+                            TEX_MODE_EXT_DSA_TEXUNIT,
+                            "glCompressedMultiTexSubImage2DEXT");
+}
+
+
 void GLAPIENTRY
 _mesa_CompressedTextureSubImage2D_no_error(GLuint texture, GLint level,
                                            GLint xoffset, GLint yoffset,
@@ -5840,6 +5935,21 @@ _mesa_CompressedTextureSubImage3DEXT(GLuint texture, GLenum target,
 }
 
 
+void GLAPIENTRY
+_mesa_CompressedMultiTexSubImage3DEXT(GLenum texunit, GLenum target,
+                                      GLint level, GLint xoffset, GLint yoffset,
+                                      GLint zoffset, GLsizei width, GLsizei height,
+                                      GLsizei depth, GLenum format,
+                                      GLsizei imageSize, const GLvoid *data)
+{
+   compressed_tex_sub_image(3, target, texunit - GL_TEXTURE0, level,
+                            xoffset, yoffset, zoffset, width, height, depth,
+                            format, imageSize, data,
+                            TEX_MODE_EXT_DSA_TEXUNIT,
+                            "glCompressedMultiTexSubImage3DEXT");
+}
+
+
 mesa_format
 _mesa_get_texbuffer_format(const struct gl_context *ctx, GLenum internalFormat)
 {
index b0211870e71a8c790d45eecb306db3533e830d35..51d555584c92ca1bdbd84dc6062202ca7c40635a 100644 (file)
@@ -601,6 +601,12 @@ _mesa_CompressedTextureImage1DEXT(GLuint texture, GLenum target, GLint level,
                                   GLint border, GLsizei imageSize,
                                   const GLvoid *pixels);
 
+extern void GLAPIENTRY
+_mesa_CompressedMultiTexImage1DEXT(GLenum texunit, GLenum target, GLint level,
+                                   GLenum internalFormat, GLsizei width,
+                                   GLint border, GLsizei imageSize,
+                                   const GLvoid *pixels);
+
 extern void GLAPIENTRY
 _mesa_CompressedTexImage2D(GLenum target, GLint level,
                               GLenum internalformat, GLsizei width,
@@ -613,6 +619,12 @@ _mesa_CompressedTextureImage2DEXT(GLuint texture, GLenum target, GLint level,
                                   GLsizei height, GLint border, GLsizei imageSize,
                                   const GLvoid *pixels);
 
+extern void GLAPIENTRY
+_mesa_CompressedMultiTexImage2DEXT(GLenum texunit, GLenum target, GLint level,
+                                   GLenum internalFormat, GLsizei width,
+                                   GLsizei height, GLint border, GLsizei imageSize,
+                                   const GLvoid *pixels);
+
 extern void GLAPIENTRY
 _mesa_CompressedTexImage3D(GLenum target, GLint level,
                               GLenum internalformat, GLsizei width,
@@ -625,6 +637,13 @@ _mesa_CompressedTextureImage3DEXT(GLuint texture, GLenum target, GLint level,
                                   GLsizei height, GLsizei depth, GLint border,
                                   GLsizei imageSize, const GLvoid *pixels);
 
+extern void GLAPIENTRY
+_mesa_CompressedMultiTexImage3DEXT(GLenum texunit, GLenum target, GLint level,
+                                   GLenum internalFormat, GLsizei width,
+                                   GLsizei height, GLsizei depth, GLint border,
+                                   GLsizei imageSize, const GLvoid *pixels);
+
+
 extern void GLAPIENTRY
 _mesa_CompressedTexImage1D_no_error(GLenum target, GLint level,
                                     GLenum internalformat, GLsizei width,
@@ -669,6 +688,12 @@ _mesa_CompressedTextureSubImage1DEXT(GLuint texture, GLenum target, GLint level,
                                      GLint xoffset, GLsizei width, GLenum format,
                                      GLsizei imageSize, const GLvoid *data);
 
+extern void GLAPIENTRY
+_mesa_CompressedMultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level,
+                                      GLint xoffset, GLsizei width, GLenum format,
+                                      GLsizei imageSize, const GLvoid *data);
+
+
 void GLAPIENTRY
 _mesa_CompressedTextureSubImage2DEXT(GLuint texture, GLenum target,
                                      GLint level, GLint xoffset,
@@ -676,6 +701,13 @@ _mesa_CompressedTextureSubImage2DEXT(GLuint texture, GLenum target,
                                      GLsizei height, GLenum format,
                                      GLsizei imageSize, const GLvoid *data);
 
+extern void GLAPIENTRY
+_mesa_CompressedMultiTexSubImage2DEXT(GLenum texunit, GLenum target,
+                                      GLint level, GLint xoffset,
+                                      GLint yoffset, GLsizei width,
+                                      GLsizei height, GLenum format,
+                                      GLsizei imageSize, const GLvoid *data);
+
 extern void GLAPIENTRY
 _mesa_CompressedTextureSubImage3DEXT(GLuint texture, GLenum target,
                                      GLint level, GLint xoffset,
@@ -684,6 +716,14 @@ _mesa_CompressedTextureSubImage3DEXT(GLuint texture, GLenum target,
                                      GLenum format, GLsizei imageSize,
                                      const GLvoid *data);
 
+extern void GLAPIENTRY
+_mesa_CompressedMultiTexSubImage3DEXT(GLenum texunit, GLenum target,
+                                      GLint level, GLint xoffset,
+                                      GLint yoffset, GLint zoffset,
+                                      GLsizei width, GLsizei height, GLsizei depth,
+                                      GLenum format, GLsizei imageSize,
+                                      const GLvoid *data);
+
 extern void GLAPIENTRY
 _mesa_CompressedTexSubImage2D_no_error(GLenum target, GLint level,
                                        GLint xoffset, GLint yoffset,