mesa: add EXT_dsa glCopyMultiTexImage* and glCopyMultiTexSubImage*
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Tue, 30 Apr 2019 13:42:39 +0000 (15:42 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 6 Aug 2019 21:03:19 +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 8d567bd881600bbcad6465e49a408abd269c24a2..0cb4a47ef57a43503fc354476917b8745601c527 100644 (file)
       <param name="pixels" type="const GLvoid*" />
    </function>
 
+   <function name="CopyMultiTexImage1DEXT">
+      <param name="texunit" type="GLenum" />
+      <param name="target" type="GLenum" />
+      <param name="level" type="GLint" />
+      <param name="internalformat" type="GLenum" />
+      <param name="x" type="GLint" />
+      <param name="y" type="GLint" />
+      <param name="width" type="GLsizei" />
+      <param name="border" type="GLint" />
+   </function>
+
+   <function name="CopyMultiTexImage2DEXT">
+      <param name="texunit" type="GLenum" />
+      <param name="target" type="GLenum" />
+      <param name="level" type="GLint" />
+      <param name="internalformat" type="GLenum" />
+      <param name="x" type="GLint" />
+      <param name="y" type="GLint" />
+      <param name="width" type="GLsizei" />
+      <param name="height" type="GLsizei" />
+      <param name="border" type="GLint" />
+   </function>
+
+   <function name="CopyMultiTexSubImage1DEXT">
+      <param name="texunit" type="GLenum" />
+      <param name="target" type="GLenum" />
+      <param name="level" type="GLint" />
+      <param name="xoffset" type="GLint" />
+      <param name="x" type="GLint" />
+      <param name="y" type="GLint" />
+      <param name="width" type="GLsizei" />
+   </function>
+
+   <function name="CopyMultiTexSubImage2DEXT">
+      <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="x" type="GLint" />
+      <param name="y" type="GLint" />
+      <param name="width" type="GLsizei" />
+      <param name="height" type="GLsizei" />
+   </function>
+
+   <function name="CopyMultiTexSubImage3DEXT">
+      <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="x" type="GLint" />
+      <param name="y" type="GLint" />
+      <param name="width" type="GLsizei" />
+      <param name="height" type="GLsizei" />
+   </function>
+
    <!-- OpenGL 1.3 -->
 
    <function name="MatrixLoadTransposefEXT" offset="assign">
index 5d92f61b4ea51f742cdf984b7a30f37e8ec86d7f..a74de70897a24005d62d9967b07d1190811d6ebd 100644 (file)
@@ -1536,6 +1536,11 @@ offsets = {
     "MultiTexSubImage3DEXT": 1500,
     "GetMultiTexParameterivEXT": 1501,
     "GetMultiTexParameterfvEXT": 1502,
+    "CopyMultiTexImage1DEXT": 1503,
+    "CopyMultiTexImage2DEXT": 1504,
+    "CopyMultiTexSubImage1DEXT": 1505,
+    "CopyMultiTexSubImage2DEXT": 1506,
+    "CopyMultiTexSubImage3DEXT": 1507,
 }
 
 functions = [
index d62c87bcd5979f6c108389a40e59eef297114462..be77c386d621fedc7245bd93a94935e839e9d2ed 100644 (file)
@@ -590,6 +590,11 @@ typedef enum
    OPCODE_MULTITEX_SUB_IMAGE1D,
    OPCODE_MULTITEX_SUB_IMAGE2D,
    OPCODE_MULTITEX_SUB_IMAGE3D,
+   OPCODE_COPY_MULTITEX_IMAGE1D,
+   OPCODE_COPY_MULTITEX_IMAGE2D,
+   OPCODE_COPY_MULTITEX_SUB_IMAGE1D,
+   OPCODE_COPY_MULTITEX_SUB_IMAGE2D,
+   OPCODE_COPY_MULTITEX_SUB_IMAGE3D,
    OPCODE_MULTITEXENV,
    OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D,
 
@@ -10221,6 +10226,143 @@ save_MultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level,
 }
 
 
+static void GLAPIENTRY
+save_CopyMultiTexImage1DEXT(GLenum texunit, GLenum target, GLint level,
+                           GLenum internalformat, GLint x, GLint y,
+                           GLsizei width, GLint border)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+   n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_IMAGE1D, 8);
+   if (n) {
+      n[1].e = texunit;
+      n[2].e = target;
+      n[3].i = level;
+      n[4].e = internalformat;
+      n[5].i = x;
+      n[6].i = y;
+      n[7].i = width;
+      n[8].i = border;
+   }
+   if (ctx->ExecuteFlag) {
+      CALL_CopyMultiTexImage1DEXT(ctx->Exec, (texunit, target, level,
+                                             internalformat, x, y,
+                                             width, border));
+   }
+}
+
+
+static void GLAPIENTRY
+save_CopyMultiTexImage2DEXT(GLenum texunit, GLenum target, GLint level,
+                           GLenum internalformat,
+                           GLint x, GLint y, GLsizei width,
+                           GLsizei height, GLint border)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+   n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_IMAGE2D, 9);
+   if (n) {
+      n[1].e = texunit;
+      n[2].e = target;
+      n[3].i = level;
+      n[4].e = internalformat;
+      n[5].i = x;
+      n[6].i = y;
+      n[7].i = width;
+      n[8].i = height;
+      n[9].i = border;
+   }
+   if (ctx->ExecuteFlag) {
+      CALL_CopyMultiTexImage2DEXT(ctx->Exec, (texunit, target, level,
+                                             internalformat, x, y,
+                                             width, height, border));
+   }
+}
+
+
+static void GLAPIENTRY
+save_CopyMultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level,
+                              GLint xoffset, GLint x, GLint y, GLsizei width)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+   n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_SUB_IMAGE1D, 7);
+   if (n) {
+      n[1].e = texunit;
+      n[2].e = target;
+      n[3].i = level;
+      n[4].i = xoffset;
+      n[5].i = x;
+      n[6].i = y;
+      n[7].i = width;
+   }
+   if (ctx->ExecuteFlag) {
+      CALL_CopyMultiTexSubImage1DEXT(ctx->Exec,
+                             (texunit, target, level, xoffset, x, y, width));
+   }
+}
+
+
+static void GLAPIENTRY
+save_CopyMultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level,
+                              GLint xoffset, GLint yoffset,
+                              GLint x, GLint y, GLsizei width, GLint height)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+   n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_SUB_IMAGE2D, 9);
+   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 = x;
+      n[7].i = y;
+      n[8].i = width;
+      n[9].i = height;
+   }
+   if (ctx->ExecuteFlag) {
+      CALL_CopyMultiTexSubImage2DEXT(ctx->Exec, (texunit, target, level,
+                                                xoffset, yoffset,
+                                                x, y, width, height));
+   }
+}
+
+
+static void GLAPIENTRY
+save_CopyMultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level,
+                              GLint xoffset, GLint yoffset, GLint zoffset,
+                              GLint x, GLint y, GLsizei width, GLint height)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+   n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_SUB_IMAGE3D, 10);
+   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 = x;
+      n[8].i = y;
+      n[9].i = width;
+      n[10].i = height;
+   }
+   if (ctx->ExecuteFlag) {
+      CALL_CopyMultiTexSubImage3DEXT(ctx->Exec, (texunit, target, level,
+                                                xoffset, yoffset, zoffset,
+                                                x, y, width, height));
+   }
+}
+
+
 static void GLAPIENTRY
 save_MultiTexEnvfvEXT(GLenum texunit, GLenum target, GLenum pname, const GLfloat *params)
 {
@@ -12122,6 +12264,32 @@ execute_list(struct gl_context *ctx, GLuint list)
                ctx->Unpack = save;      /* restore */
             }
             break;
