Commit Graph

36190 Commits

Author SHA1 Message Date
Ian Romanick
e45a982313 Make hashtable.h be C++ friendly 2010-07-06 15:00:46 -07:00
Eric Anholt
a0b3b93029 ir_to_mesa: Use the compiler-assigned locations for builtin attrs/varyings.
The previous table didn't distinguish gl_Color for the VS and FS, so
we would use the FS's attribute index for the VS and read undefined.
This partially fixes glsl-routing to match its behavior on master.
2010-07-06 14:05:51 -07:00
Kenneth Graunke
83035574db Refresh autogenerated file builtin_function.cpp. 2010-07-02 18:20:19 -07:00
Kenneth Graunke
7e908a6a27 glcpp: Add #error support. 2010-07-02 18:03:58 -07:00
Kenneth Graunke
2070f9f5be glsl2: Fix for dead strings being stored in the symbol table. 2010-07-02 18:03:58 -07:00
Kenneth Graunke
e2a358348b ir_to_mesa: Fix uninitalized value. 2010-07-02 18:03:58 -07:00
Kenneth Graunke
ddc3aa0783 glsl2/builtins: Use vector ops in the 130 version of "sign." 2010-07-02 18:03:58 -07:00
Kenneth Graunke
9a7ac272fb glsl2/builtins: Use vector ops in "smoothstep." 2010-07-02 18:03:58 -07:00
Eric Anholt
b0ac07e3de ir_to_mesa: Fix up implementation of ir_unop_exp.
OPCODE_EXP is not to ir_unop_exp what OPCODE_EX2 is to ir_unop_exp2.
It's the weird VP approximation helper opcode.  Just implement it with
OPCODE_POW instead.

Fixes glsl-fs-exp.
2010-07-02 17:06:32 -07:00
Eric Anholt
4e7d5d0e74 i965: Add support for the DP2 opcode, which we use for dot(vec2, vec2).
The original glsl compiler would generate a.x * b.x + a.y * b.y, which
we would do mul+mul+add for instead of this mul+mac.

