Commit Graph

1848 Commits

Author SHA1 Message Date
Faith Ekstrand 3c7460c023 nvk: Advertise variableMultisampleRate and EDS3RasterizationSamples
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9665
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27025>
2024-01-13 18:25:20 +00:00
Faith Ekstrand 0e33dba625 nvk: Move SET_HYBRID_ANTI_ALIAS_CONTROL to draw time
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27025>
2024-01-13 18:25:20 +00:00
Faith Ekstrand 148ea7792f nvk: Emit SET_ANTI_ALIAS at draw time when no render targets are bound
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27025>
2024-01-13 18:25:20 +00:00
Faith Ekstrand 94d96dac60 nak: Add explicit padding to nak_shader_info
This ensures that the padding bits stay zero, even as we copy the
structure around through multiple languages.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27049>
2024-01-12 23:58:11 +00:00
Faith Ekstrand d280160a13 nak: Disallow gl_FragData and set MRT correctly
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27049>
2024-01-12 23:58:11 +00:00
Faith Ekstrand 005b5b1464 nvk: Set a minimum of one patch control point
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27049>
2024-01-12 23:58:11 +00:00
Faith Ekstrand 2cab67a9f1 nvk: Invalidate state after secondary command buffers
Today, the only thing that this really affects is descriptor sets and
dynamic state as everything else is re-emitted almost every time.
However, as we add more dirtying, we'll need to be more and more careful
about stale state leaking across secondary command buffer executions.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27049>
2024-01-12 23:58:11 +00:00
Faith Ekstrand bc36dfdb5d nvk: Handle missing descriptor sets in nvk_nir_lower_descriptors
For VK_EXT_graphics_pipeline_library, we need to be able to handle
missing descriptor sets.  THis screws up dynamic buffers because we're
no longer guaranteed to be able to statically compute the index into
nvk_root_descriptor_table::dynamic_buffers while lowering descriptors.
Instead, we may need to look up the start index for the set in
nvk_root_descriptor_table::set_dynamic_buffer_start and compute from
there.

We also rework nvk_nir_lower_descriptors to take an array of (possibly
NULL) descriptor sets.  This ensures that we don't make any assumptions
about the pipeline layout.  It's also the interface we'll want for
implementing VK_EXT_shader_object.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27048>
2024-01-12 23:42:39 +00:00
Faith Ekstrand 3197aff4e8 nvk: Make dynamic cbuf indices relative to the descriptor set
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27048>
2024-01-12 23:42:38 +00:00
Faith Ekstrand e0d907f56f nvk: Rework descriptor set binding
This prepares us for VK_EXT_graphics_pipeline_library by allowing null
descriptor sets to be bound and handling holes in pipeline layouts.  We
also add a set_dynamic_buffer_start map to the root descriptor table
which says where in dynamic_buffers each set starts.  This can be used
by the pipeline layout lowering in the case where we can't statically
the dynamic buffer index for a binding.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27048>
2024-01-12 23:42:38 +00:00
Faith Ekstrand a11adbe408 nvk: Use s instead of set_idx in CmdBindDescriptorSets
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27048>
2024-01-12 23:42:38 +00:00
Faith Ekstrand 2d5c04ee4a nvk: Return an nvk_cbuf_map from nvk_lower_nir()
There's no need to pass in the whole shader when the only part we're
going to write is the cbuf map.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27048>
2024-01-12 23:42:38 +00:00
Faith Ekstrand f62b5582ea nvk: Add an explicit mapping from shader stages to cbuf bindings
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27048>
2024-01-12 23:42:38 +00:00
Karol Herbst 2d3273e388 nak/algebraic: write code to an output file
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26999>
2024-01-11 19:02:44 +00:00
Karol Herbst 15785a9bfe nak/algebraic: merge run and main function
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26999>
2024-01-11 19:02:43 +00:00
Yonggang Luo 32d2f70742 nouveau: Use align64 instead of ALIGN over input layer_size_B
layer_size_B is uint64_t, so use align64 over it
Because array_stride_B is uint32_t, so cast back to uint32_t

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23932>
2024-01-11 17:30:46 +00:00
Yonggang Luo 0b9c96562b treewide: Use util_is_power_of_two_nonzero{64|_uintptr} when needed
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26909>
2024-01-11 16:45:57 +00:00
Thomas H.P. Andersen 83ba2498c2 nvk: VK_EXT_shader_module_identifier
dEQP-VK.pipeline.monolithic.shader_module_identifier.*

Test run totals:
  Passed:        530/1292 (41.0%)
  Failed:        0/1292 (0.0%)
  Not supported: 762/1292 (59.0%)
  Warnings:      0/1292 (0.0%)
  Waived:        0/1292 (0.0%)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25550>
