Commit graph

37181 commits

Author SHA1 Message Date
Carl Worth
19e3771cff Add missing initialization of inOutFlags pointer.
This quiets a compiler warning, (and ensures a segmentation fault rather
than memory corruption if this variable is written through before being
initialized elsewhere).
2010-07-21 13:26:26 -07:00
Carl Worth
9d1a61efbe Makefiles: Don't complain if depend file to be included doesn't exist.
While bootstrapping the dependencies, make will see the "include depend"
directive before the depend file has been created. To avoid a spurious
warning in this case we use "-include" instead, (which differs precisely
in the fact that it will not emit a diagnostic if the named file does
not exist).
2010-07-21 13:19:33 -07:00
Carl Worth
171a25eaba i965: Remove an unused variable.
To quiet a compiler warning.
2010-07-21 13:17:22 -07:00
Carl Worth
c0ca2bfb2a dri2: Remove an unused variable.
To quiet a compiler warning.
2010-07-21 13:17:05 -07:00
Carl Worth
349fa9ced7 Regenerate program/lex.yy.c
Based on the two recent changes to program_lexer.l.
2010-07-21 13:13:46 -07:00
Carl Worth
b4a08a0d87 Avoid more warnings in flex-generated code.
This avoids two "function defined but not used" warnings. For the yyinput
function we define YY_NO_INPUT which tells flex to simply not generate this
function.

For unput, we add a call to this function, but inside a while(0) so
that it will quiet the warning without actually changing any
functionality.
2010-07-21 13:11:46 -07:00
Carl Worth
3c716a7ec2 Avoid warnings in flex-generated code.
Add declarations for two functions generated in the flex ouput. It
would be nicer if flex simply declared these generated functions as
static, but for now we can at least avoid the warning this way.
2010-07-21 12:49:01 -07:00
Carl Worth
c24bcad9f8 glsl: Correctly handle unary plus operator.
Previously, any occurence of the unary plus operator would trigger a
bogus type mismatch error. Fix this by making the ast_plus case look
more like the ast_neg case as far as type-checking is concerned.

With this change the shaders/CorrectPreprocess8.frag test in piglit
now passes.
2010-07-21 11:42:27 -07:00
Brian Paul
aa9003e20e draw: tweak aa line width threshold and sampling
Set sampler max_lod to avoid sampling the 1x1 and 2x2 mipmap levels.

Fixes piglit line-aa-width test, fd.o bug 29160.
2010-07-21 11:38:43 -06:00
Patrice Mandin
c052213fb3 nouveau/nvfx: Add new PIPE_CAP values
Signed-off-by: Patrice Mandin <patmandin@gmail.com>
2010-07-21 19:28:45 +02:00
Brian Paul
3662afd87d gallivm: replace has_indirect_addressing field with indirect_files field
Instead of one big boolean indicating indirect addressing, use a
bitfield indicating which register files are accessed with indirect
addressing.

Most shaders that use indirect addressing only use it to access the
constant buffer.  So no need to use an array for temporary registers
in this case.
2010-07-21 10:16:32 -06:00
Brian Paul
85206e56a1 tgsi: added tgsi_shader_info::indirect_files field
Indicates which register files are accessed with indirect addressing.
2010-07-21 10:16:32 -06:00
Brian Paul
0115f07507 gallivm: refactor code into get_indirect_offsets() function 2010-07-21 10:16:32 -06:00
Brian Paul
890976e02d gallivm: added comment 2010-07-21 10:16:32 -06:00
Brian Paul
be22e1e781 gallivm: remove extraneous braces 2010-07-21 10:16:32 -06:00
Brian Paul
f674ed6b06 gallivm: no longer do indirect addressing in get_temp_ptr() 2010-07-21 10:16:32 -06:00
Brian Paul
105ed7dfd4 gallivm: implement correct indirect addressing of temp registers
As with indexing the const buffer, the ADDR reg may have totally
different values for each element.  Need to use a gather operation.
2010-07-21 10:16:32 -06:00
Brian Paul
695814a15b gallivm: re-org, comments for get_temp_ptr() 2010-07-21 10:16:31 -06:00
Brian Paul
6921a6dd4e draw: whitespace clean-up 2010-07-21 10:16:31 -06:00
Keith Whitwell
d350695a6b gallium: remove pointless bitfield restrction in pipe_vertex_element
This used to be a somewhat packed struct, but no longer.  Remove the
last remaining bitfield tag.
2010-07-21 16:30:38 +01:00
Brian Paul
ec0e7b16bb gallivm: rename a var to avoid compiler warnings 2010-07-21 08:08:12 -06:00
Brian Paul
4363d4d0b9 gallivm: fix indirect addressing of constant buffer
The previous code assumed that all elements of the address register
were the same.  But it can vary from pixel to pixel or vertex to
vertex so we must use a gather operation when dynamically indexing
the constant buffer.

