[Mesa-dev] [PATCH 6/6] intel: Create a miptree using offsets in intel_set_texture_image_region
Abdiel Janulgue
abdiel.janulgue at linux.intel.com
Fri Dec 14 05:28:18 PST 2012
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 | 27 ++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c
index cc4d49f..e27f0f4 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -256,7 +256,13 @@ 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 level_x,
+ GLuint level_y,
+ GLuint slice_x_offset,
+ GLuint slice_y_offset)
{
struct intel_context *intel = intel_context(ctx);
struct intel_texture_image *intel_image = intel_texture_image(image);
@@ -264,14 +270,17 @@ 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,
+ intel_image->mt = intel_miptree_create_for_offset(intel, target,
image->TexFormat,
- region);
+ region, width,
+ height, level_x,
+ level_y, slice_x_offset,
+ slice_y_offset);
if (intel_image->mt == NULL)
return;
@@ -331,7 +340,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, 0, 0);
_mesa_unlock_texture(&intel->ctx, texObj);
}
@@ -362,7 +374,10 @@ 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->level_x, image->level_y,
+ image->slice_x_offset, image->slice_y_offset);
}
void
--
1.7.9.5
More information about the mesa-dev
mailing list