From 7e9f4ea970e8f7008c212d7d3918a974eb0066da Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 6 Jan 2012 19:27:25 +0100 Subject: libX11 mesa pixman git update 6 jan 2012 --- mesalib/src/mesa/main/bufferobj.c | 18 +- mesalib/src/mesa/main/dd.h | 188 ++++------ mesalib/src/mesa/main/ff_fragment_shader.cpp | 16 +- mesalib/src/mesa/main/format_pack.c | 2 +- mesalib/src/mesa/main/get.c | 2 +- mesalib/src/mesa/main/imports.h | 2 +- mesalib/src/mesa/main/mipmap.c | 7 +- mesalib/src/mesa/main/mtypes.h | 34 +- mesalib/src/mesa/main/pack.c | 39 ++ mesalib/src/mesa/main/shaderapi.c | 2 +- mesalib/src/mesa/main/shaderobj.c | 5 - mesalib/src/mesa/main/texcompress_fxt1.c | 18 +- mesalib/src/mesa/main/texcompress_rgtc.c | 37 +- mesalib/src/mesa/main/texcompress_s3tc.c | 39 +- mesalib/src/mesa/main/texgetimage.c | 10 +- mesalib/src/mesa/main/texgetimage.h | 7 +- mesalib/src/mesa/main/teximage.c | 81 ++--- mesalib/src/mesa/main/teximage.h | 2 +- mesalib/src/mesa/main/texobj.c | 6 +- mesalib/src/mesa/main/texstorage.c | 6 +- mesalib/src/mesa/main/texstore.c | 525 +++++++++------------------ mesalib/src/mesa/main/texstore.h | 94 ++--- mesalib/src/mesa/main/transformfeedback.c | 71 ++-- 23 files changed, 487 insertions(+), 724 deletions(-) (limited to 'mesalib/src/mesa/main') diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c index cc6f6753d..462519895 100644 --- a/mesalib/src/mesa/main/bufferobj.c +++ b/mesalib/src/mesa/main/bufferobj.c @@ -184,7 +184,10 @@ buffer_object_subdata_range_good( struct gl_context * ctx, GLenum target, } if (offset + size > bufObj->Size) { _mesa_error(ctx, GL_INVALID_VALUE, - "%s(size + offset > buffer size)", caller); + "%s(offset %lu + size %lu > buffer size %lu)", caller, + (unsigned long) offset, + (unsigned long) size, + (unsigned long) bufObj->Size); return NULL; } if (_mesa_bufferobj_mapped(bufObj)) { @@ -499,19 +502,20 @@ _mesa_copy_buffer_subdata(struct gl_context *ctx, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) { - GLubyte *srcPtr, *dstPtr; + void *srcPtr, *dstPtr; /* buffer should not already be mapped */ assert(!_mesa_bufferobj_mapped(src)); assert(!_mesa_bufferobj_mapped(dst)); - srcPtr = (GLubyte *) ctx->Driver.MapBufferRange(ctx, 0, src->Size, - GL_MAP_READ_BIT, src); - dstPtr = (GLubyte *) ctx->Driver.MapBufferRange(ctx, 0, dst->Size, - GL_MAP_WRITE_BIT, dst); + srcPtr = ctx->Driver.MapBufferRange(ctx, readOffset, size, + GL_MAP_READ_BIT, src); + dstPtr = ctx->Driver.MapBufferRange(ctx, writeOffset, size, + (GL_MAP_WRITE_BIT | + GL_MAP_INVALIDATE_RANGE_BIT), dst); if (srcPtr && dstPtr) - memcpy(dstPtr + writeOffset, srcPtr + readOffset, size); + memcpy(dstPtr, srcPtr, size); ctx->Driver.UnmapBuffer(ctx, src); ctx->Driver.UnmapBuffer(ctx, dst); diff --git a/mesalib/src/mesa/main/dd.h b/mesalib/src/mesa/main/dd.h index 5816faa78..6707e785d 100644 --- a/mesalib/src/mesa/main/dd.h +++ b/mesalib/src/mesa/main/dd.h @@ -203,83 +203,77 @@ struct dd_function_table { * fully initialized. * The parameters are the same as glTexImage1D(), plus: * \param packing describes how to unpack the source data. - * \param texObj is the target texture object. - * \param texImage is the target texture image. + * \param texImage is the destination texture image. */ - void (*TexImage1D)( struct gl_context *ctx, GLenum target, GLint level, - GLint internalFormat, - GLint width, GLint border, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ); + void (*TexImage1D)(struct gl_context *ctx, + struct gl_texture_image *texImage, + GLint internalFormat, + GLint width, GLint border, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing); /** * Called by glTexImage2D(). * * \sa dd_function_table::TexImage1D. */ - void (*TexImage2D)( struct gl_context *ctx, GLenum target, GLint level, - GLint internalFormat, - GLint width, GLint height, GLint border, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ); + void (*TexImage2D)(struct gl_context *ctx, + struct gl_texture_image *texImage, + GLint internalFormat, + GLint width, GLint height, GLint border, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing); /** * Called by glTexImage3D(). * * \sa dd_function_table::TexImage1D. */ - void (*TexImage3D)( struct gl_context *ctx, GLenum target, GLint level, - GLint internalFormat, - GLint width, GLint height, GLint depth, GLint border, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ); + void (*TexImage3D)(struct gl_context *ctx, + struct gl_texture_image *texImage, + GLint internalFormat, + GLint width, GLint height, GLint depth, GLint border, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing); /** * Called by glTexSubImage1D(). Replace a subset of the target texture * with new texel data. * \sa dd_function_table::TexImage1D. */ - void (*TexSubImage1D)( struct gl_context *ctx, GLenum target, GLint level, - GLint xoffset, GLsizei width, - GLenum format, GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ); + void (*TexSubImage1D)(struct gl_context *ctx, + struct gl_texture_image *texImage, + GLint xoffset, GLsizei width, + GLenum format, GLenum type, + const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing); /** * Called by glTexSubImage2D(). * * \sa dd_function_table::TexSubImage1D. */ - void (*TexSubImage2D)( struct gl_context *ctx, GLenum target, GLint level, - GLint xoffset, GLint yoffset, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ); + void (*TexSubImage2D)(struct gl_context *ctx, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing); /** * Called by glTexSubImage3D(). * * \sa dd_function_table::TexSubImage1D. */ - void (*TexSubImage3D)( struct gl_context *ctx, GLenum target, GLint level, - GLint xoffset, GLint yoffset, GLint zoffset, - GLsizei width, GLsizei height, GLint depth, - GLenum format, GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ); + void (*TexSubImage3D)(struct gl_context *ctx, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLint depth, + GLenum format, GLenum type, + const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing); + /** * Called by glGetTexImage(). @@ -342,105 +336,73 @@ struct dd_function_table { /** * Called by glCompressedTexImage1D(). - * - * \param target user specified. - * \param format user specified. - * \param type user specified. - * \param pixels user specified. - * \param packing indicates the image packing of pixels. - * \param texObj is the target texture object. - * \param texImage is the target texture image. It will have the texture \p - * width, \p height, \p depth, \p border and \p internalFormat information. - * - * \a retainInternalCopy is returned by this function and indicates whether - * core Mesa should keep an internal copy of the texture image. - */ - void (*CompressedTexImage1D)( struct gl_context *ctx, GLenum target, - GLint level, GLint internalFormat, - GLsizei width, GLint border, - GLsizei imageSize, const GLvoid *data, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ); + * The parameters are the same as for glCompressedTexImage1D(), plus a + * pointer to the destination texure image. + */ + void (*CompressedTexImage1D)(struct gl_context *ctx, + struct gl_texture_image *texImage, + GLint internalFormat, + GLsizei width, GLint border, + GLsizei imageSize, const GLvoid *data); /** * Called by glCompressedTexImage2D(). * * \sa dd_function_table::CompressedTexImage1D. */ - void (*CompressedTexImage2D)( struct gl_context *ctx, GLenum target, - GLint level, GLint internalFormat, - GLsizei width, GLsizei height, GLint border, - GLsizei imageSize, const GLvoid *data, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ); + void (*CompressedTexImage2D)(struct gl_context *ctx, + struct gl_texture_image *texImage, + GLint internalFormat, + GLsizei width, GLsizei height, GLint border, + GLsizei imageSize, const GLvoid *data); + /** * Called by glCompressedTexImage3D(). * * \sa dd_function_table::CompressedTexImage3D. */ - void (*CompressedTexImage3D)( struct gl_context *ctx, GLenum target, - GLint level, GLint internalFormat, - GLsizei width, GLsizei height, GLsizei depth, - GLint border, - GLsizei imageSize, const GLvoid *data, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ); + void (*CompressedTexImage3D)(struct gl_context *ctx, + struct gl_texture_image *texImage, + GLint internalFormat, + GLsizei width, GLsizei height, GLsizei depth, + GLint border, + GLsizei imageSize, const GLvoid *data); /** * Called by glCompressedTexSubImage1D(). - * - * \param target user specified. - * \param level user specified. - * \param xoffset user specified. - * \param yoffset user specified. - * \param zoffset user specified. - * \param width user specified. - * \param height user specified. - * \param depth user specified. - * \param imageSize user specified. - * \param data user specified. - * \param texObj is the target texture object. - * \param texImage is the target texture image. It will have the texture \p - * width, \p height, \p depth, \p border and \p internalFormat information. - */ - void (*CompressedTexSubImage1D)(struct gl_context *ctx, GLenum target, GLint level, + */ + void (*CompressedTexSubImage1D)(struct gl_context *ctx, + struct gl_texture_image *texImage, GLint xoffset, GLsizei width, GLenum format, - GLsizei imageSize, const GLvoid *data, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); + GLsizei imageSize, const GLvoid *data); + /** * Called by glCompressedTexSubImage2D(). - * - * \sa dd_function_table::CompressedTexImage3D. */ - void (*CompressedTexSubImage2D)(struct gl_context *ctx, GLenum target, GLint level, + void (*CompressedTexSubImage2D)(struct gl_context *ctx, + struct gl_texture_image *texImage, GLint xoffset, GLint yoffset, GLsizei width, GLint height, GLenum format, - GLsizei imageSize, const GLvoid *data, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); + GLsizei imageSize, const GLvoid *data); + /** * Called by glCompressedTexSubImage3D(). - * - * \sa dd_function_table::CompressedTexImage3D. */ - void (*CompressedTexSubImage3D)(struct gl_context *ctx, GLenum target, GLint level, + void (*CompressedTexSubImage3D)(struct gl_context *ctx, + struct gl_texture_image *texImage, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLint height, GLint depth, GLenum format, - GLsizei imageSize, const GLvoid *data, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); + GLsizei imageSize, const GLvoid *data); /** * Called by glGetCompressedTexImage. */ - void (*GetCompressedTexImage)(struct gl_context *ctx, GLenum target, GLint level, - GLvoid *img, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); + void (*GetCompressedTexImage)(struct gl_context *ctx, + struct gl_texture_image *texImage, + GLvoid *data); /*@}*/ diff --git a/mesalib/src/mesa/main/ff_fragment_shader.cpp b/mesalib/src/mesa/main/ff_fragment_shader.cpp index 008da0d0e..3e736fa15 100644 --- a/mesalib/src/mesa/main/ff_fragment_shader.cpp +++ b/mesalib/src/mesa/main/ff_fragment_shader.cpp @@ -632,15 +632,19 @@ emit_combine_source(struct texenv_fragment_program *p, new(p->mem_ctx) ir_constant(1.0f), src); - case OPR_SRC_ALPHA: - return new(p->mem_ctx) ir_swizzle(src, 3, 3, 3, 3, 1); + case OPR_SRC_ALPHA: + return src->type->is_scalar() + ? src : (ir_rvalue *) new(p->mem_ctx) ir_swizzle(src, 3, 3, 3, 3, 1); + + case OPR_ONE_MINUS_SRC_ALPHA: { + ir_rvalue *const scalar = (src->type->is_scalar()) + ? src : (ir_rvalue *) new(p->mem_ctx) ir_swizzle(src, 3, 3, 3, 3, 1); - case OPR_ONE_MINUS_SRC_ALPHA: return new(p->mem_ctx) ir_expression(ir_binop_sub, new(p->mem_ctx) ir_constant(1.0f), - new(p->mem_ctx) ir_swizzle(src, - 3, 3, - 3, 3, 1)); + scalar); + } + case OPR_ZERO: return new(p->mem_ctx) ir_constant(0.0f); case OPR_ONE: diff --git a/mesalib/src/mesa/main/format_pack.c b/mesalib/src/mesa/main/format_pack.c index 840559bac..43677117e 100644 --- a/mesalib/src/mesa/main/format_pack.c +++ b/mesalib/src/mesa/main/format_pack.c @@ -2453,7 +2453,7 @@ _mesa_pack_ubyte_stencil_row(gl_format format, GLuint n, break; case MESA_FORMAT_Z32_FLOAT_X24S8: { - GLfloat *d = ((GLfloat *) dst); + GLuint *d = dst; GLuint i; for (i = 0; i < n; i++) { d[i * 2 + 1] = src[i]; diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c index 0c9d6b391..5ad601242 100644 --- a/mesalib/src/mesa/main/get.c +++ b/mesalib/src/mesa/main/get.c @@ -2498,7 +2498,7 @@ find_value_indexed(const char *func, GLenum pname, int index, union value *v) goto invalid_value; if (!ctx->Extensions.EXT_transform_feedback) goto invalid_enum; - v->value_int = ctx->TransformFeedback.CurrentObject->Buffers[index]->Name; + v->value_int = ctx->TransformFeedback.CurrentObject->BufferNames[index]; return TYPE_INT; } diff --git a/mesalib/src/mesa/main/imports.h b/mesalib/src/mesa/main/imports.h index d5e3859f8..b7e87439f 100644 --- a/mesalib/src/mesa/main/imports.h +++ b/mesalib/src/mesa/main/imports.h @@ -568,7 +568,7 @@ _mesa_init_sqrt_table(void); #ifdef __GNUC__ -#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(ANDROID) +#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(ANDROID) || defined(__APPLE__) #define ffs __builtin_ffs #define ffsll __builtin_ffsll #endif diff --git a/mesalib/src/mesa/main/mipmap.c b/mesalib/src/mesa/main/mipmap.c index 867cb22e2..867506c9f 100644 --- a/mesalib/src/mesa/main/mipmap.c +++ b/mesalib/src/mesa/main/mipmap.c @@ -1860,7 +1860,7 @@ _mesa_prepare_mipmap_level(struct gl_context *ctx, /* need to (re)allocate image */ ctx->Driver.FreeTextureImageBuffer(ctx, dstImage); - _mesa_init_teximage_fields(ctx, target, dstImage, + _mesa_init_teximage_fields(ctx, dstImage, width, height, depth, border, intFormat, format); @@ -2132,11 +2132,10 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target, } /* The image space was allocated above so use glTexSubImage now */ - ctx->Driver.TexSubImage2D(ctx, target, level + 1, + ctx->Driver.TexSubImage2D(ctx, dstImage, 0, 0, dstWidth, dstHeight, temp_base_format, temp_datatype, - temp_dst, &ctx->DefaultPacking, - texObj, dstImage); + temp_dst, &ctx->DefaultPacking); /* swap src and dest pointers */ { diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index 107371e52..dcb987116 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -1817,10 +1817,21 @@ struct prog_instruction; struct gl_program_parameter_list; struct gl_uniform_list; +struct gl_transform_feedback_varying_info { + char *Name; + GLenum Type; + GLint Size; +}; + /** Post-link transform feedback info. */ struct gl_transform_feedback_info { unsigned NumOutputs; + /** + * Number of transform feedback buffers in use by this program. + */ + unsigned NumBuffers; + struct { unsigned OutputRegister; unsigned OutputBuffer; @@ -1828,8 +1839,22 @@ struct gl_transform_feedback_info { /** offset (in DWORDs) of this output within the interleaved structure */ unsigned DstOffset; + + /** + * Offset into the output register of the data to output. For example, + * if NumComponents is 2 and ComponentOffset is 1, then the data to + * offset is in the y and z components of the output register. + */ + unsigned ComponentOffset; } Outputs[MAX_PROGRAM_OUTPUTS]; + /** Transform feedback varyings used for the linking of this shader program. + * + * Use for glGetTransformFeedbackVarying(). + */ + struct gl_transform_feedback_varying_info *Varyings; + GLint NumVarying; + /** * Total number of components stored in each buffer. This may be used by * hardware back-ends to determine the correct stride when interleaving @@ -2222,7 +2247,13 @@ struct gl_shader_program */ struct string_to_uint_map *FragDataBindings; - /** Transform feedback varyings */ + /** + * Transform feedback varyings last specified by + * glTransformFeedbackVaryings(). + * + * For the current set of transform feeedback varyings used for transform + * feedback output, see LinkedTransformFeedback. + */ struct { GLenum BufferMode; GLuint NumVarying; @@ -2273,7 +2304,6 @@ struct gl_shader_program /** Which texture target is being sampled (TEXTURE_1D/2D/3D/etc_INDEX) */ gl_texture_index SamplerTargets[MAX_SAMPLERS]; - struct gl_program_parameter_list *Varying; GLboolean LinkStatus; /**< GL_LINK_STATUS */ GLboolean Validated; GLboolean _Used; /**< Ever used for drawing? */ diff --git a/mesalib/src/mesa/main/pack.c b/mesalib/src/mesa/main/pack.c index 2933ff638..8f2c8fd97 100644 --- a/mesalib/src/mesa/main/pack.c +++ b/mesalib/src/mesa/main/pack.c @@ -692,6 +692,12 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4], dst[i] = (GLubyte) rgba[i][ACOMP]; } break; + case GL_RG_INTEGER: + for (i=0;iShader.CurrentGeometryProgram || shProg == ctx->Shader.CurrentFragmentProgram)) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glLinkProgram(transform feedback active"); + "glLinkProgram(transform feedback active)"); return; } diff --git a/mesalib/src/mesa/main/shaderobj.c b/mesalib/src/mesa/main/shaderobj.c index 454007f83..de66851e9 100644 --- a/mesalib/src/mesa/main/shaderobj.c +++ b/mesalib/src/mesa/main/shaderobj.c @@ -286,11 +286,6 @@ _mesa_clear_shader_program_data(struct gl_context *ctx, shProg->UniformHash = NULL; } - if (shProg->Varying) { - _mesa_free_parameter_list(shProg->Varying); - shProg->Varying = NULL; - } - assert(shProg->InfoLog != NULL); ralloc_free(shProg->InfoLog); shProg->InfoLog = ralloc_strdup(shProg, ""); diff --git a/mesalib/src/mesa/main/texcompress_fxt1.c b/mesalib/src/mesa/main/texcompress_fxt1.c index d5c73e3b4..2480ffb38 100644 --- a/mesalib/src/mesa/main/texcompress_fxt1.c +++ b/mesalib/src/mesa/main/texcompress_fxt1.c @@ -64,14 +64,9 @@ _mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS) const GLubyte *pixels; GLint srcRowStride; GLubyte *dst; - const GLint texWidth = dstRowStride * 8 / 16; /* a bit of a hack */ const GLubyte *tempImage = NULL; ASSERT(dstFormat == MESA_FORMAT_RGB_FXT1); - ASSERT(dstXoffset % 8 == 0); - ASSERT(dstYoffset % 4 == 0); - ASSERT(dstZoffset == 0); - (void) dstZoffset; if (srcFormat != GL_RGB || srcType != GL_UNSIGNED_BYTE || @@ -99,9 +94,7 @@ _mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS) srcType) / sizeof(GLubyte); } - dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, - dstFormat, - texWidth, dstSlices[0]); + dst = dstSlices[0]; fxt1_encode(srcWidth, srcHeight, 3, pixels, srcRowStride, dst, dstRowStride); @@ -122,14 +115,9 @@ _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS) const GLubyte *pixels; GLint srcRowStride; GLubyte *dst; - GLint texWidth = dstRowStride * 8 / 16; /* a bit of a hack */ const GLubyte *tempImage = NULL; ASSERT(dstFormat == MESA_FORMAT_RGBA_FXT1); - ASSERT(dstXoffset % 8 == 0); - ASSERT(dstYoffset % 4 == 0); - ASSERT(dstZoffset == 0); - (void) dstZoffset; if (srcFormat != GL_RGBA || srcType != GL_UNSIGNED_BYTE || @@ -156,9 +144,7 @@ _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS) srcType) / sizeof(GLubyte); } - dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, - dstFormat, - texWidth, dstSlices[0]); + dst = 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 3586fc39d..b8e334b45 100644 --- a/mesalib/src/mesa/main/texcompress_rgtc.c +++ b/mesalib/src/mesa/main/texcompress_rgtc.c @@ -92,7 +92,6 @@ GLboolean _mesa_texstore_red_rgtc1(TEXSTORE_PARAMS) { GLubyte *dst; - const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */ const GLubyte *tempImage = NULL; int i, j; int numxpixels, numypixels; @@ -102,11 +101,6 @@ _mesa_texstore_red_rgtc1(TEXSTORE_PARAMS) GLint dstRowDiff; ASSERT(dstFormat == MESA_FORMAT_RED_RGTC1 || dstFormat == MESA_FORMAT_L_LATC1); - ASSERT(dstXoffset % 4 == 0); - ASSERT(dstYoffset % 4 == 0); - ASSERT(dstZoffset % 4 == 0); - (void) dstZoffset; - tempImage = _mesa_make_temp_ubyte_image(ctx, dims, baseInternalFormat, @@ -117,9 +111,7 @@ _mesa_texstore_red_rgtc1(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; /* out of memory */ - dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, - dstFormat, - texWidth, dstSlices[0]); + dst = dstSlices[0]; blkaddr = dst; dstRowDiff = dstRowStride >= (srcWidth * 2) ? dstRowStride - (((srcWidth + 3) & ~3) * 2) : 0; @@ -147,7 +139,6 @@ GLboolean _mesa_texstore_signed_red_rgtc1(TEXSTORE_PARAMS) { GLbyte *dst; - const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */ const GLfloat *tempImage = NULL; int i, j; int numxpixels, numypixels; @@ -157,10 +148,6 @@ _mesa_texstore_signed_red_rgtc1(TEXSTORE_PARAMS) GLint dstRowDiff; ASSERT(dstFormat == MESA_FORMAT_SIGNED_RED_RGTC1 || dstFormat == MESA_FORMAT_SIGNED_L_LATC1); - ASSERT(dstXoffset % 4 == 0); - ASSERT(dstYoffset % 4 == 0); - ASSERT(dstZoffset % 4 == 0); - (void) dstZoffset; tempImage = _mesa_make_temp_float_image(ctx, dims, baseInternalFormat, @@ -171,9 +158,7 @@ _mesa_texstore_signed_red_rgtc1(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; /* out of memory */ - dst = (GLbyte *)_mesa_compressed_image_address(dstXoffset, dstYoffset, 0, - dstFormat, - texWidth, dstSlices[0]); + dst = (GLbyte *) dstSlices[0]; blkaddr = dst; dstRowDiff = dstRowStride >= (srcWidth * 2) ? dstRowStride - (((srcWidth + 3) & ~3) * 2) : 0; @@ -201,7 +186,6 @@ GLboolean _mesa_texstore_rg_rgtc2(TEXSTORE_PARAMS) { GLubyte *dst; - const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */ const GLubyte *tempImage = NULL; int i, j; int numxpixels, numypixels; @@ -212,10 +196,6 @@ _mesa_texstore_rg_rgtc2(TEXSTORE_PARAMS) ASSERT(dstFormat == MESA_FORMAT_RG_RGTC2 || dstFormat == MESA_FORMAT_LA_LATC2); - ASSERT(dstXoffset % 4 == 0); - ASSERT(dstYoffset % 4 == 0); - ASSERT(dstZoffset % 4 == 0); - (void) dstZoffset; tempImage = _mesa_make_temp_ubyte_image(ctx, dims, baseInternalFormat, @@ -226,9 +206,7 @@ _mesa_texstore_rg_rgtc2(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; /* out of memory */ - dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, - dstFormat, - texWidth, dstSlices[0]); + dst = dstSlices[0]; blkaddr = dst; dstRowDiff = dstRowStride >= (srcWidth * 4) ? dstRowStride - (((srcWidth + 3) & ~3) * 4) : 0; @@ -262,7 +240,6 @@ GLboolean _mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS) { GLbyte *dst; - const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */ const GLfloat *tempImage = NULL; int i, j; int numxpixels, numypixels; @@ -273,10 +250,6 @@ _mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS) ASSERT(dstFormat == MESA_FORMAT_SIGNED_RG_RGTC2 || dstFormat == MESA_FORMAT_SIGNED_LA_LATC2); - ASSERT(dstXoffset % 4 == 0); - ASSERT(dstYoffset % 4 == 0); - ASSERT(dstZoffset % 4 == 0); - (void) dstZoffset; tempImage = _mesa_make_temp_float_image(ctx, dims, baseInternalFormat, @@ -287,9 +260,7 @@ _mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; /* out of memory */ - dst = (GLbyte *)_mesa_compressed_image_address(dstXoffset, dstYoffset, 0, - dstFormat, - texWidth, dstSlices[0]); + dst = (GLbyte *) 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 ed7eae4f4..995e079fd 100644 --- a/mesalib/src/mesa/main/texcompress_s3tc.c +++ b/mesalib/src/mesa/main/texcompress_s3tc.c @@ -165,15 +165,10 @@ _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS) { const GLubyte *pixels; GLubyte *dst; - const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */ const GLubyte *tempImage = NULL; ASSERT(dstFormat == MESA_FORMAT_RGB_DXT1 || dstFormat == MESA_FORMAT_SRGB_DXT1); - ASSERT(dstXoffset % 4 == 0); - ASSERT(dstYoffset % 4 == 0); - ASSERT(dstZoffset % 4 == 0); - (void) dstZoffset; if (srcFormat != GL_RGB || srcType != GL_UNSIGNED_BYTE || @@ -197,9 +192,7 @@ _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS) srcFormat, srcType, 0, 0); } - dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, - dstFormat, - texWidth, dstSlices[0]); + dst = dstSlices[0]; if (ext_tx_compress_dxtn) { (*ext_tx_compress_dxtn)(3, srcWidth, srcHeight, pixels, @@ -225,15 +218,10 @@ _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS) { const GLubyte *pixels; GLubyte *dst; - const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */ const GLubyte *tempImage = NULL; ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT1 || dstFormat == MESA_FORMAT_SRGBA_DXT1); - ASSERT(dstXoffset % 4 == 0); - ASSERT(dstYoffset % 4 == 0); - ASSERT(dstZoffset % 4 == 0); - (void) dstZoffset; if (srcFormat != GL_RGBA || srcType != GL_UNSIGNED_BYTE || @@ -257,9 +245,8 @@ _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS) srcFormat, srcType, 0, 0); } - dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, - dstFormat, - texWidth, dstSlices[0]); + dst = dstSlices[0]; + if (ext_tx_compress_dxtn) { (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, @@ -284,15 +271,10 @@ _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS) { const GLubyte *pixels; GLubyte *dst; - const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */ const GLubyte *tempImage = NULL; ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT3 || dstFormat == MESA_FORMAT_SRGBA_DXT3); - ASSERT(dstXoffset % 4 == 0); - ASSERT(dstYoffset % 4 == 0); - ASSERT(dstZoffset % 4 == 0); - (void) dstZoffset; if (srcFormat != GL_RGBA || srcType != GL_UNSIGNED_BYTE || @@ -315,9 +297,8 @@ _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS) srcFormat, srcType, 0, 0); } - dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, - dstFormat, - texWidth, dstSlices[0]); + dst = dstSlices[0]; + if (ext_tx_compress_dxtn) { (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, @@ -342,15 +323,10 @@ _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS) { const GLubyte *pixels; GLubyte *dst; - const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */ const GLubyte *tempImage = NULL; ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT5 || dstFormat == MESA_FORMAT_SRGBA_DXT5); - ASSERT(dstXoffset % 4 == 0); - ASSERT(dstYoffset % 4 == 0); - ASSERT(dstZoffset % 4 == 0); - (void) dstZoffset; if (srcFormat != GL_RGBA || srcType != GL_UNSIGNED_BYTE || @@ -373,9 +349,8 @@ _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS) srcFormat, srcType, 0, 0); } - dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, - dstFormat, - texWidth, dstSlices[0]); + dst = 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/texgetimage.c b/mesalib/src/mesa/main/texgetimage.c index 738c18112..f848aa89d 100644 --- a/mesalib/src/mesa/main/texgetimage.c +++ b/mesalib/src/mesa/main/texgetimage.c @@ -603,10 +603,9 @@ _mesa_get_teximage(struct gl_context *ctx, * All error checking will have been done before this routine is called. */ void -_mesa_get_compressed_teximage(struct gl_context *ctx, GLenum target, GLint level, - GLvoid *img, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage) +_mesa_get_compressed_teximage(struct gl_context *ctx, + struct gl_texture_image *texImage, + GLvoid *img) { const GLuint row_stride = _mesa_format_row_stride(texImage->TexFormat, texImage->Width); @@ -981,8 +980,7 @@ _mesa_GetnCompressedTexImageARB(GLenum target, GLint level, GLsizei bufSize, _mesa_lock_texture(ctx, texObj); { - ctx->Driver.GetCompressedTexImage(ctx, target, level, img, - texObj, texImage); + ctx->Driver.GetCompressedTexImage(ctx, texImage, img); } _mesa_unlock_texture(ctx, texObj); } diff --git a/mesalib/src/mesa/main/texgetimage.h b/mesalib/src/mesa/main/texgetimage.h index 02b1cf459..cd8e76e7a 100644 --- a/mesalib/src/mesa/main/texgetimage.h +++ b/mesalib/src/mesa/main/texgetimage.h @@ -40,10 +40,9 @@ _mesa_get_teximage(struct gl_context *ctx, extern void -_mesa_get_compressed_teximage(struct gl_context *ctx, GLenum target, GLint level, - GLvoid *img, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); +_mesa_get_compressed_teximage(struct gl_context *ctx, + struct gl_texture_image *texImage, + GLvoid *data); diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c index 18a7b87c0..6dd70b96c 100644 --- a/mesalib/src/mesa/main/teximage.c +++ b/mesalib/src/mesa/main/teximage.c @@ -1059,7 +1059,6 @@ clear_teximage_fields(struct gl_texture_image *img) * Initialize basic fields of the gl_texture_image struct. * * \param ctx GL context. - * \param target texture target (GL_TEXTURE_1D, GL_TEXTURE_RECTANGLE, etc). * \param img texture image structure to be initialized. * \param width image width. * \param height image height. @@ -1072,7 +1071,7 @@ clear_teximage_fields(struct gl_texture_image *img) * Note: width, height and depth include the border. */ void -_mesa_init_teximage_fields(struct gl_context *ctx, GLenum target, +_mesa_init_teximage_fields(struct gl_context *ctx, struct gl_texture_image *img, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum internalFormat, @@ -2422,7 +2421,7 @@ teximage(struct gl_context *ctx, GLuint dims, format, type); if (legal_texture_size(ctx, texFormat, width, height, depth)) { - _mesa_init_teximage_fields(ctx, target, texImage, width, height, + _mesa_init_teximage_fields(ctx, texImage, width, height, depth, border, internalFormat, texFormat); } @@ -2473,7 +2472,7 @@ teximage(struct gl_context *ctx, GLuint dims, type); if (legal_texture_size(ctx, texFormat, width, height, depth)) { - _mesa_init_teximage_fields(ctx, target, texImage, + _mesa_init_teximage_fields(ctx, texImage, width, height, depth, border, internalFormat, texFormat); @@ -2481,22 +2480,19 @@ teximage(struct gl_context *ctx, GLuint dims, ASSERT(ctx->Driver.TexImage3D); switch (dims) { case 1: - ctx->Driver.TexImage1D(ctx, target, level, internalFormat, + ctx->Driver.TexImage1D(ctx, texImage, internalFormat, width, border, format, - type, pixels, unpack, texObj, - texImage); + type, pixels, unpack); break; case 2: - ctx->Driver.TexImage2D(ctx, target, level, internalFormat, + ctx->Driver.TexImage2D(ctx, texImage, internalFormat, width, height, border, format, - type, pixels, unpack, texObj, - texImage); + type, pixels, unpack); break; case 3: - ctx->Driver.TexImage3D(ctx, target, level, internalFormat, + ctx->Driver.TexImage3D(ctx, texImage, internalFormat, width, height, depth, border, format, - type, pixels, unpack, texObj, - texImage); + type, pixels, unpack); break; default: _mesa_problem(ctx, "invalid dims=%u in teximage()", dims); @@ -2681,23 +2677,20 @@ texsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level, switch (dims) { case 1: - ctx->Driver.TexSubImage1D(ctx, target, level, + ctx->Driver.TexSubImage1D(ctx, texImage, xoffset, width, - format, type, pixels, - &ctx->Unpack, texObj, texImage ); + format, type, pixels, &ctx->Unpack); break; case 2: - ctx->Driver.TexSubImage2D(ctx, target, level, + ctx->Driver.TexSubImage2D(ctx, texImage, xoffset, yoffset, width, height, - format, type, pixels, - &ctx->Unpack, texObj, texImage ); + format, type, pixels, &ctx->Unpack); break; case 3: - ctx->Driver.TexSubImage3D(ctx, target, level, + ctx->Driver.TexSubImage3D(ctx, texImage, xoffset, yoffset, zoffset, width, height, depth, - format, type, pixels, - &ctx->Unpack, texObj, texImage ); + format, type, pixels, &ctx->Unpack); break; default: _mesa_problem(ctx, "unexpected dims in subteximage()"); @@ -2818,19 +2811,19 @@ copyteximage(struct gl_context *ctx, GLuint dims, /* Free old texture image */ ctx->Driver.FreeTextureImageBuffer(ctx, texImage); - _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1, + _mesa_init_teximage_fields(ctx, texImage, width, height, 1, border, internalFormat, texFormat); /* Allocate texture memory (no pixel data yet) */ if (dims == 1) { - ctx->Driver.TexImage1D(ctx, target, level, internalFormat, + ctx->Driver.TexImage1D(ctx, texImage, internalFormat, width, border, GL_NONE, GL_NONE, NULL, - &ctx->Unpack, texObj, texImage); + &ctx->Unpack); } else { - ctx->Driver.TexImage2D(ctx, target, level, internalFormat, + ctx->Driver.TexImage2D(ctx, texImage, internalFormat, width, height, border, GL_NONE, GL_NONE, - NULL, &ctx->Unpack, texObj, texImage); + NULL, &ctx->Unpack); } if (_mesa_clip_copytexsubimage(ctx, &dstX, &dstY, &srcX, &srcY, @@ -3410,7 +3403,7 @@ compressedteximage(struct gl_context *ctx, GLuint dims, } else { /* no error: store the teximage parameters */ - _mesa_init_teximage_fields(ctx, target, texImage, width, height, + _mesa_init_teximage_fields(ctx, texImage, width, height, depth, border, internalFormat, MESA_FORMAT_NONE); } @@ -3445,34 +3438,31 @@ compressedteximage(struct gl_context *ctx, GLuint dims, GL_NONE); if (legal_texture_size(ctx, texFormat, width, height, depth)) { - _mesa_init_teximage_fields(ctx, target, texImage, + _mesa_init_teximage_fields(ctx, texImage, width, height, depth, border, internalFormat, texFormat); switch (dims) { case 1: ASSERT(ctx->Driver.CompressedTexImage1D); - ctx->Driver.CompressedTexImage1D(ctx, target, level, + ctx->Driver.CompressedTexImage1D(ctx, texImage, internalFormat, width, - border, imageSize, data, - texObj, texImage); + border, imageSize, data); break; case 2: ASSERT(ctx->Driver.CompressedTexImage2D); - ctx->Driver.CompressedTexImage2D(ctx, target, level, + ctx->Driver.CompressedTexImage2D(ctx, texImage, internalFormat, width, height, - border, imageSize, data, - texObj, texImage); + border, imageSize, data); break; case 3: ASSERT(ctx->Driver.CompressedTexImage3D); - ctx->Driver.CompressedTexImage3D(ctx, target, level, + ctx->Driver.CompressedTexImage3D(ctx, texImage, internalFormat, width, height, depth, - border, imageSize, data, - texObj, texImage); + border, imageSize, data); break; default: _mesa_problem(ctx, "bad dims in compressedteximage"); @@ -3570,28 +3560,25 @@ compressed_tex_sub_image(GLuint dims, GLenum target, GLint level, switch (dims) { case 1: if (ctx->Driver.CompressedTexSubImage1D) { - ctx->Driver.CompressedTexSubImage1D(ctx, target, level, + ctx->Driver.CompressedTexSubImage1D(ctx, texImage, xoffset, width, - format, imageSize, data, - texObj, texImage); + format, imageSize, data); } break; case 2: if (ctx->Driver.CompressedTexSubImage2D) { - ctx->Driver.CompressedTexSubImage2D(ctx, target, level, + ctx->Driver.CompressedTexSubImage2D(ctx, texImage, xoffset, yoffset, width, height, - format, imageSize, data, - texObj, texImage); + format, imageSize, data); } break; case 3: if (ctx->Driver.CompressedTexSubImage3D) { - ctx->Driver.CompressedTexSubImage3D(ctx, target, level, + ctx->Driver.CompressedTexSubImage3D(ctx, texImage, xoffset, yoffset, zoffset, width, height, depth, - format, imageSize, data, - texObj, texImage); + format, imageSize, data); } break; default: diff --git a/mesalib/src/mesa/main/teximage.h b/mesalib/src/mesa/main/teximage.h index 0354c9ac5..12af0e6d6 100644 --- a/mesalib/src/mesa/main/teximage.h +++ b/mesalib/src/mesa/main/teximage.h @@ -67,7 +67,7 @@ _mesa_delete_texture_image( struct gl_context *ctx, extern void -_mesa_init_teximage_fields(struct gl_context *ctx, GLenum target, +_mesa_init_teximage_fields(struct gl_context *ctx, struct gl_texture_image *img, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum internalFormat, diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c index 8e447cabd..7ee200585 100644 --- a/mesalib/src/mesa/main/texobj.c +++ b/mesalib/src/mesa/main/texobj.c @@ -793,16 +793,16 @@ _mesa_get_fallback_texture(struct gl_context *ctx) GL_UNSIGNED_BYTE); /* init the image fields */ - _mesa_init_teximage_fields(ctx, GL_TEXTURE_2D, texImage, + _mesa_init_teximage_fields(ctx, texImage, 8, 8, 1, 0, GL_RGBA, texFormat); ASSERT(texImage->TexFormat != MESA_FORMAT_NONE); /* set image data */ - ctx->Driver.TexImage2D(ctx, GL_TEXTURE_2D, 0, GL_RGBA, + ctx->Driver.TexImage2D(ctx, texImage, GL_RGBA, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, texels, - &ctx->DefaultPacking, texObj, texImage); + &ctx->DefaultPacking); _mesa_test_texobj_completeness(ctx, texObj); assert(texObj->_Complete); diff --git a/mesalib/src/mesa/main/texstorage.c b/mesalib/src/mesa/main/texstorage.c index 241a940cc..5e1f31a93 100644 --- a/mesalib/src/mesa/main/texstorage.c +++ b/mesalib/src/mesa/main/texstorage.c @@ -155,7 +155,7 @@ setup_texstorage(struct gl_context *ctx, return; } - _mesa_init_teximage_fields(ctx, target, texImage, + _mesa_init_teximage_fields(ctx, texImage, levelWidth, levelHeight, levelDepth, 0, internalFormat, texFormat); } @@ -180,7 +180,7 @@ setup_texstorage(struct gl_context *ctx, for (face = 0; face < numFaces; face++) { struct gl_texture_image *texImage = texObj->Image[face][level]; if (texImage) { - _mesa_init_teximage_fields(ctx, target, texImage, + _mesa_init_teximage_fields(ctx, texImage, 0, 0, 0, 0, GL_NONE, MESA_FORMAT_NONE); } @@ -223,7 +223,7 @@ clear_image_fields(struct gl_context *ctx, return; } - _mesa_init_teximage_fields(ctx, target, texImage, + _mesa_init_teximage_fields(ctx, texImage, 0, 0, 0, 0, GL_NONE, MESA_FORMAT_NONE); } } diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c index 86c35d38f..512965fc3 100644 --- a/mesalib/src/mesa/main/texstore.c +++ b/mesalib/src/mesa/main/texstore.c @@ -851,7 +851,6 @@ _mesa_swizzle_ubyte_image(struct gl_context *ctx, const GLubyte *rgba2dst, GLuint dstComponents, - GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, GLint dstRowStride, GLubyte **dstSlices, @@ -896,9 +895,7 @@ _mesa_swizzle_ubyte_image(struct gl_context *ctx, srcRowStride == srcWidth * srcComponents && dimensions < 3) { /* 1 and 2D images only */ - GLubyte *dstImage = dstSlices[0] - + dstYoffset * dstRowStride - + dstXoffset * dstComponents; + GLubyte *dstImage = dstSlices[0]; swizzle_copy(dstImage, dstComponents, srcImage, srcComponents, map, srcWidth * srcHeight); } @@ -906,9 +903,7 @@ _mesa_swizzle_ubyte_image(struct gl_context *ctx, GLint img, row; for (img = 0; img < srcDepth; img++) { const GLubyte *srcRow = srcImage; - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * dstComponents; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { swizzle_copy(dstRow, dstComponents, srcRow, srcComponents, map, srcWidth); dstRow += dstRowStride; @@ -929,7 +924,6 @@ static void memcpy_texture(struct gl_context *ctx, GLuint dimensions, gl_format dstFormat, - GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, GLint dstRowStride, GLubyte **dstSlices, GLint srcWidth, GLint srcHeight, GLint srcDepth, @@ -951,9 +945,7 @@ memcpy_texture(struct gl_context *ctx, /* memcpy image by image */ GLint img; for (img = 0; img < srcDepth; img++) { - GLubyte *dstImage = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstImage = dstSlices[img]; memcpy(dstImage, srcImage, bytesPerRow * srcHeight); srcImage += srcImageStride; } @@ -963,9 +955,7 @@ memcpy_texture(struct gl_context *ctx, GLint img, row; for (img = 0; img < srcDepth; img++) { const GLubyte *srcRow = srcImage; - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { memcpy(dstRow, srcRow, bytesPerRow); dstRow += dstRowStride; @@ -985,12 +975,11 @@ static GLboolean _mesa_texstore_z32(TEXSTORE_PARAMS) { const GLuint depthScale = 0xffffffff; - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); GLenum dstType; (void) dims; ASSERT(dstFormat == MESA_FORMAT_Z32 || dstFormat == MESA_FORMAT_Z32_FLOAT); - ASSERT(texelBytes == sizeof(GLuint)); + ASSERT(_mesa_get_format_bytes(dstFormat) == sizeof(GLuint)); if (dstFormat == MESA_FORMAT_Z32) dstType = GL_UNSIGNED_INT; @@ -1005,7 +994,7 @@ _mesa_texstore_z32(TEXSTORE_PARAMS) srcType == dstType) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -1014,9 +1003,7 @@ _mesa_texstore_z32(TEXSTORE_PARAMS) /* general path */ GLint img, row; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { const GLvoid *src = _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0); @@ -1038,7 +1025,6 @@ static GLboolean _mesa_texstore_x8_z24(TEXSTORE_PARAMS) { const GLuint depthScale = 0xffffff; - const GLuint texelBytes = 4; (void) dims; ASSERT(dstFormat == MESA_FORMAT_X8_Z24); @@ -1047,9 +1033,7 @@ _mesa_texstore_x8_z24(TEXSTORE_PARAMS) /* general path */ GLint img, row; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { const GLvoid *src = _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0); @@ -1071,7 +1055,6 @@ static GLboolean _mesa_texstore_z24_x8(TEXSTORE_PARAMS) { const GLuint depthScale = 0xffffff; - const GLuint texelBytes = 4; (void) dims; ASSERT(dstFormat == MESA_FORMAT_Z24_X8); @@ -1080,9 +1063,7 @@ _mesa_texstore_z24_x8(TEXSTORE_PARAMS) /* general path */ GLint img, row; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { const GLvoid *src = _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0); @@ -1108,10 +1089,9 @@ static GLboolean _mesa_texstore_z16(TEXSTORE_PARAMS) { const GLuint depthScale = 0xffff; - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); (void) dims; ASSERT(dstFormat == MESA_FORMAT_Z16); - ASSERT(texelBytes == sizeof(GLushort)); + ASSERT(_mesa_get_format_bytes(dstFormat) == sizeof(GLushort)); if (ctx->Pixel.DepthScale == 1.0f && ctx->Pixel.DepthBias == 0.0f && @@ -1121,7 +1101,7 @@ _mesa_texstore_z16(TEXSTORE_PARAMS) srcType == GL_UNSIGNED_SHORT) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -1130,9 +1110,7 @@ _mesa_texstore_z16(TEXSTORE_PARAMS) /* general path */ GLint img, row; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { const GLvoid *src = _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0); @@ -1154,12 +1132,11 @@ _mesa_texstore_z16(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgb565(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); ASSERT(dstFormat == MESA_FORMAT_RGB565 || dstFormat == MESA_FORMAT_RGB565_REV); - ASSERT(texelBytes == 2); + ASSERT(_mesa_get_format_bytes(dstFormat) == 2); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -1169,7 +1146,7 @@ _mesa_texstore_rgb565(TEXSTORE_PARAMS) srcType == GL_UNSIGNED_SHORT_5_6_5) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -1186,9 +1163,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 = dstSlices[0] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dst = dstSlices[0]; GLint row, col; for (row = 0; row < srcHeight; row++) { const GLubyte *srcUB = (const GLubyte *) src; @@ -1223,9 +1198,7 @@ _mesa_texstore_rgb565(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLushort *dstUS = (GLushort *) dstRow; /* check for byteswapped format */ @@ -1261,14 +1234,13 @@ static GLboolean _mesa_texstore_rgba8888(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); ASSERT(dstFormat == MESA_FORMAT_RGBA8888 || dstFormat == MESA_FORMAT_RGBA8888_REV || dstFormat == MESA_FORMAT_RGBX8888 || dstFormat == MESA_FORMAT_RGBX8888_REV); - ASSERT(texelBytes == 4); + ASSERT(_mesa_get_format_bytes(dstFormat) == 4); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -1281,7 +1253,7 @@ _mesa_texstore_rgba8888(TEXSTORE_PARAMS) (srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_BYTE && littleEndian))) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -1297,7 +1269,7 @@ _mesa_texstore_rgba8888(TEXSTORE_PARAMS) (srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_BYTE && !littleEndian))) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -1334,7 +1306,6 @@ _mesa_texstore_rgba8888(TEXSTORE_PARAMS) srcType, baseInternalFormat, dstmap, 4, - dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcAddr, srcPacking); @@ -1352,9 +1323,7 @@ _mesa_texstore_rgba8888(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLuint *dstUI = (GLuint *) dstRow; if (dstFormat == MESA_FORMAT_RGBA8888 || @@ -1389,14 +1358,13 @@ static GLboolean _mesa_texstore_argb8888(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLenum baseFormat = GL_RGBA; ASSERT(dstFormat == MESA_FORMAT_ARGB8888 || dstFormat == MESA_FORMAT_ARGB8888_REV || dstFormat == MESA_FORMAT_XRGB8888 || dstFormat == MESA_FORMAT_XRGB8888_REV ); - ASSERT(texelBytes == 4); + ASSERT(_mesa_get_format_bytes(dstFormat) == 4); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -1408,7 +1376,7 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) srcType == GL_UNSIGNED_INT_8_8_8_8_REV)) { /* simple memcpy path (little endian) */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -1423,7 +1391,7 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) srcType == GL_UNSIGNED_INT_8_8_8_8)) { /* simple memcpy path (big endian) */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -1442,9 +1410,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 = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLuint *d4 = (GLuint *) dstRow; for (col = 0; col < srcWidth; col++) { @@ -1477,9 +1443,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 = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLuint *d4 = (GLuint *) dstRow; for (col = 0; col < srcWidth; col++) { @@ -1529,7 +1493,6 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) srcType, baseInternalFormat, dstmap, 4, - dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcAddr, @@ -1548,9 +1511,7 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLuint *dstUI = (GLuint *) dstRow; if (dstFormat == MESA_FORMAT_ARGB8888) { @@ -1593,11 +1554,10 @@ static GLboolean _mesa_texstore_rgb888(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); ASSERT(dstFormat == MESA_FORMAT_RGB888); - ASSERT(texelBytes == 3); + ASSERT(_mesa_get_format_bytes(dstFormat) == 3); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -1607,7 +1567,7 @@ _mesa_texstore_rgb888(TEXSTORE_PARAMS) littleEndian) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -1623,9 +1583,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 = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { for (col = 0; col < srcWidth; col++) { dstRow[col * 3 + 0] = srcRow[col * 4 + BCOMP]; @@ -1656,7 +1614,6 @@ _mesa_texstore_rgb888(TEXSTORE_PARAMS) srcType, baseInternalFormat, dstmap, 3, - dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcAddr, srcPacking); @@ -1674,9 +1631,7 @@ _mesa_texstore_rgb888(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { #if 0 if (littleEndian) { @@ -1716,11 +1671,10 @@ static GLboolean _mesa_texstore_bgr888(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); ASSERT(dstFormat == MESA_FORMAT_BGR888); - ASSERT(texelBytes == 3); + ASSERT(_mesa_get_format_bytes(dstFormat) == 3); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -1730,7 +1684,7 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS) littleEndian) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -1746,9 +1700,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 = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { for (col = 0; col < srcWidth; col++) { dstRow[col * 3 + 0] = srcRow[col * 4 + RCOMP]; @@ -1779,7 +1731,6 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS) srcType, baseInternalFormat, dstmap, 3, - dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcAddr, srcPacking); @@ -1797,9 +1748,7 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { for (col = 0; col < srcWidth; col++) { dstRow[col * 3 + 0] = src[RCOMP]; @@ -1819,12 +1768,11 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_argb4444(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); ASSERT(dstFormat == MESA_FORMAT_ARGB4444 || dstFormat == MESA_FORMAT_ARGB4444_REV); - ASSERT(texelBytes == 2); + ASSERT(_mesa_get_format_bytes(dstFormat) == 2); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -1834,7 +1782,7 @@ _mesa_texstore_argb4444(TEXSTORE_PARAMS) srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -1852,9 +1800,7 @@ _mesa_texstore_argb4444(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLushort *dstUS = (GLushort *) dstRow; if (dstFormat == MESA_FORMAT_ARGB4444) { @@ -1886,11 +1832,10 @@ _mesa_texstore_argb4444(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgba5551(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); ASSERT(dstFormat == MESA_FORMAT_RGBA5551); - ASSERT(texelBytes == 2); + ASSERT(_mesa_get_format_bytes(dstFormat) == 2); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -1900,7 +1845,7 @@ _mesa_texstore_rgba5551(TEXSTORE_PARAMS) srcType == GL_UNSIGNED_SHORT_5_5_5_1) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -1918,9 +1863,7 @@ _mesa_texstore_rgba5551(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLushort *dstUS = (GLushort *) dstRow; for (col = 0; col < srcWidth; col++) { @@ -1941,12 +1884,11 @@ _mesa_texstore_rgba5551(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_argb1555(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); ASSERT(dstFormat == MESA_FORMAT_ARGB1555 || dstFormat == MESA_FORMAT_ARGB1555_REV); - ASSERT(texelBytes == 2); + ASSERT(_mesa_get_format_bytes(dstFormat) == 2); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -1956,7 +1898,7 @@ _mesa_texstore_argb1555(TEXSTORE_PARAMS) srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -1974,9 +1916,7 @@ _mesa_texstore_argb1555(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLushort *dstUS = (GLushort *) dstRow; if (dstFormat == MESA_FORMAT_ARGB1555) { @@ -2009,11 +1949,10 @@ _mesa_texstore_argb1555(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_argb2101010(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); ASSERT(dstFormat == MESA_FORMAT_ARGB2101010); - ASSERT(texelBytes == 4); + ASSERT(_mesa_get_format_bytes(dstFormat) == 4); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -2023,7 +1962,7 @@ _mesa_texstore_argb2101010(TEXSTORE_PARAMS) baseInternalFormat == GL_RGBA) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -2042,9 +1981,7 @@ _mesa_texstore_argb2101010(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; if (baseInternalFormat == GL_RGBA) { for (row = 0; row < srcHeight; row++) { GLuint *dstUI = (GLuint *) dstRow; @@ -2090,11 +2027,10 @@ _mesa_texstore_argb2101010(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_unorm44(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); ASSERT(dstFormat == MESA_FORMAT_AL44); - ASSERT(texelBytes == 1); + ASSERT(_mesa_get_format_bytes(dstFormat) == 1); { /* general path */ @@ -2109,9 +2045,7 @@ _mesa_texstore_unorm44(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLubyte *dstUS = (GLubyte *) dstRow; for (col = 0; col < srcWidth; col++) { @@ -2136,14 +2070,13 @@ static GLboolean _mesa_texstore_unorm88(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); ASSERT(dstFormat == MESA_FORMAT_AL88 || dstFormat == MESA_FORMAT_AL88_REV || dstFormat == MESA_FORMAT_GR88 || dstFormat == MESA_FORMAT_RG88); - ASSERT(texelBytes == 2); + ASSERT(_mesa_get_format_bytes(dstFormat) == 2); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -2156,7 +2089,7 @@ _mesa_texstore_unorm88(TEXSTORE_PARAMS) littleEndian) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -2200,7 +2133,6 @@ _mesa_texstore_unorm88(TEXSTORE_PARAMS) srcType, baseInternalFormat, dstmap, 2, - dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcAddr, srcPacking); @@ -2218,9 +2150,7 @@ _mesa_texstore_unorm88(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLushort *dstUS = (GLushort *) dstRow; if (dstFormat == MESA_FORMAT_AL88 || @@ -2256,14 +2186,13 @@ static GLboolean _mesa_texstore_unorm1616(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); ASSERT(dstFormat == MESA_FORMAT_AL1616 || dstFormat == MESA_FORMAT_AL1616_REV || dstFormat == MESA_FORMAT_RG1616 || dstFormat == MESA_FORMAT_RG1616_REV); - ASSERT(texelBytes == 4); + ASSERT(_mesa_get_format_bytes(dstFormat) == 4); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -2276,7 +2205,7 @@ _mesa_texstore_unorm1616(TEXSTORE_PARAMS) littleEndian) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -2295,9 +2224,7 @@ _mesa_texstore_unorm1616(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLuint *dstUI = (GLuint *) dstRow; if (dstFormat == MESA_FORMAT_AL1616 || @@ -2335,14 +2262,13 @@ static GLboolean _mesa_texstore_unorm16(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); ASSERT(dstFormat == MESA_FORMAT_R16 || dstFormat == MESA_FORMAT_A16 || dstFormat == MESA_FORMAT_L16 || dstFormat == MESA_FORMAT_I16); - ASSERT(texelBytes == 2); + ASSERT(_mesa_get_format_bytes(dstFormat) == 2); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -2351,7 +2277,7 @@ _mesa_texstore_unorm16(TEXSTORE_PARAMS) littleEndian) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -2370,9 +2296,7 @@ _mesa_texstore_unorm16(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLushort *dstUS = (GLushort *) dstRow; for (col = 0; col < srcWidth; col++) { @@ -2394,11 +2318,10 @@ _mesa_texstore_unorm16(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgba_16(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); ASSERT(dstFormat == MESA_FORMAT_RGBA_16); - ASSERT(texelBytes == 8); + ASSERT(_mesa_get_format_bytes(dstFormat) == 8); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -2407,7 +2330,7 @@ _mesa_texstore_rgba_16(TEXSTORE_PARAMS) srcType == GL_UNSIGNED_SHORT) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -2426,9 +2349,7 @@ _mesa_texstore_rgba_16(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLushort *dstUS = (GLushort *) dstRow; for (col = 0; col < srcWidth; col++) { @@ -2456,7 +2377,6 @@ _mesa_texstore_rgba_16(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_signed_rgba_16(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); ASSERT(dstFormat == MESA_FORMAT_SIGNED_RGB_16 || @@ -2470,7 +2390,7 @@ _mesa_texstore_signed_rgba_16(TEXSTORE_PARAMS) srcType == GL_SHORT) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -2495,9 +2415,7 @@ _mesa_texstore_signed_rgba_16(TEXSTORE_PARAMS) * 3 or 4 components/pixel here. */ for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLshort *dstRowS = (GLshort *) dstRow; if (dstFormat == MESA_FORMAT_SIGNED_RGBA_16) { @@ -2534,11 +2452,10 @@ _mesa_texstore_signed_rgba_16(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgb332(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); ASSERT(dstFormat == MESA_FORMAT_RGB332); - ASSERT(texelBytes == 1); + ASSERT(_mesa_get_format_bytes(dstFormat) == 1); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -2546,7 +2463,7 @@ _mesa_texstore_rgb332(TEXSTORE_PARAMS) srcFormat == GL_RGB && srcType == GL_UNSIGNED_BYTE_3_3_2) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -2564,9 +2481,7 @@ _mesa_texstore_rgb332(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { for (col = 0; col < srcWidth; col++) { dstRow[col] = PACK_COLOR_332( src[RCOMP], @@ -2589,14 +2504,13 @@ _mesa_texstore_rgb332(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_unorm8(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); ASSERT(dstFormat == MESA_FORMAT_A8 || dstFormat == MESA_FORMAT_L8 || dstFormat == MESA_FORMAT_I8 || dstFormat == MESA_FORMAT_R8); - ASSERT(texelBytes == 1); + ASSERT(_mesa_get_format_bytes(dstFormat) == 1); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -2604,7 +2518,7 @@ _mesa_texstore_unorm8(TEXSTORE_PARAMS) srcType == GL_UNSIGNED_BYTE) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -2632,7 +2546,6 @@ _mesa_texstore_unorm8(TEXSTORE_PARAMS) srcType, baseInternalFormat, dstmap, 1, - dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcAddr, srcPacking); @@ -2650,9 +2563,7 @@ _mesa_texstore_unorm8(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { for (col = 0; col < srcWidth; col++) { dstRow[col] = src[col]; @@ -2675,13 +2586,12 @@ static GLboolean _mesa_texstore_ycbcr(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); (void) ctx; (void) dims; (void) baseInternalFormat; ASSERT((dstFormat == MESA_FORMAT_YCBCR) || (dstFormat == MESA_FORMAT_YCBCR_REV)); - ASSERT(texelBytes == 2); + ASSERT(_mesa_get_format_bytes(dstFormat) == 2); ASSERT(ctx->Extensions.MESA_ycbcr_texture); ASSERT(srcFormat == GL_YCBCR_MESA); ASSERT((srcType == GL_UNSIGNED_SHORT_8_8_MESA) || @@ -2690,7 +2600,7 @@ _mesa_texstore_ycbcr(TEXSTORE_PARAMS) /* always just memcpy since no pixel transfer ops apply */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -2703,9 +2613,7 @@ _mesa_texstore_ycbcr(TEXSTORE_PARAMS) !littleEndian) { GLint img, row; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { _mesa_swap2((GLushort *) dstRow, srcWidth); dstRow += dstRowStride; @@ -2732,7 +2640,7 @@ _mesa_texstore_dudv8(TEXSTORE_PARAMS) littleEndian) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -2758,7 +2666,6 @@ _mesa_texstore_dudv8(TEXSTORE_PARAMS) GL_UNSIGNED_BYTE, /* hack */ GL_LUMINANCE_ALPHA, /* hack */ dstmap, 2, - dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcAddr, srcPacking); @@ -2791,9 +2698,7 @@ _mesa_texstore_dudv8(TEXSTORE_PARAMS) } src = tempImage; - dst = (GLbyte *) dstSlices[0] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + dst = (GLbyte *) dstSlices[0]; for (row = 0; row < srcHeight; row++) { memcpy(dst, src, srcWidth * texelBytes); dst += dstRowStride; @@ -2811,14 +2716,13 @@ _mesa_texstore_dudv8(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_snorm8(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); ASSERT(dstFormat == MESA_FORMAT_SIGNED_A8 || dstFormat == MESA_FORMAT_SIGNED_L8 || dstFormat == MESA_FORMAT_SIGNED_I8 || dstFormat == MESA_FORMAT_SIGNED_R8); - ASSERT(texelBytes == 1); + ASSERT(_mesa_get_format_bytes(dstFormat) == 1); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -2826,7 +2730,7 @@ _mesa_texstore_snorm8(TEXSTORE_PARAMS) srcType == GL_BYTE) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -2845,9 +2749,7 @@ _mesa_texstore_snorm8(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLbyte *dstRow = (GLbyte *) dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLbyte *dstRow = (GLbyte *) dstSlices[img]; for (row = 0; row < srcHeight; row++) { for (col = 0; col < srcWidth; col++) { dstRow[col] = FLOAT_TO_BYTE_TEX(src[col]); @@ -2869,12 +2771,11 @@ static GLboolean _mesa_texstore_snorm88(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); ASSERT(dstFormat == MESA_FORMAT_SIGNED_AL88 || dstFormat == MESA_FORMAT_SIGNED_RG88_REV); - ASSERT(texelBytes == 2); + ASSERT(_mesa_get_format_bytes(dstFormat) == 2); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -2883,7 +2784,7 @@ _mesa_texstore_snorm88(TEXSTORE_PARAMS) littleEndian) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -2902,9 +2803,7 @@ _mesa_texstore_snorm88(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLbyte *dstRow = (GLbyte *) dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLbyte *dstRow = (GLbyte *) dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLbyte *dst = dstRow; for (col = 0; col < srcWidth; col++) { @@ -2926,14 +2825,13 @@ static GLboolean _mesa_texstore_snorm16(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); ASSERT(dstFormat == MESA_FORMAT_SIGNED_R16 || dstFormat == MESA_FORMAT_SIGNED_A16 || dstFormat == MESA_FORMAT_SIGNED_L16 || dstFormat == MESA_FORMAT_SIGNED_I16); - ASSERT(texelBytes == 2); + ASSERT(_mesa_get_format_bytes(dstFormat) == 2); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -2942,7 +2840,7 @@ _mesa_texstore_snorm16(TEXSTORE_PARAMS) littleEndian) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -2961,9 +2859,7 @@ _mesa_texstore_snorm16(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLshort *dstUS = (GLshort *) dstRow; for (col = 0; col < srcWidth; col++) { @@ -2988,12 +2884,11 @@ static GLboolean _mesa_texstore_snorm1616(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); ASSERT(dstFormat == MESA_FORMAT_SIGNED_AL1616 || dstFormat == MESA_FORMAT_SIGNED_GR1616); - ASSERT(texelBytes == 4); + ASSERT(_mesa_get_format_bytes(dstFormat) == 4); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -3002,7 +2897,7 @@ _mesa_texstore_snorm1616(TEXSTORE_PARAMS) littleEndian) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -3021,9 +2916,7 @@ _mesa_texstore_snorm1616(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLshort *dst = (GLshort *) dstRow; for (col = 0; col < srcWidth; col++) { @@ -3050,11 +2943,10 @@ _mesa_texstore_snorm1616(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_signed_rgbx8888(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); ASSERT(dstFormat == MESA_FORMAT_SIGNED_RGBX8888); - ASSERT(texelBytes == 4); + ASSERT(_mesa_get_format_bytes(dstFormat) == 4); { /* general path */ @@ -3070,9 +2962,7 @@ _mesa_texstore_signed_rgbx8888(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLbyte *dstRow = (GLbyte *) dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLbyte *dstRow = (GLbyte *) dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLbyte *dst = dstRow; for (col = 0; col < srcWidth; col++) { @@ -3101,12 +2991,11 @@ static GLboolean _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); ASSERT(dstFormat == MESA_FORMAT_SIGNED_RGBA8888 || dstFormat == MESA_FORMAT_SIGNED_RGBA8888_REV); - ASSERT(texelBytes == 4); + ASSERT(_mesa_get_format_bytes(dstFormat) == 4); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -3116,7 +3005,7 @@ _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS) (srcFormat == GL_ABGR_EXT && srcType == GL_BYTE && littleEndian))) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -3129,7 +3018,7 @@ _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS) (srcFormat == GL_ABGR_EXT && srcType == GL_BYTE && !littleEndian))) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -3148,9 +3037,7 @@ _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLbyte *dstRow = (GLbyte *) dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLbyte *dstRow = (GLbyte *) dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLbyte *dst = dstRow; if (dstFormat == MESA_FORMAT_SIGNED_RGBA8888) { @@ -3204,7 +3091,7 @@ _mesa_texstore_z24_s8(TEXSTORE_PARAMS) !srcPacking->SwapBytes) { /* simple path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -3213,9 +3100,7 @@ _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 *) (dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * 4); + GLuint *dstRow = (GLuint *) dstSlices[img]; const GLubyte *src = (const GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, @@ -3285,9 +3170,7 @@ _mesa_texstore_s8_z24(TEXSTORE_PARAMS) srcType == GL_UNSIGNED_INT_24_8_EXT); for (img = 0; img < srcDepth; img++) { - GLuint *dstRow = (GLuint *) (dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * 4); + GLuint *dstRow = (GLuint *) dstSlices[img]; const GLubyte *src = (const GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, @@ -3353,7 +3236,7 @@ _mesa_texstore_s8(TEXSTORE_PARAMS) srcType == GL_UNSIGNED_BYTE) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -3364,9 +3247,7 @@ _mesa_texstore_s8(TEXSTORE_PARAMS) GLint img, row; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride / sizeof(GLuint) - + dstXoffset; + GLubyte *dstRow = dstSlices[img]; const GLubyte *src = (const GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, @@ -3409,7 +3290,6 @@ _mesa_texstore_s8(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgba_float32(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); const GLint components = _mesa_components_in_format(baseFormat); @@ -3429,7 +3309,7 @@ _mesa_texstore_rgba_float32(TEXSTORE_PARAMS) baseInternalFormat == GL_INTENSITY || baseInternalFormat == GL_RED || baseInternalFormat == GL_RG); - ASSERT(texelBytes == components * sizeof(GLfloat)); + ASSERT(_mesa_get_format_bytes(dstFormat) == components * sizeof(GLfloat)); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -3438,7 +3318,7 @@ _mesa_texstore_rgba_float32(TEXSTORE_PARAMS) srcType == GL_FLOAT) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -3459,9 +3339,7 @@ _mesa_texstore_rgba_float32(TEXSTORE_PARAMS) return GL_FALSE; bytesPerRow = srcWidth * components * sizeof(GLfloat); for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { memcpy(dstRow, srcRow, bytesPerRow); dstRow += dstRowStride; @@ -3482,7 +3360,6 @@ _mesa_texstore_rgba_float32(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgba_float16(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); const GLint components = _mesa_components_in_format(baseFormat); @@ -3502,7 +3379,7 @@ _mesa_texstore_rgba_float16(TEXSTORE_PARAMS) baseInternalFormat == GL_INTENSITY || baseInternalFormat == GL_RED || baseInternalFormat == GL_RG); - ASSERT(texelBytes == components * sizeof(GLhalfARB)); + ASSERT(_mesa_get_format_bytes(dstFormat) == components * sizeof(GLhalfARB)); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -3511,7 +3388,7 @@ _mesa_texstore_rgba_float16(TEXSTORE_PARAMS) srcType == GL_HALF_FLOAT_ARB) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -3530,9 +3407,7 @@ _mesa_texstore_rgba_float16(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLhalfARB *dstTexel = (GLhalfARB *) dstRow; GLint i; @@ -3554,7 +3429,6 @@ _mesa_texstore_rgba_float16(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgba_int8(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); const GLint components = _mesa_components_in_format(baseFormat); @@ -3574,7 +3448,7 @@ _mesa_texstore_rgba_int8(TEXSTORE_PARAMS) baseInternalFormat == GL_LUMINANCE || baseInternalFormat == GL_LUMINANCE_ALPHA || baseInternalFormat == GL_INTENSITY); - ASSERT(texelBytes == components * sizeof(GLbyte)); + ASSERT(_mesa_get_format_bytes(dstFormat) == components * sizeof(GLbyte)); /* Note: Pixel transfer ops (scale, bias, table lookup) do not apply * to integer formats. @@ -3584,7 +3458,7 @@ _mesa_texstore_rgba_int8(TEXSTORE_PARAMS) srcType == GL_BYTE) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -3602,9 +3476,7 @@ _mesa_texstore_rgba_int8(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLbyte *dstTexel = (GLbyte *) dstRow; GLint i; @@ -3626,7 +3498,6 @@ _mesa_texstore_rgba_int8(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgba_int16(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); const GLint components = _mesa_components_in_format(baseFormat); @@ -3646,7 +3517,7 @@ _mesa_texstore_rgba_int16(TEXSTORE_PARAMS) baseInternalFormat == GL_LUMINANCE || baseInternalFormat == GL_LUMINANCE_ALPHA || baseInternalFormat == GL_INTENSITY); - ASSERT(texelBytes == components * sizeof(GLshort)); + ASSERT(_mesa_get_format_bytes(dstFormat) == components * sizeof(GLshort)); /* Note: Pixel transfer ops (scale, bias, table lookup) do not apply * to integer formats. @@ -3656,7 +3527,7 @@ _mesa_texstore_rgba_int16(TEXSTORE_PARAMS) srcType == GL_SHORT) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -3674,9 +3545,7 @@ _mesa_texstore_rgba_int16(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLshort *dstTexel = (GLshort *) dstRow; GLint i; @@ -3698,7 +3567,6 @@ _mesa_texstore_rgba_int16(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgba_int32(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); const GLint components = _mesa_components_in_format(baseFormat); @@ -3718,7 +3586,7 @@ _mesa_texstore_rgba_int32(TEXSTORE_PARAMS) baseInternalFormat == GL_LUMINANCE || baseInternalFormat == GL_LUMINANCE_ALPHA || baseInternalFormat == GL_INTENSITY); - ASSERT(texelBytes == components * sizeof(GLint)); + ASSERT(_mesa_get_format_bytes(dstFormat) == components * sizeof(GLint)); /* Note: Pixel transfer ops (scale, bias, table lookup) do not apply * to integer formats. @@ -3728,7 +3596,7 @@ _mesa_texstore_rgba_int32(TEXSTORE_PARAMS) srcType == GL_INT) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -3746,9 +3614,7 @@ _mesa_texstore_rgba_int32(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLint *dstTexel = (GLint *) dstRow; GLint i; @@ -3770,7 +3636,6 @@ _mesa_texstore_rgba_int32(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgba_uint8(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); const GLint components = _mesa_components_in_format(baseFormat); @@ -3790,7 +3655,7 @@ _mesa_texstore_rgba_uint8(TEXSTORE_PARAMS) baseInternalFormat == GL_LUMINANCE || baseInternalFormat == GL_LUMINANCE_ALPHA || baseInternalFormat == GL_INTENSITY); - ASSERT(texelBytes == components * sizeof(GLubyte)); + ASSERT(_mesa_get_format_bytes(dstFormat) == components * sizeof(GLubyte)); /* Note: Pixel transfer ops (scale, bias, table lookup) do not apply * to integer formats. @@ -3800,7 +3665,7 @@ _mesa_texstore_rgba_uint8(TEXSTORE_PARAMS) srcType == GL_UNSIGNED_BYTE) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -3816,9 +3681,7 @@ _mesa_texstore_rgba_uint8(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLubyte *dstTexel = (GLubyte *) dstRow; GLint i; @@ -3840,7 +3703,6 @@ _mesa_texstore_rgba_uint8(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgba_uint16(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); const GLint components = _mesa_components_in_format(baseFormat); @@ -3860,7 +3722,7 @@ _mesa_texstore_rgba_uint16(TEXSTORE_PARAMS) baseInternalFormat == GL_LUMINANCE || baseInternalFormat == GL_LUMINANCE_ALPHA || baseInternalFormat == GL_INTENSITY); - ASSERT(texelBytes == components * sizeof(GLushort)); + ASSERT(_mesa_get_format_bytes(dstFormat) == components * sizeof(GLushort)); /* Note: Pixel transfer ops (scale, bias, table lookup) do not apply * to integer formats. @@ -3870,7 +3732,7 @@ _mesa_texstore_rgba_uint16(TEXSTORE_PARAMS) srcType == GL_UNSIGNED_SHORT) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -3886,9 +3748,7 @@ _mesa_texstore_rgba_uint16(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLushort *dstTexel = (GLushort *) dstRow; GLint i; @@ -3910,7 +3770,6 @@ _mesa_texstore_rgba_uint16(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgba_uint32(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); const GLint components = _mesa_components_in_format(baseFormat); @@ -3930,7 +3789,7 @@ _mesa_texstore_rgba_uint32(TEXSTORE_PARAMS) baseInternalFormat == GL_LUMINANCE || baseInternalFormat == GL_LUMINANCE_ALPHA || baseInternalFormat == GL_INTENSITY); - ASSERT(texelBytes == components * sizeof(GLuint)); + ASSERT(_mesa_get_format_bytes(dstFormat) == components * sizeof(GLuint)); /* Note: Pixel transfer ops (scale, bias, table lookup) do not apply * to integer formats. @@ -3940,7 +3799,7 @@ _mesa_texstore_rgba_uint32(TEXSTORE_PARAMS) srcType == GL_UNSIGNED_INT) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -3956,9 +3815,7 @@ _mesa_texstore_rgba_uint32(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLuint *dstTexel = (GLuint *) dstRow; GLint i; @@ -3992,7 +3849,6 @@ _mesa_texstore_srgb8(TEXSTORE_PARAMS) k = _mesa_texstore_rgb888(ctx, dims, baseInternalFormat, newDstFormat, - dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, @@ -4013,7 +3869,6 @@ _mesa_texstore_srgba8(TEXSTORE_PARAMS) newDstFormat = MESA_FORMAT_RGBA8888; k = _mesa_texstore_rgba8888(ctx, dims, baseInternalFormat, newDstFormat, - dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, @@ -4035,7 +3890,6 @@ _mesa_texstore_sargb8(TEXSTORE_PARAMS) k = _mesa_texstore_argb8888(ctx, dims, baseInternalFormat, newDstFormat, - dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, @@ -4057,7 +3911,6 @@ _mesa_texstore_sl8(TEXSTORE_PARAMS) /* _mesa_textore_a8 handles luminance8 too */ k = _mesa_texstore_unorm8(ctx, dims, baseInternalFormat, newDstFormat, - dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, @@ -4079,7 +3932,6 @@ _mesa_texstore_sla8(TEXSTORE_PARAMS) k = _mesa_texstore_unorm88(ctx, dims, baseInternalFormat, newDstFormat, - dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, @@ -4112,7 +3964,7 @@ _mesa_texstore_rgb9_e5(TEXSTORE_PARAMS) srcType == GL_UNSIGNED_INT_5_9_9_9_REV) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -4131,9 +3983,7 @@ _mesa_texstore_rgb9_e5(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * 4; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLuint *dstUI = (GLuint*)dstRow; for (col = 0; col < srcWidth; col++) { @@ -4163,7 +4013,7 @@ _mesa_texstore_r11_g11_b10f(TEXSTORE_PARAMS) srcType == GL_UNSIGNED_INT_10F_11F_11F_REV) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -4182,9 +4032,7 @@ _mesa_texstore_r11_g11_b10f(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * 4; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLuint *dstUI = (GLuint*)dstRow; for (col = 0; col < srcWidth; col++) { @@ -4217,7 +4065,7 @@ _mesa_texstore_z32f_x24s8(TEXSTORE_PARAMS) !srcPacking->SwapBytes) { /* simple path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -4231,9 +4079,7 @@ _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 *) (dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * 8); + uint64_t *dstRow = (uint64_t *) dstSlices[img]; const uint64_t *src = (const uint64_t *) _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, @@ -4268,11 +4114,10 @@ _mesa_texstore_z32f_x24s8(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_argb2101010_uint(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); ASSERT(dstFormat == MESA_FORMAT_ARGB2101010_UINT); - ASSERT(texelBytes == 4); + ASSERT(_mesa_get_format_bytes(dstFormat) == 4); if (!srcPacking->SwapBytes && dstFormat == MESA_FORMAT_ARGB2101010_UINT && @@ -4281,7 +4126,7 @@ _mesa_texstore_argb2101010_uint(TEXSTORE_PARAMS) baseInternalFormat == GL_RGBA) { /* simple memcpy path */ memcpy_texture(ctx, dims, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -4300,9 +4145,7 @@ _mesa_texstore_argb2101010_uint(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[dstZoffset + img] - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; + GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLuint *dstUI = (GLuint *) dstRow; @@ -4329,7 +4172,6 @@ _mesa_texstore_null(TEXSTORE_PARAMS) (void) ctx; (void) dims; (void) baseInternalFormat; (void) dstFormat; - (void) dstXoffset; (void) dstYoffset; (void) dstZoffset; (void) dstRowStride; (void) dstSlices, (void) srcWidth; (void) srcHeight; (void) srcDepth; (void) srcFormat; (void) srcType; @@ -4539,7 +4381,7 @@ _mesa_texstore(TEXSTORE_PARAMS) storeImage = _mesa_get_texstore_func(dstFormat); success = storeImage(ctx, dims, baseInternalFormat, - dstFormat, dstXoffset, dstYoffset, dstZoffset, + dstFormat, dstRowStride, dstSlices, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -4671,7 +4513,6 @@ store_texsubimage(struct gl_context *ctx, */ success = _mesa_texstore(ctx, dims, texImage->_BaseFormat, texImage->TexFormat, - 0, 0, 0, /* dstX/Y/Zoffset */ dstRowStride, &dstMap, width, height, 1, /* w, h, d */ @@ -4698,13 +4539,12 @@ store_texsubimage(struct gl_context *ctx, * This is the fallback for Driver.TexImage1D(). */ void -_mesa_store_teximage1d(struct gl_context *ctx, GLenum target, GLint level, +_mesa_store_teximage1d(struct gl_context *ctx, + struct gl_texture_image *texImage, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage) + const struct gl_pixelstore_attrib *packing) { if (width == 0) return; @@ -4726,13 +4566,12 @@ _mesa_store_teximage1d(struct gl_context *ctx, GLenum target, GLint level, * This is the fallback for Driver.TexImage2D(). */ void -_mesa_store_teximage2d(struct gl_context *ctx, GLenum target, GLint level, +_mesa_store_teximage2d(struct gl_context *ctx, + struct gl_texture_image *texImage, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const void *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage) + const struct gl_pixelstore_attrib *packing) { if (width == 0 || height == 0) return; @@ -4755,13 +4594,12 @@ _mesa_store_teximage2d(struct gl_context *ctx, GLenum target, GLint level, * This is the fallback for Driver.TexImage3D(). */ void -_mesa_store_teximage3d(struct gl_context *ctx, GLenum target, GLint level, +_mesa_store_teximage3d(struct gl_context *ctx, + struct gl_texture_image *texImage, GLint internalFormat, GLint width, GLint height, GLint depth, GLint border, GLenum format, GLenum type, const void *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage) + const struct gl_pixelstore_attrib *packing) { if (width == 0 || height == 0 || depth == 0) return; @@ -4785,12 +4623,11 @@ _mesa_store_teximage3d(struct gl_context *ctx, GLenum target, GLint level, * This is the fallback for Driver.TexSubImage1D(). */ void -_mesa_store_texsubimage1d(struct gl_context *ctx, GLenum target, GLint level, +_mesa_store_texsubimage1d(struct gl_context *ctx, + struct gl_texture_image *texImage, GLint xoffset, GLint width, GLenum format, GLenum type, const void *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage) + const struct gl_pixelstore_attrib *packing) { store_texsubimage(ctx, texImage, xoffset, 0, 0, width, 1, 1, @@ -4803,13 +4640,12 @@ _mesa_store_texsubimage1d(struct gl_context *ctx, GLenum target, GLint level, * This is the fallback for Driver.TexSubImage2D(). */ void -_mesa_store_texsubimage2d(struct gl_context *ctx, GLenum target, GLint level, +_mesa_store_texsubimage2d(struct gl_context *ctx, + struct gl_texture_image *texImage, GLint xoffset, GLint yoffset, GLint width, GLint height, GLenum format, GLenum type, const void *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage) + const struct gl_pixelstore_attrib *packing) { store_texsubimage(ctx, texImage, xoffset, yoffset, 0, width, height, 1, @@ -4821,13 +4657,12 @@ _mesa_store_texsubimage2d(struct gl_context *ctx, GLenum target, GLint level, * This is the fallback for Driver.TexSubImage3D(). */ void -_mesa_store_texsubimage3d(struct gl_context *ctx, GLenum target, GLint level, +_mesa_store_texsubimage3d(struct gl_context *ctx, + struct gl_texture_image *texImage, GLint xoffset, GLint yoffset, GLint zoffset, GLint width, GLint height, GLint depth, GLenum format, GLenum type, const void *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage) + const struct gl_pixelstore_attrib *packing) { store_texsubimage(ctx, texImage, xoffset, yoffset, zoffset, width, height, depth, @@ -4840,20 +4675,16 @@ _mesa_store_texsubimage3d(struct gl_context *ctx, GLenum target, GLint level, */ void _mesa_store_compressed_teximage1d(struct gl_context *ctx, - GLenum target, GLint level, + struct gl_texture_image *texImage, GLint internalFormat, GLint width, GLint border, - GLsizei imageSize, const GLvoid *data, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage) + GLsizei imageSize, const GLvoid *data) { - /* this space intentionally left blank */ + /* no compressed 1D image formats at this time */ (void) ctx; - (void) target; (void) level; (void) internalFormat; (void) width; (void) border; (void) imageSize; (void) data; - (void) texObj; (void) texImage; } @@ -4864,18 +4695,15 @@ _mesa_store_compressed_teximage1d(struct gl_context *ctx, */ void _mesa_store_compressed_teximage2d(struct gl_context *ctx, - GLenum target, GLint level, + struct gl_texture_image *texImage, GLint internalFormat, GLint width, GLint height, GLint border, - GLsizei imageSize, const GLvoid *data, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage) + GLsizei imageSize, const GLvoid *data) { /* This is pretty simple, because unlike the general texstore path we don't * have to worry about the usual image unpacking or image transfer * operations. */ - ASSERT(texObj); ASSERT(texImage); ASSERT(texImage->Width > 0); ASSERT(texImage->Height > 0); @@ -4888,12 +4716,11 @@ _mesa_store_compressed_teximage2d(struct gl_context *ctx, return; } - _mesa_store_compressed_texsubimage2d(ctx, target, level, + _mesa_store_compressed_texsubimage2d(ctx, texImage, 0, 0, width, height, texImage->TexFormat, - imageSize, data, - texObj, texImage); + imageSize, data); } @@ -4903,22 +4730,18 @@ _mesa_store_compressed_teximage2d(struct gl_context *ctx, */ void _mesa_store_compressed_teximage3d(struct gl_context *ctx, - GLenum target, GLint level, + struct gl_texture_image *texImage, GLint internalFormat, GLint width, GLint height, GLint depth, GLint border, - GLsizei imageSize, const GLvoid *data, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage) + GLsizei imageSize, const GLvoid *data) { /* this space intentionally left blank */ (void) ctx; - (void) target; (void) level; (void) internalFormat; (void) width; (void) height; (void) depth; (void) border; (void) imageSize; (void) data; - (void) texObj; (void) texImage; } @@ -4928,21 +4751,17 @@ _mesa_store_compressed_teximage3d(struct gl_context *ctx, * Fallback for Driver.CompressedTexSubImage1D() */ void -_mesa_store_compressed_texsubimage1d(struct gl_context *ctx, GLenum target, - GLint level, +_mesa_store_compressed_texsubimage1d(struct gl_context *ctx, + struct gl_texture_image *texImage, GLint xoffset, GLsizei width, GLenum format, - GLsizei imageSize, const GLvoid *data, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage) + GLsizei imageSize, const GLvoid *data) { /* there are no compressed 1D texture formats yet */ (void) ctx; - (void) target; (void) level; (void) xoffset; (void) width; (void) format; (void) imageSize; (void) data; - (void) texObj; (void) texImage; } @@ -4951,14 +4770,12 @@ _mesa_store_compressed_texsubimage1d(struct gl_context *ctx, GLenum target, * Fallback for Driver.CompressedTexSubImage2D() */ void -_mesa_store_compressed_texsubimage2d(struct gl_context *ctx, GLenum target, - GLint level, +_mesa_store_compressed_texsubimage2d(struct gl_context *ctx, + struct gl_texture_image *texImage, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, - GLsizei imageSize, const GLvoid *data, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage) + GLsizei imageSize, const GLvoid *data) { GLint bytesPerRow, dstRowStride, srcRowStride; GLint i, rows; @@ -5016,22 +4833,18 @@ _mesa_store_compressed_texsubimage2d(struct gl_context *ctx, GLenum target, * Fallback for Driver.CompressedTexSubImage3D() */ void -_mesa_store_compressed_texsubimage3d(struct gl_context *ctx, GLenum target, - GLint level, - GLint xoffset, GLint yoffset, GLint zoffset, - GLsizei width, GLsizei height, GLsizei depth, - GLenum format, - GLsizei imageSize, const GLvoid *data, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage) +_mesa_store_compressed_texsubimage3d(struct gl_context *ctx, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, + GLenum format, + GLsizei imageSize, const GLvoid *data) { /* there are no compressed 3D texture formats yet */ (void) ctx; - (void) target; (void) level; (void) xoffset; (void) yoffset; (void) zoffset; (void) width; (void) height; (void) depth; (void) format; (void) imageSize; (void) data; - (void) texObj; (void) texImage; } diff --git a/mesalib/src/mesa/main/texstore.h b/mesalib/src/mesa/main/texstore.h index f956b0436..85e33b0fe 100644 --- a/mesalib/src/mesa/main/texstore.h +++ b/mesalib/src/mesa/main/texstore.h @@ -58,7 +58,6 @@ struct gl_context *ctx, GLuint dims, \ GLenum baseInternalFormat, \ gl_format dstFormat, \ - GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, \ GLint dstRowStride, \ GLubyte **dstSlices, \ GLint srcWidth, GLint srcHeight, GLint srcDepth, \ @@ -91,118 +90,103 @@ _mesa_make_temp_float_image(struct gl_context *ctx, GLuint dims, GLbitfield transferOps); extern void -_mesa_store_teximage1d(struct gl_context *ctx, GLenum target, GLint level, +_mesa_store_teximage1d(struct gl_context *ctx, + struct gl_texture_image *texImage, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); + const struct gl_pixelstore_attrib *packing); extern void -_mesa_store_teximage2d(struct gl_context *ctx, GLenum target, GLint level, +_mesa_store_teximage2d(struct gl_context *ctx, + struct gl_texture_image *texImage, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); + const struct gl_pixelstore_attrib *packing); extern void -_mesa_store_teximage3d(struct gl_context *ctx, GLenum target, GLint level, +_mesa_store_teximage3d(struct gl_context *ctx, + struct gl_texture_image *texImage, GLint internalFormat, GLint width, GLint height, GLint depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); + const struct gl_pixelstore_attrib *packing); extern void -_mesa_store_texsubimage1d(struct gl_context *ctx, GLenum target, GLint level, +_mesa_store_texsubimage1d(struct gl_context *ctx, + struct gl_texture_image *texImage, GLint xoffset, GLint width, GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); + const struct gl_pixelstore_attrib *packing); extern void -_mesa_store_texsubimage2d(struct gl_context *ctx, GLenum target, GLint level, +_mesa_store_texsubimage2d(struct gl_context *ctx, + struct gl_texture_image *texImage, GLint xoffset, GLint yoffset, GLint width, GLint height, GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); + const struct gl_pixelstore_attrib *packing); extern void -_mesa_store_texsubimage3d(struct gl_context *ctx, GLenum target, GLint level, +_mesa_store_texsubimage3d(struct gl_context *ctx, + struct gl_texture_image *texImage, GLint xoffset, GLint yoffset, GLint zoffset, GLint width, GLint height, GLint depth, GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); + const struct gl_pixelstore_attrib *packing); extern void -_mesa_store_compressed_teximage1d(struct gl_context *ctx, GLenum target, GLint level, +_mesa_store_compressed_teximage1d(struct gl_context *ctx, + struct gl_texture_image *texImage, GLint internalFormat, GLint width, GLint border, - GLsizei imageSize, const GLvoid *data, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); + GLsizei imageSize, const GLvoid *data); extern void -_mesa_store_compressed_teximage2d(struct gl_context *ctx, GLenum target, GLint level, +_mesa_store_compressed_teximage2d(struct gl_context *ctx, + struct gl_texture_image *texImage, GLint internalFormat, GLint width, GLint height, GLint border, - GLsizei imageSize, const GLvoid *data, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); + GLsizei imageSize, const GLvoid *data); extern void -_mesa_store_compressed_teximage3d(struct gl_context *ctx, GLenum target, GLint level, +_mesa_store_compressed_teximage3d(struct gl_context *ctx, + struct gl_texture_image *texImage, GLint internalFormat, GLint width, GLint height, GLint depth, GLint border, - GLsizei imageSize, const GLvoid *data, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); + GLsizei imageSize, const GLvoid *data); extern void -_mesa_store_compressed_texsubimage1d(struct gl_context *ctx, GLenum target, - GLint level, +_mesa_store_compressed_texsubimage1d(struct gl_context *ctx, + struct gl_texture_image *texImage, GLint xoffset, GLsizei width, GLenum format, - GLsizei imageSize, const GLvoid *data, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); + GLsizei imageSize, const GLvoid *data); extern void -_mesa_store_compressed_texsubimage2d(struct gl_context *ctx, GLenum target, - GLint level, +_mesa_store_compressed_texsubimage2d(struct gl_context *ctx, + struct gl_texture_image *texImage, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, - GLsizei imageSize, const GLvoid *data, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); + GLsizei imageSize, const GLvoid *data); extern void -_mesa_store_compressed_texsubimage3d(struct gl_context *ctx, GLenum target, - GLint level, - GLint xoffset, GLint yoffset, GLint zoffset, - GLsizei width, GLsizei height, GLsizei depth, - GLenum format, - GLsizei imageSize, const GLvoid *data, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); +_mesa_store_compressed_texsubimage3d(struct gl_context *ctx, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, + GLenum format, + GLsizei imageSize, const GLvoid *data); #endif diff --git a/mesalib/src/mesa/main/transformfeedback.c b/mesalib/src/mesa/main/transformfeedback.c index be0d0ff19..c2114c227 100644 --- a/mesalib/src/mesa/main/transformfeedback.c +++ b/mesalib/src/mesa/main/transformfeedback.c @@ -342,10 +342,26 @@ void GLAPIENTRY _mesa_BeginTransformFeedback(GLenum mode) { struct gl_transform_feedback_object *obj; + struct gl_transform_feedback_info *info; + int i; GET_CURRENT_CONTEXT(ctx); obj = ctx->TransformFeedback.CurrentObject; + if (ctx->Shader.CurrentVertexProgram == NULL) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBeginTransformFeedback(no program active)"); + return; + } + + info = &ctx->Shader.CurrentVertexProgram->LinkedTransformFeedback; + + if (info->NumOutputs == 0) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBeginTransformFeedback(no varyings to record)"); + return; + } + switch (mode) { case GL_POINTS: case GL_LINES: @@ -363,6 +379,15 @@ _mesa_BeginTransformFeedback(GLenum mode) return; } + for (i = 0; i < info->NumBuffers; ++i) { + if (obj->BufferNames[i] == 0) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBeginTransformFeedback(binding point %d does not have " + "a buffer object bound)", i); + return; + } + } + FLUSH_VERTICES(ctx, _NEW_TRANSFORM_FEEDBACK); obj->Active = GL_TRUE; ctx->TransformFeedback.Mode = mode; @@ -461,7 +486,7 @@ _mesa_BindBufferRange(GLenum target, GLuint index, if ((size <= 0) || (size & 0x3)) { /* must be positive and multiple of four */ - _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(size%d)", (int) size); + _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(size=%d)", (int) size); return; } @@ -569,6 +594,13 @@ _mesa_BindBufferOffsetEXT(GLenum target, GLuint index, GLuint buffer, return; } + if (offset & 0x3) { + /* must be multiple of four */ + _mesa_error(ctx, GL_INVALID_VALUE, + "glBindBufferOffsetEXT(offset=%d)", (int) offset); + return; + } + bufObj = _mesa_lookup_bufferobj(ctx, buffer); if (!bufObj) { _mesa_error(ctx, GL_INVALID_OPERATION, @@ -662,8 +694,7 @@ _mesa_GetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei *size, GLenum *type, GLchar *name) { const struct gl_shader_program *shProg; - const GLchar *varyingName; - GLint v; + const struct gl_transform_feedback_info *linked_xfb_info; GET_CURRENT_CONTEXT(ctx); shProg = _mesa_lookup_shader_program(ctx, program); @@ -673,36 +704,22 @@ _mesa_GetTransformFeedbackVarying(GLuint program, GLuint index, return; } - if (index >= shProg->TransformFeedback.NumVarying) { + linked_xfb_info = &shProg->LinkedTransformFeedback; + if (index >= linked_xfb_info->NumVarying) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetTransformFeedbackVaryings(index=%u)", index); return; } - varyingName = shProg->TransformFeedback.VaryingNames[index]; + /* return the varying's name and length */ + _mesa_copy_string(name, bufSize, length, + linked_xfb_info->Varyings[index].Name); - v = _mesa_lookup_parameter_index(shProg->Varying, -1, varyingName); - if (v >= 0) { - struct gl_program_parameter *param = &shProg->Varying->Parameters[v]; - - /* return the varying's name and length */ - _mesa_copy_string(name, bufSize, length, varyingName); - - /* return the datatype and value's size (in datatype units) */ - if (type) - *type = param->DataType; - if (size) - *size = param->Size; - } - else { - name[0] = 0; - if (length) - *length = 0; - if (type) - *type = 0; - if (size) - *size = 0; - } + /* return the datatype and value's size (in datatype units) */ + if (type) + *type = linked_xfb_info->Varyings[index].Type; + if (size) + *size = linked_xfb_info->Varyings[index].Size; } -- cgit v1.2.3