[Mesa-dev] [PATCH] mesa: add compressed_tex_sub_image_{error, no_error} helpers
Timothy Arceri
tarceri at itsqueeze.com
Fri Jul 21 09:19:05 UTC 2017
I wasn't too worried about this because more than just no_error gets
in-lined away, for example the dsa conditions and also the dim == 3. The
resulting output shouldn't be overly large. What do you think?
On 21/07/17 18:43, Samuel Pitoiset wrote:
> To avoid inlining compressed_tex_sub_image() a bunch of times.
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
> src/mesa/main/teximage.c | 101 ++++++++++++++++++++++++++++++-----------------
> 1 file changed, 65 insertions(+), 36 deletions(-)
>
> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
> index 38feb3fea4..c8aa2803e7 100644
> --- a/src/mesa/main/teximage.c
> +++ b/src/mesa/main/teximage.c
> @@ -4997,6 +4997,31 @@ compressed_tex_sub_image(unsigned dim, GLenum target, GLuint texture,
> }
> }
>
> +static void
> +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 char *caller)
> +{
> + compressed_tex_sub_image(dim, target, texture, level, xoffset, yoffset,
> + zoffset, width, height, depth, format, imageSize,
> + data, dsa, false, caller);
> +}
> +
> +static void
> +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 char *caller)
> +{
> + compressed_tex_sub_image(dim, target, texture, level, xoffset, yoffset,
> + zoffset, width, height, depth, format, imageSize,
> + data, dsa, true, caller);
> +}
>
> void GLAPIENTRY
> _mesa_CompressedTexSubImage1D_no_error(GLenum target, GLint level,
> @@ -5004,9 +5029,9 @@ _mesa_CompressedTexSubImage1D_no_error(GLenum target, GLint level,
> GLenum format, GLsizei imageSize,
> const GLvoid *data)
> {
> - compressed_tex_sub_image(1, target, 0, level, xoffset, 0, 0, width,
> - 1, 1, format, imageSize, data, false, true,
> - "glCompressedTexSubImage1D");
> + compressed_tex_sub_image_no_error(1, target, 0, level, xoffset, 0, 0, width,
> + 1, 1, format, imageSize, data, false,
> + "glCompressedTexSubImage1D");
> }
>
>
> @@ -5015,9 +5040,9 @@ _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, 0, 0, width, 1, 1,
> - format, imageSize, data, false, false,
> - "glCompressedTexSubImage1D");
> + compressed_tex_sub_image_error(1, target, 0, level, xoffset, 0, 0, width, 1,
> + 1, format, imageSize, data, false,
> + "glCompressedTexSubImage1D");
> }
>
>
> @@ -5027,9 +5052,9 @@ _mesa_CompressedTextureSubImage1D_no_error(GLuint texture, GLint level,
> GLenum format, GLsizei imageSize,
> const GLvoid *data)
> {
> - compressed_tex_sub_image(1, 0, texture, level, xoffset, 0, 0, width, 1, 1,
> - format, imageSize, data, true, true,
> - "glCompressedTextureSubImage1D");
> + compressed_tex_sub_image_no_error(1, 0, texture, level, xoffset, 0, 0, width,
> + 1, 1, format, imageSize, data, true,
> + "glCompressedTextureSubImage1D");
> }
>
>
> @@ -5038,9 +5063,9 @@ _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, 0, 0, width, 1, 1,
> - format, imageSize, data, true, false,
> - "glCompressedTextureSubImage1D");
> + compressed_tex_sub_image_error(1, 0, texture, level, xoffset, 0, 0, width,
> + 1, 1, format, imageSize, data, true,
> + "glCompressedTextureSubImage1D");
> }
>
> void GLAPIENTRY
> @@ -5050,9 +5075,9 @@ _mesa_CompressedTexSubImage2D_no_error(GLenum target, GLint level,
> GLenum format, GLsizei imageSize,
> const GLvoid *data)
> {
> - compressed_tex_sub_image(2, target, 0, level, xoffset, yoffset, 0, width,
> - height, 1, format, imageSize, data, false, true,
> - "glCompressedTexSubImage2D");
> + compressed_tex_sub_image_no_error(2, target, 0, level, xoffset, yoffset, 0,
> + width, height, 1, format, imageSize, data,
> + false, "glCompressedTexSubImage2D");
> }
>
>
> @@ -5062,9 +5087,9 @@ _mesa_CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset,
> GLenum format, GLsizei imageSize,
> const GLvoid *data)
> {
> - compressed_tex_sub_image(2, target, 0, level, xoffset, yoffset, 0, width,
> - height, 1, format, imageSize, data, false, false,
> - "glCompressedTexSubImage2D");
> + compressed_tex_sub_image_error(2, target, 0, level, xoffset, yoffset, 0,
> + width, height, 1, format, imageSize, data,
> + false, "glCompressedTexSubImage2D");
> }
>
>
> @@ -5075,9 +5100,9 @@ _mesa_CompressedTextureSubImage2D_no_error(GLuint texture, GLint level,
> GLenum format, GLsizei imageSize,
> const GLvoid *data)
> {
> - compressed_tex_sub_image(2, 0, texture, level, xoffset, yoffset, 0, width,
> - height, 1, format, imageSize, data, true, true,
> - "glCompressedTextureSubImage2D");
> + compressed_tex_sub_image_no_error(2, 0, texture, level, xoffset, yoffset, 0,
> + width, height, 1, format, imageSize, data,
> + true, "glCompressedTextureSubImage2D");
> }
>
>
> @@ -5088,9 +5113,9 @@ _mesa_CompressedTextureSubImage2D(GLuint texture, GLint level, GLint xoffset,
> GLenum format, GLsizei imageSize,
> const GLvoid *data)
> {
> - compressed_tex_sub_image(2, 0, texture, level, xoffset, yoffset, 0, width,
> - height, 1, format, imageSize, data, true, false,
> - "glCompressedTextureSubImage2D");
> + compressed_tex_sub_image_error(2, 0, texture, level, xoffset, yoffset, 0,
> + width, height, 1, format, imageSize, data,
> + true, "glCompressedTextureSubImage2D");
> }
>
> void GLAPIENTRY
> @@ -5101,9 +5126,10 @@ _mesa_CompressedTexSubImage3D_no_error(GLenum target, GLint level,
> GLenum format, GLsizei imageSize,
> const GLvoid *data)
> {
> - compressed_tex_sub_image(3, target, 0, level, xoffset, yoffset, zoffset,
> - width, height, depth, format, imageSize, data,
> - false, true, "glCompressedTexSubImage3D");
> + compressed_tex_sub_image_no_error(3, target, 0, level, xoffset, yoffset,
> + zoffset, width, height, depth, format,
> + imageSize, data, false,
> + "glCompressedTexSubImage3D");
> }
>
> void GLAPIENTRY
> @@ -5112,9 +5138,10 @@ _mesa_CompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset,
> GLsizei height, GLsizei depth, GLenum format,
> GLsizei imageSize, const GLvoid *data)
> {
> - compressed_tex_sub_image(3, target, 0, level, xoffset, yoffset, zoffset,
> - width, height, depth, format, imageSize, data,
> - false, false, "glCompressedTexSubImage3D");
> + compressed_tex_sub_image_error(3, target, 0, level, xoffset, yoffset,
> + zoffset, width, height, depth, format,
> + imageSize, data, false,
> + "glCompressedTexSubImage3D");
> }
>
> void GLAPIENTRY
> @@ -5125,9 +5152,10 @@ _mesa_CompressedTextureSubImage3D_no_error(GLuint texture, GLint level,
> GLenum format, GLsizei imageSize,
> const GLvoid *data)
> {
> - compressed_tex_sub_image(3, 0, texture, level, xoffset, yoffset, zoffset,
> - width, height, depth, format, imageSize, data,
> - true, true, "glCompressedTextureSubImage3D");
> + compressed_tex_sub_image_no_error(3, 0, texture, level, xoffset, yoffset,
> + zoffset, width, height, depth, format,
> + imageSize, data, true,
> + "glCompressedTextureSubImage3D");
> }
>
> void GLAPIENTRY
> @@ -5137,9 +5165,10 @@ _mesa_CompressedTextureSubImage3D(GLuint texture, GLint level, GLint xoffset,
> GLenum format, GLsizei imageSize,
> const GLvoid *data)
> {
> - compressed_tex_sub_image(3, 0, texture, level, xoffset, yoffset, zoffset,
> - width, height, depth, format, imageSize, data,
> - true, false, "glCompressedTextureSubImage3D");
> + compressed_tex_sub_image_error(3, 0, texture, level, xoffset, yoffset,
> + zoffset, width, height, depth, format,
> + imageSize, data, true,
> + "glCompressedTextureSubImage3D");
> }
>
> static mesa_format
>
More information about the mesa-dev
mailing list