summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2010-08-27 10:44:04 -0700
committerEric Anholt <[email protected]>2010-08-27 12:02:15 -0700
commit55ced3367543994bd21b48326c64edb743001145 (patch)
tree18afa6be93a7927798eb0df058945a05636a5dcf /src
parent91a037b5e1374fe0574480a579bd36c71b75f9c2 (diff)
i965: Add a bit of support for matrices to the new FS.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.cpp32
1 files changed, 21 insertions, 11 deletions
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