OSDN Git Service

i965/tex_image: Reference the renderbuffer miptree in setTexBuffer2
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 12 Sep 2017 21:26:04 +0000 (14:26 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 22 Feb 2018 02:18:16 +0000 (18:18 -0800)
commit00926a2730190500a6a854659b193b022b92db2b
tree278010eb8dc665f50189442d7d113976e6f1972b
parent41d45eb21e50349a89c25a56056dc0e4f5642967
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: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chadversary@chromium.org>
src/mesa/drivers/dri/i965/intel_tex_image.c