mesa.git
14 years agoTypo fixes: de/re/ference.
Kenneth Graunke [Tue, 23 Mar 2010 22:17:49 +0000 (15:17 -0700)]
Typo fixes: de/re/ference.

14 years agoAdd some matrix math tests
Ian Romanick [Thu, 25 Mar 2010 00:42:59 +0000 (17:42 -0700)]
Add some matrix math tests

14 years agoAdd glsl_type::get_instance method
Ian Romanick [Thu, 25 Mar 2010 00:11:30 +0000 (17:11 -0700)]
Add glsl_type::get_instance method

Gets the singleton corresponding to a particular scalar, vector, or
matrix type.

14 years agoReplace accesses to glsl_type data with query functions
Ian Romanick [Thu, 25 Mar 2010 00:08:13 +0000 (17:08 -0700)]
Replace accesses to glsl_type data with query functions

In these particular cases, using the query functions makes it more obvious
what is happening.

14 years agoAdd class-private handles to matrix types in glsl_type
Ian Romanick [Thu, 25 Mar 2010 00:05:09 +0000 (17:05 -0700)]
Add class-private handles to matrix types in glsl_type

14 years agoFix typo in swizzle processing loop
Ian Romanick [Wed, 24 Mar 2010 22:27:50 +0000 (15:27 -0700)]
Fix typo in swizzle processing loop

One of the accesses to str in the loop used str[0] instead of str[i].

Reported-by: Kenneth Graunke
14 years agoTrivial cleanups in generate_swizzle
Ian Romanick [Wed, 24 Mar 2010 22:27:04 +0000 (15:27 -0700)]
Trivial cleanups in generate_swizzle

Add 'const' and 'static const' in a couple of places.

14 years agoUse ir_dereference::set_swizzle
Ian Romanick [Wed, 24 Mar 2010 22:25:23 +0000 (15:25 -0700)]
Use ir_dereference::set_swizzle

14 years agoAdd method to set the swizzle of an ir_dereference
Ian Romanick [Wed, 24 Mar 2010 22:12:21 +0000 (15:12 -0700)]
Add method to set the swizzle of an ir_dereference

14 years agoAllow duplicate symbols at the same scope that are in different name spaces
Ian Romanick [Wed, 24 Mar 2010 21:56:36 +0000 (14:56 -0700)]
Allow duplicate symbols at the same scope that are in different name spaces

14 years agoMerge branch 'anholt'
Ian Romanick [Wed, 24 Mar 2010 19:10:39 +0000 (12:10 -0700)]
Merge branch 'anholt'

14 years agoAdd (negative) test for constructing samplers
Ian Romanick [Wed, 24 Mar 2010 19:08:46 +0000 (12:08 -0700)]
Add (negative) test for constructing samplers

14 years agoir_function constructor now takes the function name as a parameter
Ian Romanick [Wed, 24 Mar 2010 00:42:04 +0000 (17:42 -0700)]
ir_function constructor now takes the function name as a parameter

14 years agoAdd glsl_type::get_base_type query
Ian Romanick [Wed, 24 Mar 2010 00:31:39 +0000 (17:31 -0700)]
Add glsl_type::get_base_type query

Retreives the glsl_type that corresponds to the base type of a numeric scalar /
vector / matrix type.  So vec4 returns float, etc.

14 years agoAdd glsl_type::is_numeric and glsl_type::is_boolean queries
Ian Romanick [Wed, 24 Mar 2010 00:31:03 +0000 (17:31 -0700)]
Add glsl_type::is_numeric and glsl_type::is_boolean queries

14 years agoBegin processing constructors
Ian Romanick [Tue, 23 Mar 2010 22:08:30 +0000 (15:08 -0700)]
Begin processing constructors

Right now, reject constructors for samplers because the are illegal.

14 years agoAdd query to determine whether a type is a sampler
Ian Romanick [Tue, 23 Mar 2010 22:03:46 +0000 (15:03 -0700)]
Add query to determine whether a type is a sampler

14 years agoAdd test for invalid assignment of function return value
Ian Romanick [Tue, 23 Mar 2010 20:23:53 +0000 (13:23 -0700)]
Add test for invalid assignment of function return value

14 years agoAdd *some* type checking for assignments
Ian Romanick [Tue, 23 Mar 2010 20:23:31 +0000 (13:23 -0700)]
Add *some* type checking for assignments

