aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2011-08-23 13:30:42 -0700
committerEric Anholt <[email protected]>2011-08-30 12:09:40 -0700
commit81a0b2166991a3015f8336e184c34cf6a92adfe0 (patch)
tree5122ce9f1e31f31c760f9679b60c41163acab43c /src/mesa/drivers
parent72cfc6f3778d8297e52c254a5861a88eb62e4d67 (diff)
i965/vs: Fix GL_FIXED setup when a writemask is present.
By emitting code before generate_code(), we ended up in align1 mode where writemasks don't exist, so we rescaled gl_Vertex.w and things went badly. By moving GL_FIXED support to the visitor, we end up with normal codegen, and as a bonus the GL_FIXED setup ends up getting printed appropriately in debug output. Fixes gtf/GL2Tests/fixed_data_type Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_emit.cpp25
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp12
2 files changed, 24 insertions, 13 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp b/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
index f084a7f7e4a..067f1c98af9 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
@@ -42,24 +42,23 @@ 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));
- }
}
}
foreach_list(node, &this->instructions) {
vec4_instruction *inst = (vec4_instruction *)node;
+ /* We have to support ATTR as a destination for GL_FIXED fixup. */
+ if (inst->dst.file == ATTR) {
+ int grf = attribute_map[inst->dst.reg + inst->dst.reg_offset];
+
+ struct brw_reg reg = brw_vec8_grf(grf, 0);
+ reg.dw1.bits.writemask = inst->dst.writemask;
+
+ inst->dst.file = HW_REG;
+ inst->dst.fixed_hw_reg = reg;
+ }
+
for (int i = 0; i < 3; i++) {
if (inst->src[i].file != ATTR)
continue;
@@ -625,7 +624,7 @@ vec4_visitor::run()
void
vec4_visitor::generate_code()
{
- int last_native_inst = p->nr_insn;
+ int last_native_inst = 0;
const char *last_annotation_string = NULL;
ir_instruction *last_annotation_ir = NULL;
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 69399045d85..4babc56bac4 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -666,6 +666,18 @@ vec4_visitor::visit(ir_variable *ir)
switch (ir->mode) {
case ir_var_in:
reg = new(mem_ctx) dst_reg(ATTR, ir->location);
+
+ /* Do GL_FIXED rescaling for GLES2.0. Our GL_FIXED attributes
+ * come in as floating point conversions of the integer values.
+ */
+ for (int i = ir->location; i < ir->location + type_size(ir->type); i++) {
+ if (!c->key.gl_fixed_input_size[i])
+ continue;
+
+ dst_reg dst = *reg;
+ dst.writemask = (1 << c->key.gl_fixed_input_size[i]) - 1;
+ emit(BRW_OPCODE_MUL, dst, src_reg(dst), src_reg(1.0f / 65536.0f));
+ }
break;
case ir_var_out: