Commit graph

21 commits

Author SHA1 Message Date
Ian Romanick
261bbc011d glsl2: Use Elements from main/compiler.h instead of open-coding 2010-08-12 15:05:39 -07:00
Kenneth Graunke
8aa7dbacaf glsl2: Refresh autogenerated file builtin_function.cpp. 2010-08-09 12:45:25 -07:00
Eric Anholt
eb7e120f0f glsl2: Fix expression type in builtin tan().
Fixes glsl-fs-tan-1.
2010-08-02 12:33:18 -07:00
Eric Anholt
3fa1b85196 glsl2: Fix the implementation of atan(y, x).
So many problems here.  One is that we can't do the quadrant handling
for all the channels at the same time, so we call the float(y, x)
version multiple times.  I'd also left out the x == 0 handling.  Also,
the quadrant handling was broken for y == 0, so there was a funny
discontinuity on the +x side if you plugged in obvious values to test.

I generated the atan(float y, float x) code from a short segment of
GLSL and pasted it in by hand.  It would be nice to automate that
somehow.

Fixes:
glsl-fs-atan-1
glsl-fs-atan-2
2010-07-30 15:19:00 -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
0a71527dab glsl2: Refresh autogenerated file builtin_function.cpp. 2010-07-22 16:54:20 -07:00
Eric Anholt
e65dfa89ee glsl2: Fix the type of (1.0 - arg2) for mix(gen, gen, float).
Previously, we'd constant-fold up a value of vec4(1.0 - arg2, 0, 0, 0).

Fixes:
glsl1-mix(vec4) function
2010-07-22 14:25:26 -07:00
Ian Romanick
d5be2acae3 linker: Link built-in functions instead of including them in every shader
This is an invasive set of changes.  Each user shader tracks a set of other
shaders that contain built-in functions.  During compilation, function
prototypes are imported from these shaders.  During linking, the
shaders are linked with these built-in-function shaders just like with
any other shader.
2010-07-21 15:52:58 -07:00
Eric Anholt
1245babe0c glsl2: Fix asin() implementation.
I'd flipped around the order of two operations in paren-balancing
adventures, and left out the multiply by sign(x) required for negative x.

Fixes:
glsl1-acos(vec4) function
glsl1-asin(vec4) function
glsl1-atan(vec4) function
2010-07-20 12:24:01 -07:00
Eric Anholt
117d154b4d glsl2: notEqual() produces a boolean value, not the base type of the args.
Fixes:
glsl1-vector relational (bvec2 ==,!=)
glsl1-vector relational (vec4 !=)
2010-07-20 12:01:40 -07:00
Ian Romanick
b64e979971 glsl2: Use Elements macro 2010-07-19 14:50:43 -07:00
Eric Anholt
82d4b9593b glsl2: Fix the expression type for atan's pi * sign(y).
Fixes CorrectFunction.vert.
2010-07-19 10:47:12 -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
53120805a8 Refresh autogenerated file builtin_function.cpp. 2010-07-14 16:49:24 -07:00
Eric Anholt
0b74bbb3dc glsl: Fix the setup of refract()'s output for vec3/vec4 and k < 0.0.
caught by valgrind.
2010-07-07 14:55:33 -07:00
Kenneth Graunke
83035574db Refresh autogenerated file builtin_function.cpp. 2010-07-02 18:20:19 -07:00
Eric Anholt
d925c91730 glsl2: Add ir_unop_fract as an expression type.
Most backends will prefer seeing this to seeing (a - floor(a)), so
represent it explicitly.
2010-07-01 11:07:22 -07:00
Eric Anholt
f5b3b2a01a glsl2: Don't break sign() down by vector components. 2010-06-30 17:29:12 -07:00
Eric Anholt
02d615306e glsl2: Fix reversed value of step().
It's 0.0 if x < edge, not 1.0.  Partial fix for glsl-fs-step.
2010-06-30 16:23:15 -07:00
Eric Anholt
4e16a7b526 glsl2: Fix up the implementation of fract() for vector types.
There's no need to split each vector component out, just do vector ops.
2010-06-30 15:59:07 -07:00
Eric Anholt
2928588267 glsl2: Move the compiler to the subdirectory it will live in in Mesa. 2010-06-24 15:36:00 -07:00
Renamed from builtin_function.cpp (Browse further)