diff --git a/generator/templates/dawn_native/ProcTable.cpp b/generator/templates/dawn_native/ProcTable.cpp index 9a75bd5dde..92aed37427 100644 --- a/generator/templates/dawn_native/ProcTable.cpp +++ b/generator/templates/dawn_native/ProcTable.cpp @@ -73,18 +73,18 @@ namespace dawn_native { {% endfor %} struct ProcEntry { - DawnProc proc; + WGPUProc proc; const char* name; }; static const ProcEntry sProcMap[] = { {% for (type, method) in methods_sorted_by_name %} - { reinterpret_cast(Native{{as_MethodSuffix(type.name, method.name)}}), "{{as_cMethod(type.name, method.name)}}" }, + { reinterpret_cast(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 @@ namespace dawn_native { } if (strcmp(procName, "wgpuGetProcAddress") == 0) { - return reinterpret_cast(NativeGetProcAddress); + return reinterpret_cast(NativeGetProcAddress); } return nullptr; diff --git a/src/common/SwapChainUtils.h b/src/common/SwapChainUtils.h index af62d79961..c1ad5f2e62 100644 --- a/src/common/SwapChainUtils.h +++ b/src/common/SwapChainUtils.h @@ -26,7 +26,7 @@ DawnSwapChainImplementation CreateSwapChainImplementation(T* swapChain) { reinterpret_cast(userData)->Init(ctx); }; impl.Destroy = [](void* userData) { delete reinterpret_cast(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(userData)->Configure(format, allowedUsage, width, height); }; diff --git a/src/dawn_native/Buffer.cpp b/src/dawn_native/Buffer.cpp index 7bfed63d56..5712bdf2ee 100644 --- a/src/dawn_native/Buffer.cpp +++ b/src/dawn_native/Buffer.cpp @@ -124,8 +124,8 @@ namespace dawn_native { 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 @@ namespace dawn_native { 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 @@ namespace dawn_native { 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 @@ namespace dawn_native { // 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 e63e3b8efd..c30c6906cc 100644 --- a/src/dawn_native/DawnNative.cpp +++ b/src/dawn_native/DawnNative.cpp @@ -27,7 +27,7 @@ namespace dawn_native { return GetProcsAutogen(); } - std::vector GetTogglesUsed(DawnDevice device) { + std::vector GetTogglesUsed(WGPUDevice device) { const dawn_native::DeviceBase* deviceBase = reinterpret_cast(device); return deviceBase->GetTogglesUsed(); @@ -65,8 +65,8 @@ namespace dawn_native { return mImpl != nullptr; } - DawnDevice Adapter::CreateDevice(const DeviceDescriptor* deviceDescriptor) { - return reinterpret_cast(mImpl->CreateDevice(deviceDescriptor)); + WGPUDevice Adapter::CreateDevice(const DeviceDescriptor* deviceDescriptor) { + return reinterpret_cast(mImpl->CreateDevice(deviceDescriptor)); } // AdapterDiscoverOptionsBase @@ -129,7 +129,7 @@ namespace dawn_native { return mImpl->GetPlatform(); } - size_t GetLazyClearCountForTesting(DawnDevice device) { + size_t GetLazyClearCountForTesting(WGPUDevice device) { dawn_native::DeviceBase* deviceBase = reinterpret_cast(device); return deviceBase->GetLazyClearCountForTesting(); } diff --git a/src/dawn_native/Device.cpp b/src/dawn_native/Device.cpp index c16044714d..8fa12782b4 100644 --- a/src/dawn_native/Device.cpp +++ b/src/dawn_native/Device.cpp @@ -380,7 +380,7 @@ namespace dawn_native { return result; } - DawnCreateBufferMappedResult DeviceBase::CreateBufferMapped( + WGPUCreateBufferMappedResult DeviceBase::CreateBufferMapped( const BufferDescriptor* descriptor) { BufferBase* buffer = nullptr; uint8_t* data = nullptr; @@ -405,8 +405,8 @@ namespace dawn_native { memset(data, 0, size); } - DawnCreateBufferMappedResult result = {}; - result.buffer = reinterpret_cast(buffer); + WGPUCreateBufferMappedResult result = {}; + result.buffer = reinterpret_cast(buffer); result.data = data; result.dataLength = size; @@ -415,11 +415,11 @@ namespace dawn_native { 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 e828195fc5..af6ca98014 100644 --- a/src/dawn_native/Device.h +++ b/src/dawn_native/Device.h @@ -141,7 +141,7 @@ namespace dawn_native { 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 @@ namespace dawn_native { 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 c0195c4bed..2c506a1cd0 100644 --- a/src/dawn_native/Fence.cpp +++ b/src/dawn_native/Fence.cpp @@ -46,7 +46,7 @@ namespace dawn_native { 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 @@ namespace dawn_native { 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 @@ namespace dawn_native { 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 bb9eb63c4b..e9907b9d40 100644 --- a/src/dawn_native/SwapChain.cpp +++ b/src/dawn_native/SwapChain.cpp @@ -95,8 +95,8 @@ namespace dawn_native { mAllowedUsage = allowedUsage; mWidth = width; mHeight = height; - mImplementation.Configure(mImplementation.userData, static_cast(format), - static_cast(allowedUsage), width, height); + mImplementation.Configure(mImplementation.userData, static_cast(format), + static_cast(allowedUsage), width, height); } TextureBase* SwapChainBase::GetNextTexture() { diff --git a/src/dawn_native/d3d12/BufferD3D12.cpp b/src/dawn_native/d3d12/BufferD3D12.cpp index 3c4feefab4..b875403bf9 100644 --- a/src/dawn_native/d3d12/BufferD3D12.cpp +++ b/src/dawn_native/d3d12/BufferD3D12.cpp @@ -218,9 +218,9 @@ namespace dawn_native { namespace d3d12 { 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 f7a4952c07..2db62da461 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 GetD3D12Device(DawnDevice device) { + ComPtr GetD3D12Device(WGPUDevice device) { Device* backendDevice = reinterpret_cast(device); return backendDevice->GetD3D12Device(); } - DawnSwapChainImplementation CreateNativeSwapChainImpl(DawnDevice device, HWND window) { + DawnSwapChainImplementation CreateNativeSwapChainImpl(WGPUDevice device, HWND window) { Device* backendDevice = reinterpret_cast(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(swapChain->userData); - return static_cast(impl->GetPreferredFormat()); + return static_cast(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); @@ -55,6 +55,6 @@ namespace dawn_native { namespace d3d12 { reinterpret_cast(descriptor); TextureBase* texture = backendDevice->WrapSharedHandle(backendDescriptor, sharedHandle, acquireMutexKey); - return reinterpret_cast(texture); + return reinterpret_cast(texture); } }} // namespace dawn_native::d3d12 diff --git a/src/dawn_native/d3d12/NativeSwapChainImplD3D12.cpp b/src/dawn_native/d3d12/NativeSwapChainImplD3D12.cpp index 9b404977d6..9170e8ed86 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 @@ namespace dawn_native { namespace d3d12 { 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(GetPreferredFormat())); + ASSERT(format == static_cast(GetPreferredFormat())); ComPtr factory = mDevice->GetFactory(); ComPtr queue = mDevice->GetCommandQueue(); diff --git a/src/dawn_native/d3d12/NativeSwapChainImplD3D12.h b/src/dawn_native/d3d12/NativeSwapChainImplD3D12.h index fa8e4fab4b..aaa8d85ee5 100644 --- a/src/dawn_native/d3d12/NativeSwapChainImplD3D12.h +++ b/src/dawn_native/d3d12/NativeSwapChainImplD3D12.h @@ -34,8 +34,8 @@ namespace dawn_native { namespace d3d12 { ~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 29acf57a56..aec8a61c28 100644 --- a/src/dawn_native/d3d12/SwapChainD3D12.cpp +++ b/src/dawn_native/d3d12/SwapChainD3D12.cpp @@ -25,10 +25,10 @@ namespace dawn_native { namespace d3d12 { : SwapChainBase(device, descriptor) { const auto& im = GetImplementation(); DawnWSIContextD3D12 wsiContext = {}; - wsiContext.device = reinterpret_cast(GetDevice()); + wsiContext.device = reinterpret_cast(GetDevice()); im.Init(im.userData, &wsiContext); - ASSERT(im.textureUsage != DAWN_TEXTURE_USAGE_NONE); + ASSERT(im.textureUsage != WGPUTextureUsage_None); mTextureUsage = static_cast(im.textureUsage); } diff --git a/src/dawn_native/metal/BufferMTL.mm b/src/dawn_native/metal/BufferMTL.mm index a3c2f4cc5b..c61b029cdb 100644 --- a/src/dawn_native/metal/BufferMTL.mm +++ b/src/dawn_native/metal/BufferMTL.mm @@ -53,9 +53,9 @@ namespace dawn_native { namespace metal { void Buffer::OnMapCommandSerialFinished(uint32_t mapSerial, bool isWrite) { char* data = reinterpret_cast([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 e5c88673ff..22b583af18 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 GetMetalDevice(DawnDevice cDevice) { + id GetMetalDevice(WGPUDevice cDevice) { Device* device = reinterpret_cast(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(cDevice); const TextureDescriptor* descriptor = reinterpret_cast(cDescriptor); TextureBase* texture = device->CreateTextureWrappingIOSurface(descriptor, ioSurface, plane); - return reinterpret_cast(texture); + return reinterpret_cast(texture); } - void WaitForCommandsToBeScheduled(DawnDevice cDevice) { + void WaitForCommandsToBeScheduled(WGPUDevice cDevice) { Device* device = reinterpret_cast(cDevice); device->WaitForCommandsToBeScheduled(); } diff --git a/src/dawn_native/null/DeviceNull.cpp b/src/dawn_native/null/DeviceNull.cpp index 35a2cfd65c..207efc3d5e 100644 --- a/src/dawn_native/null/DeviceNull.cpp +++ b/src/dawn_native/null/DeviceNull.cpp @@ -251,9 +251,9 @@ namespace dawn_native { namespace null { 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 @@ namespace dawn_native { namespace null { 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 9a8794251d..0ca300c94f 100644 --- a/src/dawn_native/null/DeviceNull.h +++ b/src/dawn_native/null/DeviceNull.h @@ -208,8 +208,8 @@ namespace dawn_native { namespace null { 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 14fff85850..a48dcdccc4 100644 --- a/src/dawn_native/null/NullBackend.cpp +++ b/src/dawn_native/null/NullBackend.cpp @@ -25,7 +25,7 @@ namespace dawn_native { namespace null { 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 3f54691469..80311af20c 100644 --- a/src/dawn_native/opengl/BufferGL.cpp +++ b/src/dawn_native/opengl/BufferGL.cpp @@ -65,7 +65,7 @@ namespace dawn_native { namespace opengl { // 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 @@ namespace dawn_native { namespace opengl { // 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 0b5f2940d9..3cfdad4f36 100644 --- a/src/dawn_native/opengl/NativeSwapChainImplGL.cpp +++ b/src/dawn_native/opengl/NativeSwapChainImplGL.cpp @@ -42,11 +42,11 @@ namespace dawn_native { namespace opengl { 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 2729e4cdde..acda00576f 100644 --- a/src/dawn_native/opengl/NativeSwapChainImplGL.h +++ b/src/dawn_native/opengl/NativeSwapChainImplGL.h @@ -32,8 +32,8 @@ namespace dawn_native { namespace opengl { ~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 91b019f213..fbab415254 100644 --- a/src/dawn_native/opengl/OpenGLBackend.cpp +++ b/src/dawn_native/opengl/OpenGLBackend.cpp @@ -27,7 +27,7 @@ namespace dawn_native { namespace opengl { : AdapterDiscoveryOptionsBase(BackendType::OpenGL) { } - DawnSwapChainImplementation CreateNativeSwapChainImpl(DawnDevice device, + DawnSwapChainImplementation CreateNativeSwapChainImpl(WGPUDevice device, PresentCallback present, void* presentUserdata) { Device* backendDevice = reinterpret_cast(device); @@ -35,15 +35,15 @@ namespace dawn_native { namespace opengl { 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(swapChain->userData); - return static_cast(impl->GetPreferredFormat()); + return static_cast(impl->GetPreferredFormat()); } }} // namespace dawn_native::opengl diff --git a/src/dawn_native/vulkan/BufferVk.cpp b/src/dawn_native/vulkan/BufferVk.cpp index dbbe44e45d..baa71028c2 100644 --- a/src/dawn_native/vulkan/BufferVk.cpp +++ b/src/dawn_native/vulkan/BufferVk.cpp @@ -160,11 +160,11 @@ namespace dawn_native { namespace vulkan { } 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 76b66ca954..e359d7033f 100644 --- a/src/dawn_native/vulkan/NativeSwapChainImplVk.cpp +++ b/src/dawn_native/vulkan/NativeSwapChainImplVk.cpp @@ -94,8 +94,8 @@ namespace dawn_native { namespace vulkan { 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 @@ namespace dawn_native { namespace vulkan { ASSERT(mInfo.capabilities.minImageExtent.height <= height); ASSERT(mInfo.capabilities.maxImageExtent.height >= height); - ASSERT(format == static_cast(GetPreferredFormat())); + ASSERT(format == static_cast(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 e4e2658b85..fe7a1820f5 100644 --- a/src/dawn_native/vulkan/NativeSwapChainImplVk.h +++ b/src/dawn_native/vulkan/NativeSwapChainImplVk.h @@ -32,8 +32,8 @@ namespace dawn_native { namespace vulkan { ~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 eb36627432..52a1f728f0 100644 --- a/src/dawn_native/vulkan/SwapChainVk.cpp +++ b/src/dawn_native/vulkan/SwapChainVk.cpp @@ -30,7 +30,7 @@ namespace dawn_native { namespace vulkan { DawnWSIContextVulkan wsiContext = {}; im.Init(im.userData, &wsiContext); - ASSERT(im.textureUsage != DAWN_TEXTURE_USAGE_NONE); + ASSERT(im.textureUsage != WGPUTextureUsage_None); mTextureUsage = static_cast(im.textureUsage); } diff --git a/src/dawn_native/vulkan/VulkanBackend.cpp b/src/dawn_native/vulkan/VulkanBackend.cpp index 60eda44932..b0060edfe3 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); return backendDevice->GetVkInstance(); } @@ -36,35 +36,35 @@ namespace dawn_native { namespace vulkan { // 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); 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(swapChain->userData); - return static_cast(impl->GetPreferredFormat()); + return static_cast(impl->GetPreferredFormat()); } #ifdef DAWN_PLATFORM_LINUX - DawnTexture WrapVulkanImageOpaqueFD(DawnDevice cDevice, + WGPUTexture WrapVulkanImageOpaqueFD(WGPUDevice cDevice, const ExternalImageDescriptorOpaqueFD* descriptor) { Device* device = reinterpret_cast(cDevice); TextureBase* texture = device->CreateTextureWrappingVulkanImage( descriptor, descriptor->memoryFD, descriptor->waitFDs); - return reinterpret_cast(texture); + return reinterpret_cast(texture); } - int ExportSignalSemaphoreOpaqueFD(DawnDevice cDevice, DawnTexture cTexture) { + int ExportSignalSemaphoreOpaqueFD(WGPUDevice cDevice, WGPUTexture cTexture) { Device* device = reinterpret_cast(cDevice); Texture* texture = reinterpret_cast(cTexture); diff --git a/src/include/dawn/dawn_wsi.h b/src/include/dawn/dawn_wsi.h index ff83f722bf..e07e74185c 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 +#include // 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 diff --git a/src/include/dawn_native/D3D12Backend.h b/src/include/dawn_native/D3D12Backend.h index 14c0ffee75..de12d640fc 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 GetD3D12Device(DawnDevice device); - DAWN_NATIVE_EXPORT DawnSwapChainImplementation CreateNativeSwapChainImpl(DawnDevice device, + DAWN_NATIVE_EXPORT Microsoft::WRL::ComPtr 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 b3125ed8f4..6e1bd63a62 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 #include +#include #include #include @@ -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 GetTogglesUsed(DawnDevice device); + DAWN_NATIVE_EXPORT std::vector 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 GetProcMapNamesForTesting(); diff --git a/src/include/dawn_native/MetalBackend.h b/src/include/dawn_native/MetalBackend.h index 7588b97896..6e07c05824 100644 --- a/src/include/dawn_native/MetalBackend.h +++ b/src/include/dawn_native/MetalBackend.h @@ -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 GetMetalDevice(DawnDevice device); + DAWN_NATIVE_EXPORT id 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 0ebbbc7a20..05896716a3 100644 --- a/src/include/dawn_native/OpenGLBackend.h +++ b/src/include/dawn_native/OpenGLBackend.h @@ -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 diff --git a/src/include/dawn_native/VulkanBackend.h b/src/include/dawn_native/VulkanBackend.h index f8742591af..fc81a58fc1 100644 --- a/src/include/dawn_native/VulkanBackend.h +++ b/src/include/dawn_native/VulkanBackend.h @@ -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 diff --git a/src/tests/unittests/ExtensionTests.cpp b/src/tests/unittests/ExtensionTests.cpp index cef27527f2..4e2a81c778 100644 --- a/src/tests/unittests/ExtensionTests.cpp +++ b/src/tests/unittests/ExtensionTests.cpp @@ -55,7 +55,7 @@ TEST_F(ExtensionTests, AdapterWithRequiredExtensionDisabled) { dawn_native::DeviceDescriptor deviceDescriptor; const char* extensionName = ExtensionEnumToName(notSupportedExtension); deviceDescriptor.requiredExtensions = std::vector(1, extensionName); - DawnDevice deviceWithExtension = adapterWithoutExtension.CreateDevice(&deviceDescriptor); + WGPUDevice deviceWithExtension = adapterWithoutExtension.CreateDevice(&deviceDescriptor); ASSERT_EQ(nullptr, deviceWithExtension); } }