mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 00:17:03 +00:00
Also use ExternalImageDescriptor in D3D12 and Metal Backends
Bug: chromium:1036080 Change-Id: I358b0441c168ca075b09ab028c2f6d9df2a44d59 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16240 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Natasha Lee <natlee@microsoft.com>
This commit is contained in:
committed by
Commit Bot service account
parent
cb90835dd9
commit
6f92b9160b
@@ -30,6 +30,18 @@ namespace dawn_native { namespace d3d12 {
|
||||
DAWN_NATIVE_EXPORT WGPUTextureFormat
|
||||
GetNativeSwapChainPreferredFormat(const DawnSwapChainImplementation* swapChain);
|
||||
|
||||
struct DAWN_NATIVE_EXPORT ExternalImageDescriptorDXGISharedHandle : ExternalImageDescriptor {
|
||||
public:
|
||||
ExternalImageDescriptorDXGISharedHandle();
|
||||
|
||||
HANDLE sharedHandle;
|
||||
uint64_t acquireMutexKey;
|
||||
};
|
||||
|
||||
// Note: SharedHandle must be a handle to a texture object.
|
||||
DAWN_NATIVE_EXPORT WGPUTexture
|
||||
WrapSharedHandle(WGPUDevice device, const ExternalImageDescriptorDXGISharedHandle* descriptor);
|
||||
|
||||
// Note: SharedHandle must be a handle to a texture object.
|
||||
DAWN_NATIVE_EXPORT WGPUTexture WrapSharedHandle(WGPUDevice device,
|
||||
const WGPUTextureDescriptor* descriptor,
|
||||
|
||||
@@ -185,6 +185,24 @@ namespace dawn_native {
|
||||
DAWN_NATIVE_EXPORT uint64_t AcquireErrorInjectorCallCount();
|
||||
DAWN_NATIVE_EXPORT void InjectErrorAt(uint64_t index);
|
||||
|
||||
// The different types of ExternalImageDescriptors
|
||||
enum ExternalImageDescriptorType {
|
||||
OpaqueFD,
|
||||
DmaBuf,
|
||||
IOSurface,
|
||||
DXGISharedHandle,
|
||||
};
|
||||
|
||||
// Common properties of external images
|
||||
struct DAWN_NATIVE_EXPORT ExternalImageDescriptor {
|
||||
public:
|
||||
const ExternalImageDescriptorType type;
|
||||
const WGPUTextureDescriptor* cTextureDescriptor; // Must match image creation params
|
||||
bool isCleared; // Sets whether the texture will be cleared before use
|
||||
|
||||
protected:
|
||||
ExternalImageDescriptor(ExternalImageDescriptorType type);
|
||||
};
|
||||
} // namespace dawn_native
|
||||
|
||||
#endif // DAWNNATIVE_DAWNNATIVE_H_
|
||||
|
||||
@@ -33,6 +33,17 @@ typedef __IOSurface* IOSurfaceRef;
|
||||
#endif //__OBJC__
|
||||
|
||||
namespace dawn_native { namespace metal {
|
||||
struct DAWN_NATIVE_EXPORT ExternalImageDescriptorIOSurface : ExternalImageDescriptor {
|
||||
public:
|
||||
ExternalImageDescriptorIOSurface();
|
||||
|
||||
IOSurfaceRef ioSurface;
|
||||
uint32_t plane;
|
||||
};
|
||||
|
||||
DAWN_NATIVE_EXPORT WGPUTexture
|
||||
WrapIOSurface(WGPUDevice device, const ExternalImageDescriptorIOSurface* descriptor);
|
||||
|
||||
DAWN_NATIVE_EXPORT WGPUTexture WrapIOSurface(WGPUDevice device,
|
||||
const WGPUTextureDescriptor* descriptor,
|
||||
IOSurfaceRef ioSurface,
|
||||
|
||||
@@ -23,26 +23,6 @@
|
||||
#include <vector>
|
||||
|
||||
namespace dawn_native { namespace vulkan {
|
||||
|
||||
// The different types of ExternalImageDescriptors
|
||||
enum ExternalImageDescriptorType {
|
||||
#ifdef __linux__
|
||||
OpaqueFD,
|
||||
DmaBuf,
|
||||
#endif // __linux__
|
||||
};
|
||||
|
||||
// Common properties of external images
|
||||
struct DAWN_NATIVE_EXPORT ExternalImageDescriptor {
|
||||
public:
|
||||
const ExternalImageDescriptorType type; // Must match the subclass
|
||||
const WGPUTextureDescriptor* cTextureDescriptor; // Must match image creation params
|
||||
bool isCleared; // Sets whether the texture will be cleared before use
|
||||
|
||||
protected:
|
||||
ExternalImageDescriptor(ExternalImageDescriptorType type);
|
||||
};
|
||||
|
||||
DAWN_NATIVE_EXPORT VkInstance GetInstance(WGPUDevice device);
|
||||
|
||||
DAWN_NATIVE_EXPORT PFN_vkVoidFunction GetInstanceProcAddr(WGPUDevice device, const char* pName);
|
||||
|
||||
Reference in New Issue
Block a user