14 years agoDisallow passing NULL for state to _mesa_glsl_error
Ian Romanick [Tue, 23 Mar 2010 20:21:19 +0000 (13:21 -0700)]
Disallow passing NULL for state to _mesa_glsl_error

The two places that were still passing NULL had a state pointer to
pass.  Not passing it in these places prevented termination of
compilation of erroneous programs.

14 years agoFix typographical errors of "FINISHME"
Ian Romanick [Tue, 23 Mar 2010 20:04:19 +0000 (13:04 -0700)]
Fix typographical errors of "FINISHME"

14 years agoInclude other generated sources in BUILT_SOURCES.
Eric Anholt [Wed, 24 Mar 2010 03:43:10 +0000 (20:43 -0700)]
Include other generated sources in BUILT_SOURCES.

Otherwise, having cleaned glsl_parser.h, we'd never regenerate it because
glsl_parser.cpp was already right where it needed to be.

14 years agoUse bash for the built file generation since builtin_types.sh requires it.
Eric Anholt [Wed, 24 Mar 2010 03:24:33 +0000 (20:24 -0700)]
Use bash for the built file generation since builtin_types.sh requires it.

14 years agoClean the built sources with make clean.
Eric Anholt [Wed, 24 Mar 2010 03:24:11 +0000 (20:24 -0700)]
Clean the built sources with make clean.

14 years agoGenerate an error for variables declared with type void
Ian Romanick [Tue, 23 Mar 2010 19:28:44 +0000 (12:28 -0700)]
Generate an error for variables declared with type void

14 years agoAdd is_error and is_void type queries
Ian Romanick [Tue, 23 Mar 2010 19:28:28 +0000 (12:28 -0700)]
Add is_error and is_void type queries

14 years agoSet the type of a function call to be the return type of the callee
Ian Romanick [Tue, 23 Mar 2010 19:21:18 +0000 (12:21 -0700)]
Set the type of a function call to be the return type of the callee

14 years agoSet, and require, a return type for function signatures
Ian Romanick [Tue, 23 Mar 2010 19:19:13 +0000 (12:19 -0700)]
Set, and require, a return type for function signatures

14 years agoAdd `void' type to table of available types
Ian Romanick [Tue, 23 Mar 2010 19:11:50 +0000 (12:11 -0700)]
Add `void' type to table of available types

This will make void-01.glsl test fail, so I may regret this later.
However, this will make supporting functions that return void or
functions that have a void parameter list easier to handle.

14 years agoRename test GLSL sources from .txt to .glsl
Ian Romanick [Tue, 23 Mar 2010 18:57:24 +0000 (11:57 -0700)]
Rename test GLSL sources from .txt to .glsl

14 years agoAdd test for declaring variables of type void.
Ian Romanick [Tue, 23 Mar 2010 18:54:03 +0000 (11:54 -0700)]
Add test for declaring variables of type void.

14 years agoTrack the function that is currently being defined
Ian Romanick [Sat, 20 Mar 2010 00:08:05 +0000 (17:08 -0700)]
Track the function that is currently being defined

Later this will allow type checking for return statements.

14 years agoInitial bits for converting AST return nodes to IR return instructions
Ian Romanick [Fri, 19 Mar 2010 23:45:19 +0000 (16:45 -0700)]
Initial bits for converting AST return nodes to IR return instructions

14 years agoImplement IR return instructions
Ian Romanick [Fri, 19 Mar 2010 23:44:52 +0000 (16:44 -0700)]
Implement IR return instructions

14 years agoUse glsl_symbol_table::name_declared_this_scope
Ian Romanick [Fri, 19 Mar 2010 22:38:52 +0000 (15:38 -0700)]
Use glsl_symbol_table::name_declared_this_scope

Prevent most illegal name reuse.

14 years agoAdd query to determine whether a name was declared at this scope
Ian Romanick [Fri, 19 Mar 2010 22:37:01 +0000 (15:37 -0700)]
Add query to determine whether a name was declared at this scope

This will be used to prevent a variable and a function with the same
name from being declared.  As a side effect, the calls to
add_{type,name,function} should never fail.

14 years agoUse separate namespaces for types, variables, and functions
Ian Romanick [Fri, 19 Mar 2010 22:34:13 +0000 (15:34 -0700)]
Use separate namespaces for types, variables, and functions

This will allow types and their constructors to be easily stored in
the same symbol table.  This does add a potential problem that a
shader could declare a variable and a function with the same name.
This appears to be forbidden by the GLSL spec.

