X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fdrivers%2Fdri%2Fintel%2Fintel_tex.c;h=24f13dfee8993933345666fb0f0847223594978d;hb=bdf13dc8324c391b7d34f8bdaea72c4452ab7edb;hp=92481b9b55f7a858776def611f8091be7b93e96f;hpb=c9a7dfcf92e6adb4b85338c2c8dbbfbaf39fbfe7;p=mesa.git diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c index 92481b9b55f..24f13dfee89 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.c +++ b/src/mesa/drivers/dri/intel/intel_tex.c @@ -7,6 +7,7 @@ #include "intel_context.h" #include "intel_mipmap_tree.h" #include "intel_tex.h" +#include "intel_fbo.h" #define FILE_DEBUG_FLAG DEBUG_TEXTURE @@ -34,8 +35,14 @@ intelNewTextureObject(struct gl_context * ctx, GLuint name, GLenum target) (void) ctx; DBG("%s\n", __FUNCTION__); + + if (obj == NULL) + return NULL; + _mesa_initialize_texture_object(&obj->base, name, target); + obj->needs_validate = true; + return &obj->base; } @@ -57,32 +64,24 @@ 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); + /* Quantize sample count */ + if (image->NumSamples) { + image->NumSamples = intel_quantize_num_samples(intel->intelScreen, image->NumSamples); + if (!image->NumSamples) + return false; + } + /* Because the driver uses AllocTextureImageBuffer() internally, it may end * up mismatched with FreeTextureImageBuffer(), but that is safe to call * multiple times. */ 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: - 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)) { @@ -107,6 +106,8 @@ intel_alloc_texture_image_buffer(struct gl_context *ctx, image->Width, image->Height, image->Depth, intel_image->mt); } + intel_texobj->needs_validate = true; + return true; } @@ -120,15 +121,7 @@ intel_free_texture_image_buffer(struct gl_context * ctx, intel_miptree_release(&intelImage->mt); - if (intelImage->base.Buffer) { - _mesa_align_free(intelImage->base.Buffer); - intelImage->base.Buffer = NULL; - } - - if (intelImage->base.ImageOffsets) { - free(intelImage->base.ImageOffsets); - intelImage->base.ImageOffsets = NULL; - } + _swrast_free_texture_image_buffer(ctx, texImage); } /**