mesa.git
14 years agoglcpp: Add boolean 'error' flag.
Kenneth Graunke [Mon, 21 Jun 2010 19:39:49 +0000 (12:39 -0700)]
glcpp: Add boolean 'error' flag.

We used to check if the info log is non-empty, but when we print
warnings, this will no longer be valid.

14 years agoglcpp: Rename "errors" to "info_log."
Kenneth Graunke [Sat, 19 Jun 2010 02:52:36 +0000 (19:52 -0700)]
glcpp: Rename "errors" to "info_log."

Eventually, we'll want to be be able to print out warnings as well.

14 years agoglcpp: Don't include newlines as part of #version-passthrough.
Kenneth Graunke [Fri, 18 Jun 2010 22:41:00 +0000 (15:41 -0700)]
glcpp: Don't include newlines as part of #version-passthrough.

Fixes glcpp/tests/064-version.c.

14 years agoglcpp/tests: Add a test for #version followed by #define.
Kenneth Graunke [Fri, 18 Jun 2010 22:34:50 +0000 (15:34 -0700)]
glcpp/tests: Add a test for #version followed by #define.

This isn't really a C file, but...that's probably okay.

14 years agoglcpp: Fix line and column numbering.
Kenneth Graunke [Fri, 18 Jun 2010 22:23:50 +0000 (15:23 -0700)]
glcpp: Fix line and column numbering.

Lines were off by one, and column numbering was completely daft.

14 years agoglcpp: Remove calls to exit().
Kenneth Graunke [Thu, 17 Jun 2010 19:58:54 +0000 (12:58 -0700)]
glcpp: Remove calls to exit().

Calling exit() would be really bad once integrated into mesa.  Even in
the standalone binary, we want to print the error log first.

Since each case already flags an error, compilation will still fail,
but it may go on (with something fudged) and generate more errors.

14 years agoglcpp: Add line locations to "Unterminated #if" error message.
Kenneth Graunke [Thu, 17 Jun 2010 19:41:46 +0000 (12:41 -0700)]
glcpp: Add line locations to "Unterminated #if" error message.

14 years agoglcpp: Add line locations to various mismatched #if error messages.
Kenneth Graunke [Thu, 17 Jun 2010 19:30:57 +0000 (12:30 -0700)]
glcpp: Add line locations to various mismatched #if error messages.

14 years agoglcpp: Add line locations to "reserved name" error messages.
Kenneth Graunke [Thu, 17 Jun 2010 19:21:53 +0000 (12:21 -0700)]
glcpp: Add line locations to "reserved name" error messages.

14 years agoglcpp: Print locations in error messages where possible.
Kenneth Graunke [Thu, 17 Jun 2010 00:31:50 +0000 (17:31 -0700)]
glcpp: Print locations in error messages where possible.

14 years agoglcpp: Introduce new glcpp_error function.
Kenneth Graunke [Thu, 17 Jun 2010 19:03:25 +0000 (12:03 -0700)]
glcpp: Introduce new glcpp_error function.

14 years agoglcpp: Set locations on tokens.
Kenneth Graunke [Wed, 16 Jun 2010 23:58:31 +0000 (16:58 -0700)]
glcpp: Set locations on tokens.

14 years agoglcpp: Set line locations in the lexer.
Kenneth Graunke [Thu, 17 Jun 2010 00:41:12 +0000 (17:41 -0700)]
glcpp: Set line locations in the lexer.

14 years agoglcpp: Add plumbing to support line locations.
Kenneth Graunke [Wed, 16 Jun 2010 23:35:57 +0000 (16:35 -0700)]
glcpp: Add plumbing to support line locations.

14 years agoglcpp: Add %error-verbose.
Kenneth Graunke [Thu, 17 Jun 2010 20:07:13 +0000 (13:07 -0700)]
glcpp: Add %error-verbose.

14 years agoglcpp: Actually support #ifdef and #ifndef.
Kenneth Graunke [Thu, 17 Jun 2010 21:36:34 +0000 (14:36 -0700)]
glcpp: Actually support #ifdef and #ifndef.

Strangely, the lexer never created these tokens, even though the parser
already had code to handle them.

