summaryrefslogtreecommitdiffstats
path: root/src/glsl
Commit message (Collapse)AuthorAgeFilesLines
* glsl: Rebalance expression trees that are reduction operations.Matt Turner2014-06-194-0/+303
| | | | | | | | | | The intention of this pass was to give us better instruction scheduling opportunities, but it unexpectedly reduced some instruction counts as well: total instructions in shared programs: 1666639 -> 1666073 (-0.03%) instructions in affected programs: 54612 -> 54046 (-1.04%) (and trades 4 SIMD16 programs in SS3)
* glsl: Remove 'struct' from ir_variable declaration.Matt Turner2014-06-171-1/+1
| | | | | Reviewed-by: Tapani Pälli <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: type check between switch init-expression and caseTapani Pälli2014-06-171-3/+45
| | | | | | | | | | | Patch adds a type check between switch init-expression and case label and performs a implicit signed->unsigned type conversion when possible. v2: add GLSL spec reference, do implicit conversion if possible (Matt) Signed-off-by: Tapani Pälli <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79724 Reviewed-by: Matt Turner <[email protected]>
* glsl/cs: Fix local_size_y and local_size_zJordan Justen2014-06-161-1/+1
| | | | | | | | | | | | | | | flags.q.local_size has 3 bits. One each for x, y and z. Fixes piglit's: * spec/ARB_compute_shader/linker/mismatched_local_work_sizes * spec/ARB_compute_shader/compiler/default_local_size.comp * spec/ARB_compute_shader/compiler/work_group_size_too_large * spec/ARB_compute_shader/compiler/gl_WorkGroupSize_matches_layout.comp This was regressed in 738c9c3c. Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Chris Forbes <[email protected]>
* glsl: parser changes for GL_ARB_explicit_uniform_locationTapani Pälli2014-06-164-0/+54
| | | | | | | | | | | | Patch adds a preprocessor define for the extension and stores explicit location data for uniforms during AST->HIR conversion. It also sets layout token to be available when having the extension in place. v2: change parser check to require GLSL 330 or enabling GL_ARB_explicit_attrib_location (Ian) v3: fix the check and comment in AST->HIR (Petri) Signed-off-by: Tapani Pälli <[email protected]>
* glsl: add enable bit for ARB_explicit_uniform_locationTapani Pälli2014-06-162-0/+3
| | | | | Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl/linker: assign explicit uniform locationsTapani Pälli2014-06-161-5/+56
| | | | | | | | | | | | | | | | | | | Patch refactors the existing uniform processing so explicit locations are taken in to account during variable processing. These locations are temporarily stored in gl_uniform_storage before actual locations are set. UNMAPPED_UNIFORM_LOC marks unset location so that we can use 0 as a valid explicit location. When locations are set, UniformRemapTable is first populated with uniforms that have explicit location set (inactive and active ones), rest are put after explicit location slots. v2: introduce define for locations that have not been set yet (Ian) Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl/linker: initialize explicit uniform locationsTapani Pälli2014-06-162-0/+119
| | | | | | | | | | | Patch initializes the UniformRemapTable for explicit locations. This needs to happen before optimizations to make sure all inactive uniforms get their explicit locations correctly. v2: fix initialization bug, introduce define for inactive uniforms (Ian) Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: add glsl_type::uniform_locations() helper functionTapani Pälli2014-06-162-0/+32
| | | | | | | | This function calculates the number of unique values from glGetUniformLocation for the elements of the type. Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Fix clang mismatched-tags warnings with glsl_type.Vinson Lee2014-06-151-1/+1
| | | | | | | | | | | | | | | | | | Fix clang mismatched-tags warnings introduced with commit 4f5445a45d3ed02e00a061b10c943c0b079c6020. ./glsl_symbol_table.h:37:1: warning: class 'glsl_type' was previously declared as a struct [-Wmismatched-tags] class glsl_type; ^ ./glsl_types.h:86:8: note: previous use is here struct glsl_type { ^ ./glsl_symbol_table.h:37:1: note: did you mean struct here? class glsl_type; ^~~~~ Signed-off-by: Vinson Lee <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Correct more typosChris Forbes2014-06-152-2/+2
| | | | Signed-off-by: Chris Forbes <[email protected]>
* 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]>