summaryrefslogtreecommitdiffstats
path: root/src/glsl/nir/nir.h
Commit message (Collapse)AuthorAgeFilesLines
* glsl: Rename safe_reverse -> reverse_safe.Matt Turner2015-12-011-2/+2
| | | | | | To match existing foreach_in_list_reverse_safe. Reviewed-by: Francisco Jerez <currojerez@riseup.net>
* nir/lower_tex: Add support for lowering texture swizzleJason Ekstrand2015-11-231-0/+13
| | | | Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
* nir: Add a tex_instr_is_query helperJason Ekstrand2015-11-231-0/+25
| | | | Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
* nir: Add a ssa_def_rewrite_uses_after helperJason Ekstrand2015-11-231-0/+2
| | | | Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
* nir/lower_tex: Report progressJason Ekstrand2015-11-231-1/+1
| | | | | Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
* nir: s/nir_type_unsigned/nir_type_uintJason Ekstrand2015-11-231-1/+1
| | | | | | | | | | | v2: do the same in tgsi_to_nir (Samuel) v3: added missing cases after rebase (Iago) v4: Add a blank space after '#' in one of the comments (Matt) Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
* nir: Add nir_texop_samples_identical opcodeIan Romanick2015-11-191-0/+4
| | | | | | | | | | | This is the NIR analog to GLSL IR ir_samples_identical. v2: Don't add the second nir_tex_src_ms_index parameter. Suggested by Ken and Jason. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com> Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
* nir: add nir_var_all enumRob Clark2015-11-191-0/+1
| | | | | | | | | Otherwise, passing -1 gets you: error: invalid conversion from 'int' to 'nir_variable_mode' [-fpermissive] Signed-off-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* nir: Add support for cloning shadersJason Ekstrand2015-11-181-0/+2
| | | | | | | | This commit is heavily based on one by Rob Clark <robdclark@gmail.com> but reworked to re-use nir_create functions and do less hashing. Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com> Reviewed-by: Rob Clark <robclark@freedesktop.org>
* i965/nir: Validate that NIR passes call nir_metadata_preserve().Kenneth Graunke2015-11-181-0/+5
| | | | | | | | | | | | | | | | | | | | | Failing to call nir_metadata_preserve() can have nasty consequences: some pass breaks dominance information, but leaves it marked as valid, causing some subsequent pass to go haywire and probably crash. This pass adds a simple validation mechanism to ensure passes handle this properly. We add a new bogus metadata flag that isn't used for anything in particular, set it before each pass, and ensure it *isn't* still set after the pass. nir_metadata_preserve will reset the flag, so correct passes will work, and bad passes will assert fail. (I would have made these functions static inline, but nir.h is included in C++, so we can't bit-or enums without lots of casting...) Thanks to Dylan Baker for the idea. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
* nir: add array length fieldRob Clark2015-11-181-0/+5
| | | | | | | | This will simplify things somewhat in clone. Signed-off-by: Rob Clark <robclark@freedesktop.org> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
* nir: remove nir_variable::max_ifc_array_accessRob Clark2015-11-181-13/+0
| | | | | | | | No users. Signed-off-by: Rob Clark <robclark@freedesktop.org> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
* nir: Store the size of the TCS output patch in nir_shader_info.Kenneth Graunke2015-11-181-0/+5
| | | | | Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* nir: Add helpers for getting input/output intrinsic sources.Kenneth Graunke2015-11-131-0/+3
| | | | | | | | | | With the many variants of IO intrinsics, particular sources are often in different locations. It's convenient to say "give me the indirect offset" or "give me the vertex index" and have it just work, without having to think about exactly which kind of intrinsic you have. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* nir/nir_opt_peephole_ffma: Move this lowering pass to the i965 driverEduardo Lima Mitev2015-11-101-1/+0
| | | | | | | | | Because the next patch will add an optimization that is specific to i965, we want to move this loweing pass to that driver altogether. This is safe because i965 is the only consumer. Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* nir: Store PatchInputsRead and PatchOutputsWritten in nir_shader_info.Kenneth Graunke2015-11-101-0/+5
| | | | | | | | | | These tessellation shader related fields need plumbing through NIR. v2: Use uint32_t instead of uint64_t to match the source type of GLbitfield (caught by Iago Toral). Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
* nir: Add a nir_deref_tail helperJason Ekstrand2015-11-071-0/+9
| | | | Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
* nir: some small cleanupsRob Clark2015-11-061-5/+5
| | | | | | | | | The various cf nodes all get allocated w/ shader as their ralloc_parent, so lets make this more explicit. Plus couple other corrections/ clarifications. Signed-off-by: Rob Clark <robclark@freedesktop.org> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* nir: Rename live_variables to live_ssa_defs.Kenneth Graunke2015-11-051-2/+2
| | | | | | | This computes liveness of SSA values, not nir_variables. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* nir: Unexpose _impl versions of copy_prop and dceJason Ekstrand2015-11-031-2/+0
| | | | | Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* nir: Copy "patch" flag from ir_variable to nir_variable.Kenneth Graunke2015-10-281-0/+1
| | | | | | | This was introduced in GLSL IR after NIR development had branched. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
* glsl: keep track of intra-stage indices for atomicsTimothy Arceri2015-10-271-2/+2
| | | | | | | | | | | | | | | This is more optimal as it means we no longer have to upload the same set of ABO surfaces to all stages in the program. This also fixes a bug where since commit c0cd5b var->data.binding was being used as a replacement for atomic buffer index, but they don't have to be the same value they just happened to end up the same when binding is 0. Reviewed-by: Francisco Jerez <currojerez@riseup.net> Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com> Cc: Ilia Mirkin <imirkin@alum.mit.edu> Cc: Alejandro Piñeiro <apinheiro@igalia.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90175
* nir: Constify nir_gs_count_verticesJason Ekstrand2015-10-211-1/+1
| | | | Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* nir/info: Add more information about geometry shadersJason Ekstrand2015-10-211-0/+12
| | | | Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* nir/info: Add a few bits of info for fragment shadersJason Ekstrand2015-10-191-0/+13
| | | | Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
* nir/info: Add compute shader local size to nir_shader_infoJason Ekstrand2015-10-191-0/+4
| | | | Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
* nir/info: Move the GS info into a stage-specific info unionJason Ekstrand2015-10-191-6/+8
| | | | | | | | This way we can have other stage-specific info without consuming too much extra space. While we're at it, we make sure that the geometry info is only set if we're actually a goemetry shader. Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
* nir: Add a label to nir_shader_infoJason Ekstrand2015-10-191-0/+3
| | | | Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
* nir: Add helpers for creating variables and adding them to listsJason Ekstrand2015-10-151-0/+20
| | | | Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
* glsl: move shader_enums into nirRob Clark2015-10-091-1/+1
| | | | | | | | | | | | | | | | | | | | First step towards inverting the dependency between glsl and nir (so nir can be used without glsl). Also solves this issue with 'make distclean' Making distclean in mesa make[2]: Entering directory '/mnt/sdb1/Src64/Mesa-git/mesa/src/mesa' Makefile:2486: ../glsl/.deps/shader_enums.Plo: No such file or directory make[2]: *** No rule to make target '../glsl/.deps/shader_enums.Plo'. Stop. make[2]: Leaving directory '/mnt/sdb1/Src64/Mesa-git/mesa/src/mesa' Makefile:684: recipe for target 'distclean-recursive' failed make[1]: *** [distclean-recursive] Error 1 make[1]: Leaving directory '/mnt/sdb1/Src64/Mesa-git/mesa/src' Makefile:615: recipe for target 'distclean-recursive' failed make: *** [distclean-recursive] Error 1 Reported-by: Andy Furniss <adf.lists@gmail.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Rob Clark <robclark@freedesktop.org>
* nir: constify nir_ssa_alu_instr_src_components()Connor Abbott2015-10-091-1/+1
| | | | | Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com> Signed-off-by: Connor Abbott <cwabbott0@gmail.com>
* nir: Add a function to determine if a source is dynamically uniformNeil Roberts2015-10-091-0/+1
| | | | | | | | | | | | Adds nir_src_is_dynamically_uniform which returns true if the source is known to be dynamically uniform. This will be used in a later patch to add a workaround for cases that only work with dynamically uniform sources. Note that the function is not definitive, it can return false negatives (but not false positives). Currently it only detects constants and uniform accesses. It could easily be extended to include more cases. Reviewed-by: Matt Turner <mattst88@gmail.com>
* nir: Add a nir_shader_info::has_transform_feedback_varyings flag.Kenneth Graunke2015-10-041-0/+3
| | | | | Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Matt Turner <mattst88@gmail.com>
* nir: Add a nir_foreach_variable macroJason Ekstrand2015-10-021-0/+3
| | | | | | | This is a common enough operation that it's nice to not have to think about the arguments to foreach_list_typed every time. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* nir: Move GS data to nir_shader_infoJason Ekstrand2015-10-021-8/+8
| | | | Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* nir: Add a a nir_shader_info structJason Ekstrand2015-10-021-0/+34
| | | | | | This commit also adds code to glsl_to_nir and prog_to_nir to fill it out. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* nir: Allow nir_lower_io() to only lower one type of variable.Kenneth Graunke2015-10-011-0/+1
| | | | | | | | | We may want to use different type_size functions for (e.g.) inputs vs. uniforms. Passing in -1 for mode ignores this, handling all modes as before. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Matt Turner <mattst88@gmail.com>
* nir: Add a function to count the number of vertices a GS emits.Kenneth Graunke2015-09-261-0/+2
| | | | | | | | | | | Some hardware (such as Broadwell) can run geometry shaders more efficiently when the number of vertices emitted is statically known. This pass provides a way to obtain the constant vertex count, or -1 indicating that the vertex count is unknown/non-constant. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
* nir: Add new GS intrinsics that maintain a count of emitted vertices.Kenneth Graunke2015-09-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | This patch also introduces a lowering pass to convert the simple GS intrinsics to the new ones. See the comments above that for the rationale behind the new intrinsics. This should be useful for i965; it's a generic enough mechanism that I could see other drivers potentially using it as well, so I don't feel too bad about putting it in the generic code. v2: - Use nir_after_block_before_jump for the cursor (caught by Jason Ekstrand - I'd mistakenly used nir_after_block when rebasing this code onto the new NIR control flow API). - Remove the old emit_vertex intrinsic at the end, rather than in the middle (requested by Jason). - Use state->... directly rather than locals (requested by Jason). - Report progress from nir_lower_gs_intrinsics() (requested by me). - Remove "Authors:" section from file comment (requested by Michael Schellenberger Costa). Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* nir: Report progress from nir_normalize_cubemap_coords().Kenneth Graunke2015-09-211-1/+1
| | | | | Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* nir: Report progress from nir_lower_system_values().Kenneth Graunke2015-09-211-1/+1
| | | | | Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* nir: Report progress from nir_split_var_copies().Kenneth Graunke2015-09-211-1/+1
| | | | | Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* nir: Report progress from nir_lower_locals_to_regs().Kenneth Graunke2015-09-211-1/+1
| | | | | Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* nir: Report progress from nir_remove_dead_variables().Kenneth Graunke2015-09-211-1/+1
| | | | | Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* nir: Report progress from lower_vec_to_movs().Jason Ekstrand2015-09-211-1/+1
| | | | | Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* nir: Report progress from nir_lower_globals_vars_to_local().Kenneth Graunke2015-09-211-1/+1
| | | | | Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* nir: Move system value -> intrinsic mapping into nir.cJason Ekstrand2015-09-211-0/+1
| | | | | | This way they're right next to the map going the other direction. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* nir: add two-sided-color lowering passRob Clark2015-09-181-0/+2
| | | | | Signed-off-by: Rob Clark <robclark@freedesktop.org> Reviewed-by: Eric Anholt <eric@anholt.net>
* nir/lower_tex: add support to clamp texture coordsRob Clark2015-09-181-0/+18
| | | | | | | | | | | | | | Some hardware needs to clamp texture coordinates to [0.0, 1.0] in the shader to emulate GL_CLAMP. This is added to lower_tex_proj since, in the case of projected coords, the clamping needs to happen *after* projection. v2: comments/suggestions from Ilia and Eric, use txs to get texture size and clamp RECT textures to their dimensions rather than [0.0, 1.0] to avoid having to lower RECT textures to 2D. Signed-off-by: Rob Clark <robclark@freedesktop.org> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* nir/lower_tex: support for lowering RECT texturesRob Clark2015-09-181-0/+7
| | | | | | | | v2: comments/suggestions from Ilia and Eric, split out get_texture_size() helper so we can use it in the next commit for clamping RECT textures. Signed-off-by: Rob Clark <robclark@freedesktop.org> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>