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