14 years agoglcpp: Build a reentrant parser.
Kenneth Graunke [Wed, 16 Jun 2010 23:26:28 +0000 (16:26 -0700)]
glcpp: Build a reentrant parser.

14 years agoglcpp: Print errors on stdout instead of stderr (non-standalone version).
Kenneth Graunke [Wed, 16 Jun 2010 20:19:27 +0000 (13:19 -0700)]
glcpp: Print errors on stdout instead of stderr (non-standalone version).

Otherwise, piglit marks tests as "warn" when the shader was (correctly)
failing.

14 years agoglcpp/tests: Add extra newline at the end of expected output.
Kenneth Graunke [Thu, 17 Jun 2010 21:49:40 +0000 (14:49 -0700)]
glcpp/tests: Add extra newline at the end of expected output.

This newline at EOF is harmless and generated by the previous commit.

14 years agoglcpp: Handle missing newline at EOF.
Kenneth Graunke [Wed, 16 Jun 2010 19:53:19 +0000 (12:53 -0700)]
glcpp: Handle missing newline at EOF.

Fixes CorrectFuncOverload.vert.

14 years agoglcpp: Complain about unrecognized directives.
Kenneth Graunke [Wed, 16 Jun 2010 19:41:37 +0000 (12:41 -0700)]
glcpp: Complain about unrecognized directives.

14 years agoglcpp: Pass #version, #extension, and #pragma directives through unchanged.
Kenneth Graunke [Wed, 16 Jun 2010 19:21:17 +0000 (12:21 -0700)]
glcpp: Pass #version, #extension, and #pragma directives through unchanged.

Let the main compiler's lexer/parser handle them.

14 years agoMake the main compiler call the preprocessor.
Kenneth Graunke [Wed, 16 Jun 2010 19:18:00 +0000 (12:18 -0700)]
Make the main compiler call the preprocessor.

By using a single function, the main compiler doesn't need to include
glcpp.h, which currently has a lot of details about the preprocessor
internals.  In particular, this prevents the two yacc grammars from
seeing each other, which would be rather messy to sort out.

14 years agoComplain and exit if the given shader file doesn't exist.
Kenneth Graunke [Wed, 16 Jun 2010 19:10:55 +0000 (12:10 -0700)]
Complain and exit if the given shader file doesn't exist.

14 years agoglcpp: Add support for lexing from a string.
Kenneth Graunke [Wed, 16 Jun 2010 19:01:17 +0000 (12:01 -0700)]
glcpp: Add support for lexing from a string.

The standalone binary still reads from stdin, however.

14 years agoglcpp: Output to a buffer and error log rather than directly printing.
Kenneth Graunke [Wed, 16 Jun 2010 18:57:48 +0000 (11:57 -0700)]
glcpp: Output to a buffer and error log rather than directly printing.

In the standalone case, simply print the buffers when done.

14 years agoglcpp: Fix a case of == where = probably ought to be.
Kenneth Graunke [Wed, 16 Jun 2010 18:56:36 +0000 (11:56 -0700)]
glcpp: Fix a case of == where = probably ought to be.

Caught by a GCC warning.

14 years agoAdd glcpp to the build.
Kenneth Graunke [Wed, 16 Jun 2010 18:54:01 +0000 (11:54 -0700)]
Add glcpp to the build.

14 years agoSpecify %option prefix="glcpp_" in the source code, not the Makefile.
Kenneth Graunke [Wed, 16 Jun 2010 18:51:43 +0000 (11:51 -0700)]
Specify %option prefix="glcpp_" in the source code, not the Makefile.

14 years agoMerge Carl's preprocessor into the glcpp subdirectory.
Kenneth Graunke [Mon, 21 Jun 2010 18:22:11 +0000 (11:22 -0700)]
Merge Carl's preprocessor into the glcpp subdirectory.

14 years agoPrint out the info log if compilation fails.
Kenneth Graunke [Sat, 19 Jun 2010 18:31:01 +0000 (11:31 -0700)]
Print out the info log if compilation fails.

14 years agoChange error/warning functions to print to the info log.
Kenneth Graunke [Thu, 17 Jun 2010 22:15:35 +0000 (15:15 -0700)]
Change error/warning functions to print to the info log.

