From 1cb8e12717eecb2a9dfab3016c74bdbaffd9b617 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Mon, 6 May 2019 15:23:53 +0200 Subject: [PATCH] mesa: add EXT_dsa glCompressedMultiTex* functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák --- .../glapi/gen/EXT_direct_state_access.xml | 82 ++++++++++++ src/mapi/glapi/gen/static_data.py | 7 + src/mesa/main/tests/dispatch_sanity.cpp | 14 +- src/mesa/main/texgetimage.c | 30 +++++ src/mesa/main/texgetimage.h | 4 + src/mesa/main/teximage.c | 120 +++++++++++++++++- src/mesa/main/teximage.h | 40 ++++++ 7 files changed, 285 insertions(+), 12 deletions(-) diff --git a/src/mapi/glapi/gen/EXT_direct_state_access.xml b/src/mapi/glapi/gen/EXT_direct_state_access.xml index 108bbad8757..ae25bb61fdd 100644 --- a/src/mapi/glapi/gen/EXT_direct_state_access.xml +++ b/src/mapi/glapi/gen/EXT_direct_state_access.xml @@ -745,6 +745,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mapi/glapi/gen/static_data.py b/src/mapi/glapi/gen/static_data.py index c9b59988864..0c53ef1ac45 100644 --- a/src/mapi/glapi/gen/static_data.py +++ b/src/mapi/glapi/gen/static_data.py @@ -1558,6 +1558,13 @@ offsets = { "CompressedTextureSubImage2DEXT": 1522, "CompressedTextureSubImage3DEXT": 1523, "GetCompressedTextureImageEXT": 1524, + "CompressedMultiTexImage1DEXT": 1525, + "CompressedMultiTexImage2DEXT": 1526, + "CompressedMultiTexImage3DEXT": 1527, + "CompressedMultiTexSubImage1DEXT": 1528, + "CompressedMultiTexSubImage2DEXT": 1529, + "CompressedMultiTexSubImage3DEXT": 1530, + "GetCompressedMultiTexImageEXT": 1531, } functions = [ diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp index 6b478fded88..6ccdf3f83f8 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -1113,13 +1113,13 @@ const struct function common_desktop_functions_possible[] = { { "glCompressedTextureSubImage2DEXT", 13, -1 }, { "glCompressedTextureSubImage3DEXT", 13, -1 }, { "glGetCompressedTextureImageEXT", 13, -1 }, - //{ "glCompressedMultiTexImage1DEXT", 13, -1 }, - //{ "glCompressedMultiTexImage2DEXT", 13, -1 }, - //{ "glCompressedMultiTexImage3DEXT", 13, -1 }, - //{ "glCompressedMultiTexSubImage1DEXT", 13, -1 }, - //{ "glCompressedMultiTexSubImage2DEXT", 13, -1 }, - //{ "glCompressedMultiTexSubImage3DEXT", 13, -1 }, - //{ "glGetCompressedMultiTexImageEXT", 13, -1 }, + { "glCompressedMultiTexImage1DEXT", 13, -1 }, + { "glCompressedMultiTexImage2DEXT", 13, -1 }, + { "glCompressedMultiTexImage3DEXT", 13, -1 }, + { "glCompressedMultiTexSubImage1DEXT", 13, -1 }, + { "glCompressedMultiTexSubImage2DEXT", 13, -1 }, + { "glCompressedMultiTexSubImage3DEXT", 13, -1 }, + { "glGetCompressedMultiTexImageEXT", 13, -1 }, { "glMatrixLoadTransposefEXT", 13, -1 }, { "glMatrixLoadTransposedEXT", 13, -1 }, { "glMatrixMultTransposefEXT", 13, -1 }, diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index 749d0b21313..e43f33677fd 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -1895,6 +1895,36 @@ _mesa_GetCompressedTextureImageEXT(GLuint texture, GLenum target, GLint level, texObj = _mesa_lookup_or_create_texture(ctx, target, texture, false, true, caller); + + get_texture_image_dims(texObj, texObj->Target, level, + &width, &height, &depth); + + if (getcompressedteximage_error_check(ctx, texObj, texObj->Target, level, + 0, 0, 0, width, height, depth, + INT_MAX, pixels, caller)) { + return; + } + + get_compressed_texture_image(ctx, texObj, texObj->Target, level, + 0, 0, 0, width, height, depth, + pixels, caller); +} + + +void GLAPIENTRY +_mesa_GetCompressedMultiTexImageEXT(GLenum texunit, GLenum target, GLint level, + GLvoid *pixels) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_texture_object* texObj; + GLsizei width, height, depth; + static const char *caller = "glGetCompressedMultiTexImageEXT"; + + texObj = _mesa_get_texobj_by_target_and_texunit(ctx, target, + texunit - GL_TEXTURE0, + false, + caller); + get_texture_image_dims(texObj, texObj->Target, level, &width, &height, &depth); diff --git a/src/mesa/main/texgetimage.h b/src/mesa/main/texgetimage.h index da87cbeea9e..ab31eaa8f44 100644 --- a/src/mesa/main/texgetimage.h +++ b/src/mesa/main/texgetimage.h @@ -92,6 +92,10 @@ extern void GLAPIENTRY _mesa_GetCompressedTextureImageEXT(GLuint texture, GLenum target, GLint level, GLvoid *pixels); +extern void GLAPIENTRY +_mesa_GetCompressedMultiTexImageEXT(GLenum texunit, GLenum target, GLint level, + GLvoid *pixels); + extern void APIENTRY _mesa_GetCompressedTextureSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 875d2226ad9..498b6ae4c44 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -5376,6 +5376,26 @@ _mesa_CompressedTextureImage1DEXT(GLuint texture, GLenum target, GLint level, } +void GLAPIENTRY +_mesa_CompressedMultiTexImage1DEXT(GLenum texunit, GLenum target, GLint level, + GLenum internalFormat, GLsizei width, + GLint border, GLsizei imageSize, + 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, + "glCompressedMultiTexImage1DEXT"); + if (!texObj) + return; + teximage(ctx, GL_TRUE, 1, texObj, target, level, internalFormat, + width, 1, 1, border, GL_NONE, GL_NONE, imageSize, pixels, false); +} + + void GLAPIENTRY _mesa_CompressedTexImage2D(GLenum target, GLint level, GLenum internalFormat, GLsizei width, @@ -5406,6 +5426,26 @@ _mesa_CompressedTextureImage2DEXT(GLuint texture, GLenum target, GLint level, } +void GLAPIENTRY +_mesa_CompressedMultiTexImage2DEXT(GLenum texunit, GLenum target, GLint level, + GLenum internalFormat, GLsizei width, + GLsizei height, GLint border, GLsizei imageSize, + 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, + "glCompressedMultiTexImage2DEXT"); + if (!texObj) + return; + teximage(ctx, GL_TRUE, 2, texObj, target, level, internalFormat, + width, height, 1, border, GL_NONE, GL_NONE, imageSize, pixels, false); +} + + void GLAPIENTRY _mesa_CompressedTexImage3D(GLenum target, GLint level, GLenum internalFormat, GLsizei width, @@ -5436,6 +5476,25 @@ _mesa_CompressedTextureImage3DEXT(GLuint texture, GLenum target, GLint level, } +void GLAPIENTRY +_mesa_CompressedMultiTexImage3DEXT(GLenum texunit, GLenum target, GLint level, + GLenum internalFormat, GLsizei width, + GLsizei height, GLsizei depth, GLint border, + GLsizei imageSize, 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, + "glCompressedMultiTexImage3DEXT"); + if (!texObj) + return; + teximage(ctx, GL_TRUE, 3, texObj, target, level, internalFormat, + width, height, depth, border, GL_NONE, GL_NONE, imageSize, pixels, false); +} + void GLAPIENTRY _mesa_CompressedTexImage1D_no_error(GLenum target, GLint level, @@ -5516,11 +5575,13 @@ enum tex_mode { TEX_MODE_DSA_ERROR, /* Use the specified texture name + target */ TEX_MODE_EXT_DSA_TEXTURE, + /* Use the specified texture unit + target */ + TEX_MODE_EXT_DSA_TEXUNIT, }; static void -compressed_tex_sub_image(unsigned dim, GLenum target, GLuint texture, +compressed_tex_sub_image(unsigned dim, GLenum target, GLuint textureOrIndex, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, @@ -5535,26 +5596,32 @@ compressed_tex_sub_image(unsigned dim, GLenum target, GLuint texture, switch (mode) { case TEX_MODE_DSA_ERROR: assert(target == 0); - texObj = _mesa_lookup_texture_err(ctx, texture, caller); + texObj = _mesa_lookup_texture_err(ctx, textureOrIndex, caller); if (texObj) target = texObj->Target; break; case TEX_MODE_DSA_NO_ERROR: assert(target == 0); - texObj = _mesa_lookup_texture(ctx, texture); + texObj = _mesa_lookup_texture(ctx, textureOrIndex); if (texObj) target = texObj->Target; no_error = true; break; case TEX_MODE_EXT_DSA_TEXTURE: - texObj = _mesa_lookup_or_create_texture(ctx, target, texture, + texObj = _mesa_lookup_or_create_texture(ctx, target, textureOrIndex, false, true, caller); break; + case TEX_MODE_EXT_DSA_TEXUNIT: + texObj = _mesa_get_texobj_by_target_and_texunit(ctx, target, + textureOrIndex, + false, + caller); + break; case TEX_MODE_CURRENT_ERROR: no_error = true; case TEX_MODE_CURRENT_NO_ERROR: default: - assert(texture == 0); + assert(textureOrIndex == 0); texObj = _mesa_get_current_tex_object(ctx, target); break; } @@ -5695,6 +5762,20 @@ _mesa_CompressedTextureSubImage1DEXT(GLuint texture, GLenum target, } +void GLAPIENTRY +_mesa_CompressedMultiTexSubImage1DEXT(GLenum texunit, GLenum target, + GLint level, GLint xoffset, + GLsizei width, GLenum format, + GLsizei imageSize, const GLvoid *data) +{ + compressed_tex_sub_image(1, target, texunit - GL_TEXTURE0, level, + xoffset, 0, 0, width, 1, 1, format, imageSize, + data, + TEX_MODE_EXT_DSA_TEXUNIT, + "glCompressedMultiTexSubImage1DEXT"); +} + + void GLAPIENTRY _mesa_CompressedTexSubImage2D_no_error(GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -5739,6 +5820,20 @@ _mesa_CompressedTextureSubImage2DEXT(GLuint texture, GLenum target, } +void GLAPIENTRY +_mesa_CompressedMultiTexSubImage2DEXT(GLenum texunit, GLenum target, + GLint level, GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, GLenum format, + GLsizei imageSize, const GLvoid *data) +{ + compressed_tex_sub_image(2, target, texunit - GL_TEXTURE0, level, + xoffset, yoffset, 0, width, height, 1, format, + imageSize, data, + TEX_MODE_EXT_DSA_TEXUNIT, + "glCompressedMultiTexSubImage2DEXT"); +} + + void GLAPIENTRY _mesa_CompressedTextureSubImage2D_no_error(GLuint texture, GLint level, GLint xoffset, GLint yoffset, @@ -5840,6 +5935,21 @@ _mesa_CompressedTextureSubImage3DEXT(GLuint texture, GLenum target, } +void GLAPIENTRY +_mesa_CompressedMultiTexSubImage3DEXT(GLenum texunit, GLenum target, + GLint level, GLint xoffset, GLint yoffset, + GLint zoffset, GLsizei width, GLsizei height, + GLsizei depth, GLenum format, + GLsizei imageSize, const GLvoid *data) +{ + compressed_tex_sub_image(3, target, texunit - GL_TEXTURE0, level, + xoffset, yoffset, zoffset, width, height, depth, + format, imageSize, data, + TEX_MODE_EXT_DSA_TEXUNIT, + "glCompressedMultiTexSubImage3DEXT"); +} + + mesa_format _mesa_get_texbuffer_format(const struct gl_context *ctx, GLenum internalFormat) { diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h index b0211870e71..51d555584c9 100644 --- a/src/mesa/main/teximage.h +++ b/src/mesa/main/teximage.h @@ -601,6 +601,12 @@ _mesa_CompressedTextureImage1DEXT(GLuint texture, GLenum target, GLint level, GLint border, GLsizei imageSize, const GLvoid *pixels); +extern void GLAPIENTRY +_mesa_CompressedMultiTexImage1DEXT(GLenum texunit, GLenum target, GLint level, + GLenum internalFormat, GLsizei width, + GLint border, GLsizei imageSize, + const GLvoid *pixels); + extern void GLAPIENTRY _mesa_CompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, @@ -613,6 +619,12 @@ _mesa_CompressedTextureImage2DEXT(GLuint texture, GLenum target, GLint level, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *pixels); +extern void GLAPIENTRY +_mesa_CompressedMultiTexImage2DEXT(GLenum texunit, GLenum target, GLint level, + GLenum internalFormat, GLsizei width, + GLsizei height, GLint border, GLsizei imageSize, + const GLvoid *pixels); + extern void GLAPIENTRY _mesa_CompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, @@ -625,6 +637,13 @@ _mesa_CompressedTextureImage3DEXT(GLuint texture, GLenum target, GLint level, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *pixels); +extern void GLAPIENTRY +_mesa_CompressedMultiTexImage3DEXT(GLenum texunit, GLenum target, GLint level, + GLenum internalFormat, GLsizei width, + GLsizei height, GLsizei depth, GLint border, + GLsizei imageSize, const GLvoid *pixels); + + extern void GLAPIENTRY _mesa_CompressedTexImage1D_no_error(GLenum target, GLint level, GLenum internalformat, GLsizei width, @@ -669,6 +688,12 @@ _mesa_CompressedTextureSubImage1DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +extern void GLAPIENTRY +_mesa_CompressedMultiTexSubImage1DEXT(GLenum texunit, GLenum target, 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, @@ -676,6 +701,13 @@ _mesa_CompressedTextureSubImage2DEXT(GLuint texture, GLenum target, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +extern void GLAPIENTRY +_mesa_CompressedMultiTexSubImage2DEXT(GLenum texunit, GLenum target, + GLint level, GLint xoffset, + GLint yoffset, GLsizei width, + GLsizei height, GLenum format, + GLsizei imageSize, const GLvoid *data); + extern void GLAPIENTRY _mesa_CompressedTextureSubImage3DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset, @@ -684,6 +716,14 @@ _mesa_CompressedTextureSubImage3DEXT(GLuint texture, GLenum target, GLenum format, GLsizei imageSize, const GLvoid *data); +extern void GLAPIENTRY +_mesa_CompressedMultiTexSubImage3DEXT(GLenum texunit, GLenum target, + GLint level, GLint xoffset, + GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, + 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