Still need to fix this for the temporary register file...
2010-07-20 18:50:35 -06:00
Brian Paul
b0636f78aa gallivm: added lp_build_const_int32() helper 2010-07-20 18:50:35 -06:00
Ian Romanick
f38d15b80d glsl2: glsl_type has its own talloc context, don't pass one in 2010-07-20 17:48:25 -07:00
Ian Romanick
a7ba9a7919 linker: Do post-link lowering and optimization
The lowering code should probably be moved elsewhere.
2010-07-20 17:48:24 -07:00
Ian Romanick
60e2d06d1c glsl2: Implement utility routine to talloc reparent an IR tree 2010-07-20 17:48:24 -07:00
Ian Romanick
2462a536ea glsl2: Add a constructor for _mesa_glsl_parse_state
Coming changes to the handling of built-in functions necessitate this.
2010-07-20 17:48:24 -07:00
Ian Romanick
7e2aa91507 glsl2: Add and use new variable mode ir_var_temporary
This is quite a large patch because breaking it into smaller pieces
would result in the tree being intermitently broken.  The big changes
are:

    * Add the ir_var_temporary variable mode

    * Change the ir_variable constructor to take the mode as a
      parameter and correctly specify the mode for all ir_varables.

    * Change the linker to not cross validate ir_var_temporary
      variables.

    * Change the linker to pull all ir_var_temporary variables from
      global scope into 'main'.
2010-07-20 17:48:24 -07:00
Eric Anholt
1124e5a3cb ir_to_mesa: Validate the linked shaders as well.
This caught the failure in cloning of ir_dereference_record.
2010-07-20 17:30:11 -07:00
Eric Anholt
f141fa63a4 glsl2: Check that nodes in a valid tree aren't error-type.
We're good at propagating error types around, but finding when the
first one was triggered can be painful if we aren't paying attention.
2010-07-20 17:30:10 -07:00
Eric Anholt
fade78edcb glsl2: strdup the field names used in dereference_record.
Otherwise, after linking and freeing the old data, the pointer would
dangle.  Partial fix for glsl1-struct*.
2010-07-20 17:30:10 -07:00
Eric Anholt
21b0dbd799 glsl2: talloc the glsl_struct_field[] we use to look up structure types.
Since the types are singletons across the lifetime of the compiler,
repeatedly compiling a program with the same structure type defined
would drop a copy of the array on the floor per compile.

This is a bit tricky because the static GLSL types are not called with
the talloc-based new, so we have to use the global type context, which
may not be initialized yet.
2010-07-20 17:30:10 -07:00
Eric Anholt
b6e92ad7da glsl2: Don't claim a match on structure types with different field names.
We regularly do lookups on the field names of the structure to find
the types within the struct, so returning a structure type with bad
names will lead to lots of error types being found.
2010-07-20 17:30:10 -07:00
Kenneth Graunke
094cf8c199 glsl2: Add support for the .length() method on arrays.
Fixes piglit test glsl-array-length, and provides proper error messages
for negative piglit tests array-length-110.frag, array-length-unsized.frag,
and array-length-args.frag.
2010-07-20 17:13:17 -07:00
Kenneth Graunke
1036a7ebae glsl2: Remove incorrect assertion in the parser.
This assertion is triggered by method calls (i.e. array.length()), where
subexpressions[1] is an ast_function_call expression.  Since the
assertion itself had a comment saying it could be removed eventually,
simply do so.

