aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler
Commit message (Collapse)AuthorAgeFilesLines
* nir: support derefs in two-sided lighting loweringErik Faye-Lund2019-10-171-12/+28
| | | | Reviewed-by: Marek Olšák <[email protected]>
* nir: add lowering-pass for point-size movErik Faye-Lund2019-10-174-0/+74
| | | | Reviewed-by: Marek Olšák <[email protected]>
* nir: allow passing alpha-ref state to lowering-codeErik Faye-Lund2019-10-172-4/+20
| | | | Reviewed-by: Marek Olšák <[email protected]>
* nir: add a pass to lower flat shading.Dave Airlie2019-10-174-0/+54
| | | | | | | This takes any color or backcolor that has unspecified shading and converts it to flat shading. Reviewed-by: Marek Olšák <[email protected]>
* spirv: set correct dest_type for texture query opsJonathan Marek2019-10-151-7/+17
| | | | | Signed-off-by: Jonathan Marek <[email protected]> Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
* glsl: fix crash compiling bindless samplers inside unnamed UBOsTimothy Arceri2019-10-121-5/+5
| | | | | | | | | | The check to see if we were dealing with a buffer block was too late and only worked for named UBOs. Fixes: f32b01ca435c "glsl/linker: remove ubo explicit binding handling" Reviewed-by: Marek Olšák <[email protected]> Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1900
* glsl/builtin: Add alternate versions of atan using new opsNeil Roberts2019-10-121-2/+31
| | | | | | | | | | Adds alternate versions of the atan builtin functions that use ir_unop_atan and ir_binop_atan2 instead of inlining to the IR implementation of the function. These alternatives are selected if the IR is going to be consumed by NIR. In that case the IR ops will be translated to the appropriate NIR op. Reviewed-by: Kristian H. Kristensen <[email protected]>
* glsl: Add opcodes for atan and atan2Neil Roberts2019-10-124-0/+27
| | | | | | | | Adds ir_binop_atan2 and ir_unop_atan. When converting to NIR these are expanded out using the appropriate builtin generator. If they are used with anything else then it will just hit an assert. Reviewed-by: Kristian H. Kristensen <[email protected]>
* nir/builtin: Add extern "C" guards to nir_builtin_builder.hNeil Roberts2019-10-121-0/+8
| | | | | | That way it can also be included from a C++ source. Reviewed-by: Kristian H. Kristensen <[email protected]>
* nir/builtin: Add #include u_math.h to the headerNeil Roberts2019-10-121-0/+1
| | | | | | | The inline functions use M_PI so they should include a header to make sure it is defined. Reviewed-by: Kristian H. Kristensen <[email protected]>
* nir/builder: Move nir_atan and nir_atan2 from SPIR-V translatorNeil Roberts2019-10-123-153/+156
| | | | | | | Moves build_atan and build_atan2 into nir_builtin_builder. The goal is to be able to use this from the GLSL translator too. Reviewed-by: Kristian H. Kristensen <[email protected]>
* nir/dead_cf: Remove dead control flow after infinite loops.Bas Nieuwenhuizen2019-10-111-0/+7
| | | | | | | | | | | | | And after discard-only loops. Otherwise we end up with dead code which confuses nir_repair_ssa into adding a whole bunch of uses of undefined. However, for derefs, we sometimes always expect to get a variable instead of undefined. Fixes dEQP-VK.graphicsfuzz.write-red-in-loop-nest on radv. Fixes: c832820ce95 "nir/dead_cf: Repair SSA if the pass makes progress" Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1928 Reviewed-by: Connor Abbott <[email protected]>
* nir/lower_input_attachments: pass on non-uniform access flagRhys Perry2019-10-111-0/+2
| | | | | | Signed-off-by: Rhys Perry <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir/lower_non_uniform: lower image/texture instructions taking derefsRhys Perry2019-10-111-10/+88
| | | | | | | | | v2: always assert on the texture/sampler handle's num_components v3: replicate the deref inside the loop v4: remove a case of useless line wrapping Signed-off-by: Rhys Perry <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* glsl/tests: Handle no-exec errorsDylan Baker2019-10-102-4/+42
| | | | | | | | | | Currently meson doesn't correctly handle passing compiled binaries to scripts in tests. This patch looks to the future (0.53) when meson will have this functionality, but also immediately it fixes these tests in cross compiles by causing them to return 77, which meson interprets as skip. Acked-by: Kristian H. Kristensen <[email protected]>
* meson: glcpp tests are expected to fail on windowsDylan Baker2019-10-101-1/+2
| | | | | | v2: - Exclude the tests rather than xfail them Acked-by: Kristian H. Kristensen <[email protected]>
* meson: Add idep_getopt for testsDylan Baker2019-10-102-4/+4
| | | | | | | There are quite a few tests that require getopt, when using MSVC we need to use the bundled version of getopt since there isn't a system version. Acked-by: Kristian H. Kristensen <[email protected]>
* meson: force inclusion of inttypes.h for glcpp with msvcDylan Baker2019-10-101-2/+12
| | | | | | | Because we provide a copy if MSVC doesn't, and we need it to make flex do what we want. Acked-by: Kristian H. Kristensen <[email protected]>
* nir: add nir_shader_compiler_options::lower_to_scalarMarek Olšák2019-10-101-0/+1
| | | | | | | | This will replace PIPE_SHADER_CAP_SCALAR_ISA. Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Christian Gmeiner <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir/drawpixels: fix what appears to be a copy-paste bug in get_texcoord_constMarek Olšák2019-10-101-4/+5
| | | | | Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir/drawpixels: handle load_color0, load_input, load_interpolated_inputMarek Olšák2019-10-101-1/+26
| | | | | | for radeonsi Reviewed-by: Timothy Arceri <[email protected]>
* nir: move gl_nir_opt_access from glsl directoryMarek Olšák2019-10-106-8/+5
| | | | | Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: add a strip parameter to nir_serializeMarek Olšák2019-10-102-3/+18
| | | | | | | so that drivers don't have to call nir_strip manually. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Rob Clark <[email protected]>
* nir: add shader_info::last_msaa_imageMarek Olšák2019-10-092-0/+8
| | | | | | for radeonsi Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]>
* nir/sink: Don't sink load_ubo to outside of its defining loopConnor Abbott2019-10-091-5/+32
| | | | | | | | Previously, this could have made the resource divergent in code like that which is genereated by nir_lower_non_uniform_access. Fixes: da8ed68a ('nir: replace nir_move_load_const() with nir_opt_sink()') Reviewed-by: Daniel Schürmann <[email protected]>
* nir/sink: Rewrite loop handling logicConnor Abbott2019-10-091-35/+40
| | | | | | | | | | | | | | | | Previously, for code like: loop { loop { a = load_ubo() } use(a) } adjust_block_for_loops() would return the block before the first loop. Now we compute the range of allowed blocks and then walk the dominance tree directly, guaranteeing directly that we always choose a block that dominates all the uses and is dominated by the definition. Reviewed-by: Daniel Schürmann <[email protected]>
* meson: drop unused inc_nirEric Engestrom2019-10-071-1/+0
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Dylan Baker <[email protected]>
* meson: drop duplicate inc_nir from spirv2nirEric Engestrom2019-10-071-1/+1
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Dylan Baker <[email protected]>
* meson: drop duplicate inc_nir from libglslEric Engestrom2019-10-071-1/+1
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Dylan Baker <[email protected]>
* meson: rename libnir to _libnir to make it clear it's not meant to be used ↵Eric Engestrom2019-10-071-2/+2
| | | | | | | anywhere else Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Dylan Baker <[email protected]>
* nir/constant_folding: fold load_constant intrinsicsRhys Perry2019-10-071-0/+58
| | | | | | | | | | | | | | | | | | These can appear after loop unrolling. v2: stylistic changes v2: replace state->mem_ctx with state->shader v2: add bounds checking v3: use nir_intrinsic_range() for bounds checking v3: fix issue where partially out-of-bounds reads are replaced with undefs v4: fix merge conflicts during rebase v5: split into two commits v6: set constant_data to NULL after freeing (fixes nir_sweep()/Iris) v7: don't remove the constant data if there are no constant loads Signed-off-by: Rhys Perry <[email protected]> Reviewed-by: Connor Abbott <[email protected]> (v6) Acked-by: Ian Romanick <[email protected]>
* nir/constant_folding: add back and use constant_fold_stateRhys Perry2019-10-071-22/+19
| | | | | | | Useful for load_constant folding. Signed-off-by: Rhys Perry <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
* spirv: Implement SPV_KHR_shader_clockCaio Marcelo de Oliveira Filho2019-10-072-0/+36
| | | | | | | We only have the subgroup variant in NIR (equivalent to clockARB), so only support that for now. Reviewed-by: Lionel Landwerlin <[email protected]>
* nir: Fix some wonky whitespace in nir_search.h.Eric Anholt2019-10-041-2/+2
| | | | | Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
* nir: Factor out most of the algebraic passes C code to .c/.h.Eric Anholt2019-10-043-146/+173
| | | | | | | | | | | Working on the algebraic implementation, I was being driven nuts by my editor not highlighting and handling indentation for the C code. It turns out that it's basically not pass-specific code, and we can move it over to the relevant .c file. Replaces 30KB of code with 34KB of data on my i965 build. No perf diff on shader-db (n=3) Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
* nir: Keep the range analysis HT around intra-pass until we make a change.Eric Anholt2019-10-047-38/+52
| | | | | | | | | This lets us memoize range analysis work across instructions. Reduces runtime of shader-db on Intel by -30.0288% +/- 2.1693% (n=3). Fixes: 405de7ccb6cb ("nir/range-analysis: Rudimentary value range analysis pass") Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
* nir: Skip emitting no-op movs from the builder.Eric Anholt2019-10-042-3/+12
| | | | | | | | | | | Having passes generate these is just making more work for copy propagation (and thus probably calling more optimization passes) later. Noticed while trying to debug nir_opt_algebraic() top-to-bottom having O(n^2) behavior due to not finding new matches in replacement code. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
* nir: Make nir_search's dumping go to stderr.Eric Anholt2019-10-041-16/+16
| | | | | Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
* nir/print: always use the right FILE *Rhys Perry2019-10-041-2/+4
| | | | | Signed-off-by: Rhys Perry <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* nir: initialize needs_helper_invocations as wellErik Faye-Lund2019-10-041-0/+1
| | | | | | | Similar to the previous commit, we should also initialize needs_helper_invocations here. Reviewed-by: Kenneth Graunke <[email protected]>
* nir: initialize uses_discard to falseErik Faye-Lund2019-10-041-0/+1
| | | | | | | | This matches what we do for uses_sample_qualifier, and what we do in ir_set_program_inouts.cpp as well. Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Add helperInvocationEXT() builtinCaio Marcelo de Oliveira Filho2019-09-303-0/+47
| | | | | | | | | | | From EXT_demote_to_helper_invocation, implemented with the existing nir_intrinsic_is_helper_invocation. Such builtin is necessary when using `demote` because we can't redefine the value of gl_HelperInvocation (since it is an input variable). Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Parse `demote` statementCaio Marcelo de Oliveira Filho2019-09-305-1/+49
| | | | | | | When the EXT_demote_to_helper_invocation extension is enabled, `demote` is treated as a keyword, and produces an ir_demote. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Add ir_demoteCaio Marcelo de Oliveira Filho2019-09-309-0/+81
| | | | | | | | | | | | | | | To represent the new `demote` keyword when using EXT_demote_to_helper_invocation extension. Most of the changes are to include it in the visitors. Demote is not considered a control flow, so also include an empty visit member function in ir_control_flow_visitor. Only NIR actually supports `demote`, so assert the translations for TGSI and Mesa's gl_program -- since the demote is not expected to appear for those. Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Extension boilerplate for EXT_demote_to_helper_invocationCaio Marcelo de Oliveira Filho2019-09-302-0/+3
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Remove unnecessary subtraction optimizationsDaniel Schürmann2019-09-301-10/+0
| | | | | | | These optimizations are already covered after lowering. Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
* nir: recombine nir_op_*sub when lower_sub = falseDaniel Schürmann2019-09-301-8/+13
| | | | | | | | | | | | | There are some optimizations which are only implemented for additions and some optimizations which assume that subtractions have been lowered. By lowering all subtractions first and later recombine for backends which prefer this option, we don't have to implement them twice. This patch also moves lower_negate to nir_opt_algebraic_late() to enable these optimizations for backends which make use of it. Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
* android: compiler/nir: build nir_divergence_analysis.cMauro Rossi2019-09-281-0/+1
| | | | | | | | | | | | | Prerequisite to avoid following radv linking error happening with aco FAILED: out/target/product/x86_64/obj_x86/SHARED_LIBRARIES/vulkan.radv_intermediates/LINKED/vulkan.radv.so ... external/mesa/src/amd/compiler/aco_instruction_selection_setup.cpp:178: error: undefined reference to 'nir_divergence_analysis' clang.real: error: linker command failed with exit code 1 (use -v to see invocation) Fixes: df86c5f ("nir: add divergence analysis pass.") Signed-off-by: Mauro Rossi <[email protected]>
* glsl: disallow incompatible matrices multiplicationAndrii Simiklit2019-09-271-3/+3
| | | | | | | | | | | | | | | | | | | | | | glsl 4.4 spec section '5.9 expressions': "The operator is multiply (*), where both operands are matrices or one operand is a vector and the other a matrix. A right vector operand is treated as a column vector and a left vector operand as a row vector. In all these cases, it is required that the number of columns of the left operand is equal to the number of rows of the right operand. Then, the multiply (*) operation does a linear algebraic multiply, yielding an object that has the same number of rows as the left operand and the same number of columns as the right operand. Section 5.10 “Vector and Matrix Operations” explains in more detail how vectors and matrices are operated on." This fix disallows a multiplication of incompatible matrices like: mat4x3(..) * mat4x3(..) mat4x2(..) * mat4x2(..) mat3x2(..) * mat3x2(..) .... CC: <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111664 Signed-off-by: Andrii Simiklit <[email protected]>
* shader_enums: Move MAX_DRAW_BUFFERS to this file.Eric Anholt2019-09-271-1/+3
| | | | | | | | | We include shader_enums.h from freedreno's compiler for both GL and Vulkan, and the main/config.h include resulted in polluting the namespace with things like MAX_VIEWPORTS that other Vulkan drivers use as their driver-specific maximums. Reviewed-by: Kristian H. Kristensen <[email protected]>