platform/upstream/mesa.git
11 months agonvk: Compile geometry shaders
George Ouzounoudis [Tue, 18 Oct 2022 18:51:37 +0000 (21:51 +0300)]
nvk: Compile geometry shaders

This enables compiling geometry shaders.  Based primarily on gallium
nvc0/nvc0_program.c.

We need to enable/disable user clip planes based on the last geometry
stage.  Some asserts in codegen need to be changed too because the
compacted clip distance inputs are arrayed in the geometry shader. So we
have an array of clip distances for each input vertex.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Properly align root descriptor tables for pre-Pascal
Faith Ekstrand [Tue, 31 Jan 2023 02:12:06 +0000 (20:12 -0600)]
nvk: Properly align root descriptor tables for pre-Pascal

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Free a couple regs in nvk_mme_build_draw_*()
Faith Ekstrand [Tue, 31 Jan 2023 02:12:06 +0000 (20:12 -0600)]
nvk: Free a couple regs in nvk_mme_build_draw_*()

We don't need base_instance after we've set it the first time. We also
don't need to keep intance_count around forever.  mme_loop() always
consumes the value at the beginning so we can free up a register right
away.  Fermi is really tight on registers and this is enough to make
the basic draw MMEs successfully compile.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Disable indirect draw/dispatch and query copy MMEs for now
Faith Ekstrand [Tue, 31 Jan 2023 02:12:06 +0000 (20:12 -0600)]
nvk: Disable indirect draw/dispatch and query copy MMEs for now

These all rely on mme_tu104_read_fifoed() which isn't available before
Turing.  They're also really register-expensive and we can't compile
them without paring things down a bit.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Use a contiguous shader heap pre-Volta
Faith Ekstrand [Tue, 31 Jan 2023 02:12:06 +0000 (20:12 -0600)]
nvk: Use a contiguous shader heap pre-Volta

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Add support for contiguous heaps to nvk_heap
Faith Ekstrand [Tue, 31 Jan 2023 02:12:06 +0000 (20:12 -0600)]
nvk: Add support for contiguous heaps to nvk_heap

This is required for shader heaps pre-Volta because they use a single
64-bit base address and 32-bit offsets for individual shaders.  In this
case, the addresses returned from the heap are relative to the base.
The BO for the heap can be retrieved via nvk_heap_get_contiguous_bo_ref
which returns an actual reference so it's safe to call from the queue
submit path.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/mme: Add Fermi hardware tests
Mary [Fri, 6 Jan 2023 00:17:59 +0000 (01:17 +0100)]
nouveau/mme: Add Fermi hardware tests

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/mme: Add Fermi simulator
Mary [Fri, 6 Jan 2023 00:13:55 +0000 (01:13 +0100)]
nouveau/mme: Add Fermi simulator

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agoAdd add immediate optimizations
Faith Ekstrand [Tue, 31 Jan 2023 02:12:05 +0000 (20:12 -0600)]
Add add immediate optimizations

Also, immediates are signed 18-bit values so modify the builder to
support the entire range.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agoSupport immediates in MERGE
Faith Ekstrand [Tue, 31 Jan 2023 02:12:05 +0000 (20:12 -0600)]
Support immediates in MERGE

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/mme: Add Fermi builder
Mary [Thu, 5 Jan 2023 22:57:39 +0000 (23:57 +0100)]
nouveau/mme: Add Fermi builder

Co-Authored-By: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/mme: Add initial Fermi definition
Mary [Thu, 5 Jan 2023 22:43:00 +0000 (23:43 +0100)]
nouveau/mme: Add initial Fermi definition

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/mme: Take an nv_device_info in mme_builder_init
Faith Ekstrand [Tue, 31 Jan 2023 02:12:05 +0000 (20:12 -0600)]
nouveau/mme: Take an nv_device_info in mme_builder_init

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/mme: Prepare the builder for multiple GPU generations
Faith Ekstrand [Tue, 31 Jan 2023 02:12:05 +0000 (20:12 -0600)]
nouveau/mme: Prepare the builder for multiple GPU generations

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/mme: Move the cf_stack struct to mme_builder.h
Faith Ekstrand [Tue, 31 Jan 2023 02:12:05 +0000 (20:12 -0600)]
nouveau/mme: Move the cf_stack struct to mme_builder.h