+         case OPCODE_COPY_MULTITEX_IMAGE1D:
+            CALL_CopyMultiTexImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
+                                                   n[4].e, n[5].i, n[6].i,
+                                                   n[7].i, n[8].i));
+            break;
+         case OPCODE_COPY_MULTITEX_IMAGE2D:
+            CALL_CopyMultiTexImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
+                                                   n[4].e, n[5].i, n[6].i,
+                                                   n[7].i, n[8].i, n[9].i));
+            break;
+         case OPCODE_COPY_MULTITEX_SUB_IMAGE1D:
+            CALL_CopyMultiTexSubImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
+                                                      n[4].i, n[5].i, n[6].i,
+                                                      n[7].i));
+            break;
+         case OPCODE_COPY_MULTITEX_SUB_IMAGE2D:
+            CALL_CopyMultiTexSubImage2DEXT(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));
+            break;
+         case OPCODE_COPY_MULTITEX_SUB_IMAGE3D:
+            CALL_CopyMultiTexSubImage3DEXT(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].i));
+            break;
          case OPCODE_MULTITEXENV:
             {
                GLfloat params[4];
@@ -13156,6 +13324,11 @@ _mesa_initialize_save_table(const struct gl_context *ctx)
    SET_MultiTexSubImage1DEXT(table, save_MultiTexSubImage1DEXT);
    SET_MultiTexSubImage2DEXT(table, save_MultiTexSubImage2DEXT);
    SET_MultiTexSubImage3DEXT(table, save_MultiTexSubImage3DEXT);
+   SET_CopyMultiTexImage1DEXT(table, save_CopyMultiTexImage1DEXT);
+   SET_CopyMultiTexImage2DEXT(table, save_CopyMultiTexImage2DEXT);
+   SET_CopyMultiTexSubImage1DEXT(table, save_CopyMultiTexSubImage1DEXT);
+   SET_CopyMultiTexSubImage2DEXT(table, save_CopyMultiTexSubImage2DEXT);
+   SET_CopyMultiTexSubImage3DEXT(table, save_CopyMultiTexSubImage3DEXT);
    SET_MultiTexEnvfEXT(table, save_MultiTexEnvfEXT);
    SET_MultiTexEnvfvEXT(table, save_MultiTexEnvfvEXT);
    SET_MultiTexEnviEXT(table, save_MultiTexEnviEXT);
index a0e7bc58f754db409be36785807a55f263cbb285..3653597bb2e83b7cb49bbe2b7c5a240fbc26c76f 100644 (file)
@@ -1080,10 +1080,10 @@ const struct function common_desktop_functions_possible[] = {
    { "glMultiTexImage2DEXT", 12, -1 },
    { "glMultiTexSubImage1DEXT", 12, -1 },
    { "glMultiTexSubImage2DEXT", 12, -1 },
-   //{ "glCopyMultiTexImage1DEXT", 12, -1 },
-   //{ "glCopyMultiTexImage2DEXT", 12, -1 },
-   //{ "glCopyMultiTexSubImage1DEXT", 12, -1 },
-   //{ "glCopyMultiTexSubImage2DEXT", 12, -1 },
+   { "glCopyMultiTexImage1DEXT", 12, -1 },
+   { "glCopyMultiTexImage2DEXT", 12, -1 },
+   { "glCopyMultiTexSubImage1DEXT", 12, -1 },
+   { "glCopyMultiTexSubImage2DEXT", 12, -1 },
    { "glGetMultiTexImageEXT", 12, -1 },
    { "glGetMultiTexParameterfvEXT", 12, -1 },
    { "glGetMultiTexParameterivEXT", 12, -1 },
@@ -1091,7 +1091,7 @@ const struct function common_desktop_functions_possible[] = {
    //{ "glGetMultiTexLevelParameterivEXT", 12, -1 },
    { "glMultiTexImage3DEXT", 12, -1 },
    { "glMultiTexSubImage3DEXT", 12, -1 },
-   //{ "glCopyMultiTexSubImage3DEXT", 12, -1 },
+   { "glCopyMultiTexSubImage3DEXT", 12, -1 },
    { "glEnableClientStateIndexedEXT", 12, -1 },
    { "glDisableClientStateIndexedEXT", 12, -1 },
    { "glGetPointerIndexedvEXT", 12, -1 },
index fdb9ae886b8476248e2bdf0e215b209da62f93b2..352ccf2d660ea4c6c0688555b23ad39e063f6ab6 100644 (file)
@@ -4381,6 +4381,25 @@ _mesa_CopyTextureImage1DEXT( GLuint texture, GLenum target, GLint level,
 }
 
 
+void GLAPIENTRY
+_mesa_CopyMultiTexImage1DEXT( GLenum texunit, GLenum target, GLint level,
+                              GLenum internalFormat,
+                              GLint x, GLint y,
+                              GLsizei width, GLint border )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   struct gl_texture_object* texObj =
+      _mesa_get_texobj_by_target_and_texunit(ctx, target,
+                                             texunit - GL_TEXTURE0,
+                                             false,
+                                             "glCopyMultiTexImage1DEXT");
+   if (!texObj)
+      return;
+   copyteximage(ctx, 1, texObj, target, level, internalFormat, x, y, width, 1,
+                border, false);
+}
+
+
 void GLAPIENTRY
 _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat,
                       GLint x, GLint y, GLsizei width, GLsizei height,
@@ -4410,6 +4429,25 @@ _mesa_CopyTextureImage2DEXT( GLuint texture, GLenum target, GLint level,
 }
 
 
+void GLAPIENTRY
+_mesa_CopyMultiTexImage2DEXT( GLenum texunit, GLenum target, GLint level,
+                              GLenum internalFormat,
+                              GLint x, GLint y,
+                              GLsizei width, GLsizei height, GLint border )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   struct gl_texture_object* texObj =
+      _mesa_get_texobj_by_target_and_texunit(ctx, target,
+                                             texunit - GL_TEXTURE0,
+                                             false,
+                                             "glCopyMultiTexImage2DEXT");
+   if (!texObj)
+      return;
+   copyteximage(ctx, 2, texObj, target, level, internalFormat, x, y, width, height,
+                border, false);
+}
+
+
 void GLAPIENTRY
 _mesa_CopyTexImage1D_no_error(GLenum target, GLint level, GLenum internalFormat,
                               GLint x, GLint y, GLsizei width, GLint border)
@@ -4560,6 +4598,25 @@ _mesa_CopyTextureSubImage1DEXT(GLuint texture, GLenum target, GLint level,
 }
 
 
+void GLAPIENTRY
+_mesa_CopyMultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level,
+                                GLint xoffset, GLint x, GLint y, GLsizei width)
+{
+   struct gl_texture_object* texObj;
+   const char *self = "glCopyMultiTexSubImage1DEXT";
+   GET_CURRENT_CONTEXT(ctx);
+
+   texObj = _mesa_get_texobj_by_target_and_texunit(ctx, target,
+                                                   texunit - GL_TEXTURE0,
+                                                   false, self);
+   if (!texObj)
+      return;
+
+   copy_texture_sub_image_err(ctx, 1, texObj, texObj->Target, level, xoffset, 0,
+                              0, x, y, width, 1, self);
+}
+
+
 void GLAPIENTRY
 _mesa_CopyTextureSubImage2D(GLuint texture, GLint level,
                             GLint xoffset, GLint yoffset,
@@ -4610,6 +4667,25 @@ _mesa_CopyTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level,
 }
 
 
