[Mesa-dev] [PATCH V5 6/7] intel: Create a miptree using offsets in intel_set_texture_image_region
Abdiel Janulgue
abdiel.janulgue at linux.intel.com
Thu Jan 17 07:49:00 PST 2013
When binding a region to a texture image, re-create the miptree base-level
considering the offset and dimension information exported by DRIImage.
Signed-off-by: Abdiel Janulgue <abdiel.janulgue at linux.intel.com>
---
src/mesa/drivers/dri/intel/intel_tex_image.c | 31 ++++++++++++++++++++------
1 file changed, 24 insertions(+), 7 deletions(-)
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c
index 7361e6a..6c81b80 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -256,7 +256,11 @@ intel_set_texture_image_region(struct gl_context *ctx,
GLenum target,
GLenum internalFormat,
gl_format format,
- uint32_t offset)
+ uint32_t offset,
+ GLuint width,
+ GLuint height,
+ GLuint draw_x,
+ GLuint draw_y)
{
struct intel_context *intel = intel_context(ctx);
struct intel_texture_image *intel_image = intel_texture_image(image);
@@ -264,14 +268,22 @@ intel_set_texture_image_region(struct gl_context *ctx,
struct intel_texture_object *intel_texobj = intel_texture_object(texobj);
_mesa_init_teximage_fields(&intel->ctx, image,
- region->width, region->height, 1,
+ width, height, 1,
0, internalFormat, format);
ctx->Driver.FreeTextureImageBuffer(ctx, image);
- intel_image->mt = intel_miptree_create_for_region(intel, target,
- image->TexFormat,
- region);
+ intel_image->mt = intel_miptree_create_layout(intel, target, image->TexFormat,
+ 0, 0,
+ width, height, 1,
+ true, 0 /* num_samples */,
+ INTEL_MSAA_LAYOUT_NONE);
+ intel_region_reference(&intel_image->mt->region, region);
+ intel_image->mt->total_width = width;
+ intel_image->mt->total_height = height;
+ intel_image->mt->level[0].slice[0].x_offset = draw_x;
+ intel_image->mt->level[0].slice[0].y_offset = draw_y;
+
if (intel_image->mt == NULL)
return;
intel_texobj->needs_validate = true;
@@ -332,7 +344,10 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target,
_mesa_lock_texture(&intel->ctx, texObj);
texImage = _mesa_get_tex_image(ctx, texObj, target, level);
intel_set_texture_image_region(ctx, texImage, rb->mt->region, target,
- internalFormat, texFormat, 0);
+ internalFormat, texFormat, 0,
+ rb->mt->region->width,
+ rb->mt->region->height,
+ 0, 0);
_mesa_unlock_texture(&intel->ctx, texObj);
}
@@ -363,7 +378,9 @@ intel_image_target_texture_2d(struct gl_context *ctx, GLenum target,
intel_set_texture_image_region(ctx, texImage, image->region,
target, image->internal_format,
- image->format, image->offset);
+ image->format, image->offset,
+ image->width, image->height,
+ image->draw_x, image->draw_y);
}
void
--
1.7.9.5
More information about the mesa-dev
mailing list