2024-01-09 20:27:27 +00:00
Thomas H.P. Andersen 057133927b nvk: VK_EXT_pipeline_creation_cache_control
dEQP-VK.pipeline.monolithic.creation_cache_control.*

Test run totals:
  Passed:        16/18 (88.9%)
  Failed:        0/18 (0.0%)
  Not supported: 2/18 (11.1%)
  Warnings:      0/18 (0.0%)
  Waived:        0/18 (0.0%)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25550>
2024-01-09 20:27:27 +00:00
Thomas H.P. Andersen 74647ee45a nvk: VK_EXT_pipeline_creation_feedback
dEQP-VK.*creation_feedback*

Test run totals:
  Passed:        13/73 (17.8%)
  Failed:        0/73 (0.0%)
  Not supported: 60/73 (82.2%)
  Warnings:      0/73 (0.0%)
  Waived:        0/73 (0.0%)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25550>
2024-01-09 20:27:27 +00:00
Thomas H.P. Andersen d6a1e29ccd nvk: pipeline shader cache
dEQP-VK.pipeline.monolithic.cache.*

Test run totals:
  Passed:        773/773 (100.0%)
  Failed:        0/773 (0.0%)
  Not supported: 0/773 (0.0%)
  Warnings:      0/773 (0.0%)
  Waived:        0/773 (0.0%)

Timing these test:
Before:
real    0m11,304s
user    0m9,442s
sys     0m0,477s

After:
real    0m3,470s
user    0m1,962s
sys     0m0,504s

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25550>
2024-01-09 20:27:27 +00:00
Thomas H.P. Andersen ad802ae2f9 nvk: allocatable nvk_shaders
This will be needed later when the shader life cycle will be managed
by the pipeline cache

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25550>
2024-01-09 20:27:27 +00:00
Faith Ekstrand 3e4411a1d3 nvk: Free shaders created by codegen
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25550>
2024-01-09 20:27:27 +00:00
Thomas H.P. Andersen 3e13d0fcd9 nvk: add hashing for shaders
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25550>
2024-01-09 20:27:27 +00:00
Thomas H.P. Andersen 1cb6b4f82d nvk: loop over stages in MESA order
we do this to make the VkPipelineShaderStageCreateInfo available
when we want to calculate the shader hash

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25550>
2024-01-09 20:27:27 +00:00
Yonggang Luo 08b6f786ac nouveau: Use align64 instead of ALIGN for 64 bit value parameter
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26868>
2024-01-06 02:05:09 +00:00
Yonggang Luo 06163884b2 nvk: Avoid use align as variable, replace it with alignment
align is a function and when we want use it, the align variable will shadow it
So replace it with alignment

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26868>
2024-01-06 02:05:09 +00:00
Daniel Schürmann bdbf873b0f nir: remove redundant passes from nir_opt_if()
These are now covered by nir_opt_loop():
- opt_if_loop_last_continue()
- opt_merge_breaks()
- opt_if_loop_terminator()

Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24940>
2024-01-03 20:48:05 +00:00
Daniel Schürmann a3ed36da1a treewide: replace calls to nir_opt_trivial_continues() with nir_opt_loop()
Totals from 850 (1.11% of 76636) affected shaders: (RADV, GFX11)
MaxWaves: 18134 -> 18130 (-0.02%)
Instrs: 3011298 -> 3008585 (-0.09%); split: -0.17%, +0.08%
CodeSize: 15836804 -> 15841972 (+0.03%); split: -0.09%, +0.12%
VGPRs: 63580 -> 63604 (+0.04%)
SpillSGPRs: 966 -> 1148 (+18.84%); split: -0.83%, +19.67%
Latency: 36102291 -> 30186144 (-16.39%); split: -16.41%, +0.02%
InvThroughput: 9058100 -> 7011821 (-22.59%); split: -22.61%, +0.02%
VClause: 65369 -> 65364 (-0.01%); split: -0.03%, +0.02%
SClause: 100309 -> 100305 (-0.00%); split: -0.04%, +0.04%
Copies: 335658 -> 336472 (+0.24%); split: -0.70%, +0.94%
Branches: 110806 -> 108945 (-1.68%); split: -1.94%, +0.26%
PreSGPRs: 73476 -> 73934 (+0.62%); split: -0.25%, +0.87%
PreVGPRs: 58809 -> 58840 (+0.05%); split: -0.01%, +0.06%

Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24940>
2024-01-03 20:48:04 +00:00
Caio Oliveira cc809d4de9 nouveau: Use glsl_type C helpers
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26707>
2023-12-22 06:44:23 -08:00
Joshua Ashton 6b1fafe716 nvk: Enable KHR_present_id and KHR_present_wait
This is needed for DXVK and VKD3D-Proton in order to implement
DXGI frame latency and frame latency waitable objects.

