summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorPierre-Eric Pelloux-Prayer <[email protected]>2019-04-30 15:42:39 +0200
committerMarek Olšák <[email protected]>2019-08-06 17:03:19 -0400
commite8e0de6a8f11be85cd52e2bda08fa32e5b148f22 (patch)
tree76c52aaeb4c9d846b200d2e2057629bf795684a9 /src/mesa
parentf28d9ab1a3d486c1c9535fb3dd7d9f49a65c3e96 (diff)
mesa: add EXT_dsa glCopyMultiTexImage* and glCopyMultiTexSubImage*
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/dlist.c173
-rw-r--r--src/mesa/main/tests/dispatch_sanity.cpp10
-rw-r--r--src/mesa/main/teximage.c104
-rw-r--r--src/mesa/main/teximage.h26
4 files changed, 308 insertions, 5 deletions
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index d62c87bcd59..be77c386d62 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -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,
@@ -10222,6 +10227,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)
{
GET_CURRENT_CONTEXT(ctx);
@@ -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);
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index a0e7bc58f75..3653597bb2e 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -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 },
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index fdb9ae886b8..352ccf2d660 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -4382,6 +4382,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,
GLint border )
@@ -4411,6 +4430,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)
{
@@ -4561,6 +4599,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,
GLint x, GLint y, GLsizei width, GLsizei height)
@@ -4611,6 +4668,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,
GLint x, GLint y, GLsizei width, GLsizei height)
@@ -4677,6 +4753,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)
{
diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h
index 57af2f40142..891fa16565c 100644
--- a/src/mesa/main/teximage.h
+++ b/src/mesa/main/teximage.h
@@ -449,6 +449,10 @@ 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,
@@ -456,6 +460,11 @@ _mesa_CopyTexImage2D( GLenum target, GLint level,
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,
GLsizei width, GLint border);
@@ -502,6 +511,11 @@ _mesa_CopyTextureSubImage1DEXT(GLuint texture, GLenum target,
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,
GLint x, GLint y,
@@ -514,6 +528,12 @@ _mesa_CopyTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level,
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,
GLint x, GLint y,
@@ -526,6 +546,12 @@ _mesa_CopyTextureSubImage3DEXT(GLuint texture, GLenum target, GLint level,
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 );