14 years agoAdd function to determine the scope where a variable is declared
Ian Romanick [Fri, 19 Mar 2010 22:32:57 +0000 (15:32 -0700)]
Add function to determine the scope where a variable is declared

14 years agoUse glsl_symbol_table instead of using _mesa_symbol_table directly
Ian Romanick [Fri, 19 Mar 2010 18:57:24 +0000 (11:57 -0700)]
Use glsl_symbol_table instead of using _mesa_symbol_table directly

14 years agoAdd a GLSL-specific facade to _mesa_symbol_table
Ian Romanick [Fri, 19 Mar 2010 18:42:45 +0000 (11:42 -0700)]
Add a GLSL-specific facade to _mesa_symbol_table

This adds some type saftey and will enable elimination of a bunch of
type casts and other ugly crap in the code.

14 years agoDon't track new type names during pass-1 parsing
Ian Romanick [Fri, 19 Mar 2010 18:12:33 +0000 (11:12 -0700)]
Don't track new type names during pass-1 parsing

This implementation was wrong anyway because it did not respect
scoping rules.  This will need to be revisited soon.  The most likely
result is that the grammar is going to need some significant re-work
to be able to use a IDENTIFIER in all the places where a TYPE_NAME is
currently used.

14 years agoAdd multiple include protection to ir.h
Ian Romanick [Mon, 15 Mar 2010 22:20:15 +0000 (15:20 -0700)]
Add multiple include protection to ir.h

14 years agoTrivial clean-ups to ast_type_specifier(int) constructor
Ian Romanick [Mon, 15 Mar 2010 21:31:48 +0000 (14:31 -0700)]
Trivial clean-ups to ast_type_specifier(int) constructor

14 years agoAdd new constructors for ast_type_specifier
Ian Romanick [Mon, 15 Mar 2010 21:28:17 +0000 (14:28 -0700)]
Add new constructors for ast_type_specifier

Add a constructor that uses an ast_struct_specifier and one that uses
a type name.  This saves a (trivial) bit of code, but it also ensures
some of the class invariants (i.e., type_name != NULL) are met.

14 years agoEnsure that ast_type always has type_name set
Ian Romanick [Mon, 15 Mar 2010 21:15:15 +0000 (14:15 -0700)]
Ensure that ast_type always has type_name set

For built-in types, type_name would be NULL.  This ensures that
type_name is set even for the built-in types.  This simplifies code in
a few places and centralizes the name setting code.

14 years agoFactor ast_type_specifier code out to ast_type.cpp
Ian Romanick [Mon, 15 Mar 2010 21:09:23 +0000 (14:09 -0700)]
Factor ast_type_specifier code out to ast_type.cpp

14 years agoFactor guts of function matching code out to match_function_by_name
Ian Romanick [Mon, 15 Mar 2010 20:26:02 +0000 (13:26 -0700)]
Factor guts of function matching code out to match_function_by_name

This function will be used for matching some types of constructors as well.

14 years agoMove ast_function_expression::hir to ast_function.cpp
Ian Romanick [Mon, 15 Mar 2010 20:04:13 +0000 (13:04 -0700)]
Move ast_function_expression::hir to ast_function.cpp

14 years agoRemove DOA hir_function.c file
Ian Romanick [Mon, 15 Mar 2010 20:02:08 +0000 (13:02 -0700)]
Remove DOA hir_function.c file

14 years agoChange type of function_identifier to silence bison warning
Ian Romanick [Fri, 12 Mar 2010 00:12:25 +0000 (16:12 -0800)]
Change type of function_identifier to silence bison warning

When the implementation of function_call_header and
function_identifier were changed a few commits ago, the types of the
production changed.  This just updates the types specified for the
productions to match reality.

14 years agoAdd parameters to function declarations in the correct order
Ian Romanick [Fri, 12 Mar 2010 00:11:07 +0000 (16:11 -0800)]
Add parameters to function declarations in the correct order

14 years agoInitial pass at resolving function calls
Ian Romanick [Thu, 11 Mar 2010 22:50:30 +0000 (14:50 -0800)]
Initial pass at resolving function calls

The code is still really rough and *REALLY* incomplete.  This at least
passes the first few trivially simple test cases.

14 years agoDefault function parameters to 'in' instead of auto
Ian Romanick [Thu, 11 Mar 2010 22:48:51 +0000 (14:48 -0800)]
Default function parameters to 'in' instead of auto

