Commit Graph

659 Commits

Author SHA1 Message Date
Boris Brezillon 447d448513 ci/windows: Bump spirv-samples commit-ID
We need the fix adding a Block decoration to the BuiltIn struct in
SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position_Initializer.spvasm.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16221>
2022-06-08 15:17:05 +00:00
Boris Brezillon c06b265ec7 dzn: Emit missing transition barriers for rendering attachments
VkRenderingAttachmentInitialLayoutInfoMESA provides information about
the initialLayout -> currentLayout that's expected when we begin a
render pass. Let's take it into account.

Fixes: 2d0798440b ("dzn: Add support for dynamic rendering")
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16792>
2022-06-07 08:15:25 +00:00
Yonggang Luo ca700dcb0a microsoft/clc: Fixes compiling of microsoft clc with mingw
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16767>
2022-06-03 16:33:00 +00:00
Yonggang Luo 1720672e33 dzn: Fixes compiling error by include `<unknwn.h>`
In mingw's `<unknwn.h>`, it's defeind __REQUIRED_RPCNDR_H_VERSION__ to 475,
so that gcc/mingw won't raise compiling error that because directx/d3d12.h
define __REQUIRED_RPCNDR_H_VERSION__ to 500, but the maximal supported __REQUIRED_RPCNDR_H_VERSION__ in mingw
are 475.

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16767>
2022-06-03 16:33:00 +00:00
Yonggang Luo 0445bfdc1b dzn: Fixes compiling error when build with msys2/mingw
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16767>
2022-06-03 16:33:00 +00:00
Boris Brezillon 2feef505c1 microsoft/spirv_to_dxil: Fix the push_constant UBO size calculation
Right now, we just consider the size of the accessed portion of the
push constant array, but it doesn't necessarily reflect the size
of the UBO we should declare.

Fixes: de1e941c59 ("microsoft/spirv_to_dxil: Lower push constant loads to UBO loads")
Reviewed-by: Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16703>
2022-06-03 10:43:18 +00:00
Boris Brezillon 6783a88455 microsoft/spirv_to_dxil: Fix push_constants type declaration
We're not declaring an array of bytes but an array of uint32. Let's
fix the element_count we pass to glsl_array_type().

Fixes: de1e941c59 ("microsoft/spirv_to_dxil: Lower push constant loads to UBO loads")
Reviewed-by: Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16703>
2022-06-03 10:43:17 +00:00
Erik Faye-Lund 8901df12ab dzn: add debug option to redirect stdout/stderr
For applications that doesn't have a terminal, it's useful to get output
like nir_log etc output somewhere.

