aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/intel_tex_image.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-09-12 14:26:04 -0700
committerJason Ekstrand <[email protected]>2017-09-18 12:16:55 -0700
commitd80cbbeaff9329fdc78ae3d97097c1e65dfcdd61 (patch)
tree0d24c22dcee13db0c905a23e525ea1b754ceeab2 /src/mesa/drivers/dri/i965/intel_tex_image.c
parente97f4b748094466567c7f3bad1a02ecee13db9c8 (diff)
i965/tex_image: Reference the renderbuffer miptree in setTexBuffer2
The old code made a new miptree that referenced the same BO as the renderbuffer and just trusted in the memory aliasing to work. There are only two ways in which the new miptree is liable to differ from the one in the renderbuffer and neither of them matter: 1) It may have a different target. The only targets that we can ever see in intelSetTexBuffer2 are GL_TEXTURE_2D and GL_TEXTURE_RECTANGLE and the difference between the two doesn't matter as far as the miptree is concerned; genX(update_sampler_state) only looks at the gl_texture_object and not the miptree when determining whether or not to use normalized coordinates. 2) It may have a very slightly different format. Again, this doesn't matter because we've supported texture views for quite some time so we always look at the gl_texture_object format instead of the miptree format for hardware setup anyway. On the other hand, because we were recreating the miptree, we were using intel_miptree_create_for_bo which doesn't understand modifiers. We really want this function to work without doing a resolve so long as you have modifiers so we need to fix that. Reviewed-by: Topi Pohjolainen <[email protected]> Reviewed-by: Daniel Stone <[email protected]> Reviewed-by: Chad Versace <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/intel_tex_image.c')
-rw-r--r--src/mesa/drivers/dri/i965/intel_tex_image.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c b/src/mesa/drivers/dri/i965/intel_tex_image.c
index ceb0b3f9810..9ecfd7fc4ff 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_image.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_image.c
@@ -410,8 +410,6 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target,
struct intel_renderbuffer *rb;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
- mesa_format texFormat = MESA_FORMAT_NONE;
- struct intel_mipmap_tree *mt;
GLenum internal_format = 0;
texObj = _mesa_get_current_tex_object(ctx, target);
@@ -431,33 +429,20 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target,
return;
if (rb->mt->cpp == 4) {
- if (texture_format == __DRI_TEXTURE_FORMAT_RGB) {
+ if (texture_format == __DRI_TEXTURE_FORMAT_RGB)
internal_format = GL_RGB;
- texFormat = MESA_FORMAT_B8G8R8X8_UNORM;
- }
- else {
+ else
internal_format = GL_RGBA;
- texFormat = MESA_FORMAT_B8G8R8A8_UNORM;
- }
} else if (rb->mt->cpp == 2) {
+ /* This is 565 */
internal_format = GL_RGB;
- texFormat = MESA_FORMAT_B5G6R5_UNORM;
}
intel_miptree_make_shareable(brw, rb->mt);
- mt = intel_miptree_create_for_bo(brw, rb->mt->bo, texFormat, 0,
- rb->Base.Base.Width,
- rb->Base.Base.Height,
- 1, rb->mt->surf.row_pitch,
- MIPTREE_CREATE_DEFAULT);
- if (mt == NULL)
- return;
- mt->target = target;
_mesa_lock_texture(&brw->ctx, texObj);
texImage = _mesa_get_tex_image(ctx, texObj, target, 0);
- intel_set_texture_image_mt(brw, texImage, internal_format, mt);
- intel_miptree_release(&mt);
+ intel_set_texture_image_mt(brw, texImage, internal_format, rb->mt);
_mesa_unlock_texture(&brw->ctx, texObj);
}