summaryrefslogtreecommitdiff
path: root/src/glsl
AgeCommit message (Collapse)Author
2010-11-19glsl: Add ir_quadop_vector expressionIan Romanick
The vector operator collects 2, 3, or 4 scalar components into a vector. Doing this has several advantages. First, it will make ud-chain tracking for components of vectors much easier. Second, a later optimization pass could collect scalars into vectors to allow generation of SWZ instructions (or similar as operands to other instructions on R200 and i915). It also enables an easy way to generate IR for SWZ instructions in the ARB_vertex_program assembler.
2010-11-19glsl: Add unary ir_expression constructorIan Romanick
2010-11-19glsl: Add ir_rvalue::is_negative_one predicateIan Romanick
2010-11-19glsl: Eliminate assumptions about size of ir_expression::operandsIan Romanick
This may grow in the near future.
2010-11-19glsl: Add ir_unop_sin_reduced and ir_unop_cos_reducedIan Romanick
The operate just like ir_unop_sin and ir_unop_cos except that they expect their inputs to be limited to the range [-pi, pi]. Several GPUs require this limited range for their sine and cosine instructions, so having these as operations (along with a to-be-written lowering pass) helps this architectures. These new operations also matche the semantics of the GL_ARB_fragment_program SCS instruction. Having these as operations helps in generating GLSL IR directly from assembly fragment programs.
2010-11-18glsl: Make is_zero and is_one virtual methods of ir_rvalueIan Romanick
This eliminates the need in some cames to validate that an rvalue is an ir_constant before checking to see if it's 0 or 1.
2010-11-17glsl: Fix 'control reaches end of non-void function' warning.Vinson Lee
Fix this GCC warning. ir.cpp: In static member function 'static unsigned int ir_expression::get_num_operands(ir_expression_operation)': ir.cpp:199: warning: control reaches end of non-void function
2010-11-17glsl: Improve usage message for glsl_compilerChad Versace
The new usage message lists possible command line options. (Newcomers to Mesa currently have to trawl through the source to find the command line options, and we should save them from that trouble.) Example Output -------------- usage: ./glsl_compiler [options] <file.vert | file.geom | file.frag> Possible options are: --glsl-es --dump-ast --dump-hir --dump-lir --link
2010-11-17glsl: Refactor get_num_operands.Kenneth Graunke
This adds sentinel values to the ir_expression_operation enum type: ir_last_unop, ir_last_binop, and ir_last_opcode. They are set to the previous one so they don't trigger "unhandled case in switch statement" warnings, but should never be handled directly. This allows us to remove the huge array of 1s and 2s in ir_expression::get_num_operands().
2010-11-17glsl: Remove the ir_binop_cross opcode.Kenneth Graunke
2010-11-17Refresh autogenerated file builtin_function.cpp.Kenneth Graunke
2010-11-17glsl: Reimplement the "cross" built-in without ir_binop_cross.Kenneth Graunke
We are not aware of any GPU that actually implements the cross product as a single instruction. Hence, there's no need for it to be an opcode. Future commits will remove it entirely.
2010-11-17Regenerate glcpp parser.Kenneth Graunke
2010-11-17glsl: Unconditionally define GL_FRAGMENT_PRECISION_HIGH in ES2 shaders.Kenneth Graunke
This is really supposed to be defined only if the driver supports highp in the fragment shader - but all of our current ES2 implementations do. So, just define it. In the future, we'll need to add a flag to gl_context and only define the macro if the flag is set. "Fixes" freedesktop.org bug #31673.
2010-11-17glsl: Fix Doxygen tag \file in recently renamed filesChad Versace
2010-11-17glsl: Fix erroneous cast in ast_jump_statement::hir()Chad Versace
Return values were erroneously cast from (ir_rvalue*) to (ir_expression*). NOTE: This is a candidate for the 7.9 branch.
2010-11-17glsl: Fix constant expression handling for <, >, <=, >= on vectors.Kenneth Graunke
ir_binop_less, ir_binop_greater, ir_binop_lequal, and ir_binop_gequal are defined to work on vectors as well as scalars, as long as the two operands have the same type. This is evident from both ir_validate.cpp and our use of these opcodes in the GLSL lessThan, greaterThan, lessThanEqual, greaterThanEqual built-in functions. Found by code inspection. Not known to fix any bugs. Presumably, our tests for the built-in comparison functions must pass because C.E. handling is done on the ir_call of "greaterThan" rather than the inlined opcode. The C.E. handling of the built-in function calls is correct. NOTE: This is a candidate for the 7.9 branch.
2010-11-16Refresh autogenerated glcpp parser.Kenneth Graunke
2010-11-16glcpp: Define GL_FRAGMENT_PRECISION_HIGH if GLSL version >= 1.30.Kenneth Graunke
Per section 4.5.4 of the GLSL 1.30 specification.
2010-11-16glsl: Simplify generation of swizzle for vector constructorsIan Romanick
2010-11-16glsl: Refactor is_vec_{zero,one} to be methods of ir_constantIan Romanick
These predicates will be used in other places soon.
2010-11-15glsl: Add ir_constant_expression.cpp to SConscript.Vinson Lee
This was accidentally removed in commit 32aaf89823de11e98cb59d5ec78c66cd3e74bcd4. Fixes SCons builds.
2010-11-15glsl: remove opt_constant_expression.cpp from SConscriptBrian Paul
And alphabetize the opt_* files.
2010-11-15glsl: fix assorted MSVC warningsBrian Paul
2010-11-15glsl: Rename various ir_* files to lower_* and opt_*.Kenneth Graunke
This helps distinguish between lowering passes, optimization passes, and other compiler code.
2010-11-15glsl: Remove unused and out of date Makefile.am.Kenneth Graunke
This was from when glsl2 lived in a separate repository and used automake.
2010-11-15glsl: Add constant expression handling for asinh, acosh, and atanh.Kenneth Graunke
2010-11-15glsl: Refresh autogenerated file builtin_function.cpp.Kenneth Graunke
2010-11-15glsl: Implement the asinh, acosh, and atanh built-in functions.Kenneth Graunke
2010-11-15generate_builtins.py: Fix inconsistent use of tabs and spaces warning.Kenneth Graunke
2010-11-15glsl: Refresh autogenerated lexer and parser files.Kenneth Graunke
For the last three commits.
2010-11-15glsl: Add support for the 'u' and 'U' unsigned integer suffixes.Kenneth Graunke
2010-11-15glsl: Add new keywords and reserved words for GLSL 1.30.Kenneth Graunke
2010-11-15glsl: Rework reserved word/keyword handling in the lexer.Kenneth Graunke
This consolidates the TOKEN_OR_IDENTIFIER and RESERVED_WORD macros into a single KEYWORD macro. The old TOKEN_OR_IDENTIFIER macros handled the case of a word going from an identifier to a keyword; the RESERVED_WORD macro handled a word going from a reserved word to a language keyword. However, neither could properly handle samplerBuffer (for example), which is an identifier in 1.10 and 1.20, a reserved word in 1.30, and a keyword in 1.40 and on. Furthermore, the existing macros didn't properly handle reserved words in GLSL ES 1.00. The best they could do was return a token (rather than an identifier), resulting in an obtuse parser error, rather than a user-friendly "you used a reserved word" error message.
2010-11-15glsl: Convert glsl_type::base_type from #define'd constants to an enum.Kenneth Graunke
This is nice because printing type->base_type in GDB will now give you a readable name instead of a number.
2010-11-15glsl: Remove GLSL_TYPE_FUNCTION define.Kenneth Graunke
Functions are not first class objects in GLSL, so there is never a value of function type. No code actually used this except for one function which asserted it shouldn't occur. One comment mentioned it, but was incorrect. So we may as well remove it entirely.
2010-11-11glsl: Free the loop state context when we free the loop state.Eric Anholt
Since this was talloced off of NULL instead of the compile state, it was a real leak over the course of the program. Noticed with valgrind --leak-check=full --show-reachable=yes. We should really change these passes to generally get the compile context as an argument so simple mistakes like this stop mattering.
2010-11-11glsl: fix crash in loop analysis when some controls can't be determinedAras Pranckevicius
Fixes loop-07.frag.
2010-11-09glsl: Remove unnecessary "unused variable" warning suppression.Kenneth Graunke
The "instructions" variable -is- used, so the cast to void can go away.
2010-11-09glsl: Fix incorrect gl_type of sampler2DArray and sampler1DArrayShadowIan Romanick
NOTE: this is a candidate for the 7.9 branch.
2010-11-09glsl: Fix ir_expression::constant_expression_value()Chad Versace
When the type of the ir_expression is error_type, return NULL. This fixes bug 31371.
2010-11-08ir_dead_functions: Actually free dead functions and signatures.Kenneth Graunke
This makes linked shaders use around 36k less memory since the built-in prototypes are now freed.
2010-11-08r600g: implement texture_get_handle (needed for eglExportDRMImageMESA)Benjamin Franzke
2010-11-03ir_reader: Fix some potential NULL pointer dereferences.Kenneth Graunke
Found by inspection.
2010-11-03ir_reader: Remove useless error check.Kenneth Graunke
It's already been determined that length == 3, so clearly swiz->next is a valid S-Expression.
2010-11-03ir_reader: Return a specific ir_dereference variant.Kenneth Graunke
There's really no reason to return the base class when we have more specific information about what type it is.
2010-11-03glsl: Don't print a useless space at the end of an S-Expression list.Kenneth Graunke
We really only want to print spaces -between- elements, not after each element. This cleans up error messages from IR reader, making them (mildly) easier to read.
2010-11-03Refresh autogenerated file builtin_function.cpp.Kenneth Graunke
2010-11-03glsl/builtins: Clean up some ugly autogenerated code in atan.Kenneth Graunke
In particular, calling the abs function is silly, since there's already an expression opcode for that. Also, assigning to temporaries then assigning those to the final location is rather redundant.
2010-11-03glsl/builtins: Rename 'x' to 'y_over_x' in atan(float) implementation.Kenneth Graunke
For consistency with the vec2/vec3/vec4 variants.