Commit Graph

29 Commits

Author SHA1 Message Date
Eric Anholt 894ea972a4 Put function bodies under function signatures, instead of flat in the parent.
This will let us know the length of function bodies for the purpose of
inlining (among other uses).
2010-04-07 17:23:23 -07:00
Eric Anholt 70b74928a2 Make constant folding descend into if statements. 2010-04-06 11:52:09 -07:00
Eric Anholt 326c676236 Handle constant expressions using derefs of const values.
Fixes CorrectParse1.frag and makes for a ton of folding in
CorrectParse2.frag.
2010-04-06 11:42:34 -07:00
Ian Romanick b2deb19dc3 Set correct type for ir_dereference of a matrix or a vector 2010-04-05 10:30:15 -07:00
Ian Romanick 9d975377ca Track whether whole-arrays are assignable
In GLSL 1.10 this was not allowed, but in GLSL 1.20 and later it is.

This causes the following tests to pass:

    glslparsertest/glsl2/array-09.vert
    glslparsertest/glsl2/array-13.vert
2010-04-02 17:17:47 -07:00
Ian Romanick 2d946634eb Whole structures are assignable
Whole arrays are assignable in GLSL 1.20 and later, but it's not clear
how to handle that within the IR because the IR is supposed to be
shading language version agnostic.
2010-04-02 17:06:57 -07:00
Eric Anholt c2cb84e17b Add bool/int conversion as IR operations.
Fixes constructor-09.glsl and CorrectParse2.frag.
2010-04-02 11:22:41 -07:00
Eric Anholt dc58b3f8cc Add conversion of bool to float as an IR operation to match int to float. 2010-04-02 11:22:41 -07:00
Eric Anholt c7da28b4be Allow array dereferences to be considered as lvalues.
Fixes glsl-vs-arrays.vert and glsl-vs-mov-after-deref.vert.
Regresses parser3.frag which was failing for the wrong reason.
2010-04-02 11:22:41 -07:00
Eric Anholt 160d092507 Simplify ir_constant_expression.cpp by factoring operand computation out. 2010-04-02 11:22:41 -07:00
Ian Romanick b8a21cc6df Track max accessed array element, reject additional out-of-bounds accesses
For unsized arrays, we can't flag out-of-bounds accesses until the
array is redeclared with a size.  Track the maximum accessed element
and generate an error if the declaration specifies a size that would
cause that access to be out-of-bounds.

This causes the following tests to pass:

    glslparsertest/shaders/array10.frag
2010-04-01 18:35:08 -07:00
Ian Romanick 63af4b0e99 Fix type handling in ir_dereference array dereference constructor 2010-04-01 18:02:48 -07:00
Eric Anholt 72fc47f0b0 Set variables with the sampler base type to read only.
Fixes increment3.frag.
2010-03-26 17:51:41 -07:00
Eric Anholt 3c36b2df7c Add constructors for immediate hir constants.
This will make ast_to_hir for inc/dec easier.
2010-03-26 17:51:41 -07:00
Ian Romanick d811d47609 Add glsl_type::components to query total number of components in a type 2010-03-26 14:43:11 -07:00
Ian Romanick 0471e8b089 Make glsl_*_type glsl_type class static data 2010-03-26 14:33:41 -07:00
Kenneth Graunke affc1413ac Move swizzles out of ir_dereference and into their own class.
Also turn generate_swizzle into a static "create" method of the new
class; we'll want to use it for the IR reader as well.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2010-03-26 14:00:59 -07:00
Kenneth Graunke fb9fb5f51d Add new abstract ir_rvalue class; rework accordingly.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2010-03-26 13:58:48 -07:00
Kenneth Graunke 44e1dfa2df Replace "mode" type tag with virtual as_foo() downcasting functions.
These should work well even in a non-flat IR hierarchy.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2010-03-26 12:50:40 -07:00
Ian Romanick 9546997736 Add dereference constructor for array element dereferences
This should have gone in before the previous commit.
2010-03-25 17:01:15 -07:00
Ian Romanick 1b4f04124a Fix matrix dimensioning
Newb GL mistake: matrices in GL are column-major.  This means that
vector_elements is the number of rows.  Making these changes causes
matrix-08.glsl to pass.
2010-03-25 13:19:13 -07:00
Ian Romanick 2f4240fb02 Add method to set the swizzle of an ir_dereference 2010-03-24 15:12:21 -07:00
Ian Romanick 882dad7540 ir_function constructor now takes the function name as a parameter 2010-03-23 17:42:04 -07:00
Ian Romanick e39cc69fa3 Set, and require, a return type for function signatures 2010-03-23 12:19:13 -07:00
Ian Romanick ed45ec6a51 Add ir_call call to represent function calls. 2010-03-11 14:35:37 -08:00
Ian Romanick d27ec2461b Fix broken constructor of ir_instruction base class
Make the constructor inline-able, and don't try to initialize it as a
simple_node.  It hasn't been derived from simple_node in a long time.
2010-03-11 14:23:41 -08:00
Ian Romanick 654c057257 ir_variable: Initialize all attribute bits to reasonable defaults
This prevents variables from randomly having their 'invariant' or
'read_only' bits set, for example.
2010-03-10 00:21:27 -08:00
Ian Romanick 0044e7edce Conver IR structures to use exec_list instead of simple_node 2010-03-08 23:44:54 -08:00
Ian Romanick d5f4f09e76 Rename .cc files to .cpp 2010-02-22 18:43:08 -08:00