Commit graph

175764 commits

Author SHA1 Message Date
Rebecca Mckeever
45c2ebc341 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>
2023-08-04 21:32:02 +00:00
Faith Ekstrand
a08ad59ea6 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>
2023-08-04 21:32:02 +00:00
Faith Ekstrand
08e5a211dc nvk: Add an nvk_buffer_addr_range helper
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:02 +00:00
Faith Ekstrand
e0e16a7893 nvk: Fix a comment
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:02 +00:00
George Ouzounoudis
d8c21d89e8 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>
2023-08-04 21:32:02 +00:00
George Ouzounoudis
e6ef49b454 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>
2023-08-04 21:32:02 +00:00
Faith Ekstrand
4fa8df43ea nvk: Lower image_size to txs
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:02 +00:00
Karol Herbst
ae14362ff6 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>
2023-08-04 21:32:02 +00:00
Karol Herbst
970bd70584 nvk: allocate VAB memory area
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:02 +00:00
Karol Herbst
8633aac584 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>
2023-08-04 21:32:02 +00:00
Karol Herbst
27d6f994ba 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>
2023-08-04 21:32:02 +00:00
Karol Herbst
6214bfd139 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>
2023-08-04 21:32:02 +00:00
Karol Herbst
cd48710176 nvk: reduce pitch for FillBuffer
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:02 +00:00
Karol Herbst
1eb63dd19a 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>
2023-08-04 21:32:02 +00:00
Karol Herbst
a39d22f246 nvk: properly align slm size
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:02 +00:00
Karol Herbst
cb54c32fee 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>
2023-08-04 21:32:02 +00:00
Karol Herbst
f24bd52915 nvk: align desc root table
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:02 +00:00
Karol Herbst
2a8673f694 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>
2023-08-04 21:32:02 +00:00
Karol Herbst
80d0a074fc 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>
2023-08-04 21:32:02 +00:00
Karol Herbst
1949c83381 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>
2023-08-04 21:32:02 +00:00
Faith Ekstrand
891624b08f nvk: Advertise EXT_vertex_attribute_divisor
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:02 +00:00
Thomas H.P. Andersen
b9316b624a nvk: advertise EXT_image_2d_view_of_3d
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:02 +00:00
Thomas H.P. Andersen
380a2bc795 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>
2023-08-04 21:32:02 +00:00
George Ouzounoudis
6f9319f60f 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>
2023-08-04 21:32:02 +00:00
George Ouzounoudis
b2a52982d1 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>
2023-08-04 21:32:02 +00:00
George Ouzounoudis
73f5ab5456 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>
2023-08-04 21:32:02 +00:00
George Ouzounoudis
0de4083544 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>
2023-08-04 21:32:02 +00:00
Faith Ekstrand
ff30b05917 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>
2023-08-04 21:32:02 +00:00
Faith Ekstrand
b0d8ddc70e nvk: Support VK_FORMAT_B10G11R11_UFLOAT_PACK32 for vertex buffers
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:02 +00:00
Dave Airlie
c9b72acc4e 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>
2023-08-04 21:32:02 +00:00
Faith Ekstrand
79d7ee22e1 nvk/format: Style fix for VkFormatProperties3KHR
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:02 +00:00
Faith Ekstrand
7d629d7aec nvk: Add a bo size to nvk_descriptor_set
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:02 +00:00
Faith Ekstrand
3568027b9d nvk: Assert that descriptor buffer access stays in-bounds
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:02 +00:00
Faith Ekstrand
be417625c4 nvk: Advertise VK_KHR_depth_stencil_resolve
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:02 +00:00
Faith Ekstrand
d47ca67cde nvk: Advertise MSAA via image format properties
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:02 +00:00
Faith Ekstrand
8dc19e1cce nvk: Stop advertising higher framebufferNoAttachmentsSampleCounts
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:02 +00:00
Faith Ekstrand
d6a0c1cd4b nvk: Replace gl_SamplePosition with fract(gl_FragCoord.xy)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:02 +00:00
Faith Ekstrand
4bd2ba31fc nvk: Use meta for MSAA resolves
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:02 +00:00
Faith Ekstrand
1c3dc8c632 nvk/meta: Fix restore for descriptor set 0
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:02 +00:00
Faith Ekstrand
1a94c55632 vulkan/meta: Add support for MSAA resolves
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:01 +00:00
Faith Ekstrand
57314fcdc6 vulkan/meta: Rename vk_meta_blit.c to vk_meta_blit_resolve.c
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:01 +00:00
Faith Ekstrand
d813fe50a4 vulkan/meta: Support writing stencil as iterative discard
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:01 +00:00
Faith Ekstrand
c184b54ef9 vulkan/meta: Break the guts of blit into a helper
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:01 +00:00
Faith Ekstrand
266a472b28 vulkan/meta: Add a helper for building texture ops
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:01 +00:00
Faith Ekstrand
996844f884 vulkan/meta: Bind whole LODs of 3D blit destinations
Instead of only binding the layers we need, bind the whole LOD.  In
particular, we now set a layer range of [0, 1] when creating the image
view but a layerCount of minify(depth, level) in VkRenderingInfo.  While
still a bit out of spec, this is more in line with how 3D image views
typically work for sampled and storage images and allows us to avoid
creating 2D images views which would require 2D_ARRAY_COMPATIBLE_BIT.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:01 +00:00
Faith Ekstrand
a34edc7500 nvk: Fill out sample locations on Maxwell B+
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:01 +00:00
Faith Ekstrand
7660e585f6 nvk: Stop creating a new upload BO every time
We intended this optimization for the case where we're uploading more
data than we had in the previous upload BO.  If there is no previous
upload BO, we always want to set it to the new one.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:01 +00:00
Faith Ekstrand
55278fe2b8 nvk: Set correct multisample regs for graphics pipelines
This adds SAMPLE_MASK_*, ANTI_ALIAS_CONTROL, and drops ANTI_ALIAS which
we set in BeginRendering().

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:01 +00:00
Faith Ekstrand
0842cae081 nvk: Pass through a shader key for fragment shaders and MSAA
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:01 +00:00
Faith Ekstrand
a02f65809c nvk: Use the right view format for stencil texturing
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:01 +00:00