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);
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,
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;
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__);
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);
/** 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,
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);
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;
}
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;
}
*/
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 */
*/
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;
}
* 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;
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;
}
}
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,