srcImage->TexFormat);
dstImage->DriverData = NULL;
- /* Alloc new teximage data buffer */
- {
- GLuint size = _mesa_format_image_size(dstImage->TexFormat,
- dstWidth, dstHeight, dstDepth);
- dstImage->Data = _mesa_alloc_texmemory(size);
- if (!dstImage->Data) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps");
- return;
- }
+ /* Alloc storage for new texture image */
+ if (!ctx->Driver.AllocTextureImageBuffer(ctx, dstImage,
+ dstImage->TexFormat,
+ dstWidth, dstHeight,
+ dstDepth)) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps");
+ return;
}
ASSERT(dstImage->TexFormat);
}
-/** Return texture size in bytes */
-static GLuint
-texture_size(const struct gl_texture_image *texImage)
-{
- GLuint sz = _mesa_format_image_size(texImage->TexFormat, texImage->Width,
- texImage->Height, texImage->Depth);
- return sz;
-}
-
-
/**
* Normally, we'll only _write_ texel data to a texture when we map it.
* But if the user is providing depth or stencil values and the texture
struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
{
- GLuint sizeInBytes;
const GLbitfield rwMode = get_read_write_mode(format, texImage->TexFormat);
const GLuint zeroImageOffset = 0;
GLubyte *dstMap;
(void) border;
- /* allocate memory */
- sizeInBytes = texture_size(texImage);
- texImage->Data = _mesa_alloc_texmemory(sizeInBytes);
- if (!texImage->Data) {
+ /* allocate storage for texture data */
+ if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage, texImage->TexFormat,
+ width, 1, 1)) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D");
return;
}
struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
{
- GLuint sizeInBytes;
const GLbitfield rwMode = get_read_write_mode(format, texImage->TexFormat);
const GLuint zeroImageOffset = 0;
GLubyte *dstMap;
(void) border;
- /* allocate memory */
- sizeInBytes = texture_size(texImage);
- texImage->Data = _mesa_alloc_texmemory(sizeInBytes);
- if (!texImage->Data) {
+ /* allocate storage for texture data */
+ if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage, texImage->TexFormat,
+ width, height, 1)) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
return;
}
struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
{
- GLuint sizeInBytes;
const GLbitfield rwMode = get_read_write_mode(format, texImage->TexFormat);
GLboolean success;
GLint slice;
(void) border;
- /* allocate memory */
- sizeInBytes = texture_size(texImage);
- texImage->Data = _mesa_alloc_texmemory(sizeInBytes);
- if (!texImage->Data) {
- /* Note: we check for a NULL image pointer here, _after_ we allocated
- * memory for the texture. That's what the GL spec calls for.
- */
+ /* allocate storage for texture data */
+ if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage, texImage->TexFormat,
+ width, height, depth)) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D");
return;
}
ASSERT(texImage->Depth == 1);
ASSERT(texImage->Data == NULL); /* was freed in glCompressedTexImage2DARB */
- /* allocate storage */
- texImage->Data = _mesa_alloc_texmemory(imageSize);
- if (!texImage->Data) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2DARB");
+ /* allocate storage for texture data */
+ if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage, texImage->TexFormat,
+ width, height, 1)) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D");
return;
}