Kenneth Graunke
0afe349322
ir_constant_expression: Add support for the "radians" builtin.
2010-07-28 15:46:27 -07:00
Kenneth Graunke
20970f7dea
ir_constant_expression: Add support for the "tanh" builtin.
2010-07-28 15:46:27 -07:00
Kenneth Graunke
9c9f8b2d69
ir_constant_expression: Add support for the "tan" builtin.
2010-07-28 15:46:27 -07:00
Kenneth Graunke
5d551daf38
ir_constant_expression: Add support for the "sinh" builtin.
2010-07-28 15:46:27 -07:00
Kenneth Graunke
ba4178345a
ir_constant_expression: Add support for the "cosh" builtin.
2010-07-28 15:46:27 -07:00
Kenneth Graunke
13f8758e9c
ir_constant_expression: Add support for "atan" builtins.
2010-07-28 15:46:27 -07:00
Kenneth Graunke
f6ea9dfe47
ir_constant_expression: Add support for "acos" builtin.
2010-07-28 15:46:27 -07:00
Kenneth Graunke
3b6c29b8f0
ir_constant_expression: Add support for "asin" builtin.
2010-07-28 15:46:26 -07:00
Kenneth Graunke
d6792a7f7c
ir_constant_expression: Add support for "any" builtin.
2010-07-28 15:46:26 -07:00
Kenneth Graunke
aca7e95222
ir_constant_expression: Add support for "all" builtin.
2010-07-28 15:46:26 -07:00
Kenneth Graunke
8b1680acc3
ir_constant_expression: Implement builtins that wrap an expression.
...
These builtin functions are represented by ir_expression_operations, so
we can just create one of those and ask for its value.
2010-07-28 15:46:26 -07:00
Kenneth Graunke
38cb1b273f
ir_constant_expression: Add support for builtins dFdx, dFdy, and fwidth.
...
These always return zero (the derivative of a constant).
2010-07-28 15:46:26 -07:00
Kenneth Graunke
bafd89fa0f
ir_constant_expression: Stub out support for constant builtins.
2010-07-28 15:46:26 -07:00
Kenneth Graunke
f914915d8e
ir_constant_expression: Use Mesa's MIN2/MAX2 instead of our own.
2010-07-28 15:46:26 -07:00
Eric Anholt
54f583a206
glsl2: Don't dereference a NULL var in CE handling during a compile error.
...
If an undeclared variable was dereferenced in an expression that
needed constant expression handling, we would walk off a null ir->var
pointer.
Fixes:
glsl1-TIntermediate::addUnaryMath
2010-07-27 12:10:50 -07:00
Kenneth Graunke
3e882ec84a
ir_constant_expression: Fix broken code for floating point modulus.
...
It's supposed to be x - y * floor(x/y), not (x - y) * floor(x/y).
2010-07-22 17:45:45 -07:00
Kenneth Graunke
9a6d40fbfb
ir_constant_expression: Add support for array == and !=.
...
Piglit parser tests const-array-03.frag and const-array-04.frag now
generate the correct code.
2010-07-21 16:38:33 -07:00
Kenneth Graunke
a096fa7476
ir_constant_expression: Add support for constant arrays.
...
Fixes piglit test const-array-02.frag.
2010-07-21 16:38:33 -07:00
Kenneth Graunke
46d6b8d1ba
ir_constant_expression: Add support for ir_unop_u2f.
...
Also make ir_unop_i2f only operate on signed integers.
2010-07-21 16:38:32 -07:00
Kenneth Graunke
3163f87463
ir_constant_expression: Remove open coded equality comparisons.
...
The ir_constant::has_value method already does this.
2010-07-21 16:38:32 -07:00
Kenneth Graunke
e4768eecd5
ir_constant_expression: Remove pointless use of variable_referenced.
...
ir_dereference_variable always references an ir_variable, so there's no
point in calling a function and NULL-checking the result.
2010-07-20 17:10:05 -07:00
Kenneth Graunke
98f32a13be
ir_constant_expression: Use "this" pointer directly.
...
In ir_expression's signature, I replaced ir->operands[i] with op[i] as
it is more concise; an assertion already ensures these are equal.
2010-07-20 17:10:05 -07:00
Kenneth Graunke
fb2ffd2846
ir_constant_expression: Convert from a visitor to a virtual function.
...
The constant_expression_wrapper was already the only external API, and
much of the internal code used it anyway. Also, it wouldn't ever visit
non-rvalue ir_instructions, so using a visitor seemed a bit unnecessary.
This uses "ir_foo *ir = this;" lines to avoid code churn. These should
be removed.
2010-07-20 17:10:05 -07:00
Kenneth Graunke
e340854115
glsl2: Move constant_expression_value method to ir_rvalue.
...
This prevents top-level callers from asking for the value of something
that is guaranteed not to have one.
2010-07-20 17:10:05 -07:00
Eric Anholt
9be7f63813
glsl2: Make cross() be an expression operation.
...
ARB_fp, ARB_vp, Mesa IR, and the 965 vertex shader all have
instructions for cross. Shaves 12 Mesa instructions off of a
66-instruction shader I have.
2010-07-18 18:12:12 -07:00
Kenneth Graunke
ce5ae5f49d
ir_constant_expression: Add support for ir_binop_mod.
2010-07-14 16:49:24 -07:00
Kenneth Graunke
79fed377f4
ir_constant_expression: Add support for ir_binop_min and ir_binop_max.
...
These now work on scalar/vector combos. Semantically, if a is a scalar,
min(a, vec2(x,y)) == vec2(min(a,x), min(a,y))
2010-07-14 15:50:28 -07:00
Kenneth Graunke
891a0647e4
ir_constant_expression: Add support for ir_binop_pow.
2010-07-14 15:50:28 -07:00
Kenneth Graunke
3fab376bef
ir_constant_expression: Add support for ir_unop_cos.
2010-07-14 15:50:28 -07:00
Kenneth Graunke
908afd16d1
ir_constant_expression: Add support for ir_unop_sin.
2010-07-14 15:50:28 -07:00
Kenneth Graunke
074720477c
ir_constant_expression: Add support for ir_unop_floor.
2010-07-14 15:50:28 -07:00
Kenneth Graunke
c1ee30a145
ir_constant_expression: Add support for ir_unop_ceil.
2010-07-14 15:50:28 -07:00
Kenneth Graunke
323d909ab2
ir_constant_expression: Add support for ir_unop_trunc.
...
This uses a C99 function.
2010-07-14 15:50:28 -07:00
Kenneth Graunke
cb63929df4
ir_constant_expression: Add support for ir_unop_log2.
...
This uses a C99 function.
2010-07-14 15:50:27 -07:00
Kenneth Graunke
aca01edc83
ir_constant_expression: Add support for ir_unop_exp2.
...
This uses a C99 function.
2010-07-14 15:50:27 -07:00
Kenneth Graunke
14b7b2660c
ir_constant_expression: Add support for ir_unop_sign.
2010-07-14 15:50:27 -07:00
Kenneth Graunke
5e840dba44
ir_constant_expression: Remove bogus assert in ir_unop_abs case.
...
abs is defined for integral types; it's even implemented.
2010-07-14 15:50:27 -07:00
Kenneth Graunke
acf88f2769
ir_constant_expression: Fix loop increments.
2010-07-07 12:41:26 -07:00
Eric Anholt
570dc0d400
glsl2: Avoid null deref in scalar constant unop expressions.
2010-07-07 09:07:52 -07:00
Ian Romanick
ca088cc277
glsl2: Clone methods return the type of the thing being cloned
...
This is as opposed to returning the type of the base class of the hierarchy.
2010-07-06 17:44:37 -07:00
Kenneth Graunke
f14e596f11
ir_constant_expression: Declare loop counting variables in the loops.
...
Fixes "name lookup of 'c' changed" warning.
2010-07-06 17:43:56 -07:00
Kenneth Graunke
3f4a0b8bb0
ir_constant_expression: Add support for dot products.
2010-07-06 16:03:33 -07:00
Kenneth Graunke
cf80a4d177
ir_constant_expression: Add support for matrix multiplication.
...
Also handles matrix/vector and vector/matrix multiplication.
Fixes piglit tests const-matrix-multiply-01.frag,
const-matrix-multiply-02.frag, and const-vec-mat.frag.
2010-07-06 16:03:33 -07:00
Kenneth Graunke
37b3f9d0ed
ir_constant_expression: Support scalar * vector and scalar * matrix.
...
The test here is slightly different since we need to keep matrix
multiplication separate.
Fixes piglit tests const-vec-scalar-03.frag and const-mat-scalar-03.frag.
2010-07-06 16:03:33 -07:00
Kenneth Graunke
dad35eb8b0
ir_constant_expression: Support scalar / vector and scalar / matrix.
...
Fixes piglit tests const-vec-scalar-04.frag and const-mat-scalar-04.frag.
2010-07-06 16:03:33 -07:00
Kenneth Graunke
97b44f040a
ir_constant_expression: Support scalar - vector and scalar - matrix.
...
Fixes piglit tests const-vec-scalar-02.frag and const-mat-scalar-02.frag.
2010-07-06 16:03:33 -07:00
Kenneth Graunke
e74dcd7924
ir_constant_expression: Support scalar + vector and scalar + matrix.
...
Fixes piglit tests const-vec-scalar-01.frag, const-vec-scalar-05.frag,
and const-mat-scalar-01.frag.
2010-07-06 16:03:33 -07:00
Kenneth Graunke
6fc983b9bb
ir_constant_expression: Assert that both operands share a base type.
2010-07-06 16:03:33 -07:00
Kenneth Graunke
6bc432e14e
ir_constant_expression: Initialize op[0] and op[1] to NULL.
...
This makes it easy to check if there is a second argument.
2010-07-06 16:03:33 -07:00
Kenneth Graunke
c63a1db81f
ir_constant_expression: Initialize all components of constant data to 0.
...
This is probably just a good idea, and will come in useful when
implementing things like matrix multiplication.
2010-07-06 16:03:32 -07:00