Complete per-backend AdapterDiscoveryOptions

D3D12, OpenGL, and OpenGLES have their own backend-specific
AdapterDiscoveryOptions. Add the same for Vulkan and Metal so we can
selectively discover just Vulkan or Metal adapters.

The Vulkan options include a boolean forceSwiftShader to force
Dawn to discover only SwiftShader on the Vulkan backend.

Also, refactor D3D12's DiscoverDefaultAdapters to simply call
DiscoverAdapters to match the other backends.

Bug: chromium:1266550
Change-Id: I137f94b40084b2d0ddeda39b6b7ef20f033d8a4b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/69522
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
This commit is contained in:
Austin Eng
2021-12-06 20:58:56 +00:00
committed by Dawn LUCI CQ
parent 652293f14c
commit 58c655b6b3
13 changed files with 357 additions and 17 deletions

View File

@@ -95,6 +95,7 @@ namespace dawn_native { namespace d3d12 {
};
struct DAWN_NATIVE_EXPORT AdapterDiscoveryOptions : public AdapterDiscoveryOptionsBase {
AdapterDiscoveryOptions();
AdapterDiscoveryOptions(Microsoft::WRL::ComPtr<IDXGIAdapter> adapter);
Microsoft::WRL::ComPtr<IDXGIAdapter> dxgiAdapter;

View File

@@ -33,6 +33,11 @@ typedef __IOSurface* IOSurfaceRef;
#endif //__OBJC__
namespace dawn_native { namespace metal {
struct DAWN_NATIVE_EXPORT AdapterDiscoveryOptions : public AdapterDiscoveryOptionsBase {
AdapterDiscoveryOptions();
};
struct DAWN_NATIVE_EXPORT ExternalImageDescriptorIOSurface : ExternalImageDescriptor {
public:
ExternalImageDescriptorIOSurface();
@@ -50,11 +55,14 @@ namespace dawn_native { namespace metal {
// when they are "scheduled". Submitting other operations before the command buffer is
// scheduled could lead to races in who gets scheduled first and incorrect rendering.
DAWN_NATIVE_EXPORT void WaitForCommandsToBeScheduled(WGPUDevice device);
}} // namespace dawn_native::metal
#ifdef __OBJC__
namespace dawn_native { namespace metal {
DAWN_NATIVE_EXPORT id<MTLDevice> GetMetalDevice(WGPUDevice device);
}} // namespace dawn_native::metal
#endif // __OBJC__

View File

@@ -33,6 +33,12 @@ namespace dawn_native { namespace vulkan {
DAWN_NATIVE_EXPORT WGPUTextureFormat
GetNativeSwapChainPreferredFormat(const DawnSwapChainImplementation* swapChain);
struct DAWN_NATIVE_EXPORT AdapterDiscoveryOptions : public AdapterDiscoveryOptionsBase {
AdapterDiscoveryOptions();
bool forceSwiftShader = false;
};
struct DAWN_NATIVE_EXPORT ExternalImageDescriptorVk : ExternalImageDescriptor {
public:
// The following members may be ignored if |ExternalImageDescriptor::isInitialized| is false