14 years agoInitialize the shader info log
Ian Romanick [Sat, 19 Jun 2010 08:39:14 +0000 (01:39 -0700)]
Initialize the shader info log

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
14 years agoMake shader a talloc context.
Kenneth Graunke [Sat, 19 Jun 2010 18:24:33 +0000 (11:24 -0700)]
Make shader a talloc context.

14 years agoLink against talloc. We're going to be using it.
Kenneth Graunke [Thu, 17 Jun 2010 22:14:47 +0000 (15:14 -0700)]
Link against talloc.  We're going to be using it.

14 years agoFix crash when running glsl on a signle fragment shader.
Kenneth Graunke [Thu, 17 Jun 2010 22:37:26 +0000 (15:37 -0700)]
Fix crash when running glsl on a signle fragment shader.

14 years agoRename prog to shader. Less confusing.
Kenneth Graunke [Thu, 17 Jun 2010 22:28:34 +0000 (15:28 -0700)]
Rename prog to shader.  Less confusing.

14 years agoFix compile on 64-bit.
Kenneth Graunke [Thu, 17 Jun 2010 22:28:13 +0000 (15:28 -0700)]
Fix compile on 64-bit.

14 years agoEnsure that shader_in and shader_out are correctly set in declarations
Ian Romanick [Sat, 19 Jun 2010 01:57:31 +0000 (18:57 -0700)]
Ensure that shader_in and shader_out are correctly set in declarations

14 years agoglsl_lexer: centroid and invariant are not reserved words in GLSL 1.10
Ian Romanick [Sat, 19 Jun 2010 01:40:12 +0000 (18:40 -0700)]
glsl_lexer: centroid and invariant are not reserved words in GLSL 1.10

14 years agoglsl_lexer: Handle interpolation qualifiers
Ian Romanick [Sat, 19 Jun 2010 01:36:51 +0000 (18:36 -0700)]
glsl_lexer: Handle interpolation qualifiers

14 years agolinker: Add some function header comments
Ian Romanick [Thu, 17 Jun 2010 22:20:22 +0000 (15:20 -0700)]
linker: Add some function header comments

14 years agoTODO: Add note about initializers for constants
Ian Romanick [Fri, 18 Jun 2010 03:37:17 +0000 (20:37 -0700)]
TODO: Add note about initializers for constants

14 years agoAllow initializers for uniforms
Ian Romanick [Fri, 18 Jun 2010 03:09:34 +0000 (20:09 -0700)]
Allow initializers for uniforms

14 years agoDon't link shaders by default
Ian Romanick [Fri, 18 Jun 2010 02:51:48 +0000 (19:51 -0700)]
Don't link shaders by default

Add a command line option to trigger linking.  This "fixes" all the
failing test cases.  Oops.

14 years agolinker: Initial bits of the linker
Ian Romanick [Thu, 17 Jun 2010 22:04:20 +0000 (15:04 -0700)]
linker: Initial bits of the linker

No linking is done yet, but some of the semantic checking is done.

14 years agoUse glsl_program instead of an open-coded vector of shaders
Ian Romanick [Thu, 17 Jun 2010 19:59:45 +0000 (12:59 -0700)]
Use glsl_program instead of an open-coded vector of shaders

14 years agoAdd glsl_program that is similar to Mesa's gl_shader_program
Ian Romanick [Thu, 17 Jun 2010 19:59:27 +0000 (12:59 -0700)]
Add glsl_program that is similar to Mesa's gl_shader_program

14 years agoChange glsl_program to glsl_shader
Ian Romanick [Thu, 17 Jun 2010 19:54:24 +0000 (12:54 -0700)]
Change glsl_program to glsl_shader

14 years agoCompile multiple shaders listed on the command line
Ian Romanick [Thu, 17 Jun 2010 19:22:16 +0000 (12:22 -0700)]
Compile multiple shaders listed on the command line

14 years agoExtract compilation to a separate routine
Ian Romanick [Thu, 17 Jun 2010 19:01:18 +0000 (12:01 -0700)]
Extract compilation to a separate routine