14 years agoAdd a handful of simple tests for function calls in constructors
Ian Romanick [Thu, 11 Mar 2010 22:46:19 +0000 (14:46 -0800)]
Add a handful of simple tests for function calls in constructors

14 years agoAdd ir_call call to represent function calls.
Ian Romanick [Thu, 11 Mar 2010 22:34:27 +0000 (14:34 -0800)]
Add ir_call call to represent function calls.

14 years agoFix broken constructor of ir_instruction base class
Ian Romanick [Thu, 11 Mar 2010 22:23:41 +0000 (14:23 -0800)]
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.

14 years agoTrack generation of errors and halt compilation appropriately
Ian Romanick [Thu, 11 Mar 2010 22:08:33 +0000 (14:08 -0800)]
Track generation of errors and halt compilation appropriately

14 years agoDifferentiate in ast_function_expression between constructors and func. calls
Ian Romanick [Wed, 10 Mar 2010 22:12:22 +0000 (14:12 -0800)]
Differentiate in ast_function_expression between constructors and func. calls

14 years agoTell emacs that C++ .h files are C++
Ian Romanick [Wed, 10 Mar 2010 21:58:12 +0000 (13:58 -0800)]
Tell emacs that C++ .h files are C++

14 years agoMake ast_function_expression subclass of ast_expression
Ian Romanick [Wed, 10 Mar 2010 21:26:52 +0000 (13:26 -0800)]
Make ast_function_expression subclass of ast_expression

14 years agoSimplified constructor for identifier expressions
Ian Romanick [Wed, 10 Mar 2010 21:25:56 +0000 (13:25 -0800)]
Simplified constructor for identifier expressions

14 years agoIR variable: Initial work to support GLSL built-in variables
Ian Romanick [Wed, 10 Mar 2010 18:43:16 +0000 (10:43 -0800)]
IR variable: Initial work to support GLSL built-in variables

14 years agoInclude cstdlib to be sure size_t is available
Ian Romanick [Wed, 10 Mar 2010 18:42:37 +0000 (10:42 -0800)]
Include cstdlib to be sure size_t is available

14 years agoMove top-level AST to HIR conversion to _mesa_ast_to_hir
Ian Romanick [Wed, 10 Mar 2010 17:55:22 +0000 (09:55 -0800)]
Move top-level AST to HIR conversion to _mesa_ast_to_hir

14 years agoRequire the shader target be specified to the driver program
Ian Romanick [Wed, 10 Mar 2010 17:31:30 +0000 (09:31 -0800)]
Require the shader target be specified to the driver program

14 years agoUse ir_print_visitor to dump IR tree
Ian Romanick [Wed, 10 Mar 2010 17:27:03 +0000 (09:27 -0800)]
Use ir_print_visitor to dump IR tree

14 years agoFix typeo in gl_FogParameters.scale (was scalre)
Ian Romanick [Wed, 10 Mar 2010 08:52:39 +0000 (00:52 -0800)]
Fix typeo in gl_FogParameters.scale (was scalre)

14 years agoAST to IR: Mark 'varying' in a vertex shader as 'out'
Ian Romanick [Wed, 10 Mar 2010 08:28:59 +0000 (00:28 -0800)]
AST to IR: Mark 'varying' in a vertex shader as 'out'

14 years agoir_variable: Initialize all attribute bits to reasonable defaults
Ian Romanick [Wed, 10 Mar 2010 08:21:27 +0000 (00:21 -0800)]
ir_variable: Initialize all attribute bits to reasonable defaults

This prevents variables from randomly having their 'invariant' or
'read_only' bits set, for example.

14 years agoIR print visitor: Add some support for printing types and constants
Ian Romanick [Wed, 10 Mar 2010 05:44:34 +0000 (21:44 -0800)]
IR print visitor: Add some support for printing types and constants

14 years agoIR print visitor: Print assignments
Ian Romanick [Wed, 10 Mar 2010 00:40:45 +0000 (16:40 -0800)]
IR print visitor: Print assignments

14 years agoAdd assignment side-effect to the instruction stream
Ian Romanick [Wed, 10 Mar 2010 00:38:02 +0000 (16:38 -0800)]
Add assignment side-effect to the instruction stream

The actual assignment is a side-effect of the assignment expression.
Add it to the instruction stream and return the LHS of the assignment
as its rvalue.

14 years agoIR visitor: Add initial version of ir_visitor classes
Ian Romanick [Wed, 10 Mar 2010 00:23:37 +0000 (16:23 -0800)]
IR visitor: Add initial version of ir_visitor classes

