From 55ced3367543994bd21b48326c64edb743001145 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 27 Aug 2010 10:44:04 -0700 Subject: i965: Add a bit of support for matrices to the new FS. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index a2284e431a0..749a2f2eb79 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -165,16 +165,7 @@ type_size(const struct glsl_type *type) case GLSL_TYPE_INT: case GLSL_TYPE_FLOAT: case GLSL_TYPE_BOOL: - if (type->is_matrix()) { - /* In case of incoming uniform/varying matrices, match their - * allocation behavior. FINISHME: We could just use - * glsl_type->components() for variables and temps within the - * shader. - */ - return type->matrix_columns * 4; - } else { - return type->vector_elements; - } + return type->components(); case GLSL_TYPE_ARRAY: /* FINISHME: uniform/varying arrays. */ return type_size(type->fields.array) * type->length; @@ -579,7 +570,26 @@ fs_visitor::visit(ir_dereference_record *ir) void fs_visitor::visit(ir_dereference_array *ir) { - assert(!"FINISHME"); + ir_constant *index; + int element_size; + + ir->array->accept(this); + index = ir->array_index->as_constant(); + + if (ir->type->is_matrix()) { + element_size = ir->type->vector_elements; + } else { + element_size = type_size(ir->type); + } + + if (index) { + assert(this->result.file == UNIFORM || + (this->result.file == GRF && + this->result.reg != 0)); + this->result.reg_offset += index->value.i[0] * element_size; + } else { + assert(!"FINISHME: non-constant matrix column"); + } } void -- cgit v1.2.3