Commit graph

37078 commits

Author SHA1 Message Date
Eric Anholt
a62ef12ef2 glsl2: Make sure functions end with a return before doing ir_if_return.
This catches a few remaining functions that weren't getting inlined,
generally operating on global or out variables and using an early
return to skip work when possible.

Fixes for i965:
glsl1-function with early return (3)
2010-07-29 15:19:44 -07:00
Eric Anholt
18964618a1 glsl2: Make ir_if_return handle if () { return } else { not return }
This makes many remaining functions inlinable.

Fixes for i965:
glsl1-function with early return (1)
glsl1-function with early return (2)
2010-07-29 15:19:37 -07:00
Eric Anholt
92a3768cef glsl2: Refactor a bit of ir_if_return for the next changes. 2010-07-29 15:19:37 -07:00
Eric Anholt
806cb9f952 ir_to_mesa: Don't emit a duplicate return at the end of a function.
It was harmless, but ugly.
2010-07-29 15:19:37 -07:00
Eric Anholt
0e19922558 glsl2: Allow use of _mesa_print_ir without a parse state on hand. 2010-07-29 15:09:31 -07:00
Eric Anholt
ee4b4bab68 ir_constant_variable: Don't mark variable from outside our scope as constant.
Fixes (with software, except for alpha):
glsl1-function with early return(3)
2010-07-29 15:09:28 -07:00
Eric Anholt
bf496862be glsl2: When dumping IR for debug, indent nested blocks.
No more trying to match parens in my head when looking at the body of
a short function containing an if statement.
2010-07-29 14:38:04 -07:00
Eric Anholt
9a8eb684d4 glsl2: When dumping IR for debug, skip all the empty builtin prototypes. 2010-07-29 14:38:04 -07:00
Eric Anholt
62c4763b70 glsl2: Fix spelling of "sentinel." 2010-07-29 14:02:19 -07:00
Eric Anholt
fa33d0b854 glsl2: Fix spelling of "initializer." 2010-07-29 14:02:19 -07:00
Eric Anholt
4285247f12 glsl2: Remove an inlined unvalued return statement.
We already have asserts that it was the last call in the function, so
it's safe to remove after it got cloned in.

Fixes:
glsl-fs-functions-4.
2010-07-29 14:02:10 -07:00
Eric Anholt
d6942460ce glsl2: Actually fix glsl-version-define. 2010-07-28 17:36:07 -07:00
Eric Anholt
d4a04f3155 glcpp: Add __VERSION__ define to the current language version.
Fixes:
glsl-version-define
glsl-version-define-110
glsl-version-define-120
2010-07-28 17:32:39 -07:00
Eric Anholt
8605c297cf glcpp: Print integer tokens as decimal, not hex. 2010-07-28 17:32:11 -07:00
Eric Anholt
192b57df8c glsl2: Make lowp, mediump, highp, and precision identifiers pre-1.20.
Fixes glsl-precision-110.
2010-07-28 17:32:11 -07:00
Kenneth Graunke
35cc8b98ec glsl2/Makefile: Append to DEFINES rather than replacing them.
Otherwise, we lose DEBUG, which causes mtypes.h to set NDEBUG, which
causes assertions to not happen, which is no fun for anyone.
2010-07-28 16:48:04 -07:00
Eric Anholt
859fd56245 ir_to_mesa: Respect the driver if it rejects a shader. 2010-07-28 15:51:36 -07:00
Kenneth Graunke
56af4e56e3 glsl2: Fix outerProduct builtin.
The type signatures were completely backwards.
2010-07-28 15:46:29 -07:00
Kenneth Graunke
7ddee6a535 ir_constant_expression: Add support for the "outerProduct" builtin. 2010-07-28 15:46:29 -07:00
Kenneth Graunke
5d255e24b2 ir_constant_expression: Add support for the "mix" builtin.
Both 1.10 and 1.30 variants.
2010-07-28 15:46:29 -07:00
Kenneth Graunke
b09ae5dd3f ir_constant_expression: Add support for the "transpose" builtin. 2010-07-28 15:46:29 -07:00
Kenneth Graunke
546f3a2754 ir_constant_expression: Add support for the "smoothstep" builtin. 2010-07-28 15:46:29 -07:00
Kenneth Graunke
a4ca1cfb66 ir_constant_expression: Add support for the "clamp" builtin. 2010-07-28 15:46:29 -07:00
Kenneth Graunke
ff58b7c9b6 ir_constant_expression: Add support for the "step" builtin. 2010-07-28 15:46:29 -07:00
Kenneth Graunke
3d5c2f0adb ir_constant_expression: Add support for the "faceforward" builtin. 2010-07-28 15:46:29 -07:00
Kenneth Graunke
04b3643dbf ir_constant_expression: Add support for the "refract" builtin. 2010-07-28 15:46:28 -07:00
Kenneth Graunke
d60b2b03da ir_constant_expression: Add support for the "reflect" builtin. 2010-07-28 15:46:28 -07:00
Kenneth Graunke
53f306d573 ir_constant_expression: Add support for the "normalize" builtin. 2010-07-28 15:46:28 -07:00
Kenneth Graunke
8fe5f30645 ir_constant_expression: Add support for the "matrixCompMult" builtin. 2010-07-28 15:46:28 -07:00
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