diff options
| author | Eric Anholt <eric@anholt.net> | 2010-07-02 16:10:31 -0700 | 
|---|---|---|
| committer | Eric Anholt <eric@anholt.net> | 2010-07-02 17:06:08 -0700 | 
| commit | 8f25d198e54a117b36e68582977a644d085a4a94 (patch) | |
| tree | 535906dfb06ff3a2dfa272408ce3b4245b09171b /src | |
| parent | b61f4241f314144d3290085cda5db1959d8960a2 (diff) | |
ir_to_mesa: Add support for scalar * mat, vec * mat.
This is not tested by piglit currently.
Diffstat (limited to 'src')
| -rw-r--r-- | src/mesa/shader/ir_to_mesa.cpp | 36 | 
1 files changed, 36 insertions, 0 deletions
| diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index c467825492..f8858af26d 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -686,6 +686,42 @@ ir_to_mesa_visitor::visit(ir_expression *ir)  		src_column.index++;  	    }  	 } +      } else if (ir->operands[1]->type->is_matrix()) { +	 if (ir->operands[0]->type->is_scalar()) { +	    ir_to_mesa_dst_reg dst_column = result_dst; +	    ir_to_mesa_src_reg src_column = op[1]; +	    for (int i = 0; i < ir->operands[1]->type->matrix_columns; i++) { +	       ir_to_mesa_emit_op2(ir, OPCODE_MUL, +				   dst_column, src_column, op[0]); +	       dst_column.index++; +	       src_column.index++; +	    } +	 } else { +	    ir_to_mesa_src_reg src_column = op[1]; +	    ir_to_mesa_dst_reg dst_chan = result_dst; + +	    /* FINISHME here and above: non-square matrices */ +	    assert(ir->operands[1]->type->vector_elements == +		   ir->operands[1]->type->matrix_columns); + +	    for (int i = 0; i < ir->operands[0]->type->vector_elements; i++) { +	       dst_chan.writemask = (1 << i); +	       switch (ir->operands[0]->type->vector_elements) { +	       case 2: +		  ir_to_mesa_emit_op2(ir, OPCODE_DP2, dst_chan, op[0], src_column); +		  break; +	       case 3: +		  ir_to_mesa_emit_op2(ir, OPCODE_DP3, dst_chan, op[0], src_column); +		  break; +	       case 4: +		  ir_to_mesa_emit_op2(ir, OPCODE_DP4, dst_chan, op[0], src_column); +		  break; +	       default: +		  assert(0); +	       } +	       src_column.index++; +	    } +	 }        } else {  	 assert(!ir->operands[0]->type->is_matrix());  	 assert(!ir->operands[1]->type->is_matrix()); | 
