[Mesa-dev] [WIP 06/25] i965/fs: Take double float into account in register offsets
Topi Pohjolainen
topi.pohjolainen at intel.com
Thu Oct 16 05:24:18 PDT 2014
Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
src/mesa/drivers/dri/i965/brw_fs.h | 4 +++-
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 8 ++++++--
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index 943e638..09ac1eb 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -167,6 +167,8 @@ horiz_offset(fs_reg reg, unsigned delta)
static inline fs_reg
offset(fs_reg reg, unsigned delta)
{
+ const unsigned dmul = (reg.type == BRW_REGISTER_TYPE_DF) ? 2 : 1;
+
assert(reg.stride > 0);
switch (reg.file) {
case BAD_FILE:
@@ -175,7 +177,7 @@ offset(fs_reg reg, unsigned delta)
case MRF:
return byte_offset(reg, delta * reg.width * reg.stride * type_sz(reg.type));
case UNIFORM:
- reg.reg_offset += delta;
+ reg.reg_offset += (dmul * delta);
break;
default:
assert(delta == 0);
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index fbd56a0..57cd5d4 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -174,9 +174,11 @@ fs_visitor::visit(ir_dereference_record *ir)
unsigned int off = 0;
for (unsigned int i = 0; i < struct_type->length; i++) {
+ const unsigned dmul =
+ struct_type->fields.structure[i].type->is_double() ? 2 : 1;
if (strcmp(struct_type->fields.structure[i].name, ir->field) == 0)
break;
- off += type_size(struct_type->fields.structure[i].type);
+ off += (dmul * type_size(struct_type->fields.structure[i].type));
}
this->result = offset(this->result, off);
this->result.type = brw_type_for_base_type(ir->type);
@@ -210,7 +212,9 @@ fs_visitor::visit(ir_dereference_array *ir)
fs_reg index_reg;
index_reg = fs_reg(this, glsl_type::int_type);
- emit(BRW_OPCODE_MUL, index_reg, this->result, fs_reg(element_size));
+ const int dmul = (src.type == BRW_REGISTER_TYPE_DF) ? 2 : 1;
+ emit(BRW_OPCODE_MUL, index_reg, this->result,
+ fs_reg(dmul * element_size));
if (src.reladdr) {
emit(BRW_OPCODE_ADD, index_reg, *src.reladdr, index_reg);
--
1.8.3.1
More information about the mesa-dev
mailing list