mesa: add EXT_dsa glMultiTexSubImage1D/2D/3DEXT
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Tue, 30 Apr 2019 12:47:31 +0000 (14:47 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 6 Aug 2019 21:03:16 +0000 (17:03 -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/dlist.c
src/mesa/main/tests/dispatch_sanity.cpp
src/mesa/main/teximage.c
src/mesa/main/teximage.h

index 10142414fbcf17d89904f3006b2e60e1057af96b..3eb62d20eef1fcf5e0bf871c061dee2c00659b35 100644 (file)
       <param name="pixels" type="const GLvoid*" />
    </function>
 
+   <function name="MultiTexSubImage1DEXT">
+      <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="type" type="GLenum" />
+      <param name="pixels" type="const GLvoid*" />
+   </function>
+
+   <function name="MultiTexSubImage2DEXT">
+      <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="type" type="GLenum" />
+      <param name="pixels" type="const GLvoid*" />
+   </function>
+
+   <function name="MultiTexSubImage3DEXT">
+      <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="type" type="GLenum" />
+      <param name="pixels" type="const GLvoid*" />
+   </function>
+
    <!-- OpenGL 1.3 -->
 
    <function name="MatrixLoadTransposefEXT" offset="assign">
index 2d243c479bff340cdbdaa3e5ca47d68b46ff2bb2..ff71436953521c24466cf1c42b8b399f7310f381 100644 (file)
@@ -1531,6 +1531,9 @@ offsets = {
     "MultiTexImage1DEXT": 1495,
     "MultiTexImage2DEXT": 1496,
     "MultiTexImage3DEXT": 1497,
+    "MultiTexSubImage1DEXT": 1498,
+    "MultiTexSubImage2DEXT": 1499,
+    "MultiTexSubImage3DEXT": 1500,
 }
 
 functions = [
index ab83546bf74fd1deb85932bd8557adf93a9d1c73..d62c87bcd5979f6c108389a40e59eef297114462 100644 (file)
@@ -587,6 +587,9 @@ typedef enum
    OPCODE_MULTITEX_IMAGE1D,
    OPCODE_MULTITEX_IMAGE2D,
    OPCODE_MULTITEX_IMAGE3D,
+   OPCODE_MULTITEX_SUB_IMAGE1D,
+   OPCODE_MULTITEX_SUB_IMAGE2D,
+   OPCODE_MULTITEX_SUB_IMAGE3D,
    OPCODE_MULTITEXENV,
    OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D,
 
@@ -1236,13 +1239,16 @@ _mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist)
             free(get_pointer(&n[11]));
             break;
          case OPCODE_TEXTURE_SUB_IMAGE1D:
+         case OPCODE_MULTITEX_SUB_IMAGE1D:
             free(get_pointer(&n[8]));
             break;
          case OPCODE_TEXTURE_SUB_IMAGE2D:
+         case OPCODE_MULTITEX_SUB_IMAGE2D:
          case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D:
             free(get_pointer(&n[10]));
             break;
          case OPCODE_TEXTURE_SUB_IMAGE3D:
+         case OPCODE_MULTITEX_SUB_IMAGE3D:
             free(get_pointer(&n[12]));
             break;
          case OPCODE_CONTINUE:
@@ -10115,6 +10121,105 @@ save_MultiTexImage3DEXT(GLenum texunit, GLenum target,
 }
 
 
+static void GLAPIENTRY
+save_MultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
+                   GLsizei width, GLenum format, GLenum type,
+                   const GLvoid * pixels)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+
+   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+
+   n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE1D, 7 + POINTER_DWORDS);
+   if (n) {
+      n[1].e = texunit;
+      n[2].e = target;
+      n[3].i = level;
+      n[4].i = xoffset;
+      n[5].i = (GLint) width;
+      n[6].e = format;
+      n[7].e = type;
+      save_pointer(&n[8],
+                   unpack_image(ctx, 1, width, 1, 1, format, type,
+                                pixels, &ctx->Unpack));
+   }
+   if (ctx->ExecuteFlag) {
+      CALL_MultiTexSubImage1DEXT(ctx->Exec, (texunit, target, level, xoffset, width,
+                                            format, type, pixels));
+   }
+}
+
+
+static void GLAPIENTRY
+save_MultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level,
+                          GLint xoffset, GLint yoffset,
+                          GLsizei width, GLsizei height,
+                          GLenum format, GLenum type, const GLvoid * pixels)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+
+   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+
+   n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE2D, 9 + POINTER_DWORDS);
+   if (n) {
+      n[1].e = texunit;
+      n[2].e = target;
+      n[3].i = level;
+      n[4].i = xoffset;
+      n[5].i = yoffset;
+      n[6].i = (GLint) width;
+      n[7].i = (GLint) height;
+      n[8].e = format;
+      n[9].e = type;
+      save_pointer(&n[10],
+                   unpack_image(ctx, 2, width, height, 1, format, type,
+                                pixels, &ctx->Unpack));
+   }
+   if (ctx->ExecuteFlag) {
+      CALL_MultiTexSubImage2DEXT(ctx->Exec, (texunit, target, level, xoffset, yoffset,
+                                            width, height, format, type, pixels));
+   }
+}
+
+
+static void GLAPIENTRY
+save_MultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level,
+                          GLint xoffset, GLint yoffset, GLint zoffset,
+                          GLsizei width, GLsizei height, GLsizei depth,
+                          GLenum format, GLenum type, const GLvoid * pixels)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+
+   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+
+   n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE3D, 11 + POINTER_DWORDS);
+   if (n) {
+      n[1].e = texunit;
+      n[2].e = target;
+      n[3].i = level;
+      n[4].i = xoffset;
+      n[5].i = yoffset;
+      n[6].i = zoffset;
+      n[7].i = (GLint) width;
+      n[8].i = (GLint) height;
+      n[9].i = (GLint) depth;
+      n[10].e = format;
+      n[11].e = type;
+      save_pointer(&n[12],
+                   unpack_image(ctx, 3, width, height, depth, format, type,
+                                pixels, &ctx->Unpack));
+   }
+   if (ctx->ExecuteFlag) {
+      CALL_MultiTexSubImage3DEXT(ctx->Exec, (texunit, target, level,
+                                            xoffset, yoffset, zoffset,
+                                            width, height, depth, format, type,
+                                            pixels));
+   }
+}
+
 
 static void GLAPIENTRY
 save_MultiTexEnvfvEXT(GLenum texunit, GLenum target, GLenum pname, const GLfloat *params)
@@ -11984,6 +12089,39 @@ execute_list(struct gl_context *ctx, GLuint list)
                ctx->Unpack = save;      /* restore */
             }
             break;
+         case OPCODE_MULTITEX_SUB_IMAGE1D:
+            {
+               const struct gl_pixelstore_attrib save = ctx->Unpack;
+               ctx->Unpack = ctx->DefaultPacking;
+               CALL_MultiTexSubImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
+                                                     n[4].i, n[5].i, n[6].e,
+                                                     n[7].e, get_pointer(&n[8])));
+               ctx->Unpack = save;      /* restore */
+            }
+            break;
+         case OPCODE_MULTITEX_SUB_IMAGE2D:
+            {
+               const struct gl_pixelstore_attrib save = ctx->Unpack;
+               ctx->Unpack = ctx->DefaultPacking;
+               CALL_MultiTexSubImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
+                                                     n[4].i, n[5].i, n[6].e,
+                                                     n[7].i, n[8].e, n[9].e,
+                                                     get_pointer(&n[10])));
+               ctx->Unpack = save;      /* restore */
+            }
+            break;
+         case OPCODE_MULTITEX_SUB_IMAGE3D:
+            {
+               const struct gl_pixelstore_attrib save = ctx->Unpack;
+               ctx->Unpack = ctx->DefaultPacking;
+               CALL_MultiTexSubImage3DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
+                                                     n[4].i, n[5].i, n[6].i,
+                                                     n[7].i, n[8].i, n[9].i,
+                                                     n[10].e, n[11].e,
+                                                     get_pointer(&n[12])));
+               ctx->Unpack = save;      /* restore */
+            }
+            break;
          case OPCODE_MULTITEXENV:
             {
                GLfloat params[4];
@@ -13015,6 +13153,9 @@ _mesa_initialize_save_table(const struct gl_context *ctx)
    SET_MultiTexImage1DEXT(table, save_MultiTexImage1DEXT);
    SET_MultiTexImage2DEXT(table, save_MultiTexImage2DEXT);
    SET_MultiTexImage3DEXT(table, save_MultiTexImage3DEXT);
+   SET_MultiTexSubImage1DEXT(table, save_MultiTexSubImage1DEXT);
+   SET_MultiTexSubImage2DEXT(table, save_MultiTexSubImage2DEXT);
+   SET_MultiTexSubImage3DEXT(table, save_MultiTexSubImage3DEXT);
    SET_MultiTexEnvfEXT(table, save_MultiTexEnvfEXT);
    SET_MultiTexEnvfvEXT(table, save_MultiTexEnvfvEXT);
    SET_MultiTexEnviEXT(table, save_MultiTexEnviEXT);
index b1e80fd5dfbc34f263b71b8b8dc995a842c2cd55..bb5ba961a68a48d37800c835b636c8a381729bef 100644 (file)
@@ -1078,8 +1078,8 @@ const struct function common_desktop_functions_possible[] = {
    { "glMultiTexParameterivEXT", 12, -1 },
    { "glMultiTexImage1DEXT", 12, -1 },
    { "glMultiTexImage2DEXT", 12, -1 },
-   //{ "glMultiTexSubImage1DEXT", 12, -1 },
-   //{ "glMultiTexSubImage2DEXT", 12, -1 },
+   { "glMultiTexSubImage1DEXT", 12, -1 },
+   { "glMultiTexSubImage2DEXT", 12, -1 },
    //{ "glCopyMultiTexImage1DEXT", 12, -1 },
    //{ "glCopyMultiTexImage2DEXT", 12, -1 },
    //{ "glCopyMultiTexSubImage1DEXT", 12, -1 },
@@ -1090,7 +1090,7 @@ const struct function common_desktop_functions_possible[] = {
    //{ "glGetMultiTexLevelParameterfvEXT", 12, -1 },
    //{ "glGetMultiTexLevelParameterivEXT", 12, -1 },
    { "glMultiTexImage3DEXT", 12, -1 },
-   //{ "glMultiTexSubImage3DEXT", 12, -1 },
+   { "glMultiTexSubImage3DEXT", 12, -1 },
    //{ "glCopyMultiTexSubImage3DEXT", 12, -1 },
    { "glEnableClientStateIndexedEXT", 12, -1 },
    { "glDisableClientStateIndexedEXT", 12, -1 },
index ac950c2051bd7bfd638a9fa109508e6f93fc1c10..fdb9ae886b8476248e2bdf0e215b209da62f93b2 100644 (file)
@@ -3814,6 +3814,28 @@ _mesa_TextureSubImage1DEXT(GLuint texture, GLenum target, GLint level,
 }
 
 
+void GLAPIENTRY
+_mesa_MultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level,
+                            GLint xoffset, GLsizei width,
+                            GLenum format, GLenum type,
+                            const GLvoid *pixels)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   struct gl_texture_object *texObj;
+   struct gl_texture_image *texImage;
+
+   texObj = _mesa_get_texobj_by_target_and_texunit(ctx, target,
+                                                   texunit - GL_TEXTURE0,
+                                                   false,
+                                                   "glMultiTexImage1DEXT");
+   texImage = _mesa_select_tex_image(texObj, target, level);
+
+   texture_sub_image(ctx, 1, texObj, texImage, target, level,
+                     xoffset, 0, 0, width, 1, 1,
+                     format, type, pixels);
+}
+
+
 void GLAPIENTRY
 _mesa_TextureSubImage1D(GLuint texture, GLint level,
                         GLint xoffset, GLsizei width,
@@ -3853,6 +3875,28 @@ _mesa_TextureSubImage2DEXT(GLuint texture, GLenum target, GLint level,
 }
 
 
+void GLAPIENTRY
+_mesa_MultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level,
+                            GLint xoffset, GLint yoffset, GLsizei width,
+                            GLsizei height, GLenum format, GLenum type,
+                            const GLvoid *pixels)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   struct gl_texture_object *texObj;
+   struct gl_texture_image *texImage;
+
+   texObj = _mesa_get_texobj_by_target_and_texunit(ctx, target,
+                                                   texunit - GL_TEXTURE0,
+                                                   false,
+                                                   "glMultiTexImage2DEXT");
+   texImage = _mesa_select_tex_image(texObj, target, level);
+
+   texture_sub_image(ctx, 2, texObj, texImage, target, level,
+                     xoffset, yoffset, 0, width, height, 1,
+                     format, type, pixels);
+}
+
+
 void GLAPIENTRY
 _mesa_TextureSubImage2D(GLuint texture, GLint level,
                         GLint xoffset, GLint yoffset,
@@ -3879,6 +3923,7 @@ _mesa_TextureSubImage3D_no_error(GLuint texture, GLint level, GLint xoffset,
                             pixels, "glTextureSubImage3D", false);
 }
 
