summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex.c10
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_image.c3
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_texture.c4
-rw-r--r--src/mesa/main/dd.h4
-rw-r--r--src/mesa/main/mipmap.c3
-rw-r--r--src/mesa/main/texstore.c7
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c10
-rw-r--r--src/mesa/swrast/s_texture.c37
-rw-r--r--src/mesa/swrast/swrast.h7
9 files changed, 29 insertions, 56 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c
index b3ac2267b7d..92481b9b55f 100644
--- a/src/mesa/drivers/dri/intel/intel_tex.c
+++ b/src/mesa/drivers/dri/intel/intel_tex.c
@@ -51,9 +51,7 @@ intelDeleteTextureObject(struct gl_context *ctx,
static GLboolean
intel_alloc_texture_image_buffer(struct gl_context *ctx,
- struct gl_texture_image *image,
- gl_format format, GLsizei width,
- GLsizei height, GLsizei depth)
+ struct gl_texture_image *image)
{
struct intel_context *intel = intel_context(ctx);
struct intel_texture_image *intel_image = intel_texture_image(image);
@@ -84,14 +82,14 @@ intel_alloc_texture_image_buffer(struct gl_context *ctx,
assert(!intel_image->base.ImageOffsets);
intel_image->base.ImageOffsets = malloc(slices * sizeof(GLuint));
- _swrast_init_texture_image(image, width, height, depth);
+ _swrast_init_texture_image(image);
if (intel_texobj->mt &&
intel_miptree_match_image(intel_texobj->mt, image)) {
intel_miptree_reference(&intel_image->mt, intel_texobj->mt);
DBG("%s: alloc obj %p level %d %dx%dx%d using object's miptree %p\n",
__FUNCTION__, texobj, image->Level,
- width, height, depth, intel_texobj->mt);
+ image->Width, image->Height, image->Depth, intel_texobj->mt);
} else {
intel_image->mt = intel_miptree_create_for_teximage(intel, intel_texobj,
intel_image,
@@ -106,7 +104,7 @@ intel_alloc_texture_image_buffer(struct gl_context *ctx,
DBG("%s: alloc obj %p level %d %dx%dx%d using new miptree %p\n",
__FUNCTION__, texobj, image->Level,
- width, height, depth, intel_image->mt);
+ image->Width, image->Height, image->Depth, intel_image->mt);
}
return true;
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c
index acb21fbc7e4..fe9040cf1b6 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -160,8 +160,7 @@ try_pbo_upload(struct gl_context *ctx,
return false;
}
- ctx->Driver.AllocTextureImageBuffer(ctx, image, image->TexFormat,
- image->Width, image->Height, 1);
+ ctx->Driver.AllocTextureImageBuffer(ctx, image);
if (!intelImage->mt) {
DBG("%s: no miptree\n", __FUNCTION__);
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c
index 04f3e232b37..157cc096a31 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.c
@@ -103,9 +103,7 @@ radeonDeleteTextureImage(struct gl_context *ctx, struct gl_texture_image *img)
static GLboolean
radeonAllocTextureImageBuffer(struct gl_context *ctx,
- struct gl_texture_image *timage,
- gl_format format, GLsizei width,
- GLsizei height, GLsizei depth)
+ struct gl_texture_image *timage)
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
radeon_texture_image *image = get_radeon_texture_image(timage);
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 546e360819a..4346b9e6155 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -327,9 +327,7 @@ struct dd_function_table {
/** Called to allocate memory for a single texture image */
GLboolean (*AllocTextureImageBuffer)(struct gl_context *ctx,
- struct gl_texture_image *texImage,
- gl_format format, GLsizei width,
- GLsizei height, GLsizei depth);
+ struct gl_texture_image *texImage);
/** Free the memory for a single texture image */
void (*FreeTextureImageBuffer)(struct gl_context *ctx,
diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
index 9f531ae20bb..00d3e8f9ed6 100644
--- a/src/mesa/main/mipmap.c
+++ b/src/mesa/main/mipmap.c
@@ -1865,8 +1865,7 @@ _mesa_prepare_mipmap_level(struct gl_context *ctx,
width, height, depth,
border, intFormat, format);
- ctx->Driver.AllocTextureImageBuffer(ctx, dstImage,
- format, width, height, depth);
+ ctx->Driver.AllocTextureImageBuffer(ctx, dstImage);
/* in case the mipmap level is part of an FBO: */
_mesa_update_fbo_texture(ctx, texObj, face, level);
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index 52eef3ebab3..393b9a8a5f1 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -4345,9 +4345,7 @@ _mesa_store_teximage(struct gl_context *ctx,
return;
/* allocate storage for texture data */
- if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage, texImage->TexFormat,
- texImage->Width, texImage->Height,
- texImage->Depth)) {
+ if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage)) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage%uD", dims);
return;
}
@@ -4402,8 +4400,7 @@ _mesa_store_compressed_teximage(struct gl_context *ctx, GLuint dims,
ASSERT(texImage->Depth == 1);
/* allocate storage for texture data */
- if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage, texImage->TexFormat,
- width, height, 1)) {
+ if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage)) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D");
return;
}
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 0c4e8a8f47b..5385ed8a4b9 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -415,20 +415,18 @@ guess_and_alloc_texture(struct st_context *st,
*/
static GLboolean
st_AllocTextureImageBuffer(struct gl_context *ctx,
- struct gl_texture_image *texImage,
- gl_format format, GLsizei width,
- GLsizei height, GLsizei depth)
+ struct gl_texture_image *texImage)
{
struct st_context *st = st_context(ctx);
struct st_texture_image *stImage = st_texture_image(texImage);
struct st_texture_object *stObj = st_texture_object(texImage->TexObject);
const GLuint level = texImage->Level;
+ GLuint width = texImage->Width;
+ GLuint height = texImage->Height;
+ GLuint depth = texImage->Depth;
DBG("%s\n", __FUNCTION__);
- assert(width > 0);
- assert(height > 0);
- assert(depth > 0);
assert(!stImage->TexData);
assert(!stImage->pt); /* xxx this might be wrong */
diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c
index 9718367a8df..8df4b84398e 100644
--- a/src/mesa/swrast/s_texture.c
+++ b/src/mesa/swrast/s_texture.c
@@ -63,40 +63,34 @@ _swrast_delete_texture_image(struct gl_context *ctx,
*/
GLboolean
_swrast_alloc_texture_image_buffer(struct gl_context *ctx,
- struct gl_texture_image *texImage,
- gl_format format, GLsizei width,
- GLsizei height, GLsizei depth)
+ struct gl_texture_image *texImage)
{
struct swrast_texture_image *swImg = swrast_texture_image(texImage);
- GLuint bytes = _mesa_format_image_size(format, width, height, depth);
+ GLuint bytes = _mesa_format_image_size(texImage->TexFormat, texImage->Width,
+ texImage->Height, texImage->Depth);
GLuint i;
- /* This _should_ be true (revisit if these ever fail) */
- assert(texImage->Width == width);
- assert(texImage->Height == height);
- assert(texImage->Depth == depth);
-
assert(!swImg->Buffer);
swImg->Buffer = _mesa_align_malloc(bytes, 512);
if (!swImg->Buffer)
return GL_FALSE;
/* RowStride and ImageOffsets[] describe how to address texels in 'Data' */
- swImg->RowStride = width;
+ swImg->RowStride = texImage->Width;
/* Allocate the ImageOffsets array and initialize to typical values.
* We allocate the array for 1D/2D textures too in order to avoid special-
* case code in the texstore routines.
*/
- swImg->ImageOffsets = (GLuint *) malloc(depth * sizeof(GLuint));
+ swImg->ImageOffsets = (GLuint *) malloc(texImage->Depth * sizeof(GLuint));
if (!swImg->ImageOffsets)
return GL_FALSE;
- for (i = 0; i < depth; i++) {
- swImg->ImageOffsets[i] = i * width * height;
+ for (i = 0; i < texImage->Depth; i++) {
+ swImg->ImageOffsets[i] = i * texImage->Width * texImage->Height;
}
- _swrast_init_texture_image(texImage, width, height, depth);
+ _swrast_init_texture_image(texImage);
return GL_TRUE;
}
@@ -110,14 +104,13 @@ _swrast_alloc_texture_image_buffer(struct gl_context *ctx,
* Returns GL_TRUE on success, GL_FALSE on memory allocation failure.
*/
void
-_swrast_init_texture_image(struct gl_texture_image *texImage, GLsizei width,
- GLsizei height, GLsizei depth)
+_swrast_init_texture_image(struct gl_texture_image *texImage)
{
struct swrast_texture_image *swImg = swrast_texture_image(texImage);
- if ((width == 1 || _mesa_is_pow_two(texImage->Width2)) &&
- (height == 1 || _mesa_is_pow_two(texImage->Height2)) &&
- (depth == 1 || _mesa_is_pow_two(texImage->Depth2)))
+ if ((texImage->Width == 1 || _mesa_is_pow_two(texImage->Width2)) &&
+ (texImage->Height == 1 || _mesa_is_pow_two(texImage->Height2)) &&
+ (texImage->Depth == 1 || _mesa_is_pow_two(texImage->Depth2)))
swImg->_IsPowerOfTwo = GL_TRUE;
else
swImg->_IsPowerOfTwo = GL_FALSE;
@@ -348,11 +341,7 @@ _swrast_AllocTextureStorage(struct gl_context *ctx,
for (face = 0; face < numFaces; face++) {
for (level = 0; level < levels; level++) {
struct gl_texture_image *texImage = texObj->Image[face][level];
- if (!_swrast_alloc_texture_image_buffer(ctx, texImage,
- texImage->TexFormat,
- texImage->Width,
- texImage->Height,
- texImage->Depth)) {
+ if (!_swrast_alloc_texture_image_buffer(ctx, texImage)) {
return GL_FALSE;
}
}
diff --git a/src/mesa/swrast/swrast.h b/src/mesa/swrast/swrast.h
index a299e6fda87..97cc5ee6313 100644
--- a/src/mesa/swrast/swrast.h
+++ b/src/mesa/swrast/swrast.h
@@ -215,13 +215,10 @@ _swrast_delete_texture_image(struct gl_context *ctx,
extern GLboolean
_swrast_alloc_texture_image_buffer(struct gl_context *ctx,
- struct gl_texture_image *texImage,
- gl_format format, GLsizei width,
- GLsizei height, GLsizei depth);
+ struct gl_texture_image *texImage);
extern void
-_swrast_init_texture_image(struct gl_texture_image *texImage, GLsizei width,
- GLsizei height, GLsizei depth);
+_swrast_init_texture_image(struct gl_texture_image *texImage);
extern void
_swrast_free_texture_image_buffer(struct gl_context *ctx,