mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 00:17:03 +00:00
Vulkan: Add support for using dedicated allocation when importing images.
This is required to make importing images work on some systems. The ideal version would be detecting whether dedicated allocations are needed as Vulkan provides reflection for that. However this reflection doesn't work on Nvidia, so instead Dawn requires a NeedsDedicatedAllocation enum on import that's Yes/No/Detect so the application can force use of a specific code path. Support for this enum and toggling dedicated allocations on/off is added for all external memory service implementations. Vulkan image wrapping tests are modified to add test parameters so that the Yes/No/Detect code paths are covered by tests. This is technically post-V1 work, but gl_tests in Chromium fail on Nvidia workstations without this fix, which makes it hard to debug other issues. Bug: dawn:1552, dawn:206, dawn:1260 Change-Id: Iee4f7bb9dbec520432ec623551221ef9e4d3d984 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103560 Reviewed-by: Austin Eng <enga@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
6ff74a6d3e
commit
324e446f9c
@@ -40,6 +40,13 @@ struct DAWN_NATIVE_EXPORT AdapterDiscoveryOptions : public AdapterDiscoveryOptio
|
||||
bool forceSwiftShader = false;
|
||||
};
|
||||
|
||||
enum class NeedsDedicatedAllocation {
|
||||
Yes,
|
||||
No,
|
||||
// Use Vulkan reflection to detect whether a dedicated allocation is needed.
|
||||
Detect,
|
||||
};
|
||||
|
||||
struct DAWN_NATIVE_EXPORT ExternalImageDescriptorVk : ExternalImageDescriptor {
|
||||
public:
|
||||
// The following members may be ignored if |ExternalImageDescriptor::isInitialized| is false
|
||||
@@ -54,6 +61,11 @@ struct DAWN_NATIVE_EXPORT ExternalImageDescriptorVk : ExternalImageDescriptor {
|
||||
VkImageLayout releasedOldLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
VkImageLayout releasedNewLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
|
||||
// Try to detect the need to use a dedicated allocation for imported images by default but let
|
||||
// the application override this as drivers have bugs and forget to require a dedicated
|
||||
// allocation.
|
||||
NeedsDedicatedAllocation dedicatedAllocation = NeedsDedicatedAllocation::Detect;
|
||||
|
||||
protected:
|
||||
using ExternalImageDescriptor::ExternalImageDescriptor;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user