Gamescope also requires this to keep in-step with the host.

Using the same enablement system as RADV, etc to be safe.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26752>
2023-12-21 05:38:47 +00:00
Joshua Ashton edb5229538 nvk: Hook up driconf for nvk_instance
We will use this in the future to enable present_id + present_wait like
in RADV.

This also enables the common WSI driconf entries for image count, etc
overrides to work by default, fixing some games.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26752>
2023-12-21 05:38:47 +00:00
Vinson Lee 2464cd81d3 nvk: Fix tautological-overlap-compare warning
../src/nouveau/vulkan/nvk_nir_lower_descriptors.c:145:55: warning: overlapping comparisons always evaluate to false [-Wtautological-overlap-compare]
  145 |    if (desc_type == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER &&
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
  146 |        desc_type == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC)
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fixes: f1c909edd5 ("nvk/nir: Add cbuf analysis to nvi_nir_lower_descriptors()")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26772>
2023-12-20 21:16:17 +00:00
Faith Ekstrand f11b4d1ebe nvk: Advertise shaderFloat64
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9661
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26587>
2023-12-20 02:40:25 +00:00
Faith Ekstrand 4a4815b855 nak/nir: Lower a bunch of fp64
All we have are add, mul, ffma, and comparisons.  Everything else has to
be lowered.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26587>
2023-12-20 02:40:25 +00:00
Faith Ekstrand e1fecd83ed nak/sm50: Add DMnMx and use it for fp64 fmin/fmax
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26587>
2023-12-20 02:40:25 +00:00
Faith Ekstrand 1a7e83c87f nak/sm50: Properly legalize OpSel and drop an assert
While we're here, update sm70 to be a bit more modern.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26587>
2023-12-20 02:40:25 +00:00
Faith Ekstrand 7f5c6642d8 nak/sm50: Fix encoding of iadd with imm32
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26587>
2023-12-20 02:40:25 +00:00
Daniel Almeida 0ac6a81ab5 nak: sm50: fix ineg legalization
There is nothing to be done, as we lower this op unconditionally.

We need to add an arm in the match to not panic, though.

Fixes a panic in
dEQP-VK.binding_model.shader_access.primary_cmd_buf.sampler_immutable.vertex_fragment.multiple_contiguous_descriptors.2d

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26587>
2023-12-20 02:40:25 +00:00
Faith Ekstrand 73a1acef18 nak/sm50: Fix encoding of f20 immediates
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26587>
2023-12-20 02:40:25 +00:00
Faith Ekstrand 17d2b2f2cc nak/sm50: Add encoding and legalization for dadd/dfma/dmul/dsetp
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26587>
2023-12-20 02:40:25 +00:00
Faith Ekstrand 1f5623c557 nak: Implement 64-bit nir_op_fsign
There is NIR lowering for this but this implementation is more
efficient.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26587>
2023-12-20 02:40:25 +00:00
Faith Ekstrand d03cbac05a nak: Fix encoding of dsetp with RZ on SM70+
The `as_reg().is_some()` check returns false when src[1].src_ref is
Zero but we want to handle that as a register case.  Replace it with a
match instead.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26587>
2023-12-20 02:40:24 +00:00
Faith Ekstrand 290d958c63 nak/nir: Set nir_lower_io_lower_64bit_to_32 for varyings
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26743>
2023-12-18 17:35:29 +00:00
Faith Ekstrand a9fb7b0280 nak: Implement b2f64
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26743>
2023-12-18 17:35:29 +00:00
Faith Ekstrand 26d649f120 nak: Fix nir_op_f2f64
We were only allocating one register

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26743>
2023-12-18 17:35:29 +00:00
Faith Ekstrand 7ced1d3648 nak: Wire up 64-bit nir_op_fadd/ffma/fmul and comparisons
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26743>
2023-12-18 17:35:28 +00:00
Faith Ekstrand 995eea8d04 nak: Split fmul/ffma handling from fmulz/ffmaz
They're enough of a special case that things are going to get confusing
when we start adding bit sizes to fmul/ffma.  Let's make them a special
case so they can assert all their things.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26743>
2023-12-18 17:35:28 +00:00
Faith Ekstrand 1236c5d4f1 nak: Add the rest of the double-precision ops
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26743>
2023-12-18 17:35:28 +00:00
Faith Ekstrand 2f899f44eb nak: Rework encoding of ALU instructions on SM70+
The main change here is that we match on src2 first and then src1.  This
lets make some of the src2 code common because src2 never moves around
if it's a register.  This change also has another subtle effect: None
sources now work everywhere.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26743>
2023-12-18 17:35:28 +00:00