This outputs these to stderr.txt and stdout.txt in the current user's
home directory, typically in C:\Users\my-user\.

Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16640>
2022-06-01 08:54:22 +00:00
Erik Faye-Lund 9f3a5b4313 dzn: add a debug-flag to wait for the debugger
It's geneunely useful to wait for the debugger to attach in some cases.
So let's add a debug-flag and staill untik the debugger has attached.

Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16640>
2022-06-01 08:54:21 +00:00
Jesse Natalie cb2cc69ebb dzn: Update fails/flakes
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16756>
2022-05-31 18:32:59 +00:00
Jesse Natalie a56d47b0ba microsoft/compiler: Fixup sampler derefs in tex instrs that don't *need* samplers
Sometimes you can end up with tex instructions that have sampler deref srcs, even though
they don't need them, e.g. a txs. In this case, still fix up those derefs in the sampler
splitting pass rather than leaving them pointing to a typed sampler.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16639>
2022-05-30 07:28:50 +00:00
Boris Brezillon 47c6f7ccf3 dzn: Use the correct ICD path on Win32
Similar to commit c6cddd2e17 ("lavapipe: Use the correct ICD path on
Win32"), but applied to dozen.

Suggested-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16634>
2022-05-23 08:45:24 +00:00
Boris Brezillon 1eaba553e2 dzn: Use the vk_sync_binary abstraction
D3D12 fences are capable of handling binary operations, but the
current dzn_sync implementation doesn't match vk_sync expectations
when sync objects are used to back semaphores. In that case, the wait
operation is supposed to set the sync object back to an unsignaled
state after the wait succeeded, but there's no way of knowing what
the sync object is used for, and this implicit-reset behavior is not
expected on fence objects, which also use the sync primitive.
That means we currently have a semaphore implementation that works
only once, and, as soon as the semaphore object has been signaled it
stays in a signaled state until it's destroyed.

We could extend the sync framework to pass an
implicit-reset-after-wait flag, but, given no one else seems to
need that, it's probably simpler to drop the binary sync
capability and rely on the binary-on-top-of-timeline emulation provided
by the core.

Fixes: a012b21964 ("microsoft: Initial vulkan-on-12 driver")
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16629>
2022-05-23 08:09:15 +00:00
Jesse Natalie be5c7c0351 dzn: Add new parameter to vk_image_view_init call
Fixes: fc8d2543 ("vulkan,v3dv: Add a driver_internal flag to vk_image_view_init/create")
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16589>
2022-05-18 11:03:26 -07:00
Timothy Arceri 2a2a2e58d1 d3d12: switch to NIR loop unrolling
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16543>
2022-05-17 02:12:21 +00:00
Boris Brezillon 3999fcba15 dzn: Fix dzn_cmd_buffer_collect_queries()
We can have an empty dzn_cmd_buffer_query_pool_state::collect
bitset, handle that case properly.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16396>
2022-05-16 07:46:57 +00:00
Erik Faye-Lund 0ef28ca34a dzn: reset correct list
It makes no sense to add the active heaps to the free heaps, just to
remove them again. Instead, let's move them from the one list to the
other.

This fixes a crash in Doom 2016 after a while, due to resource
exhaustion.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16514>
2022-05-16 07:20:37 +00:00
Karol Herbst 9c5fd100cc nir: add a nir_remove_non_entrypoints helper
This code just got duplicated a lot. There is still more, but the
remaining instances do a bit more than just removing other functions.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16348>
2022-05-10 03:37:44 +00:00
Jesse Natalie ab9d649ac3 microsoft/compiler: Unload DXIL validator library *after* calling Release()
Otherwise, the code to actually run Release() might not be loaded or
callable anymore.

Fixes: 193cf76c ("microsoft/compiler: add common dxil-validator API")
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16225>
2022-04-29 16:16:22 +00:00
Erik Faye-Lund 41fcffeda0 microsoft/compiler: fixup indentation
Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16079>
2022-04-29 07:08:57 +00:00
Erik Faye-Lund f8fe225840 microsoft/clc: fixup indentation
Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16079>
2022-04-29 07:08:57 +00:00
Emma Anholt 536c8ee96d nir/lower_tex: Make the adding a 0 LOD to nir_op_tex in the VS optional.
This controls the whole lowering of "make tex ops with implicit
derivatives on non-implicit-derivative stages be tex ops with an explicit
lod of 0 instead", but it's really hard to describe that in a git commit
summary.

All existing callers get it added except:
- nir_to_tgsi which didn't want it.
- nouveau, which didn't want it (fixes regressions in shadowcube and
  shadow2darray with NIR, since the shading languages don't expose txl of
  those sampler types and thus it's not supported in HW)
- optional lowering passes in mesa/st (lower_rect, YUV lowering, etc)

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16156>
2022-04-28 21:26:08 +00:00
Boris Brezillon 1999e927b0 dzn: Fix the STATIC_ASSERT() in dzn_meta_blits_get_context()
We care about the object key size, not the size of a pointer.

Fixes: a012b21964 ("microsoft: Initial vulkan-on-12 driver")
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16109>
2022-04-22 20:45:04 +00:00
Boris Brezillon 3328f6be06 dzn: Pass the dzn_event pointer to _mesa_hash_table_insert()
The key is supposed to be the dzn_event pointer, not the VkEvent
object, even if they do match in practice on 64bit builds.

Fixes: a012b21964 ("microsoft: Initial vulkan-on-12 driver")
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16109>
2022-04-22 20:45:04 +00:00
Boris Brezillon cb9ad71d75 dzn: Add missing VKAPI_{ATTR,CALL} specifiers to BeginCommandBuffer()
Fixes: a012b21964 ("microsoft: Initial vulkan-on-12 driver")
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16109>
2022-04-22 20:45:04 +00:00
Boris Brezillon e018311b35 dzn: Add KHR_draw_indirect_count support
Unfortunately it's not as simple as passing the indirect draw count
buffer to ExecuteIndirect. The compute job that populate the execute
buffer also needs to know the number of entries that need to be
patched. Instead of transitioning the indirect count buffer from
GENERIC_READ to INDIRECT_ARGUMENT we just keep at as a read-only
resource and copy the draw_count value to the exec buffer in the
compute job.

Acked-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15914>
2022-04-22 10:01:51 +00:00
Boris Brezillon ece5e27a7f dzn: Allow multiDrawIndirect and drawIndirectFirstInstance
Those are already supported, let's just toggle the switch.

Acked-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15914>
2022-04-22 10:01:51 +00:00
Boris Brezillon e293691a99 dzn: Get rid of the render pass logic
The core provides generic render-pass -> dynamic-rendering wrappers,
so let's rely on them instead of implementing our own logic.

Suggested-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15913>
2022-04-22 01:07:51 -07:00
Boris Brezillon 2d0798440b dzn: Add support for dynamic rendering
This is how D3D12 works, so nothing really complicated here. We just
add a bunch of states to the render state, patch the pipeline building
logic to support dynamic rendering, and add new functions to

Suggested-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15913>
2022-04-22 01:07:49 -07:00
Boris Brezillon 076eac0e62 dzn: Inline dzn_cmd_buffer_clear_attachments()
It's only called from dzn_CmdClearAttachments(), so let's move the
code there.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15913>
2022-04-22 01:07:22 -07:00
Boris Brezillon 70b06e775b dzn: Move all render-related states to a substruct
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15913>
2022-04-22 01:07:22 -07:00
Boris Brezillon d3836df8d4 dzn: Set MAX_RTS to D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT
D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT == 8, so no functional change
here, it's just cleaner to use the D3D12 definition.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15913>
2022-04-22 01:07:22 -07:00
Boris Brezillon 39851688df dzn: Pass an image view to dzn_cmd_buffer_clear_attachment()
Let the caller extract the image view from the attachment index, so
we can make this function framebuffer-agnostic and re-use it in the
dynamic rendering path.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15913>
2022-04-22 01:07:22 -07:00
Boris Brezillon 3420110ee7 dzn: Advertise KHR_shader_draw_parameters
We already pass those parameters to shaders, so let's advertise the
feature.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15912>
2022-04-22 07:31:44 +00:00
Boris Brezillon 2eadd8dd16 dzn: Update the draw_id sysval when issuing indirect draws
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15912>
2022-04-22 07:31:44 +00:00
Boris Brezillon 02d8436bbd dzn: Simplify the triangle_fan_rewrite_index shader
We don't need the first_vertex argument when turning non-indexed
triangle-fan draws into indexed triangle-list ones, the firstVertex
argument can simply be passed as a vertexOffset.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15912>
2022-04-22 07:31:44 +00:00
Boris Brezillon 1cefda7cb4 dzn: Fix exec_buf_stride calculation
The stride depends on the indirect draw arguments which are different if
triangle-fan emulation is required.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15912>
2022-04-22 07:31:44 +00:00
Boris Brezillon 7673697256 microsoft/spirv_to_dxil: Add a draw_id field to vertex_runtime_data
So we can support the draw_id system value.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15912>
2022-04-22 07:31:44 +00:00
Erik Faye-Lund 4300b5d914 dzn: remove stale cpp_args
We no longer use C++, so we don't need to set cpp_args here.

Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16076>
2022-04-21 11:21:06 +00:00
Erik Faye-Lund 85d0d3fede dzn: fixup indent
This seems to be all tab-indents we have in our code-base.

Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16076>
2022-04-21 11:21:06 +00:00
Erik Faye-Lund dee89ea027 dzn: drop needless enum-casts
After rewriting to C, we also don't need these casts.

Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16076>
2022-04-21 11:21:06 +00:00
Erik Faye-Lund f854e6ec9b dzn: add space before += operator
Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16052>
2022-04-21 10:52:44 +00:00
Erik Faye-Lund 52cde4a1ad dzn: clean up pointer syntax
The code-style we use have a space before the first asterisk for
pointers. Fix a few inconsistencies.

Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16052>
2022-04-21 10:52:44 +00:00
Erik Faye-Lund 92964d2bfd dzn: remove some needless casts
Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16052>
2022-04-21 10:52:44 +00:00
Boris Brezillon b8d41d5919 dzn: Add support for KHR_descriptor_update_template
Create update templates where the offset in the descriptor heap is
pre-calculated.

Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15691>
2022-04-21 10:43:31 +00:00
Boris Brezillon 4da5524c9b dzn: Split the write desc helpers in two halves
Split the write desc helpers in two halves, one taking a descriptor
offset directly, and the other one taking a descriptor set pointer.

This will allow us to pre-calculate descriptor offsets when creating
a descriptor_update template and speed up a bit the write step in that
case.

Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15691>
2022-04-21 10:43:30 +00:00
Boris Brezillon 31dc341f3a dzn: Pass layout objects to various dzn_descriptor_set_ptr_xxx helpers
Needed if we want to support KHR_descriptor_update_template, since
we won't have access to the final descriptor set when calculating heap
offsets in that case.

Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15691>
2022-04-21 10:43:30 +00:00
Boris Brezillon fe68cfe82a dzn: Rename a bunch of dzn_descriptor_set helpers
Let's be consistent with other helpers taking a dzn_descriptor_set_ptr
object and prefix all such functions with dzn_descriptor_set_ptr_.

We also rename dzn_descriptor_set_ptr_get_desc_vk_type() into
dzn_descriptor_set_ptr_get_vk_type() to shorten it a bit.

Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15691>
2022-04-21 10:43:30 +00:00
Boris Brezillon 3af6631c6d dzn: Add support for EXT_vertex_attribute_divisor
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15915>
2022-04-21 00:31:18 -07:00
Boris Brezillon d01a149b8b ci/windows: Split the windows-related tests
Should help with the timeouts we see in CI right now.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Acked-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16042>
2022-04-20 23:45:28 -07:00
Boris Brezillon cf930db39c d3d12: Move the D3D12ResourceState code to the gallium driver
It's only used there, and we don't plan to use it in Dozen, so let's move
the code to src/gallium/drivers/d3d12/ and get rid of the static
d3d12_resource_state library.

Suggested-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16042>
2022-04-20 23:45:28 -07:00
Boris Brezillon b8fd1e8844 dzn: Report actual device limits
Report actual device limits instead of pseudo-random numbers.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15911>
2022-04-20 22:47:29 +00:00
Boris Brezillon 6c877cb00f dzn: Use core helpers to fill physical device features/properties
The core provide generic helpers to turn Vulkan minor version
features/properties into their KHR counterparts. Let's declare those
core features/properties structs and use those helpers so we get
ready to support newer spec versions without too much pain.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15911>
2022-04-20 22:47:29 +00:00
Yonggang Luo 4ead2f6579 win32: Fixes 32 bits visual studio module definition files by add script gen_vs_module_defs.py
Getting opengl32*.def consistence with Windows SDK.
Getting osmesa.mingw.def's gl* functions consistence with Windows SDK.
stw_* functions are cdecl, not stdcall, so there is no need mangling the symbol.
Fixes egl.def for x86
d3d10sw: Move the place of d3d10_sw.def to d3d10_sw.def.in
Fixes vulkan_lvp.def for x86
Fixes #5552
Remove stdcall-fixup

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14041>
2022-04-19 19:38:47 +00:00
Boris Brezillon 9eace7f2e4 dzn: refactor error-handling
Here's a couple of cleanups to the error-handling code, now that we're
no longer using ComPtr<T>.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15816>
2022-04-19 15:39:48 +00:00
Erik Faye-Lund cfdaf1af9b dzn: remove needless defines
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15816>
2022-04-19 15:39:48 +00:00
Erik Faye-Lund 2ca4e21df7 dzn: merge util sources
There, no more C and C++ sources of the same base-name. We can do both
in one source.

This is our last C++ source file, so let's also clean away the C++20
mess in meson.build.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15816>
2022-04-19 15:39:48 +00:00
Erik Faye-Lund 0551f8ed62 dzn: port code to plain c
This does quite a lot in one go, simply because C and C++ are too
different to cleanly move from one language to another. But hopefully
this won't create too many rebase-issues.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15816>
2022-04-19 15:39:48 +00:00
Erik Faye-Lund b369e10d08 dzn: do not set unused default member initializer
These objects aren't allocated using C++ constructors, so these default
member initializers does nothing.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15816>
2022-04-19 15:39:48 +00:00
Erik Faye-Lund c5e979f632 dzn: c-style casts
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15816>
2022-04-19 15:39:48 +00:00
Erik Faye-Lund 3d608de882 dzn: use c-style initialization
Here's a few cases where we can use C-style initialization up-front,
which reduces the diffs later on.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15816>
2022-04-19 15:39:48 +00:00
Erik Faye-Lund 05af6f0434 dzn: use c-style for-statement
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15816>
2022-04-19 15:39:48 +00:00
Erik Faye-Lund 502c36c07d dzn: use define instead of constexpr
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15816>
2022-04-19 15:39:48 +00:00
Erik Faye-Lund 5a9571ee2c dzn: no more reinterpret_cast
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15816>
2022-04-19 15:39:48 +00:00
Erik Faye-Lund 79119ac478 dzn: drop using references
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15816>
2022-04-19 15:39:48 +00:00
Erik Faye-Lund bd8e8537cc dzn: drop auto usage
The auto keyword isn't available in C, so let's drop it and just use
explicit types instead.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15816>
2022-04-19 15:39:48 +00:00
Erik Faye-Lund d61c2e965b dzn: add a bunch of missing struct-keywords
If we're going to have any chance of porting this code to C, we're
going to have to be better at spelling out structs.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15816>
2022-04-19 15:39:48 +00:00
Erik Faye-Lund 4903a7c051 dzn: port to d3d12 c-api
Using the vulkan-helpers from C++ code has turned out to have a lot of
friction, because no other driver uses C++ for this.

So let's bite the bullet and call the D3D12 C-API instead. The C-API
wasn't really around when we started out, but it's there now.

This is still far from ideal; we should really create some wrapping
macros to generate the extremely verbose COM calls.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15816>
2022-04-19 15:39:48 +00:00
Erik Faye-Lund 4753222e62 dzn: pass IDXGIAdapter1 to d3d12_create_device
The D3D12 C API doesn't know about the relationship between
IDXGIAdapter1 and IUnknown. And there's no good reason to care about it
here either. So let's just pass the right type all the way.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15816>
2022-04-19 15:39:48 +00:00
Erik Faye-Lund 3ba021cdd0 dzn: use ID3D10Blob instead of ID3DBlob
In the C interface, there's no such alias.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15816>
2022-04-19 15:39:48 +00:00
Erik Faye-Lund 8c6f50efdb dzn: always use ID3D12GraphicsCommandList1
In the C-interface, ID3D12GraphicsCommandList1 and
ID3D12GraphicsCommandList are unrelated types. So let's make sure we
consistenly use the most up-to-date version.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15816>
2022-04-19 15:39:48 +00:00
Erik Faye-Lund 411dfc574c dzn: always use ID3D12Device1
In the C-interface, ID3D12Device1 and ID3D12Device are unrelated types.
So let's make sure we consistenly use the most up-to-date version.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15816>
2022-04-19 15:39:48 +00:00
Erik Faye-Lund 5f17d070a9 dzn: remove all usage of ComPtr<T>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15816>
2022-04-19 15:39:48 +00:00
Erik Faye-Lund 74228c32ee dzn: fixup indent
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15816>
2022-04-19 15:39:48 +00:00
Boris Brezillon 9fd02d49b8 dzn: Pass the right type to CreateCommandList() in the reset path
The Command allocator and command list type must match, but we
are forcing it to D3D12_COMMAND_LIST_TYPE_DIRECT in the reset path.

Fixes: a012b21964 ("microsoft: Initial vulkan-on-12 driver")
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16023>
2022-04-19 12:07:38 +00:00
Boris Brezillon 3e97d37c63 dzn: Add support for sampleRateShading
Forward the sample-rate shading info to spirv_to_dxil() so we can
claim to support sampleRateShading.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15916>
2022-04-19 08:49:50 +00:00
Boris Brezillon 80a5deee62 microsoft/spirv_to_dxil: Allow forcing per-sample shading
Needed to support VkPipelineMultisampleStateCreateInfo::sampleShadingEnable.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15916>
2022-04-19 08:49:50 +00:00
Boris Brezillon cacc3f03e6 microsoft/compiler: Add a dunmmy SV_SampleIndex when needed
When per-sample shading is forced and all input variables have a flat
interpolation, DXIL validation detects a mismatch between the
SampleFrequency property and the fact that no variables are per-sample
and SV_SampleIndex is never read. When that happens, add a dummy
SV_SampleIndex.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15916>
2022-04-19 08:49:50 +00:00
Jason Ekstrand 319d87846c nir,microsoft: Move scale_fdiv into a common NIR pass
While we're at it, convert to nir_shader_instructions_pass() to get rid
of some boilerplate and get metadata correct.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15983>
2022-04-16 02:10:25 +00:00
Enrico Galli 0c4d1762de microsoft/compiler: Fix when using a shadow sampler more than once
Reusing the shadow sampler's variable causes problems when the sampler
is used more than once. The remaining `deref_var`s will be using the
wrong type.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14988>
2022-04-15 00:19:55 +00:00
Enrico Galli 0e91dd2f3e microsoft/compiler: Add support for unnamed ubos
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14988>
2022-04-15 00:19:55 +00:00
Enrico Galli 6073c74bfd microsoft/compiler: Fix for arrays of 1 element
The DXIL validator doesn't like dynamic indexing into resources if the
resource was not declared as an array type. This commit makes it so that
we always generate array resource types if the original type was
declared as an array instead, not just when the number of elements is
greater than 1.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14988>
2022-04-15 00:19:55 +00:00
Enrico Galli 0badd0547d microsoft/spirv_to_dxil: Add pass to lower dynamic accesses on ubo[1]
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14988>
2022-04-15 00:19:55 +00:00
Boris Brezillon 31ea1fcd14 dzn: Make sure sampler heaps don't contain more than 2048 samplers
The spec says "The maximum number of samplers in a shader visible
descriptor heap is 2048.". Let's make sure we follow this rule
in dozen.

Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15884>
2022-04-14 13:14:57 +00:00
Boris Brezillon 3becb2729a dzn: Skip binding entries with zero descriptors
D3D12 doesn't like empty descriptor ranges, so let's skip those
at set layout creation time.

Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15884>
2022-04-14 13:14:57 +00:00
Louis-Francis Ratté-Boulianne 3017522e74 dzn: Add CI target for vulkan driver
A custom branch of `deqp` is used to have proper results when
crashing. See:

https://github.com/KhronosGroup/VK-GL-CTS/issues/311

A custom branch of `deqp-runner` with Windows support is also
used until the changes are merged into the main repository.

The `api`, `info`, `draw`, `query-pool` and `memory` test cases are
executed for now.

Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15742>
2022-04-13 18:05:44 +00:00
Louis-Francis Ratté-Boulianne fb24f34fc3 dzn: Add a debug flag to enable D3D12 debug layer
Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15742>
2022-04-13 18:05:44 +00:00
Boris Brezillon bc58b34087 dzn: Fix loop condition in dzn_descriptor_set_copy()
We need to make sure we still have descriptors to copy in the
while() condition. While at it, drop the assert() checking that
the number of descriptors already copied is less than the
requested number.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15828>
2022-04-11 07:04:24 +00:00
Boris Brezillon 53e83b7031 dzn: Support independent depth/stencil access
Needed for VK_KHR_maintenance2. While at it, fix various places where
we were only issuing resource state transition on the first sub-resource
instead of doing it per-layer/aspect.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15698>
2022-04-08 11:54:44 +00:00
Boris Brezillon 69e8a6042f dzn: Fix 2D <-> 3D blits
layer_count == 1 doesn't imply image_is_3d. So let's add explicit
is_3d checks where appropriate.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15698>
2022-04-08 11:54:44 +00:00
Boris Brezillon 451a43ae1e dzn: Lower partial copy of multisample resources to blits
Unfortunately that won't work on transfer queues, but we don't have a
better option right now.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15698>
2022-04-08 11:54:44 +00:00
Boris Brezillon 8d30204ca4 dzn: Drop extra blank line in dzn_CmdCopyImage2()
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15698>
2022-04-08 11:54:43 +00:00
Boris Brezillon 653c362ca6 dzn: Check image view usage instead of image usage when creating an image view
So we take VkImageViewUsageCreateInfo extension instead of ignoring it.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15698>
2022-04-08 11:54:43 +00:00
Boris Brezillon 7ecc22ccaa dzn: Force sampleCounts to 1 for bgra4 images
Those are not expected to be used as render-target, and Vulkan mandates
that such formats get their sampleCounts set to VK_SAMPLE_COUNT_1_BIT.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15698>
2022-04-08 11:54:43 +00:00
Boris Brezillon 84ad923482 dzn: Get rid of dzn_GetPhysicalDeviceProperties()
Rely on the vk_common_ wrapper.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15698>
2022-04-08 11:54:43 +00:00
Boris Brezillon 9a804b6390 dzn: Get rid of dzn_GetPhysicalDeviceFeatures()
And rely on the vk_common_ wrapper to get it implemented.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15698>
2022-04-08 11:54:43 +00:00
Boris Brezillon e9c69fe39a dzn: 3D array images don't exist
Let's force maxArrayLayers to one in that case.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15698>
2022-04-08 11:54:43 +00:00
Boris Brezillon ad0ac592be dzn: Set bufferFeatures to zero on depth/stencil formats
Those are not supposed to advertise buffer features.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15698>
2022-04-08 11:54:43 +00:00
Boris Brezillon 8dfab9b382 dzn: Make sure the properties are all zero when the format is not supported
Move one of the is_supported() check before we start filling the
structure so we don't end up with a partially filled object when
we return VK_ERROR_FORMAT_NOT_SUPPORTED (which deqp doesn't seem to like,
so it's probably coming from a spec requirement).

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15698>
2022-04-08 11:54:43 +00:00
Boris Brezillon dc3dd9690b dzn: Return a valid imageFormatProperties.maxMipLevels
maxMipLevels is encoding the maximum number of MIP levels, but
dzn_physical_device_get_max_mip_levels() return the maximum MIP level.
Let's rename the function and add one to the returned value to fix
the problem.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15698>
2022-04-08 11:54:43 +00:00
Boris Brezillon cfd3dfc074 dzn: Fix 3D <-> 2D image copies
We just need to treat layers as slices when manipulating 3D resources
whose slices are coming from/going to 2D array layers.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15698>
2022-04-08 11:54:43 +00:00
Boris Brezillon 94923021d7 dzn: Support 2Darray views on 3D images for color attachments
Those are declared as 3D RTVs in D3D12, and layers are treated as
slices.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15698>
2022-04-08 11:54:43 +00:00
Boris Brezillon 3684cae58c dzn: Fix dzn_image_get_rtv_desc() for 3D views
VK_REMAINING_ARRAY_LAYERS maps to -1 in the D3D12 world. Let's make sure
we set WSize to -1 in that case, because the layer_count calculated by
dzn_get_layer_count() won't work for 3D images which never have more
than one layer (in case of 3D images, we treat slices as layers).

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15698>
2022-04-08 11:54:43 +00:00
Boris Brezillon 9f5831bbec dzn: Replace C++ references by pointers
Let's keep as much as we can in plain C.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15698>
2022-04-08 11:54:43 +00:00
Boris Brezillon 1401f62069 dzn: Align the default case in dzn_image_view_prepare_dsv_desc()
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15698>
2022-04-08 11:54:43 +00:00
Boris Brezillon 1692d8f0f6 dzn: Don't crash when EndCommandBuffer() returns an error
Leftover from a debug session.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15698>
2022-04-08 11:54:43 +00:00
Boris Brezillon c937152756 dzn: Fix dzn_translate_viewport() when height < 0
Since negative height is not a thing in D3D12, we need to adjust the
TopLeftY accordingly.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15698>
2022-04-08 11:54:43 +00:00
Boris Brezillon 05b6c1ed84 dzn: Fix pipeline creation when rasterization is disabled
We use some of the VkGraphicsPipelineCreateInfo fields that should
be ignored when rasterization in disabled, assuming those who be set
to NULL by the caller in that case, which is not mandated by the
Vulkan specification.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15698>
2022-04-08 11:54:43 +00:00
Erik Faye-Lund 31824d4213 dzn: add missing space
Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15790>
2022-04-07 19:53:03 +00:00
Erik Faye-Lund 08e4b28a05 dzn: drop unused include
Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15790>
2022-04-07 19:53:03 +00:00
Erik Faye-Lund 4ae6c34a5a dzn: drop incorrect return statement
We're returning nothing here. Let's not do that.

Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15790>
2022-04-07 19:53:03 +00:00
Erik Faye-Lund 600d99650b dzn: drop unused header
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15790>
2022-04-07 19:53:03 +00:00
Erik Faye-Lund 76b0023c06 dzn: remove unused variable
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15790>
2022-04-07 19:53:03 +00:00
Erik Faye-Lund 96bbcb1e48 dzn: fixup indent
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15790>
2022-04-07 19:53:03 +00:00
Erik Faye-Lund f3ce7d8561 dzn: add D3D12_IGNORE_SDK_LAYERS define
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15790>
2022-04-07 19:53:03 +00:00
Erik Faye-Lund 659e26285a dzn: drop needless includes
These include either dzn_nir.h or dzn_internal.h which already includes
this header.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15790>
2022-04-07 19:53:03 +00:00
Erik Faye-Lund bda5852846 dzn: remove unused struct
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15790>
2022-04-07 19:53:03 +00:00
Erik Faye-Lund f7b0cfe04a dzn: remove needless using
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15790>
2022-04-07 19:53:03 +00:00
Boris Brezillon 07af51da9d dzn: Pass a NULL ralloc context to dxil_create_validator()
instance is not allocated with ralloc, we can't pass it as a ralloc
context to dxil_create_validator().

Fixes: 09c2016d6b ("dzn: use dxil_validator")
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15787>
2022-04-07 16:55:02 +00:00
Erik Faye-Lund 0998621496 clc/tests: use dxil_validator
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15751>
2022-04-07 00:00:45 +00:00
Erik Faye-Lund 09c2016d6b dzn: use dxil_validator
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15751>
2022-04-07 00:00:45 +00:00
Erik Faye-Lund 0c5d772b71 microsoft/spirv_to_dxil: use dxil_validator
This has one negative side-effect; we're no longer able to print
validation errors without dxcompiler.dll. I doubt that's a real problem,
but if it is, we should add this ability to dxil_validator instead of
having a second implementation here.

The reasons I didn't try adding this in the first place is:

1. This code seems a bit janky; it doesn't consult the "known"-variable
   to figure out if the encoding is OK, and it's lacking a fallback path
   in that case.
2. It seems unlikely that the compiler varies the encoding of the output
   in the first place; one of the two code-paths in here is probably
   untested.
3. Since dxil_validator leaves reporting to the call-site, we'd need to
   either add and output-encoding to the API (yuck), or re-encode the
   string to UTF-8 using WinAPI.

Right now, it seems questionable if fixing all of the above is worth it.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15751>
2022-04-07 00:00:45 +00:00
Erik Faye-Lund 193cf76c09 microsoft/compiler: add common dxil-validator API
This API is only available on Windows, which is the only OS where DXIL
validation is a requirement, and where DXIL.dll (and dxcompiler.dll) are
available.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15751>
2022-04-07 00:00:44 +00:00
Erik Faye-Lund f607db2689 dozen: require c++20 for designated initializers
We do require C++20 still, because designated initializers is part of
that standard. This is almost a revert, but conditionally selecting
between c++latest or c++20 when available, as that's what we really want.

Fixes: 55ca1c8db3 ("vulkan/microsoft: Remove `override_options: ['cpp_std=c++latest']` option for visual studio")
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15706>
2022-04-05 16:58:56 +00:00
Boris Brezillon 23bd889541 dzn: Properly support static blend constants
The current code was assuming blend constants to be passed dynamically,
which is wrong. Let's handle both the dynamic and static cases.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15608>
2022-03-31 12:21:35 +00:00
Boris Brezillon f16a7aa9d6 dzn: Fix alpha blend factor translation
When VK_BLEND_FACTOR_xxx_COLOR is passed to an alpha equation what we
really want is the alpha component replicated on the RGBA channels,
which has dedicated enums in D3D12. Let's make sure we use the right
definition depending on the equation we're translating.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15608>
2022-03-31 12:21:35 +00:00
Boris Brezillon 329f16fffc dzn: Make a bunch of functions private
Looks like some functions that should have been marked static when
transitioning from C++ methods to plain C where forgotten. Let's fix that
now.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15607>
2022-03-31 09:46:36 +00:00
Boris Brezillon 4194c89ed8 dzn: Remove the dzn_cmd_exec_functions file
That's a leftover from a previous version of the secondary command
buffer implementation.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15607>
2022-03-31 09:46:36 +00:00
Boris Brezillon b402cff591 dzn: Add Missing return type to dzn_translate_sampler_filter()
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15607>
2022-03-31 09:46:36 +00:00
Yonggang Luo 55ca1c8db3 vulkan/microsoft: Remove `override_options: ['cpp_std=c++latest']` option for visual studio
The project no longer uses c++20 features

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15595>
2022-03-31 09:16:27 +00:00
Erik Faye-Lund a012b21964 microsoft: Initial vulkan-on-12 driver
This is Dozen, the Vulkan on DirectX 12 driver. Not to be confused with
DirectEggs.

This is an early prototype, and not meant to be upstreamed as-is.

Co-Authored-by: Boris Brezillon <boris.brezillon@collabora.com>
Co-Authored-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Co-Authored-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Co-Authored-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Acked-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14766>
2022-03-25 16:21:45 +00:00
Enrico Galli 6635d011cb microsoft/spirv_to_dxil: Add missing ralloc_free
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Acked-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14766>
2022-03-25 16:21:45 +00:00
Boris Brezillon 04d812b2d0 Revert "ci: Disable windows-vs2019"
This reverts commit 04b80489d5.

Acked-by: Daniel Stone <daniels@collabora.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Acked-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15518>
2022-03-24 09:11:13 +00:00
Erik Faye-Lund f7e92c8869 microsoft/compiler: remove phi-value limit
There's no guarantee that we don't have more than 128 PHI values either,
so let's stop asuming so.

We do this by changing dxil_phi_set_incoming to dxil_phi_add_incoming,
which lets us add more incoming phi-values to the current one instead of
setting a new set of them.

This also lets us reduce these stack-arrays a bit, down to something
much more reasonable.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15519>
2022-03-23 16:33:21 +00:00
Erik Faye-Lund d752c4bc7c microsoft/compiler: ralloc incoming phi-values
Reserving 127 incoming values for every phi instruction is neither
robust nor memory efficient.

Let's ralloc this array instead when filling it. This way, we only pay
for what we use here.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15519>
2022-03-23 16:33:21 +00:00
Alyssa Rosenzweig 04b80489d5 ci: Disable windows-vs2019
Currently down.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15148>
2022-02-23 15:12:41 +00:00
Ian Romanick a01b262990 nir: Add missing dependency on nir_opcodes.py
Commit 38800b38 changed nir_opcodes.py, but that doesn't seem to have
triggered nir_opt_algebraic.py.  The change in 75ef5991 depends on
opt_algebraic lowering 16-bit versions of slt, but if opt_algebraic is
not rebuilt, this may not happen.  This resulted in some people seeing
assertion failures in, for example,
dEQP-VK.spirv_assembly.instruction.compute.float16.arithmetic_3.step,
due to the backend seeing nir_op_slt that it didn't know how to handle.

v2: Add nir_opcodes.py to nir_algebraic_py so that all the per-driver
algebraic passes pick up the dependency too.  Rename it to
nir_algebraic_depends.  Suggested by Emma.

Closes: #6047
Fixes: d1992255bb ("meson: Add build Intel "anv" vulkan driver")
Reviewed-by: Emma Anholt <emma@anholt.net>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15050>
2022-02-17 22:57:33 +00:00
Jesse Natalie 31e2c3f550 microsoft/compiler: Fill interpolation for sysval inputs to non-vertex shader
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5483
Reviewed-by: Michael Tang <tangm@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14984>
2022-02-11 00:19:17 +00:00
Daniel Stone 7a0ace7d4e Revert "ci: Disable Windows for now"
This reverts commit be385ab5bc.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14975>
2022-02-10 16:44:16 +00:00
Daniel Stone be385ab5bc ci: Disable Windows for now
Docker on Windows is broken for some reason, so just disable it for now.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14970>
2022-02-10 12:51:06 +00:00
Jesse Natalie 918647000f microsoft/compiler: Set flag for VP/RT array index from VS/DS
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14881>
2022-02-04 20:49:23 +00:00
Jesse Natalie 5954c8e524 microsoft/compiler: Handle SV_ViewportArrayIndex
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14881>
2022-02-04 20:49:23 +00:00
Jesse Natalie 0044e80b82 microsoft/compiler: Handle structs in I/O signatures
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Reviewed-By: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14837>
2022-02-04 00:07:53 +00:00
Jesse Natalie eb0cefae6d microsoft/compiler: Map I/O base locations to input IDs
When dealing with a vertex input that takes multiple rows, the value of
nir_intrinsic_base points to a driver-location-based index, but we need
to emit a location-based index (or more specifically, an index that
increments once per input, not once per register). Add a mapping to
the module of base -> ID.

Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Reviewed-By: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14837>
2022-02-04 00:07:53 +00:00
Jesse Natalie efe5c2d6f3 microsoft/compiler: Process signatures before the shader code
This lets us set up some metadata based on I/O vars without having
to do multiple passes over them.

Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Reviewed-By: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14837>
2022-02-04 00:07:53 +00:00
Jesse Natalie c154d403d3 microsoft/compiler: Handle I/O vars larger than a vec4
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Reviewed-By: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14837>
2022-02-04 00:07:53 +00:00
Jesse Natalie cdc49fb605 microsoft/compiler: Lower 64bit I/O to 32 and then run lower_pack
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Reviewed-By: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14837>
2022-02-04 00:07:53 +00:00
Jesse Natalie b24cfd0d40 microsoft/compiler: Handle b2f64
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Reviewed-By: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14837>
2022-02-04 00:07:53 +00:00
Jesse Natalie 4d17393ba0 microsoft/compiler: Set dx11_1_double_extensions flag for dfma/ddiv
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Reviewed-By: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14837>
2022-02-04 00:07:53 +00:00
Jesse Natalie 4c8935d325 microsoft/compiler: Fix dxil_nir_lower_double_math_instr pass for vectors
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Reviewed-By: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14837>
2022-02-04 00:07:53 +00:00
Jesse Natalie c8bd830dfb microsoft/compiler: Fix make_double and split_double to respect swizzles
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Reviewed-By: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14837>
2022-02-04 00:07:53 +00:00
Jesse Natalie 92191349e9 microsoft/compiler: Fix splitdouble struct name
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Reviewed-By: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14837>
2022-02-04 00:07:53 +00:00
Jesse Natalie dde3b04d44 microsoft/compiler: It's possible to have doubles without int64
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Reviewed-By: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14837>
2022-02-04 00:07:53 +00:00
Jesse Natalie 3b9483e89d microsoft/compiler: Add never-supported double ops to lower_doubles bitmask
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Reviewed-By: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14837>
2022-02-04 00:07:53 +00:00
Jesse Natalie ce6dbbabf9 microsoft/compiler: Only treat tess level location as special if it's a patch constant
Fixes: a550c059 ("microsoft/compiler: For load_input from DS, use loadPatchConstant")
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Reviewed-By: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14837>
2022-02-04 00:07:53 +00:00
Jesse Natalie 0c711dc823 microsoft/compiler: Only prep phis for the current function
Fixes: 41af9620 ("microsoft/compiler: Emit all NIR functions into the DXIL module")
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Reviewed-By: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14837>
2022-02-04 00:07:53 +00:00
Jesse Natalie 87d22c2465 microsoft/compiler: Lower mul_2x32_64
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Reviewed-By: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14837>
2022-02-04 00:07:53 +00:00
Jesse Natalie 36add3d002 microsoft/compiler: Support multiple GS output streams
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14787>
2022-01-31 13:34:27 -08:00
Jesse Natalie 895cdbd6f0 microsoft/compiler: Correctly support I/O on variables with location_frac
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14787>
2022-01-31 13:34:27 -08:00
Jesse Natalie 1d43e75228 d3d12: Add UAV barriers for UAVs that are being used by compute transforms
If an indirect arg buffer is being produced by a compute shader, then when
we go to consume it as an SSBO in a compute transform pass, we need to insert
a UAV barrier to prevent the two dispatches from overlapping. For app dispatches,
this is the app's responsibility via explicit barrier APIs, and if they don't,
then they're allowed to overlap.

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14787>
2022-01-31 13:13:33 -08:00
Jesse Natalie 2d4ee41df0 microsoft/compiler: Fix UAV resource ID counting for static indexed handles
Skip resource space 2 after computing the ID it would've used.

Fixes: e5f353f2 ("microsoft/compiler: Emit statically-indexed resource handles and scratch later")
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14787>
2022-01-31 13:13:12 -08:00
Boris Brezillon 11e2c4b502 microsoft/spirv_to_dxil: Define idep_libspirv_to_dxil
So we can re-use it when we need to define a dependency on spirv_to_dxil.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14765>
2022-01-31 20:21:25 +00:00
Boris Brezillon ef47a6800b microsoft/spirv_to_dxil: Make sure the SampleMask is a uint
DXIL doesn't like when SV_Coverage (AKA SampleMask in DXIL) is a
signed integer. Fix the type while we're in the NIR domain.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14765>
2022-01-31 20:21:25 +00:00
Boris Brezillon 7e56d8c393 microsoft/spirv_to_dxil: Lower atomics to their dxil variants
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14765>
2022-01-31 20:21:25 +00:00
Boris Brezillon c2eeba04c3 microsoft/spirv_to_dxil: Discard PSIZ accesses
D3D12 doesn't support gl_PointSize, so let's consider PointSize is
always 1.0 and discard any PointSize access.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14765>
2022-01-31 20:21:25 +00:00
Louis-Francis Ratté-Boulianne 5cd2bf837d microsoft/spirv_to_dxil: Allow passing a vulkan -> d3d12 binding mapping table
Vulkan bindings take only one slot per variable, but d3d12 ones take one
slot per entry when the variable is an array. This forces us to pass
an explicit vulkan -> d3d12 mapping table when dealing with vulkan
shaders.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14765>
2022-01-31 20:21:25 +00:00
Louis-Francis Ratté-Boulianne de1e941c59 microsoft/spirv_to_dxil: Lower push constant loads to UBO loads
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14765>
2022-01-31 20:21:25 +00:00
Louis-Francis Ratté-Boulianne d11a417ded microsoft/spirv_to_dxil: lower input attachments
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14765>
2022-01-31 20:21:25 +00:00
Louis-Francis Ratté-Boulianne e65303c6e6 microsoft/spirv_to_dxil: check for variables r/w access
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14765>
2022-01-31 20:21:25 +00:00
Boris Brezillon 39592f8ad4 microsoft/spirv_to_dxil: Support [un]conditional YZ-flip
The unconditional Y-flip is needed for Vulkan 1.0 since D3D12 and
Vulkan coordinate systems differ. Conditional YZ-flip is needed if
we want to support negative viewport height/depth.

Prepare spirv_to_dxil() to support that, and while at it, prepare
things for multi-viewport: the Y/Z flips are per-viewport and encoded
in a 32bit bitmask, with the upper 16bits reserved for Z flips, and the
lower 16bits reserved for Y flips.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14765>
2022-01-31 20:21:25 +00:00
Boris Brezillon 225867684a microsoft/spirv_to_dxil: Allow dumping NIR
Dumping NIR shaders is a useful debug feature. Let's tweak the
spirv_to_nir() helper so we can pass debugging options and
add one to allow dumping NIR.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14765>
2022-01-31 20:21:25 +00:00
Boris Brezillon 27790c4a7a microsoft/spirv_to_dxil: Remove dead variables after the struct split pass
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14765>
2022-01-31 20:21:25 +00:00
Boris Brezillon a4c8508c37 microsoft/compiler: textureLoad() doesn't take a LOD on MS textures
Make sure the LOD is zero in that case.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13993>
2022-01-31 16:37:47 +00:00
Boris Brezillon 951fd35012 microsoft/compiler: Skip images in redirect_texture_derefs()
The input attachment lowering pass turns input attachment loads into
texel fetch operation, and insert an image -> texture deref cast along
the way. In this situation, we can end up with a texture deref chain
pointing to an image variable, which is not a combined sampler+texture
object. Bail out when an image type is found, like we do for bare
textures.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13993>
2022-01-31 16:37:47 +00:00
Boris Brezillon 678b94c2d8 microsoft/compiler: Fix sampler/texture array emission
Those need to be declared as sampler/SRV arrays, as we do for UAVs and
CBVs.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13993>
2022-01-31 16:37:47 +00:00
Louis-Francis Ratté-Boulianne 54c32aeba6 microsoft/compiler: Use SRVs for read-only images
Acked-by: Enrico Galli <enrico.galli@intel.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13993>
2022-01-31 16:37:47 +00:00
Louis-Francis Ratté-Boulianne 8507afbd06 microsoft/compiler: Add subpass input types
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13993>
2022-01-31 16:37:47 +00:00
Louis-Francis Ratté-Boulianne ef5283d37d microsoft/compiler: add support for load_layer_id
We simply return 0 for now as we don't support multi-view yet.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13993>
2022-01-31 16:37:47 +00:00
Thomas H.P. Andersen 37989670b9 microsoft/compiler: fix -Wbitwise-instead-of-logical warning
Replace the bitwise operation with a more explicit do-while
loop. This fixes a warning with clang, and ensures that
nir_opt_dead_cf and nir_opt_dce are called in the right
order.

Suggested-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14742>
2022-01-30 05:05:38 +00:00
Jesse Natalie 973bff335f microsoft/compiler: Handle clip/cull distance as an input to tess shaders
In order to get the semantics right, we need to know how many of the clip/
cull fields are designated for which purpose. In the case of a shader that
can receive these fields as both input and output, the shader_info property
is reserved to store the output info. We could add a dedicated input field
to shader_info, but since it'd probably only be useful for us, just send
it through a side channel during shader linking.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14399>
2022-01-26 01:31:35 +00:00
Jesse Natalie 1c4667bc9f microsoft/compiler: Location_frac needs to be included in sort order
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14399>
2022-01-26 01:31:35 +00:00
Jesse Natalie 4da51aa88f microsoft/compiler: Primitive ID should only be added as a sysval in geometry shaders
Docs say that its presence in signatures as a "shadow" element (meaning it's not
accessed via load/store, but with a dedicated opcode) is legacy. It seems it
wasn't carried forward when HS/DS were added in D3D11.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14399>
2022-01-26 01:31:35 +00:00
Jesse Natalie ec415a274e microsoft/compiler: Emit DS PSV validation and entrypoint metadata
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14399>
2022-01-26 01:31:35 +00:00
Jesse Natalie 9aca56b137 microsoft/compiler: Handle domain location intrinsic
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14399>
2022-01-26 01:31:35 +00:00
Jesse Natalie 8524d04783 microsoft/compiler: Handle load_output in the HS stage as reading a previously written patch constant
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14399>
2022-01-26 01:31:35 +00:00
Jesse Natalie a39881b788 microsoft/compiler: Handle load_per_vertex_output as LoadOutputControlPoint
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14399>
2022-01-26 01:31:35 +00:00
Jesse Natalie a550c059c7 microsoft/compiler: For load_input from DS, use loadPatchConstant
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14399>
2022-01-26 01:31:35 +00:00
Jesse Natalie cc6104dd3f microsoft/compiler: For store_output from HS, use storePatchConstant
In HS, store_per_vertex_output maps to storeOutput in DXIL. The data
that isn't per-vertex is patch constants.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14399>
2022-01-26 01:31:35 +00:00
Jesse Natalie 97b6ea71a0 microsoft/compiler: Add a pass for hull and domain shaders to shrink tess level vars
DXIL validation will complain if the tess factor signature entries have the
wrong number of components for the shader's domain. Make sure that both
hull and domain shaders have the right number, and drop loads and stores
from the removed components.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14399>
2022-01-26 01:31:35 +00:00
Jesse Natalie bd2a4fb1b8 microsoft/compiler: Add patch constant signature into PSV and as container blob
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14399>
2022-01-26 01:31:35 +00:00
Jesse Natalie 26247d506e microsoft/compiler: Gather patch const signature and handle tess factor in it
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14399>
2022-01-26 01:31:35 +00:00
Jesse Natalie 8e42891f69 microsoft/compiler: When sorting patch varyings, adjust location to be in normal varying range
This way, patch varyings come before the patch sysvals (tess levels).

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14399>
2022-01-26 01:31:35 +00:00
Jesse Natalie 4bb4d0454d microsoft/compiler: Overlap patch and non-patch varyings so both are separately 0-indexed
Also add tess factors to the list of sysvals that can cause vars to be sorted last.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14399>
2022-01-26 01:31:35 +00:00
Jesse Natalie b7da3f8647 microsoft/compiler: Fix I/O signatures for tess shaders
- Skip patch variables, those go into a separate patch constant signature
- Use nir_is_arrayed_io and only strip one level of array when it's true

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14399>
2022-01-26 01:31:35 +00:00
Jesse Natalie b346f28453 microsoft/compiler: Emit HS PSV validation and entrypoint metadata
Note that this requires the shader info "tess" data to be correct.
For GLSL tess control shaders, only the output primitive count is
automatically available. The rest will need to be either guessed
or filled in from a matching tess eval (domain) shader. This is handled
by the d3d12 driver in a later patch.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14399>
2022-01-26 01:31:35 +00:00
Jesse Natalie 6c58e1f448 microsoft/compiler: Delete misleading TODO comments about semantic table
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>

We've been writing a valid semantic table for a while now.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14399>
2022-01-26 01:31:35 +00:00
Jesse Natalie f511354a64 microsoft/compiler: Split hull (tess ctrl) shaders into main and patch constant funcs
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14399>
2022-01-26 01:31:35 +00:00
Jesse Natalie ad2233616c microsoft/compiler: Handle store_per_vertex_output for HS outputs
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14399>
2022-01-26 01:31:35 +00:00
Jesse Natalie 41af962099 microsoft/compiler: Emit all NIR functions into the DXIL module
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14399>
2022-01-26 01:31:35 +00:00
Jesse Natalie f6a333f010 microsoft/compiler: Emit functions with actual function names
Once we start writing multiple functions, we can't keep calling all
of them "main"

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14399>
2022-01-26 01:31:35 +00:00
Jesse Natalie 72812fe9b5 microsoft/compiler: Support emitting multiple functions into a DXIL module
The instruction and block lists are moved into a new "function definition"
struct, and the DXIL module tracks one at a time for adding instructions
into. The NIR side still only emits the main function here though.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14399>
2022-01-26 01:31:35 +00:00
Jesse Natalie e5f353f2f2 microsoft/compiler: Emit statically-indexed resource handles and scratch later
The resource declarations are module-wide, but the resource handles
are function-local. A future change will add multi-function support,
but requires these handles to be potentially emitted multiple times.
The alloca used for scratch is also function-local.

This is the same pattern that the DXBC to DXIL converter uses.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14399>
2022-01-26 01:31:35 +00:00
Jesse Natalie 02f46b67cd microsoft/compiler: Fix typo in enum entry
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14399>
2022-01-26 01:31:35 +00:00
Jesse Natalie b5cb81f8c1 microsoft/compiler: Add mapping from MESA_SHADER_* to DXIL_*_SHADER for tessellation
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14399>
2022-01-26 01:31:35 +00:00
Jesse Natalie 8ad0393abe microsoft/compiler: Getting a builtin function with an undeclared signature should be unreachable
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14399>
2022-01-26 01:31:35 +00:00
Jesse Natalie 4ad72b152c microsoft/compiler: Multi-row output semantics need to write multiple never_writes_masks
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14399>
2022-01-26 01:31:35 +00:00
Jesse Natalie 5e3d64d067 microsoft/compiler: Semantic table should be de-duped for multi-row semantics too
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14399>
2022-01-26 01:31:35 +00:00
Jesse Natalie 218f8302d2 microsoft/compiler: Use driver_location instead of location for inter-stage varying index in GL
In the case of two vars being packed into the same register / location,
they'll still get unique driver_location, which is what we need.

This does require some tweaks to stream output handling, which also needs to
produce the varying index.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14399>
2022-01-26 01:31:35 +00:00
Jesse Natalie 14ed624ff3 microsoft/compiler: Force integer I/O vars to use flat/constant interpolation
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14399>
2022-01-26 01:31:35 +00:00
Jesse Natalie 7f9ac5bba2 d3d12: Support dynamic UBO/SSBO indexing
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14624>
2022-01-21 23:08:26 +00:00
Jesse Natalie f915bc56a4 microsoft/compiler: Lower helper invocations
DXIL adds this in SM6.6, so when we get around to being able to
emit SM6.6, we can conditionally turn this off and support emitting
the new intrinsic. Until then, this is easy.

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14624>
2022-01-21 23:08:26 +00:00
Jesse Natalie 1022435845 microsoft/compiler: Handle msb/lsb/bfrev
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14624>
2022-01-21 23:08:26 +00:00
Jesse Natalie ac94bcf046 microsoft/compiler: Use ibfe/ubfe for bitfield extract instead of lowering to shifts
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14624>
2022-01-21 23:08:26 +00:00
Jesse Natalie 80e782d5ed microsoft/compiler: Handle bitfield_insert
This *almost* matches what GLSL wants, except for the handling of
large widths. You can see this in the lowering algorithm:
   (('bitfield_insert', 'base', 'insert', 'offset', 'bits'),
    ('bcsel', ('ult', 31, 'bits'), 'insert',
              ('bfi', ('bfm', 'bits', 'offset'), 'insert', 'base')),
    'options->lower_bitfield_insert'),

DXIL's 'bfi' instruction is an inseparable pairing of NIR's 'bfi(bfm(...), ...)',
so we just apply the additional bcsel in the backend.

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14624>
2022-01-21 23:08:26 +00:00
Jesse Natalie 8938c6e032 microsoft/compiler: Emit samplers as array types
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14624>
2022-01-21 23:08:26 +00:00
Jesse Natalie 7502b08900 microsoft/compiler: Handle load_invocation_id for GS and HS
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14624>
2022-01-21 23:08:26 +00:00
Jesse Natalie fe6f7b5265 microsoft/compiler: Handle tex texture/sampler offset srcs
Note that these offsets are 0-based, so to make them binding IDs we
need to explicitly add the base ID to them.

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14624>
2022-01-21 23:08:26 +00:00
Jesse Natalie 7748e4799d microsoft/compiler: Handle input coverage
Note that GL requires input coverage for sample execution mode to
be only the single bit corresponding to the executing sample, so
rearrange things to understand during shader emitting if we're
executing per-sample to emit the right coverage value.

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14624>
2022-01-21 23:08:26 +00:00
Jesse Natalie 777a42e309 microsoft/compiler: Handle textureGatherCmp
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14624>
2022-01-21 23:08:26 +00:00
Jesse Natalie 30a44e4c3d microsoft/compiler: Handle 'pull model' explicit interpolation intrinsics
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14624>
2022-01-21 23:08:26 +00:00
Jesse Natalie 5b51842b58 microsoft/compiler: Always have at least one GS active stream
DXIL validation will fail if there's no stream that has a valid
primitive topology, which is what happens in the case of no
active streams.

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14624>
2022-01-21 23:08:26 +00:00
Jesse Natalie a8373ca8de microsoft/compiler: Handle load_sample_pos_at_id
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14624>
2022-01-21 23:08:26 +00:00
Jesse Natalie 852e243cae microsoft/compiler: Handle variables declared per-sample
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14624>
2022-01-21 23:08:26 +00:00
Jesse Natalie 413f398cff ci/windows: Use 2 container stages
The first container stage ("build") is for dependencies of the build.
These are infrequently-changing things like Visual Studio, LLVM, git,
and also meson. The second container stage ("test") currently depends
on the first, and adds test dependencies like piglit.

This lets us rev piglit without having to rebuild LLVM.

Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14637>
2022-01-21 22:38:16 +00:00
Dave Airlie 1352e0ba0c mesa/*: add a shader primitive type to get away from GL types.
This creates an internal shader_prim enum, I've fixed up most
users to use it instead of GL types.

don't store the enum in shader_info as it changes size, and confuses
other things.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14605>
2022-01-19 21:54:58 +00:00
Marcin Ślusarz f547122772 microsoft/compiler: normalize line endings
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11779>
2022-01-19 15:17:17 +00:00
Daniel Stone 56886459c5 Revert "ci: disable vs2019 windows build"
This reverts commit 567a9550d7.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14513>
2022-01-12 21:45:11 +00:00
Lionel Landwerlin 567a9550d7 ci: disable vs2019 windows build
Failing with :

   error during connect: In the default daemon configuration on
   Windows, the docker client must be run with elevated privileges to
   connect.: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/auth:
   open //./pipe/docker_engine: The system cannot find the file
   specified.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14509>
2022-01-12 09:04:29 +00:00
Jesse Natalie 2837e67b9b microsoft/compiler: Handle more GL memory barriers
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14367>
2022-01-11 01:36:56 +00:00
Jesse Natalie fd50ef046b microsoft/compiler: Move workgroup_size lowering from clc
It doesn't depend on the clc data being provided externally, so no
need to tie it there, we can re-use it for GL and Vulkan compute.

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14367>
2022-01-11 01:36:56 +00:00
Jesse Natalie 156ef05ec7 d3d12: Handle memory barriers
This is a bit fragile. The algorithm is essentially:
- Let the driver track state for non-dual-bound resources.
- For resources that are dual-bound as SSBO/image and a second
  bind point, assume they're being used as UAVs.
- When a MemoryBarrier is issued, dirty all destination bind points
  so they re-assert their state, and if the destination is not UAV,
  temporarily suppress UAV state re-assertion.

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14342>
2022-01-07 03:31:16 +00:00
Jesse Natalie 02fc28625f microsoft/compiler: Fix handling of fp16-in-32bit-val ops to handle high bits
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14342>
2022-01-07 03:31:16 +00:00
Jesse Natalie 20e374f4a3 microsoft/compiler: Hook up memory/control barriers
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14342>
2022-01-07 03:31:16 +00:00
Jesse Natalie 5d33a9fa47 microsoft/compiler: Handle forced early depth
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14342>
2022-01-07 03:31:16 +00:00
Jesse Natalie 0b88600a64 microsoft/compiler: Implement atomic image ops
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14342>
2022-01-07 03:31:16 +00:00
Jesse Natalie 1b62c86eb1 microsoft/compiler: Handle images as derefs for GL
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14342>
2022-01-07 03:31:16 +00:00
Jesse Natalie a7311ceafe microsoft/compiler: Fix array-of-array handling for derefs of textures/images
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14342>
2022-01-07 03:31:16 +00:00
Jesse Natalie c9719b6d2e microsoft/compiler: Emit SRVs/UAVs as arrays
This is done regardless of size so that "dynamic" indexing with a
uniform can work even on arrays of size 1.

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14342>
2022-01-07 03:31:16 +00:00
Jesse Natalie e3c14cf718 microsoft/compiler: Unify handle retrieval between images and UBO/SSBO
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14342>
2022-01-07 03:31:16 +00:00
Jesse Natalie 61872b5240 microsoft/compiler: Emit GL images in descriptor space 1 with driver_location instead of binding
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14342>
2022-01-07 03:31:16 +00:00
Jesse Natalie 83ed626b76 microsoft/compiler: Put SSBO and image handles in separate arrays
In a future change, the bindings for images and SSBOs will start to
overlap in GL (using a separate space to disambiguate them)

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14342>
2022-01-07 03:31:16 +00:00
Jesse Natalie 8a4b443c5b microsoft/compiler: Change vulkan_environment bool to an enum
There are currently 3 different "environments" supported by this backend,
and they have slightly different semantics for how resources are accessed,
which is only going to get a little weirder when GL images start getting
supported. To try to make things less confusing, use an explicit enum
with heavy documentation on what's different between them.

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14342>
2022-01-07 03:31:16 +00:00
Jesse Natalie 8371591dc6 microsoft/compiler: Fix LOD instruction to return 2 values
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14161>
2021-12-30 09:50:17 -08:00
Jesse Natalie 8926cfc9f7 d3d12: Enable texture gather
The CI changes are because WARP fails really hard at gather,
with crashes when doing it on a 1x1 or Nx1 texture, and incorrectly
applying swizzling to the result vector instead of the actual texture
accesses.

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14161>
2021-12-30 09:50:17 -08:00
Jesse Natalie 9ba4569184 microsoft/compiler: Position should always be no-perspective
Debug WARP asserts on this, and sure enough, the spec says it
should be no-perspective.

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14161>
2021-12-30 08:14:20 -08:00
Jesse Natalie c375b05bfe microsoft/compiler: Handle write masks in SSBO lowering pass
Previously, the lowering was for 8/16/64-bit values, or 8/16-component
vectors. Now, it also handles write masks on 32-bit 1/2/3/4-component
vectors.

DXIL looks like it supports putting an interesting write mask in the
buffer store intrinsic, but DXC never generates stores with write
masks, and multiple drivers completely ignore the write mask.

Also, set the write mask properly on the output intrinsic.

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14294>
2021-12-27 23:40:24 +00:00
Jesse Natalie efc47571d4 microsoft/compiler: Hook up uavs-at-every-stage flag
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14294>
2021-12-27 23:40:24 +00:00
Jesse Natalie 72b0d0cda0 microsoft/compiler: Emit SSBOs from 0 -> count for GL (non-kernel, non-Vulkan) shaders
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14294>
2021-12-27 23:40:24 +00:00
Thomas H.P. Andersen e0ec818cfd microsoft/compiler: dxil_nir_opt_alu_deref_srcs: return progress
dxil_nir_opt_alu_deref_srcs will always return false because
the progress variable is declared both for the function and also
inside the loop.

Spotted by a unused-but-set-variable warning from clang

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14290>
2021-12-23 01:52:13 +00:00
Jesse Natalie 64991d44a8 microsoft/compiler: Load synthesized sysvals via lowered io
Reviewed-by: Enrico Galli <enrico.galli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14175>
2021-12-20 08:20:59 -08:00