summaryrefslogtreecommitdiffstats
path: root/src/glsl
Commit message (Collapse)AuthorAgeFilesLines
* glsl: Fix typo in comment.Chris Forbes2014-06-121-1/+1
| | | | Signed-off-by: Chris Forbes <[email protected]>
* glsl: Store gl_uniform_driver_storage::format as the actual typeIan Romanick2014-06-111-5/+2
| | | | | | | | And delete the incorrect comment. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* glsl: Remove unused include in expr.flatt.Thomas Helland2014-06-101-2/+0
| | | | | | | | Found with IWYU. Compile-tested on my Ivy-bridge system. Reviewed-by: Tom Stellard <[email protected]> Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Thomas Helland <[email protected]>
* glsl: Remove unused include in ir.cppThomas Helland2014-06-101-1/+0
| | | | | | | | Found with IWYU. Compile-tested on my Ivy-bridge system. Reviewed-by: Tom Stellard <[email protected]> Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Thomas Helland <[email protected]>
* glsl: Remove unused include from ir_constant_expression.cppThomas Helland2014-06-101-1/+0
| | | | | | | | Found with IWYU. Compile-tested on my Ivy-bridge system. Reviewed-by: Tom Stellard <[email protected]> Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Thomas Helland <[email protected]>
* glsl: Remove unused include from ir_basic_block.cppThomas Helland2014-06-101-2/+0
| | | | | | | | Found with IWYU. Compile-tested on my Ivy-bridge system. Reviewed-by: Tom Stellard <[email protected]> Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Thomas Helland <[email protected]>
* glsl: Remove unused include from hir_field_selection.cppThomas Helland2014-06-101-1/+0
| | | | | | | | Found with IWYU. Compile-tested on my Ivy-bridge system Reviewed-by: Tom Stellard <[email protected]> Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Thomas Helland <[email protected]>
* glsl: Remove unused include from glsl_symbol_table.hThomas Helland2014-06-101-1/+1
| | | | | | | | | | | | | Only function-defs use glsl_type so forward declare instead. Compile-tested on my Ivy-bridge system. IWYU also suggests removing #include <new>, and this compiles fine. I'm not familiar enough with memory management in C/C++ that I feel comfortable removing this. Insights would be appreciated. Reviewed-by: Tom Stellard <[email protected]> Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Thomas Helland <[email protected]>
* glsl: Remove unused include from glsl_types.cppThomas Helland2014-06-101-3/+1
| | | | | | | | | Found with IWYU. Compile-tested on my Ivy-bridge system. Added comment about core.h being used for MAX2. Reviewed-by: Tom Stellard <[email protected]> Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Thomas Helland <[email protected]>
* glsl: Remove unused include from builtin_variables.cppThomas Helland2014-06-101-1/+0
| | | | | | | | Found with IWYU. Compile-tested on my Ivy-bridge system. Reviewed-by: Tom Stellard <[email protected]> Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Thomas Helland <[email protected]>
* glsl: Remove unused include in ast_to_hir.cppThomas Helland2014-06-101-1/+0
| | | | | | | | | | Found with IWYU. Comment says it's for struct gl_extensions. Grepping for gl_extensions shows no uses. Tested by compiling on my Ivy-bridge system. Reviewed-by: Tom Stellard <[email protected]> Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Thomas Helland <[email protected]>
* glsl: Remove unused includes in link_uniform_block_active_visitor.hThomas Helland2014-06-101-2/+0
| | | | | | | | | Found with IWYU, compile-tested on my Ivy-bridge system. This is not used in the header, and is included in the source. Reviewed-by: Tom Stellard <[email protected]> Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Thomas Helland <[email protected]>
* glsl: Remove unused includes in link_uniform_init.Thomas Helland2014-06-101-2/+0
| | | | | | | | | | | | Found with IWYU, confirmed with grepping for "hash" and "symbol". No negative effects on compilation. IWYU also reported core.h and linker.h could be removed, but I'm unsure if those are false positives. Reviewed-by: Tom Stellard <[email protected]> Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Thomas Helland <[email protected]>
* glsl: Add an exec_node_init() function, usable from C.Matt Turner2014-06-101-0/+7
| | | | Reviewed-by: Ian Romanick <[email protected]>
* glsl: Make foreach macros usable from C by adding struct keyword.Matt Turner2014-06-101-11/+11
| | | | Reviewed-by: Ian Romanick <[email protected]>
* glsl: Make exec_list members just wrap the C API.Matt Turner2014-06-101-77/+13
| | | | Reviewed-by: Ian Romanick <[email protected]>
* glsl: Make exec_node members just wrap the C API.Matt Turner2014-06-101-27/+11
| | | | Reviewed-by: Ian Romanick <[email protected]>
* glsl: Add C API for exec_list.Matt Turner2014-06-101-0/+141
| | | | Reviewed-by: Ian Romanick <[email protected]>
* glsl: Add C API for exec_node.Matt Turner2014-06-101-0/+82
| | | | Reviewed-by: Ian Romanick <[email protected]>
* glsl: Move definition of exec_list member functions out of the struct.Matt Turner2014-06-101-108/+127
| | | | Reviewed-by: Ian Romanick <[email protected]>
* glsl: Move definition of exec_node member functions out of the struct.Matt Turner2014-06-101-62/+83
| | | | Reviewed-by: Ian Romanick <[email protected]>
* glsl: Validate aux storage qualifier combination with other qualifiers.Chris Forbes2014-06-101-39/+37
| | | | | | | | | | | | | | | | | | | We've been allowing `centroid` and `sample` in all kinds of weird places where they're not valid. Insist that `sample` is combined with `in` or `out`; and that `centroid` is combined with `in`, `out`, or the deprecated `varying`. V2: Validate this in a more sensible place. This does require an extra case for uniform blocks members and struct members, though, since they don't go through the normal path. V3: Improve error message wording; eliminate redundant error generation for inputs in VS or outputs in FS. Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Implement overload resolution for ARB_gpu_shader5Chris Forbes2014-06-041-0/+71
| | | | | | | V3: Move spec citation into the code. Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* glsl: Add support for comparing function parameter conversionsChris Forbes2014-06-041-3/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | The ARB_gpu_shader5 spec says: "To determine whether the conversion for a single argument in one match is better than that for another match, the following rules are applied, in order: 1. An exact match is better than a match involving any implicit conversion. 2. A match involving an implicit conversion from float to double is better than a match involving any other implicit conversion. 3. A match involving an implicit conversion from either int or uint to float is better than a match involving an implicit conversion from either int or uint to double. If none of the rules above apply to a particular pair of conversions, neither conversion is considered better than the other." V3: Add spec citation, including oddball difference between gs5 and GLSL 4.0; comment a bit better as per Jordan's suggestions. Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* glsl: Build a list of inexact function matchesChris Forbes2014-06-041-11/+32
| | | | | | | | | This will facilitate GLSL 4.0 / ARB_gpu_shader5's enhanced overload resolution rules, and also possibly better error reporting for ambiguous function calls. Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* glsl: Allow int -> uint implicit conversions on function parametersChris Forbes2014-06-041-3/+16
| | | | | | | | | V2: Fix crashes during linking, where the parse state is NULL. In this case, all required checks have already been done, so we assume the extension is enabled. Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Pass parse state to can_implicitly_convert_to()Chris Forbes2014-06-044-6/+8
| | | | | Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Pass parse state to parameter_lists_match()Chris Forbes2014-06-041-2/+3
| | | | | | | | The available implicit conversions depend on the GLSL version we're compiling. Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Add support for int -> uint implicit conversionsChris Forbes2014-06-041-0/+8
| | | | | | | This is required for ARB_gpu_shader5. Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Clean up apply_implicit_conversionChris Forbes2014-06-041-27/+31
| | | | | | | | | | | | | | | We're about to add new implicit conversions, first for ARB_gpu_shader5, and then later for ARB_gpu_shader_fp64. Pull out the opcode determination into its own function, and get rid of the bool -> float case that could never be hit anyway [since it fails the is_numeric() check]. V2: Retain the vector width mangling. It turns out this is necessary for the conversions done (and then thrown away) when determining the return type of arithmetic operators. Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Allow `precise` as a parameter qualifierChris Forbes2014-06-041-2/+10
| | | | | Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* glsl: Disallow `precise` redeclarations of vars from outer scopesChris Forbes2014-06-041-0/+9
| | | | | Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* glsl: Add support for `precise` redeclarationsChris Forbes2014-06-044-7/+47
| | | | | | | | This works like glsl-1.20+'s invariant redeclarations, but with fewer restrictions, since `precise` is allowed on pretty much anything. Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* glsl: add support for `precise` in type_qualifierChris Forbes2014-06-045-8/+48
| | | | | Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* glsl: remove outdated comment, move sample to correct blockChris Forbes2014-06-041-3/+3
| | | | | Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* glsl: Make most ir_instruction::as_subclass() functions non-virtual.Matt Turner2014-06-031-109/+52
| | | | | | | | | | | | | | | | | | | | | | | | There are several common ways to check whether an object is a particular subclass: dynamic_cast<>, the as_subclass() pattern, or explicit enum tags. We originally used the virtual as_subclass methods, but later added enum tags as they are much nicer for debugging. Since we have the enum tags, we don't necessarily need to use virtual functions to implement the as_subclass() methods. We can just check the tag and return the pointer or NULL. This saves 18 entries in the vtable, and instead of two pointer dereferences per as_subclass() call most are only three inline instructions. Compile time of sam3/112.frag (the longest compile in a recent shader-db run) is reduced by 5% from 348 to 329 ms (n=500). perf stat of this workload shows: 24.14% reduction in iTLB-loads: 285,543 -> 216,606 42.55% reduction in iTLB-load-misses: 18,785 -> 10,792 Reviewed-by: Juha-Pekka Heikkila <[email protected]>
* glsl: Move ir_type_unset to end of enumeration.Matt Turner2014-06-032-7/+3
| | | | | | | | Now that the constructors set a type, ir_type_unset is not very useful. Move it to the end of the enum (specifically out of position 0) so that enums checks for dereferences and rvalues can save an instruction. Reviewed-by: Juha-Pekka Heikkila <[email protected]>
* glsl: Reorder ir_type_* enum for easier comparisons.Matt Turner2014-06-031-7/+7
| | | | | | | | Makes checking whether an object is an ir_dereference, an ir_rvalue, or an ir_jump simpler. Since ir_dereference is a subclass or ir_rvalue, list its subtypes first so that they can both generate nice code. Reviewed-by: Juha-Pekka Heikkila <[email protected]>
* glsl: Remove useless call to as_rvalue().Matt Turner2014-06-031-1/+1
| | | | | | The type returned by hir() is already an ir_rvalue pointer. Reviewed-by: Juha-Pekka Heikkila <[email protected]>
* glsl: Set ir_instruction::ir_type in the base class constructorIan Romanick2014-06-032-54/+57
| | | | | | | | | | | | This has the added perk that if you forget to set ir_type in the constructor of a new subclass (or a new constructor of an existing subclass) the compiler will tell you... instead of relying on ir_validate or similar run-time detection. Reviewed-by: Juha-Pekka Heikkila <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Signed-off-by: Ian Romanick <[email protected]>
* scons: add common.c as part of glcpp buildTapani Pälli2014-05-301-1/+1
| | | | | | | | to have _mesa_error_no_memory function available Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79440 Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Juha-Pekka Heikkila <[email protected]>
* glcpp: link with tests/common.cTapani Pälli2014-05-301-0/+1
| | | | | | | So that prog_hash_table can use _mesa_error_no_memory function. Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Juha-Pekka Heikkila <[email protected]>
* glsl: Add null check in loop_analysis.cppJuha-Pekka Heikkila2014-05-301-2/+4
| | | | | | | Check return value from hash_table_find before using it as a pointer Signed-off-by: Juha-Pekka Heikkila <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl/tests: remove generated tests from the repoConnor Abbott2014-05-2849-696/+2
| | | | | | | | They were made unneccesary by the last commit. Signed-off-by: Connor Abbott <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl/tests: call create_test_cases.py in optimization-testConnor Abbott2014-05-281-0/+8
| | | | | | | | | | | | | | This way, when someone modifies create_test_cases.py and forgets to commit their changes again, people will notice. v2: make sure we parse the right directories and check for existance the right way. v3 (Ken): Use $PYTHON2 instead of calling python directly. Signed-off-by: Connor Abbott <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl/tests/lower_jumps: fix generated sexpr's for loopsConnor Abbott2014-05-281-1/+1
| | | | | | | | | | | | | | In 088494aa (as well as other commits in the series) Paul Berry modified the tests for lower_jumps to account for the fact that the s-expression for the loop IR instruction changed from (loop () () () () (statements...)) to (loop (statements...)), but he forgot to update create_test_cases.py which he used to create the tests. Fix that, so that now create_test_cases.py is synced with the generated tests. Signed-off-by: Connor Abbott <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: be more consistent about printing constantsConnor Abbott2014-05-2823-48/+40
| | | | | | | | | | | | Make sure that we print the same number of digits when printing 0.0 as any other floating-point number. This will make generating expected output files for tests easier. To avoid breaking "make check," update the generated tests for lower_jumps before the next commit which will bring create_test_cases.py in line with them. Signed-off-by: Connor Abbott <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: replace strncmp("gl_") calls with new is_gl_identifier() helperBrian Paul2014-05-285-9/+17
| | | | | | Makes things a little easier to read. Reviewed-by: Ian Romanick <[email protected]>
* glsl: fix use-after free bug/crash in ast_declarator_list::hir()Brian Paul2014-05-281-1/+5
| | | | | | | | | | | | | | The call to get_variable_being_redeclared() may delete 'var' so we can't reference var->name afterward. We fix that by examining the var's name before making that call. Fixes valgrind warnings and possible crash when running the piglit tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-in-param.shader_test test (and probably others). Cc: "10.1 10.2" <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Add C-callable fprint_ir function.Matt Turner2014-05-152-0/+10
| | | | | Acked-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>