Pull all of the code that actually compiles shaders into a separate
function.  Use a glsl_program to track data about the compiled shader.

14 years agoAdd glsl_program that is similar to Mesa's gl_program
Ian Romanick [Thu, 17 Jun 2010 19:00:25 +0000 (12:00 -0700)]
Add glsl_program that is similar to Mesa's gl_program

This will be used as the header for individual compilation units.

14 years agoAdd TODO list
Ian Romanick [Wed, 16 Jun 2010 00:42:16 +0000 (17:42 -0700)]
Add TODO list

Don't want to forget anything, no do we?

14 years agoPrinting LIR is optional
Ian Romanick [Tue, 15 Jun 2010 19:51:38 +0000 (12:51 -0700)]
Printing LIR is optional

14 years agoPrinting the AST is optional
Ian Romanick [Tue, 15 Jun 2010 19:47:07 +0000 (12:47 -0700)]
Printing the AST is optional

14 years agoMinor bits of code rearranging
Ian Romanick [Tue, 15 Jun 2010 19:03:10 +0000 (12:03 -0700)]
Minor bits of code rearranging

14 years agoInfer shader type from suffix on filename
Ian Romanick [Tue, 15 Jun 2010 19:00:37 +0000 (12:00 -0700)]
Infer shader type from suffix on filename

14 years agoRemove ability to read "IR shaders" from stand-alone compiler
Ian Romanick [Mon, 14 Jun 2010 21:47:26 +0000 (14:47 -0700)]
Remove ability to read "IR shaders" from stand-alone compiler

14 years agoMove stand-alone compiler main routine to main.cpp
Ian Romanick [Mon, 14 Jun 2010 21:46:09 +0000 (14:46 -0700)]
Move stand-alone compiler main routine to main.cpp

14 years agoir_constant: Eliminate 'void *' constructor
Ian Romanick [Fri, 11 Jun 2010 23:57:47 +0000 (16:57 -0700)]
ir_constant: Eliminate 'void *' constructor

All of the places that had been using the (glsl_type *, void *)
constructor were actually passing an ir_constant_data for the
'void *'.  The code can be greatly simplified by replacing this
constructor with a (glsl_type *, ir_constant_data *) constructor.
This should also help prevent one class of invalid uses of the old
constructor.

14 years agoUse statically typed ir_constant constructors wherever possible
Ian Romanick [Fri, 11 Jun 2010 23:52:09 +0000 (16:52 -0700)]
Use statically typed ir_constant constructors wherever possible

14 years agoir_reader: Use 'union ir_constant_data' in read_constant
Ian Romanick [Fri, 11 Jun 2010 23:43:42 +0000 (16:43 -0700)]
ir_reader: Use 'union ir_constant_data' in read_constant

14 years agoir_constant_visitor: Type of constant result is same as original expression
Ian Romanick [Fri, 11 Jun 2010 23:23:52 +0000 (16:23 -0700)]
ir_constant_visitor: Type of constant result is same as original expression

The type of the resulting constant must be the same as the type of the
original expression.  The changes to the code require that the case
where an unhandled expression is received, and there really shouldn't
be any of these, must be an exit point.

14 years agoir_constant_visitor: Types of ir_binop_{equal,nequal} must match
Ian Romanick [Fri, 11 Jun 2010 23:20:43 +0000 (16:20 -0700)]
ir_constant_visitor: Types of ir_binop_{equal,nequal} must match

The types must match exactly, so there is no reason to check the types here.

14 years agoir_constant_visitor: Use 'union ir_constant_data' in expression handler
Ian Romanick [Fri, 11 Jun 2010 23:08:47 +0000 (16:08 -0700)]
ir_constant_visitor: Use 'union ir_constant_data' in expression handler

14 years agoir_constant_visitor: Use 'union ir_constant_data' instead of open-coded version
Ian Romanick [Fri, 11 Jun 2010 22:49:49 +0000 (15:49 -0700)]
ir_constant_visitor: Use 'union ir_constant_data' instead of open-coded version

14 years agoMatrix and vector constructors with a single constant scalar are constant
Ian Romanick [Fri, 11 Jun 2010 21:01:44 +0000 (14:01 -0700)]
Matrix and vector constructors with a single constant scalar are constant