+void GLAPIENTRY
+_mesa_CopyMultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level,
+                               GLint xoffset, GLint yoffset,
+                               GLint x, GLint y, GLsizei width, GLsizei height)
+{
+   struct gl_texture_object* texObj;
+   const char *self = "glCopyMultiTexSubImage2DEXT";
+   GET_CURRENT_CONTEXT(ctx);
+
+   texObj = _mesa_get_texobj_by_target_and_texunit(ctx, target,
+                                                   texunit - GL_TEXTURE0,
+                                                   false, self);
+   if (!texObj)
+      return;
+
+   copy_texture_sub_image_err(ctx, 2, texObj, texObj->Target, level, xoffset,
+                              yoffset, 0, x, y, width, height, self);
+}
+
 void GLAPIENTRY
 _mesa_CopyTextureSubImage3D(GLuint texture, GLint level,
                             GLint xoffset, GLint yoffset, GLint zoffset,
@@ -4676,6 +4752,34 @@ _mesa_CopyTextureSubImage3DEXT(GLuint texture, GLenum target, GLint level,
 }
 
 
+void GLAPIENTRY
+_mesa_CopyMultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level,
+                                GLint xoffset, GLint yoffset, GLint zoffset,
+                                GLint x, GLint y, GLsizei width, GLsizei height)
+{
+   struct gl_texture_object* texObj;
+   const char *self = "glCopyMultiTexSubImage3D";
+   GET_CURRENT_CONTEXT(ctx);
+
+   texObj = _mesa_get_texobj_by_target_and_texunit(ctx, target,
+                                                   texunit - GL_TEXTURE0,
+                                                   false, self);
+   if (!texObj)
+      return;
+
+   if (texObj->Target == GL_TEXTURE_CUBE_MAP) {
+      /* Act like CopyTexSubImage2D */
+      copy_texture_sub_image_err(ctx, 2, texObj,
+                                GL_TEXTURE_CUBE_MAP_POSITIVE_X + zoffset,
+                                level, xoffset, yoffset, 0, x, y, width, height,
+                                self);
+   }
+   else
+      copy_texture_sub_image_err(ctx, 3, texObj, texObj->Target, level, xoffset,
+                                 yoffset, zoffset, x, y, width, height, self);
+}
+
+
 void GLAPIENTRY
 _mesa_CopyTexSubImage1D_no_error(GLenum target, GLint level, GLint xoffset,
                                  GLint x, GLint y, GLsizei width)
