From d5e382e316b651f1b048407b014c6e9cfc05b8cc Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Wed, 10 May 2017 17:20:10 +1000 Subject: [PATCH] mesa: add KHR_no_error support for CompressedTex*SubImage1D() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Nicolai Hähnle --- .../glapi/gen/ARB_direct_state_access.xml | 2 +- src/mapi/glapi/gen/gl_API.xml | 2 +- src/mesa/main/teximage.c | 49 +++++++++++++++---- src/mesa/main/teximage.h | 11 +++++ 4 files changed, 53 insertions(+), 11 deletions(-) diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml b/src/mapi/glapi/gen/ARB_direct_state_access.xml index 2f2ba20b7d4..4597d3b6d38 100644 --- a/src/mapi/glapi/gen/ARB_direct_state_access.xml +++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml @@ -410,7 +410,7 @@ - + diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index 50d60f53da6..026f74c2a04 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -4571,7 +4571,7 @@ - + diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index c95e9e276cf..722d8809d39 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -4533,7 +4533,7 @@ static ALWAYS_INLINE void compressed_tex_sub_image(unsigned dim, GLenum target, GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data, - bool dsa, const char *caller) + bool dsa, bool no_error, const char *caller) { struct gl_texture_object *texObj; struct gl_texture_image *texImage; @@ -4541,25 +4541,31 @@ compressed_tex_sub_image(unsigned dim, GLenum target, GLuint texture, GET_CURRENT_CONTEXT(ctx); if (dsa) { - texObj = _mesa_lookup_texture_err(ctx, texture, caller); - if (!texObj) - return; + if (no_error) { + texObj = _mesa_lookup_texture(ctx, texture); + } else { + texObj = _mesa_lookup_texture_err(ctx, texture, caller); + if (!texObj) + return; + } target = texObj->Target; } - if (compressed_subtexture_target_check(ctx, target, dim, format, dsa, + if (!no_error && + compressed_subtexture_target_check(ctx, target, dim, format, dsa, caller)) { return; } if (!dsa) { texObj = _mesa_get_current_tex_object(ctx, target); - if (!texObj) + if (!no_error && !texObj) return; } - if (compressed_subtexture_error_check(ctx, dim, texObj, target, level, + if (!no_error && + compressed_subtexture_error_check(ctx, dim, texObj, target, level, xoffset, 0, 0, width, 1, 1, format, imageSize, data, caller)) { return; @@ -4574,23 +4580,48 @@ compressed_tex_sub_image(unsigned dim, GLenum target, GLuint texture, } +void GLAPIENTRY +_mesa_CompressedTexSubImage1D_no_error(GLenum target, GLint level, + GLint xoffset, GLsizei width, + GLenum format, GLsizei imageSize, + const GLvoid *data) +{ + compressed_tex_sub_image(1, target, 0, level, xoffset, width, format, + imageSize, data, false, true, + "glCompressedTexSubImage1D"); +} + + void GLAPIENTRY _mesa_CompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data) { compressed_tex_sub_image(1, target, 0, level, xoffset, width, format, - imageSize, data, false, + imageSize, data, false, false, "glCompressedTexSubImage1D"); } + +void GLAPIENTRY +_mesa_CompressedTextureSubImage1D_no_error(GLuint texture, GLint level, + GLint xoffset, GLsizei width, + GLenum format, GLsizei imageSize, + const GLvoid *data) +{ + compressed_tex_sub_image(1, 0, texture, level, xoffset, width, + format, imageSize, data, true, true, + "glCompressedTextureSubImage1D"); +} + + void GLAPIENTRY _mesa_CompressedTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data) { compressed_tex_sub_image(1, 0, texture, level, xoffset, width, - format, imageSize, data, true, + format, imageSize, data, true, false, "glCompressedTextureSubImage1D"); } diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h index 5becd293444..08e01c6641d 100644 --- a/src/mesa/main/teximage.h +++ b/src/mesa/main/teximage.h @@ -386,12 +386,23 @@ _mesa_CompressedTexImage3D(GLenum target, GLint level, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); + +extern void GLAPIENTRY +_mesa_CompressedTexSubImage1D_no_error(GLenum target, GLint level, + GLint xoffset, GLsizei width, + GLenum format, GLsizei imageSize, + const GLvoid *data); extern void GLAPIENTRY _mesa_CompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); extern void GLAPIENTRY +_mesa_CompressedTextureSubImage1D_no_error(GLuint texture, GLint level, + GLint xoffset, GLsizei width, + GLenum format, GLsizei imageSize, + const GLvoid *data); +extern void GLAPIENTRY _mesa_CompressedTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); -- 2.30.2