Fermi wants exactly the same thing.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/mme: Drop the implicit_imm parameter from mme_alu_to()
Faith Ekstrand [Tue, 31 Jan 2023 02:12:05 +0000 (20:12 -0600)]
nouveau/mme: Drop the implicit_imm parameter from mme_alu_to()

It's only used for control-flow and MERGE, all of which are special.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/mme: Move the guts of mme_state_arr_to() into mme_tu104_builder.c
Faith Ekstrand [Tue, 31 Jan 2023 02:12:05 +0000 (20:12 -0600)]
nouveau/mme: Move the guts of mme_state_arr_to() into mme_tu104_builder.c

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/mme: Move the guts of mme_merge_to() into mme_tu104_builder.c
Faith Ekstrand [Tue, 31 Jan 2023 02:12:05 +0000 (20:12 -0600)]
nouveau/mme: Move the guts of mme_merge_to() into mme_tu104_builder.c

It's going to be a bit different on Fermi.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/mme: Break the Turing builder guts into a separate header
Faith Ekstrand [Tue, 31 Jan 2023 02:12:05 +0000 (20:12 -0600)]
nouveau/mme: Break the Turing builder guts into a separate header

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/mme: Make helpers less Turing specific
Faith Ekstrand [Tue, 31 Jan 2023 02:12:05 +0000 (20:12 -0600)]
nouveau/mme: Make helpers less Turing specific

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/mme: Use mme_mov() for temp copies of register IMM32 sources
Faith Ekstrand [Tue, 31 Jan 2023 02:12:05 +0000 (20:12 -0600)]
nouveau/mme: Use mme_mov() for temp copies of register IMM32 sources

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/mme: Add an intermediate MME_CMP_OP enum
Faith Ekstrand [Tue, 31 Jan 2023 02:12:05 +0000 (20:12 -0600)]
nouveau/mme: Add an intermediate MME_CMP_OP enum

Having everything go through the Turing opcodes isn't a good long-term
plan so add an intermediate which is independent of HW generation.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/mme: Add an intermediate MME_ALU_OP enum
Faith Ekstrand [Tue, 31 Jan 2023 02:12:05 +0000 (20:12 -0600)]
nouveau/mme: Add an intermediate MME_ALU_OP enum

Having everything go through the Turing opcodes isn't a good long-term
plan so add an intermediate which is independent of HW generation.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/mme: Add a mme_reg_alloc struct
Faith Ekstrand [Tue, 31 Jan 2023 02:12:05 +0000 (20:12 -0600)]
nouveau/mme: Add a mme_reg_alloc struct

This has some nice asserts which we'll want when we start having
reserved registers on Fermi.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/mme: Move mme_value into its own header
Faith Ekstrand [Tue, 31 Jan 2023 02:12:05 +0000 (20:12 -0600)]
nouveau/mme: Move mme_value into its own header

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Implement VK_EXT_image_view_min_lod
Rebecca Mckeever [Wed, 21 Dec 2022 19:01:04 +0000 (13:01 -0600)]
nvk: Implement VK_EXT_image_view_min_lod

Closes: https://gitlab.freedesktop.org/nouveau/mesa/-/issues/40

Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/nil: Add macros for ufixed
Rebecca Mckeever [Thu, 22 Dec 2022 00:03:52 +0000 (18:03 -0600)]
nouveau/nil: Add macros for ufixed

Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/mme: Make alu_op_to_str static
Faith Ekstrand [Tue, 31 Jan 2023 02:12:05 +0000 (20:12 -0600)]
nouveau/mme: Make alu_op_to_str static

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/mme: Invoke SET_OBJECT in the tests
Faith Ekstrand [Tue, 31 Jan 2023 02:12:05 +0000 (20:12 -0600)]
nouveau/mme: Invoke SET_OBJECT in the tests

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/nil: Use nv_device_info for format queries
Faith Ekstrand [Tue, 31 Jan 2023 02:12:05 +0000 (20:12 -0600)]
nouveau/nil: Use nv_device_info for format queries

