diff options
| author | Kenneth Graunke <kenneth@whitecape.org> | 2010-07-05 21:15:32 -0700 | 
|---|---|---|
| committer | Ian Romanick <ian.d.romanick@intel.com> | 2010-07-06 16:03:33 -0700 | 
| commit | 3f4a0b8bb0cfa36cc6f9968c8aab03f1cb0678ff (patch) | |
| tree | bcde428d6a47fede37a96b2674e0e2b2ceee7540 /src | |
| parent | cf80a4d177225345c2238d8e545f8ae02b41da71 (diff) | |
ir_constant_expression: Add support for dot products.
Diffstat (limited to 'src')
| -rw-r--r-- | src/glsl/ir_constant_expression.cpp | 20 | 
1 files changed, 20 insertions, 0 deletions
diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index d05aa104f8..5c2e3629e1 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -317,6 +317,26 @@ ir_constant_visitor::visit(ir_expression *ir)        }        break; +   case ir_binop_dot: +      assert(op[0]->type->is_vector() && op[1]->type->is_vector()); +      data.f[0] = 0; +      for (c = 0; c < op[0]->type->components(); c++) { +	 switch (ir->operands[0]->type->base_type) { +	 case GLSL_TYPE_UINT: +	    data.u[0] += op[0]->value.u[c] * op[1]->value.u[c]; +	    break; +	 case GLSL_TYPE_INT: +	    data.i[0] += op[0]->value.i[c] * op[1]->value.i[c]; +	    break; +	 case GLSL_TYPE_FLOAT: +	    data.f[0] += op[0]->value.f[c] * op[1]->value.f[c]; +	    break; +	 default: +	    assert(0); +	 } +      } + +      break;     case ir_binop_add:        assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar);        for (unsigned c = 0, c0 = 0, c1 = 0;  | 
