aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristian Høgsberg Kristensen <[email protected]>2016-05-09 17:02:45 -0700
committerKristian Høgsberg Kristensen <[email protected]>2016-05-24 10:14:56 -0700
commit8ceb7c7d9bc2443c84069a8441b97b8beea4f922 (patch)
treec54b32640c009cfada8ea6da0d9394bf22c06d68
parent40e9be4a5cc4fa2a46900d10dd5d5657d54625c4 (diff)
i965: Use intel_set_texture_image_mt() in intelSetTexBuffer2()
Create the mt for the drawable bo directly and call our new intel_miptree_create_for_bo() helper instead. Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Chad Versace <[email protected]>
-rw-r--r--src/mesa/drivers/dri/i965/intel_tex_image.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c b/src/mesa/drivers/dri/i965/intel_tex_image.c
index b2149376deb..7d71aa2d648 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_image.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_image.c
@@ -225,8 +225,8 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target,
struct intel_renderbuffer *rb;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
- int level = 0, internalFormat = 0;
mesa_format texFormat = MESA_FORMAT_NONE;
+ struct intel_mipmap_tree *mt;
texObj = _mesa_get_current_tex_object(ctx, target);
@@ -246,27 +246,30 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target,
if (rb->mt->cpp == 4) {
if (texture_format == __DRI_TEXTURE_FORMAT_RGB) {
- internalFormat = GL_RGB;
texFormat = MESA_FORMAT_B8G8R8X8_UNORM;
}
else {
- internalFormat = GL_RGBA;
texFormat = MESA_FORMAT_B8G8R8A8_UNORM;
}
} else if (rb->mt->cpp == 2) {
- internalFormat = GL_RGB;
texFormat = MESA_FORMAT_B5G6R5_UNORM;
}
- _mesa_lock_texture(&brw->ctx, texObj);
- texImage = _mesa_get_tex_image(ctx, texObj, target, level);
intel_miptree_make_shareable(brw, rb->mt);
- intel_set_texture_image_bo(ctx, texImage, rb->mt->bo, target,
- internalFormat, texFormat, 0,
- rb->Base.Base.Width,
- rb->Base.Base.Height,
- rb->mt->pitch,
- 0, 0, 0);
+ mt = intel_miptree_create_for_bo(brw, rb->mt->bo, texFormat, 0,
+ rb->Base.Base.Width,
+ rb->Base.Base.Height,
+ 1, rb->mt->pitch, 0);
+ if (mt == NULL)
+ return;
+ mt->target = target;
+ mt->total_width = rb->Base.Base.Width;
+ mt->total_height = rb->Base.Base.Height;
+
+ _mesa_lock_texture(&brw->ctx, texObj);
+ texImage = _mesa_get_tex_image(ctx, texObj, target, 0);
+ intel_set_texture_image_mt(brw, texImage, mt);
+ intel_miptree_release(&mt);
_mesa_unlock_texture(&brw->ctx, texObj);
}