summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Eric Pelloux-Prayer <[email protected]>2019-04-30 14:47:31 +0200
committerMarek Olšák <[email protected]>2019-08-06 17:03:16 -0400
commit989c3758524d80aa33f0fb86f0b05ccc7b96a5d5 (patch)
treeb86f05bfbbbe44d15bbcf373b2ef3dd6151cb09e
parentaac65787321e480e58f1570e75941a865ab0568d (diff)
mesa: add EXT_dsa glMultiTexSubImage1D/2D/3DEXT
Reviewed-by: Marek Olšák <[email protected]>
-rw-r--r--src/mapi/glapi/gen/EXT_direct_state_access.xml39
-rw-r--r--src/mapi/glapi/gen/static_data.py3
-rw-r--r--src/mesa/main/dlist.c141
-rw-r--r--src/mesa/main/tests/dispatch_sanity.cpp6
-rw-r--r--src/mesa/main/teximage.c68
-rw-r--r--src/mesa/main/teximage.h19
6 files changed, 273 insertions, 3 deletions
diff --git a/src/mapi/glapi/gen/EXT_direct_state_access.xml b/src/mapi/glapi/gen/EXT_direct_state_access.xml
index 10142414fbc..3eb62d20eef 100644
--- a/src/mapi/glapi/gen/EXT_direct_state_access.xml
+++ b/src/mapi/glapi/gen/EXT_direct_state_access.xml
@@ -459,6 +459,45 @@
<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">
diff --git a/src/mapi/glapi/gen/static_data.py b/src/mapi/glapi/gen/static_data.py
index 2d243c479bf..ff714369535 100644
--- a/src/mapi/glapi/gen/static_data.py
+++ b/src/mapi/glapi/gen/static_data.py
@@ -1531,6 +1531,9 @@ offsets = {
"MultiTexImage1DEXT": 1495,
"MultiTexImage2DEXT": 1496,
"MultiTexImage3DEXT": 1497,
+ "MultiTexSubImage1DEXT": 1498,
+ "MultiTexSubImage2DEXT": 1499,
+ "MultiTexSubImage3DEXT": 1500,
}
functions = [
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index ab83546bf74..d62c87bcd59 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -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);
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index b1e80fd5dfb..bb5ba961a68 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -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 },
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index ac950c2051b..fdb9ae886b8 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -3815,6 +3815,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,
GLenum format, GLenum type,
@@ -3854,6 +3876,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,
GLsizei width, GLsizei height,
@@ -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,
diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h
index 49f0937ca20..57af2f40142 100644
--- a/src/mesa/main/teximage.h
+++ b/src/mesa/main/teximage.h
@@ -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,
@@ -427,6 +439,13 @@ _mesa_TextureSubImage3DEXT(GLuint texture, GLenum target,
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);