There's no reason why any of this needs access to the fd or the context.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/nil: Take an nv_device_info for image functions
Faith Ekstrand [Tue, 31 Jan 2023 02:12:05 +0000 (20:12 -0600)]
nouveau/nil: Take an nv_device_info for image functions

There's no reason why any of this needs access to the fd or the context.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/winsys: Move device type into nv_device_info
Faith Ekstrand [Tue, 31 Jan 2023 02:12:05 +0000 (20:12 -0600)]
nouveau/winsys: Move device type into nv_device_info

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/winsys: Add an info to nouveau_ws_device
Faith Ekstrand [Tue, 31 Jan 2023 02:12:05 +0000 (20:12 -0600)]
nouveau/winsys: Add an info to nouveau_ws_device

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonouveau/winsys: Take a drmDevicePtr in nouveau_ws_device_new()
Faith Ekstrand [Tue, 31 Jan 2023 02:12:05 +0000 (20:12 -0600)]
nouveau/winsys: Take a drmDevicePtr in nouveau_ws_device_new()

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Implement VK_EXT_non_seamless_cube_map
Rebecca Mckeever [Wed, 4 Jan 2023 23:17:24 +0000 (15:17 -0800)]
nvk: Implement VK_EXT_non_seamless_cube_map

Add new bit to VkSamplerCreateFlags and then advertise
VK_EXT_non_seamless_cube_map.

Closes: https://gitlab.freedesktop.org/nouveau/mesa/-/issues/42

Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Enable shadow sampling
Rebecca Mckeever [Wed, 4 Jan 2023 23:16:55 +0000 (15:16 -0800)]
nvk: Enable shadow sampling

Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Advertise EXT_4444_formats
Rebecca Mckeever [Fri, 9 Dec 2022 21:25:48 +0000 (15:25 -0600)]
nvk: Advertise EXT_4444_formats

The following tests now pass:

dEQP-VK.texture.filtering.2d.formats.a4b4g4r4_unorm.nearest
dEQP-VK.texture.filtering.2d.formats.a4b4g4r4_unorm.linear
dEQP-VK.texture.filtering.2d.formats.a4b4g4r4_unorm.nearest_mipmap_nearest
dEQP-VK.texture.filtering.2d.formats.a4b4g4r4_unorm.linear_mipmap_nearest
dEQP-VK.texture.filtering.2d.formats.a4b4g4r4_unorm.nearest_mipmap_linear
dEQP-VK.texture.filtering.2d.formats.a4b4g4r4_unorm.linear_mipmap_linear

The corresponding tests for a4r4g4b4_unorm are still passing.

Closes: https://gitlab.freedesktop.org/nouveau/mesa/-/issues/36

Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Add A4B4G4R4 formats to nil_format_info table
Rebecca Mckeever [Fri, 9 Dec 2022 21:06:27 +0000 (15:06 -0600)]
nvk: Add A4B4G4R4 formats to nil_format_info table

The nil_format_info table contains the following lines, which add
A4R4G4B4 formats.

   C4(A, B4G4R4A4_UNORM,   NONE,       B, G, R, A, UNORM,   A4B4G4R4,   T),
   F3(A, B4G4R4X4_UNORM,   NONE,       B, G, R, x, UNORM,   A4B4G4R4,   T),

Add similar lines to the nil_format_info table for A4B4G4R4 formats.

Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Add VK_FORMAT_B4G4R4A4_UNORM_PACK16 format to nil_format_info table
Rebecca Mckeever [Fri, 9 Dec 2022 21:12:50 +0000 (15:12 -0600)]
nvk: Add VK_FORMAT_B4G4R4A4_UNORM_PACK16 format to nil_format_info table

The following tests now pass:

dEQP-VK.pipeline.monolithic.sampler.view_type.2d_unnormalized.format.b4g4r4a4_unorm_pack16.*

Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Advertise KHR_device_group
Rebecca Mckeever [Fri, 9 Dec 2022 22:35:30 +0000 (16:35 -0600)]
nvk: Advertise KHR_device_group

