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

@ -73,18 +73,18 @@ namespace dawn_native {
{% endfor %} {% endfor %}
struct ProcEntry { struct ProcEntry {
DawnProc proc; WGPUProc proc;
const char* name; const char* name;
}; };
static const ProcEntry sProcMap[] = { static const ProcEntry sProcMap[] = {
{% for (type, method) in methods_sorted_by_name %} {% 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 %} {% endfor %}
}; };
static constexpr size_t sProcMapSize = sizeof(sProcMap) / sizeof(sProcMap[0]); 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) { if (procName == nullptr) {
return nullptr; return nullptr;
} }
@ -100,7 +100,7 @@ namespace dawn_native {
} }
if (strcmp(procName, "wgpuGetProcAddress") == 0) { if (strcmp(procName, "wgpuGetProcAddress") == 0) {
return reinterpret_cast<DawnProc>(NativeGetProcAddress); return reinterpret_cast<WGPUProc>(NativeGetProcAddress);
} }
return nullptr; return nullptr;

View File

@ -26,7 +26,7 @@ DawnSwapChainImplementation CreateSwapChainImplementation(T* swapChain) {
reinterpret_cast<T*>(userData)->Init(ctx); reinterpret_cast<T*>(userData)->Init(ctx);
}; };
impl.Destroy = [](void* userData) { delete reinterpret_cast<T*>(userData); }; 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) { uint32_t width, uint32_t height) {
return static_cast<T*>(userData)->Configure(format, allowedUsage, width, height); return static_cast<T*>(userData)->Configure(format, allowedUsage, width, height);
}; };

View File

