Commit graph

753 commits

Author SHA1 Message Date
Kenneth Graunke
739ba06680 glcpp: Complain about unrecognized directives. 2010-06-21 11:31:55 -07:00
Kenneth Graunke
3b73ea36c4 glcpp: Pass #version, #extension, and #pragma directives through unchanged.
Let the main compiler's lexer/parser handle them.
2010-06-21 11:31:55 -07:00
Kenneth Graunke
04ba86a536 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.
2010-06-21 11:31:54 -07:00
Kenneth Graunke
2848c4c183 Complain and exit if the given shader file doesn't exist. 2010-06-21 11:27:33 -07:00
Kenneth Graunke
1b1f43e608 glcpp: Add support for lexing from a string.
The standalone binary still reads from stdin, however.
2010-06-21 11:25:50 -07:00
Kenneth Graunke
4c8a1af811 glcpp: Output to a buffer and error log rather than directly printing.
In the standalone case, simply print the buffers when done.
2010-06-21 11:25:50 -07:00
Kenneth Graunke
0656f6b875 glcpp: Fix a case of == where = probably ought to be.
Caught by a GCC warning.
2010-06-21 11:25:50 -07:00
Kenneth Graunke
cbaab7093c Add glcpp to the build. 2010-06-21 11:25:48 -07:00
Kenneth Graunke
254a485c33 Specify %option prefix="glcpp_" in the source code, not the Makefile. 2010-06-21 11:25:30 -07:00
Kenneth Graunke
6f510a49d2 Merge Carl's preprocessor into the glcpp subdirectory. 2010-06-21 11:22:11 -07:00
Kenneth Graunke
f3eb42d200 Print out the info log if compilation fails. 2010-06-19 11:44:22 -07:00
Kenneth Graunke
b2ba6fac09 Change error/warning functions to print to the info log. 2010-06-19 11:44:21 -07:00
Ian Romanick
ca97bd395f Initialize the shader info log
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
2010-06-19 11:36:15 -07:00
Kenneth Graunke
32cf482215 Make shader a talloc context. 2010-06-19 11:36:15 -07:00
Kenneth Graunke
57d0fc4139 Link against talloc. We're going to be using it. 2010-06-19 11:36:15 -07:00
Kenneth Graunke
c186b3fbe0 Fix crash when running glsl on a signle fragment shader. 2010-06-19 01:29:17 -07:00
Kenneth Graunke
29e6087481 Rename prog to shader. Less confusing. 2010-06-19 01:29:17 -07:00
Kenneth Graunke
520aad2c3e Fix compile on 64-bit. 2010-06-19 01:29:17 -07:00
Ian Romanick
c96822cf31 Ensure that shader_in and shader_out are correctly set in declarations 2010-06-18 19:02:45 -07:00
Ian Romanick
93dad36844 glsl_lexer: centroid and invariant are not reserved words in GLSL 1.10 2010-06-18 19:02:45 -07:00
Ian Romanick
8655b7e78a glsl_lexer: Handle interpolation qualifiers 2010-06-18 19:02:45 -07:00
Ian Romanick
c93b8f1d2c linker: Add some function header comments 2010-06-17 20:37:38 -07:00
Ian Romanick
4230cfdb42 TODO: Add note about initializers for constants 2010-06-17 20:37:17 -07:00
Ian Romanick
ce03088406 Allow initializers for uniforms 2010-06-17 20:09:34 -07:00
Ian Romanick
c648a124b2 Don't link shaders by default
Add a command line option to trigger linking.  This "fixes" all the
failing test cases.  Oops.
2010-06-17 19:51:48 -07:00
Ian Romanick
832dfa58b2 linker: Initial bits of the linker
No linking is done yet, but some of the semantic checking is done.
2010-06-17 15:04:20 -07:00
Ian Romanick
705fb01b59 Use glsl_program instead of an open-coded vector of shaders 2010-06-17 12:59:45 -07:00
Ian Romanick
3f09c2508a Add glsl_program that is similar to Mesa's gl_shader_program 2010-06-17 12:59:27 -07:00
Ian Romanick
f8fe53ca2e Change glsl_program to glsl_shader 2010-06-17 12:54:24 -07:00
Ian Romanick
6fd9fb23de Compile multiple shaders listed on the command line 2010-06-17 12:22:16 -07:00
Ian Romanick
8ce55dbd92 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.
2010-06-17 12:01:18 -07:00
Ian Romanick
869b6f680f Add glsl_program that is similar to Mesa's gl_program
This will be used as the header for individual compilation units.
2010-06-17 12:00:25 -07:00
Ian Romanick
298586fd6c Add TODO list
Don't want to forget anything, no do we?
2010-06-15 17:42:16 -07:00
Ian Romanick
81e1747ac5 Printing LIR is optional 2010-06-15 12:51:38 -07:00
Ian Romanick
7babbdbd82 Printing the AST is optional 2010-06-15 12:50:53 -07:00
Ian Romanick
fc0ef6451c Minor bits of code rearranging 2010-06-15 12:20:49 -07:00
Ian Romanick
2b36895f0c Infer shader type from suffix on filename 2010-06-15 12:00:37 -07:00
Ian Romanick
54992c30b0 Remove ability to read "IR shaders" from stand-alone compiler 2010-06-14 14:47:26 -07:00
Ian Romanick
61d4aa041f Move stand-alone compiler main routine to main.cpp 2010-06-14 14:46:09 -07:00
Ian Romanick
824b659d91 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.
2010-06-11 17:12:40 -07:00
Ian Romanick
b74b43e4ba Use statically typed ir_constant constructors wherever possible 2010-06-11 17:12:23 -07:00
Ian Romanick
4976e57448 ir_reader: Use 'union ir_constant_data' in read_constant 2010-06-11 17:12:23 -07:00
Ian Romanick
f8b88bea0f 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.
2010-06-11 17:12:12 -07:00
Ian Romanick
083d75a942 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.
2010-06-11 17:11:14 -07:00
Ian Romanick
4daaab6040 ir_constant_visitor: Use 'union ir_constant_data' in expression handler 2010-06-11 17:11:06 -07:00
Ian Romanick
0bb70a30d5 ir_constant_visitor: Use 'union ir_constant_data' instead of open-coded version 2010-06-11 15:49:49 -07:00
Ian Romanick
be1d2bfdea Matrix and vector constructors with a single constant scalar are constant 2010-06-11 15:48:26 -07:00
Ian Romanick
39d6dd3537 ir_constant_visitor: Handle bool-to-int and int-to-bool 2010-06-11 15:43:59 -07:00
Ian Romanick
7825d3d157 Treat ?: with all constant subexpressions as a constant expression 2010-06-11 15:43:59 -07:00
Ian Romanick
0ad76c6767 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.
2010-06-11 15:43:59 -07:00