i965/vs: Add support for GL_FIXED attributes.
authorEric Anholt <eric@anholt.net>
Wed, 10 Aug 2011 18:38:42 +0000 (11:38 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 16 Aug 2011 20:04:43 +0000 (13:04 -0700)
Fixes arb_es2_compatibility-fixed-type

src/mesa/drivers/dri/i965/brw_vec4_emit.cpp

index 517a3e3c75ba54b8092d6004535afeb02950bfd7..350d544aba313140b43baff812730863d10528e0 100644 (file)
@@ -42,6 +42,18 @@ vec4_visitor::setup_attributes(int payload_reg)
       if (prog_data->inputs_read & BITFIELD64_BIT(i)) {
         attribute_map[i] = payload_reg + nr_attributes;
         nr_attributes++;
+
+        /* Do GL_FIXED rescaling for GLES2.0.  Our GL_FIXED
+         * attributes come in as floating point conversions of the
+         * integer values.
+         */
+        if (c->key.gl_fixed_input_size[i] != 0) {
+           struct brw_reg reg = brw_vec8_grf(attribute_map[i], 0);
+
+           brw_MUL(p,
+                   brw_writemask(reg, (1 << c->key.gl_fixed_input_size[i]) - 1),
+                   reg, brw_imm_f(1.0 / 65536.0));
+        }
       }
    }