From 8c76221886358ce9f1377507c317d3aa1b02d23c Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Mon, 6 May 2019 11:25:04 +0200 Subject: [PATCH] mesa: add EXT_dsa glCompressedTexture(Sub)Image1D/2D/3D 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 | 69 +++++++++ src/mapi/glapi/gen/static_data.py | 132 +++++++++--------- src/mesa/main/tests/dispatch_sanity.cpp | 12 +- src/mesa/main/texgetimage.c | 26 ++++ src/mesa/main/texgetimage.h | 4 + src/mesa/main/teximage.c | 85 +++++++++++ src/mesa/main/teximage.h | 31 ++++ 7 files changed, 290 insertions(+), 69 deletions(-) diff --git a/src/mapi/glapi/gen/EXT_direct_state_access.xml b/src/mapi/glapi/gen/EXT_direct_state_access.xml index 155b2ade145..108bbad8757 100644 --- a/src/mapi/glapi/gen/EXT_direct_state_access.xml +++ b/src/mapi/glapi/gen/EXT_direct_state_access.xml @@ -663,6 +663,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -676,6 +723,28 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mapi/glapi/gen/static_data.py b/src/mapi/glapi/gen/static_data.py index 231563fd622..c9b59988864 100644 --- a/src/mapi/glapi/gen/static_data.py +++ b/src/mapi/glapi/gen/static_data.py @@ -1489,69 +1489,75 @@ offsets = { "CopyTextureSubImage1DEXT": 1453, "CopyTextureSubImage2DEXT": 1454, "CopyTextureSubImage3DEXT": 1455, - "CompressedTextureSubImage2DEXT": 1456, - "MapNamedBufferEXT": 1457, - "GetTextureParameterivEXT": 1458, - "GetTextureParameterfvEXT": 1459, - "TextureParameteriEXT": 1460, - "TextureParameterivEXT": 1461, - "TextureParameterfEXT": 1462, - "TextureParameterfvEXT": 1463, - "GetTextureImageEXT": 1464, - "GetTextureLevelParameterivEXT": 1465, - "GetTextureLevelParameterfvEXT": 1466, - "GetNamedBufferSubDataEXT": 1467, - "GetNamedBufferPointervEXT": 1468, - "GetNamedBufferParameterivEXT": 1469, - "FlushMappedNamedBufferRangeEXT": 1470, - "FramebufferDrawBufferEXT": 1471, - "FramebufferDrawBuffersEXT": 1472, - "FramebufferReadBufferEXT": 1473, - "GetFramebufferParameterivEXT": 1474, - "CheckNamedFramebufferStatusEXT": 1475, - "NamedFramebufferTexture1DEXT": 1476, - "NamedFramebufferTexture2DEXT": 1477, - "NamedFramebufferTexture3DEXT": 1478, - "NamedFramebufferRenderbufferEXT": 1479, - "GetNamedFramebufferAttachmentParameterivEXT": 1480, - "EnableClientStateiEXT": 1481, - "DisableClientStateiEXT": 1482, - "GetPointerIndexedvEXT": 1483, - "MultiTexEnviEXT": 1484, - "MultiTexEnvivEXT": 1485, - "MultiTexEnvfEXT": 1486, - "MultiTexEnvfvEXT": 1487, - "GetMultiTexEnvivEXT": 1488, - "GetMultiTexEnvfvEXT": 1489, - "MultiTexParameteriEXT": 1490, - "MultiTexParameterivEXT": 1491, - "MultiTexParameterfEXT": 1492, - "MultiTexParameterfvEXT": 1493, - "GetMultiTexImageEXT": 1494, - "MultiTexImage1DEXT": 1495, - "MultiTexImage2DEXT": 1496, - "MultiTexImage3DEXT": 1497, - "MultiTexSubImage1DEXT": 1498, - "MultiTexSubImage2DEXT": 1499, - "MultiTexSubImage3DEXT": 1500, - "GetMultiTexParameterivEXT": 1501, - "GetMultiTexParameterfvEXT": 1502, - "CopyMultiTexImage1DEXT": 1503, - "CopyMultiTexImage2DEXT": 1504, - "CopyMultiTexSubImage1DEXT": 1505, - "CopyMultiTexSubImage2DEXT": 1506, - "CopyMultiTexSubImage3DEXT": 1507, - "MultiTexGendEXT": 1508, - "MultiTexGendvEXT": 1509, - "MultiTexGenfEXT": 1510, - "MultiTexGenfvEXT": 1511, - "MultiTexGeniEXT": 1512, - "MultiTexGenivEXT": 1513, - "GetMultiTexGendvEXT": 1514, - "GetMultiTexGenfvEXT": 1515, - "GetMultiTexGenivEXT": 1516, - "MultiTexCoordPointerEXT": 1517, - "BindImageTextureEXT": 1518, + "MapNamedBufferEXT": 1456, + "GetTextureParameterivEXT": 1457, + "GetTextureParameterfvEXT": 1458, + "TextureParameteriEXT": 1459, + "TextureParameterivEXT": 1460, + "TextureParameterfEXT": 1461, + "TextureParameterfvEXT": 1462, + "GetTextureImageEXT": 1463, + "GetTextureLevelParameterivEXT": 1464, + "GetTextureLevelParameterfvEXT": 1465, + "GetNamedBufferSubDataEXT": 1466, + "GetNamedBufferPointervEXT": 1467, + "GetNamedBufferParameterivEXT": 1468, + "FlushMappedNamedBufferRangeEXT": 1469, + "FramebufferDrawBufferEXT": 1470, + "FramebufferDrawBuffersEXT": 1471, + "FramebufferReadBufferEXT": 1472, + "GetFramebufferParameterivEXT": 1473, + "CheckNamedFramebufferStatusEXT": 1474, + "NamedFramebufferTexture1DEXT": 1475, + "NamedFramebufferTexture2DEXT": 1476, + "NamedFramebufferTexture3DEXT": 1477, + "NamedFramebufferRenderbufferEXT": 1478, + "GetNamedFramebufferAttachmentParameterivEXT": 1479, + "EnableClientStateiEXT": 1480, + "DisableClientStateiEXT": 1481, + "GetPointerIndexedvEXT": 1482, + "MultiTexEnviEXT": 1483, + "MultiTexEnvivEXT": 1484, + "MultiTexEnvfEXT": 1485, + "MultiTexEnvfvEXT": 1486, + "GetMultiTexEnvivEXT": 1487, + "GetMultiTexEnvfvEXT": 1488, + "MultiTexParameteriEXT": 1489, + "MultiTexParameterivEXT": 1490, + "MultiTexParameterfEXT": 1491, + "MultiTexParameterfvEXT": 1492, + "GetMultiTexImageEXT": 1493, + "MultiTexImage1DEXT": 1494, + "MultiTexImage2DEXT": 1495, + "MultiTexImage3DEXT": 1496, + "MultiTexSubImage1DEXT": 1497, + "MultiTexSubImage2DEXT": 1498, + "MultiTexSubImage3DEXT": 1499, + "GetMultiTexParameterivEXT": 1500, + "GetMultiTexParameterfvEXT": 1501, + "CopyMultiTexImage1DEXT": 1502, + "CopyMultiTexImage2DEXT": 1503, + "CopyMultiTexSubImage1DEXT": 1504, + "CopyMultiTexSubImage2DEXT": 1505, + "CopyMultiTexSubImage3DEXT": 1506, + "MultiTexGendEXT": 1507, + "MultiTexGendvEXT": 1508, + "MultiTexGenfEXT": 1509, + "MultiTexGenfvEXT": 1510, + "MultiTexGeniEXT": 1511, + "MultiTexGenivEXT": 1512, + "GetMultiTexGendvEXT": 1513, + "GetMultiTexGenfvEXT": 1514, + "GetMultiTexGenivEXT": 1515, + "MultiTexCoordPointerEXT": 1516, + "BindImageTextureEXT": 1517, + "CompressedTextureImage1DEXT": 1518, + "CompressedTextureImage2DEXT": 1519, + "CompressedTextureImage3DEXT": 1520, + "CompressedTextureSubImage1DEXT": 1521, + "CompressedTextureSubImage2DEXT": 1522, + "CompressedTextureSubImage3DEXT": 1523, + "GetCompressedTextureImageEXT": 1524, } functions = [ diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp index 2542f15b056..6b478fded88 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -1106,13 +1106,13 @@ const struct function common_desktop_functions_possible[] = { //{ "glGetNamedProgramivEXT", 10, -1 }, //{ "glGetNamedProgramStringEXT", 10, -1 }, /* GL_EXT_direct_state_access - GL 1.3 */ - //{ "glCompressedTextureImage1DEXT", 13, -1 }, - //{ "glCompressedTextureImage2DEXT", 13, -1 }, - //{ "glCompressedTextureImage3DEXT", 13, -1 }, - //{ "glCompressedTextureSubImage1DEXT", 13, -1 }, + { "glCompressedTextureImage1DEXT", 13, -1 }, + { "glCompressedTextureImage2DEXT", 13, -1 }, + { "glCompressedTextureImage3DEXT", 13, -1 }, + { "glCompressedTextureSubImage1DEXT", 13, -1 }, { "glCompressedTextureSubImage2DEXT", 13, -1 }, - //{ "glCompressedTextureSubImage3DEXT", 13, -1 }, - //{ "glGetCompressedTextureImageEXT", 13, -1 }, + { "glCompressedTextureSubImage3DEXT", 13, -1 }, + { "glGetCompressedTextureImageEXT", 13, -1 }, //{ "glCompressedMultiTexImage1DEXT", 13, -1 }, //{ "glCompressedMultiTexImage2DEXT", 13, -1 }, //{ "glCompressedMultiTexImage3DEXT", 13, -1 }, diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index 0e475e53893..749d0b21313 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -1884,6 +1884,32 @@ _mesa_GetCompressedTexImage(GLenum target, GLint level, GLvoid *pixels) } +void GLAPIENTRY +_mesa_GetCompressedTextureImageEXT(GLuint texture, GLenum target, GLint level, + GLvoid *pixels) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_texture_object* texObj; + GLsizei width, height, depth; + static const char *caller = "glGetCompressedTextureImageEXT"; + + 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_GetCompressedTextureImage(GLuint texture, GLint level, GLsizei bufSize, GLvoid *pixels) diff --git a/src/mesa/main/texgetimage.h b/src/mesa/main/texgetimage.h index 9a27aacc040..da87cbeea9e 100644 --- a/src/mesa/main/texgetimage.h +++ b/src/mesa/main/texgetimage.h @@ -88,6 +88,10 @@ extern void GLAPIENTRY _mesa_GetCompressedTextureImage(GLuint texture, GLint level, GLsizei bufSize, GLvoid *pixels); +extern void GLAPIENTRY +_mesa_GetCompressedTextureImageEXT(GLuint texture, 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 8a36247c5a1..875d2226ad9 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -5358,6 +5358,24 @@ _mesa_CompressedTexImage1D(GLenum target, GLint level, } +void GLAPIENTRY +_mesa_CompressedTextureImage1DEXT(GLuint texture, 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_lookup_or_create_texture(ctx, target, texture, false, true, + "glCompressedTextureImage1DEXT"); + 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, @@ -5370,6 +5388,24 @@ _mesa_CompressedTexImage2D(GLenum target, GLint level, } +void GLAPIENTRY +_mesa_CompressedTextureImage2DEXT(GLuint texture, 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_lookup_or_create_texture(ctx, target, texture, false, true, + "glCompressedTextureImage2DEXT"); + 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, @@ -5382,6 +5418,25 @@ _mesa_CompressedTexImage3D(GLenum target, GLint level, } +void GLAPIENTRY +_mesa_CompressedTextureImage3DEXT(GLuint texture, 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_lookup_or_create_texture(ctx, target, texture, false, true, + "glCompressedTextureImage3DEXT"); + 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, GLenum internalFormat, GLsizei width, @@ -5626,6 +5681,20 @@ _mesa_CompressedTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, } +void GLAPIENTRY +_mesa_CompressedTextureSubImage1DEXT(GLuint texture, GLenum target, + GLint level, GLint xoffset, + GLsizei width, GLenum format, + GLsizei imageSize, const GLvoid *data) +{ + compressed_tex_sub_image(1, target, texture, level, xoffset, 0, + 0, width, 1, 1, format, imageSize, + data, + TEX_MODE_EXT_DSA_TEXTURE, + "glCompressedTextureSubImage1DEXT"); +} + + void GLAPIENTRY _mesa_CompressedTexSubImage2D_no_error(GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -5755,6 +5824,22 @@ _mesa_CompressedTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, } +void GLAPIENTRY +_mesa_CompressedTextureSubImage3DEXT(GLuint texture, 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, texture, level, xoffset, yoffset, + zoffset, width, height, depth, format, + imageSize, data, + TEX_MODE_EXT_DSA_TEXTURE, + "glCompressedTextureSubImage3DEXT"); +} + + 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 891fa16565c..b0211870e71 100644 --- a/src/mesa/main/teximage.h +++ b/src/mesa/main/teximage.h @@ -595,18 +595,36 @@ _mesa_CompressedTexImage1D(GLenum target, GLint level, GLint border, GLsizei imageSize, const GLvoid *data); +extern void GLAPIENTRY +_mesa_CompressedTextureImage1DEXT(GLuint texture, 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, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +extern void GLAPIENTRY +_mesa_CompressedTextureImage2DEXT(GLuint texture, 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, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +extern void GLAPIENTRY +_mesa_CompressedTextureImage3DEXT(GLuint texture, 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, @@ -646,6 +664,11 @@ _mesa_CompressedTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +extern void GLAPIENTRY +_mesa_CompressedTextureSubImage1DEXT(GLuint texture, 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, @@ -653,6 +676,14 @@ _mesa_CompressedTextureSubImage2DEXT(GLuint texture, GLenum target, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +extern void GLAPIENTRY +_mesa_CompressedTextureSubImage3DEXT(GLuint texture, 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