14 years agoir_constant_visitor: Handle bool-to-int and int-to-bool
Ian Romanick [Fri, 11 Jun 2010 20:46:30 +0000 (13:46 -0700)]
ir_constant_visitor: Handle bool-to-int and int-to-bool

14 years agoTreat ?: with all constant subexpressions as a constant expression
Ian Romanick [Fri, 11 Jun 2010 20:45:51 +0000 (13:45 -0700)]
Treat ?: with all constant subexpressions as a constant expression

14 years agoRearrange code in HIR conversion of ?: operator
Ian Romanick [Fri, 11 Jun 2010 19:56:26 +0000 (12:56 -0700)]
Rearrange code in HIR conversion of ?: operator

There are no functional changes.  Code is just moved arround.  This
prepares for the next set of changes that do change the functionality.

14 years agoir_constant_visitor: Handle constant swizzles
Ian Romanick [Fri, 11 Jun 2010 19:30:28 +0000 (12:30 -0700)]
ir_constant_visitor: Handle constant swizzles

14 years agoir_constant_visitor: Handle array access of constant vectors and matrices
Ian Romanick [Fri, 11 Jun 2010 19:20:12 +0000 (12:20 -0700)]
ir_constant_visitor: Handle array access of constant vectors and matrices

14 years agoRemove redundant type checks for constant constructors
Ian Romanick [Fri, 11 Jun 2010 18:36:12 +0000 (11:36 -0700)]
Remove redundant type checks for constant constructors

All of the cases (e.g., arrays and structures) that were being
filtered by these tests were already filtered by the earlier
is_numeric and is_boolean tests.

14 years agoDo simple constant folding while processing function call parameters
Ian Romanick [Thu, 10 Jun 2010 00:31:02 +0000 (17:31 -0700)]
Do simple constant folding while processing function call parameters

14 years agoir_constant_visitor: Handle dereferences of constant records
Ian Romanick [Thu, 10 Jun 2010 00:30:19 +0000 (17:30 -0700)]
ir_constant_visitor: Handle dereferences of constant records

14 years agoir_constant: Add get_record_field query
Ian Romanick [Thu, 10 Jun 2010 00:28:54 +0000 (17:28 -0700)]
ir_constant: Add get_record_field query

14 years agoAdd glsl_types::field_index to get the location of a record field
Ian Romanick [Thu, 10 Jun 2010 00:27:31 +0000 (17:27 -0700)]
Add glsl_types::field_index to get the location of a record field

14 years agoDetect and process constant record constructors
Ian Romanick [Thu, 10 Jun 2010 00:26:20 +0000 (17:26 -0700)]
Detect and process constant record constructors

14 years agoMove parameter processing out of match_function_by_name
Ian Romanick [Thu, 10 Jun 2010 00:23:26 +0000 (17:23 -0700)]
Move parameter processing out of match_function_by_name

Eventually code that processes constant structure constructors will
need to use the processed list of parameters.

14 years agoir_constant_visitor: Use clone to create a constant from a variable reference
Ian Romanick [Thu, 10 Jun 2010 00:19:10 +0000 (17:19 -0700)]
ir_constant_visitor: Use clone to create a constant from a variable reference

14 years agoir_constant: Support constant structures in clone
Ian Romanick [Thu, 10 Jun 2010 00:18:04 +0000 (17:18 -0700)]
ir_constant: Support constant structures in clone

14 years agoir_constant: Add storage for multiple constants for arrays and records
Ian Romanick [Thu, 10 Jun 2010 00:11:50 +0000 (17:11 -0700)]
ir_constant: Add storage for multiple constants for arrays and records

14 years agoAdd glsl_type::is_record query
Ian Romanick [Thu, 10 Jun 2010 00:17:47 +0000 (17:17 -0700)]
Add glsl_type::is_record query

14 years agoAdd float/bool conversion to ir_constant_expression.cpp.
Ian Romanick [Mon, 7 Jun 2010 22:10:14 +0000 (15:10 -0700)]
Add float/bool conversion to ir_constant_expression.cpp.