Closes: https://gitlab.freedesktop.org/nouveau/mesa/-/issues/35

Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Implement nvk_CmdDispatchBase and delete nvk_CmdDispatch
Rebecca Mckeever [Fri, 9 Dec 2022 22:33:41 +0000 (16:33 -0600)]
nvk: Implement nvk_CmdDispatchBase and delete nvk_CmdDispatch

Implement nvk_CmdDispatchBase() and then delete nvk_CmdDispatch() so that
the vk_common verion with be used instead. This will avoid repeated code.
Update nvk_CmdDispatchIndirect() so that it sets the three base_group
fields of the root descriptor table to 0.

Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Lower base_workgroup_id
Rebecca Mckeever [Fri, 9 Dec 2022 22:32:57 +0000 (16:32 -0600)]
nvk: Lower base_workgroup_id

Lower load_base_workgroup_id intrinsics to a load_ubo using NIR.

Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Add base_group to root descriptor table
Rebecca Mckeever [Fri, 9 Dec 2022 22:31:42 +0000 (16:31 -0600)]
nvk: Add base_group to root descriptor table

Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Set maxMemoryAllocationCount
Faith Ekstrand [Tue, 31 Jan 2023 02:12:04 +0000 (20:12 -0600)]
nvk: Set maxMemoryAllocationCount

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: call correct macro to clear views
Thomas H.P. Andersen [Tue, 22 Nov 2022 23:29:26 +0000 (00:29 +0100)]
nvk: call correct macro to clear views

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: fix maxPushDescriptors
Thomas H.P. Andersen [Thu, 24 Nov 2022 23:52:31 +0000 (00:52 +0100)]
nvk: fix maxPushDescriptors

maxPushDescriptors was advertised as 0.

Spotted with Sascha Willems pushdescriptors example

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Add a helper for loading resource_index-based descriptors
Faith Ekstrand [Tue, 31 Jan 2023 02:12:04 +0000 (20:12 -0600)]
nvk: Add a helper for loading resource_index-based descriptors

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Drop block_size from the root descriptor table
Faith Ekstrand [Tue, 31 Jan 2023 02:12:04 +0000 (20:12 -0600)]
nvk: Drop block_size from the root descriptor table

It's unused because Vulkan doesn't support compute dispatches with an
unknown workgroup size.  If we ever do, we can add it back in. In case
it ever comes back, add an unreachable() to nvk_nir_lower_descriptors().

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Lower load_num_workgroups ourselves
Faith Ekstrand [Tue, 31 Jan 2023 02:12:04 +0000 (20:12 -0600)]
nvk: Lower load_num_workgroups ourselves

Instead of relying on the back-end to put it at a magic offset in a
magic constant buffer, lower it in NIR.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Rename grid_size to group_count
Faith Ekstrand [Tue, 31 Jan 2023 02:12:04 +0000 (20:12 -0600)]
nvk: Rename grid_size to group_count

That's the Vulkan name for it.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Capitalize NVK in user exposed strings
Faith Ekstrand [Tue, 31 Jan 2023 02:12:04 +0000 (20:12 -0600)]
nvk: Capitalize NVK in user exposed strings

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: expose KHR_driver_properties
Yusuf Khan [Tue, 8 Nov 2022 07:19:08 +0000 (01:19 -0600)]
nvk: expose KHR_driver_properties

Signed-off-by: Yusuf Khan <yusisamerican@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Advertise VK_EXT_separate_stencil_usage
Faith Ekstrand [Tue, 31 Jan 2023 02:12:04 +0000 (20:12 -0600)]
nvk: Advertise VK_EXT_separate_stencil_usage

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Advertise EXT_index_type_uint8
Faith Ekstrand [Tue, 31 Jan 2023 02:12:04 +0000 (20:12 -0600)]
nvk: Advertise EXT_index_type_uint8

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Advertise KHR_uniform_buffer_standard_layout
Faith Ekstrand [Tue, 31 Jan 2023 02:12:04 +0000 (20:12 -0600)]
nvk: Advertise KHR_uniform_buffer_standard_layout

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Enable KHR_dynamic_rendering
Faith Ekstrand [Tue, 31 Jan 2023 02:12:04 +0000 (20:12 -0600)]
nvk: Enable KHR_dynamic_rendering

