Return the capabilities reported by the host. No functional change in case the
host virgl implementation doesn't implement it.
Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
Reviewed-by: Italo Nicola <italonicola@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16401>
The currently available D3D12 API headers have incorrect C function
prototypes for these functions when compiling for non-Windows platforms.
Future changes here will move these helpers into the DirectX-Headers
project, but:
* The process of getting a fix into the headers is still ongoing
* I'd prefer to avoid taking an immediate dependency on just-published
headers again
So, for now add some helpers to work around this problem in Dozen
Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17340>
WSL doesn't have DXGI, but it does have DXCore. DXCore also has a nice
property that it filters to only D3D12-capable adapters. We can rely
on DXCore as a first option even for Windows, because we'll be able
to let the Vulkan loader do preference sorting, instead of having to
rely on DXGI to do it for us.
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/17340>
The prototypes for physical device enumeration are moved to a new
dedicated header so that it can be included from a DXCore path,
which will C++, in the next commit
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/17340>
Per the Vulkan spec, the device UUID should be identical between reboots.
It should also uniquely identify different instances of the same device,
e.g. 2 identical GPUs connected to different PCI ports, but D3D doesn't
currently expose a way to do both of these things. Prefer persistence
over uniqueness here.
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/17340>
WSL doesn't support DXGI, and DirectX-Headers used to build for WSL
doesn't have the DXGI headers, so we need to isolate DXGI usage
and only build it on Windows
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/17340>
Otherwise the IUnknown definition might get included before 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/17340>
While we're moving it, reformat a bit to make it match util_sign_extend
better.
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17214>
As long as we left-shift the unsigned version, this has no undefined
behavior and is fewer instructions. The only tricky bit is that a right
shift of a negative number is technically implementation-defined (not
undefined) behavior in C. However, if it's ever anything other than an
arithmatic right-shift, there's lots of other places where Mesa will
break today.
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17214>
The current implementation depends on both of these things for
correctness. If width > 64, you get UB wrap-around and, if
val >= (1 << width), the subtract trick won't work.
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17214>
Also move it to the end of the switch as is more conventional. For some
reason, later patches in the series make ANV fail to build because GCC
stops detecting the assert(!"str") as not returning.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17214>
Now that usage flags can be specified even when using the modifier path for
allocation and frontends like GBM and EGL wayland do this properly, we can
drop the assumption that all resources allocated through the modifier
enabled path need to be SCANOUT capable.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17364>
Use a typeless format when VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT is
set, so we can cast to compatible types at least. Still doesn't
work when formats are of the same size but from incompatible
types (like R32_FLOAT and RGBA8_UNORM), which Vulkan considers
as compatible while D3D12 doesn't, but it gets us closer to what
the Vulkan API wants.
D3D12_FEATURE_DATA_D3D12_OPTIONS12::RelaxedFormatCastingSupported
should address the remaining limitations.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17368>
CopyTextureRegion() works fine if the formats belong to the
same group (matching the same _TYPELESS type), so let's avoid
creating a temporary resource in that case.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17368>
D3D12 supports fomat casting through optional features. Let's
add a helper to query whether 2 formats are compatible or not.
The compatibility depends on the formats+usage pair
(CopyTextureRegion() is less strict than the texture sampling
logic).
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17368>
This only works if the framebuffer config is exactly the same so
testing both subpasses have the same attachments is not enough,
they also need to be exactly in the same order.
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17358>
this eliminates (some) out-of-bounds bo access and will ensure that
bo sizing is always accurate by breaking all the cases where it isn't
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17239>