index 57af2f401421152ed8e47d87007b0a5149699945..891fa16565c2b79312db1775eaf5b604be2bf6d9 100644 (file)
@@ -449,12 +449,21 @@ extern void GLAPIENTRY
 _mesa_CopyTexImage1D(GLenum target, GLint level, GLenum internalformat,
                      GLint x, GLint y, GLsizei width, GLint border);
 
+extern void GLAPIENTRY
+_mesa_CopyMultiTexImage1DEXT(GLenum texunit, GLenum target, GLint level,
+                             GLenum internalformat, GLint x, GLint y,
+                             GLsizei width, GLint border);
 
 extern void GLAPIENTRY
 _mesa_CopyTexImage2D( GLenum target, GLint level,
                       GLenum internalformat, GLint x, GLint y,
                       GLsizei width, GLsizei height, GLint border );
 
+extern void GLAPIENTRY
+_mesa_CopyMultiTexImage2DEXT(GLenum texunit, GLenum target, GLint level,
+                             GLenum internalformat, GLint x, GLint y,
+                             GLsizei width, GLsizei hright, GLint border);
+
 extern void GLAPIENTRY
 _mesa_CopyTextureImage1DEXT( GLuint texture, GLenum target, GLint level,
                              GLenum internalformat, GLint x, GLint y,
@@ -501,6 +510,11 @@ _mesa_CopyTextureSubImage1DEXT(GLuint texture, GLenum target,
                                GLint level, GLint xoffset, GLint x, GLint y,
                                GLsizei width);
 
+extern void GLAPIENTRY
+_mesa_CopyMultiTexSubImage1DEXT(GLenum texunit, GLenum target,
+                                GLint level, GLint xoffset, GLint x, GLint y,
+                                GLsizei width);
+
 extern void GLAPIENTRY
 _mesa_CopyTextureSubImage2D(GLuint texture, GLint level,
                             GLint xoffset, GLint yoffset,
@@ -513,6 +527,12 @@ _mesa_CopyTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level,
                                GLint x, GLint y,
                                GLsizei width, GLsizei height);
 
+extern void GLAPIENTRY
+_mesa_CopyMultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level,
+                                GLint xoffset, GLint yoffset,
+                                GLint x, GLint y,
+                                GLsizei width, GLsizei height);
+
 extern void GLAPIENTRY
 _mesa_CopyTextureSubImage3D(GLuint texture, GLint level,
                             GLint xoffset, GLint yoffset, GLint zoffset,
@@ -525,6 +545,12 @@ _mesa_CopyTextureSubImage3DEXT(GLuint texture, GLenum target, GLint level,
                                GLint x, GLint y,
                                GLsizei width, GLsizei height);
 
+extern void GLAPIENTRY
+_mesa_CopyMultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level,
+                                GLint xoffset, GLint yoffset, GLint zoffset,
+                                GLint x, GLint y,
+                                GLsizei width, GLsizei height);
+
 extern void GLAPIENTRY
 _mesa_CopyTexSubImage1D_no_error(GLenum target, GLint level, GLint xoffset,
                                  GLint x, GLint y, GLsizei width );