Make dawn_native public headers and dawn_wsi use webgpu.h

BUG=dawn:22

Change-Id: I112d71323c9305fa0997d251556fe0a41dafed29
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12701
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
Corentin Wallez
2019-10-24 23:55:37 +00:00
committed by Commit Bot service account
parent 1fdcb16b69
commit 9f90c8d3ca
34 changed files with 121 additions and 121 deletions

View File

@@ -15,7 +15,7 @@
#ifndef DAWN_DAWN_WSI_H_
#define DAWN_DAWN_WSI_H_
#include <dawn/dawn.h>
#include <dawn/webgpu.h>
// Error message (or nullptr if there was no error)
typedef const char* DawnSwapChainError;
@@ -40,8 +40,8 @@ typedef struct {
/// Configure/reconfigure the swap chain.
DawnSwapChainError (*Configure)(void* userData,
DawnTextureFormat format,
DawnTextureUsage allowedUsage,
WGPUTextureFormat format,
WGPUTextureUsage allowedUsage,
uint32_t width,
uint32_t height);
@@ -55,12 +55,12 @@ typedef struct {
void* userData;
/// For use by the D3D12 and Vulkan backends: how the swapchain will use the texture.
DawnTextureUsage textureUsage;
WGPUTextureUsage textureUsage;
} DawnSwapChainImplementation;
#if defined(DAWN_ENABLE_BACKEND_D3D12) && defined(__cplusplus)
typedef struct {
DawnDevice device = nullptr;
WGPUDevice device = nullptr;
} DawnWSIContextD3D12;
#endif

View File

@@ -24,15 +24,15 @@
struct ID3D12Device;
namespace dawn_native { namespace d3d12 {
DAWN_NATIVE_EXPORT Microsoft::WRL::ComPtr<ID3D12Device> GetD3D12Device(DawnDevice device);
DAWN_NATIVE_EXPORT DawnSwapChainImplementation CreateNativeSwapChainImpl(DawnDevice device,
DAWN_NATIVE_EXPORT Microsoft::WRL::ComPtr<ID3D12Device> GetD3D12Device(WGPUDevice device);
DAWN_NATIVE_EXPORT DawnSwapChainImplementation CreateNativeSwapChainImpl(WGPUDevice device,
HWND window);
DAWN_NATIVE_EXPORT DawnTextureFormat
DAWN_NATIVE_EXPORT WGPUTextureFormat
GetNativeSwapChainPreferredFormat(const DawnSwapChainImplementation* swapChain);
// Note: SharedHandle must be a handle to a texture object.
DAWN_NATIVE_EXPORT DawnTexture WrapSharedHandle(DawnDevice device,
const DawnTextureDescriptor* descriptor,
DAWN_NATIVE_EXPORT WGPUTexture WrapSharedHandle(WGPUDevice device,
const WGPUTextureDescriptor* descriptor,
HANDLE sharedHandle,
uint64_t acquireMutexKey);
}} // namespace dawn_native::d3d12

View File

@@ -15,8 +15,8 @@
#ifndef DAWNNATIVE_DAWNNATIVE_H_
#define DAWNNATIVE_DAWNNATIVE_H_
#include <dawn/dawn.h>
#include <dawn/dawn_proc_table.h>
#include <dawn/webgpu.h>
#include <dawn_native/dawn_native_export.h>
#include <string>
@@ -96,7 +96,7 @@ namespace dawn_native {
// Create a device on this adapter, note that the interface will change to include at least
// a device descriptor and a pointer to backend specific options.
// On an error, nullptr is returned.
DawnDevice CreateDevice(const DeviceDescriptor* deviceDescriptor = nullptr);
WGPUDevice CreateDevice(const DeviceDescriptor* deviceDescriptor = nullptr);
private:
AdapterBase* mImpl = nullptr;
@@ -156,10 +156,10 @@ namespace dawn_native {
DAWN_NATIVE_EXPORT DawnProcTable GetProcs();
// Query the names of all the toggles that are enabled in device
DAWN_NATIVE_EXPORT std::vector<const char*> GetTogglesUsed(DawnDevice device);
DAWN_NATIVE_EXPORT std::vector<const char*> GetTogglesUsed(WGPUDevice device);
// Backdoor to get the number of lazy clears for testing
DAWN_NATIVE_EXPORT size_t GetLazyClearCountForTesting(DawnDevice device);
DAWN_NATIVE_EXPORT size_t GetLazyClearCountForTesting(WGPUDevice device);
// Backdoor to get the order of the ProcMap for testing
DAWN_NATIVE_EXPORT std::vector<const char*> GetProcMapNamesForTesting();

View File

@@ -33,8 +33,8 @@ typedef __IOSurface* IOSurfaceRef;
#endif //__OBJC__
namespace dawn_native { namespace metal {
DAWN_NATIVE_EXPORT DawnTexture WrapIOSurface(DawnDevice device,
const DawnTextureDescriptor* descriptor,
DAWN_NATIVE_EXPORT WGPUTexture WrapIOSurface(WGPUDevice device,
const WGPUTextureDescriptor* descriptor,
IOSurfaceRef ioSurface,
uint32_t plane);
@@ -43,12 +43,12 @@ namespace dawn_native { namespace metal {
// does have a global queue of graphics operations, but the command buffers are inserted there
// 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(DawnDevice device);
DAWN_NATIVE_EXPORT void WaitForCommandsToBeScheduled(WGPUDevice device);
}} // namespace dawn_native::metal
#ifdef __OBJC__
namespace dawn_native { namespace metal {
DAWN_NATIVE_EXPORT id<MTLDevice> GetMetalDevice(DawnDevice device);
DAWN_NATIVE_EXPORT id<MTLDevice> GetMetalDevice(WGPUDevice device);
}} // namespace dawn_native::metal
#endif // __OBJC__

View File

@@ -28,8 +28,8 @@ namespace dawn_native { namespace opengl {
using PresentCallback = void (*)(void*);
DAWN_NATIVE_EXPORT DawnSwapChainImplementation
CreateNativeSwapChainImpl(DawnDevice device, PresentCallback present, void* presentUserdata);
DAWN_NATIVE_EXPORT DawnTextureFormat
CreateNativeSwapChainImpl(WGPUDevice device, PresentCallback present, void* presentUserdata);
DAWN_NATIVE_EXPORT WGPUTextureFormat
GetNativeSwapChainPreferredFormat(const DawnSwapChainImplementation* swapChain);
}} // namespace dawn_native::opengl

View File

@@ -26,17 +26,17 @@ namespace dawn_native { namespace vulkan {
// Common properties of external images
struct ExternalImageDescriptor {
const DawnTextureDescriptor* cTextureDescriptor; // Must match image creation params
const WGPUTextureDescriptor* cTextureDescriptor; // Must match image creation params
bool isCleared; // Sets whether the texture will be cleared before use
VkDeviceSize allocationSize; // Must match VkMemoryAllocateInfo from image creation
uint32_t memoryTypeIndex; // Must match VkMemoryAllocateInfo from image creation
};
DAWN_NATIVE_EXPORT VkInstance GetInstance(DawnDevice device);
DAWN_NATIVE_EXPORT VkInstance GetInstance(WGPUDevice device);
DAWN_NATIVE_EXPORT DawnSwapChainImplementation CreateNativeSwapChainImpl(DawnDevice device,
DAWN_NATIVE_EXPORT DawnSwapChainImplementation CreateNativeSwapChainImpl(WGPUDevice device,
VkSurfaceKHR surface);
DAWN_NATIVE_EXPORT DawnTextureFormat
DAWN_NATIVE_EXPORT WGPUTextureFormat
GetNativeSwapChainPreferredFormat(const DawnSwapChainImplementation* swapChain);
// Can't use DAWN_PLATFORM_LINUX since header included in both dawn and chrome
@@ -52,14 +52,14 @@ namespace dawn_native { namespace vulkan {
// |descriptor->waitFDs| before the texture can be used. Finally, a signal semaphore
// can be exported, transferring control back to the caller.
// On failure, returns a nullptr
DAWN_NATIVE_EXPORT DawnTexture
WrapVulkanImageOpaqueFD(DawnDevice cDevice,
DAWN_NATIVE_EXPORT WGPUTexture
WrapVulkanImageOpaqueFD(WGPUDevice cDevice,
const ExternalImageDescriptorOpaqueFD* descriptor);
// Exports a signal semaphore from a wrapped texture. This must be called on wrapped
// textures before they are destroyed. On failure, returns -1
DAWN_NATIVE_EXPORT int ExportSignalSemaphoreOpaqueFD(DawnDevice cDevice,
DawnTexture cTexture);
DAWN_NATIVE_EXPORT int ExportSignalSemaphoreOpaqueFD(WGPUDevice cDevice,
WGPUTexture cTexture);
#endif // __linux__
}} // namespace dawn_native::vulkan