From b520df571e0a319eae5231d09f36b98f28b8914a Mon Sep 17 00:00:00 2001 From: marha Date: Thu, 6 Oct 2011 08:46:34 +0200 Subject: upgraded to inputproto-2.1.99.1 xwininfo fontconfig libXau mesa xkeyboard-config git update 6 oct 2011 --- mesalib/src/glsl/ast_to_hir.cpp | 13 + mesalib/src/glsl/builtin_variables.h | 220 ++++----- mesalib/src/mesa/main/mipmap.c | 76 --- mesalib/src/mesa/main/mipmap.h | 9 - mesalib/src/mesa/main/mtypes.h | 28 +- mesalib/src/mesa/main/texcompress_fxt1.c | 6 +- mesalib/src/mesa/main/texcompress_rgtc.c | 12 +- mesalib/src/mesa/main/texcompress_s3tc.c | 12 +- mesalib/src/mesa/main/texstore.c | 533 ++++++++-------------- mesalib/src/mesa/main/texstore.h | 7 +- mesalib/src/mesa/state_tracker/st_cb_drawpixels.c | 4 +- mesalib/src/mesa/state_tracker/st_cb_texture.c | 110 ++--- mesalib/src/mesa/state_tracker/st_texture.c | 1 + mesalib/src/mesa/state_tracker/st_texture.h | 7 +- mesalib/src/mesa/swrast/s_texfetch.c | 325 +++++++++++++ 15 files changed, 734 insertions(+), 629 deletions(-) (limited to 'mesalib') diff --git a/mesalib/src/glsl/ast_to_hir.cpp b/mesalib/src/glsl/ast_to_hir.cpp index 91a223160..4f8a5482b 100644 --- a/mesalib/src/glsl/ast_to_hir.cpp +++ b/mesalib/src/glsl/ast_to_hir.cpp @@ -2803,6 +2803,19 @@ ast_declarator_list::hir(exec_list *instructions, _mesa_glsl_error(& loc, state, "identifier `%s' uses reserved `gl_' prefix", decl->identifier); + else if (state->language_version >= 130 && + strstr(decl->identifier, "__")) { + /* From page 14 (page 20 of the PDF) of the GLSL 1.10 + * spec: + * + * "In addition, all identifiers containing two + * consecutive underscores (__) are reserved as + * possible future keywords." + */ + _mesa_glsl_error(& loc, state, + "identifier `%s' uses reserved `__' string", + decl->identifier); + } /* Add the variable to the symbol table. Note that the initializer's * IR was already processed earlier (though it hasn't been emitted diff --git a/mesalib/src/glsl/builtin_variables.h b/mesalib/src/glsl/builtin_variables.h index f3531a370..d25bbf42a 100644 --- a/mesalib/src/glsl/builtin_variables.h +++ b/mesalib/src/glsl/builtin_variables.h @@ -1,110 +1,110 @@ -/* - * Copyright © 2010 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#include "main/core.h" /* for slot numbers */ - -struct builtin_variable { - enum ir_variable_mode mode; - int slot; - const char *type; - const char *name; -}; - -static const builtin_variable builtin_core_vs_variables[] = { - { ir_var_out, VERT_RESULT_HPOS, "vec4", "gl_Position" }, - { ir_var_out, VERT_RESULT_PSIZ, "float", "gl_PointSize" }, -}; - -static const builtin_variable builtin_core_fs_variables[] = { - { ir_var_in, FRAG_ATTRIB_WPOS, "vec4", "gl_FragCoord" }, - { ir_var_in, FRAG_ATTRIB_FACE, "bool", "gl_FrontFacing" }, - { ir_var_out, FRAG_RESULT_COLOR, "vec4", "gl_FragColor" }, -}; - -static const builtin_variable builtin_100ES_fs_variables[] = { - { ir_var_in, FRAG_ATTRIB_PNTC, "vec2", "gl_PointCoord" }, -}; - -static const builtin_variable builtin_110_fs_variables[] = { - { ir_var_out, FRAG_RESULT_DEPTH, "float", "gl_FragDepth" }, -}; - -static const builtin_variable builtin_110_deprecated_fs_variables[] = { - { ir_var_in, FRAG_ATTRIB_COL0, "vec4", "gl_Color" }, - { ir_var_in, FRAG_ATTRIB_COL1, "vec4", "gl_SecondaryColor" }, - { ir_var_in, FRAG_ATTRIB_FOGC, "float", "gl_FogFragCoord" }, -}; - -static const builtin_variable builtin_110_deprecated_vs_variables[] = { - { ir_var_in, VERT_ATTRIB_POS, "vec4", "gl_Vertex" }, - { ir_var_in, VERT_ATTRIB_NORMAL, "vec3", "gl_Normal" }, - { ir_var_in, VERT_ATTRIB_COLOR0, "vec4", "gl_Color" }, - { ir_var_in, VERT_ATTRIB_COLOR1, "vec4", "gl_SecondaryColor" }, - { ir_var_in, VERT_ATTRIB_TEX0, "vec4", "gl_MultiTexCoord0" }, - { ir_var_in, VERT_ATTRIB_TEX1, "vec4", "gl_MultiTexCoord1" }, - { ir_var_in, VERT_ATTRIB_TEX2, "vec4", "gl_MultiTexCoord2" }, - { ir_var_in, VERT_ATTRIB_TEX3, "vec4", "gl_MultiTexCoord3" }, - { ir_var_in, VERT_ATTRIB_TEX4, "vec4", "gl_MultiTexCoord4" }, - { ir_var_in, VERT_ATTRIB_TEX5, "vec4", "gl_MultiTexCoord5" }, - { ir_var_in, VERT_ATTRIB_TEX6, "vec4", "gl_MultiTexCoord6" }, - { ir_var_in, VERT_ATTRIB_TEX7, "vec4", "gl_MultiTexCoord7" }, - { ir_var_in, VERT_ATTRIB_FOG, "float", "gl_FogCoord" }, - { ir_var_out, VERT_RESULT_HPOS, "vec4", "gl_ClipVertex" }, - { ir_var_out, VERT_RESULT_COL0, "vec4", "gl_FrontColor" }, - { ir_var_out, VERT_RESULT_BFC0, "vec4", "gl_BackColor" }, - { ir_var_out, VERT_RESULT_COL1, "vec4", "gl_FrontSecondaryColor" }, - { ir_var_out, VERT_RESULT_BFC1, "vec4", "gl_BackSecondaryColor" }, - { ir_var_out, VERT_RESULT_FOGC, "float", "gl_FogFragCoord" }, -}; - -static const builtin_variable builtin_120_fs_variables[] = { - { ir_var_in, FRAG_ATTRIB_PNTC, "vec2", "gl_PointCoord" }, -}; - -static const builtin_variable builtin_130_vs_variables[] = { - { ir_var_in, -1, "int", "gl_VertexID" }, -}; - -static const builtin_variable builtin_110_deprecated_uniforms[] = { - { ir_var_uniform, -1, "mat4", "gl_ModelViewMatrix" }, - { ir_var_uniform, -1, "mat4", "gl_ProjectionMatrix" }, - { ir_var_uniform, -1, "mat4", "gl_ModelViewProjectionMatrix" }, - { ir_var_uniform, -1, "mat3", "gl_NormalMatrix" }, - { ir_var_uniform, -1, "mat4", "gl_ModelViewMatrixInverse" }, - { ir_var_uniform, -1, "mat4", "gl_ProjectionMatrixInverse" }, - { ir_var_uniform, -1, "mat4", "gl_ModelViewProjectionMatrixInverse" }, - { ir_var_uniform, -1, "mat4", "gl_ModelViewMatrixTranspose" }, - { ir_var_uniform, -1, "mat4", "gl_ProjectionMatrixTranspose" }, - { ir_var_uniform, -1, "mat4", "gl_ModelViewProjectionMatrixTranspose" }, - { ir_var_uniform, -1, "mat4", "gl_ModelViewMatrixInverseTranspose" }, - { ir_var_uniform, -1, "mat4", "gl_ProjectionMatrixInverseTranspose" }, - { ir_var_uniform, -1, "mat4", "gl_ModelViewProjectionMatrixInverseTranspose" }, - { ir_var_uniform, -1, "float", "gl_NormalScale" }, - { ir_var_uniform, -1, "gl_LightModelParameters", "gl_LightModel"}, - - /* Mesa-internal ATI_envmap_bumpmap state. */ - { ir_var_uniform, -1, "vec2", "gl_MESABumpRotMatrix0"}, - { ir_var_uniform, -1, "vec2", "gl_MESABumpRotMatrix1"}, - { ir_var_uniform, -1, "vec4", "gl_MESAFogParamsOptimized"}, -}; - +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include "main/core.h" /* for slot numbers */ + +struct builtin_variable { + enum ir_variable_mode mode; + int slot; + const char *type; + const char *name; +}; + +static const builtin_variable builtin_core_vs_variables[] = { + { ir_var_out, VERT_RESULT_HPOS, "vec4", "gl_Position" }, + { ir_var_out, VERT_RESULT_PSIZ, "float", "gl_PointSize" }, +}; + +static const builtin_variable builtin_core_fs_variables[] = { + { ir_var_in, FRAG_ATTRIB_WPOS, "vec4", "gl_FragCoord" }, + { ir_var_in, FRAG_ATTRIB_FACE, "bool", "gl_FrontFacing" }, + { ir_var_out, FRAG_RESULT_COLOR, "vec4", "gl_FragColor" }, +}; + +static const builtin_variable builtin_100ES_fs_variables[] = { + { ir_var_in, FRAG_ATTRIB_PNTC, "vec2", "gl_PointCoord" }, +}; + +static const builtin_variable builtin_110_fs_variables[] = { + { ir_var_out, FRAG_RESULT_DEPTH, "float", "gl_FragDepth" }, +}; + +static const builtin_variable builtin_110_deprecated_fs_variables[] = { + { ir_var_in, FRAG_ATTRIB_COL0, "vec4", "gl_Color" }, + { ir_var_in, FRAG_ATTRIB_COL1, "vec4", "gl_SecondaryColor" }, + { ir_var_in, FRAG_ATTRIB_FOGC, "float", "gl_FogFragCoord" }, +}; + +static const builtin_variable builtin_110_deprecated_vs_variables[] = { + { ir_var_in, VERT_ATTRIB_POS, "vec4", "gl_Vertex" }, + { ir_var_in, VERT_ATTRIB_NORMAL, "vec3", "gl_Normal" }, + { ir_var_in, VERT_ATTRIB_COLOR0, "vec4", "gl_Color" }, + { ir_var_in, VERT_ATTRIB_COLOR1, "vec4", "gl_SecondaryColor" }, + { ir_var_in, VERT_ATTRIB_TEX0, "vec4", "gl_MultiTexCoord0" }, + { ir_var_in, VERT_ATTRIB_TEX1, "vec4", "gl_MultiTexCoord1" }, + { ir_var_in, VERT_ATTRIB_TEX2, "vec4", "gl_MultiTexCoord2" }, + { ir_var_in, VERT_ATTRIB_TEX3, "vec4", "gl_MultiTexCoord3" }, + { ir_var_in, VERT_ATTRIB_TEX4, "vec4", "gl_MultiTexCoord4" }, + { ir_var_in, VERT_ATTRIB_TEX5, "vec4", "gl_MultiTexCoord5" }, + { ir_var_in, VERT_ATTRIB_TEX6, "vec4", "gl_MultiTexCoord6" }, + { ir_var_in, VERT_ATTRIB_TEX7, "vec4", "gl_MultiTexCoord7" }, + { ir_var_in, VERT_ATTRIB_FOG, "float", "gl_FogCoord" }, + { ir_var_out, VERT_RESULT_CLIP_VERTEX, "vec4", "gl_ClipVertex" }, + { ir_var_out, VERT_RESULT_COL0, "vec4", "gl_FrontColor" }, + { ir_var_out, VERT_RESULT_BFC0, "vec4", "gl_BackColor" }, + { ir_var_out, VERT_RESULT_COL1, "vec4", "gl_FrontSecondaryColor" }, + { ir_var_out, VERT_RESULT_BFC1, "vec4", "gl_BackSecondaryColor" }, + { ir_var_out, VERT_RESULT_FOGC, "float", "gl_FogFragCoord" }, +}; + +static const builtin_variable builtin_120_fs_variables[] = { + { ir_var_in, FRAG_ATTRIB_PNTC, "vec2", "gl_PointCoord" }, +}; + +static const builtin_variable builtin_130_vs_variables[] = { + { ir_var_in, -1, "int", "gl_VertexID" }, +}; + +static const builtin_variable builtin_110_deprecated_uniforms[] = { + { ir_var_uniform, -1, "mat4", "gl_ModelViewMatrix" }, + { ir_var_uniform, -1, "mat4", "gl_ProjectionMatrix" }, + { ir_var_uniform, -1, "mat4", "gl_ModelViewProjectionMatrix" }, + { ir_var_uniform, -1, "mat3", "gl_NormalMatrix" }, + { ir_var_uniform, -1, "mat4", "gl_ModelViewMatrixInverse" }, + { ir_var_uniform, -1, "mat4", "gl_ProjectionMatrixInverse" }, + { ir_var_uniform, -1, "mat4", "gl_ModelViewProjectionMatrixInverse" }, + { ir_var_uniform, -1, "mat4", "gl_ModelViewMatrixTranspose" }, + { ir_var_uniform, -1, "mat4", "gl_ProjectionMatrixTranspose" }, + { ir_var_uniform, -1, "mat4", "gl_ModelViewProjectionMatrixTranspose" }, + { ir_var_uniform, -1, "mat4", "gl_ModelViewMatrixInverseTranspose" }, + { ir_var_uniform, -1, "mat4", "gl_ProjectionMatrixInverseTranspose" }, + { ir_var_uniform, -1, "mat4", "gl_ModelViewProjectionMatrixInverseTranspose" }, + { ir_var_uniform, -1, "float", "gl_NormalScale" }, + { ir_var_uniform, -1, "gl_LightModelParameters", "gl_LightModel"}, + + /* Mesa-internal ATI_envmap_bumpmap state. */ + { ir_var_uniform, -1, "vec2", "gl_MESABumpRotMatrix0"}, + { ir_var_uniform, -1, "vec2", "gl_MESABumpRotMatrix1"}, + { ir_var_uniform, -1, "vec4", "gl_MESAFogParamsOptimized"}, +}; + diff --git a/mesalib/src/mesa/main/mipmap.c b/mesalib/src/mesa/main/mipmap.c index c2f922674..f04a98b03 100644 --- a/mesalib/src/mesa/main/mipmap.c +++ b/mesalib/src/mesa/main/mipmap.c @@ -1816,7 +1816,6 @@ generate_mipmap_uncompressed(struct gl_context *ctx, GLenum target, _mesa_init_teximage_fields(ctx, target, dstImage, dstWidth, dstHeight, dstDepth, border, srcImage->InternalFormat, srcImage->TexFormat); - dstImage->DriverData = NULL; /* Alloc storage for new texture image */ if (!ctx->Driver.AllocTextureImageBuffer(ctx, dstImage, @@ -2049,78 +2048,3 @@ _mesa_generate_mipmap(struct gl_context *ctx, GLenum target, generate_mipmap_uncompressed(ctx, target, texObj, srcImage, maxLevel); } } - - -/** - * Helper function for drivers which need to rescale texture images to - * certain aspect ratios. - * Nearest filtering only (for broken hardware that can't support - * all aspect ratios). This can be made a lot faster, but I don't - * really care enough... - */ -void -_mesa_rescale_teximage2d(GLuint bytesPerPixel, - GLuint srcStrideInPixels, - GLuint dstRowStride, - GLint srcWidth, GLint srcHeight, - GLint dstWidth, GLint dstHeight, - const GLvoid *srcImage, GLvoid *dstImage) -{ - GLint row, col; - -#define INNER_LOOP( TYPE, HOP, WOP ) \ - for ( row = 0 ; row < dstHeight ; row++ ) { \ - GLint srcRow = row HOP hScale; \ - for ( col = 0 ; col < dstWidth ; col++ ) { \ - GLint srcCol = col WOP wScale; \ - dst[col] = src[srcRow * srcStrideInPixels + srcCol]; \ - } \ - dst = (TYPE *) ((GLubyte *) dst + dstRowStride); \ - } \ - -#define RESCALE_IMAGE( TYPE ) \ -do { \ - const TYPE *src = (const TYPE *)srcImage; \ - TYPE *dst = (TYPE *)dstImage; \ - \ - if ( srcHeight < dstHeight ) { \ - const GLint hScale = dstHeight / srcHeight; \ - if ( srcWidth < dstWidth ) { \ - const GLint wScale = dstWidth / srcWidth; \ - INNER_LOOP( TYPE, /, / ); \ - } \ - else { \ - const GLint wScale = srcWidth / dstWidth; \ - INNER_LOOP( TYPE, /, * ); \ - } \ - } \ - else { \ - const GLint hScale = srcHeight / dstHeight; \ - if ( srcWidth < dstWidth ) { \ - const GLint wScale = dstWidth / srcWidth; \ - INNER_LOOP( TYPE, *, / ); \ - } \ - else { \ - const GLint wScale = srcWidth / dstWidth; \ - INNER_LOOP( TYPE, *, * ); \ - } \ - } \ -} while (0) - - switch ( bytesPerPixel ) { - case 4: - RESCALE_IMAGE( GLuint ); - break; - - case 2: - RESCALE_IMAGE( GLushort ); - break; - - case 1: - RESCALE_IMAGE( GLubyte ); - break; - default: - _mesa_problem(NULL,"unexpected bytes/pixel in _mesa_rescale_teximage2d"); - } -} - diff --git a/mesalib/src/mesa/main/mipmap.h b/mesalib/src/mesa/main/mipmap.h index 8b7cd7d5a..1fb9146a1 100644 --- a/mesalib/src/mesa/main/mipmap.h +++ b/mesalib/src/mesa/main/mipmap.h @@ -46,13 +46,4 @@ _mesa_generate_mipmap(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj); -extern void -_mesa_rescale_teximage2d(GLuint bytesPerPixel, - GLuint srcStrideInPixels, - GLuint dstRowStride, - GLint srcWidth, GLint srcHeight, - GLint dstWidth, GLint dstHeight, - const GLvoid *srcImage, GLvoid *dstImage); - - #endif /* MIPMAP_H */ diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index 67db4df8f..c97c0bf80 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -73,10 +73,7 @@ struct _mesa_HashTable; struct gl_attrib_node; struct gl_list_extensions; struct gl_meta_state; -struct gl_pixelstore_attrib; struct gl_program_cache; -struct gl_texture_format; -struct gl_texture_image; struct gl_texture_object; struct gl_context; struct st_context; @@ -214,9 +211,10 @@ typedef enum VERT_RESULT_BFC0 = 13, VERT_RESULT_BFC1 = 14, VERT_RESULT_EDGE = 15, - VERT_RESULT_CLIP_DIST0 = 16, - VERT_RESULT_CLIP_DIST1 = 17, - VERT_RESULT_VAR0 = 18, /**< shader varying */ + VERT_RESULT_CLIP_VERTEX = 16, + VERT_RESULT_CLIP_DIST0 = 17, + VERT_RESULT_CLIP_DIST1 = 18, + VERT_RESULT_VAR0 = 19, /**< shader varying */ VERT_RESULT_MAX = (VERT_RESULT_VAR0 + MAX_VARYING) } gl_vert_result; @@ -1268,13 +1266,6 @@ struct gl_texture_image GLuint *ImageOffsets; /**< if 3D texture: array [Depth] of offsets to each 2D slice in 'Data', in texels */ GLvoid *Data; /**< Image data, accessed via FetchTexel() */ - - /** - * \name For device driver: - */ - /*@{*/ - void *DriverData; /**< Arbitrary device driver data */ - /*@}*/ }; @@ -1491,14 +1482,21 @@ struct gl_texture_attrib }; +/** + * Data structure representing a single clip plane (e.g. one of the elements + * of the ctx->Transform.EyeUserPlane or ctx->Transform._ClipUserPlane array). + */ +typedef GLfloat gl_clip_plane[4]; + + /** * Transformation attribute group (GL_TRANSFORM_BIT). */ struct gl_transform_attrib { GLenum MatrixMode; /**< Matrix mode */ - GLfloat EyeUserPlane[MAX_CLIP_PLANES][4]; /**< User clip planes */ - GLfloat _ClipUserPlane[MAX_CLIP_PLANES][4]; /**< derived */ + gl_clip_plane EyeUserPlane[MAX_CLIP_PLANES]; /**< User clip planes */ + gl_clip_plane _ClipUserPlane[MAX_CLIP_PLANES]; /**< derived */ GLbitfield ClipPlanesEnabled; /**< on/off bitmask */ GLboolean Normalize; /**< Normalize all normals? */ GLboolean RescaleNormals; /**< GL_EXT_rescale_normal */ diff --git a/mesalib/src/mesa/main/texcompress_fxt1.c b/mesalib/src/mesa/main/texcompress_fxt1.c index 0437cfcc1..b6d8ae016 100644 --- a/mesalib/src/mesa/main/texcompress_fxt1.c +++ b/mesalib/src/mesa/main/texcompress_fxt1.c @@ -72,7 +72,6 @@ _mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS) ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset == 0); (void) dstZoffset; - (void) dstImageOffsets; if (srcFormat != GL_RGB || srcType != GL_UNSIGNED_BYTE || @@ -99,7 +98,7 @@ _mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS) dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, dstFormat, - texWidth, (GLubyte *) dstAddr); + texWidth, dstSlices[0]); fxt1_encode(srcWidth, srcHeight, 3, pixels, srcRowStride, dst, dstRowStride); @@ -128,7 +127,6 @@ _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS) ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset == 0); (void) dstZoffset; - (void) dstImageOffsets; if (srcFormat != GL_RGBA || srcType != GL_UNSIGNED_BYTE || @@ -155,7 +153,7 @@ _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS) dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, dstFormat, - texWidth, (GLubyte *) dstAddr); + texWidth, dstSlices[0]); fxt1_encode(srcWidth, srcHeight, 4, pixels, srcRowStride, dst, dstRowStride); diff --git a/mesalib/src/mesa/main/texcompress_rgtc.c b/mesalib/src/mesa/main/texcompress_rgtc.c index 398f61290..b03cd28b8 100644 --- a/mesalib/src/mesa/main/texcompress_rgtc.c +++ b/mesalib/src/mesa/main/texcompress_rgtc.c @@ -106,7 +106,6 @@ _mesa_texstore_red_rgtc1(TEXSTORE_PARAMS) ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset % 4 == 0); (void) dstZoffset; - (void) dstImageOffsets; tempImage = _mesa_make_temp_ubyte_image(ctx, dims, @@ -120,7 +119,7 @@ _mesa_texstore_red_rgtc1(TEXSTORE_PARAMS) dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, dstFormat, - texWidth, (GLubyte *) dstAddr); + texWidth, dstSlices[0]); blkaddr = dst; dstRowDiff = dstRowStride >= (srcWidth * 2) ? dstRowStride - (((srcWidth + 3) & ~3) * 2) : 0; @@ -162,7 +161,6 @@ _mesa_texstore_signed_red_rgtc1(TEXSTORE_PARAMS) ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset % 4 == 0); (void) dstZoffset; - (void) dstImageOffsets; tempImage = _mesa_make_temp_float_image(ctx, dims, baseInternalFormat, @@ -175,7 +173,7 @@ _mesa_texstore_signed_red_rgtc1(TEXSTORE_PARAMS) dst = (GLbyte *)_mesa_compressed_image_address(dstXoffset, dstYoffset, 0, dstFormat, - texWidth, (GLubyte *) dstAddr); + texWidth, dstSlices[0]); blkaddr = dst; dstRowDiff = dstRowStride >= (srcWidth * 2) ? dstRowStride - (((srcWidth + 3) & ~3) * 2) : 0; @@ -218,7 +216,6 @@ _mesa_texstore_rg_rgtc2(TEXSTORE_PARAMS) ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset % 4 == 0); (void) dstZoffset; - (void) dstImageOffsets; tempImage = _mesa_make_temp_ubyte_image(ctx, dims, baseInternalFormat, @@ -231,7 +228,7 @@ _mesa_texstore_rg_rgtc2(TEXSTORE_PARAMS) dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, dstFormat, - texWidth, (GLubyte *) dstAddr); + texWidth, dstSlices[0]); blkaddr = dst; dstRowDiff = dstRowStride >= (srcWidth * 4) ? dstRowStride - (((srcWidth + 3) & ~3) * 4) : 0; @@ -280,7 +277,6 @@ _mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS) ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset % 4 == 0); (void) dstZoffset; - (void) dstImageOffsets; tempImage = _mesa_make_temp_float_image(ctx, dims, baseInternalFormat, @@ -293,7 +289,7 @@ _mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS) dst = (GLbyte *)_mesa_compressed_image_address(dstXoffset, dstYoffset, 0, dstFormat, - texWidth, (GLubyte *) dstAddr); + texWidth, dstSlices[0]); blkaddr = dst; dstRowDiff = dstRowStride >= (srcWidth * 4) ? dstRowStride - (((srcWidth + 3) & ~3) * 4) : 0; diff --git a/mesalib/src/mesa/main/texcompress_s3tc.c b/mesalib/src/mesa/main/texcompress_s3tc.c index 8c6b1dfad..b180c80f0 100644 --- a/mesalib/src/mesa/main/texcompress_s3tc.c +++ b/mesalib/src/mesa/main/texcompress_s3tc.c @@ -174,7 +174,6 @@ _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS) ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset % 4 == 0); (void) dstZoffset; - (void) dstImageOffsets; if (srcFormat != GL_RGB || srcType != GL_UNSIGNED_BYTE || @@ -198,7 +197,7 @@ _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS) dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, dstFormat, - texWidth, (GLubyte *) dstAddr); + texWidth, dstSlices[0]); if (ext_tx_compress_dxtn) { (*ext_tx_compress_dxtn)(3, srcWidth, srcHeight, pixels, @@ -233,7 +232,6 @@ _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS) ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset % 4 == 0); (void) dstZoffset; - (void) dstImageOffsets; if (srcFormat != GL_RGBA || srcType != GL_UNSIGNED_BYTE || @@ -257,7 +255,7 @@ _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS) dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, dstFormat, - texWidth, (GLubyte *) dstAddr); + texWidth, dstSlices[0]); if (ext_tx_compress_dxtn) { (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, @@ -291,7 +289,6 @@ _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS) ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset % 4 == 0); (void) dstZoffset; - (void) dstImageOffsets; if (srcFormat != GL_RGBA || srcType != GL_UNSIGNED_BYTE || @@ -314,7 +311,7 @@ _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS) dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, dstFormat, - texWidth, (GLubyte *) dstAddr); + texWidth, dstSlices[0]); if (ext_tx_compress_dxtn) { (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, @@ -348,7 +345,6 @@ _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS) ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset % 4 == 0); (void) dstZoffset; - (void) dstImageOffsets; if (srcFormat != GL_RGBA || srcType != GL_UNSIGNED_BYTE || @@ -371,7 +367,7 @@ _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS) dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, dstFormat, - texWidth, (GLubyte *) dstAddr); + texWidth, dstSlices[0]); if (ext_tx_compress_dxtn) { (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c index d70cb8ac7..cc9fbc020 100644 --- a/mesalib/src/mesa/main/texstore.c +++ b/mesalib/src/mesa/main/texstore.c @@ -850,10 +850,9 @@ _mesa_swizzle_ubyte_image(struct gl_context *ctx, const GLubyte *rgba2dst, GLuint dstComponents, - GLvoid *dstAddr, GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, GLint dstRowStride, - const GLuint *dstImageOffsets, + GLubyte **dstSlices, GLint srcWidth, GLint srcHeight, GLint srcDepth, const GLvoid *srcAddr, @@ -896,7 +895,7 @@ _mesa_swizzle_ubyte_image(struct gl_context *ctx, srcRowStride == srcWidth * srcComponents && dimensions < 3) { /* 1 and 2D images only */ - GLubyte *dstImage = (GLubyte *) dstAddr + GLubyte *dstImage = dstSlices[0] + dstYoffset * dstRowStride + dstXoffset * dstComponents; swizzle_copy(dstImage, dstComponents, srcImage, srcComponents, map, @@ -906,8 +905,7 @@ _mesa_swizzle_ubyte_image(struct gl_context *ctx, GLint img, row; for (img = 0; img < srcDepth; img++) { const GLubyte *srcRow = srcImage; - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * dstComponents + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * dstComponents; for (row = 0; row < srcHeight; row++) { @@ -930,10 +928,9 @@ static void memcpy_texture(struct gl_context *ctx, GLuint dimensions, gl_format dstFormat, - GLvoid *dstAddr, GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, GLint dstRowStride, - const GLuint *dstImageOffsets, + GLubyte **dstSlices, GLint srcWidth, GLint srcHeight, GLint srcDepth, GLenum srcFormat, GLenum srcType, const GLvoid *srcAddr, @@ -948,54 +945,35 @@ memcpy_texture(struct gl_context *ctx, const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLint bytesPerRow = srcWidth * texelBytes; -#if 0 - /* XXX update/re-enable for dstImageOffsets array */ - const GLint bytesPerImage = srcHeight * bytesPerRow; - const GLint bytesPerTexture = srcDepth * bytesPerImage; - GLubyte *dstImage = (GLubyte *) dstAddr - + dstZoffset * dstImageStride - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; - if (dstRowStride == srcRowStride && - dstRowStride == bytesPerRow && - ((dstImageStride == srcImageStride && - dstImageStride == bytesPerImage) || - (srcDepth == 1))) { - /* one big memcpy */ - ctx->Driver.TextureMemCpy(dstImage, srcImage, bytesPerTexture); + dstRowStride == bytesPerRow) { + /* memcpy image by image */ + GLint img; + for (img = 0; img < srcDepth; img++) { + GLubyte *dstImage = dstSlices[dstZoffset + img] + + dstYoffset * dstRowStride + + dstXoffset * texelBytes; + ctx->Driver.TextureMemCpy(dstImage, srcImage, + bytesPerRow * srcHeight); + srcImage += srcImageStride; + } } - else - { + else { + /* memcpy row by row */ GLint img, row; for (img = 0; img < srcDepth; img++) { const GLubyte *srcRow = srcImage; - GLubyte *dstRow = dstImage; + GLubyte *dstRow = dstSlices[dstZoffset + img] + + dstYoffset * dstRowStride + + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { ctx->Driver.TextureMemCpy(dstRow, srcRow, bytesPerRow); dstRow += dstRowStride; srcRow += srcRowStride; } srcImage += srcImageStride; - dstImage += dstImageStride; } } -#endif - - GLint img, row; - for (img = 0; img < srcDepth; img++) { - const GLubyte *srcRow = srcImage; - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; - for (row = 0; row < srcHeight; row++) { - ctx->Driver.TextureMemCpy(dstRow, srcRow, bytesPerRow); - dstRow += dstRowStride; - srcRow += srcRowStride; - } - srcImage += srcImageStride; - } } @@ -1022,9 +1000,8 @@ _mesa_texstore_z32(TEXSTORE_PARAMS) srcType == dstType) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -1032,8 +1009,7 @@ _mesa_texstore_z32(TEXSTORE_PARAMS) /* general path */ GLint img, row; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -1066,8 +1042,7 @@ _mesa_texstore_x8_z24(TEXSTORE_PARAMS) /* general path */ GLint img, row; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -1100,8 +1075,7 @@ _mesa_texstore_z24_x8(TEXSTORE_PARAMS) /* general path */ GLint img, row; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -1142,9 +1116,8 @@ _mesa_texstore_z16(TEXSTORE_PARAMS) srcType == GL_UNSIGNED_SHORT) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -1152,8 +1125,7 @@ _mesa_texstore_z16(TEXSTORE_PARAMS) /* general path */ GLint img, row; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -1192,9 +1164,8 @@ _mesa_texstore_rgb565(TEXSTORE_PARAMS) srcType == GL_UNSIGNED_SHORT_5_6_5) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -1210,7 +1181,7 @@ _mesa_texstore_rgb565(TEXSTORE_PARAMS) const GLubyte *src = (const GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, 0, 0, 0); - GLubyte *dst = (GLubyte *) dstAddr + GLubyte *dst = dstSlices[0] + dstYoffset * dstRowStride + dstXoffset * texelBytes; GLint row, col; @@ -1247,8 +1218,7 @@ _mesa_texstore_rgb565(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -1303,9 +1273,8 @@ _mesa_texstore_rgba8888(TEXSTORE_PARAMS) (srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_BYTE && littleEndian))) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -1319,9 +1288,8 @@ _mesa_texstore_rgba8888(TEXSTORE_PARAMS) (srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_BYTE && !littleEndian))) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -1355,8 +1323,8 @@ _mesa_texstore_rgba8888(TEXSTORE_PARAMS) srcType, baseInternalFormat, dstmap, 4, - dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, dstImageOffsets, + dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcAddr, srcPacking); } @@ -1373,8 +1341,7 @@ _mesa_texstore_rgba8888(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -1429,9 +1396,8 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) srcType == GL_UNSIGNED_INT_8_8_8_8_REV)) { /* simple memcpy path (little endian) */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -1445,9 +1411,8 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) srcType == GL_UNSIGNED_INT_8_8_8_8)) { /* simple memcpy path (big endian) */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -1465,8 +1430,7 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType); GLubyte *srcRow = (GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0); - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -1501,8 +1465,7 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType); GLubyte *srcRow = (GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0); - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -1554,9 +1517,9 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) srcType, baseInternalFormat, dstmap, 4, - dstAddr, dstXoffset, dstYoffset, dstZoffset, + dstXoffset, dstYoffset, dstZoffset, dstRowStride, - dstImageOffsets, + dstSlices, srcWidth, srcHeight, srcDepth, srcAddr, srcPacking); } @@ -1573,8 +1536,7 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -1633,9 +1595,8 @@ _mesa_texstore_rgb888(TEXSTORE_PARAMS) littleEndian) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -1650,8 +1611,7 @@ _mesa_texstore_rgb888(TEXSTORE_PARAMS) _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType); GLubyte *srcRow = (GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0); - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -1684,8 +1644,8 @@ _mesa_texstore_rgb888(TEXSTORE_PARAMS) srcType, baseInternalFormat, dstmap, 3, - dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, dstImageOffsets, + dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcAddr, srcPacking); } @@ -1702,8 +1662,7 @@ _mesa_texstore_rgb888(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -1759,9 +1718,8 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS) littleEndian) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -1776,8 +1734,7 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS) _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType); GLubyte *srcRow = (GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0); - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -1810,8 +1767,8 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS) srcType, baseInternalFormat, dstmap, 3, - dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, dstImageOffsets, + dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcAddr, srcPacking); } @@ -1828,8 +1785,7 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -1866,9 +1822,8 @@ _mesa_texstore_argb4444(TEXSTORE_PARAMS) srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -1885,8 +1840,7 @@ _mesa_texstore_argb4444(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -1934,9 +1888,8 @@ _mesa_texstore_rgba5551(TEXSTORE_PARAMS) srcType == GL_UNSIGNED_SHORT_5_5_5_1) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -1953,8 +1906,7 @@ _mesa_texstore_rgba5551(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -1992,9 +1944,8 @@ _mesa_texstore_argb1555(TEXSTORE_PARAMS) srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -2011,8 +1962,7 @@ _mesa_texstore_argb1555(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -2061,9 +2011,8 @@ _mesa_texstore_argb2101010(TEXSTORE_PARAMS) baseInternalFormat == GL_RGBA) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -2081,8 +2030,7 @@ _mesa_texstore_argb2101010(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; if (baseInternalFormat == GL_RGBA) { @@ -2149,8 +2097,7 @@ _mesa_texstore_unorm44(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -2197,9 +2144,8 @@ _mesa_texstore_unorm88(TEXSTORE_PARAMS) littleEndian) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -2242,8 +2188,8 @@ _mesa_texstore_unorm88(TEXSTORE_PARAMS) srcType, baseInternalFormat, dstmap, 2, - dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, dstImageOffsets, + dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcAddr, srcPacking); } @@ -2260,8 +2206,7 @@ _mesa_texstore_unorm88(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -2319,9 +2264,8 @@ _mesa_texstore_unorm1616(TEXSTORE_PARAMS) littleEndian) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -2339,8 +2283,7 @@ _mesa_texstore_unorm1616(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -2396,9 +2339,8 @@ _mesa_texstore_unorm16(TEXSTORE_PARAMS) littleEndian) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -2416,8 +2358,7 @@ _mesa_texstore_unorm16(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -2454,9 +2395,8 @@ _mesa_texstore_rgba_16(TEXSTORE_PARAMS) srcType == GL_UNSIGNED_SHORT) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -2474,8 +2414,7 @@ _mesa_texstore_rgba_16(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -2519,9 +2458,8 @@ _mesa_texstore_signed_rgba_16(TEXSTORE_PARAMS) srcType == GL_SHORT) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -2545,8 +2483,7 @@ _mesa_texstore_signed_rgba_16(TEXSTORE_PARAMS) * 3 or 4 components/pixel here. */ for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -2597,9 +2534,8 @@ _mesa_texstore_rgb332(TEXSTORE_PARAMS) srcFormat == GL_RGB && srcType == GL_UNSIGNED_BYTE_3_3_2) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -2616,8 +2552,7 @@ _mesa_texstore_rgb332(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -2657,9 +2592,8 @@ _mesa_texstore_unorm8(TEXSTORE_PARAMS) srcType == GL_UNSIGNED_BYTE) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -2686,8 +2620,8 @@ _mesa_texstore_unorm8(TEXSTORE_PARAMS) srcType, baseInternalFormat, dstmap, 1, - dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, dstImageOffsets, + dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcAddr, srcPacking); } @@ -2704,8 +2638,7 @@ _mesa_texstore_unorm8(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -2745,9 +2678,8 @@ _mesa_texstore_ycbcr(TEXSTORE_PARAMS) /* always just memcpy since no pixel transfer ops apply */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -2759,8 +2691,7 @@ _mesa_texstore_ycbcr(TEXSTORE_PARAMS) !littleEndian) { GLint img, row; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -2789,9 +2720,8 @@ _mesa_texstore_dudv8(TEXSTORE_PARAMS) littleEndian) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -2816,8 +2746,8 @@ _mesa_texstore_dudv8(TEXSTORE_PARAMS) GL_UNSIGNED_BYTE, /* hack */ GL_LUMINANCE_ALPHA, /* hack */ dstmap, 2, - dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, dstImageOffsets, + dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcAddr, srcPacking); } @@ -2849,7 +2779,7 @@ _mesa_texstore_dudv8(TEXSTORE_PARAMS) } src = tempImage; - dst = (GLbyte *) dstAddr + dst = (GLbyte *) dstSlices[0] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -2884,9 +2814,8 @@ _mesa_texstore_snorm8(TEXSTORE_PARAMS) srcType == GL_BYTE) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -2904,8 +2833,7 @@ _mesa_texstore_snorm8(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLbyte *dstRow = (GLbyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLbyte *dstRow = (GLbyte *) dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -2943,9 +2871,8 @@ _mesa_texstore_snorm88(TEXSTORE_PARAMS) littleEndian) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -2963,8 +2890,7 @@ _mesa_texstore_snorm88(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLbyte *dstRow = (GLbyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLbyte *dstRow = (GLbyte *) dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -3004,9 +2930,8 @@ _mesa_texstore_snorm16(TEXSTORE_PARAMS) littleEndian) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -3024,8 +2949,7 @@ _mesa_texstore_snorm16(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -3066,9 +2990,8 @@ _mesa_texstore_snorm1616(TEXSTORE_PARAMS) littleEndian) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -3086,8 +3009,7 @@ _mesa_texstore_snorm1616(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -3136,8 +3058,7 @@ _mesa_texstore_signed_rgbx8888(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLbyte *dstRow = (GLbyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLbyte *dstRow = (GLbyte *) dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -3183,9 +3104,8 @@ _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS) (srcFormat == GL_ABGR_EXT && srcType == GL_BYTE && littleEndian))) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -3197,9 +3117,8 @@ _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS) (srcFormat == GL_ABGR_EXT && srcType == GL_BYTE && !littleEndian))) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -3217,8 +3136,7 @@ _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLbyte *dstRow = (GLbyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLbyte *dstRow = (GLbyte *) dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -3274,9 +3192,8 @@ _mesa_texstore_z24_s8(TEXSTORE_PARAMS) !srcPacking->SwapBytes) { /* simple path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -3284,10 +3201,9 @@ _mesa_texstore_z24_s8(TEXSTORE_PARAMS) srcFormat == GL_STENCIL_INDEX) { /* In case we only upload depth we need to preserve the stencil */ for (img = 0; img < srcDepth; img++) { - GLuint *dstRow = (GLuint *) dstAddr - + dstImageOffsets[dstZoffset + img] - + dstYoffset * dstRowStride / sizeof(GLuint) - + dstXoffset; + GLuint *dstRow = (GLuint *) (dstSlices[dstZoffset + img] + + dstYoffset * dstRowStride + + dstXoffset * 4); const GLubyte *src = (const GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, @@ -3357,10 +3273,9 @@ _mesa_texstore_s8_z24(TEXSTORE_PARAMS) srcType == GL_UNSIGNED_INT_24_8_EXT); for (img = 0; img < srcDepth; img++) { - GLuint *dstRow = (GLuint *) dstAddr - + dstImageOffsets[dstZoffset + img] - + dstYoffset * dstRowStride / sizeof(GLuint) - + dstXoffset; + GLuint *dstRow = (GLuint *) (dstSlices[dstZoffset + img] + + dstYoffset * dstRowStride + + dstXoffset * 4); const GLubyte *src = (const GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, @@ -3426,9 +3341,8 @@ _mesa_texstore_s8(TEXSTORE_PARAMS) srcType == GL_UNSIGNED_BYTE) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -3438,8 +3352,7 @@ _mesa_texstore_s8(TEXSTORE_PARAMS) GLint img, row; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride / sizeof(GLuint) + dstXoffset; const GLubyte *src @@ -3513,9 +3426,8 @@ _mesa_texstore_rgba_float32(TEXSTORE_PARAMS) srcType == GL_FLOAT) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -3535,8 +3447,7 @@ _mesa_texstore_rgba_float32(TEXSTORE_PARAMS) return GL_FALSE; bytesPerRow = srcWidth * components * sizeof(GLfloat); for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -3588,9 +3499,8 @@ _mesa_texstore_rgba_float16(TEXSTORE_PARAMS) srcType == GL_HALF_FLOAT_ARB) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -3608,8 +3518,7 @@ _mesa_texstore_rgba_float16(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -3661,9 +3570,8 @@ _mesa_texstore_rgba_int8(TEXSTORE_PARAMS) srcType == GL_BYTE) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -3680,8 +3588,7 @@ _mesa_texstore_rgba_int8(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -3733,9 +3640,8 @@ _mesa_texstore_rgba_int16(TEXSTORE_PARAMS) srcType == GL_SHORT) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -3752,8 +3658,7 @@ _mesa_texstore_rgba_int16(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -3805,9 +3710,8 @@ _mesa_texstore_rgba_int32(TEXSTORE_PARAMS) srcType == GL_INT) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -3824,8 +3728,7 @@ _mesa_texstore_rgba_int32(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -3877,9 +3780,8 @@ _mesa_texstore_rgba_uint8(TEXSTORE_PARAMS) srcType == GL_UNSIGNED_BYTE) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -3894,8 +3796,7 @@ _mesa_texstore_rgba_uint8(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -3947,9 +3848,8 @@ _mesa_texstore_rgba_uint16(TEXSTORE_PARAMS) srcType == GL_UNSIGNED_SHORT) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -3964,8 +3864,7 @@ _mesa_texstore_rgba_uint16(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -4017,9 +3916,8 @@ _mesa_texstore_rgba_uint32(TEXSTORE_PARAMS) srcType == GL_UNSIGNED_INT) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -4034,8 +3932,7 @@ _mesa_texstore_rgba_uint32(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { @@ -4070,9 +3967,9 @@ _mesa_texstore_srgb8(TEXSTORE_PARAMS) newDstFormat = MESA_FORMAT_RGB888; k = _mesa_texstore_rgb888(ctx, dims, baseInternalFormat, - newDstFormat, dstAddr, + newDstFormat, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, dstImageOffsets, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -4091,9 +3988,9 @@ _mesa_texstore_srgba8(TEXSTORE_PARAMS) /* reuse normal rgba texstore code */ newDstFormat = MESA_FORMAT_RGBA8888; k = _mesa_texstore_rgba8888(ctx, dims, baseInternalFormat, - newDstFormat, dstAddr, + newDstFormat, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, dstImageOffsets, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -4113,9 +4010,9 @@ _mesa_texstore_sargb8(TEXSTORE_PARAMS) newDstFormat = MESA_FORMAT_ARGB8888; k = _mesa_texstore_argb8888(ctx, dims, baseInternalFormat, - newDstFormat, dstAddr, + newDstFormat, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, dstImageOffsets, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -4135,12 +4032,12 @@ _mesa_texstore_sl8(TEXSTORE_PARAMS) /* _mesa_textore_a8 handles luminance8 too */ k = _mesa_texstore_unorm8(ctx, dims, baseInternalFormat, - newDstFormat, dstAddr, - dstXoffset, dstYoffset, dstZoffset, - dstRowStride, dstImageOffsets, - srcWidth, srcHeight, srcDepth, - srcFormat, srcType, - srcAddr, srcPacking); + newDstFormat, + dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, + srcAddr, srcPacking); return k; } @@ -4157,9 +4054,9 @@ _mesa_texstore_sla8(TEXSTORE_PARAMS) newDstFormat = MESA_FORMAT_AL88; k = _mesa_texstore_unorm88(ctx, dims, baseInternalFormat, - newDstFormat, dstAddr, + newDstFormat, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, dstImageOffsets, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -4191,9 +4088,8 @@ _mesa_texstore_rgb9_e5(TEXSTORE_PARAMS) srcType == GL_UNSIGNED_INT_5_9_9_9_REV) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -4211,8 +4107,7 @@ _mesa_texstore_rgb9_e5(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * 4 + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * 4; for (row = 0; row < srcHeight; row++) { @@ -4244,9 +4139,8 @@ _mesa_texstore_r11_g11_b10f(TEXSTORE_PARAMS) srcType == GL_UNSIGNED_INT_10F_11F_11F_REV) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -4264,8 +4158,7 @@ _mesa_texstore_r11_g11_b10f(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * 4 + GLubyte *dstRow = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * 4; for (row = 0; row < srcHeight; row++) { @@ -4300,9 +4193,8 @@ _mesa_texstore_z32f_x24s8(TEXSTORE_PARAMS) !srcPacking->SwapBytes) { /* simple path */ memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } @@ -4315,10 +4207,9 @@ _mesa_texstore_z32f_x24s8(TEXSTORE_PARAMS) /* In case we only upload depth we need to preserve the stencil */ for (img = 0; img < srcDepth; img++) { - uint64_t *dstRow = (uint64_t *) dstAddr - + dstImageOffsets[dstZoffset + img] - + dstYoffset * dstRowStride / sizeof(uint64_t) - + dstXoffset; + uint64_t *dstRow = (uint64_t *) (dstSlices[dstZoffset + img] + + dstYoffset * dstRowStride + + dstXoffset * 8); const uint64_t *src = (const uint64_t *) _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, @@ -4356,9 +4247,8 @@ _mesa_texstore_null(TEXSTORE_PARAMS) (void) ctx; (void) dims; (void) baseInternalFormat; (void) dstFormat; - (void) dstAddr; (void) dstXoffset; (void) dstYoffset; (void) dstZoffset; - (void) dstRowStride; (void) dstImageOffsets; + (void) dstRowStride; (void) dstSlices, (void) srcWidth; (void) srcHeight; (void) srcDepth; (void) srcFormat; (void) srcType; (void) srcAddr; @@ -4563,8 +4453,8 @@ _mesa_texstore(TEXSTORE_PARAMS) storeImage = _mesa_get_texstore_func(dstFormat); success = storeImage(ctx, dims, baseInternalFormat, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, dstImageOffsets, + dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); return success; @@ -4603,7 +4493,6 @@ _mesa_store_teximage1d(struct gl_context *ctx, GLenum target, GLint level, struct gl_texture_image *texImage) { const GLbitfield rwMode = get_read_write_mode(format, texImage->TexFormat); - const GLuint zeroImageOffset = 0; GLubyte *dstMap; GLint dstRowStride; GLboolean success; @@ -4634,10 +4523,9 @@ _mesa_store_teximage1d(struct gl_context *ctx, GLenum target, GLint level, success = _mesa_texstore(ctx, 1, texImage->_BaseFormat, texImage->TexFormat, - dstMap, 0, 0, 0, /* dstX/Y/Zoffset */ 0, /* dstRowStride */ - &zeroImageOffset, + &dstMap, width, 1, 1, format, type, pixels, packing); @@ -4666,7 +4554,6 @@ _mesa_store_teximage2d(struct gl_context *ctx, GLenum target, GLint level, struct gl_texture_image *texImage) { const GLbitfield rwMode = get_read_write_mode(format, texImage->TexFormat); - const GLuint zeroImageOffset = 0; GLubyte *dstMap; GLint dstRowStride; GLboolean success; @@ -4705,10 +4592,9 @@ _mesa_store_teximage2d(struct gl_context *ctx, GLenum target, GLint level, assert(dstMap); success = _mesa_texstore(ctx, 2, texImage->_BaseFormat, texImage->TexFormat, - dstMap, 0, 0, 0, /* dstX/Y/Zoffset */ dstRowStride, - &zeroImageOffset, + &dstMap, width, 1, 1, format, type, pixels, packing); ctx->Driver.UnmapTextureImage(ctx, texImage, y); @@ -4727,10 +4613,9 @@ _mesa_store_teximage2d(struct gl_context *ctx, GLenum target, GLint level, assert(dstMap); success = _mesa_texstore(ctx, 2, texImage->_BaseFormat, texImage->TexFormat, - dstMap, 0, 0, 0, /* dstX/Y/Zoffset */ dstRowStride, - &zeroImageOffset, + &dstMap, width, height, 1, format, type, pixels, packing); @@ -4762,9 +4647,7 @@ _mesa_store_teximage3d(struct gl_context *ctx, GLenum target, GLint level, GLboolean success; GLint slice; GLubyte **sliceMaps; - GLuint *dstImageOffsets; GLint dstRowStride; - GLuint texelSize = _mesa_get_format_bytes(texImage->TexFormat); (void) border; @@ -4791,7 +4674,6 @@ _mesa_store_teximage3d(struct gl_context *ctx, GLenum target, GLint level, } sliceMaps = (GLubyte **) malloc(depth * sizeof(GLubyte *)); - dstImageOffsets = (GLuint *) malloc(depth * sizeof(GLuint)); /* Map dest texture buffer slices */ for (slice = 0; slice < depth; slice++) { @@ -4800,17 +4682,12 @@ _mesa_store_teximage3d(struct gl_context *ctx, GLenum target, GLint level, rwMode, &sliceMaps[slice], &dstRowStride); } - /* Compute image slice offsets */ - for (slice = 0; slice < depth; slice++) { - dstImageOffsets[slice] = (sliceMaps[slice] - sliceMaps[0]) / texelSize; - } success = _mesa_texstore(ctx, 3, texImage->_BaseFormat, texImage->TexFormat, - sliceMaps[0], 0, 0, 0, /* dstX/Y/Zoffset */ dstRowStride, - dstImageOffsets, + sliceMaps, width, height, depth, format, type, pixels, packing); @@ -4825,7 +4702,6 @@ _mesa_store_teximage3d(struct gl_context *ctx, GLenum target, GLint level, _mesa_unmap_teximage_pbo(ctx, packing); free(sliceMaps); - free(dstImageOffsets); } @@ -4844,7 +4720,6 @@ _mesa_store_texsubimage1d(struct gl_context *ctx, GLenum target, GLint level, struct gl_texture_image *texImage) { const GLbitfield rwMode = get_read_write_mode(format, texImage->TexFormat); - const GLuint zeroImageOffset = 0; GLubyte *dstMap; GLint dstRowStride; GLboolean success; @@ -4863,10 +4738,9 @@ _mesa_store_texsubimage1d(struct gl_context *ctx, GLenum target, GLint level, success = _mesa_texstore(ctx, 1, texImage->_BaseFormat, texImage->TexFormat, - dstMap, 0, 0, 0, /* dstX/Y/Zoffset */ dstRowStride, - &zeroImageOffset, + &dstMap, width, 1, 1, format, type, pixels, packing); @@ -4894,7 +4768,6 @@ _mesa_store_texsubimage2d(struct gl_context *ctx, GLenum target, GLint level, struct gl_texture_image *texImage) { const GLbitfield rwMode = get_read_write_mode(format, texImage->TexFormat); - const GLuint zeroImageOffset = 0; GLubyte *dstMap; GLint dstRowStride; GLboolean success; @@ -4913,10 +4786,9 @@ _mesa_store_texsubimage2d(struct gl_context *ctx, GLenum target, GLint level, success = _mesa_texstore(ctx, 2, texImage->_BaseFormat, texImage->TexFormat, - dstMap, 0, 0, 0, /* dstX/Y/Zoffset */ dstRowStride, - &zeroImageOffset, + &dstMap, width, height, 1, format, type, pixels, packing); @@ -4946,9 +4818,7 @@ _mesa_store_texsubimage3d(struct gl_context *ctx, GLenum target, GLint level, GLboolean success; GLint slice; GLubyte **sliceMaps; - GLuint *dstImageOffsets; GLint dstRowStride; - GLuint texelSize = _mesa_get_format_bytes(texImage->TexFormat); /* get pointer to src pixels (may be in a pbo which we'll map here) */ pixels = _mesa_validate_pbo_teximage(ctx, 3, width, height, depth, format, @@ -4957,29 +4827,21 @@ _mesa_store_texsubimage3d(struct gl_context *ctx, GLenum target, GLint level, if (!pixels) return; - sliceMaps = (GLubyte **) malloc((zoffset + depth) * sizeof(GLubyte *)); - dstImageOffsets = (GLuint *) malloc((zoffset + depth) * sizeof(GLuint)); + sliceMaps = (GLubyte **) malloc(depth * sizeof(GLubyte *)); /* Map dest texture buffer slices */ for (slice = 0; slice < depth; slice++) { ctx->Driver.MapTextureImage(ctx, texImage, zoffset + slice, xoffset, yoffset, width, height, rwMode, - &sliceMaps[zoffset + slice], &dstRowStride); - } - - /* Compute image slice offsets */ - for (slice = 0; slice < depth; slice++) { - dstImageOffsets[slice] = - (sliceMaps[zoffset + slice] - sliceMaps[zoffset]) / texelSize; + &sliceMaps[slice], &dstRowStride); } success = _mesa_texstore(ctx, 3, texImage->_BaseFormat, texImage->TexFormat, - sliceMaps[zoffset], - 0, 0, 0, /* dstX/Y/Zoffset */ + 0, 0, 0, dstRowStride, - dstImageOffsets, + sliceMaps, width, height, depth, format, type, pixels, packing); @@ -4994,7 +4856,6 @@ _mesa_store_texsubimage3d(struct gl_context *ctx, GLenum target, GLint level, _mesa_unmap_teximage_pbo(ctx, packing); free(sliceMaps); - free(dstImageOffsets); } diff --git a/mesalib/src/mesa/main/texstore.h b/mesalib/src/mesa/main/texstore.h index 24a254ac4..f956b0436 100644 --- a/mesalib/src/mesa/main/texstore.h +++ b/mesalib/src/mesa/main/texstore.h @@ -45,10 +45,9 @@ * \param dims either 1 or 2 or 3 * \param baseInternalFormat user-specified base internal format * \param dstFormat destination Mesa texture format - * \param dstAddr destination image address * \param dstX/Y/Zoffset destination x/y/z offset (ala TexSubImage), in texels * \param dstRowStride destination image row stride, in bytes - * \param dstImageOffsets offset of each 2D slice within 3D texture, in texels + * \param dstSlices array of addresses of image slices (for 3D, array texture) * \param srcWidth/Height/Depth source image size, in pixels * \param srcFormat incoming image format * \param srcType incoming image data type @@ -59,9 +58,9 @@ struct gl_context *ctx, GLuint dims, \ GLenum baseInternalFormat, \ gl_format dstFormat, \ - GLvoid *dstAddr, \ GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, \ - GLint dstRowStride, const GLuint *dstImageOffsets, \ + GLint dstRowStride, \ + GLubyte **dstSlices, \ GLint srcWidth, GLint srcHeight, GLint srcDepth, \ GLenum srcFormat, GLenum srcType, \ const GLvoid *srcAddr, \ diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c index 390c51869..74e87f0e4 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c @@ -494,7 +494,6 @@ make_texture(struct st_context *st, { struct pipe_transfer *transfer; - static const GLuint dstImageOffsets = 0; GLboolean success; GLubyte *dest; const GLbitfield imageTransferStateSave = ctx->_ImageTransferState; @@ -517,10 +516,9 @@ make_texture(struct st_context *st, success = _mesa_texstore(ctx, 2, /* dims */ baseInternalFormat, /* baseInternalFormat */ mformat, /* gl_format */ - dest, /* dest */ 0, 0, 0, /* dstX/Y/Zoffset */ transfer->stride, /* dstRowStride, bytes */ - &dstImageOffsets, /* dstImageOffsets */ + &dest, /* destSlices */ width, height, 1, /* size */ format, type, /* src format/type */ pixels, /* data source */ diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c index 76bf78bbf..169e235ac 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_texture.c +++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c @@ -162,9 +162,9 @@ st_FreeTextureImageBuffer(struct gl_context * ctx, struct gl_texture_image *texI pipe_resource_reference(&stImage->pt, NULL); } - if (texImage->Data) { - _mesa_align_free(texImage->Data); - texImage->Data = NULL; + if (stImage->TexData) { + _mesa_align_free(stImage->TexData); + stImage->TexData = NULL; } } @@ -482,7 +482,7 @@ st_AllocTextureImageBuffer(struct gl_context *ctx, assert(width > 0); assert(height > 0); assert(depth > 0); - assert(!texImage->Data); + assert(!stImage->TexData); assert(!stImage->pt); /* xxx this might be wrong */ /* Look if the parent texture object has space for this image */ @@ -604,6 +604,7 @@ st_TexImage(struct gl_context * ctx, GLuint dstRowStride = 0; struct gl_pixelstore_attrib unpackNB; enum pipe_transfer_usage transfer_usage = 0; + GLubyte *dstMap; DBG("%s target %s level %d %dx%dx%d border %d\n", __FUNCTION__, _mesa_lookup_enum_by_nr(target), level, width, height, depth, border); @@ -650,10 +651,10 @@ st_TexImage(struct gl_context * ctx, */ if (stImage->pt) { pipe_resource_reference(&stImage->pt, NULL); - assert(!texImage->Data); + assert(!stImage->TexData); } - else if (texImage->Data) { - _mesa_align_free(texImage->Data); + else if (stImage->TexData) { + _mesa_align_free(stImage->TexData); } /* @@ -744,8 +745,8 @@ st_TexImage(struct gl_context * ctx, else transfer_usage = PIPE_TRANSFER_WRITE; - texImage->Data = st_texture_image_map(st, stImage, 0, - transfer_usage, 0, 0, width, height); + dstMap = st_texture_image_map(st, stImage, 0, + transfer_usage, 0, 0, width, height); if(stImage->transfer) dstRowStride = stImage->transfer->stride; } @@ -755,10 +756,11 @@ st_TexImage(struct gl_context * ctx, width, height, depth); dstRowStride = _mesa_format_row_stride(texImage->TexFormat, width); - texImage->Data = _mesa_align_malloc(imageSize, 16); + stImage->TexData = _mesa_align_malloc(imageSize, 16); + dstMap = stImage->TexData; } - if (!texImage->Data) { + if (!dstMap) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); return; } @@ -771,16 +773,16 @@ st_TexImage(struct gl_context * ctx, DBG("Upload image %dx%dx%d row_len %x pitch %x\n", width, height, depth, width, dstRowStride); - /* Copy user texture image into the texture buffer. + /* Copy user texture image into the mapped texture buffer. */ if (compressed_src) { const GLuint srcRowStride = _mesa_format_row_stride(texImage->TexFormat, width); if (dstRowStride == srcRowStride) { - memcpy(texImage->Data, pixels, imageSize); + memcpy(dstMap, pixels, imageSize); } else { - char *dst = texImage->Data; + GLubyte *dst = dstMap; const char *src = pixels; GLuint i, bw, bh, lines; _mesa_get_format_block_size(texImage->TexFormat, &bw, &bh); @@ -803,10 +805,9 @@ st_TexImage(struct gl_context * ctx, if (!_mesa_texstore(ctx, dims, texImage->_BaseFormat, texImage->TexFormat, - texImage->Data, 0, 0, 0, /* dstX/Y/Zoffset */ dstRowStride, - texImage->ImageOffsets, + (GLubyte **) &dstMap, /* dstSlice */ width, height, 1, format, type, src, unpack)) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); @@ -816,9 +817,9 @@ st_TexImage(struct gl_context * ctx, /* unmap this slice */ st_texture_image_unmap(st, stImage); /* map next slice of 3D texture */ - texImage->Data = st_texture_image_map(st, stImage, i + 1, - transfer_usage, 0, 0, - width, height); + dstMap = st_texture_image_map(st, stImage, i + 1, + transfer_usage, 0, 0, + width, height); src += srcImageStride; } } @@ -827,9 +828,8 @@ st_TexImage(struct gl_context * ctx, done: _mesa_unmap_teximage_pbo(ctx, unpack); - if (stImage->pt && texImage->Data) { + if (stImage->pt && stImage->transfer) { st_texture_image_unmap(st, stImage); - texImage->Data = NULL; } } @@ -1018,7 +1018,7 @@ st_GetTexImage(struct gl_context * ctx, if (stImage->pt && util_format_is_s3tc(stImage->pt->format)) { /* Need to decompress the texture. * We'll do this by rendering a textured quad (which is hopefully - * faster than using the fallback code in texcompress.c. + * faster than using the fallback code in texcompress.c). * Note that we only expect RGBA formats (no Z/depth formats). */ decompress_with_blit(ctx, format, type, pixels, texImage); @@ -1047,6 +1047,7 @@ st_TexSubimage(struct gl_context *ctx, GLint dims, GLenum target, GLint level, const GLubyte *src; /* init to silence warning only: */ enum pipe_transfer_usage transfer_usage = PIPE_TRANSFER_WRITE; + GLubyte *dstMap; DBG("%s target %s level %d offset %d,%d %dx%d\n", __FUNCTION__, _mesa_lookup_enum_by_nr(target), @@ -1074,13 +1075,13 @@ st_TexSubimage(struct gl_context *ctx, GLint dims, GLenum target, GLint level, else transfer_usage = PIPE_TRANSFER_WRITE; - texImage->Data = st_texture_image_map(st, stImage, zoffset, - transfer_usage, - xoffset, yoffset, - width, height); + dstMap = st_texture_image_map(st, stImage, zoffset, + transfer_usage, + xoffset, yoffset, + width, height); } - if (!texImage->Data) { + if (!dstMap) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage"); goto done; } @@ -1091,10 +1092,9 @@ st_TexSubimage(struct gl_context *ctx, GLint dims, GLenum target, GLint level, for (i = 0; i < depth; i++) { if (!_mesa_texstore(ctx, dims, texImage->_BaseFormat, texImage->TexFormat, - texImage->Data, 0, 0, 0, dstRowStride, - texImage->ImageOffsets, + (GLubyte **) &dstMap, width, height, 1, format, type, src, packing)) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage"); @@ -1104,11 +1104,11 @@ st_TexSubimage(struct gl_context *ctx, GLint dims, GLenum target, GLint level, /* unmap this slice */ st_texture_image_unmap(st, stImage); /* map next slice of 3D texture */ - texImage->Data = st_texture_image_map(st, stImage, - zoffset + i + 1, - transfer_usage, - xoffset, yoffset, - width, height); + dstMap = st_texture_image_map(st, stImage, + zoffset + i + 1, + transfer_usage, + xoffset, yoffset, + width, height); src += srcImageStride; } } @@ -1116,9 +1116,8 @@ st_TexSubimage(struct gl_context *ctx, GLint dims, GLenum target, GLint level, done: _mesa_unmap_teximage_pbo(ctx, packing); - if (stImage->pt && texImage->Data) { + if (stImage->pt && stImage->transfer) { st_texture_image_unmap(st, stImage); - texImage->Data = NULL; } } @@ -1194,14 +1193,15 @@ st_CompressedTexSubImage2D(struct gl_context *ctx, GLenum target, GLint level, int dstBlockStride; int y; enum pipe_format pformat; + GLubyte *dstMap; if (stImage->pt) { pformat = stImage->pt->format; - texImage->Data = st_texture_image_map(st, stImage, 0, - PIPE_TRANSFER_WRITE, - xoffset, yoffset, - width, height); + dstMap = st_texture_image_map(st, stImage, 0, + PIPE_TRANSFER_WRITE, + xoffset, yoffset, + width, height); srcBlockStride = util_format_get_stride(pformat, width); dstBlockStride = stImage->transfer->stride; @@ -1212,7 +1212,7 @@ st_CompressedTexSubImage2D(struct gl_context *ctx, GLenum target, GLint level, return; } - if (!texImage->Data) { + if (!dstMap) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage"); return; } @@ -1223,13 +1223,12 @@ st_CompressedTexSubImage2D(struct gl_context *ctx, GLenum target, GLint level, for (y = 0; y < height; y += util_format_get_blockheight(pformat)) { /* don't need to adjust for xoffset and yoffset as st_texture_image_map does that */ const char *src = (const char*)data + srcBlockStride * util_format_get_nblocksy(pformat, y); - char *dst = (char*)texImage->Data + dstBlockStride * util_format_get_nblocksy(pformat, y); + char *dst = (char *) dstMap + dstBlockStride * util_format_get_nblocksy(pformat, y); memcpy(dst, src, util_format_get_stride(pformat, width)); } - if (stImage->pt) { + if (stImage->pt && stImage->transfer) { st_texture_image_unmap(st, stImage); - texImage->Data = NULL; } } @@ -1356,10 +1355,9 @@ fallback_copy_texsubimage(struct gl_context *ctx, GLenum target, GLint level, _mesa_texstore(ctx, dims, texImage->_BaseFormat, texImage->TexFormat, - texDest, 0, 0, 0, dstRowStride, - texImage->ImageOffsets, + (GLubyte **) &texDest, width, height, 1, GL_RGBA, GL_FLOAT, tempSrc, /* src */ &unpack); @@ -1686,19 +1684,21 @@ copy_image_data_to_texture(struct st_context *st, pipe_resource_reference(&stImage->pt, NULL); } - else if (stImage->base.Data) { + else if (stImage->TexData) { + /* Copy from malloc'd memory */ + /* XXX this should be re-examined/tested with a compressed format */ + GLuint blockSize = util_format_get_blocksize(stObj->pt->format); + GLuint srcRowStride = stImage->base.Width * blockSize; + GLuint srcSliceStride = stImage->base.Height * srcRowStride; st_texture_image_data(st, stObj->pt, stImage->base.Face, dstLevel, - stImage->base.Data, - stImage->base.RowStride * - util_format_get_blocksize(stObj->pt->format), - stImage->base.RowStride * - stImage->base.Height * - util_format_get_blocksize(stObj->pt->format)); - _mesa_align_free(stImage->base.Data); - stImage->base.Data = NULL; + stImage->TexData, + srcRowStride, + srcSliceStride); + _mesa_align_free(stImage->TexData); + stImage->TexData = NULL; } pipe_resource_reference(&stImage->pt, stObj->pt); diff --git a/mesalib/src/mesa/state_tracker/st_texture.c b/mesalib/src/mesa/state_tracker/st_texture.c index c18268829..ca8106b52 100644 --- a/mesalib/src/mesa/state_tracker/st_texture.c +++ b/mesalib/src/mesa/state_tracker/st_texture.c @@ -241,6 +241,7 @@ st_texture_image_unmap(struct st_context *st, pipe_transfer_unmap(pipe, stImage->transfer); pipe->transfer_destroy(pipe, stImage->transfer); + stImage->transfer = NULL; } diff --git a/mesalib/src/mesa/state_tracker/st_texture.h b/mesalib/src/mesa/state_tracker/st_texture.h index dd3bc7310..3d2a6369c 100644 --- a/mesalib/src/mesa/state_tracker/st_texture.h +++ b/mesalib/src/mesa/state_tracker/st_texture.h @@ -45,8 +45,13 @@ struct st_texture_image { struct gl_texture_image base; + /** Used to store texture data that doesn't fit in the patent + * object's mipmap buffer. + */ + GLubyte *TexData; + /* If stImage->pt != NULL, image data is stored here. - * Else if stImage->base.Data != NULL, image is stored there. + * Else if stImage->TexData != NULL, image is stored there. * Else there is no image data. */ struct pipe_resource *pt; diff --git a/mesalib/src/mesa/swrast/s_texfetch.c b/mesalib/src/mesa/swrast/s_texfetch.c index 73b5af319..7573abda6 100644 --- a/mesalib/src/mesa/swrast/s_texfetch.c +++ b/mesalib/src/mesa/swrast/s_texfetch.c @@ -656,6 +656,226 @@ texfetch_funcs[MESA_FORMAT_COUNT] = store_texel_rg_f16 }, + { + MESA_FORMAT_ALPHA_UINT8, + NULL, + NULL, + NULL, + NULL + }, + + { + MESA_FORMAT_ALPHA_UINT16, + NULL, + NULL, + NULL, + NULL + }, + + { + MESA_FORMAT_ALPHA_UINT32, + NULL, + NULL, + NULL, + NULL + }, + + { + MESA_FORMAT_ALPHA_INT8, + NULL, + NULL, + NULL, + NULL + }, + + { + MESA_FORMAT_ALPHA_INT16, + NULL, + NULL, + NULL, + NULL + }, + + { + MESA_FORMAT_ALPHA_INT32, + NULL, + NULL, + NULL, + NULL + }, + + + { + MESA_FORMAT_INTENSITY_UINT8, + NULL, + NULL, + NULL, + NULL + }, + + { + MESA_FORMAT_INTENSITY_UINT16, + NULL, + NULL, + NULL, + NULL + }, + + { + MESA_FORMAT_INTENSITY_UINT32, + NULL, + NULL, + NULL, + NULL + }, + + { + MESA_FORMAT_INTENSITY_INT8, + NULL, + NULL, + NULL, + NULL + }, + + { + MESA_FORMAT_INTENSITY_INT16, + NULL, + NULL, + NULL, + NULL + }, + + { + MESA_FORMAT_INTENSITY_INT32, + NULL, + NULL, + NULL, + NULL + }, + + + { + MESA_FORMAT_LUMINANCE_UINT8, + NULL, + NULL, + NULL, + NULL + }, + + { + MESA_FORMAT_LUMINANCE_UINT16, + NULL, + NULL, + NULL, + NULL + }, + + { + MESA_FORMAT_LUMINANCE_UINT32, + NULL, + NULL, + NULL, + NULL + }, + + { + MESA_FORMAT_LUMINANCE_INT8, + NULL, + NULL, + NULL, + NULL + }, + + { + MESA_FORMAT_LUMINANCE_INT16, + NULL, + NULL, + NULL, + NULL + }, + + { + MESA_FORMAT_LUMINANCE_INT32, + NULL, + NULL, + NULL, + NULL + }, + + + { + MESA_FORMAT_LUMINANCE_ALPHA_UINT8, + NULL, + NULL, + NULL, + NULL + }, + + { + MESA_FORMAT_LUMINANCE_ALPHA_UINT16, + NULL, + NULL, + NULL, + NULL + }, + + { + MESA_FORMAT_LUMINANCE_ALPHA_UINT32, + NULL, + NULL, + NULL, + NULL + }, + + { + MESA_FORMAT_LUMINANCE_ALPHA_INT8, + NULL, + NULL, + NULL, + NULL + }, + + { + MESA_FORMAT_LUMINANCE_ALPHA_INT16, + NULL, + NULL, + NULL, + NULL + }, + + { + MESA_FORMAT_LUMINANCE_ALPHA_INT32, + NULL, + NULL, + NULL, + NULL + }, + + + { + MESA_FORMAT_R_INT8, + NULL, + NULL, + NULL, + NULL + }, + + { + MESA_FORMAT_RG_INT8, + NULL, + NULL, + NULL, + NULL + }, + + { + MESA_FORMAT_RGB_INT8, + NULL, + NULL, + NULL, + NULL + }, + /* non-normalized, signed int */ { MESA_FORMAT_RGBA_INT8, @@ -664,6 +884,27 @@ texfetch_funcs[MESA_FORMAT_COUNT] = fetch_texel_3d_rgba_int8, store_texel_rgba_int8 }, + { + MESA_FORMAT_R_INT16, + NULL, + NULL, + NULL, + NULL + }, + { + MESA_FORMAT_RG_INT16, + NULL, + NULL, + NULL, + NULL + }, + { + MESA_FORMAT_RGB_INT16, + NULL, + NULL, + NULL, + NULL + }, { MESA_FORMAT_RGBA_INT16, fetch_texel_1d_rgba_int16, @@ -671,6 +912,27 @@ texfetch_funcs[MESA_FORMAT_COUNT] = fetch_texel_3d_rgba_int16, store_texel_rgba_int16 }, + { + MESA_FORMAT_R_INT32, + NULL, + NULL, + NULL, + NULL + }, + { + MESA_FORMAT_RG_INT32, + NULL, + NULL, + NULL, + NULL + }, + { + MESA_FORMAT_RGB_INT32, + NULL, + NULL, + NULL, + NULL + }, { MESA_FORMAT_RGBA_INT32, fetch_texel_1d_rgba_int32, @@ -680,6 +942,27 @@ texfetch_funcs[MESA_FORMAT_COUNT] = }, /* non-normalized, unsigned int */ + { + MESA_FORMAT_R_UINT8, + NULL, + NULL, + NULL, + NULL + }, + { + MESA_FORMAT_RG_UINT8, + NULL, + NULL, + NULL, + NULL + }, + { + MESA_FORMAT_RGB_UINT8, + NULL, + NULL, + NULL, + NULL + }, { MESA_FORMAT_RGBA_UINT8, fetch_texel_1d_rgba_uint8, @@ -687,6 +970,27 @@ texfetch_funcs[MESA_FORMAT_COUNT] = fetch_texel_3d_rgba_uint8, store_texel_rgba_uint8 }, + { + MESA_FORMAT_R_UINT16, + NULL, + NULL, + NULL, + NULL + }, + { + MESA_FORMAT_RG_UINT16, + NULL, + NULL, + NULL, + NULL + }, + { + MESA_FORMAT_RGB_UINT16, + NULL, + NULL, + NULL, + NULL + }, { MESA_FORMAT_RGBA_UINT16, fetch_texel_1d_rgba_uint16, @@ -694,6 +998,27 @@ texfetch_funcs[MESA_FORMAT_COUNT] = fetch_texel_3d_rgba_uint16, store_texel_rgba_uint16 }, + { + MESA_FORMAT_R_UINT32, + NULL, + NULL, + NULL, + NULL + }, + { + MESA_FORMAT_RG_UINT32, + NULL, + NULL, + NULL, + NULL + }, + { + MESA_FORMAT_RGB_UINT32, + NULL, + NULL, + NULL, + NULL + }, { MESA_FORMAT_RGBA_UINT32, fetch_texel_1d_rgba_uint32, -- cgit v1.2.3