aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler
Commit message (Collapse)AuthorAgeFilesLines
...
* spirv/nir: add offset at vtn_variableAlejandro Piñeiro2018-07-032-0/+4
| | | | | | | | | Also initialize it on var_decoration_cb This is equivalent to nir_variable.offset, used to store the location an atomic counter is stored at. Reviewed-by: Timothy Arceri <[email protected]>
* spirv/nir: SpvStorageClassAtomicCounter support on vtn_storage_class_to_modeAlejandro Piñeiro2018-07-031-1/+4
| | | | | | Atomic Counters are uniforms per spec. Reviewed-by: Timothy Arceri <[email protected]>
* nir/linker: handle uniforms without explicit locationAlejandro Piñeiro2018-07-031-2/+62
| | | | | | | | | | | | | | | | | ARB_gl_spirv points that uniforms in general need explicit location. But there are still some cases of uniforms without location, like for example uniform atomic counters. Those doesn't have a location from the OpenGL point of view (they are identified with a binding and offset), but Mesa internally assigns it a location. Signed-off-by: Eduardo Lima <[email protected]> Signed-off-by: Alejandro Piñeiro <[email protected]> Signed-off-by: Neil Roberts <[email protected]> v2: squash with another patch, minor variable name tweak (Timothy Arceri) Reviewed-by: Timothy Arceri <[email protected]>
* compiler/glsl: refactor empty_uniform_block utilities to linker_utilAlejandro Piñeiro2018-07-035-63/+79
| | | | | | | | | | | | | | | This includes: * Move the defition of empty_uniform_block to linker_util.h * Move find_empty_block (with a rename) to linker_util.h * Refactor some code at linker.cpp to a new method at linker_util.h (link_util_update_empty_uniform_locations) So all that code could be used by the GLSL linker and the NIR linker used for ARB_gl_spirv. v2: include just "ir_uniform.h" (Timothy Arceri) Reviewed-by: Timothy Arceri <[email protected]>
* nir: Add a large constants optimization passJason Ekstrand2018-07-024-0/+311
| | | | | | | | | | | | | | | | This pass searches for reasonably large local variables which can be statically proven to be constant and moves them into shader constant data. This is especially useful when large tables are baked into the shader source code because they can be moved into a UBO by the driver to reduce register pressure and make indirect access cheaper. v2 (Jason Ekstrand): - Use a size/align function to ensure we get the right alignments - Use the newly added deref offset helpers Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Add a concept of constant data associated with a shaderJason Ekstrand2018-07-025-0/+30
| | | | | | | | | | | | | | | | | | | This commit adds a concept to NIR of having a blob of constant data associated with a shader. Instead of being a UBO or uniform that can be manipulated by the client, this constant data considered part of the shader and remains constant across all invocations of the given shader until the end of time. To access this constant data from the shader, we add a new load_constant intrinsic. The intention is that drivers will eventually lower load_constant intrinsics to load_ubo, load_uniform, or something similar. Constant data will be used by the optimization pass in the next commit but this concept may also be useful for OpenCL. v2 (Jason Ekstrand): - Rename num_constants to constant_data_size (anholt) Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir/deref: Add helpers for getting offsetsJason Ekstrand2018-07-022-0/+95
| | | | | | | | | | | | | These are very similar to the related function in nir_lower_io except that they don't handle per-vertex or packed things (that could be added, in theory) and they take a more detailed size/align function pointer. One day, we should consider switching nir_lower_io over to using the more detailed size/align functions and then we could make it use these helpers instead of having its own. Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir/types: Add a natural size and alignment helperJason Ekstrand2018-07-022-0/+62
| | | | | | | | | | The size and alignment are "natural" in the sense that everything is aligned to a scalar. This is a bit tighter than std430 where vec3s are required to be aligned to a vec4. Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Add a deref_instr_has_indirect helperJason Ekstrand2018-07-022-0/+20
| | | | | | Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl/cache: save and restore ExternalSamplersUsedMarek Olšák2018-06-301-0/+2
| | | | | | | | Shaders that need special code for external samplers were broken if they were loaded from the cache. Cc: 18.1 <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* nir: fix selection of loop terminator when two or more have the same limitTimothy Arceri2018-06-302-4/+4
| | | | | | | | | | | | | | | | | We need to add loop terminators to the list in the order we come across them otherwise if two or more have the same exit condition we will select that last one rather than the first one even though its unreachable. This fix is for simple unrolls where we only have a single exit point. When unrolling these type of loops the unreachable terminators and their unreachable branch are removed prior to unrolling. Because of the logic change we also switch some list access in the complex unrolling logic to avoid breakage. Fixes: 6772a17acc8e ("nir: Add a loop analysis pass") Reviewed-by: Jason Ekstrand <[email protected]>
* glsl: skip comparison opt when adding vars of different sizeTimothy Arceri2018-06-281-0/+6
| | | | | | | | | | | The spec allows adding scalars with a vector or matrix. In this case the opt was losing swizzle and size information. This fixes a bug with Doom (2016) shaders. Fixes: 34ec1a24d61f ("glsl: Optimize (x + y cmp 0) into (x cmp -y).") Reviewed-by: Ian Romanick <[email protected]>
* glsl: Make sure that packed varyings reflect always_active_io properly.Eric Anholt2018-06-271-2/+7
| | | | | | | | The always_active_io flag was only set according to the first variable that got packed in, so NIR io compaction would end up compacting XFB varyings that shouldn't move at that point. Reviewed-by: Timothy Arceri <[email protected]>
* nir/opt_if: Remove unneeded phis if we make progressJason Ekstrand2018-06-263-3/+11
| | | | | | | | | | Now that SSA values can be derefs and they have special rules, we have to be a bit more careful about our LCSSA phis. In particular, we need to clean up in case LCSSA ended up creating a phi node for a deref. This fixes validation issues with some Vulkan CTS tests with the new deref instructions. Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* glsl: serialize data from glTransformFeedbackVaryingsTapani Pälli2018-06-261-0/+20
| | | | | | | | | | While XFB has been enabled for cache, we did not serialize enough data for the whole API to work (such as glGetProgramiv). Fixes: 6d830940f7 "Allow shader cache usage with transform feedback" Signed-off-by: Tapani Pälli <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106907 Reviewed-by: Jordan Justen <[email protected]>
* nir/lower_system_values: Assert/assume direct var derefsJason Ekstrand2018-06-221-4/+13
| | | | | | | | | | | | | System values are never arrays or structs so we can assume a direct var deref. This simplifies things a bit and prevents us from accidentally throwing away an array index. Suggested-by: Caio Marcelo de Oliveira Filho <[email protected]> Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]> Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Remove old-school deref chain supportJason Ekstrand2018-06-2241-1360/+6
| | | | | | | Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Remove deref chain support from analyze_loopsJason Ekstrand2018-06-221-56/+0
| | | | | | | | | | Note that this patch needs to come late in the series since this pass can be run after any pass that damages nir_metadata_loop_analysis. Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: promote intrinsic_get_var() to helperRob Clark2018-06-222-10/+10
| | | | | | | | | | Useful in a few other places.. let's not copy-pasta Signed-off-by: Rob Clark <[email protected]> Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Rework lower_locals_to_regs to use deref instructionsJason Ekstrand2018-06-221-100/+88
| | | | | | | | | | This completely reworks the pass to support deref instructions and delete support for old deref chains Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Rework opt_copy_prop_vars to use deref instructionsJason Ekstrand2018-06-221-170/+146
| | | | | | | Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir/copy_prop_vars: Re-order some logic in compare_derefsJason Ekstrand2018-06-221-8/+8
| | | | | | | Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Remove deref chain support from split_per_member_structsJason Ekstrand2018-06-221-83/+3
| | | | | | | Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Remove deref chain support from opt_undefJason Ekstrand2018-06-221-1/+2
| | | | | | | Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Remove deref chain support from split_var_copiesJason Ekstrand2018-06-221-210/+6
| | | | | | | Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Remove deref chain support from dead_variablesJason Ekstrand2018-06-221-83/+3
| | | | | | | Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Remove deref chain support from propagate_invariantJason Ekstrand2018-06-221-11/+3
| | | | | | | Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Remove deref chain support from lower_var_copiesJason Ekstrand2018-06-221-132/+8
| | | | | | | Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Remove deref chain support from lower_drawpixelsJason Ekstrand2018-06-221-13/+5
| | | | | | | Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Remove deref chain support from opt_peephole_selectJason Ekstrand2018-06-221-11/+2
| | | | | | | Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Remove deref chain support from lower_texJason Ekstrand2018-06-221-6/+2
| | | | | | | Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Remove deref chain support from lower_wpos_ytransformJason Ekstrand2018-06-221-36/+2
| | | | | | | Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Remove deref chain support from lower_wpos_centerJason Ekstrand2018-06-221-11/+2
| | | | | | | Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Remove deref chain support from lower_system_valuesJason Ekstrand2018-06-221-13/+11
| | | | | | | Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Remove deref chain support from remove_unused_varyingsJason Ekstrand2018-06-221-7/+6
| | | | | | | Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Delete lower_io_typesJason Ekstrand2018-06-224-181/+0
| | | | | | | | | | It's only used by the ir3 stand-alone compiler and Rob said we could delete it. Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Remove deref chain support from lower_phis_to_scalarJason Ekstrand2018-06-221-7/+2
| | | | | | | Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Convert lower_io to deref instructionsJason Ekstrand2018-06-221-68/+37
| | | | | | | | | | | This deletes support for _var intrinsics and legacy deref chains in favor of deref instructions. The internals are also reworked a bit to use deref instructions directly. Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir/lower_io: Convert atomic lowering to deref instructionsJason Ekstrand2018-06-221-23/+27
| | | | | | | | | | | No one is currently using so we can make this change irrespective of driver. We may use it again in i965 so it's best to pretend to keep it working. Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Remove deref chain support from lower_global_vars_to_localJason Ekstrand2018-06-221-18/+4
| | | | | | | Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Remove deref chain support from lower_clamp_color_outputsJason Ekstrand2018-06-221-3/+2
| | | | | | | Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Remove deref chain support from lower_alpha_testJason Ekstrand2018-06-221-3/+2
| | | | | | | Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Remove deref chain support from lower_atomicsJason Ekstrand2018-06-221-144/+2
| | | | | | | Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Remove deref chain support from lower_clip_cull_distance_arraysJason Ekstrand2018-06-221-52/+2
| | | | | | | Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Remove deref chain support from lower_indirect_derefsJason Ekstrand2018-06-221-161/+2
| | | | | | | Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Rework gather_info to entirely use deref instructionsJason Ekstrand2018-06-221-28/+14
| | | | | | | Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir/vars_to_ssa: Rework to entirely use deref instructionsJason Ekstrand2018-06-221-184/+152
| | | | | | | | | | | This commit reworks nir_lower_vars_to_ssa to use deref instructions and deref paths internally instead of deref chains. We also drop support for the old load/store/copy_var intrinsics. Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir/vars_to_ssa: Add an is_direct field to deref_nodeJason Ekstrand2018-06-221-16/+25
| | | | | | | | | | This makes us build the is_direct parameter as the nodes are constructed rather than as we walk the chain. This will be useful later. Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir/lower_samplers: remove legacy versionRob Clark2018-06-224-167/+0
| | | | | | | | Signed-off-by: Rob Clark <[email protected]> Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: convert lower_samplers_as_deref to deref instructionsRob Clark2018-06-221-65/+117
| | | | | | | | | | This also removes the legacy version of lower_samplers. Signed-off-by: Rob Clark <[email protected]> Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>