diff options
author | Eric Anholt <[email protected]> | 2013-04-19 11:56:35 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2013-04-30 10:40:43 -0700 |
commit | 0a484f100615379482eb733d97757d7b24e377ef (patch) | |
tree | 3e40a12c7277b7068e1ac79dd837eb6249a070eb /src/mesa/drivers | |
parent | f709c31c6717f898ae8689af2eb25232309f0cba (diff) |
swrast: Move ImageOffsets allocation to shared code.
Reviewed-by: Kenneth Graunke <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_tex.c | 20 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_texture.c | 15 |
2 files changed, 4 insertions, 31 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c index ee8db71372b..2fbd5c4e815 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.c +++ b/src/mesa/drivers/dri/intel/intel_tex.c @@ -64,7 +64,6 @@ intel_alloc_texture_image_buffer(struct gl_context *ctx, struct intel_texture_image *intel_image = intel_texture_image(image); struct gl_texture_object *texobj = image->TexObject; struct intel_texture_object *intel_texobj = intel_texture_object(texobj); - GLuint slices; assert(image->Border == 0); @@ -81,23 +80,8 @@ intel_alloc_texture_image_buffer(struct gl_context *ctx, */ ctx->Driver.FreeTextureImageBuffer(ctx, image); - /* Allocate the swrast_texture_image::ImageOffsets array now */ - switch (texobj->Target) { - case GL_TEXTURE_3D: - case GL_TEXTURE_2D_ARRAY: - case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: - slices = image->Depth; - break; - case GL_TEXTURE_1D_ARRAY: - slices = image->Height; - break; - default: - slices = 1; - } - assert(!intel_image->base.ImageOffsets); - intel_image->base.ImageOffsets = malloc(slices * sizeof(GLuint)); - - _swrast_init_texture_image(image); + if (!_swrast_init_texture_image(image)) + return false; if (intel_texobj->mt && intel_miptree_match_image(intel_texobj->mt, image)) { diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index b6e551cd992..a953858d3bb 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -105,23 +105,12 @@ radeonAllocTextureImageBuffer(struct gl_context *ctx, struct gl_texture_image *timage) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); - radeon_texture_image *image = get_radeon_texture_image(timage); struct gl_texture_object *texobj = timage->TexObject; - int slices; ctx->Driver.FreeTextureImageBuffer(ctx, timage); - switch (texobj->Target) { - case GL_TEXTURE_3D: - slices = timage->Depth; - break; - default: - slices = 1; - } - assert(!image->base.ImageOffsets); - image->base.ImageOffsets = malloc(slices * sizeof(GLuint)); - - _swrast_init_texture_image(timage); + if (!_swrast_init_texture_image(timage)) + return GL_FALSE; teximage_assign_miptree(rmesa, texobj, timage); |