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.
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.
Ian Romanick [Fri, 11 Jun 2010 23:08:47 +0000 (16:08 -0700)]
ir_constant_visitor: Use 'union ir_constant_data' in expression handler
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
Ian Romanick [Fri, 11 Jun 2010 21:01:44 +0000 (14:01 -0700)]
Matrix and vector constructors with a single constant scalar are constant
Ian Romanick [Fri, 11 Jun 2010 20:46:30 +0000 (13:46 -0700)]
ir_constant_visitor: Handle bool-to-int and int-to-bool
Ian Romanick [Fri, 11 Jun 2010 20:45:51 +0000 (13:45 -0700)]
Treat ?: with all constant subexpressions as a constant expression
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.
Ian Romanick [Fri, 11 Jun 2010 19:30:28 +0000 (12:30 -0700)]
ir_constant_visitor: Handle constant swizzles
Ian Romanick [Fri, 11 Jun 2010 19:20:12 +0000 (12:20 -0700)]
ir_constant_visitor: Handle array access of constant vectors and matrices
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.
Ian Romanick [Thu, 10 Jun 2010 00:31:02 +0000 (17:31 -0700)]
Do simple constant folding while processing function call parameters
Ian Romanick [Thu, 10 Jun 2010 00:30:19 +0000 (17:30 -0700)]
ir_constant_visitor: Handle dereferences of constant records
Ian Romanick [Thu, 10 Jun 2010 00:28:54 +0000 (17:28 -0700)]
ir_constant: Add get_record_field query
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
Ian Romanick [Thu, 10 Jun 2010 00:26:20 +0000 (17:26 -0700)]
Detect and process constant record constructors
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.
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
Ian Romanick [Thu, 10 Jun 2010 00:18:04 +0000 (17:18 -0700)]
ir_constant: Support constant structures in clone
Ian Romanick [Thu, 10 Jun 2010 00:11:50 +0000 (17:11 -0700)]
ir_constant: Add storage for multiple constants for arrays and records
Ian Romanick [Thu, 10 Jun 2010 00:17:47 +0000 (17:17 -0700)]
Add glsl_type::is_record query
Ian Romanick [Mon, 7 Jun 2010 22:10:14 +0000 (15:10 -0700)]
Add float/bool conversion to ir_constant_expression.cpp.
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.
Ian Romanick [Fri, 4 Jun 2010 23:36:09 +0000 (16:36 -0700)]
Make constructors with all constant parameters generate in-line constants
Ian Romanick [Fri, 4 Jun 2010 23:34:38 +0000 (16:34 -0700)]
Construct an ir_constant from a list of ir_constant values
Ian Romanick [Fri, 4 Jun 2010 23:35:42 +0000 (16:35 -0700)]
Add queries to determine if a node is a list sentinal
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
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.
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
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.
Kenneth Graunke [Thu, 10 Jun 2010 00:05:14 +0000 (17:05 -0700)]
Remove linux_list in favor of exec_list.
Kenneth Graunke [Wed, 9 Jun 2010 23:46:09 +0000 (16:46 -0700)]
Add forgotten autogenerated EXT_texture_array_fs folder.
Kenneth Graunke [Wed, 9 Jun 2010 23:14:45 +0000 (16:14 -0700)]
Implement 1.30 int/uint variants of min/max/clamp.
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.
Kenneth Graunke [Wed, 9 Jun 2010 23:08:36 +0000 (16:08 -0700)]
Implement 1.30 hyperbolic trig builtins (sinh, cosh, tanh).
Kenneth Graunke [Wed, 9 Jun 2010 22:56:46 +0000 (15:56 -0700)]
Implement 1.20 'transpose' builtin.
Kenneth Graunke [Wed, 9 Jun 2010 22:47:09 +0000 (15:47 -0700)]
Implement 1.20 'outerProduct' builtin.
Kenneth Graunke [Wed, 9 Jun 2010 22:17:41 +0000 (15:17 -0700)]
Implement matrixCompMult builtin - the last of the 110 builtins.
Kenneth Graunke [Wed, 9 Jun 2010 22:22:35 +0000 (15:22 -0700)]
ir_constant_visitor: Add support for dFdx and dFdy operations.
If the argument is a constant expression...it's not changing per pixel,
so the result is simply 0.
Kenneth Graunke [Wed, 9 Jun 2010 21:42:41 +0000 (14:42 -0700)]
Implement dFdx, dFdy, and fwidth via new expression opcodes.
Kenneth Graunke [Wed, 9 Jun 2010 21:30:52 +0000 (14:30 -0700)]
Implement 'refract' builtin.
Kenneth Graunke [Wed, 9 Jun 2010 21:15:04 +0000 (14:15 -0700)]
Fix some typing issues in asin.
CorrectFunction.vert now passes.
Kenneth Graunke [Wed, 9 Jun 2010 21:06:56 +0000 (14:06 -0700)]
Add a completely bogus implementation of the noise[1234] builtins.
idr suggested this. Eventually we will need a real one.
Kenneth Graunke [Wed, 9 Jun 2010 20:52:32 +0000 (13:52 -0700)]
Implement 'acos' builtin.
This is tacked on to the end of the 'asin' file because acos calls asin,
whech means asin needs to be defined first. Alphabetical order fail.
Kenneth Graunke [Wed, 9 Jun 2010 20:27:16 +0000 (13:27 -0700)]
Implement 'faceforward' builtin.
Kenneth Graunke [Wed, 9 Jun 2010 20:17:00 +0000 (13:17 -0700)]
Implement 'distance' builtin.
Kenneth Graunke [Wed, 9 Jun 2010 20:10:00 +0000 (13:10 -0700)]
Add remaining signatures for 'clamp' builtin.
Kenneth Graunke [Wed, 9 Jun 2010 20:05:40 +0000 (13:05 -0700)]
Add remaining signatures for 'max' builtin.
Kenneth Graunke [Wed, 9 Jun 2010 20:03:18 +0000 (13:03 -0700)]
Add remaining signatures for 'min' builtin.
Kenneth Graunke [Wed, 9 Jun 2010 19:58:42 +0000 (12:58 -0700)]
Add remaining signatures for 'mod' builtin.
Kenneth Graunke [Wed, 9 Jun 2010 18:07:53 +0000 (11:07 -0700)]
ir_function_cloning_visitor: Add support for ir_texture.
Kenneth Graunke [Wed, 9 Jun 2010 05:41:30 +0000 (22:41 -0700)]
Don't call _mesa_glsl_initialize_types for every builtin function.
This was clearly wrong; types are now only initialized once.
Kenneth Graunke [Wed, 9 Jun 2010 05:33:43 +0000 (22:33 -0700)]
Only initialize types after #extension directives have been processed.
Since _mesa_glsl_initialize_types add types for various extensions, we
can't call it until after processing "#extension foo : disable" lines.
Fixes tex_rect_02.frag.
Kenneth Graunke [Tue, 8 Jun 2010 23:29:17 +0000 (16:29 -0700)]
Commit output of texture_builtins.py and refresh builtin_function.cpp.
Kenneth Graunke [Tue, 8 Jun 2010 23:03:46 +0000 (16:03 -0700)]
texture_builtins.py: Support the EXT_texture_array extension.
Kenneth Graunke [Tue, 8 Jun 2010 23:17:17 +0000 (16:17 -0700)]
Add EXT_texture_array support.
Kenneth Graunke [Tue, 8 Jun 2010 23:01:41 +0000 (16:01 -0700)]
generate_builtins.pl: Support stage-specific builtins even for extensions.
Kenneth Graunke [Tue, 8 Jun 2010 22:34:37 +0000 (15:34 -0700)]
texture_builtins.py: Fixes for Array variants.
The array layer is now included as part of the texture coordinate.
Kenneth Graunke [Tue, 8 Jun 2010 20:44:00 +0000 (13:44 -0700)]
texture_builtins.py: Add support for 130 Proj variants.
Kenneth Graunke [Tue, 8 Jun 2010 02:28:19 +0000 (19:28 -0700)]
Add a python script to generate texture builtins.
Kenneth Graunke [Fri, 4 Jun 2010 22:02:49 +0000 (15:02 -0700)]
generate_builtins.pl: Support directiories for each extension.
Kenneth Graunke [Thu, 3 Jun 2010 21:51:40 +0000 (14:51 -0700)]
generate_builtins.pl: Support _fs directories as well as _vs.
Kenneth Graunke [Thu, 3 Jun 2010 22:07:34 +0000 (15:07 -0700)]
Set the type of ir_texture properly; infer it from the sampler type.
Kenneth Graunke [Thu, 27 May 2010 00:55:10 +0000 (17:55 -0700)]
ir_reader: Add support for reading ir_texture.
Kenneth Graunke [Thu, 27 May 2010 00:52:44 +0000 (17:52 -0700)]
ir_reader: Refactor reading of dereferences for later reuse.
Kenneth Graunke [Thu, 27 May 2010 00:42:03 +0000 (17:42 -0700)]
Add stub visitor support for ir_texture.
Kenneth Graunke [Wed, 26 May 2010 22:15:31 +0000 (15:15 -0700)]
ir_print_visitor: Add support for ir_texture.
Kenneth Graunke [Wed, 26 May 2010 23:41:47 +0000 (16:41 -0700)]
Add mappings between ir_texture_opcode and strings.
Ian Romanick [Thu, 29 Apr 2010 01:42:36 +0000 (18:42 -0700)]
Define IR instruction for texture look-ups
Ian Romanick [Wed, 9 Jun 2010 18:00:00 +0000 (11:00 -0700)]
Use array delete operator to delete an array
This was detected by valgrind. I think GCC still does the right
thing, but the C++ spec allows the compiler to do something
stupid... like crash or only delete the first entry in the array.
Ian Romanick [Tue, 8 Jun 2010 02:10:33 +0000 (19:10 -0700)]
Bump GL_MAX_TEXTURE_COORDS from 2 to 4
Every platform that supports GLSL sets GL_MAX_TEXTURE_COORDS to at
least 4, so hard-code 4 for now.
This causes the following tests to pass:
glslparsertest/glsl2/norsetto-bumptbn_sh_fp.vert
glslparsertest/glsl2/xreal-lighting-d-omni.vert
glslparsertest/glsl2/xreal-lighting-db-omni.vert
glslparsertest/glsl2/xreal-lighting-dbs-omni.vert
Ian Romanick [Tue, 8 Jun 2010 02:02:44 +0000 (19:02 -0700)]
Only allow global precision qualifier for int and float
This causes the following tests to pass:
glslparsertest/glsl2/precision-03.vert
Ian Romanick [Tue, 8 Jun 2010 01:55:41 +0000 (18:55 -0700)]
Fix parsing of precision qualifiers
This causes the following tests to pass:
glslparsertest/glsl2/precision-02.vert
glslparsertest/glsl2/precision-04.vert
glslparsertest/glsl2/precision-06.vert
This causes the following test to fail. This shader was previously
failing to compile, but it was failing for the wrong reasons.
glslparsertest/glsl2/precision-03.vert
Ian Romanick [Tue, 8 Jun 2010 01:53:06 +0000 (18:53 -0700)]
Don't process empty shaders
Some valid shaders, such as 'precision highp float;', evaluate to
empty sets of instructions. This causes some of the optimization
stages to enter infinite loops. Instead, don't bother processing the
empty ones.
Ian Romanick [Tue, 8 Jun 2010 01:49:48 +0000 (18:49 -0700)]
Generate an error on empty declaration lists
This causes an error for code such as 'float;'
Kenneth Graunke [Fri, 4 Jun 2010 19:56:15 +0000 (12:56 -0700)]
Check variable mode when comparing qualifier lists.
Fixes function-05.vert.
Ian Romanick [Wed, 2 Jun 2010 20:50:27 +0000 (13:50 -0700)]
ir_dereference_array always operates on an r-value
ir_dereference_array::array is always an r-value. If the dereference
is of a varaible, that r-value will be an ir_dereference_variable.
This simplifies the code a bit.
Ian Romanick [Wed, 2 Jun 2010 20:39:45 +0000 (13:39 -0700)]
There is no class ir_label, so there's no need for ir_instruction::as_label
Ian Romanick [Wed, 2 Jun 2010 20:13:40 +0000 (13:13 -0700)]
Remove some cruft from the Makefile
This was affecting the build, but the files don't actually exist.
Eric Anholt [Wed, 19 May 2010 21:09:04 +0000 (14:09 -0700)]
Add builtin gl_LightSource[].
Fixes gst-gl-bumper.vert parsing.
Eric Anholt [Wed, 19 May 2010 21:01:33 +0000 (14:01 -0700)]
builtins: Add support for reflect().
Fixes glsl-orangebook-ch06.frag parsing.
Eric Anholt [Wed, 19 May 2010 20:57:01 +0000 (13:57 -0700)]
builtins: Add ftransform().
Fixes glsl-orangebook-ch06-bump.vert.
Eric Anholt [Wed, 19 May 2010 20:38:15 +0000 (13:38 -0700)]
Allow arrays of floats as varyings.
The comment just above the code said arrays were OK, then it didn't
handle arrays. Whoops. Partially fixes CorrectUnsizedArray.frat.
Eric Anholt [Wed, 19 May 2010 20:30:14 +0000 (13:30 -0700)]
gl_Normal is a vec3 not a vec4.
Fixes CorrectSwizzle1.vert.
Eric Anholt [Wed, 19 May 2010 20:05:01 +0000 (13:05 -0700)]
builtins: Add the mix(gentype, gentype, float) variant.
The broken-in-mesa Regnum Online shader now parses, except for its
preprocessor usage.
Eric Anholt [Wed, 19 May 2010 17:38:37 +0000 (10:38 -0700)]
Handle GLSL 1.20 implicit type conversions.
We were nicely constructing a new expression for the implicit type
conversion, but then checking that the previous types matched instead
of the new expression's type. Fixes errors in Regnum Online shaders.
Eric Anholt [Wed, 19 May 2010 19:44:23 +0000 (12:44 -0700)]
builtins: Add atan().
Eric Anholt [Wed, 19 May 2010 19:19:54 +0000 (12:19 -0700)]
builtins: Add asin().
Eric Anholt [Wed, 12 May 2010 21:42:21 +0000 (14:42 -0700)]
ir_constant_expression: Handle several floating point unops.
Cleans up a bunch of pointless operations in a GStreamer fragment shader.
Eric Anholt [Wed, 12 May 2010 19:10:41 +0000 (12:10 -0700)]
ir_constant_variable: New pass to mark constant-assigned variables constant.
This removes a bunch of gratuitous moving around of constant values
from constructors. Makes a shader ir I was looking at for structure
handling almost readable.
Eric Anholt [Wed, 12 May 2010 19:15:40 +0000 (12:15 -0700)]
ir_constant_folding: Look at instructions in functions.
This was broken in the ir_label -> ir_function rework.
Eric Anholt [Tue, 11 May 2010 19:34:21 +0000 (12:34 -0700)]
ir_swizzle_swizzle: Reduce swizzle chains to a single swizzle.
Eric Anholt [Tue, 11 May 2010 18:31:09 +0000 (11:31 -0700)]
ir_vec_index_to_swizzle: Pass to convert indexing of vectors to swizzles.
This should remove the burden of handling constant vector indexing
well from backend codegen, and could help with swizzle optimizations.
Eric Anholt [Thu, 6 May 2010 21:48:20 +0000 (14:48 -0700)]
ir_expression_flattening: Handle flattening values out of swizzles, too.
Fixes an uninlined normalize() in CorrectSwizzle2.vert.
Eric Anholt [Tue, 1 Jun 2010 22:06:11 +0000 (15:06 -0700)]
ir_expression_flattening: Fix breakage from hierarchichal visitor.
Similar to other situations where the visitor pattern doesn't fit, in
this case we need the pointer to the base instruction in the
instruction stream for where to insert any new instructions we
generate (not the instruction in the tree we're looking at). By
removing the code for setting the base_ir, flattened expressions would
end up, for example, before the function definition where they had appeared.
Ian Romanick [Thu, 27 May 2010 01:58:27 +0000 (18:58 -0700)]
Reimplement ir_function_inlining_visitor using ir_hierarchical_vistor
Ian Romanick [Thu, 27 May 2010 00:04:19 +0000 (17:04 -0700)]
Reimplement ir_copy_propagation_visitor using ir_hierarchical_vistor
Ian Romanick [Wed, 26 May 2010 23:07:49 +0000 (16:07 -0700)]
Reimplement ir_expression_flattening_visitor using ir_hierarchical_vistor
Kenneth Graunke [Wed, 26 May 2010 22:20:59 +0000 (15:20 -0700)]
ir_reader: Read record_refs.
Also changes the print visitor to not emit extraneous parenthesis.
Kenneth Graunke [Wed, 26 May 2010 20:03:14 +0000 (13:03 -0700)]
ir_reader: Fix reading of array deferences and correct error messages.
Previously, the syntax was (array_ref <variable name> <index>), but the
subject is now a general rvalue (not a name). In particular, it might
be a (var_ref ...).
Also, remove "expected ... or (swiz)" from error messages; swiz is not
allowed inside a var_ref.