Mesa (master): st/mesa: Ignore internal_format in st_context_teximage.

Chia-I Wu olv at kemper.freedesktop.org
Mon May 10 03:18:23 UTC 2010


Module: Mesa
Branch: master
Commit: 913d7c388d1167a6cb3ccb52eb50f4c4f183b033
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=913d7c388d1167a6cb3ccb52eb50f4c4f183b033

Author: Chia-I Wu <olv at lunarg.com>
Date:   Fri May  7 17:34:15 2010 +0800

st/mesa: Ignore internal_format in st_context_teximage.

When internal_format and tex->format differ, st_finailize_texture will
surface_copy between surfaces with different formats.  This commit works
around the issue by ignoring internal_format.  A sane fix is needed
here.

---

 src/mesa/state_tracker/st_manager.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index ea89553..8691969 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -541,7 +541,16 @@ st_context_teximage(struct st_context_iface *stctxi, enum st_texture_type target
    texImage = _mesa_get_tex_image(ctx, texObj, target, level);
    stImage = st_texture_image(texImage);
    if (tex) {
-      if (util_format_get_component_bits(internal_format,
+      /*
+       * XXX When internal_format and tex->format differ, st_finalize_texture
+       * needs to allocate a new texture with internal_format and copy the
+       * texture here into the new one.  It will result in surface_copy being
+       * called on surfaces whose formats differ.
+       *
+       * To avoid that, internal_format is (wrongly) ignored here.  A sane fix
+       * is to use a sampler view.
+       */
+      if (util_format_get_component_bits(tex->format,
                UTIL_FORMAT_COLORSPACE_RGB, 3) > 0)
          internalFormat = GL_RGBA;
       else




More information about the mesa-commit mailing list