Commit Graph

37100 Commits

Author SHA1 Message Date
Kenneth Graunke
3c033637de glsl2: Make ir_assignment derive from ir_instruction, not ir_rvalue.
Assignments can only exist at the top level instruction stream; the
residual value is handled by assigning the value to a temporary and
returning an ir_dereference_variable of that temporary.
2010-07-22 16:50:37 -07:00
Kenneth Graunke
aa9f86ae8b glsl2: Fix standalone compiler to not crash horribly.
ir_to_mesa was updated for the _mesa_glsl_parse_state constructor
changes, but main.cpp was not.
2010-07-22 16:50:36 -07:00
Kenneth Graunke
40c4298a6e ir_print_visitor: Add "temporary" to mode string printing.
Variables with mode ir_var_temporary were causing an out of bounds array
access and filling my screen with rubbish.  I'm not sure if "temporary"
is the right thing to print.
2010-07-22 16:50:36 -07:00
Carl Worth
fbe4240626 glcpp: Fix function-like macros with an argument used multiple times.
It's really hard to believe that this case has been broken, but apparently
no test previously exercised it. So this commit adds such a test and fixes
it by making a copy of the argument token-list before expanding it.

This fix causes the following glean tests to now pass:

	glsl1-Preprocessor test 6 (#if 0, #define macro)
	glsl1-Preprocessor test 7 (multi-line #define)
2010-07-22 16:38:12 -07:00
Eric Anholt
a0879b9dd4 glsl2: Put side effects of the RHS of logic_or in the right branch.
Kind of missing the point to only do the side effects if the LHS
evaluates as true.

Fixes:
glsl1-|| operator, short-circuit
2010-07-22 16:34:36 -07:00
Eric Anholt
432b787b29 glsl2: Validate that ir_if conditions are actually bool. 2010-07-22 16:24:49 -07:00
Eric Anholt
85e93da18c ir_to_mesa: Fix the swizzles on record and array dereferences.
Fixes:
glsl1-struct (1)
glsl1-struct (2)
glsl1-struct (3)
glsl1-struct (4)
2010-07-22 16:17:57 -07:00
Eric Anholt
9703ed05e6 glsl2: When setting the size of an unsized array, set its deref's size too. 2010-07-22 15:56:07 -07:00
Brian Paul
c20a3628c7 glsl: remove invalid _mesa_problem() call
Fixes fd.o bug 29206.
2010-07-22 16:35:46 -06:00
Eric Anholt
c3081e6273 glsl2: Set the type on cloned tex instructions. 2010-07-22 15:34:01 -07:00
Eric Anholt
a711ad6bf2 glsl2: Add the API defines to the glsl2 build so we get the right GLcontext
Fixes:
draw_buffers-08.frag
draw_buffers-09.frag
glsl-vs-texturematrix-2
2010-07-22 15:22:57 -07:00
Brian Paul
815e79e72c draw: re-order optimization passes depending on LLVM version, 32/64-bit
This is a work-around for an apparent bug in LLVM seen with piglit's
glsl-vs-sqrt-zero test.
2010-07-22 16:09:03 -06:00
Eric Anholt
1bef4c8c4b glsl2: Fix builtin prototypes defined in multiple glsl/builtins/* files
If we put the protos in separate ir_functions, they wouldn't be found
at lookup time for linking.

Fixes:
glsl-fs-texture2d-bias
glsl-fs-texture2dproj-bias
glsl-fs-texture2dproj-bias-2
glsl-lod-bias
glsl1-texture2D(), computed coordinate
2010-07-22 15:03:40 -07:00
Carl Worth
47c90b1447 glsl2: Fix expected type for multiplying vector with non-square matrix.
Previously, the compiler expected the result of the multiplication to
be of the same type as the vector. This is correct for square
matrices, but wrong for all others.

We fix this by instead expecting a vector with the same number of rows
as the matrix (for the case of M*v with a column vector) or the same
number of columns as the matrix (for v*M with a row vector).

This fix causes the following four glean tests to now pass:

	glsl1-mat4x2 * vec4
  	glsl1-vec2 * mat4x2 multiply
  	glsl1-vec3 * mat4x3 multiply
  	glsl1-vec4 * mat3x4 multiply
2010-07-22 14:59:06 -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
Eric Anholt
8ec0b8187e glsl2: When inlining, don't clone and assign sampler arguments.
Instead, just use the incoming sampler param.  Fixes many texture-using
piglit tests since the linker rework.
2010-07-22 13:58:32 -07:00
Eric Anholt
2d1ed7b1b1 glsl2: When a "continue" happens in a "for" loop, run the loop expression.
Fixes:
glsl1-for-loop with continue

Bug #29097
2010-07-22 13:02:40 -07:00
Eric Anholt
748c343f8b ir_to_mesa: Pretty up the printing of MESA_GLSL=dump 2010-07-22 12:37:43 -07:00
Eric Anholt
cc15ef07e0 mesa: Only complain about an infinite loop in a swrast program once.
Chances are, if one fragment looped badly, others will too, and
debugging output gets overwhelmed by the looping complaints.
2010-07-22 12:16:11 -07:00
Eric Anholt
c8d0a9f006 ir_to_mesa: Add support for MESA_GLSL=dump environment var. 2010-07-22 12:11:36 -07:00
Brian Paul
ca3238f3fc draw: added new assertions to clipping code 2010-07-22 11:18:54 -06:00
Eric Anholt
63ba1ec3c1 i965: Respect VS/VP point size result when enabled.
Fixes glsl-vs-point-size.
2010-07-22 10:06:55 -07:00
Eric Anholt
4ea71cbd0e i965: Fix the disasm output for da16 src widths.
This has confused me twice now.  It's a fixed width of 4 (usually a
region description of <4,4,1>), not 1.  If it was 1, we'd have been
skipping all over register space.
2010-07-22 10:06:55 -07:00
Eric Anholt
86fb92f59c i965: Avoid extra MOV in VS indirect register reads. 2010-07-22 10:06:55 -07:00
Eric Anholt
b69ef5744a i965: Fix up VS temporary array access for fixed index offset != 0. 2010-07-22 10:06:55 -07:00
Henri Verbeet
2fdff50999 r600: Flip point sprite coordinates when rendering to an FBO.
This supersedes http://lists.freedesktop.org/archives/mesa-dev/2010-July/001442.html.
2010-07-22 11:10:11 -04:00
Eric Anholt
7095e2f860 glsl2: Use talloc on InfoLog handling in ValidateProgram
Fixes a segfault in Regnum Online.
2010-07-21 23:21:23 -07:00
Eric Anholt
c686ee0fa7 i965: In the VS, multiply the address reg by the appropriate register size.
The ARL value is increments of vec4 in the register file.  But
PROGRAM_TEMPORARY or PROGRAM_INPUT are stored as vec4s interleaved
between the two verts being executed (thus a vec8 each), compared to
PROGRAM_STATE_VAR being packed vec4s.

Fixes:
glsl-vs-arrays-2
glsl-vs-mov-after-deref
(without regressing glsl-vs-arrays-3)
2010-07-21 22:05:30 -07:00
Eric Anholt
21eaa62ba4 i965: Clean up brw_dp_READ_4_vs() now that it has fewer options to support. 2010-07-21 20:17:24 -07:00
Eric Anholt
96b11f1e3e i965: Support relative addressed VS constant reads using the appropriate msg.
The previous support was overly complicated by trying to use the same
1-OWORD message for both offsets.
2010-07-21 20:17:24 -07:00
Eric Anholt
9e9e87a9b2 i965: Fix the DP read msg_control definitions other than plain OWORD. 2010-07-21 20:17:24 -07:00
Eric Anholt
d0326e0e4e i965: Clean up dead code from the VS get_constant/get_reladdr_constant split. 2010-07-21 20:17:24 -07:00
Eric Anholt
04de6861c1 i956: Set the execution size correctly for scratch space writes.
Otherwise, the second half isn't written, and we end up reading back
black.

Fixes the remaining junk drawn in glsl-max-varyings, and will likely
help with a number of large real-world shaders.
2010-07-21 20:17:24 -07:00
Eric Anholt
ff81a1dd92 i965: Set the GEM domain flags for the scratch space.
They go into the render cache, so while we don't care about their
contents after execution, failing to note them could cause the writes
to be flushed over important buffer contents later.
2010-07-21 20:17:24 -07:00
Eric Anholt
a3bfb2f755 i965: Use the pretty define for 4-oword DP reads. 2010-07-21 20:17:24 -07:00
Eric Anholt
d2f3eac8ff i965: Set the send commit bit on register spills as required pre-gen6.
Otherwise, the subsequent read may not get the written value.
2010-07-21 20:17:24 -07:00
Eric Anholt
0ecf5128a4 i965: Add disasm for dataport reads (register unspilling). 2010-07-21 20:17:24 -07:00
Kristian Høgsberg
7a66e54958 glx: Move last few dri_interface.h types out of glxclient.h and drop include 2010-07-21 22:17:24 -04:00
Kristian Høgsberg
f679640868 glx: Move __driContext field out of __GLXcontextRec 2010-07-21 22:17:24 -04:00
Kenneth Graunke
e9384d1d7f glsl2: Update TODO. 2010-07-21 16:38:33 -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
ef2c38b245 ir_reader: Add support for reading constant arrays. 2010-07-21 16:38:33 -07:00
Kenneth Graunke
9930d18c2a ir_print_visitor: Print out constant arrays. 2010-07-21 16:38:33 -07:00
Kenneth Graunke
7ea977a15c ir_print_visitor: Remove commas between ir_constant's components.
The IR reader does not expect commas.
2010-07-21 16:38:33 -07:00
Kenneth Graunke
74e1802f5d glsl2: Extend ir_constant to store constant arrays, and generate them.
Since GLSL permits arrays of structures, we need to store each element
as an ir_constant*, not just ir_constant_data.

Fixes parser tests const-array-01.frag, const-array-03.frag,
const-array-04.frag, const-array-05.frag, though 03 and 04 generate the
wrong code.
2010-07-21 16:38:33 -07:00
Kenneth Graunke
13a19745d4 glsl2: Emit array constructors inline. 2010-07-21 16:38:32 -07:00
Kenneth Graunke
e1d71850fa ast_to_hir: Fix bug in constant initializers.
Implicit conversions were not being performed, nor was there any
type checking - it was possible to have, say, var->type == float
and var->constant_value->type == int.  Later use of the constant
expression would trigger an assertion.

Fixes piglit test const-implicit-conversion.frag.
2010-07-21 16:38:32 -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