14 years agoConstant-fold constructor parameters after type conversion
Ian Romanick [Mon, 7 Jun 2010 22:08:04 +0000 (15:08 -0700)]
Constant-fold constructor parameters after type conversion

This causes the following tests to pass:

         glslparsertest/shaders/CorrectMatComma2.frag

One of the incorrect errors in glslparsertest/shaders/CorrectComma.frag
is also eliminated.

14 years agoMake constructors with all constant parameters generate in-line constants
Ian Romanick [Fri, 4 Jun 2010 23:36:09 +0000 (16:36 -0700)]
Make constructors with all constant parameters generate in-line constants

14 years agoConstruct an ir_constant from a list of ir_constant values
Ian Romanick [Fri, 4 Jun 2010 23:34:38 +0000 (16:34 -0700)]
Construct an ir_constant from a list of ir_constant values

14 years agoAdd queries to determine if a node is a list sentinal
Ian Romanick [Fri, 4 Jun 2010 23:35:42 +0000 (16:35 -0700)]
Add queries to determine if a node is a list sentinal

14 years agoAdd methods to ir_constant to get scalar components in a particular type
Ian Romanick [Fri, 4 Jun 2010 23:30:07 +0000 (16:30 -0700)]
Add methods to ir_constant to get scalar components in a particular type

14 years agoDerefence components of constants smarter
Ian Romanick [Fri, 4 Jun 2010 23:20:35 +0000 (16:20 -0700)]
Derefence components of constants smarter

During generation of calls to constructors, derefernce constants by creating
new constants instead of creating dereferences.

14 years agoConstruct an ir_constant from a scalar component of another ir_constant
Ian Romanick [Fri, 4 Jun 2010 23:13:35 +0000 (16:13 -0700)]
Construct an ir_constant from a scalar component of another ir_constant

14 years agoUse ir_unop_b2i when converting a bool-to-int and add a missing break
Ian Romanick [Fri, 11 Jun 2010 20:49:00 +0000 (13:49 -0700)]
Use ir_unop_b2i when converting a bool-to-int and add a missing break

The previous code just had dumb cut-and-paste errors.

14 years agoRemove linux_list in favor of exec_list.
Kenneth Graunke [Thu, 10 Jun 2010 00:05:14 +0000 (17:05 -0700)]
Remove linux_list in favor of exec_list.

14 years agoAdd forgotten autogenerated EXT_texture_array_fs folder.
Kenneth Graunke [Wed, 9 Jun 2010 23:46:09 +0000 (16:46 -0700)]
Add forgotten autogenerated EXT_texture_array_fs folder.

14 years agoImplement 1.30 int/uint variants of min/max/clamp.
Kenneth Graunke [Wed, 9 Jun 2010 23:14:45 +0000 (16:14 -0700)]
Implement 1.30 int/uint variants of min/max/clamp.

14 years agotexture_builtins.py: The unsigned integer type is "uint", not "unsigned"
Kenneth Graunke [Wed, 9 Jun 2010 23:11:36 +0000 (16:11 -0700)]
texture_builtins.py: The unsigned integer type is "uint", not "unsigned"

This doesn't actually affect anything yet, but is good to fix anyway.

14 years agoImplement 1.30 hyperbolic trig builtins (sinh, cosh, tanh).
Kenneth Graunke [Wed, 9 Jun 2010 23:08:36 +0000 (16:08 -0700)]
Implement 1.30 hyperbolic trig builtins (sinh, cosh, tanh).

14 years agoImplement 1.20 'transpose' builtin.
Kenneth Graunke [Wed, 9 Jun 2010 22:56:46 +0000 (15:56 -0700)]
Implement 1.20 'transpose' builtin.

14 years agoImplement 1.20 'outerProduct' builtin.
Kenneth Graunke [Wed, 9 Jun 2010 22:47:09 +0000 (15:47 -0700)]
Implement 1.20 'outerProduct' builtin.

14 years agoImplement matrixCompMult builtin - the last of the 110 builtins.
Kenneth Graunke [Wed, 9 Jun 2010 22:17:41 +0000 (15:17 -0700)]
Implement matrixCompMult builtin - the last of the 110 builtins.