diff options
-rw-r--r-- | src/mapi/glapi/gen/EXT_direct_state_access.xml | 48 | ||||
-rw-r--r-- | src/mapi/glapi/gen/static_data.py | 4 | ||||
-rw-r--r-- | src/mesa/main/dlist.c | 180 | ||||
-rw-r--r-- | src/mesa/main/tests/dispatch_sanity.cpp | 8 | ||||
-rw-r--r-- | src/mesa/main/texgetimage.c | 38 | ||||
-rw-r--r-- | src/mesa/main/texgetimage.h | 4 | ||||
-rw-r--r-- | src/mesa/main/teximage.c | 57 | ||||
-rw-r--r-- | src/mesa/main/teximage.h | 17 |
8 files changed, 351 insertions, 5 deletions
diff --git a/src/mapi/glapi/gen/EXT_direct_state_access.xml b/src/mapi/glapi/gen/EXT_direct_state_access.xml index a22ad73ed74..10142414fbc 100644 --- a/src/mapi/glapi/gen/EXT_direct_state_access.xml +++ b/src/mapi/glapi/gen/EXT_direct_state_access.xml @@ -411,6 +411,54 @@ <param name="param" type="const GLfloat*" /> </function> + <function name="GetMultiTexImageEXT"> + <param name="texunit" type="GLenum" /> + <param name="target" type="GLenum" /> + <param name="level" type="GLint" /> + <param name="format" type="GLenum" /> + <param name="type" type="GLenum" /> + <param name="pixels" type="GLvoid*" /> + </function> + + <function name="MultiTexImage1DEXT"> + <param name="texunit" type="GLenum" /> + <param name="target" type="GLenum" /> + <param name="level" type="GLint" /> + <param name="internalformat" type="GLint" /> + <param name="width" type="GLsizei" /> + <param name="border" type="GLint" /> + <param name="format" type="GLenum" /> + <param name="type" type="GLenum" /> + <param name="pixels" type="const GLvoid*" /> + </function> + + <function name="MultiTexImage2DEXT"> + <param name="texunit" type="GLenum" /> + <param name="target" type="GLenum" /> + <param name="level" type="GLint" /> + <param name="internalformat" type="GLint" /> + <param name="width" type="GLsizei" /> + <param name="height" type="GLsizei" /> + <param name="border" type="GLint" /> + <param name="format" type="GLenum" /> + <param name="type" type="GLenum" /> + <param name="pixels" type="const GLvoid*" /> + </function> + + <function name="MultiTexImage3DEXT"> + <param name="texunit" type="GLenum" /> + <param name="target" type="GLenum" /> + <param name="level" type="GLint" /> + <param name="internalformat" type="GLint" /> + <param name="width" type="GLsizei" /> + <param name="height" type="GLsizei" /> + <param name="depth" type="GLsizei" /> + <param name="border" type="GLint" /> + <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 73688de9c3e..2d243c479bf 100644 --- a/src/mapi/glapi/gen/static_data.py +++ b/src/mapi/glapi/gen/static_data.py @@ -1527,6 +1527,10 @@ offsets = { "MultiTexParameterivEXT": 1491, "MultiTexParameterfEXT": 1492, "MultiTexParameterfvEXT": 1493, + "GetMultiTexImageEXT": 1494, + "MultiTexImage1DEXT": 1495, + "MultiTexImage2DEXT": 1496, + "MultiTexImage3DEXT": 1497, } functions = [ diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 5c37668e207..ab83546bf74 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -584,6 +584,9 @@ typedef enum OPCODE_BIND_MULTITEXTURE, OPCODE_MULTITEXPARAMETER_F, OPCODE_MULTITEXPARAMETER_I, + OPCODE_MULTITEX_IMAGE1D, + OPCODE_MULTITEX_IMAGE2D, + OPCODE_MULTITEX_IMAGE3D, OPCODE_MULTITEXENV, OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D, @@ -1221,12 +1224,15 @@ _mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist) free(get_pointer(&n[3])); break; case OPCODE_TEXTURE_IMAGE1D: + case OPCODE_MULTITEX_IMAGE1D: free(get_pointer(&n[9])); break; case OPCODE_TEXTURE_IMAGE2D: + case OPCODE_MULTITEX_IMAGE2D: free(get_pointer(&n[10])); break; case OPCODE_TEXTURE_IMAGE3D: + case OPCODE_MULTITEX_IMAGE3D: free(get_pointer(&n[11])); break; case OPCODE_TEXTURE_SUB_IMAGE1D: @@ -9578,7 +9584,7 @@ save_TextureImage1DEXT(GLuint texture, GLenum target, ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE1D, 8 + POINTER_DWORDS); if (n) { - n[1].e = texture; + n[1].ui = texture; n[2].e = target; n[3].i = level; n[4].i = components; @@ -9993,6 +9999,124 @@ save_MultiTexParameteriEXT(GLenum texunit, GLenum target, GLenum pname, GLint pa static void GLAPIENTRY +save_MultiTexImage1DEXT(GLenum texunit, GLenum target, + GLint level, GLint components, + GLsizei width, GLint border, + GLenum format, GLenum type, const GLvoid * pixels) +{ + GET_CURRENT_CONTEXT(ctx); + if (target == GL_PROXY_TEXTURE_1D) { + /* don't compile, execute immediately */ + CALL_MultiTexImage1DEXT(ctx->Exec, (texunit, target, level, components, width, + border, format, type, pixels)); + } + else { + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE1D, 8 + POINTER_DWORDS); + if (n) { + n[1].e = texunit; + n[2].e = target; + n[3].i = level; + n[4].i = components; + n[5].i = (GLint) width; + n[6].i = border; + n[7].e = format; + n[8].e = type; + save_pointer(&n[9], + unpack_image(ctx, 1, width, 1, 1, format, type, + pixels, &ctx->Unpack)); + } + if (ctx->ExecuteFlag) { + CALL_MultiTexImage1DEXT(ctx->Exec, (texunit, target, level, components, width, + border, format, type, pixels)); + } + } +} + + +static void GLAPIENTRY +save_MultiTexImage2DEXT(GLenum texunit, GLenum target, + GLint level, GLint components, + GLsizei width, GLsizei height, GLint border, + GLenum format, GLenum type, const GLvoid * pixels) +{ + GET_CURRENT_CONTEXT(ctx); + if (target == GL_PROXY_TEXTURE_2D) { + /* don't compile, execute immediately */ + CALL_MultiTexImage2DEXT(ctx->Exec, (texunit, target, level, components, width, + height, border, format, type, pixels)); + } + else { + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE2D, 9 + POINTER_DWORDS); + if (n) { + n[1].e = texunit; + n[2].e = target; + n[3].i = level; + n[4].i = components; + n[5].i = (GLint) width; + n[6].i = (GLint) height; + n[7].i = border; + 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_MultiTexImage2DEXT(ctx->Exec, (texunit, target, level, components, width, + height, border, format, type, pixels)); + } + } +} + + +static void GLAPIENTRY +save_MultiTexImage3DEXT(GLenum texunit, GLenum target, + GLint level, GLint internalFormat, + GLsizei width, GLsizei height, GLsizei depth, + GLint border, + GLenum format, GLenum type, const GLvoid * pixels) +{ + GET_CURRENT_CONTEXT(ctx); + if (target == GL_PROXY_TEXTURE_3D) { + /* don't compile, execute immediately */ + CALL_MultiTexImage3DEXT(ctx->Exec, (texunit, target, level, internalFormat, width, + height, depth, border, format, type, + pixels)); + } + else { + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE3D, 10 + POINTER_DWORDS); + if (n) { + n[1].e = texunit; + n[2].e = target; + n[3].i = level; + n[4].i = (GLint) internalFormat; + n[5].i = (GLint) width; + n[6].i = (GLint) height; + n[7].i = (GLint) depth; + n[8].i = border; + n[9].e = format; + n[10].e = type; + save_pointer(&n[11], + unpack_image(ctx, 3, width, height, depth, format, type, + pixels, &ctx->Unpack)); + } + if (ctx->ExecuteFlag) { + CALL_MultiTexImage3DEXT(ctx->Exec, (texunit, target, level, internalFormat, + width, height, depth, border, format, + type, pixels)); + } + } +} + + + +static void GLAPIENTRY save_MultiTexEnvfvEXT(GLenum texunit, GLenum target, GLenum pname, const GLfloat *params) { GET_CURRENT_CONTEXT(ctx); @@ -11809,6 +11933,57 @@ execute_list(struct gl_context *ctx, GLuint list) CALL_MultiTexParameterivEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params)); } break; + case OPCODE_MULTITEX_IMAGE1D: + { + const struct gl_pixelstore_attrib save = ctx->Unpack; + ctx->Unpack = ctx->DefaultPacking; + CALL_MultiTexImage1DEXT(ctx->Exec, (n[1].e, /* texture */ + n[2].e, /* target */ + n[3].i, /* level */ + n[4].i, /* components */ + n[5].i, /* width */ + n[6].e, /* border */ + n[7].e, /* format */ + n[8].e, /* type */ + get_pointer(&n[9]))); + ctx->Unpack = save; /* restore */ + } + break; + case OPCODE_MULTITEX_IMAGE2D: + { + const struct gl_pixelstore_attrib save = ctx->Unpack; + ctx->Unpack = ctx->DefaultPacking; + CALL_MultiTexImage2DEXT(ctx->Exec, (n[1].e, /* texture */ + n[2].e, /* target */ + n[3].i, /* level */ + n[4].i, /* components */ + n[5].i, /* width */ + n[6].i, /* height */ + n[7].e, /* border */ + n[8].e, /* format */ + n[9].e, /* type */ + get_pointer(&n[10]))); + ctx->Unpack = save; /* restore */ + } + break; + case OPCODE_MULTITEX_IMAGE3D: + { + const struct gl_pixelstore_attrib save = ctx->Unpack; + ctx->Unpack = ctx->DefaultPacking; + CALL_MultiTexImage3DEXT(ctx->Exec, (n[1].e, /* texture */ + n[2].e, /* target */ + n[3].i, /* level */ + n[4].i, /* components */ + n[5].i, /* width */ + n[6].i, /* height */ + n[7].i, /* depth */ + n[8].e, /* border */ + n[9].e, /* format */ + n[10].e, /* type */ + get_pointer(&n[11]))); + ctx->Unpack = save; /* restore */ + } + break; case OPCODE_MULTITEXENV: { GLfloat params[4]; @@ -12837,6 +13012,9 @@ _mesa_initialize_save_table(const struct gl_context *ctx) SET_MultiTexParameterivEXT(table, save_MultiTexParameterivEXT); SET_MultiTexParameterfEXT(table, save_MultiTexParameterfEXT); SET_MultiTexParameterfvEXT(table, save_MultiTexParameterfvEXT); + SET_MultiTexImage1DEXT(table, save_MultiTexImage1DEXT); + SET_MultiTexImage2DEXT(table, save_MultiTexImage2DEXT); + SET_MultiTexImage3DEXT(table, save_MultiTexImage3DEXT); 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 661f275af7f..b1e80fd5dfb 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -1076,20 +1076,20 @@ const struct function common_desktop_functions_possible[] = { { "glMultiTexParameterfvEXT", 12, -1 }, { "glMultiTexParameteriEXT", 12, -1 }, { "glMultiTexParameterivEXT", 12, -1 }, - //{ "glMultiTexImage1DEXT", 12, -1 }, - //{ "glMultiTexImage2DEXT", 12, -1 }, + { "glMultiTexImage1DEXT", 12, -1 }, + { "glMultiTexImage2DEXT", 12, -1 }, //{ "glMultiTexSubImage1DEXT", 12, -1 }, //{ "glMultiTexSubImage2DEXT", 12, -1 }, //{ "glCopyMultiTexImage1DEXT", 12, -1 }, //{ "glCopyMultiTexImage2DEXT", 12, -1 }, //{ "glCopyMultiTexSubImage1DEXT", 12, -1 }, //{ "glCopyMultiTexSubImage2DEXT", 12, -1 }, - //{ "glGetMultiTexImageEXT", 12, -1 }, + { "glGetMultiTexImageEXT", 12, -1 }, //{ "glGetMultiTexParameterfvEXT", 12, -1 }, //{ "glGetMultiTexParameterivEXT", 12, -1 }, //{ "glGetMultiTexLevelParameterfvEXT", 12, -1 }, //{ "glGetMultiTexLevelParameterivEXT", 12, -1 }, - //{ "glMultiTexImage3DEXT", 12, -1 }, + { "glMultiTexImage3DEXT", 12, -1 }, //{ "glMultiTexSubImage3DEXT", 12, -1 }, //{ "glCopyMultiTexSubImage3DEXT", 12, -1 }, { "glEnableClientStateIndexedEXT", 12, -1 }, diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index fcaaf3eee69..693077e1993 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -1560,6 +1560,44 @@ _mesa_GetTextureImageEXT(GLuint texture, GLenum target, GLint level, void GLAPIENTRY +_mesa_GetMultiTexImageEXT(GLenum texunit, GLenum target, GLint level, + GLenum format, GLenum type, GLvoid *pixels) +{ + GET_CURRENT_CONTEXT(ctx); + GLsizei width, height, depth; + static const char *caller = "glGetMultiTexImageEXT"; + + struct gl_texture_object *texObj = + _mesa_get_texobj_by_target_and_texunit(ctx, target, + texunit - GL_TEXTURE0, + false, + caller); + + if (!texObj) { + return; + } + + if (!legal_getteximage_target(ctx, texObj->Target, true)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s", caller); + return; + } + + get_texture_image_dims(texObj, texObj->Target, level, + &width, &height, &depth); + + if (getteximage_error_check(ctx, texObj, texObj->Target, level, + width, height, depth, + format, type, INT_MAX, pixels, caller)) { + return; + } + + get_texture_image(ctx, texObj, texObj->Target, level, + 0, 0, 0, width, height, depth, + format, type, pixels, caller); +} + + +void GLAPIENTRY _mesa_GetTextureSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, diff --git a/src/mesa/main/texgetimage.h b/src/mesa/main/texgetimage.h index 0ab154a9c42..9a27aacc040 100644 --- a/src/mesa/main/texgetimage.h +++ b/src/mesa/main/texgetimage.h @@ -66,6 +66,10 @@ _mesa_GetTextureImageEXT( GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels); extern void GLAPIENTRY +_mesa_GetMultiTexImageEXT(GLenum texunit, GLenum target, GLint level, + GLenum format, GLenum type, GLvoid *pixels); + +extern void GLAPIENTRY _mesa_GetTextureSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 5c28c21234e..ac950c2051b 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -3211,6 +3211,24 @@ _mesa_TextureImage1DEXT(GLuint texture, GLenum target, GLint level, } void GLAPIENTRY +_mesa_MultiTexImage1DEXT(GLenum texunit, GLenum target, GLint level, + GLint internalFormat, GLsizei width, GLint border, + GLenum format, GLenum type, 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, + "glMultiTexImage1DEXT"); + if (!texObj) + return; + teximage(ctx, GL_FALSE, 1, texObj, target, level, internalFormat, width, 1, 1, + border, format, type, 0, pixels, false); +} + +void GLAPIENTRY _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, @@ -3238,6 +3256,25 @@ _mesa_TextureImage2DEXT(GLuint texture, GLenum target, GLint level, width, height, 1, border, format, type, 0, pixels, false); } +void GLAPIENTRY +_mesa_MultiTexImage2DEXT(GLenum texunit, GLenum target, GLint level, + GLint internalFormat, GLsizei width, GLsizei height, + GLint border, + GLenum format, GLenum type, 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, + "glMultiTexImage2DEXT"); + if (!texObj) + return; + teximage(ctx, GL_FALSE, 2, texObj, target, level, internalFormat, width, height, 1, + border, format, type, 0, pixels, false); +} + /* * Called by the API or display list executor. * Note that width and height include the border. @@ -3272,6 +3309,26 @@ _mesa_TextureImage3DEXT(GLuint texture, GLenum target, GLint level, void GLAPIENTRY +_mesa_MultiTexImage3DEXT(GLenum texunit, GLenum target, GLint level, + GLint internalFormat, GLsizei width, GLsizei height, + GLsizei depth, GLint border, GLenum format, GLenum type, + 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, + "glMultiTexImage3DEXT"); + if (!texObj) + return; + teximage(ctx, GL_FALSE, 3, texObj, target, level, internalFormat, + width, height, depth, border, format, type, 0, pixels, false); +} + + +void GLAPIENTRY _mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h index 5f3dc0383a4..49f0937ca20 100644 --- a/src/mesa/main/teximage.h +++ b/src/mesa/main/teximage.h @@ -267,6 +267,11 @@ _mesa_TextureImage1DEXT( GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, const GLvoid *pixels ); extern void GLAPIENTRY +_mesa_MultiTexImage1DEXT( GLenum texture, GLenum target, GLint level, + GLint internalformat, GLsizei width, GLint border, + GLenum format, GLenum type, const GLvoid *pixels ); + +extern void GLAPIENTRY _mesa_TexImage2D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ); @@ -278,6 +283,12 @@ _mesa_TextureImage2DEXT( GLuint texture, GLenum target, GLint level, const GLvoid *pixels ); extern void GLAPIENTRY +_mesa_MultiTexImage2DEXT(GLenum texture, GLenum target, GLint level, + GLint internalFormat, GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, + const GLvoid *pixels ); + +extern void GLAPIENTRY _mesa_TexImage3D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels ); @@ -295,6 +306,12 @@ _mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalformat, const GLvoid *pixels ); extern void GLAPIENTRY +_mesa_MultiTexImage3DEXT(GLenum texture, GLenum target, GLint level, + GLint internalFormat, GLsizei width, GLsizei height, + GLsizei depth, GLint border, GLenum format, GLenum type, + const GLvoid *pixels ); + +extern void GLAPIENTRY _mesa_TexImage1D_no_error(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels); |