summaryrefslogtreecommitdiff
path: root/src/glsl
AgeCommit message (Collapse)Author
2010-12-02glsl: Fix flipped return of has_value() for array constants.Eric Anholt
Fixes glsl-array-uniform.
2010-12-01glsl: Fix linker bug in cross_validate_globals()Chad Versace
Cause linking to fail if a global has mismatching invariant qualifiers. See https://bugs.freedesktop.org/show_bug.cgi?id=30261
2010-12-01glsl: Mark the array access for whole-array comparisons.Eric Anholt
By not doing so, the uniform contents of glsl-uniform-non-uniform-array-compare.shader_test was getting thrown out since nobody was recorded as dereferencing the array.
2010-12-01glsl: Lower ir_binop_pow to a sequence of EXP2 and LOG2Ian Romanick
2010-12-01glsl: Use M_LOG2E constant instead of calling log2Ian Romanick
2010-12-01glsl: Add comments to lower_jumps (from the commit message).Kenneth Graunke
This is essentially Luca's commit message, but placed at the top of the file.
2010-12-01glsl: Remove "discard" support from lower_jumps.Kenneth Graunke
The new lower_discard and opt_discard_simplification passes should handle all the necessary transformations, so lower_jumps doesn't need to support it. Also, lower_jumps incorrectly handled conditional discards - it would unconditionally truncate all code after the discard. Rather than fixing the bug, simply remove the code. NOTE: This is a candidate for the 7.9 branch.
2010-12-01glsl: Add a lowering pass to move discards out of if-statements.Kenneth Graunke
This should allow lower_if_to_cond_assign to work in the presence of discards, fixing bug #31690 and likely #31983. NOTE: This is a candidate for the 7.9 branch.
2010-12-01glsl: Add an optimization pass to simplify discards.Kenneth Graunke
NOTE: This is a candidate for the 7.9 branch.
2010-11-30glsl/linker: Free any IR discarded by optimization passes.Kenneth Graunke
Previously, IR for a linked shader was allocated directly out of the gl_shader object - meaning all of it lived as long as the shader. Now, IR is allocated out of a temporary context, and any -live- IR is reparented/stolen to (effectively) the gl_shader. Any remaining IR can be freed. NOTE: This is a candidate for the 7.9 branch.
2010-11-30glsl: Remove anti-built-in hacks from the print visitor.Kenneth Graunke
Now that we only import built-in signatures that are actually used, printing them is reasonable.
2010-11-30glsl: Lazily import built-in function prototypes.Kenneth Graunke
This makes a very simple 1.30 shader go from 196k of memory to 9k. NOTE: This -may- be a candidate for the 7.9 branch, as the benefit is substantial. However, it's not a simple change, so it may be wiser to wait for 7.10.
2010-11-30glsl: Refactor out cloning of function prototypes.Kenneth Graunke
This allows us to reuse some code and will be useful later.
2010-11-30glsl: fix matrix type check in ir_algebraicAras Pranckevicius
Fixes glsl-mat-mul-1.
2010-11-30glsl: Quiet unreachable no-return-from-function warning.Eric Anholt
2010-11-30glsl: Fix structure and array comparisions.Eric Anholt
We were trying to emit a single ir_expression to compare the whole thing. The backends (ir_to_mesa.cpp and brw_fs.cpp so far) expected ir_binop_any_nequal or ir_binop_all_equal to apply to at most a vector (with matrices broken down by the lowering pass). Break them down to a bunch of ORed or ANDed any_nequals/all_equals. Fixes: glsl-array-compare glsl-array-compare-02 glsl-fs-struct-equal glsl-fs-struct-notequal Bug #31909
2010-11-30glsl: Add a helper constructor for expressions that works out result type.Eric Anholt
This doesn't cover all expressions or all operand types, but it will complain if you overreach and it allows for much greater slack on the programmer's part.
2010-11-29glsl: Make the symbol table's add_variable just use the variable's name.Eric Anholt
2010-11-29glsl: Make the symbol table's add_function just use the function's name.Eric Anholt
2010-11-25glsl: Add a virtual as_discard() method.Kenneth Graunke
NOTE: This is candidate for the 7.9 branch.
2010-11-25glsl: Use do_common_optimization in the standalone compiler.Kenneth Graunke
NOTE: This is a candidate for the 7.9 branch.
2010-11-25glsl: Don't inline function prototypes.Kenneth Graunke
Currently, the standalone compiler tries to do function inlining before linking shaders (including linking against the built-in functions). This resulted in the built-in function _prototypes_ being inlined rather than the actual function definition. This is only known to fix a bug in the standalone compiler; most programs should be unaffected. Still, it seems like a good idea. NOTE: This is a candidate for the 7.9 branch.
2010-11-19glsl: Add a helper function for determining if an rvalue could be a saturate.Eric Anholt
Hardware pretty commonly has saturate modifiers on instructions, and this can be used in codegen to produce those, without everyone else needing to understand clamping other than min and max.
2010-11-19glsl: Fix type of label 'default' in switch statement.Vinson Lee
2010-11-19glsl: Add lower_vector.cpp to SConscript.Vinson Lee
2010-11-19glsl: Fix matrix constructors with vector parametersIan Romanick
When the semantics of write masks in assignments were changed, this code was not correctly updated. Fixes piglit test glsl-mat-from-vec-ctor-01.
2010-11-19glsl: Combine many instruction lowering passes into one.Kenneth Graunke
This should save on the overhead of tree-walking and provide a convenient place to add more instruction lowering in the future. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2010-11-19glsl: Simplify a type check by using type->is_integer().Kenneth Graunke
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.