Mesa (master): i915g: Fix a bug in facing.

Stephane Marchesin marcheu at kemper.freedesktop.org
Tue Jun 28 02:56:32 UTC 2011


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

Author: Stéphane Marchesin <marcheu at chromium.org>
Date:   Mon Jun 27 18:27:50 2011 -0700

i915g: Fix a bug in facing.

However doesn't work because of limitations in the draw module.

---

 src/gallium/drivers/i915/TODO                 |    3 +--
 src/gallium/drivers/i915/i915_fpc_translate.c |    3 ---
 src/gallium/drivers/i915/i915_state_derived.c |    8 ++++++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/i915/TODO b/src/gallium/drivers/i915/TODO
index e4404d2..992168e 100644
--- a/src/gallium/drivers/i915/TODO
+++ b/src/gallium/drivers/i915/TODO
@@ -36,8 +36,7 @@ Random list of problems with i915g:
   * PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR
   * PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS
 
-- Finish front/back face. This would need EMIT_1F_FACE or adding a couple of
-  instructions in the shader.
+- Finish front/back face. We need to add face support to lp_build_system_values_array and use it in draw_llvm.c.
 
 Other bugs can be found here:
 https://bugs.freedesktop.org/buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&component=Drivers/Gallium/i915g
diff --git a/src/gallium/drivers/i915/i915_fpc_translate.c b/src/gallium/drivers/i915/i915_fpc_translate.c
index f39b020..5018456 100644
--- a/src/gallium/drivers/i915/i915_fpc_translate.c
+++ b/src/gallium/drivers/i915/i915_fpc_translate.c
@@ -215,9 +215,7 @@ src_vector(struct i915_fp_compile *p,
       case TGSI_SEMANTIC_FACE:
          {
             /* for back/front faces */
-            /* XXX also emit something from 0,1 to -1,1 */
             int real_tex_unit = get_mapping(fs, I915_SEMANTIC_FACE);
-            printf("semantic face fpc at %d\n",real_tex_unit);
             src = i915_emit_decl(p, REG_TYPE_T, T_TEX0 + real_tex_unit, D0_CHANNEL_X);
             break;
          }
@@ -246,7 +244,6 @@ src_vector(struct i915_fp_compile *p,
 		 source->Register.SwizzleZ,
 		 source->Register.SwizzleW);
 
-
    /* There's both negate-all-components and per-component negation.
     * Try to handle both here.
     */
diff --git a/src/gallium/drivers/i915/i915_state_derived.c b/src/gallium/drivers/i915/i915_state_derived.c
index dd4fd18..e01f16e 100644
--- a/src/gallium/drivers/i915/i915_state_derived.c
+++ b/src/gallium/drivers/i915/i915_state_derived.c
@@ -157,11 +157,15 @@ static void calculate_vertex_layout(struct i915_context *i915)
 
    /* front/back face */
    if (face) {
-      uint slot = find_mapping(fs, I915_SEMANTIC_FACE);	 
+      uint slot = find_mapping(fs, I915_SEMANTIC_FACE);
       debug_printf("Front/back face is broken\n");
+      /* XXX Because of limitations in the draw module, currently src will be 0
+       * for SEMANTIC_FACE, so this aliases to POS. We need to fix in the draw
+       * module by adding an extra shader output.
+       */
       src = draw_find_shader_output(i915->draw, TGSI_SEMANTIC_FACE, 0);
-      /* really here it's EMIT_1F_FACE */
       draw_emit_vertex_attr(&vinfo, EMIT_1F, INTERP_CONSTANT, src);
+      vinfo.hwfmt[1] &= ~(TEXCOORDFMT_NOT_PRESENT << (slot * 4));
       vinfo.hwfmt[1] |= TEXCOORDFMT_1D << (slot * 4);
    }
 




More information about the mesa-commit mailing list