@ -124,8 +124,8 @@ namespace dawn_native {
BufferBase::~BufferBase() { BufferBase::~BufferBase() {
if (mState == BufferState::Mapped) { if (mState == BufferState::Mapped) {
ASSERT(!IsError()); ASSERT(!IsError());
CallMapReadCallback(mMapSerial, DAWN_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, 0u); CallMapReadCallback(mMapSerial, WGPUBufferMapAsyncStatus_Unknown, nullptr, 0u);
CallMapWriteCallback(mMapSerial, DAWN_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, 0u); CallMapWriteCallback(mMapSerial, WGPUBufferMapAsyncStatus_Unknown, nullptr, 0u);
} }
} }
@ -231,7 +231,7 @@ namespace dawn_native {
void BufferBase::MapReadAsync(WGPUBufferMapReadCallback callback, void* userdata) { void BufferBase::MapReadAsync(WGPUBufferMapReadCallback callback, void* userdata) {
if (GetDevice()->ConsumedError(ValidateMap(wgpu::BufferUsage::MapRead))) { if (GetDevice()->ConsumedError(ValidateMap(wgpu::BufferUsage::MapRead))) {
callback(DAWN_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, 0, userdata); callback(WGPUBufferMapAsyncStatus_Error, nullptr, 0, userdata);
return; return;
} }
ASSERT(!IsError()); ASSERT(!IsError());
@ -267,7 +267,7 @@ namespace dawn_native {
void BufferBase::MapWriteAsync(WGPUBufferMapWriteCallback callback, void* userdata) { void BufferBase::MapWriteAsync(WGPUBufferMapWriteCallback callback, void* userdata) {
if (GetDevice()->ConsumedError(ValidateMap(wgpu::BufferUsage::MapWrite))) { if (GetDevice()->ConsumedError(ValidateMap(wgpu::BufferUsage::MapWrite))) {
callback(DAWN_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, 0, userdata); callback(WGPUBufferMapAsyncStatus_Error, nullptr, 0, userdata);
return; return;
} }
ASSERT(!IsError()); ASSERT(!IsError());
@ -333,8 +333,8 @@ namespace dawn_native {
// completed before the Unmap. // completed before the Unmap.
// Callbacks are not fired if there is no callback registered, so this is correct for // Callbacks are not fired if there is no callback registered, so this is correct for
// CreateBufferMapped. // CreateBufferMapped.
CallMapReadCallback(mMapSerial, DAWN_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, 0u); CallMapReadCallback(mMapSerial, WGPUBufferMapAsyncStatus_Unknown, nullptr, 0u);
CallMapWriteCallback(mMapSerial, DAWN_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, 0u); CallMapWriteCallback(mMapSerial, WGPUBufferMapAsyncStatus_Unknown, nullptr, 0u);
UnmapImpl(); UnmapImpl();
} }
mState = BufferState::Unmapped; mState = BufferState::Unmapped;

View File

@ -27,7 +27,7 @@ namespace dawn_native {
return GetProcsAutogen(); return GetProcsAutogen();
} }
std::vector<const char*> GetTogglesUsed(DawnDevice device) { std::vector<const char*> GetTogglesUsed(WGPUDevice device) {
const dawn_native::DeviceBase* deviceBase = const dawn_native::DeviceBase* deviceBase =
reinterpret_cast<const dawn_native::DeviceBase*>(device); reinterpret_cast<const dawn_native::DeviceBase*>(device);
return deviceBase->GetTogglesUsed(); return deviceBase->GetTogglesUsed();
@ -65,8 +65,8 @@ namespace dawn_native {
return mImpl != nullptr; return mImpl != nullptr;
} }
DawnDevice Adapter::CreateDevice(const DeviceDescriptor* deviceDescriptor) { WGPUDevice Adapter::CreateDevice(const DeviceDescriptor* deviceDescriptor) {
return reinterpret_cast<DawnDevice>(mImpl->CreateDevice(deviceDescriptor)); return reinterpret_cast<WGPUDevice>(mImpl->CreateDevice(deviceDescriptor));
} }
// AdapterDiscoverOptionsBase // AdapterDiscoverOptionsBase
@ -129,7 +129,7 @@ namespace dawn_native {
return mImpl->GetPlatform(); return mImpl->GetPlatform();
} }
size_t GetLazyClearCountForTesting(DawnDevice device) { size_t GetLazyClearCountForTesting(WGPUDevice device) {
dawn_native::DeviceBase* deviceBase = reinterpret_cast<dawn_native::DeviceBase*>(device); dawn_native::DeviceBase* deviceBase = reinterpret_cast<dawn_native::DeviceBase*>(device);
return deviceBase->GetLazyClearCountForTesting(); return deviceBase->GetLazyClearCountForTesting();
} }

View File

@ -380,7 +380,7 @@ namespace dawn_native {
return result; return result;
} }
DawnCreateBufferMappedResult DeviceBase::CreateBufferMapped( WGPUCreateBufferMappedResult DeviceBase::CreateBufferMapped(
const BufferDescriptor* descriptor) { const BufferDescriptor* descriptor) {
BufferBase* buffer = nullptr; BufferBase* buffer = nullptr;
uint8_t* data = nullptr; uint8_t* data = nullptr;
@ -405,8 +405,8 @@ namespace dawn_native {
memset(data, 0, size); memset(data, 0, size);
} }
DawnCreateBufferMappedResult result = {}; WGPUCreateBufferMappedResult result = {};
result.buffer = reinterpret_cast<DawnBuffer>(buffer); result.buffer = reinterpret_cast<WGPUBuffer>(buffer);
result.data = data; result.data = data;
result.dataLength = size; result.dataLength = size;
@ -415,11 +415,11 @@ namespace dawn_native {
void DeviceBase::CreateBufferMappedAsync(const BufferDescriptor* descriptor, void DeviceBase::CreateBufferMappedAsync(const BufferDescriptor* descriptor,
wgpu::BufferCreateMappedCallback callback, wgpu::BufferCreateMappedCallback callback,
void* userdata) { 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) { if (result.data == nullptr || result.dataLength != descriptor->size) {
status = DAWN_BUFFER_MAP_ASYNC_STATUS_ERROR; status = WGPUBufferMapAsyncStatus_Error;
} }
DeferredCreateBufferMappedAsync deferred_info; DeferredCreateBufferMappedAsync deferred_info;

View File

@ -141,7 +141,7 @@ namespace dawn_native {
BindGroupBase* CreateBindGroup(const BindGroupDescriptor* descriptor); BindGroupBase* CreateBindGroup(const BindGroupDescriptor* descriptor);
BindGroupLayoutBase* CreateBindGroupLayout(const BindGroupLayoutDescriptor* descriptor); BindGroupLayoutBase* CreateBindGroupLayout(const BindGroupLayoutDescriptor* descriptor);
BufferBase* CreateBuffer(const BufferDescriptor* descriptor); BufferBase* CreateBuffer(const BufferDescriptor* descriptor);
DawnCreateBufferMappedResult CreateBufferMapped(const BufferDescriptor* descriptor); WGPUCreateBufferMappedResult CreateBufferMapped(const BufferDescriptor* descriptor);
void CreateBufferMappedAsync(const BufferDescriptor* descriptor, void CreateBufferMappedAsync(const BufferDescriptor* descriptor,
wgpu::BufferCreateMappedCallback callback, wgpu::BufferCreateMappedCallback callback,
void* userdata); void* userdata);
@ -262,8 +262,8 @@ namespace dawn_native {
struct DeferredCreateBufferMappedAsync { struct DeferredCreateBufferMappedAsync {
wgpu::BufferCreateMappedCallback callback; wgpu::BufferCreateMappedCallback callback;
DawnBufferMapAsyncStatus status; WGPUBufferMapAsyncStatus status;
DawnCreateBufferMappedResult result; WGPUCreateBufferMappedResult result;
void* userdata; void* userdata;
}; };

View File

@ -46,7 +46,7 @@ namespace dawn_native {
FenceBase::~FenceBase() { FenceBase::~FenceBase() {
for (auto& request : mRequests.IterateAll()) { for (auto& request : mRequests.IterateAll()) {
ASSERT(!IsError()); ASSERT(!IsError());
request.completionCallback(DAWN_FENCE_COMPLETION_STATUS_UNKNOWN, request.userdata); request.completionCallback(WGPUFenceCompletionStatus_Unknown, request.userdata);
} }
mRequests.Clear(); mRequests.Clear();
} }
@ -67,13 +67,13 @@ namespace dawn_native {
wgpu::FenceOnCompletionCallback callback, wgpu::FenceOnCompletionCallback callback,
void* userdata) { void* userdata) {
if (GetDevice()->ConsumedError(ValidateOnCompletion(value))) { if (GetDevice()->ConsumedError(ValidateOnCompletion(value))) {
callback(DAWN_FENCE_COMPLETION_STATUS_ERROR, userdata); callback(WGPUFenceCompletionStatus_Error, userdata);
return; return;
} }
ASSERT(!IsError()); ASSERT(!IsError());
if (value <= mCompletedValue) { if (value <= mCompletedValue) {
callback(DAWN_FENCE_COMPLETION_STATUS_SUCCESS, userdata); callback(WGPUFenceCompletionStatus_Success, userdata);
return; return;
} }
@ -106,7 +106,7 @@ namespace dawn_native {
mCompletedValue = completedValue; mCompletedValue = completedValue;
for (auto& request : mRequests.IterateUpTo(mCompletedValue)) { for (auto& request : mRequests.IterateUpTo(mCompletedValue)) {
request.completionCallback(DAWN_FENCE_COMPLETION_STATUS_SUCCESS, request.userdata); request.completionCallback(WGPUFenceCompletionStatus_Success, request.userdata);
} }
mRequests.ClearUpTo(mCompletedValue); mRequests.ClearUpTo(mCompletedValue);
} }

View File

@ -95,8 +95,8 @@ namespace dawn_native {
mAllowedUsage = allowedUsage; mAllowedUsage = allowedUsage;
mWidth = width; mWidth = width;
mHeight = height; mHeight = height;
mImplementation.Configure(mImplementation.userData, static_cast<DawnTextureFormat>(format), mImplementation.Configure(mImplementation.userData, static_cast<WGPUTextureFormat>(format),
static_cast<DawnTextureUsage>(allowedUsage), width, height); static_cast<WGPUTextureUsage>(allowedUsage), width, height);
} }
TextureBase* SwapChainBase::GetNextTexture() { TextureBase* SwapChainBase::GetNextTexture() {

View File

@ -218,9 +218,9 @@ namespace dawn_native { namespace d3d12 {
void Buffer::OnMapCommandSerialFinished(uint32_t mapSerial, void* data, bool isWrite) { void Buffer::OnMapCommandSerialFinished(uint32_t mapSerial, void* data, bool isWrite) {
if (isWrite) { if (isWrite) {
CallMapWriteCallback(mapSerial, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, data, GetSize()); CallMapWriteCallback(mapSerial, WGPUBufferMapAsyncStatus_Success, data, GetSize());
} else { } else {
CallMapReadCallback(mapSerial, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, data, GetSize()); CallMapReadCallback(mapSerial, WGPUBufferMapAsyncStatus_Success, data, GetSize());
} }
} }

View File

@ -24,30 +24,30 @@
namespace dawn_native { namespace d3d12 { namespace dawn_native { namespace d3d12 {
ComPtr<ID3D12Device> GetD3D12Device(DawnDevice device) { ComPtr<ID3D12Device> GetD3D12Device(WGPUDevice device) {
Device* backendDevice = reinterpret_cast<Device*>(device); Device* backendDevice = reinterpret_cast<Device*>(device);
return backendDevice->GetD3D12Device(); return backendDevice->GetD3D12Device();
} }
DawnSwapChainImplementation CreateNativeSwapChainImpl(DawnDevice device, HWND window) { DawnSwapChainImplementation CreateNativeSwapChainImpl(WGPUDevice device, HWND window) {
Device* backendDevice = reinterpret_cast<Device*>(device); Device* backendDevice = reinterpret_cast<Device*>(device);
DawnSwapChainImplementation impl; DawnSwapChainImplementation impl;
impl = CreateSwapChainImplementation(new NativeSwapChainImpl(backendDevice, window)); impl = CreateSwapChainImplementation(new NativeSwapChainImpl(backendDevice, window));
impl.textureUsage = DAWN_TEXTURE_USAGE_PRESENT; impl.textureUsage = WGPUTextureUsage_Present;
return impl; return impl;
} }
DawnTextureFormat GetNativeSwapChainPreferredFormat( WGPUTextureFormat GetNativeSwapChainPreferredFormat(
const DawnSwapChainImplementation* swapChain) { const DawnSwapChainImplementation* swapChain) {
NativeSwapChainImpl* impl = reinterpret_cast<NativeSwapChainImpl*>(swapChain->userData); NativeSwapChainImpl* impl = reinterpret_cast<NativeSwapChainImpl*>(swapChain->userData);
return static_cast<DawnTextureFormat>(impl->GetPreferredFormat()); return static_cast<WGPUTextureFormat>(impl->GetPreferredFormat());
} }
DawnTexture WrapSharedHandle(DawnDevice device, WGPUTexture WrapSharedHandle(WGPUDevice device,
const DawnTextureDescriptor* descriptor, const WGPUTextureDescriptor* descriptor,
HANDLE sharedHandle, HANDLE sharedHandle,
uint64_t acquireMutexKey) { uint64_t acquireMutexKey) {
Device* backendDevice = reinterpret_cast<Device*>(device); Device* backendDevice = reinterpret_cast<Device*>(device);
@ -55,6 +55,6 @@ namespace dawn_native { namespace d3d12 {
reinterpret_cast<const TextureDescriptor*>(descriptor); reinterpret_cast<const TextureDescriptor*>(descriptor);
TextureBase* texture = TextureBase* texture =
backendDevice->WrapSharedHandle(backendDescriptor, sharedHandle, acquireMutexKey); backendDevice->WrapSharedHandle(backendDescriptor, sharedHandle, acquireMutexKey);
return reinterpret_cast<DawnTexture>(texture); return reinterpret_cast<WGPUTexture>(texture);
} }
}} // namespace dawn_native::d3d12 }} // namespace dawn_native::d3d12

View File

@ -21,15 +21,15 @@
namespace dawn_native { namespace d3d12 { namespace dawn_native { namespace d3d12 {
namespace { namespace {
DXGI_USAGE D3D12SwapChainBufferUsage(DawnTextureUsage allowedUsages) { DXGI_USAGE D3D12SwapChainBufferUsage(WGPUTextureUsage allowedUsages) {
DXGI_USAGE usage = DXGI_CPU_ACCESS_NONE; DXGI_USAGE usage = DXGI_CPU_ACCESS_NONE;
if (allowedUsages & DAWN_TEXTURE_USAGE_SAMPLED) { if (allowedUsages & WGPUTextureUsage_Sampled) {
usage |= DXGI_USAGE_SHADER_INPUT; usage |= DXGI_USAGE_SHADER_INPUT;
} }
if (allowedUsages & DAWN_TEXTURE_USAGE_STORAGE) { if (allowedUsages & WGPUTextureUsage_Storage) {
usage |= DXGI_USAGE_UNORDERED_ACCESS; usage |= DXGI_USAGE_UNORDERED_ACCESS;
} }
if (allowedUsages & DAWN_TEXTURE_USAGE_OUTPUT_ATTACHMENT) { if (allowedUsages & WGPUTextureUsage_OutputAttachment) {
usage |= DXGI_USAGE_RENDER_TARGET_OUTPUT; usage |= DXGI_USAGE_RENDER_TARGET_OUTPUT;
} }
return usage; return usage;
@ -48,13 +48,13 @@ namespace dawn_native { namespace d3d12 {
void NativeSwapChainImpl::Init(DawnWSIContextD3D12* /*context*/) { void NativeSwapChainImpl::Init(DawnWSIContextD3D12* /*context*/) {
} }
DawnSwapChainError NativeSwapChainImpl::Configure(DawnTextureFormat format, DawnSwapChainError NativeSwapChainImpl::Configure(WGPUTextureFormat format,
DawnTextureUsage usage, WGPUTextureUsage usage,
uint32_t width, uint32_t width,
uint32_t height) { uint32_t height) {
ASSERT(width > 0); ASSERT(width > 0);
ASSERT(height > 0); ASSERT(height > 0);
ASSERT(format == static_cast<DawnTextureFormat>(GetPreferredFormat())); ASSERT(format == static_cast<WGPUTextureFormat>(GetPreferredFormat()));
ComPtr<IDXGIFactory4> factory = mDevice->GetFactory(); ComPtr<IDXGIFactory4> factory = mDevice->GetFactory();
ComPtr<ID3D12CommandQueue> queue = mDevice->GetCommandQueue(); ComPtr<ID3D12CommandQueue> queue = mDevice->GetCommandQueue();

View File

@ -34,8 +34,8 @@ namespace dawn_native { namespace d3d12 {
~NativeSwapChainImpl(); ~NativeSwapChainImpl();
void Init(DawnWSIContextD3D12* context); void Init(DawnWSIContextD3D12* context);
DawnSwapChainError Configure(DawnTextureFormat format, DawnSwapChainError Configure(WGPUTextureFormat format,
DawnTextureUsage, WGPUTextureUsage,
uint32_t width, uint32_t width,
uint32_t height); uint32_t height);
DawnSwapChainError GetNextTexture(DawnSwapChainNextTexture* nextTexture); DawnSwapChainError GetNextTexture(DawnSwapChainNextTexture* nextTexture);

View File

@ -25,10 +25,10 @@ namespace dawn_native { namespace d3d12 {
: SwapChainBase(device, descriptor) { : SwapChainBase(device, descriptor) {
const auto& im = GetImplementation(); const auto& im = GetImplementation();
DawnWSIContextD3D12 wsiContext = {}; DawnWSIContextD3D12 wsiContext = {};
wsiContext.device = reinterpret_cast<DawnDevice>(GetDevice()); wsiContext.device = reinterpret_cast<WGPUDevice>(GetDevice());
im.Init(im.userData, &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); mTextureUsage = static_cast<wgpu::TextureUsage>(im.textureUsage);
} }

View File

@ -53,9 +53,9 @@ namespace dawn_native { namespace metal {
void Buffer::OnMapCommandSerialFinished(uint32_t mapSerial, bool isWrite) { void Buffer::OnMapCommandSerialFinished(uint32_t mapSerial, bool isWrite) {
char* data = reinterpret_cast<char*>([mMtlBuffer contents]); char* data = reinterpret_cast<char*>([mMtlBuffer contents]);
if (isWrite) { if (isWrite) {
CallMapWriteCallback(mapSerial, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, data, GetSize()); CallMapWriteCallback(mapSerial, WGPUBufferMapAsyncStatus_Success, data, GetSize());
} else { } else {
CallMapReadCallback(mapSerial, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, data, GetSize()); CallMapReadCallback(mapSerial, WGPUBufferMapAsyncStatus_Success, data, GetSize());
} }
} }

View File

@ -22,23 +22,23 @@
namespace dawn_native { namespace metal { namespace dawn_native { namespace metal {
id<MTLDevice> GetMetalDevice(DawnDevice cDevice) { id<MTLDevice> GetMetalDevice(WGPUDevice cDevice) {
Device* device = reinterpret_cast<Device*>(cDevice); Device* device = reinterpret_cast<Device*>(cDevice);
return device->GetMTLDevice(); return device->GetMTLDevice();
} }
DawnTexture WrapIOSurface(DawnDevice cDevice, WGPUTexture WrapIOSurface(WGPUDevice cDevice,
const DawnTextureDescriptor* cDescriptor, const WGPUTextureDescriptor* cDescriptor,
IOSurfaceRef ioSurface, IOSurfaceRef ioSurface,
uint32_t plane) { uint32_t plane) {
Device* device = reinterpret_cast<Device*>(cDevice); Device* device = reinterpret_cast<Device*>(cDevice);
const TextureDescriptor* descriptor = const TextureDescriptor* descriptor =
reinterpret_cast<const TextureDescriptor*>(cDescriptor); reinterpret_cast<const TextureDescriptor*>(cDescriptor);
TextureBase* texture = device->CreateTextureWrappingIOSurface(descriptor, ioSurface, plane); 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* device = reinterpret_cast<Device*>(cDevice);
device->WaitForCommandsToBeScheduled(); device->WaitForCommandsToBeScheduled();
} }

View File

@ -251,9 +251,9 @@ namespace dawn_native { namespace null {
void Buffer::MapOperationCompleted(uint32_t serial, void* ptr, bool isWrite) { void Buffer::MapOperationCompleted(uint32_t serial, void* ptr, bool isWrite) {
if (isWrite) { if (isWrite) {
CallMapWriteCallback(serial, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, ptr, GetSize()); CallMapWriteCallback(serial, WGPUBufferMapAsyncStatus_Success, ptr, GetSize());
} else { } 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) { void NativeSwapChainImpl::Init(WSIContext* context) {
} }
DawnSwapChainError NativeSwapChainImpl::Configure(DawnTextureFormat format, DawnSwapChainError NativeSwapChainImpl::Configure(WGPUTextureFormat format,
DawnTextureUsage, WGPUTextureUsage,
uint32_t width, uint32_t width,
uint32_t height) { uint32_t height) {
return DAWN_SWAP_CHAIN_NO_ERROR; return DAWN_SWAP_CHAIN_NO_ERROR;

View File

@ -208,8 +208,8 @@ namespace dawn_native { namespace null {
public: public:
using WSIContext = struct {}; using WSIContext = struct {};
void Init(WSIContext* context); void Init(WSIContext* context);
DawnSwapChainError Configure(DawnTextureFormat format, DawnSwapChainError Configure(WGPUTextureFormat format,
DawnTextureUsage, WGPUTextureUsage,
uint32_t width, uint32_t width,
uint32_t height); uint32_t height);
DawnSwapChainError GetNextTexture(DawnSwapChainNextTexture* nextTexture); DawnSwapChainError GetNextTexture(DawnSwapChainNextTexture* nextTexture);

View File

@ -25,7 +25,7 @@ namespace dawn_native { namespace null {
DawnSwapChainImplementation CreateNativeSwapChainImpl() { DawnSwapChainImplementation CreateNativeSwapChainImpl() {
DawnSwapChainImplementation impl; DawnSwapChainImplementation impl;
impl = CreateSwapChainImplementation(new NativeSwapChainImpl()); impl = CreateSwapChainImplementation(new NativeSwapChainImpl());
impl.textureUsage = DAWN_TEXTURE_USAGE_PRESENT; impl.textureUsage = WGPUTextureUsage_Present;
return impl; return impl;
} }

View File

@ -65,7 +65,7 @@ namespace dawn_native { namespace opengl {
// version of OpenGL that would let us map the buffer unsynchronized. // version of OpenGL that would let us map the buffer unsynchronized.
gl.BindBuffer(GL_ARRAY_BUFFER, mBuffer); gl.BindBuffer(GL_ARRAY_BUFFER, mBuffer);
void* data = gl.MapBuffer(GL_ARRAY_BUFFER, GL_READ_ONLY); 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 {}; return {};
} }
@ -76,7 +76,7 @@ namespace dawn_native { namespace opengl {
// version of OpenGL that would let us map the buffer unsynchronized. // version of OpenGL that would let us map the buffer unsynchronized.
gl.BindBuffer(GL_ARRAY_BUFFER, mBuffer); gl.BindBuffer(GL_ARRAY_BUFFER, mBuffer);
void* data = gl.MapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY); 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 {}; return {};
} }

View File

@ -42,11 +42,11 @@ namespace dawn_native { namespace opengl {
mBackTexture, 0); mBackTexture, 0);
} }
DawnSwapChainError NativeSwapChainImpl::Configure(DawnTextureFormat format, DawnSwapChainError NativeSwapChainImpl::Configure(WGPUTextureFormat format,
DawnTextureUsage usage, WGPUTextureUsage usage,
uint32_t width, uint32_t width,
uint32_t height) { uint32_t height) {
if (format != DAWN_TEXTURE_FORMAT_RGBA8_UNORM) { if (format != WGPUTextureFormat_RGBA8Unorm) {
return "unsupported format"; return "unsupported format";
} }
ASSERT(width > 0); ASSERT(width > 0);

View File

@ -32,8 +32,8 @@ namespace dawn_native { namespace opengl {
~NativeSwapChainImpl(); ~NativeSwapChainImpl();
void Init(DawnWSIContextGL* context); void Init(DawnWSIContextGL* context);
DawnSwapChainError Configure(DawnTextureFormat format, DawnSwapChainError Configure(WGPUTextureFormat format,
DawnTextureUsage, WGPUTextureUsage,
uint32_t width, uint32_t width,
uint32_t height); uint32_t height);
DawnSwapChainError GetNextTexture(DawnSwapChainNextTexture* nextTexture); DawnSwapChainError GetNextTexture(DawnSwapChainNextTexture* nextTexture);

View File

@ -27,7 +27,7 @@ namespace dawn_native { namespace opengl {
: AdapterDiscoveryOptionsBase(BackendType::OpenGL) { : AdapterDiscoveryOptionsBase(BackendType::OpenGL) {
} }
DawnSwapChainImplementation CreateNativeSwapChainImpl(DawnDevice device, DawnSwapChainImplementation CreateNativeSwapChainImpl(WGPUDevice device,
PresentCallback present, PresentCallback present,
void* presentUserdata) { void* presentUserdata) {
Device* backendDevice = reinterpret_cast<Device*>(device); Device* backendDevice = reinterpret_cast<Device*>(device);
@ -35,15 +35,15 @@ namespace dawn_native { namespace opengl {
DawnSwapChainImplementation impl; DawnSwapChainImplementation impl;
impl = CreateSwapChainImplementation( impl = CreateSwapChainImplementation(
new NativeSwapChainImpl(backendDevice, present, presentUserdata)); new NativeSwapChainImpl(backendDevice, present, presentUserdata));
impl.textureUsage = DAWN_TEXTURE_USAGE_PRESENT; impl.textureUsage = WGPUTextureUsage_Present;
return impl; return impl;
} }
DawnTextureFormat GetNativeSwapChainPreferredFormat( WGPUTextureFormat GetNativeSwapChainPreferredFormat(
const DawnSwapChainImplementation* swapChain) { const DawnSwapChainImplementation* swapChain) {
NativeSwapChainImpl* impl = reinterpret_cast<NativeSwapChainImpl*>(swapChain->userData); NativeSwapChainImpl* impl = reinterpret_cast<NativeSwapChainImpl*>(swapChain->userData);
return static_cast<DawnTextureFormat>(impl->GetPreferredFormat()); return static_cast<WGPUTextureFormat>(impl->GetPreferredFormat());
} }
}} // namespace dawn_native::opengl }} // namespace dawn_native::opengl

View File

@ -160,11 +160,11 @@ namespace dawn_native { namespace vulkan {
} }
void Buffer::OnMapReadCommandSerialFinished(uint32_t mapSerial, const void* data) { 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) { 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 { VkBuffer Buffer::GetHandle() const {

View File

@ -94,8 +94,8 @@ namespace dawn_native { namespace vulkan {
UpdateSurfaceConfig(); UpdateSurfaceConfig();
} }
DawnSwapChainError NativeSwapChainImpl::Configure(DawnTextureFormat format, DawnSwapChainError NativeSwapChainImpl::Configure(WGPUTextureFormat format,
DawnTextureUsage usage, WGPUTextureUsage usage,
uint32_t width, uint32_t width,
uint32_t height) { uint32_t height) {
UpdateSurfaceConfig(); UpdateSurfaceConfig();
@ -105,7 +105,7 @@ namespace dawn_native { namespace vulkan {
ASSERT(mInfo.capabilities.minImageExtent.height <= height); ASSERT(mInfo.capabilities.minImageExtent.height <= height);
ASSERT(mInfo.capabilities.maxImageExtent.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 // TODO(cwallez@chromium.org): need to check usage works too
// Create the swapchain with the configuration we chose // Create the swapchain with the configuration we chose

View File

@ -32,8 +32,8 @@ namespace dawn_native { namespace vulkan {
~NativeSwapChainImpl(); ~NativeSwapChainImpl();
void Init(DawnWSIContextVulkan* context); void Init(DawnWSIContextVulkan* context);
DawnSwapChainError Configure(DawnTextureFormat format, DawnSwapChainError Configure(WGPUTextureFormat format,
DawnTextureUsage, WGPUTextureUsage,
uint32_t width, uint32_t width,
uint32_t height); uint32_t height);
DawnSwapChainError GetNextTexture(DawnSwapChainNextTexture* nextTexture); DawnSwapChainError GetNextTexture(DawnSwapChainNextTexture* nextTexture);

View File

@ -30,7 +30,7 @@ namespace dawn_native { namespace vulkan {
DawnWSIContextVulkan wsiContext = {}; DawnWSIContextVulkan wsiContext = {};
im.Init(im.userData, &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); mTextureUsage = static_cast<wgpu::TextureUsage>(im.textureUsage);
} }

View File

@ -28,7 +28,7 @@
namespace dawn_native { namespace vulkan { namespace dawn_native { namespace vulkan {
VkInstance GetInstance(DawnDevice device) { VkInstance GetInstance(WGPUDevice device) {
Device* backendDevice = reinterpret_cast<Device*>(device); Device* backendDevice = reinterpret_cast<Device*>(device);
return backendDevice->GetVkInstance(); 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 // Explicitly export this function because it uses the "native" type for surfaces while the
// header as seen in this file uses the wrapped type. // header as seen in this file uses the wrapped type.
DAWN_NATIVE_EXPORT DawnSwapChainImplementation DAWN_NATIVE_EXPORT DawnSwapChainImplementation
CreateNativeSwapChainImpl(DawnDevice device, VkSurfaceKHRNative surfaceNative) { CreateNativeSwapChainImpl(WGPUDevice device, VkSurfaceKHRNative surfaceNative) {
Device* backendDevice = reinterpret_cast<Device*>(device); Device* backendDevice = reinterpret_cast<Device*>(device);
VkSurfaceKHR surface = VkSurfaceKHR::CreateFromHandle(surfaceNative); VkSurfaceKHR surface = VkSurfaceKHR::CreateFromHandle(surfaceNative);
DawnSwapChainImplementation impl; DawnSwapChainImplementation impl;
impl = CreateSwapChainImplementation(new NativeSwapChainImpl(backendDevice, surface)); impl = CreateSwapChainImplementation(new NativeSwapChainImpl(backendDevice, surface));
impl.textureUsage = DAWN_TEXTURE_USAGE_PRESENT; impl.textureUsage = WGPUTextureUsage_Present;
return impl; return impl;
} }
DawnTextureFormat GetNativeSwapChainPreferredFormat( WGPUTextureFormat GetNativeSwapChainPreferredFormat(
const DawnSwapChainImplementation* swapChain) { const DawnSwapChainImplementation* swapChain) {
NativeSwapChainImpl* impl = reinterpret_cast<NativeSwapChainImpl*>(swapChain->userData); NativeSwapChainImpl* impl = reinterpret_cast<NativeSwapChainImpl*>(swapChain->userData);
return static_cast<DawnTextureFormat>(impl->GetPreferredFormat()); return static_cast<WGPUTextureFormat>(impl->GetPreferredFormat());
} }
#ifdef DAWN_PLATFORM_LINUX #ifdef DAWN_PLATFORM_LINUX
DawnTexture WrapVulkanImageOpaqueFD(DawnDevice cDevice, WGPUTexture WrapVulkanImageOpaqueFD(WGPUDevice cDevice,
const ExternalImageDescriptorOpaqueFD* descriptor) { const ExternalImageDescriptorOpaqueFD* descriptor) {
Device* device = reinterpret_cast<Device*>(cDevice); Device* device = reinterpret_cast<Device*>(cDevice);
TextureBase* texture = device->CreateTextureWrappingVulkanImage( TextureBase* texture = device->CreateTextureWrappingVulkanImage(
descriptor, descriptor->memoryFD, descriptor->waitFDs); 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); Device* device = reinterpret_cast<Device*>(cDevice);
Texture* texture = reinterpret_cast<Texture*>(cTexture); Texture* texture = reinterpret_cast<Texture*>(cTexture);

View File

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

View File

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

View File

@ -15,8 +15,8 @@
#ifndef DAWNNATIVE_DAWNNATIVE_H_ #ifndef DAWNNATIVE_DAWNNATIVE_H_
#define DAWNNATIVE_DAWNNATIVE_H_ #define DAWNNATIVE_DAWNNATIVE_H_
#include <dawn/dawn.h>
#include <dawn/dawn_proc_table.h> #include <dawn/dawn_proc_table.h>
#include <dawn/webgpu.h>
#include <dawn_native/dawn_native_export.h> #include <dawn_native/dawn_native_export.h>
#include <string> #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 // 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. // a device descriptor and a pointer to backend specific options.
// On an error, nullptr is returned. // On an error, nullptr is returned.
DawnDevice CreateDevice(const DeviceDescriptor* deviceDescriptor = nullptr); WGPUDevice CreateDevice(const DeviceDescriptor* deviceDescriptor = nullptr);
private: private:
AdapterBase* mImpl = nullptr; AdapterBase* mImpl = nullptr;
@ -156,10 +156,10 @@ namespace dawn_native {
DAWN_NATIVE_EXPORT DawnProcTable GetProcs(); DAWN_NATIVE_EXPORT DawnProcTable GetProcs();
// Query the names of all the toggles that are enabled in device // 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 // 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 // Backdoor to get the order of the ProcMap for testing
DAWN_NATIVE_EXPORT std::vector<const char*> GetProcMapNamesForTesting(); DAWN_NATIVE_EXPORT std::vector<const char*> GetProcMapNamesForTesting();

View File

@ -33,8 +33,8 @@ typedef __IOSurface* IOSurfaceRef;
#endif //__OBJC__ #endif //__OBJC__
namespace dawn_native { namespace metal { namespace dawn_native { namespace metal {
DAWN_NATIVE_EXPORT DawnTexture WrapIOSurface(DawnDevice device, DAWN_NATIVE_EXPORT WGPUTexture WrapIOSurface(WGPUDevice device,
const DawnTextureDescriptor* descriptor, const WGPUTextureDescriptor* descriptor,
IOSurfaceRef ioSurface, IOSurfaceRef ioSurface,
uint32_t plane); 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 // 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 // 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. // 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 }} // namespace dawn_native::metal
#ifdef __OBJC__ #ifdef __OBJC__
namespace dawn_native { namespace metal { 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 }} // namespace dawn_native::metal
#endif // __OBJC__ #endif // __OBJC__

View File

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

View File

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

View File

@ -55,7 +55,7 @@ TEST_F(ExtensionTests, AdapterWithRequiredExtensionDisabled) {
dawn_native::DeviceDescriptor deviceDescriptor; dawn_native::DeviceDescriptor deviceDescriptor;
const char* extensionName = ExtensionEnumToName(notSupportedExtension); const char* extensionName = ExtensionEnumToName(notSupportedExtension);
deviceDescriptor.requiredExtensions = std::vector<const char*>(1, extensionName); deviceDescriptor.requiredExtensions = std::vector<const char*>(1, extensionName);
DawnDevice deviceWithExtension = adapterWithoutExtension.CreateDevice(&deviceDescriptor); WGPUDevice deviceWithExtension = adapterWithoutExtension.CreateDevice(&deviceDescriptor);
ASSERT_EQ(nullptr, deviceWithExtension); ASSERT_EQ(nullptr, deviceWithExtension);
} }
} }