summaryrefslogtreecommitdiffstats
path: root/src/glsl
Commit message (Collapse)AuthorAgeFilesLines
* glsl: add support for shader stencil exportDave Airlie2010-10-133-0/+28
| | | | | This adds proper support for the GL_ARB_shader_stencil_export extension to the GLSL compiler. Thanks to Ian for pointing out where I need to add things.
* glsl2: fix signed/unsigned comparison warningBrian Paul2010-10-121-1/+1
|
* glsl: Changes in generated file glsl_lexer.cppChad Versace2010-10-111-691/+716
| | | | Signed-off-by: Ian Romanick <[email protected]>
* glsl: Add lexer rules for uint and uvecN (N=2..4)Chad Versace2010-10-111-0/+4
| | | | | | Commit for generated file glsl_lexer.cpp follows this commit. Reviewed-by: Ian Romanick <[email protected]>
* glsl: Add glsl_type::uvecN_type for N=2,3Chad Versace2010-10-112-0/+4
| | | | Reviewed-by: Ian Romanick <[email protected]>
* glsl: Remove const decoration from inlined function parametersIan Romanick2010-10-081-0/+7
| | | | | | | | | | | The constness of the function parameter gets inlined with the rest of the function. However, there is also an assignment to the parameter. If this occurs inside a loop the loop analysis code will get confused by the assignment to a read-only variable. Fixes bugzilla #30552. NOTE: this is a candidate for the 7.9 branch.
* glsl: Add linker support for explicit attribute locationsIan Romanick2010-10-083-4/+48
|
* glsl: Track explicit location in AST to IR translationIan Romanick2010-10-084-0/+60
|
* glsl: Regenerate files changes by previous commitIan Romanick2010-10-082-902/+956
|
* glsl: Add parser support for GL_ARB_explicit_attrib_location layoutsIan Romanick2010-10-085-4/+75
| | | | | Only layout(location=#) is supported. Setting the index requires GLSL 1.30 and GL_ARB_blend_func_extended.
* glcpp: Regenerate files changes by previous commitIan Romanick2010-10-082-124/+120
|
* glcpp: Add the define for ARB_explicit_attrib_location when presentIan Romanick2010-10-081-0/+3
|
* glsl: Regenerate files modified by previous commitsIan Romanick2010-10-083-1412/+1431
|
* glsl: Wrap ast_type_qualifier contents in a struct in a unionIan Romanick2010-10-085-100/+109
| | | | This will ease adding non-bit fields in the near future.
* glsl: Clear type_qualifier using memsetIan Romanick2010-10-081-19/+86
|
* glsl: Slight refactor of error / warning checking for ARB_fcc layoutIan Romanick2010-10-081-9/+7
|
* glsl: Refactor 'layout' grammar to match GLSL 1.60 spec grammarIan Romanick2010-10-081-10/+21
|
* glsl: Fail linking if assign_attribute_locations failsIan Romanick2010-10-081-1/+3
|
* glsl: Remove unnecessary header.Vinson Lee2010-10-011-1/+0
|
* glsl: Add a lowering pass for texture projection.Eric Anholt2010-09-303-0/+102
|
* glsl: "Copyright", not "Constantright"Kenneth Graunke2010-09-281-1/+1
| | | | | Clearly this started out as ir_copy_propagation.cpp, but the search and replace was a bit overzealous.
* glsl: Also update implicit sizes of varyings at link time.Eric Anholt2010-09-281-4/+7
| | | | | | Otherwise, we'll often end up with gl_TexCoord being 0 length, for example. With ir_to_mesa, things ended up working out anyway, as long as multiple implicitly-sized arrays weren't involved.
* glsl: Add validation that a swizzle only references valid channels.Eric Anholt2010-09-271-0/+18
| | | | Caught the bug in the previous commit.
* glsl: Fix broadcast_index of lower_variable_index_to_cond_assign.Eric Anholt2010-09-271-1/+1
| | | | | | | | | | It's trying to get an int smeared across all channels, not trying to get a 1:1 mapping of a subset of a vector's channels. This usually ended up not mattering with ir_to_mesa, since it just smears floats into every chan of a vec4. Fixes: glsl1-temp array with swizzled variable indexing
* glsl: Fix copy'n'wasted ir_noop_swizzle conditions.Eric Anholt2010-09-221-2/+2
| | | | It considered .xyyy a noop for vec4 instead of .xyzw, and similar for vec3.
* glsl: Rework assignments with write_masks to have LHS chan count match RHS.Eric Anholt2010-09-2210-111/+154
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It turns out that most people new to this IR are surprised when an assignment to (say) 3 components on the LHS takes 4 components on the RHS. It also makes for quite strange IR output: (assign (constant bool (1)) (x) (var_ref color) (swiz x (var_ref v) )) (assign (constant bool (1)) (y) (var_ref color) (swiz yy (var_ref v) )) (assign (constant bool (1)) (z) (var_ref color) (swiz zzz (var_ref v) )) But even worse, even we get it wrong, as shown by this line of our current step(float, vec4): (assign (constant bool (1)) (w) (var_ref t) (expression float b2f (expression bool >= (swiz w (var_ref x))(var_ref edge)))) where we try to assign a float to the writemasked-out x channel and don't supply anything for the actual w channel we're writing. Drivers right now just get lucky since ir_to_mesa spams the float value across all the source channels of a vec4. Instead, the RHS will now have a number of components equal to the number of components actually being written. Hopefully this confuses everyone less, and it also makes codegen for a scalar target simpler. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl2: fix typo in error msgBrian Paul2010-09-211-1/+1
|
* glsl: Add definition of gl_TextureMatrix inverse/transpose builtins.Eric Anholt2010-09-211-0/+3
| | | | | Fixes glsl2/builtin-texturematrix. Bug #30196.
* glsl: Fix broken handling of ir_binop_equal and ir_binop_nequal.Kenneth Graunke2010-09-201-25/+30
| | | | | | | | When ir_binop_all_equal and ir_binop_any_nequal were introduced, the meaning of these two opcodes changed to return vectors rather than a single scalar, but the constant expression handling code was incorrectly written and only worked for scalars. As a result, only the first component of the returned vector would be properly initialized.
* glsl: Add comments to clarify the types of comparison binops.Kenneth Graunke2010-09-201-1/+2
|
* glsl2: silence compiler warnings in printf() callsBrian Paul2010-09-201-2/+4
| | | | | Such as: "ir_validate.cpp:143: warning: format ‘%p’ expects type ‘void*’, but argument 2 has type ‘ir_variable*’"
* glsl: Add doxygen commentsIan Romanick2010-09-202-12/+121
|
* glsl/builtins: Switch comparison functions to just return an expression.Kenneth Graunke2010-09-185-360/+72
|
* glsl/builtins: Fix equal and notEqual builtins.Kenneth Graunke2010-09-183-48/+48
| | | | | Commit 309cd4115b7cba669a0bf858e7809cb6dae90ddf incorrectly converted these to all_equal and any_nequal, which is the wrong operation.
* glsl: Properly handle nested structure types.Kenneth Graunke2010-09-182-25/+11
| | | | Fixes piglit test CorrectFull.frag.
* glsl2: Fixed cloning of ir_call error instructions.Tilman Sauerbeck2010-09-181-0/+3
| | | | | | | Those have the callee field set to the null pointer, so calling the public constructor will segfault. Signed-off-by: Tilman Sauerbeck <[email protected]>
* glsl: Fix 'control reaches end of non-void function' warning.Vinson Lee2010-09-181-0/+1
| | | | | | | | | | | Fixes this GCC warning. lower_variable_index_to_cond_assign.cpp: In member function 'bool variable_index_to_cond_assign_visitor::needs_lowering(ir_dereference_array*) const': lower_variable_index_to_cond_assign.cpp:261: warning: control reaches end of non-void function
* glsl2: Empty functions can be inlined.Tilman Sauerbeck2010-09-181-1/+4
| | | | | Signed-off-by: Tilman Sauerbeck <[email protected]> Signed-off-by: Kenneth Graunke <[email protected]>
* glsl2: Add flags to enable variable index loweringIan Romanick2010-09-172-8/+52
|
* glsl2: Refactor testing for whether a deref is of a matrix or arrayIan Romanick2010-09-171-11/+12
|
* glsl: add pass to lower variable array indexing to conditional assignmentsLuca Barbieri2010-09-175-0/+317
| | | | | | | | | | | | | | | | | | | | | | | | | | Currenly GLSL happily generates indirect addressing of any kind of arrays. Unfortunately DirectX 9 GPUs are not guaranteed to support any of them in general. This pass fixes that by lowering such constructs to a binary search on the values, followed at the end by vectorized generation of equality masks, and 4 conditional assignments for each mask generation. Note that this requires the ir_binop_equal change so that we can emit SEQ to generate the boolean masks. Unfortunately, ir_structure_splitting is too dumb to turn the resulting constant array references to individual variables, so this will need to be added too before this pass can actually be effective for temps. Several patches in the glsl2-lower-variable-indexing were squashed into this commit. These patches fix bugs in Luca's original implementation, and the individual patches can be seen in that branch. This was done to aid bisecting in the future. Signed-off-by: Ian Romanick <[email protected]>
* glsl: Don't print blank (function ...) headers for built-ins.Kenneth Graunke2010-09-161-0/+3
| | | | Fixes a regression caused when I added my GLSL ES support.
* glsl: Change from has_builtin_signature to has_user_signature.Kenneth Graunke2010-09-163-5/+5
| | | | | The print visitor needs this, and the only existing user can work with has_user_signature just as well.
* glsl: Fix 'format not a string literal and no format arguments' warning.Vinson Lee2010-09-151-1/+1
| | | | | | Fix the following GCC warning. loop_controls.cpp: In function 'int calculate_iterations(ir_rvalue*, ir_rvalue*, ir_rvalue*, ir_expression_operation)': loop_controls.cpp:88: warning: format not a string literal and no format arguments
* glsl2: add case for ir_unop_noiseBrian Paul2010-09-141-0/+4
| | | | | Silences a compiler warning. Still need to add some assertions for this case.
* glsl2: fix commentsBrian Paul2010-09-143-3/+3
|
* glsl2: Port equal() and notEqual() to ir_unop_all_equal and ir_unop_any_nequalIan Romanick2010-09-133-240/+48
|
* glsl: introduce ir_binop_all_equal and ir_binop_any_equal, allow vector cmpsLuca Barbieri2010-09-137-22/+67
| | | | | | | | | | | | | | | | | Currently GLSL IR forbids any vector comparisons, and defines "ir_binop_equal" and "ir_binop_nequal" to compare all elements and give a single bool. This is highly unintuitive and prevents generation of optimal Mesa IR. Hence, first rename "ir_binop_equal" to "ir_binop_all_equal" and "ir_binop_nequal" to "ir_binop_any_nequal". Second, readd "ir_binop_equal" and "ir_binop_nequal" with the same semantics as less, lequal, etc. Third, allow all comparisons to acts on vectors. Signed-off-by: Ian Romanick <[email protected]>
* loop_unroll: unroll loops with (lowered) breaksLuca Barbieri2010-09-131-4/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the loop ends with an if with one break or in a single break unroll it. Loops that end with a continue will have that continue removed by the redundant jump optimizer. Likewise loops that end with an if-statement with a break at the end of both branches will have the break pulled out after the if-statement. Loops of the form for (...) { do_something1(); if (cond) { do_something2(); break; } else { do_something3(); } } will be unrolled as do_something1(); if (cond) { do_something2(); } else { do_something3(); do_something1(); if (cond) { do_something2(); } else { do_something3(); /* Repeat inserting iterations here.*/ } } ir_lower_jumps can guarantee that all loops are put in this form and thus all loops are now potentially unrollable if an upper bound on the number of iterations can be found. Signed-off-by: Ian Romanick <[email protected]>
* glsl2: Add pass to remove redundant jumpsIan Romanick2010-09-136-1/+118
|