We've been dynamic rendering since day 1

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Advertise VK_KHR_bind_memory2
Faith Ekstrand [Tue, 31 Jan 2023 02:12:04 +0000 (20:12 -0600)]
nvk: Advertise VK_KHR_bind_memory2

We already use the entrypoint (via the 1.0 wrappers); we just need to
turn on the extension.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Advertise samplerMirrorClampToEdge via 1.2 features
Faith Ekstrand [Tue, 31 Jan 2023 02:12:04 +0000 (20:12 -0600)]
nvk: Advertise samplerMirrorClampToEdge via 1.2 features

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Enable VK_EXT_provoking_vertex
Faith Ekstrand [Tue, 31 Jan 2023 02:12:04 +0000 (20:12 -0600)]
nvk: Enable VK_EXT_provoking_vertex

We already have it plumbed through.  Just need to turn it on.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Enable inheritedQueries
Faith Ekstrand [Tue, 31 Jan 2023 02:12:04 +0000 (20:12 -0600)]
nvk: Enable inheritedQueries

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Re-order Vulkan 1.0 feature bits
Faith Ekstrand [Tue, 31 Jan 2023 02:12:04 +0000 (20:12 -0600)]
nvk: Re-order Vulkan 1.0 feature bits

Also, leave TODO comments for anything we want to enable but haven't.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Convert system values for gl_PointCoord and PointCoord into inputs
Rebecca Mckeever [Tue, 22 Nov 2022 00:45:01 +0000 (18:45 -0600)]
nvk: Convert system values for gl_PointCoord and PointCoord into inputs

Currently, any attempt to use gl_PointCoord (GLSL) or PointCoord (SPIR-V)
results in an assert in codegen:

ERROR: unknown nir_intrinsic_op load_point_coord

This patch addresses the error by converting nir_intrinsic_load_point_coord
system value into VARYING_SLOT_PNTC. The following tests now pass:

dEQP-VK.glsl.builtin_var.simple.pointcoord
dEQP-VK.glsl.builtin_var.simple.pointcoord_uniform_frag
dEQP-VK.glsl.builtin_var.simple.pointcoord_uniform_vert

Closes: https://gitlab.freedesktop.org/nouveau/mesa/-/issues/33
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Use nvk_buffer_addr_range for buffer descriptors
Faith Ekstrand [Tue, 31 Jan 2023 02:12:04 +0000 (20:12 -0600)]
nvk: Use nvk_buffer_addr_range for buffer descriptors

Because the helper checks for buffer == NULL, this should prepare us for
VK_KHR_robustness2 where we need to handle null descriptors.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Add an nvk_buffer_addr_range helper
Faith Ekstrand [Tue, 31 Jan 2023 02:12:04 +0000 (20:12 -0600)]
nvk: Add an nvk_buffer_addr_range helper

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Fix a comment
Faith Ekstrand [Tue, 31 Jan 2023 02:12:04 +0000 (20:12 -0600)]
nvk: Fix a comment

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Support large points
George Ouzounoudis [Sun, 13 Nov 2022 10:43:02 +0000 (12:43 +0200)]
nvk: Support large points

We just need to enable the shader attribute.  With point sprite
rasterization we get correct results on rasterization and draw tests.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Switch point rasterization to point sprites
George Ouzounoudis [Sun, 13 Nov 2022 10:35:09 +0000 (12:35 +0200)]
nvk: Switch point rasterization to point sprites

It seems for Vulkan we always need square points with shader PointCoords
just like OpenGL point sprites.

From vulkan spec's point rasterization:
"Point rasterization produces a fragment for each fragment area group of
framebuffer pixels with one or more sample points that intersect a region
centered at the point’s (xf,yf).
This region is a square with side equal to the current point size.
... (xf,yf) is the exact, unrounded framebuffer coordinate of the vertex
for the point"

From OpenGL compatibility spec:
Basic point rasterization:
"If point sprites are enabled, then point rasterization produces a
fragment for each framebuffer pixel whose center lies inside a square
centered at the point’s (xw, yw), with side length equal to the current
point size.
... and xw and yw are the exact, unrounded window coordinates of the
vertex for the point"