Causes negative glslparser tests array-length-110.frag,
array-length-args.frag, and array-length-unsized.frag to pass, but only
because the length() method is not supported yet.
2010-07-20 17:13:17 -07:00
Kenneth Graunke
2b7c42b40a glsl2: Disallow non-constant array indexing for unsized arrays.
Fixes piglit test unsized-array-non-const-index.vert.
2010-07-20 17:13:17 -07:00
Kenneth Graunke
e4768eecd5 ir_constant_expression: Remove pointless use of variable_referenced.
ir_dereference_variable always references an ir_variable, so there's no
point in calling a function and NULL-checking the result.
2010-07-20 17:10:05 -07:00
Kenneth Graunke
98f32a13be ir_constant_expression: Use "this" pointer directly.
In ir_expression's signature, I replaced ir->operands[i] with op[i] as
it is more concise; an assertion already ensures these are equal.
2010-07-20 17:10:05 -07:00
Kenneth Graunke
fb2ffd2846 ir_constant_expression: Convert from a visitor to a virtual function.
The constant_expression_wrapper was already the only external API, and
much of the internal code used it anyway.  Also, it wouldn't ever visit
non-rvalue ir_instructions, so using a visitor seemed a bit unnecessary.

This uses "ir_foo *ir = this;" lines to avoid code churn.  These should
be removed.
2010-07-20 17:10:05 -07:00
Kenneth Graunke
e340854115 glsl2: Move constant_expression_value method to ir_rvalue.
This prevents top-level callers from asking for the value of something
that is guaranteed not to have one.
2010-07-20 17:10:05 -07:00
Carl Worth
e1acbfca32 glcpp: Avoid accidental token pasting in preprocessed result.
Consider this test case:

	#define EMPTY
	int foo = 1+EMPTY+4;

The expression should compile as the sequence of tokens 1, PLUS,
UNARY_POSITIVE, 4. But glcpp has been failing for this case since it
results in the string "1++4" which a compiler correctly sees as a
syntax error, (1, POST_INCREMENT, 4).

We fix this by changing any macro with an empty definition to result
in a single SPACE token rather than nothing. This then gives "1+ +4"
which compiles correctly.

This commit does touch up the two existing test cases which already
have empty macros, (to add the space to the expected result).

It also adds a new test case to exercise the above scenario.
2010-07-20 17:01:12 -07:00
Carl Worth
942ccc5170 glcpp: Add missing include in xtalloc.c
Without this, the compiler was legitimately complaining about missing
declarations for all of the functions being defined here.
2010-07-20 17:01:12 -07:00
Carl Worth
d80dcaf427 glcpp: Add static keyword to several functions in the parser.
This quiets warnings about missing declarations otherwise.
2010-07-20 17:01:11 -07:00
Carl Worth
fb90560744 glcpp: Avoid warnings in generated flex code.
We define the YY_NO_INPUT macro to avoid one needless function being
generated.

for the other needless functions, (yyunput and yy_top_state), we add a
new UNREACHABLE start condition and call these functions from an
action there. This doesn't change functionality at all, (since we
never enter the UNREACHABLE start condition), but makes the compiler
stop complaining about these two functions being defined but not used.
2010-07-20 17:01:11 -07:00
Carl Worth
a9bb4bcde3 glcpp-lex: Declare some generated functions to eliminate compiler warnings.
It's really a bug in flex that these functions are generated with neither
a declaration nor the 'static' keyword, but we can at least avoid the
warnings this way.
2010-07-20 17:01:11 -07:00
Carl Worth
1d7e03e48e glcpp: Fix support for nested #ifdef and nested #ifndef
Previously, if the outer #ifdef/#ifndef evaluated to false, the inner
directive would not be parsed correctly, (the identifier as the subject
of the #ifdef/#ifndef would inadvertently be skipped along with the other
content correctly being skipped).

We fix this by setting the lexing_if state in each case here.

We also add a new test to the test suite to ensure that this case is tested.
2010-07-20 17:01:11 -07:00
Carl Worth
17f9beb6c3 glcpp: Support #if(expression) with no intervening space.
And add a test case to ensure that this works.
2010-07-20 17:01:11 -07:00
Carl Worth
61ebc01dfe glcpp: Fix use-after-free error from #undef directive.
By taking advantage of the recently-added hash_table_remove function.

With this change, all existing tests are now valgrind-clean.
2010-07-20 17:01:11 -07:00
Carl Worth
d4f239de6e hash_table: Add new hash_table_remove function.
To allow for the removal of a single element from a hash table.
2010-07-20 17:01:11 -07:00
Carl Worth
d1500f8a19 glcpp: Make test suite test for valgrind cleanliness.
As it turns out, 4 of our current tests are not valgrind clean,
(use after free errors or so), so this will be helpful for
investigating and fixing those.
2010-07-20 17:01:11 -07:00