Mesa (master): intel: Recognize all depth formats in get_teximage_readbuffer.

Kenneth Graunke kwg at kemper.freedesktop.org
Sat Jul 9 17:39:03 UTC 2011


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Sat Jul  9 02:46:03 2011 -0700

intel: Recognize all depth formats in get_teximage_readbuffer.

The existing code was missing GL_DEPTH_COMPONENT32, resulting in it
wrongly returning the color buffer instead of the depth buffer.

Fixes an issue in PlaneShift 0.5.7 when casting spells.  The game calls
CopyTexSubImage2D on buffers with a GL_DEPTH_COMPONENT32 internal
format, which (prior to this patch) resulted in an attempt to copy
ARGB8888 to X8_Z24.

Instead of adding the missing enumeration directly, convert the code to
use _mesa_is_depth_format() and _mesa_is_depthstencil_format() as these
should catch any newly added depth formats in the future.

NOTE: This is a candidate for the 7.10 and 7.11 branches.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/mesa/drivers/dri/intel/intel_tex_copy.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c
index eda07a4..1a3643d 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_copy.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c
@@ -55,15 +55,11 @@ get_teximage_readbuffer(struct intel_context *intel, GLenum internalFormat)
    DBG("%s %s\n", __FUNCTION__,
        _mesa_lookup_enum_by_nr(internalFormat));
 
-   switch (internalFormat) {
-   case GL_DEPTH_COMPONENT:
-   case GL_DEPTH_COMPONENT16:
-   case GL_DEPTH24_STENCIL8_EXT:
-   case GL_DEPTH_STENCIL_EXT:
+   if (_mesa_is_depth_format(internalFormat) ||
+       _mesa_is_depthstencil_format(internalFormat))
       return intel_get_renderbuffer(intel->ctx.ReadBuffer, BUFFER_DEPTH);
-   default:
-      return intel_renderbuffer(intel->ctx.ReadBuffer->_ColorReadBuffer);
-   }
+
+   return intel_renderbuffer(intel->ctx.ReadBuffer->_ColorReadBuffer);
 }
 
 




More information about the mesa-commit mailing list