From b5f930ea05fd87500447982b8fd464044c417592 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Mon, 3 Sep 2018 10:27:38 +1000 Subject: [PATCH] mesa: add support for glCompressedTextureSubImage2DEXT() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák Signed-off-by: Marek Olšák --- .../glapi/gen/EXT_direct_state_access.xml | 13 ++++ src/mapi/glapi/gen/static_data.py | 1 + src/mesa/main/tests/dispatch_sanity.cpp | 2 +- src/mesa/main/teximage.c | 75 +++++++++++++------ src/mesa/main/teximage.h | 7 ++ 5 files changed, 73 insertions(+), 25 deletions(-) diff --git a/src/mapi/glapi/gen/EXT_direct_state_access.xml b/src/mapi/glapi/gen/EXT_direct_state_access.xml index 53c6aa7d563..1eef0e3c39b 100644 --- a/src/mapi/glapi/gen/EXT_direct_state_access.xml +++ b/src/mapi/glapi/gen/EXT_direct_state_access.xml @@ -143,6 +143,19 @@ + + + + + + + + + + + + + diff --git a/src/mapi/glapi/gen/static_data.py b/src/mapi/glapi/gen/static_data.py index e7b1e126508..b938942ec89 100644 --- a/src/mapi/glapi/gen/static_data.py +++ b/src/mapi/glapi/gen/static_data.py @@ -1479,6 +1479,7 @@ offsets = { "NamedBufferStorageEXT": 1443, "MapNamedBufferRangeEXT": 1444, "TextureSubImage2DEXT": 1445, + "CompressedTextureSubImage2DEXT": 1446, } functions = [ diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp index fa41aa66e38..8cb63da17b2 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -1111,7 +1111,7 @@ const struct function common_desktop_functions_possible[] = { //{ "glCompressedTextureImage2DEXT", 13, -1 }, //{ "glCompressedTextureImage3DEXT", 13, -1 }, //{ "glCompressedTextureSubImage1DEXT", 13, -1 }, - //{ "glCompressedTextureSubImage2DEXT", 13, -1 }, + { "glCompressedTextureSubImage2DEXT", 13, -1 }, //{ "glCompressedTextureSubImage3DEXT", 13, -1 }, //{ "glGetCompressedTextureImageEXT", 13, -1 }, //{ "glCompressedMultiTexImage1DEXT", 13, -1 }, diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 8508fbb711e..253183da815 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -5043,8 +5043,8 @@ compressed_tex_sub_image(unsigned dim, GLenum target, GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, - const GLvoid *data, bool dsa, bool no_error, - const char *caller) + const GLvoid *data, bool dsa, bool ext_dsa, + bool no_error, const char *caller) { struct gl_texture_object *texObj = NULL; struct gl_texture_image *texImage; @@ -5054,13 +5054,20 @@ compressed_tex_sub_image(unsigned dim, GLenum target, GLuint texture, if (dsa) { if (no_error) { texObj = _mesa_lookup_texture(ctx, texture); + target = texObj->Target; } else { - texObj = _mesa_lookup_texture_err(ctx, texture, caller); - if (!texObj) - return; - } + if (!ext_dsa) { + texObj = _mesa_lookup_texture_err(ctx, texture, caller); + if (!texObj) + return; - target = texObj->Target; + target = texObj->Target; + } else { + texObj = lookup_texture_ext_dsa(ctx, target, texture, caller); + if (!texObj) + return; + } + } } if (!no_error && @@ -5131,12 +5138,12 @@ compressed_tex_sub_image_error(unsigned dim, GLenum target, GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, - const GLvoid *data, bool dsa, + const GLvoid *data, bool dsa, bool ext_dsa, const char *caller) { compressed_tex_sub_image(dim, target, texture, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, - data, dsa, false, caller); + data, dsa, ext_dsa, false, caller); } static void @@ -5144,12 +5151,12 @@ compressed_tex_sub_image_no_error(unsigned dim, GLenum target, GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, - const GLvoid *data, bool dsa, + const GLvoid *data, bool dsa, bool ext_dsa, const char *caller) { compressed_tex_sub_image(dim, target, texture, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, - data, dsa, true, caller); + data, dsa, ext_dsa, true, caller); } void GLAPIENTRY @@ -5160,7 +5167,7 @@ _mesa_CompressedTexSubImage1D_no_error(GLenum target, GLint level, { compressed_tex_sub_image_no_error(1, target, 0, level, xoffset, 0, 0, width, 1, 1, format, imageSize, data, false, - "glCompressedTexSubImage1D"); + false, "glCompressedTexSubImage1D"); } @@ -5170,7 +5177,7 @@ _mesa_CompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei imageSize, const GLvoid *data) { compressed_tex_sub_image_error(1, target, 0, level, xoffset, 0, 0, width, 1, - 1, format, imageSize, data, false, + 1, format, imageSize, data, false, false, "glCompressedTexSubImage1D"); } @@ -5181,8 +5188,9 @@ _mesa_CompressedTextureSubImage1D_no_error(GLuint texture, GLint level, GLenum format, GLsizei imageSize, const GLvoid *data) { - compressed_tex_sub_image_no_error(1, 0, texture, level, xoffset, 0, 0, width, - 1, 1, format, imageSize, data, true, + compressed_tex_sub_image_no_error(1, 0, texture, level, xoffset, 0, 0, + width, 1, 1, format, imageSize, data, + true, false, "glCompressedTextureSubImage1D"); } @@ -5193,10 +5201,11 @@ _mesa_CompressedTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLsizei imageSize, const GLvoid *data) { compressed_tex_sub_image_error(1, 0, texture, level, xoffset, 0, 0, width, - 1, 1, format, imageSize, data, true, + 1, 1, format, imageSize, data, true, false, "glCompressedTextureSubImage1D"); } + void GLAPIENTRY _mesa_CompressedTexSubImage2D_no_error(GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -5206,7 +5215,8 @@ _mesa_CompressedTexSubImage2D_no_error(GLenum target, GLint level, { compressed_tex_sub_image_no_error(2, target, 0, level, xoffset, yoffset, 0, width, height, 1, format, imageSize, data, - false, "glCompressedTexSubImage2D"); + false, false, + "glCompressedTexSubImage2D"); } @@ -5218,7 +5228,22 @@ _mesa_CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, { compressed_tex_sub_image_error(2, target, 0, level, xoffset, yoffset, 0, width, height, 1, format, imageSize, data, - false, "glCompressedTexSubImage2D"); + false, false, + "glCompressedTexSubImage2D"); +} + + +void GLAPIENTRY +_mesa_CompressedTextureSubImage2DEXT(GLuint texture, GLenum target, + GLint level, GLint xoffset, + GLint yoffset, GLsizei width, + GLsizei height, GLenum format, + GLsizei imageSize, const GLvoid *data) +{ + compressed_tex_sub_image_error(2, target, texture, level, xoffset, yoffset, + 0, width, height, 1, format, imageSize, + data, true, true, + "glCompressedTextureSubImage2DEXT"); } @@ -5231,7 +5256,8 @@ _mesa_CompressedTextureSubImage2D_no_error(GLuint texture, GLint level, { compressed_tex_sub_image_no_error(2, 0, texture, level, xoffset, yoffset, 0, width, height, 1, format, imageSize, data, - true, "glCompressedTextureSubImage2D"); + true, false, + "glCompressedTextureSubImage2D"); } @@ -5244,7 +5270,8 @@ _mesa_CompressedTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, { compressed_tex_sub_image_error(2, 0, texture, level, xoffset, yoffset, 0, width, height, 1, format, imageSize, data, - true, "glCompressedTextureSubImage2D"); + true, false, + "glCompressedTextureSubImage2D"); } void GLAPIENTRY @@ -5257,7 +5284,7 @@ _mesa_CompressedTexSubImage3D_no_error(GLenum target, GLint level, { compressed_tex_sub_image_no_error(3, target, 0, level, xoffset, yoffset, zoffset, width, height, depth, format, - imageSize, data, false, + imageSize, data, false, false, "glCompressedTexSubImage3D"); } @@ -5269,7 +5296,7 @@ _mesa_CompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, { compressed_tex_sub_image_error(3, target, 0, level, xoffset, yoffset, zoffset, width, height, depth, format, - imageSize, data, false, + imageSize, data, false, false, "glCompressedTexSubImage3D"); } @@ -5283,7 +5310,7 @@ _mesa_CompressedTextureSubImage3D_no_error(GLuint texture, GLint level, { compressed_tex_sub_image_no_error(3, 0, texture, level, xoffset, yoffset, zoffset, width, height, depth, format, - imageSize, data, true, + imageSize, data, true, false, "glCompressedTextureSubImage3D"); } @@ -5296,7 +5323,7 @@ _mesa_CompressedTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, { compressed_tex_sub_image_error(3, 0, texture, level, xoffset, yoffset, zoffset, width, height, depth, format, - imageSize, data, true, + imageSize, data, true, false, "glCompressedTextureSubImage3D"); } diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h index 494b167e2d5..b480ec5f448 100644 --- a/src/mesa/main/teximage.h +++ b/src/mesa/main/teximage.h @@ -532,6 +532,13 @@ _mesa_CompressedTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +void GLAPIENTRY +_mesa_CompressedTextureSubImage2DEXT(GLuint texture, GLenum target, + GLint level, GLint xoffset, + GLint yoffset, GLsizei width, + GLsizei height, GLenum format, + GLsizei imageSize, const GLvoid *data); + extern void GLAPIENTRY _mesa_CompressedTexSubImage2D_no_error(GLenum target, GLint level, GLint xoffset, GLint yoffset, -- 2.30.2