Fixes glsl-fs-dot-vec2.
2010-07-02 17:06:23 -07:00
Eric Anholt
8f25d198e5 ir_to_mesa: Add support for scalar * mat, vec * mat.
This is not tested by piglit currently.
2010-07-02 17:06:08 -07:00
Eric Anholt
b61f4241f3 ir_to_mesa: Add support for shadow comparison to texture instructions.
piglit lacks tests for this currently.
2010-07-02 17:06:06 -07:00
Eric Anholt
d3983ca032 ir_to_mesa: Move projection handling out of ir_tex so txb and txl get it.
Fixes:
glsl-fs-texture2dproj-bias
glsl-fs-texture2dproj-bias-2
2010-07-02 17:06:05 -07:00
Ian Romanick
4d962e66e3 glsl2: Print the linking info log in the stand-alone compiler 2010-07-02 14:57:07 -07:00
Eric Anholt
de75dfac4e ir_to_mesa: Add support for projected non-shadow/bias/lod texturing.
Fixes:
glsl-fs-texture2dproj
glsl-fs-texture2dproj-2
2010-07-02 14:50:02 -07:00
Eric Anholt
cab95c228b ir_to_mesa: Fix sparse swizzling of src regs when a writemask is present.
Fixes glsl-fs-texture2d-masked.
2010-07-02 14:08:20 -07:00
Eric Anholt
28faa12dc2 ir_to_mesa: Don't forget to run the Mesa IR optimization passes.
With how we generate assignments, the trivial copy propagation in it
is really important, and some drivers will really want the register
allocation, too.
2010-07-02 11:38:02 -07:00
Eric Anholt
9a0e421983 glsl2: Add a pass to break ir_binop_div to _mul and _rcp.
This results in constant folding of a constant divisor.
2010-07-02 11:27:06 -07:00
Ian Romanick
667f4e1940 glsl2: Conditionally allow optional extensions to be enabled
The only optional extension currently supported by the compiler is
GL_EXT_texture_array.
2010-07-01 20:40:08 -07:00
Ian Romanick
efb6b24223 glsl2: Append _TOK to some parser tokens
This prevents conflicts with defines elsewhere in Mesa and allows
including mtypes.h in the compiler.
2010-07-01 20:40:08 -07:00
Ian Romanick
06143ea094 glsl2: Conditionally define preprocessor tokens for optional extensions
The only optional extension currently supported by the compiler is
GL_EXT_texture_array.
2010-07-01 20:40:08 -07:00
Ian Romanick
2d12236117 glsl2: Define preprocessor tokens for extensions
Currently only GL_ARB_draw_buffers and GL_ARB_texture_rectangle are
defined because those extensions are always enabled.  This make
tex_rect-03.frag pass.
2010-07-01 20:40:08 -07:00
Ian Romanick
6f0823da09 glsl2: Support AST-to-IR translation of invariant keyword 2010-07-01 20:39:08 -07:00
Ian Romanick
3832706f81 glsl2: Initialize ast_declarator_list::invariant in constructor 2010-07-01 17:10:11 -07:00
Ian Romanick
12873fa4e3 glsl2: Don't bounds check unsize array redeclarations
This along with several previous commits fix test CorrectUnsizedArray.frag.
2010-07-01 14:10:19 -07:00
Ian Romanick
127308b4be glsl2: Add gl_MaxTextureCoords 2010-07-01 13:30:50 -07:00
Ian Romanick
cd00d5b88c glsl2: Default delcaration of gl_TexCoord is unsized 2010-07-01 13:17:54 -07:00
Ian Romanick
5466b63968 glsl2: Change order of semaintic checks on variable declarations
This will make it easier to support more (valid) kinds of redeclarations.
2010-07-01 12:56:49 -07:00
Eric Anholt
411fb36b7c ir_to_mesa: Fill in remaining ops, remove default case for expression types.
We should now have support for all the expression types we need for
GLSL 1.20.
2010-07-01 11:24:38 -07:00
Eric Anholt
8761fcc2bf ir_to_mesa: Add support for ir_unop_rcp.
This isn't used at the moment, but will be soon.
2010-07-01 11:23:02 -07:00
Eric Anholt
d1b07167b9 glsl2: Update README for what I've been thinking about with expr types work. 2010-07-01 11:07:58 -07:00
Eric Anholt
8a1f186cc5 glsl2: Add a pass to convert mod(a, b) to b * fract(a/b).
This is used by the Mesa IR backend to implement mod, fixing glsl-fs-mod.
2010-07-01 11:07:23 -07:00
Eric Anholt
9acf618f24 glsl2: Remove dead member from dead code visitor. 2010-07-01 11:07:22 -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
5e4dd061d1 ir_to_mesa: Add support for discard instructions.
Fixes glsl-fs-discard-01.
2010-06-30 17:31:06 -07:00
Eric Anholt
f5b3b2a01a glsl2: Don't break sign() down by vector components. 2010-06-30 17:29:12 -07:00
Eric Anholt
3acd92a91f ir_to_mesa: Add support for ir_unop_sign.
Fixes glsl-fs-sign, glsl-vs-sign.
2010-06-30 17:29:12 -07:00
Eric Anholt
e558786a3e i965: Add support for OPCODE_SSG.
The old compiler didn't use SSG, and instead emitted SGT/SGT/SUB.  We
can do a little better for SSG than we do for the SGT series.
2010-06-30 17:29:09 -07:00
Eric Anholt
d6ebe9b16b ir_to_mesa: Add missing no-op type conversions.
Fixes glsl-fs-step.
2010-06-30 16:23:32 -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
e64a4aaacb ir_to_mesa: Note which of our expr ops are unsupported 1.30 features. 2010-06-30 16:18:06 -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
285ff93819 ir_to_mesa: Initialize the (we never use it) abs field of Mesa src regs. 2010-06-30 15:49:04 -07:00
Eric Anholt
ea6b34cce4 ir_to_mesa: Send the negate field on to Mesa IR.
Fixes glsl-fs-neg.
2010-06-30 15:47:11 -07:00
Eric Anholt
698b844443 ir_to_mesa: When generating a swizzle, respect the reg's current swizzle.
Fixes depth-tex-modes-glsl.
2010-06-30 15:30:00 -07:00
Kenneth Graunke
77049a702a glsl2: Implement AST->HIR support for the "discard" instruction. 2010-06-30 14:54:58 -07:00
Kenneth Graunke
16efab1c4d glsl2: Define new ir_discard instruction. 2010-06-30 14:54:58 -07:00
Eric Anholt
88c20c46b8 ir_to_mesa: Support gl_FragDepth.
Fixes glsl-bug-22603.
2010-06-30 14:55:45 -07:00
Eric Anholt
97eba76b8c glsl2: Allow a fragment shader to not write a color.
I can't find any text justifying this check, and it caused a
reasonable-looking shader in glsl-bug-22603 (which writes only
gl_FragDepth) to fail.
2010-06-30 14:51:50 -07:00
Eric Anholt
3e2127b9de mesa: Don't look in unallocatd param slots for parameter values.
glsl-derivs would add 40.0, 0.0, and 1.0 in order.  When we went
looking for 0.0, we'd find it in the second slot of the param, and use
it, but param->Size would still be 1.  When we went to add 1.0 and
didn't find it, we'd put allocate it to that second slot and the 0.0
would actualy end up being 1.0.

Fixes glsl-derivs, glsl-deriv-varyings.
2010-06-30 14:46:06 -07:00