Kenneth Graunke
a7650af706
ir_constant_expression: Simplify code that implements the "dot" builtin.
...
There's no need to use an ir_expression; we have a handy C function.
2010-07-28 15:46:28 -07:00
Kenneth Graunke
5489ad086f
ir_constant_expression: Add support for the "length" builtin.
2010-07-28 15:46:28 -07:00
Kenneth Graunke
ffcec13599
ir_constant_expression: Extract dot product calculation for reuse.
2010-07-28 15:46:28 -07:00
Kenneth Graunke
4b1d77ea96
ir_constant_expression: Remove support for dot products of integers.
...
This shouldn't be required since dot is only defined for floating point
types, even in GLSL 4.0.
2010-07-28 15:46:28 -07:00
Kenneth Graunke
557827340a
ir_constant_expression: Add support for the "greaterThanEqual" builtin.
2010-07-28 15:46:28 -07:00
Kenneth Graunke
7f042b9812
ir_constant_expression: Add support for the "greaterThan" builtin.
2010-07-28 15:46:28 -07:00
Kenneth Graunke
319f4949e0
ir_constant_expression: Add support for the "lessThanEqual" builtin.
2010-07-28 15:46:28 -07:00
Kenneth Graunke
6d897f07cf
ir_constant_expression: Add support for the "lessThan" builtin.
2010-07-28 15:46:27 -07:00
Kenneth Graunke
48a69ba057
ir_constant_expression: Add support for the "notEqual" builtin.
2010-07-28 15:46:27 -07:00
Kenneth Graunke
0b6ef6ef6e
ir_constant_expression: Add support for the "equal" builtin.
2010-07-28 15:46:27 -07:00
Kenneth Graunke
2eaf31642c
ir_constant_expression: Add support for the "distance" builtin.
2010-07-28 15:46:27 -07:00
Kenneth Graunke
7bcaa3828f
ir_constant_expression: Add support for the "degrees" builtin.
2010-07-28 15:46:27 -07:00
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
46d91615a2
ast_function: Set constant_value on return value temporaries in 1.20+.
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
Kenneth Graunke
f7b94f32a2
ir_algebraic: Use ir_constant::zero.
2010-07-28 15:46:26 -07:00
Kenneth Graunke
ee9a3a51b6
glsl2: Add new ir_constant::zero static method.
...
This conveniently creates a zero value of whatever type you want.
2010-07-28 15:46:26 -07:00
Eric Anholt
0c7b37c836
glsl2: Add the define for ARB_fragment_coord_conventions when present.
...
Fixes:
glsl-arb-fragment-coord-conventions-define
2010-07-28 15:00:29 -07:00
Eric Anholt
4a962170d7
glsl2: Add support for redeclaring layout of gl_FragCoord for ARB_fcc.
...
Fixes:
glsl-arb-fragment-coord-conventions
2010-07-28 15:00:09 -07:00
Ian Romanick
8d8469eb2a
glsl2: Perform some semantic checking of ARB_fcc layout qualifiers
...
The rest cannot be handled until built-in variables (i.e.,
gl_FragCoord) can be redeclared to add qualifiers.
2010-07-28 14:16:12 -07:00
Ian Romanick
f50f06552e
glsl2: Parser support for GL_ARB_fragment_coord_conventions
2010-07-28 14:14:38 -07:00
Eric Anholt
b706283c79
glsl2: Fail linking where the FS reads a varying that the VS doesn't write.
...
Fixes:
glsl1-varying read but not written
glsl1-varying var mismatch
2010-07-28 14:04:54 -07:00
Eric Anholt
a6c7606ab6
glsl2: Unmark unwritten varyings as varying.
...
This fixes an assertion failure in ir_to_mesa, and the varying won't
take up varying space.
2010-07-28 14:04:54 -07:00
Carl Worth
667173e362
glcpp: Add generated source files.
...
This is now consistent with other usage of flex/bison througout mesa,
(which is that these generated files are added to source control so
that the build system does not require external tools like flex/bison
for non-developers).
2010-07-28 13:48:32 -07:00
Carl Worth
f8a04b3877
glsl: Ignore glsl_compiler and glsl_parser.output files.
...
These are generated files where we can do the sane thing, and keep
them out of version control.
2010-07-28 13:48:32 -07:00
Carl Worth
e8a8f0f278
glsl: Add generated files from flex/bison.
...
The mesa build environment does not (currently) accept external
dependencies such as flex and bison. The compromise is to commit the
generated output files, (in spite of the pain that comes from having
generated files under version control).
2010-07-28 13:48:32 -07:00
Carl Worth
279cc22dbc
glcpp: Add expected output for a recently-added test.
...
I simply forgot to add this file when adding the test case originally.
2010-07-28 13:48:32 -07:00
Eric Anholt
dc27e73569
ir_to_mesa: Add remaining state variable (builtin uniforms) support.
...
Fixes:
glsl1-GL state variable reference (diffuse product)
glsl1-GL state variable reference (gl_FrontMaterial.ambient)
glsl1-GL state variable reference (gl_LightSource[0].diffuse)
glsl1-GL state variable reference (point attenuation)
glsl1-GL state variable reference (point size)
glsl1-linear fog
2010-07-28 12:34:20 -07:00
Eric Anholt
85b5dba593
glsl2: Add the remaining builtin uniforms.
2010-07-28 12:34:08 -07:00
Eric Anholt
73df636e04
glsl2: Size builtin arrays according to the context constants.
...
Cleans up some of the FINISHMEs in this file.
2010-07-28 11:16:19 -07:00
Carl Worth
efef950f39
glcpp: Explicitly expect 0 shift/reduce conflicts.
...
The "%expect 0" construct will make bison emit an error if any future
changes to the grammar introduce shift/reduce conflicts, (without also
increasing the number after "%expect").
2010-07-28 11:10:52 -07:00
Carl Worth
2233d10442
glcpp: Remove 2 shift/reduce conflicts from the grammar.
...
Since we have productions to turn "defined FOO" and "defined ( FOO )"
into a conditional_token we don't need to list DEFINED as an operator
as well. Doing so just introduces the shift/reduce ambiguity with no
benefit.
2010-07-28 11:07:46 -07:00
Eric Anholt
f9b0e5e322
glsl2: When stealing var->constant_value, steal its children as well.
...
Fixes:
glsl1-GLSL 1.20 uniform array constructor
2010-07-27 15:25:07 -07:00
Eric Anholt
9a670c2e9b
ir_to_mesa: Provide a restricted type size to _mesa_add_uniform.
...
Fixes:
glsl-uniform-out-of-bounds.
2010-07-27 15:10:38 -07:00
Eric Anholt
59c45e9e6c
glsl2: Actually use the linked dead code eliminator.
...
I managed to revert the change from unlinked at some point while
cleaning up the changes. glsl-fs-raytrace-bug27060 drops from 389
instructions to 370.
2010-07-27 14:34:53 -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
Eric Anholt
20c074ae28
ir_to_mesa: Add support for array constants.
...
Fixes:
glsl1-GLSL 1.20 array constructor 1
glsl1-GLSL 1.20 array constructor 2
glsl1-GLSL 1.20 array.length()
glsl1-GLSL 1.20 const array constructor 1
glsl1-GLSL 1.20 const array constructor 2
2010-07-27 12:02:11 -07:00
Eric Anholt
bf6ad0ab3d
glsl2: Use ir_dead_code's linked version after linking.
...
glsl-fs-raytrace-bug27060 goes from 485 Mesa IR instructions to 389
before Mesa IR optimization.
2010-07-27 11:49:27 -07:00