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>
diff --git a/generator/templates/dawn_native/ProcTable.cpp b/generator/templates/dawn_native/ProcTable.cpp
index 9a75bd5..92aed37 100644
--- a/generator/templates/dawn_native/ProcTable.cpp
+++ b/generator/templates/dawn_native/ProcTable.cpp
@@ -73,18 +73,18 @@
{% endfor %}
struct ProcEntry {
- DawnProc proc;
+ WGPUProc proc;
const char* name;
};
static const ProcEntry sProcMap[] = {
{% for (type, method) in methods_sorted_by_name %}
- { reinterpret_cast<DawnProc>(Native{{as_MethodSuffix(type.name, method.name)}}), "{{as_cMethod(type.name, method.name)}}" },
+ { reinterpret_cast<WGPUProc>(Native{{as_MethodSuffix(type.name, method.name)}}), "{{as_cMethod(type.name, method.name)}}" },
{% endfor %}
};
static constexpr size_t sProcMapSize = sizeof(sProcMap) / sizeof(sProcMap[0]);
}
- DawnProc NativeGetProcAddress(DawnDevice, const char* procName) {
+ WGPUProc NativeGetProcAddress(WGPUDevice, const char* procName) {
if (procName == nullptr) {
return nullptr;
}
@@ -100,7 +100,7 @@
}
if (strcmp(procName, "wgpuGetProcAddress") == 0) {
- return reinterpret_cast<DawnProc>(NativeGetProcAddress);
+ return reinterpret_cast<WGPUProc>(NativeGetProcAddress);
}
return nullptr;
diff --git a/src/common/SwapChainUtils.h b/src/common/SwapChainUtils.h
index af62d79..c1ad5f2 100644
--- a/src/common/SwapChainUtils.h
+++ b/src/common/SwapChainUtils.h
@@ -26,7 +26,7 @@
reinterpret_cast<T*>(userData)->Init(ctx);
};
impl.Destroy = [](void* userData) { delete reinterpret_cast<T*>(userData); };
- impl.Configure = [](void* userData, DawnTextureFormat format, DawnTextureUsage allowedUsage,
+ impl.Configure = [](void* userData, WGPUTextureFormat format, WGPUTextureUsage allowedUsage,
uint32_t width, uint32_t height) {
return static_cast<T*>(userData)->Configure(format, allowedUsage, width, height);
};
diff --git a/src/dawn_native/Buffer.cpp b/src/dawn_native/Buffer.cpp
index 7bfed63..5712bdf 100644
--- a/src/dawn_native/Buffer.cpp
+++ b/src/dawn_native/Buffer.cpp
@@ -124,8 +124,8 @@
BufferBase::~BufferBase() {
if (mState == BufferState::Mapped) {
ASSERT(!IsError());
- CallMapReadCallback(mMapSerial, DAWN_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, 0u);
- CallMapWriteCallback(mMapSerial, DAWN_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, 0u);
+ CallMapReadCallback(mMapSerial, WGPUBufferMapAsyncStatus_Unknown, nullptr, 0u);
+ CallMapWriteCallback(mMapSerial, WGPUBufferMapAsyncStatus_Unknown, nullptr, 0u);
}
}
@@ -231,7 +231,7 @@
void BufferBase::MapReadAsync(WGPUBufferMapReadCallback callback, void* userdata) {
if (GetDevice()->ConsumedError(ValidateMap(wgpu::BufferUsage::MapRead))) {
- callback(DAWN_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, 0, userdata);
+ callback(WGPUBufferMapAsyncStatus_Error, nullptr, 0, userdata);
return;
}
ASSERT(!IsError());
@@ -267,7 +267,7 @@
void BufferBase::MapWriteAsync(WGPUBufferMapWriteCallback callback, void* userdata) {
if (GetDevice()->ConsumedError(ValidateMap(wgpu::BufferUsage::MapWrite))) {
- callback(DAWN_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, 0, userdata);
+ callback(WGPUBufferMapAsyncStatus_Error, nullptr, 0, userdata);
return;
}
ASSERT(!IsError());
@@ -333,8 +333,8 @@
// completed before the Unmap.
// Callbacks are not fired if there is no callback registered, so this is correct for
// CreateBufferMapped.
- CallMapReadCallback(mMapSerial, DAWN_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, 0u);
- CallMapWriteCallback(mMapSerial, DAWN_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, 0u);
+ CallMapReadCallback(mMapSerial, WGPUBufferMapAsyncStatus_Unknown, nullptr, 0u);
+ CallMapWriteCallback(mMapSerial, WGPUBufferMapAsyncStatus_Unknown, nullptr, 0u);
UnmapImpl();
}
mState = BufferState::Unmapped;
diff --git a/src/dawn_native/DawnNative.cpp b/src/dawn_native/DawnNative.cpp
index e63e3b8..c30c690 100644
--- a/src/dawn_native/DawnNative.cpp
+++ b/src/dawn_native/DawnNative.cpp
@@ -27,7 +27,7 @@
return GetProcsAutogen();
}
- std::vector<const char*> GetTogglesUsed(DawnDevice device) {
+ std::vector<const char*> GetTogglesUsed(WGPUDevice device) {
const dawn_native::DeviceBase* deviceBase =
reinterpret_cast<const dawn_native::DeviceBase*>(device);
return deviceBase->GetTogglesUsed();
@@ -65,8 +65,8 @@
return mImpl != nullptr;
}
- DawnDevice Adapter::CreateDevice(const DeviceDescriptor* deviceDescriptor) {
- return reinterpret_cast<DawnDevice>(mImpl->CreateDevice(deviceDescriptor));
+ WGPUDevice Adapter::CreateDevice(const DeviceDescriptor* deviceDescriptor) {
+ return reinterpret_cast<WGPUDevice>(mImpl->CreateDevice(deviceDescriptor));
}
// AdapterDiscoverOptionsBase
@@ -129,7 +129,7 @@
return mImpl->GetPlatform();
}
- size_t GetLazyClearCountForTesting(DawnDevice device) {
+ size_t GetLazyClearCountForTesting(WGPUDevice device) {
dawn_native::DeviceBase* deviceBase = reinterpret_cast<dawn_native::DeviceBase*>(device);
return deviceBase->GetLazyClearCountForTesting();
}
diff --git a/src/dawn_native/Device.cpp b/src/dawn_native/Device.cpp
index c160447..8fa1278 100644
--- a/src/dawn_native/Device.cpp
+++ b/src/dawn_native/Device.cpp
@@ -380,7 +380,7 @@
return result;
}
- DawnCreateBufferMappedResult DeviceBase::CreateBufferMapped(
+ WGPUCreateBufferMappedResult DeviceBase::CreateBufferMapped(
const BufferDescriptor* descriptor) {
BufferBase* buffer = nullptr;
uint8_t* data = nullptr;
@@ -405,8 +405,8 @@
memset(data, 0, size);
}
- DawnCreateBufferMappedResult result = {};
- result.buffer = reinterpret_cast<DawnBuffer>(buffer);
+ WGPUCreateBufferMappedResult result = {};
+ result.buffer = reinterpret_cast<WGPUBuffer>(buffer);
result.data = data;
result.dataLength = size;
@@ -415,11 +415,11 @@
void DeviceBase::CreateBufferMappedAsync(const BufferDescriptor* descriptor,
wgpu::BufferCreateMappedCallback callback,
void* userdata) {
- DawnCreateBufferMappedResult result = CreateBufferMapped(descriptor);
+ WGPUCreateBufferMappedResult result = CreateBufferMapped(descriptor);
- DawnBufferMapAsyncStatus status = DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS;
+ WGPUBufferMapAsyncStatus status = WGPUBufferMapAsyncStatus_Success;
if (result.data == nullptr || result.dataLength != descriptor->size) {
- status = DAWN_BUFFER_MAP_ASYNC_STATUS_ERROR;
+ status = WGPUBufferMapAsyncStatus_Error;
}
DeferredCreateBufferMappedAsync deferred_info;
diff --git a/src/dawn_native/Device.h b/src/dawn_native/Device.h
index e828195..af6ca98 100644
--- a/src/dawn_native/Device.h
+++ b/src/dawn_native/Device.h
@@ -141,7 +141,7 @@
BindGroupBase* CreateBindGroup(const BindGroupDescriptor* descriptor);
BindGroupLayoutBase* CreateBindGroupLayout(const BindGroupLayoutDescriptor* descriptor);
BufferBase* CreateBuffer(const BufferDescriptor* descriptor);
- DawnCreateBufferMappedResult CreateBufferMapped(const BufferDescriptor* descriptor);
+ WGPUCreateBufferMappedResult CreateBufferMapped(const BufferDescriptor* descriptor);
void CreateBufferMappedAsync(const BufferDescriptor* descriptor,
wgpu::BufferCreateMappedCallback callback,
void* userdata);
@@ -262,8 +262,8 @@
struct DeferredCreateBufferMappedAsync {
wgpu::BufferCreateMappedCallback callback;
- DawnBufferMapAsyncStatus status;
- DawnCreateBufferMappedResult result;
+ WGPUBufferMapAsyncStatus status;
+ WGPUCreateBufferMappedResult result;
void* userdata;
};
diff --git a/src/dawn_native/Fence.cpp b/src/dawn_native/Fence.cpp
index c0195c4..2c506a1 100644
--- a/src/dawn_native/Fence.cpp
+++ b/src/dawn_native/Fence.cpp
@@ -46,7 +46,7 @@
FenceBase::~FenceBase() {
for (auto& request : mRequests.IterateAll()) {
ASSERT(!IsError());
- request.completionCallback(DAWN_FENCE_COMPLETION_STATUS_UNKNOWN, request.userdata);
+ request.completionCallback(WGPUFenceCompletionStatus_Unknown, request.userdata);
}
mRequests.Clear();
}
@@ -67,13 +67,13 @@
wgpu::FenceOnCompletionCallback callback,
void* userdata) {
if (GetDevice()->ConsumedError(ValidateOnCompletion(value))) {
- callback(DAWN_FENCE_COMPLETION_STATUS_ERROR, userdata);
+ callback(WGPUFenceCompletionStatus_Error, userdata);
return;
}
ASSERT(!IsError());
if (value <= mCompletedValue) {
- callback(DAWN_FENCE_COMPLETION_STATUS_SUCCESS, userdata);
+ callback(WGPUFenceCompletionStatus_Success, userdata);
return;
}
@@ -106,7 +106,7 @@
mCompletedValue = completedValue;
for (auto& request : mRequests.IterateUpTo(mCompletedValue)) {
- request.completionCallback(DAWN_FENCE_COMPLETION_STATUS_SUCCESS, request.userdata);
+ request.completionCallback(WGPUFenceCompletionStatus_Success, request.userdata);
}
mRequests.ClearUpTo(mCompletedValue);
}
diff --git a/src/dawn_native/SwapChain.cpp b/src/dawn_native/SwapChain.cpp
index bb9eb63..e9907b9 100644
--- a/src/dawn_native/SwapChain.cpp
+++ b/src/dawn_native/SwapChain.cpp
@@ -95,8 +95,8 @@
mAllowedUsage = allowedUsage;
mWidth = width;
mHeight = height;
- mImplementation.Configure(mImplementation.userData, static_cast<DawnTextureFormat>(format),
- static_cast<DawnTextureUsage>(allowedUsage), width, height);
+ mImplementation.Configure(mImplementation.userData, static_cast<WGPUTextureFormat>(format),
+ static_cast<WGPUTextureUsage>(allowedUsage), width, height);
}
TextureBase* SwapChainBase::GetNextTexture() {
diff --git a/src/dawn_native/d3d12/BufferD3D12.cpp b/src/dawn_native/d3d12/BufferD3D12.cpp
index 3c4feef..b875403 100644
--- a/src/dawn_native/d3d12/BufferD3D12.cpp
+++ b/src/dawn_native/d3d12/BufferD3D12.cpp
@@ -218,9 +218,9 @@
void Buffer::OnMapCommandSerialFinished(uint32_t mapSerial, void* data, bool isWrite) {
if (isWrite) {
- CallMapWriteCallback(mapSerial, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, data, GetSize());
+ CallMapWriteCallback(mapSerial, WGPUBufferMapAsyncStatus_Success, data, GetSize());
} else {
- CallMapReadCallback(mapSerial, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, data, GetSize());
+ CallMapReadCallback(mapSerial, WGPUBufferMapAsyncStatus_Success, data, GetSize());
}
}
diff --git a/src/dawn_native/d3d12/D3D12Backend.cpp b/src/dawn_native/d3d12/D3D12Backend.cpp
index f7a4952..2db62da 100644
--- a/src/dawn_native/d3d12/D3D12Backend.cpp
+++ b/src/dawn_native/d3d12/D3D12Backend.cpp
@@ -24,30 +24,30 @@
namespace dawn_native { namespace d3d12 {
- ComPtr<ID3D12Device> GetD3D12Device(DawnDevice device) {
+ ComPtr<ID3D12Device> GetD3D12Device(WGPUDevice device) {
Device* backendDevice = reinterpret_cast<Device*>(device);
return backendDevice->GetD3D12Device();
}
- DawnSwapChainImplementation CreateNativeSwapChainImpl(DawnDevice device, HWND window) {
+ DawnSwapChainImplementation CreateNativeSwapChainImpl(WGPUDevice device, HWND window) {
Device* backendDevice = reinterpret_cast<Device*>(device);
DawnSwapChainImplementation impl;
impl = CreateSwapChainImplementation(new NativeSwapChainImpl(backendDevice, window));
- impl.textureUsage = DAWN_TEXTURE_USAGE_PRESENT;
+ impl.textureUsage = WGPUTextureUsage_Present;
return impl;
}
- DawnTextureFormat GetNativeSwapChainPreferredFormat(
+ WGPUTextureFormat GetNativeSwapChainPreferredFormat(
const DawnSwapChainImplementation* swapChain) {
NativeSwapChainImpl* impl = reinterpret_cast<NativeSwapChainImpl*>(swapChain->userData);
- return static_cast<DawnTextureFormat>(impl->GetPreferredFormat());
+ return static_cast<WGPUTextureFormat>(impl->GetPreferredFormat());
}
- DawnTexture WrapSharedHandle(DawnDevice device,
- const DawnTextureDescriptor* descriptor,
+ WGPUTexture WrapSharedHandle(WGPUDevice device,
+ const WGPUTextureDescriptor* descriptor,
HANDLE sharedHandle,
uint64_t acquireMutexKey) {
Device* backendDevice = reinterpret_cast<Device*>(device);
@@ -55,6 +55,6 @@
reinterpret_cast<const TextureDescriptor*>(descriptor);
TextureBase* texture =
backendDevice->WrapSharedHandle(backendDescriptor, sharedHandle, acquireMutexKey);
- return reinterpret_cast<DawnTexture>(texture);
+ return reinterpret_cast<WGPUTexture>(texture);
}
}} // namespace dawn_native::d3d12
diff --git a/src/dawn_native/d3d12/NativeSwapChainImplD3D12.cpp b/src/dawn_native/d3d12/NativeSwapChainImplD3D12.cpp
index 9b40497..9170e8e 100644
--- a/src/dawn_native/d3d12/NativeSwapChainImplD3D12.cpp
+++ b/src/dawn_native/d3d12/NativeSwapChainImplD3D12.cpp
@@ -21,15 +21,15 @@
namespace dawn_native { namespace d3d12 {
namespace {
- DXGI_USAGE D3D12SwapChainBufferUsage(DawnTextureUsage allowedUsages) {
+ DXGI_USAGE D3D12SwapChainBufferUsage(WGPUTextureUsage allowedUsages) {
DXGI_USAGE usage = DXGI_CPU_ACCESS_NONE;
- if (allowedUsages & DAWN_TEXTURE_USAGE_SAMPLED) {
+ if (allowedUsages & WGPUTextureUsage_Sampled) {
usage |= DXGI_USAGE_SHADER_INPUT;
}
- if (allowedUsages & DAWN_TEXTURE_USAGE_STORAGE) {
+ if (allowedUsages & WGPUTextureUsage_Storage) {
usage |= DXGI_USAGE_UNORDERED_ACCESS;
}
- if (allowedUsages & DAWN_TEXTURE_USAGE_OUTPUT_ATTACHMENT) {
+ if (allowedUsages & WGPUTextureUsage_OutputAttachment) {
usage |= DXGI_USAGE_RENDER_TARGET_OUTPUT;
}
return usage;
@@ -48,13 +48,13 @@
void NativeSwapChainImpl::Init(DawnWSIContextD3D12* /*context*/) {
}
- DawnSwapChainError NativeSwapChainImpl::Configure(DawnTextureFormat format,
- DawnTextureUsage usage,
+ DawnSwapChainError NativeSwapChainImpl::Configure(WGPUTextureFormat format,
+ WGPUTextureUsage usage,
uint32_t width,
uint32_t height) {
ASSERT(width > 0);
ASSERT(height > 0);
- ASSERT(format == static_cast<DawnTextureFormat>(GetPreferredFormat()));
+ ASSERT(format == static_cast<WGPUTextureFormat>(GetPreferredFormat()));
ComPtr<IDXGIFactory4> factory = mDevice->GetFactory();
ComPtr<ID3D12CommandQueue> queue = mDevice->GetCommandQueue();
diff --git a/src/dawn_native/d3d12/NativeSwapChainImplD3D12.h b/src/dawn_native/d3d12/NativeSwapChainImplD3D12.h
index fa8e4fa..aaa8d85 100644
--- a/src/dawn_native/d3d12/NativeSwapChainImplD3D12.h
+++ b/src/dawn_native/d3d12/NativeSwapChainImplD3D12.h
@@ -34,8 +34,8 @@
~NativeSwapChainImpl();
void Init(DawnWSIContextD3D12* context);
- DawnSwapChainError Configure(DawnTextureFormat format,
- DawnTextureUsage,
+ DawnSwapChainError Configure(WGPUTextureFormat format,
+ WGPUTextureUsage,
uint32_t width,
uint32_t height);
DawnSwapChainError GetNextTexture(DawnSwapChainNextTexture* nextTexture);
diff --git a/src/dawn_native/d3d12/SwapChainD3D12.cpp b/src/dawn_native/d3d12/SwapChainD3D12.cpp
index 29acf57..aec8a61 100644
--- a/src/dawn_native/d3d12/SwapChainD3D12.cpp
+++ b/src/dawn_native/d3d12/SwapChainD3D12.cpp
@@ -25,10 +25,10 @@
: SwapChainBase(device, descriptor) {
const auto& im = GetImplementation();
DawnWSIContextD3D12 wsiContext = {};
- wsiContext.device = reinterpret_cast<DawnDevice>(GetDevice());
+ wsiContext.device = reinterpret_cast<WGPUDevice>(GetDevice());
im.Init(im.userData, &wsiContext);
- ASSERT(im.textureUsage != DAWN_TEXTURE_USAGE_NONE);
+ ASSERT(im.textureUsage != WGPUTextureUsage_None);
mTextureUsage = static_cast<wgpu::TextureUsage>(im.textureUsage);
}
diff --git a/src/dawn_native/metal/BufferMTL.mm b/src/dawn_native/metal/BufferMTL.mm
index a3c2f4c..c61b029 100644
--- a/src/dawn_native/metal/BufferMTL.mm
+++ b/src/dawn_native/metal/BufferMTL.mm
@@ -53,9 +53,9 @@
void Buffer::OnMapCommandSerialFinished(uint32_t mapSerial, bool isWrite) {
char* data = reinterpret_cast<char*>([mMtlBuffer contents]);
if (isWrite) {
- CallMapWriteCallback(mapSerial, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, data, GetSize());
+ CallMapWriteCallback(mapSerial, WGPUBufferMapAsyncStatus_Success, data, GetSize());
} else {
- CallMapReadCallback(mapSerial, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, data, GetSize());
+ CallMapReadCallback(mapSerial, WGPUBufferMapAsyncStatus_Success, data, GetSize());
}
}
diff --git a/src/dawn_native/metal/MetalBackend.mm b/src/dawn_native/metal/MetalBackend.mm
index e5c8867..22b583a 100644
--- a/src/dawn_native/metal/MetalBackend.mm
+++ b/src/dawn_native/metal/MetalBackend.mm
@@ -22,23 +22,23 @@
namespace dawn_native { namespace metal {
- id<MTLDevice> GetMetalDevice(DawnDevice cDevice) {
+ id<MTLDevice> GetMetalDevice(WGPUDevice cDevice) {
Device* device = reinterpret_cast<Device*>(cDevice);
return device->GetMTLDevice();
}
- DawnTexture WrapIOSurface(DawnDevice cDevice,
- const DawnTextureDescriptor* cDescriptor,
+ WGPUTexture WrapIOSurface(WGPUDevice cDevice,
+ const WGPUTextureDescriptor* cDescriptor,
IOSurfaceRef ioSurface,
uint32_t plane) {
Device* device = reinterpret_cast<Device*>(cDevice);
const TextureDescriptor* descriptor =
reinterpret_cast<const TextureDescriptor*>(cDescriptor);
TextureBase* texture = device->CreateTextureWrappingIOSurface(descriptor, ioSurface, plane);
- return reinterpret_cast<DawnTexture>(texture);
+ return reinterpret_cast<WGPUTexture>(texture);
}
- void WaitForCommandsToBeScheduled(DawnDevice cDevice) {
+ void WaitForCommandsToBeScheduled(WGPUDevice cDevice) {
Device* device = reinterpret_cast<Device*>(cDevice);
device->WaitForCommandsToBeScheduled();
}
diff --git a/src/dawn_native/null/DeviceNull.cpp b/src/dawn_native/null/DeviceNull.cpp
index 35a2cfd..207efc3 100644
--- a/src/dawn_native/null/DeviceNull.cpp
+++ b/src/dawn_native/null/DeviceNull.cpp
@@ -251,9 +251,9 @@
void Buffer::MapOperationCompleted(uint32_t serial, void* ptr, bool isWrite) {
if (isWrite) {
- CallMapWriteCallback(serial, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, ptr, GetSize());
+ CallMapWriteCallback(serial, WGPUBufferMapAsyncStatus_Success, ptr, GetSize());
} else {
- CallMapReadCallback(serial, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, ptr, GetSize());
+ CallMapReadCallback(serial, WGPUBufferMapAsyncStatus_Success, ptr, GetSize());
}
}
@@ -348,8 +348,8 @@
void NativeSwapChainImpl::Init(WSIContext* context) {
}
- DawnSwapChainError NativeSwapChainImpl::Configure(DawnTextureFormat format,
- DawnTextureUsage,
+ DawnSwapChainError NativeSwapChainImpl::Configure(WGPUTextureFormat format,
+ WGPUTextureUsage,
uint32_t width,
uint32_t height) {
return DAWN_SWAP_CHAIN_NO_ERROR;
diff --git a/src/dawn_native/null/DeviceNull.h b/src/dawn_native/null/DeviceNull.h
index 9a87942..0ca300c 100644
--- a/src/dawn_native/null/DeviceNull.h
+++ b/src/dawn_native/null/DeviceNull.h
@@ -208,8 +208,8 @@
public:
using WSIContext = struct {};
void Init(WSIContext* context);
- DawnSwapChainError Configure(DawnTextureFormat format,
- DawnTextureUsage,
+ DawnSwapChainError Configure(WGPUTextureFormat format,
+ WGPUTextureUsage,
uint32_t width,
uint32_t height);
DawnSwapChainError GetNextTexture(DawnSwapChainNextTexture* nextTexture);
diff --git a/src/dawn_native/null/NullBackend.cpp b/src/dawn_native/null/NullBackend.cpp
index 14fff85..a48dcdc 100644
--- a/src/dawn_native/null/NullBackend.cpp
+++ b/src/dawn_native/null/NullBackend.cpp
@@ -25,7 +25,7 @@
DawnSwapChainImplementation CreateNativeSwapChainImpl() {
DawnSwapChainImplementation impl;
impl = CreateSwapChainImplementation(new NativeSwapChainImpl());
- impl.textureUsage = DAWN_TEXTURE_USAGE_PRESENT;
+ impl.textureUsage = WGPUTextureUsage_Present;
return impl;
}
diff --git a/src/dawn_native/opengl/BufferGL.cpp b/src/dawn_native/opengl/BufferGL.cpp
index 3f54691..80311af 100644
--- a/src/dawn_native/opengl/BufferGL.cpp
+++ b/src/dawn_native/opengl/BufferGL.cpp
@@ -65,7 +65,7 @@
// version of OpenGL that would let us map the buffer unsynchronized.
gl.BindBuffer(GL_ARRAY_BUFFER, mBuffer);
void* data = gl.MapBuffer(GL_ARRAY_BUFFER, GL_READ_ONLY);
- CallMapReadCallback(serial, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, data, GetSize());
+ CallMapReadCallback(serial, WGPUBufferMapAsyncStatus_Success, data, GetSize());
return {};
}
@@ -76,7 +76,7 @@
// version of OpenGL that would let us map the buffer unsynchronized.
gl.BindBuffer(GL_ARRAY_BUFFER, mBuffer);
void* data = gl.MapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
- CallMapWriteCallback(serial, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, data, GetSize());
+ CallMapWriteCallback(serial, WGPUBufferMapAsyncStatus_Success, data, GetSize());
return {};
}
diff --git a/src/dawn_native/opengl/NativeSwapChainImplGL.cpp b/src/dawn_native/opengl/NativeSwapChainImplGL.cpp
index 0b5f294..3cfdad4 100644
--- a/src/dawn_native/opengl/NativeSwapChainImplGL.cpp
+++ b/src/dawn_native/opengl/NativeSwapChainImplGL.cpp
@@ -42,11 +42,11 @@
mBackTexture, 0);
}
- DawnSwapChainError NativeSwapChainImpl::Configure(DawnTextureFormat format,
- DawnTextureUsage usage,
+ DawnSwapChainError NativeSwapChainImpl::Configure(WGPUTextureFormat format,
+ WGPUTextureUsage usage,
uint32_t width,
uint32_t height) {
- if (format != DAWN_TEXTURE_FORMAT_RGBA8_UNORM) {
+ if (format != WGPUTextureFormat_RGBA8Unorm) {
return "unsupported format";
}
ASSERT(width > 0);
diff --git a/src/dawn_native/opengl/NativeSwapChainImplGL.h b/src/dawn_native/opengl/NativeSwapChainImplGL.h
index 2729e4c..acda005 100644
--- a/src/dawn_native/opengl/NativeSwapChainImplGL.h
+++ b/src/dawn_native/opengl/NativeSwapChainImplGL.h
@@ -32,8 +32,8 @@
~NativeSwapChainImpl();
void Init(DawnWSIContextGL* context);
- DawnSwapChainError Configure(DawnTextureFormat format,
- DawnTextureUsage,
+ DawnSwapChainError Configure(WGPUTextureFormat format,
+ WGPUTextureUsage,
uint32_t width,
uint32_t height);
DawnSwapChainError GetNextTexture(DawnSwapChainNextTexture* nextTexture);
diff --git a/src/dawn_native/opengl/OpenGLBackend.cpp b/src/dawn_native/opengl/OpenGLBackend.cpp
index 91b019f..fbab415 100644
--- a/src/dawn_native/opengl/OpenGLBackend.cpp
+++ b/src/dawn_native/opengl/OpenGLBackend.cpp
@@ -27,7 +27,7 @@
: AdapterDiscoveryOptionsBase(BackendType::OpenGL) {
}
- DawnSwapChainImplementation CreateNativeSwapChainImpl(DawnDevice device,
+ DawnSwapChainImplementation CreateNativeSwapChainImpl(WGPUDevice device,
PresentCallback present,
void* presentUserdata) {
Device* backendDevice = reinterpret_cast<Device*>(device);
@@ -35,15 +35,15 @@
DawnSwapChainImplementation impl;
impl = CreateSwapChainImplementation(
new NativeSwapChainImpl(backendDevice, present, presentUserdata));
- impl.textureUsage = DAWN_TEXTURE_USAGE_PRESENT;
+ impl.textureUsage = WGPUTextureUsage_Present;
return impl;
}
- DawnTextureFormat GetNativeSwapChainPreferredFormat(
+ WGPUTextureFormat GetNativeSwapChainPreferredFormat(
const DawnSwapChainImplementation* swapChain) {
NativeSwapChainImpl* impl = reinterpret_cast<NativeSwapChainImpl*>(swapChain->userData);
- return static_cast<DawnTextureFormat>(impl->GetPreferredFormat());
+ return static_cast<WGPUTextureFormat>(impl->GetPreferredFormat());
}
}} // namespace dawn_native::opengl
diff --git a/src/dawn_native/vulkan/BufferVk.cpp b/src/dawn_native/vulkan/BufferVk.cpp
index dbbe44e..baa7102 100644
--- a/src/dawn_native/vulkan/BufferVk.cpp
+++ b/src/dawn_native/vulkan/BufferVk.cpp
@@ -160,11 +160,11 @@
}
void Buffer::OnMapReadCommandSerialFinished(uint32_t mapSerial, const void* data) {
- CallMapReadCallback(mapSerial, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, data, GetSize());
+ CallMapReadCallback(mapSerial, WGPUBufferMapAsyncStatus_Success, data, GetSize());
}
void Buffer::OnMapWriteCommandSerialFinished(uint32_t mapSerial, void* data) {
- CallMapWriteCallback(mapSerial, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, data, GetSize());
+ CallMapWriteCallback(mapSerial, WGPUBufferMapAsyncStatus_Success, data, GetSize());
}
VkBuffer Buffer::GetHandle() const {
diff --git a/src/dawn_native/vulkan/NativeSwapChainImplVk.cpp b/src/dawn_native/vulkan/NativeSwapChainImplVk.cpp
index 76b66ca..e359d70 100644
--- a/src/dawn_native/vulkan/NativeSwapChainImplVk.cpp
+++ b/src/dawn_native/vulkan/NativeSwapChainImplVk.cpp
@@ -94,8 +94,8 @@
UpdateSurfaceConfig();
}
- DawnSwapChainError NativeSwapChainImpl::Configure(DawnTextureFormat format,
- DawnTextureUsage usage,
+ DawnSwapChainError NativeSwapChainImpl::Configure(WGPUTextureFormat format,
+ WGPUTextureUsage usage,
uint32_t width,
uint32_t height) {
UpdateSurfaceConfig();
@@ -105,7 +105,7 @@
ASSERT(mInfo.capabilities.minImageExtent.height <= height);
ASSERT(mInfo.capabilities.maxImageExtent.height >= height);
- ASSERT(format == static_cast<DawnTextureFormat>(GetPreferredFormat()));
+ ASSERT(format == static_cast<WGPUTextureFormat>(GetPreferredFormat()));
// TODO(cwallez@chromium.org): need to check usage works too
// Create the swapchain with the configuration we chose
diff --git a/src/dawn_native/vulkan/NativeSwapChainImplVk.h b/src/dawn_native/vulkan/NativeSwapChainImplVk.h
index e4e2658..fe7a182 100644
--- a/src/dawn_native/vulkan/NativeSwapChainImplVk.h
+++ b/src/dawn_native/vulkan/NativeSwapChainImplVk.h
@@ -32,8 +32,8 @@
~NativeSwapChainImpl();
void Init(DawnWSIContextVulkan* context);
- DawnSwapChainError Configure(DawnTextureFormat format,
- DawnTextureUsage,
+ DawnSwapChainError Configure(WGPUTextureFormat format,
+ WGPUTextureUsage,
uint32_t width,
uint32_t height);
DawnSwapChainError GetNextTexture(DawnSwapChainNextTexture* nextTexture);
diff --git a/src/dawn_native/vulkan/SwapChainVk.cpp b/src/dawn_native/vulkan/SwapChainVk.cpp
index eb36627..52a1f72 100644
--- a/src/dawn_native/vulkan/SwapChainVk.cpp
+++ b/src/dawn_native/vulkan/SwapChainVk.cpp
@@ -30,7 +30,7 @@
DawnWSIContextVulkan wsiContext = {};
im.Init(im.userData, &wsiContext);
- ASSERT(im.textureUsage != DAWN_TEXTURE_USAGE_NONE);
+ ASSERT(im.textureUsage != WGPUTextureUsage_None);
mTextureUsage = static_cast<wgpu::TextureUsage>(im.textureUsage);
}
diff --git a/src/dawn_native/vulkan/VulkanBackend.cpp b/src/dawn_native/vulkan/VulkanBackend.cpp
index 60eda44..b0060ed 100644
--- a/src/dawn_native/vulkan/VulkanBackend.cpp
+++ b/src/dawn_native/vulkan/VulkanBackend.cpp
@@ -28,7 +28,7 @@
namespace dawn_native { namespace vulkan {
- VkInstance GetInstance(DawnDevice device) {
+ VkInstance GetInstance(WGPUDevice device) {
Device* backendDevice = reinterpret_cast<Device*>(device);
return backendDevice->GetVkInstance();
}
@@ -36,35 +36,35 @@
// Explicitly export this function because it uses the "native" type for surfaces while the
// header as seen in this file uses the wrapped type.
DAWN_NATIVE_EXPORT DawnSwapChainImplementation
- CreateNativeSwapChainImpl(DawnDevice device, VkSurfaceKHRNative surfaceNative) {
+ CreateNativeSwapChainImpl(WGPUDevice device, VkSurfaceKHRNative surfaceNative) {
Device* backendDevice = reinterpret_cast<Device*>(device);
VkSurfaceKHR surface = VkSurfaceKHR::CreateFromHandle(surfaceNative);
DawnSwapChainImplementation impl;
impl = CreateSwapChainImplementation(new NativeSwapChainImpl(backendDevice, surface));
- impl.textureUsage = DAWN_TEXTURE_USAGE_PRESENT;
+ impl.textureUsage = WGPUTextureUsage_Present;
return impl;
}
- DawnTextureFormat GetNativeSwapChainPreferredFormat(
+ WGPUTextureFormat GetNativeSwapChainPreferredFormat(
const DawnSwapChainImplementation* swapChain) {
NativeSwapChainImpl* impl = reinterpret_cast<NativeSwapChainImpl*>(swapChain->userData);
- return static_cast<DawnTextureFormat>(impl->GetPreferredFormat());
+ return static_cast<WGPUTextureFormat>(impl->GetPreferredFormat());
}
#ifdef DAWN_PLATFORM_LINUX
- DawnTexture WrapVulkanImageOpaqueFD(DawnDevice cDevice,
+ WGPUTexture WrapVulkanImageOpaqueFD(WGPUDevice cDevice,
const ExternalImageDescriptorOpaqueFD* descriptor) {
Device* device = reinterpret_cast<Device*>(cDevice);
TextureBase* texture = device->CreateTextureWrappingVulkanImage(
descriptor, descriptor->memoryFD, descriptor->waitFDs);
- return reinterpret_cast<DawnTexture>(texture);
+ return reinterpret_cast<WGPUTexture>(texture);
}
- int ExportSignalSemaphoreOpaqueFD(DawnDevice cDevice, DawnTexture cTexture) {
+ int ExportSignalSemaphoreOpaqueFD(WGPUDevice cDevice, WGPUTexture cTexture) {
Device* device = reinterpret_cast<Device*>(cDevice);
Texture* texture = reinterpret_cast<Texture*>(cTexture);
diff --git a/src/include/dawn/dawn_wsi.h b/src/include/dawn/dawn_wsi.h
index ff83f72..e07e741 100644
--- a/src/include/dawn/dawn_wsi.h
+++ b/src/include/dawn/dawn_wsi.h
@@ -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 @@
/// 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 @@
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
diff --git a/src/include/dawn_native/D3D12Backend.h b/src/include/dawn_native/D3D12Backend.h
index 14c0ffe..de12d64 100644
--- a/src/include/dawn_native/D3D12Backend.h
+++ b/src/include/dawn_native/D3D12Backend.h
@@ -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
diff --git a/src/include/dawn_native/DawnNative.h b/src/include/dawn_native/DawnNative.h
index b3125ed..6e1bd63 100644
--- a/src/include/dawn_native/DawnNative.h
+++ b/src/include/dawn_native/DawnNative.h
@@ -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 @@
// 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 @@
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();
diff --git a/src/include/dawn_native/MetalBackend.h b/src/include/dawn_native/MetalBackend.h
index 7588b97..6e07c05 100644
--- a/src/include/dawn_native/MetalBackend.h
+++ b/src/include/dawn_native/MetalBackend.h
@@ -33,8 +33,8 @@
#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 @@
// 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__
diff --git a/src/include/dawn_native/OpenGLBackend.h b/src/include/dawn_native/OpenGLBackend.h
index 0ebbbc7..0589671 100644
--- a/src/include/dawn_native/OpenGLBackend.h
+++ b/src/include/dawn_native/OpenGLBackend.h
@@ -28,8 +28,8 @@
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
diff --git a/src/include/dawn_native/VulkanBackend.h b/src/include/dawn_native/VulkanBackend.h
index f874259..fc81a58 100644
--- a/src/include/dawn_native/VulkanBackend.h
+++ b/src/include/dawn_native/VulkanBackend.h
@@ -26,17 +26,17 @@
// 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 @@
// |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
diff --git a/src/tests/unittests/ExtensionTests.cpp b/src/tests/unittests/ExtensionTests.cpp
index cef2752..4e2a81c 100644
--- a/src/tests/unittests/ExtensionTests.cpp
+++ b/src/tests/unittests/ExtensionTests.cpp
@@ -55,7 +55,7 @@
dawn_native::DeviceDescriptor deviceDescriptor;
const char* extensionName = ExtensionEnumToName(notSupportedExtension);
deviceDescriptor.requiredExtensions = std::vector<const char*>(1, extensionName);
- DawnDevice deviceWithExtension = adapterWithoutExtension.CreateDevice(&deviceDescriptor);
+ WGPUDevice deviceWithExtension = adapterWithoutExtension.CreateDevice(&deviceDescriptor);
ASSERT_EQ(nullptr, deviceWithExtension);
}
}