The ir_visitor class is the abstract base class for all visitors.
ir_print_visitor contains the beginnings of a concrete visitor class
that will print out an IR sequence in a Lisp / Scheme-like syntax.

14 years agoConvert is_glsl_type_matrix to glsl_type::is_matrix
Ian Romanick [Tue, 9 Mar 2010 23:58:52 +0000 (15:58 -0800)]
Convert is_glsl_type_matrix to glsl_type::is_matrix

14 years agoConvert is_glsl_type_vector to glsl_type::is_vector
Ian Romanick [Tue, 9 Mar 2010 23:55:16 +0000 (15:55 -0800)]
Convert is_glsl_type_vector to glsl_type::is_vector

14 years agoConvert is_glsl_type_scalar to glsl_type::is_scalar
Ian Romanick [Tue, 9 Mar 2010 23:51:22 +0000 (15:51 -0800)]
Convert is_glsl_type_scalar to glsl_type::is_scalar

14 years agoMake glsl_type a class
Ian Romanick [Tue, 9 Mar 2010 23:17:37 +0000 (15:17 -0800)]
Make glsl_type a class

Among other benefits, this cleans up a the hackery invovled in
initializing the union field in builtin_types.h.

14 years agoRemove unused function
Ian Romanick [Tue, 9 Mar 2010 07:44:24 +0000 (23:44 -0800)]
Remove unused function

14 years agoConver IR structures to use exec_list instead of simple_node
Ian Romanick [Tue, 9 Mar 2010 07:44:00 +0000 (23:44 -0800)]
Conver IR structures to use exec_list instead of simple_node

14 years agoAdd yet-another linked list type
Ian Romanick [Tue, 9 Mar 2010 07:42:45 +0000 (23:42 -0800)]
Add yet-another linked list type

The use of macros to access existing linked list type makes it
unsuitable for its current use as a base class.  Since this type and
the accompanying macros are used all over the place in Mesa, we can't
really change them.

14 years agoRemove prototypes for *_to_hir functions that no longer exist
Ian Romanick [Tue, 9 Mar 2010 07:06:48 +0000 (23:06 -0800)]
Remove prototypes for *_to_hir functions that no longer exist

14 years agoSet C++ indent too.
Ian Romanick [Mon, 8 Mar 2010 21:02:58 +0000 (13:02 -0800)]
Set C++ indent too.

14 years agoMake AST->HIR conversion a method of ast_node, re-enable
Ian Romanick [Mon, 1 Mar 2010 21:49:10 +0000 (13:49 -0800)]
Make AST->HIR conversion a method of ast_node, re-enable

14 years agoautoconf for the ...
Ian Romanick [Fri, 26 Feb 2010 01:17:23 +0000 (17:17 -0800)]
autoconf for the ...

14 years agoReplace tacky wrapper macros with tacky in-line type-casts
Ian Romanick [Thu, 25 Feb 2010 20:49:55 +0000 (12:49 -0800)]
Replace tacky wrapper macros with tacky in-line type-casts

14 years agoConvert to new interfaces so that it will compile
Ian Romanick [Thu, 25 Feb 2010 20:24:40 +0000 (12:24 -0800)]
Convert to new interfaces so that it will compile

Convert TRUE and FALSE to true and false.  Convert
_mesa_ast_get_location to ast_node::get_location.

14 years agoAdd ast_expression_bin subclass of ast_expression
Ian Romanick [Tue, 23 Feb 2010 03:10:25 +0000 (19:10 -0800)]
Add ast_expression_bin subclass of ast_expression

The ast_expression_bin subclass is used for all binary expressions
such as addition, subtraction, and comparisons.  Several other
subclasses are soon to follow.

14 years agoIgnore all build products
Ian Romanick [Tue, 23 Feb 2010 03:09:45 +0000 (19:09 -0800)]
Ignore all build products

14 years agoRename .cc files to .cpp
Ian Romanick [Tue, 23 Feb 2010 02:43:08 +0000 (18:43 -0800)]
Rename .cc files to .cpp

14 years agoInitialize the node structure embedded in the ast_node
Ian Romanick [Mon, 22 Feb 2010 21:22:10 +0000 (13:22 -0800)]
Initialize the node structure embedded in the ast_node

14 years agoInitial commit. lol
Ian Romanick [Mon, 22 Feb 2010 21:19:34 +0000 (13:19 -0800)]
Initial commit.  lol