+
 void GLAPIENTRY
 _mesa_TextureSubImage3DEXT(GLuint texture, GLenum target, GLint level,
                            GLint xoffset, GLint yoffset, GLint zoffset,
@@ -3891,6 +3936,29 @@ _mesa_TextureSubImage3DEXT(GLuint texture, GLenum target, GLint level,
                          pixels, "glTextureSubImage3DEXT", true);
 }
 
+
+void GLAPIENTRY
+_mesa_MultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level,
+                           GLint xoffset, GLint yoffset, GLint zoffset,
+                           GLsizei width, GLsizei height, GLsizei depth,
+                           GLenum format, GLenum type, const GLvoid *pixels)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   struct gl_texture_object *texObj;
+   struct gl_texture_image *texImage;
+
+   texObj = _mesa_get_texobj_by_target_and_texunit(ctx, target,
+                                                   texunit - GL_TEXTURE0,
+                                                   false,
+                                                   "glMultiTexImage3DEXT");
+   texImage = _mesa_select_tex_image(texObj, target, level);
+
+   texture_sub_image(ctx, 3, texObj, texImage, target, level,
+                     xoffset, yoffset, zoffset, width, height, depth,
+                     format, type, pixels);
+}
+
+
 void GLAPIENTRY
 _mesa_TextureSubImage3D(GLuint texture, GLint level,
                         GLint xoffset, GLint yoffset, GLint zoffset,
index 49f0937ca20f80045bb5bdc13c8ea26277a2c115..57af2f401421152ed8e47d87007b0a5149699945 100644 (file)
@@ -387,12 +387,24 @@ _mesa_TextureSubImage1DEXT(GLuint texture, GLenum target, GLint level,
                         GLenum format, GLenum type,
                         const GLvoid *pixels);
 
+extern void GLAPIENTRY
+_mesa_MultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level,
+                            GLint xoffset, GLsizei width,
+                            GLenum format, GLenum type,
+                            const GLvoid *pixels);
+
 void GLAPIENTRY
 _mesa_TextureSubImage2DEXT(GLuint texture, GLenum target, GLint level,
                            GLint xoffset, GLint yoffset, GLsizei width,
                            GLsizei height, GLenum format, GLenum type,
                            const GLvoid *pixels);
 
+extern void GLAPIENTRY
+_mesa_MultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level,
+                            GLint xoffset, GLint yoffset, GLsizei width,
+                            GLsizei height, GLenum format, GLenum type,
+                            const GLvoid *pixels);
+
 void GLAPIENTRY
 _mesa_TextureSubImage2D_no_error(GLuint texture, GLint level, GLint xoffset,
                                  GLint yoffset, GLsizei width, GLsizei height,
@@ -426,6 +438,13 @@ _mesa_TextureSubImage3DEXT(GLuint texture, GLenum target,
                         GLsizei depth, GLenum format, GLenum type,
                         const GLvoid *pixels);
 
+extern void GLAPIENTRY
+_mesa_MultiTexSubImage3DEXT(GLenum texunit, GLenum target,
+                            GLint level, GLint xoffset, GLint yoffset,
+                            GLint zoffset, GLsizei width, GLsizei height,
+                            GLsizei depth, GLenum format, GLenum type,
+                            const GLvoid *pixels);
+
 extern void GLAPIENTRY
 _mesa_CopyTexImage1D(GLenum target, GLint level, GLenum internalformat,
                      GLint x, GLint y, GLsizei width, GLint border);