From 7719f52d5fa29f251b4ddce61238972b43be7035 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Mon, 26 Jun 2017 12:38:24 +1000 Subject: [PATCH] mesa: add KHR_no_error support for glCopyTex{ture}SubImage*D() Reviewed-by: Samuel Pitoiset --- .../glapi/gen/ARB_direct_state_access.xml | 6 +- src/mapi/glapi/gen/gl_API.xml | 6 +- src/mesa/main/teximage.c | 81 +++++++++++++++++++ src/mesa/main/teximage.h | 28 +++++++ 4 files changed, 115 insertions(+), 6 deletions(-) diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml b/src/mapi/glapi/gen/ARB_direct_state_access.xml index d3d22465e47..c9031c1a1ac 100644 --- a/src/mapi/glapi/gen/ARB_direct_state_access.xml +++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml @@ -446,7 +446,7 @@ - + @@ -455,7 +455,7 @@ - + @@ -466,7 +466,7 @@ - + diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index 550af08268e..9857e39e1f2 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -3277,7 +3277,7 @@ - + @@ -3287,7 +3287,7 @@ - + @@ -4041,7 +4041,7 @@ - + diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index ac259859b1f..a9086a27889 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -4141,6 +4141,87 @@ _mesa_CopyTextureSubImage3D(GLuint texture, GLint level, yoffset, zoffset, x, y, width, height, self); } + +void GLAPIENTRY +_mesa_CopyTexSubImage1D_no_error(GLenum target, GLint level, GLint xoffset, + GLint x, GLint y, GLsizei width) +{ + GET_CURRENT_CONTEXT(ctx); + + struct gl_texture_object* texObj = _mesa_get_current_tex_object(ctx, target); + copy_texture_sub_image_no_error(ctx, 1, texObj, target, level, xoffset, 0, 0, + x, y, width, 1); +} + +void GLAPIENTRY +_mesa_CopyTexSubImage2D_no_error(GLenum target, GLint level, GLint xoffset, + GLint yoffset, GLint x, GLint y, GLsizei width, + GLsizei height) +{ + GET_CURRENT_CONTEXT(ctx); + + struct gl_texture_object* texObj = _mesa_get_current_tex_object(ctx, target); + copy_texture_sub_image_no_error(ctx, 2, texObj, target, level, xoffset, + yoffset, 0, x, y, width, height); +} + +void GLAPIENTRY +_mesa_CopyTexSubImage3D_no_error(GLenum target, GLint level, GLint xoffset, + GLint yoffset, GLint zoffset, GLint x, GLint y, + GLsizei width, GLsizei height) +{ + GET_CURRENT_CONTEXT(ctx); + + struct gl_texture_object* texObj = _mesa_get_current_tex_object(ctx, target); + copy_texture_sub_image_no_error(ctx, 3, texObj, target, level, xoffset, + yoffset, zoffset, x, y, width, height); +} + +void GLAPIENTRY +_mesa_CopyTextureSubImage1D_no_error(GLuint texture, GLint level, GLint xoffset, + GLint x, GLint y, GLsizei width) +{ + GET_CURRENT_CONTEXT(ctx); + + struct gl_texture_object* texObj = _mesa_lookup_texture(ctx, texture); + copy_texture_sub_image_no_error(ctx, 1, texObj, texObj->Target, level, + xoffset, 0, 0, x, y, width, 1); +} + +void GLAPIENTRY +_mesa_CopyTextureSubImage2D_no_error(GLuint texture, GLint level, GLint xoffset, + GLint yoffset, GLint x, GLint y, + GLsizei width, GLsizei height) +{ + GET_CURRENT_CONTEXT(ctx); + + struct gl_texture_object* texObj = _mesa_lookup_texture(ctx, texture); + copy_texture_sub_image_no_error(ctx, 2, texObj, texObj->Target, level, + xoffset, yoffset, 0, x, y, width, height); +} + +void GLAPIENTRY +_mesa_CopyTextureSubImage3D_no_error(GLuint texture, GLint level, GLint xoffset, + GLint yoffset, GLint zoffset, GLint x, + GLint y, GLsizei width, GLsizei height) +{ + GET_CURRENT_CONTEXT(ctx); + + struct gl_texture_object* texObj = _mesa_lookup_texture(ctx, texture); + if (texObj->Target == GL_TEXTURE_CUBE_MAP) { + /* Act like CopyTexSubImage2D */ + copy_texture_sub_image_no_error(ctx, 2, texObj, + GL_TEXTURE_CUBE_MAP_POSITIVE_X + zoffset, + level, xoffset, yoffset, 0, x, y, width, + height); + } + else + copy_texture_sub_image_no_error(ctx, 3, texObj, texObj->Target, level, + xoffset, yoffset, zoffset, x, y, width, + height); +} + + static bool check_clear_tex_image(struct gl_context *ctx, const char *function, diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h index b9d6fc06704..c2fd4514d88 100644 --- a/src/mesa/main/teximage.h +++ b/src/mesa/main/teximage.h @@ -383,6 +383,34 @@ _mesa_CopyTextureSubImage3D(GLuint texture, GLint level, GLint x, GLint y, GLsizei width, GLsizei height); +extern void GLAPIENTRY +_mesa_CopyTexSubImage1D_no_error(GLenum target, GLint level, GLint xoffset, + GLint x, GLint y, GLsizei width ); + +extern void GLAPIENTRY +_mesa_CopyTexSubImage2D_no_error(GLenum target, GLint level, GLint xoffset, + GLint yoffset, GLint x, GLint y, GLsizei width, + GLsizei height); + +extern void GLAPIENTRY +_mesa_CopyTexSubImage3D_no_error(GLenum target, GLint level, GLint xoffset, + GLint yoffset, GLint zoffset, GLint x, GLint y, + GLsizei width, GLsizei height); + +extern void GLAPIENTRY +_mesa_CopyTextureSubImage1D_no_error(GLuint texture, GLint level, GLint xoffset, + GLint x, GLint y, GLsizei width); + +extern void GLAPIENTRY +_mesa_CopyTextureSubImage2D_no_error(GLuint texture, GLint level, GLint xoffset, + GLint yoffset, GLint x, GLint y, + GLsizei width, GLsizei height); + +extern void GLAPIENTRY +_mesa_CopyTextureSubImage3D_no_error(GLuint texture, GLint level, GLint xoffset, + GLint yoffset, GLint zoffset, GLint x, + GLint y, GLsizei width, GLsizei height); + extern void GLAPIENTRY _mesa_ClearTexSubImage( GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, -- 2.30.2