[Intel-gfx] [intel-gfx][patch]always use TEXCOORDMODE_CLAMP for 915/945 cubemap

Xiang, Haihao haihao.xiang at intel.com
Tue Dec 9 07:01:13 CET 2008


Another way to avoid GPU hang when using cube map texture.

diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c
index d1b0dcd..3f0e6a6 100644
--- a/src/mesa/drivers/dri/i915/i915_texstate.c
+++ b/src/mesa/drivers/dri/i915/i915_texstate.c
@@ -94,8 +94,12 @@ translate_texture_format(GLuint mesa_format, GLenum DepthMode)
  * GL_CLAMP_TO_EDGE, so the same is done here.
  */
 static GLuint
-translate_wrap_mode(GLenum wrap)
+translate_wrap_mode(GLenum wrap, GLenum target)
 {
+
+   if (target == GL_TEXTURE_CUBE_MAP_ARB)
+       return TEXCOORDMODE_CLAMP_EDGE;
+
    switch (wrap) {
    case GL_REPEAT:
       return TEXCOORDMODE_WRAP;
@@ -299,9 +303,9 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
       state[I915_TEXREG_SS3] = ss3;     /* SS3_NORMALIZED_COORDS */
 
       state[I915_TEXREG_SS3] |=
-         ((translate_wrap_mode(ws) << SS3_TCX_ADDR_MODE_SHIFT) |
-          (translate_wrap_mode(wt) << SS3_TCY_ADDR_MODE_SHIFT) |
-          (translate_wrap_mode(wr) << SS3_TCZ_ADDR_MODE_SHIFT));
+         ((translate_wrap_mode(ws, tObj->Target) << SS3_TCX_ADDR_MODE_SHIFT) |
+          (translate_wrap_mode(wt, tObj->Target) << SS3_TCY_ADDR_MODE_SHIFT) |
+          (translate_wrap_mode(wr, tObj->Target) << SS3_TCZ_ADDR_MODE_SHIFT));
 
       state[I915_TEXREG_SS3] |= (unit << SS3_TEXTUREMAP_INDEX_SHIFT);
    }





More information about the Intel-gfx mailing list