Also in OpenGL multisampling leads to circle points as we see in the spec:
Point multisample rasterization:
"This region is a circle having diameter equal to the current point width
if POINT_SPRITE is disabled, or a square with side equal to the current
point width if POINT_SPRITE is enabled."

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Lower image_size to txs
Faith Ekstrand [Fri, 28 Jul 2023 15:37:16 +0000 (10:37 -0500)]
nvk: Lower image_size to txs

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: wire up M2MF for Fermi
Karol Herbst [Sat, 10 Sep 2022 22:38:34 +0000 (00:38 +0200)]
nvk: wire up M2MF for Fermi

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: allocate VAB memory area
Karol Herbst [Sat, 10 Sep 2022 20:44:24 +0000 (22:44 +0200)]
nvk: allocate VAB memory area

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk/device: fix order of error handling
Karol Herbst [Thu, 22 Sep 2022 18:27:23 +0000 (20:27 +0200)]
nvk/device: fix order of error handling

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: support pre Maxwell Texture Headers
Karol Herbst [Sat, 10 Sep 2022 16:00:01 +0000 (18:00 +0200)]
nvk: support pre Maxwell Texture Headers

GM10x seems to disable it by default, so enable them there.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: bind more subchans in init_context_state
Karol Herbst [Sat, 10 Sep 2022 15:47:44 +0000 (17:47 +0200)]
nvk: bind more subchans in init_context_state

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: reduce pitch for FillBuffer
Karol Herbst [Sat, 10 Sep 2022 01:40:21 +0000 (03:40 +0200)]
nvk: reduce pitch for FillBuffer

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: use remaps for image copies
Karol Herbst [Fri, 9 Sep 2022 23:17:16 +0000 (01:17 +0200)]
nvk: use remaps for image copies

This helps us to get around hardware limitations on the width.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: properly align slm size
Karol Herbst [Fri, 9 Sep 2022 16:46:58 +0000 (18:46 +0200)]
nvk: properly align slm size

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Use SET_PIPELINE_PROGRAM pre-Volta
Karol Herbst [Sun, 28 Aug 2022 21:26:03 +0000 (23:26 +0200)]
nvk: Use SET_PIPELINE_PROGRAM pre-Volta

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: align desc root table
Karol Herbst [Mon, 29 Aug 2022 00:31:19 +0000 (02:31 +0200)]
nvk: align desc root table

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: rework QMD handling to support pre Turing
Karol Herbst [Sun, 28 Aug 2022 18:08:09 +0000 (20:08 +0200)]
nvk: rework QMD handling to support pre Turing

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: properly align shaders pre Turing
Karol Herbst [Thu, 8 Sep 2022 14:49:53 +0000 (16:49 +0200)]
nvk: properly align shaders pre Turing

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: fix some class version checks
Karol Herbst [Sun, 28 Aug 2022 15:44:19 +0000 (17:44 +0200)]
nvk: fix some class version checks

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Advertise EXT_vertex_attribute_divisor
Faith Ekstrand [Tue, 31 Jan 2023 02:12:03 +0000 (20:12 -0600)]
nvk: Advertise EXT_vertex_attribute_divisor

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: advertise EXT_image_2d_view_of_3d
Thomas H.P. Andersen [Thu, 10 Nov 2022 22:39:26 +0000 (23:39 +0100)]
nvk: advertise EXT_image_2d_view_of_3d

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: add check for VK_IMAGE_CREATE_2D_VIEW_COMPATIBLE_BIT_EXT
Thomas H.P. Andersen [Thu, 10 Nov 2022 22:38:07 +0000 (23:38 +0100)]
nvk: add check for VK_IMAGE_CREATE_2D_VIEW_COMPATIBLE_BIT_EXT

The tests in dEQP-VK.pipeline.*.image_2d_view_3d_image.* set this
bit and nil was not checking for it

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Support base instance in instanced draw calls
George Ouzounoudis [Fri, 4 Nov 2022 20:28:17 +0000 (22:28 +0200)]
nvk: Support base instance in instanced draw calls

Vulkan's gl_InstanceIndex is different than OpenGL gl_InstanceID.
For nvk, gl_InstanceIndex is lowered as gl_BaseInstance + gl_InstanceID in nir
code. This means we need to supply base instance to the vertex shader.
We load the value at mme draw time to a root constant, as it seems there
is no existing system value corresponding to this info.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Set base vertex state in sequential mme draw
George Ouzounoudis [Wed, 9 Nov 2022 18:28:39 +0000 (20:28 +0200)]
nvk: Set base vertex state in sequential mme draw

We need to set base vertex state to zero before emitting a sequential
draw call, if we have already emitted an indexed draw call that changed
that state.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Add a macro for root descriptor table byte offsets
George Ouzounoudis [Wed, 9 Nov 2022 18:13:26 +0000 (20:13 +0200)]
nvk: Add a macro for root descriptor table byte offsets

Use a helper macro instead of using offsetof directly.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Do not increment instance id across draws
George Ouzounoudis [Wed, 9 Nov 2022 17:50:32 +0000 (19:50 +0200)]
nvk: Do not increment instance id across draws

In cases of multiple draws (i.e. indirect draws) instance id should not
increment across draw boundaries. Use a local copy of "begin" to modify
the instance id inside the instances loop only.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Add a devenv ICD json file
Faith Ekstrand [Tue, 31 Jan 2023 02:12:03 +0000 (20:12 -0600)]
nvk: Add a devenv ICD json file

This also reworks the ICD generation stuff based on the radv header

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Support VK_FORMAT_B10G11R11_UFLOAT_PACK32 for vertex buffers
Faith Ekstrand [Tue, 31 Jan 2023 02:12:03 +0000 (20:12 -0600)]
nvk: Support VK_FORMAT_B10G11R11_UFLOAT_PACK32 for vertex buffers

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: fix multiple pipelines failure allocation case.
Dave Airlie [Fri, 4 Nov 2022 03:37:58 +0000 (13:37 +1000)]
nvk: fix multiple pipelines failure allocation case.

Fixes these failures:
dEQP-VK.api.object_management.alloc_callback_fail_multiple*

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk/format: Style fix for VkFormatProperties3KHR
Faith Ekstrand [Tue, 31 Jan 2023 02:12:03 +0000 (20:12 -0600)]
nvk/format: Style fix for VkFormatProperties3KHR

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Add a bo size to nvk_descriptor_set
Faith Ekstrand [Tue, 31 Jan 2023 02:12:03 +0000 (20:12 -0600)]
nvk: Add a bo size to nvk_descriptor_set

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Assert that descriptor buffer access stays in-bounds
Faith Ekstrand [Tue, 31 Jan 2023 02:12:03 +0000 (20:12 -0600)]
nvk: Assert that descriptor buffer access stays in-bounds

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Advertise VK_KHR_depth_stencil_resolve
Faith Ekstrand [Tue, 31 Jan 2023 02:12:03 +0000 (20:12 -0600)]
nvk: Advertise VK_KHR_depth_stencil_resolve

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Advertise MSAA via image format properties
Faith Ekstrand [Tue, 31 Jan 2023 02:12:03 +0000 (20:12 -0600)]
nvk: Advertise MSAA via image format properties

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Stop advertising higher framebufferNoAttachmentsSampleCounts
Faith Ekstrand [Tue, 31 Jan 2023 02:12:03 +0000 (20:12 -0600)]
nvk: Stop advertising higher framebufferNoAttachmentsSampleCounts

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Replace gl_SamplePosition with fract(gl_FragCoord.xy)
Faith Ekstrand [Tue, 31 Jan 2023 02:12:03 +0000 (20:12 -0600)]
nvk: Replace gl_SamplePosition with fract(gl_FragCoord.xy)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk: Use meta for MSAA resolves
Faith Ekstrand [Tue, 31 Jan 2023 02:12:03 +0000 (20:12 -0600)]
nvk: Use meta for MSAA resolves

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

11 months agonvk/meta: Fix restore for descriptor set 0
Faith Ekstrand [Tue, 31 Jan 2023 02:12:03 +0000 (20:12 -0600)]
nvk/meta: Fix restore for descriptor set 0

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>