diff --git a/examples/CHelloTriangle.cpp b/examples/CHelloTriangle.cpp index 735c208ebf..6b780fc6f7 100644 --- a/examples/CHelloTriangle.cpp +++ b/examples/CHelloTriangle.cpp @@ -17,26 +17,26 @@ #include "utils/DawnHelpers.h" #include "utils/SystemUtils.h" -nxtDevice device; -nxtQueue queue; -nxtSwapChain swapchain; -nxtRenderPipeline pipeline; +dawnDevice device; +dawnQueue queue; +dawnSwapChain swapchain; +dawnRenderPipeline pipeline; -nxtTextureFormat swapChainFormat; +dawnTextureFormat swapChainFormat; void init() { device = CreateCppDawnDevice().Release(); - queue = nxtDeviceCreateQueue(device); + queue = dawnDeviceCreateQueue(device); { - nxtSwapChainBuilder builder = nxtDeviceCreateSwapChainBuilder(device); + dawnSwapChainBuilder builder = dawnDeviceCreateSwapChainBuilder(device); uint64_t swapchainImpl = GetSwapChainImplementation(); - nxtSwapChainBuilderSetImplementation(builder, swapchainImpl); - swapchain = nxtSwapChainBuilderGetResult(builder); - nxtSwapChainBuilderRelease(builder); + dawnSwapChainBuilderSetImplementation(builder, swapchainImpl); + swapchain = dawnSwapChainBuilderGetResult(builder); + dawnSwapChainBuilderRelease(builder); } - swapChainFormat = static_cast(GetPreferredSwapChainTextureFormat()); - nxtSwapChainConfigure(swapchain, swapChainFormat, NXT_TEXTURE_USAGE_BIT_OUTPUT_ATTACHMENT, 640, + swapChainFormat = static_cast(GetPreferredSwapChainTextureFormat()); + dawnSwapChainConfigure(swapchain, swapChainFormat, DAWN_TEXTURE_USAGE_BIT_OUTPUT_ATTACHMENT, 640, 480); const char* vs = @@ -45,7 +45,7 @@ void init() { "void main() {\n" " gl_Position = vec4(pos[gl_VertexIndex], 0.0, 1.0);\n" "}\n"; - nxtShaderModule vsModule = utils::CreateShaderModule(dawn::Device(device), dawn::ShaderStage::Vertex, vs).Release(); + dawnShaderModule vsModule = utils::CreateShaderModule(dawn::Device(device), dawn::ShaderStage::Vertex, vs).Release(); const char* fs = "#version 450\n" @@ -53,52 +53,52 @@ void init() { "void main() {\n" " fragColor = vec4(1.0, 0.0, 0.0, 1.0);\n" "}\n"; - nxtShaderModule fsModule = utils::CreateShaderModule(device, dawn::ShaderStage::Fragment, fs).Release(); + dawnShaderModule fsModule = utils::CreateShaderModule(device, dawn::ShaderStage::Fragment, fs).Release(); { - nxtRenderPipelineBuilder builder = nxtDeviceCreateRenderPipelineBuilder(device); - nxtRenderPipelineBuilderSetColorAttachmentFormat(builder, 0, swapChainFormat); - nxtRenderPipelineBuilderSetStage(builder, NXT_SHADER_STAGE_VERTEX, vsModule, "main"); - nxtRenderPipelineBuilderSetStage(builder, NXT_SHADER_STAGE_FRAGMENT, fsModule, "main"); - pipeline = nxtRenderPipelineBuilderGetResult(builder); - nxtRenderPipelineBuilderRelease(builder); + dawnRenderPipelineBuilder builder = dawnDeviceCreateRenderPipelineBuilder(device); + dawnRenderPipelineBuilderSetColorAttachmentFormat(builder, 0, swapChainFormat); + dawnRenderPipelineBuilderSetStage(builder, DAWN_SHADER_STAGE_VERTEX, vsModule, "main"); + dawnRenderPipelineBuilderSetStage(builder, DAWN_SHADER_STAGE_FRAGMENT, fsModule, "main"); + pipeline = dawnRenderPipelineBuilderGetResult(builder); + dawnRenderPipelineBuilderRelease(builder); } - nxtShaderModuleRelease(vsModule); - nxtShaderModuleRelease(fsModule); + dawnShaderModuleRelease(vsModule); + dawnShaderModuleRelease(fsModule); } void frame() { - nxtTexture backbuffer = nxtSwapChainGetNextTexture(swapchain); - nxtTextureView backbufferView; + dawnTexture backbuffer = dawnSwapChainGetNextTexture(swapchain); + dawnTextureView backbufferView; { - nxtTextureViewBuilder builder = nxtTextureCreateTextureViewBuilder(backbuffer); - backbufferView = nxtTextureViewBuilderGetResult(builder); - nxtTextureViewBuilderRelease(builder); + dawnTextureViewBuilder builder = dawnTextureCreateTextureViewBuilder(backbuffer); + backbufferView = dawnTextureViewBuilderGetResult(builder); + dawnTextureViewBuilderRelease(builder); } - nxtRenderPassDescriptor renderpassInfo; + dawnRenderPassDescriptor renderpassInfo; { - nxtRenderPassDescriptorBuilder builder = nxtDeviceCreateRenderPassDescriptorBuilder(device); - nxtRenderPassDescriptorBuilderSetColorAttachment(builder, 0, backbufferView, NXT_LOAD_OP_CLEAR); - renderpassInfo = nxtRenderPassDescriptorBuilderGetResult(builder); - nxtRenderPassDescriptorBuilderRelease(builder); + dawnRenderPassDescriptorBuilder builder = dawnDeviceCreateRenderPassDescriptorBuilder(device); + dawnRenderPassDescriptorBuilderSetColorAttachment(builder, 0, backbufferView, DAWN_LOAD_OP_CLEAR); + renderpassInfo = dawnRenderPassDescriptorBuilderGetResult(builder); + dawnRenderPassDescriptorBuilderRelease(builder); } - nxtCommandBuffer commands; + dawnCommandBuffer commands; { - nxtCommandBufferBuilder builder = nxtDeviceCreateCommandBufferBuilder(device); - nxtCommandBufferBuilderBeginRenderPass(builder, renderpassInfo); - nxtCommandBufferBuilderSetRenderPipeline(builder, pipeline); - nxtCommandBufferBuilderDrawArrays(builder, 3, 1, 0, 0); - nxtCommandBufferBuilderEndRenderPass(builder); - commands = nxtCommandBufferBuilderGetResult(builder); - nxtCommandBufferBuilderRelease(builder); + dawnCommandBufferBuilder builder = dawnDeviceCreateCommandBufferBuilder(device); + dawnCommandBufferBuilderBeginRenderPass(builder, renderpassInfo); + dawnCommandBufferBuilderSetRenderPipeline(builder, pipeline); + dawnCommandBufferBuilderDrawArrays(builder, 3, 1, 0, 0); + dawnCommandBufferBuilderEndRenderPass(builder); + commands = dawnCommandBufferBuilderGetResult(builder); + dawnCommandBufferBuilderRelease(builder); } - nxtQueueSubmit(queue, 1, &commands); - nxtCommandBufferRelease(commands); - nxtSwapChainPresent(swapchain, backbuffer); - nxtRenderPassDescriptorRelease(renderpassInfo); - nxtTextureViewRelease(backbufferView); + dawnQueueSubmit(queue, 1, &commands); + dawnCommandBufferRelease(commands); + dawnSwapChainPresent(swapchain, backbuffer); + dawnRenderPassDescriptorRelease(renderpassInfo); + dawnTextureViewRelease(backbufferView); DoFlush(); } diff --git a/examples/SampleUtils.cpp b/examples/SampleUtils.cpp index a43a483d5b..81e840fd5e 100644 --- a/examples/SampleUtils.cpp +++ b/examples/SampleUtils.cpp @@ -84,11 +84,11 @@ dawn::Device CreateCppDawnDevice() { binding->SetWindow(window); - nxtDevice backendDevice; + dawnDevice backendDevice; nxtProcTable backendProcs; binding->GetProcAndDevice(&backendProcs, &backendDevice); - nxtDevice cDevice = nullptr; + dawnDevice cDevice = nullptr; nxtProcTable procs; switch (cmdBufType) { case CmdBufType::None: @@ -104,7 +104,7 @@ dawn::Device CreateCppDawnDevice() { wireServer = dawn::wire::NewServerCommandHandler(backendDevice, backendProcs, s2cBuf); c2sBuf->SetHandler(wireServer); - nxtDevice clientDevice; + dawnDevice clientDevice; nxtProcTable clientProcs; wireClient = dawn::wire::NewClientDevice(&clientProcs, &clientDevice, c2sBuf); s2cBuf->SetHandler(wireClient); diff --git a/generator/main.py b/generator/main.py index d184614da9..4b663ea0f2 100644 --- a/generator/main.py +++ b/generator/main.py @@ -314,7 +314,7 @@ def as_cType(name): if name.native: return name.concatcase() else: - return 'nxt' + name.CamelCase() + return 'dawn' + name.CamelCase() def as_cppType(name): if name.native: @@ -338,7 +338,7 @@ def annotated(typ, arg): def as_cEnum(type_name, value_name): assert(not type_name.native and not value_name.native) - return 'NXT' + '_' + type_name.SNAKE_CASE() + '_' + value_name.SNAKE_CASE() + return 'DAWN' + '_' + type_name.SNAKE_CASE() + '_' + value_name.SNAKE_CASE() def as_cppEnum(value_name): assert(not value_name.native) @@ -348,7 +348,7 @@ def as_cppEnum(value_name): def as_cMethod(type_name, method_name): assert(not type_name.native and not method_name.native) - return 'nxt' + type_name.CamelCase() + method_name.CamelCase() + return 'dawn' + type_name.CamelCase() + method_name.CamelCase() def as_MethodSuffix(type_name, method_name): assert(not type_name.native and not method_name.native) @@ -356,7 +356,7 @@ def as_MethodSuffix(type_name, method_name): def as_cProc(type_name, method_name): assert(not type_name.native and not method_name.native) - return 'nxt' + 'Proc' + type_name.CamelCase() + method_name.CamelCase() + return 'dawn' + 'Proc' + type_name.CamelCase() + method_name.CamelCase() def as_backendType(typ): if typ.category == 'object': diff --git a/generator/templates/api.h b/generator/templates/api.h index b4527f362d..2a6628b70a 100644 --- a/generator/templates/api.h +++ b/generator/templates/api.h @@ -45,11 +45,11 @@ {% endfor %} // Custom types depending on the target language -typedef uint64_t nxtCallbackUserdata; -typedef void (*nxtDeviceErrorCallback)(const char* message, nxtCallbackUserdata userdata); -typedef void (*nxtBuilderErrorCallback)(nxtBuilderErrorStatus status, const char* message, nxtCallbackUserdata userdata1, nxtCallbackUserdata userdata2); -typedef void (*nxtBufferMapReadCallback)(nxtBufferMapAsyncStatus status, const void* data, nxtCallbackUserdata userdata); -typedef void (*nxtBufferMapWriteCallback)(nxtBufferMapAsyncStatus status, void* data, nxtCallbackUserdata userdata); +typedef uint64_t dawnCallbackUserdata; +typedef void (*dawnDeviceErrorCallback)(const char* message, dawnCallbackUserdata userdata); +typedef void (*dawnBuilderErrorCallback)(dawnBuilderErrorStatus status, const char* message, dawnCallbackUserdata userdata1, dawnCallbackUserdata userdata2); +typedef void (*dawnBufferMapReadCallback)(dawnBufferMapAsyncStatus status, const void* data, dawnCallbackUserdata userdata); +typedef void (*dawnBufferMapWriteCallback)(dawnBufferMapAsyncStatus status, void* data, dawnCallbackUserdata userdata); #ifdef __cplusplus extern "C" { diff --git a/generator/templates/mock_api.cpp b/generator/templates/mock_api.cpp index 628cf0077d..9c6ac1dda1 100644 --- a/generator/templates/mock_api.cpp +++ b/generator/templates/mock_api.cpp @@ -38,7 +38,7 @@ namespace { ProcTableAsClass::~ProcTableAsClass() { } -void ProcTableAsClass::GetProcTableAndDevice(nxtProcTable* table, nxtDevice* device) { +void ProcTableAsClass::GetProcTableAndDevice(nxtProcTable* table, dawnDevice* device) { *device = GetNewDevice(); {% for type in by_category["object"] %} @@ -48,7 +48,7 @@ void ProcTableAsClass::GetProcTableAndDevice(nxtProcTable* table, nxtDevice* dev {% endfor %} } -void ProcTableAsClass::DeviceSetErrorCallback(nxtDevice self, nxtDeviceErrorCallback callback, nxtCallbackUserdata userdata) { +void ProcTableAsClass::DeviceSetErrorCallback(dawnDevice self, dawnDeviceErrorCallback callback, dawnCallbackUserdata userdata) { auto object = reinterpret_cast(self); object->deviceErrorCallback = callback; object->userdata1 = userdata; @@ -56,7 +56,7 @@ void ProcTableAsClass::DeviceSetErrorCallback(nxtDevice self, nxtDeviceErrorCall OnDeviceSetErrorCallback(self, callback, userdata); } -void ProcTableAsClass::BufferMapReadAsync(nxtBuffer self, uint32_t start, uint32_t size, nxtBufferMapReadCallback callback, nxtCallbackUserdata userdata) { +void ProcTableAsClass::BufferMapReadAsync(dawnBuffer self, uint32_t start, uint32_t size, dawnBufferMapReadCallback callback, dawnCallbackUserdata userdata) { auto object = reinterpret_cast(self); object->mapReadCallback = callback; object->userdata1 = userdata; @@ -64,7 +64,7 @@ void ProcTableAsClass::BufferMapReadAsync(nxtBuffer self, uint32_t start, uint32 OnBufferMapReadAsyncCallback(self, start, size, callback, userdata); } -void ProcTableAsClass::BufferMapWriteAsync(nxtBuffer self, uint32_t start, uint32_t size, nxtBufferMapWriteCallback callback, nxtCallbackUserdata userdata) { +void ProcTableAsClass::BufferMapWriteAsync(dawnBuffer self, uint32_t start, uint32_t size, dawnBufferMapWriteCallback callback, dawnCallbackUserdata userdata) { auto object = reinterpret_cast(self); object->mapWriteCallback = callback; object->userdata1 = userdata; @@ -72,32 +72,32 @@ void ProcTableAsClass::BufferMapWriteAsync(nxtBuffer self, uint32_t start, uint3 OnBufferMapWriteAsyncCallback(self, start, size, callback, userdata); } -void ProcTableAsClass::CallDeviceErrorCallback(nxtDevice device, const char* message) { +void ProcTableAsClass::CallDeviceErrorCallback(dawnDevice device, const char* message) { auto object = reinterpret_cast(device); object->deviceErrorCallback(message, object->userdata1); } -void ProcTableAsClass::CallBuilderErrorCallback(void* builder , nxtBuilderErrorStatus status, const char* message) { +void ProcTableAsClass::CallBuilderErrorCallback(void* builder , dawnBuilderErrorStatus status, const char* message) { auto object = reinterpret_cast(builder); object->builderErrorCallback(status, message, object->userdata1, object->userdata2); } -void ProcTableAsClass::CallMapReadCallback(nxtBuffer buffer, nxtBufferMapAsyncStatus status, const void* data) { +void ProcTableAsClass::CallMapReadCallback(dawnBuffer buffer, dawnBufferMapAsyncStatus status, const void* data) { auto object = reinterpret_cast(buffer); object->mapReadCallback(status, data, object->userdata1); } -void ProcTableAsClass::CallMapWriteCallback(nxtBuffer buffer, nxtBufferMapAsyncStatus status, void* data) { +void ProcTableAsClass::CallMapWriteCallback(dawnBuffer buffer, dawnBufferMapAsyncStatus status, void* data) { auto object = reinterpret_cast(buffer); object->mapWriteCallback(status, data, object->userdata1); } {% for type in by_category["object"] if type.is_builder %} - void ProcTableAsClass::{{as_MethodSuffix(type.name, Name("set error callback"))}}({{as_cType(type.name)}} self, nxtBuilderErrorCallback callback, nxtCallbackUserdata userdata1, nxtCallbackUserdata userdata2) { + void ProcTableAsClass::{{as_MethodSuffix(type.name, Name("set error callback"))}}({{as_cType(type.name)}} self, dawnBuilderErrorCallback callback, dawnCallbackUserdata userdata1, dawnCallbackUserdata userdata2) { auto object = reinterpret_cast(self); object->builderErrorCallback = callback; object->userdata1 = userdata1; object->userdata2 = userdata2; - OnBuilderSetErrorCallback(reinterpret_cast(self), callback, userdata1, userdata2); + OnBuilderSetErrorCallback(reinterpret_cast(self), callback, userdata1, userdata2); } {% endfor %} diff --git a/generator/templates/mock_api.h b/generator/templates/mock_api.h index b9d302ced5..63e5ec43ff 100644 --- a/generator/templates/mock_api.h +++ b/generator/templates/mock_api.h @@ -27,7 +27,7 @@ class ProcTableAsClass { public: virtual ~ProcTableAsClass(); - void GetProcTableAndDevice(nxtProcTable* table, nxtDevice* device); + void GetProcTableAndDevice(nxtProcTable* table, dawnDevice* device); // Creates an object that can be returned by a mocked call as in WillOnce(Return(foo)). // It returns an object of the write type that isn't equal to any previously returned object. @@ -51,36 +51,36 @@ class ProcTableAsClass { // Stores callback and userdata and calls OnBuilderSetErrorCallback {% if type.is_builder %} - void {{as_MethodSuffix(type.name, Name("set error callback"))}}({{as_cType(type.name)}} self, nxtBuilderErrorCallback callback, nxtCallbackUserdata userdata1, nxtCallbackUserdata userdata2); + void {{as_MethodSuffix(type.name, Name("set error callback"))}}({{as_cType(type.name)}} self, dawnBuilderErrorCallback callback, dawnCallbackUserdata userdata1, dawnCallbackUserdata userdata2); {% endif %} {% endfor %} // Stores callback and userdata and calls the On* methods - void DeviceSetErrorCallback(nxtDevice self, nxtDeviceErrorCallback callback, nxtCallbackUserdata userdata); - void BufferMapReadAsync(nxtBuffer self, uint32_t start, uint32_t size, nxtBufferMapReadCallback callback, nxtCallbackUserdata userdata); - void BufferMapWriteAsync(nxtBuffer self, uint32_t start, uint32_t size, nxtBufferMapWriteCallback callback, nxtCallbackUserdata userdata); + void DeviceSetErrorCallback(dawnDevice self, dawnDeviceErrorCallback callback, dawnCallbackUserdata userdata); + void BufferMapReadAsync(dawnBuffer self, uint32_t start, uint32_t size, dawnBufferMapReadCallback callback, dawnCallbackUserdata userdata); + void BufferMapWriteAsync(dawnBuffer self, uint32_t start, uint32_t size, dawnBufferMapWriteCallback callback, dawnCallbackUserdata userdata); // Special cased mockable methods - virtual void OnDeviceSetErrorCallback(nxtDevice device, nxtDeviceErrorCallback callback, nxtCallbackUserdata userdata) = 0; - virtual void OnBuilderSetErrorCallback(nxtBufferBuilder builder, nxtBuilderErrorCallback callback, nxtCallbackUserdata userdata1, nxtCallbackUserdata userdata2) = 0; - virtual void OnBufferMapReadAsyncCallback(nxtBuffer buffer, uint32_t start, uint32_t size, nxtBufferMapReadCallback callback, nxtCallbackUserdata userdata) = 0; - virtual void OnBufferMapWriteAsyncCallback(nxtBuffer buffer, uint32_t start, uint32_t size, nxtBufferMapWriteCallback callback, nxtCallbackUserdata userdata) = 0; + virtual void OnDeviceSetErrorCallback(dawnDevice device, dawnDeviceErrorCallback callback, dawnCallbackUserdata userdata) = 0; + virtual void OnBuilderSetErrorCallback(dawnBufferBuilder builder, dawnBuilderErrorCallback callback, dawnCallbackUserdata userdata1, dawnCallbackUserdata userdata2) = 0; + virtual void OnBufferMapReadAsyncCallback(dawnBuffer buffer, uint32_t start, uint32_t size, dawnBufferMapReadCallback callback, dawnCallbackUserdata userdata) = 0; + virtual void OnBufferMapWriteAsyncCallback(dawnBuffer buffer, uint32_t start, uint32_t size, dawnBufferMapWriteCallback callback, dawnCallbackUserdata userdata) = 0; // Calls the stored callbacks - void CallDeviceErrorCallback(nxtDevice device, const char* message); - void CallBuilderErrorCallback(void* builder , nxtBuilderErrorStatus status, const char* message); - void CallMapReadCallback(nxtBuffer buffer, nxtBufferMapAsyncStatus status, const void* data); - void CallMapWriteCallback(nxtBuffer buffer, nxtBufferMapAsyncStatus status, void* data); + void CallDeviceErrorCallback(dawnDevice device, const char* message); + void CallBuilderErrorCallback(void* builder , dawnBuilderErrorStatus status, const char* message); + void CallMapReadCallback(dawnBuffer buffer, dawnBufferMapAsyncStatus status, const void* data); + void CallMapWriteCallback(dawnBuffer buffer, dawnBufferMapAsyncStatus status, void* data); struct Object { ProcTableAsClass* procs = nullptr; - nxtDeviceErrorCallback deviceErrorCallback = nullptr; - nxtBuilderErrorCallback builderErrorCallback = nullptr; - nxtBufferMapReadCallback mapReadCallback = nullptr; - nxtBufferMapWriteCallback mapWriteCallback = nullptr; - nxtCallbackUserdata userdata1 = 0; - nxtCallbackUserdata userdata2 = 0; + dawnDeviceErrorCallback deviceErrorCallback = nullptr; + dawnBuilderErrorCallback builderErrorCallback = nullptr; + dawnBufferMapReadCallback mapReadCallback = nullptr; + dawnBufferMapWriteCallback mapWriteCallback = nullptr; + dawnCallbackUserdata userdata1 = 0; + dawnCallbackUserdata userdata2 = 0; }; private: @@ -106,10 +106,10 @@ class MockProcTable : public ProcTableAsClass { MOCK_METHOD1({{as_MethodSuffix(type.name, Name("release"))}}, void({{as_cType(type.name)}} self)); {% endfor %} - MOCK_METHOD3(OnDeviceSetErrorCallback, void(nxtDevice device, nxtDeviceErrorCallback callback, nxtCallbackUserdata userdata)); - MOCK_METHOD4(OnBuilderSetErrorCallback, void(nxtBufferBuilder builder, nxtBuilderErrorCallback callback, nxtCallbackUserdata userdata1, nxtCallbackUserdata userdata2)); - MOCK_METHOD5(OnBufferMapReadAsyncCallback, void(nxtBuffer buffer, uint32_t start, uint32_t size, nxtBufferMapReadCallback callback, nxtCallbackUserdata userdata)); - MOCK_METHOD5(OnBufferMapWriteAsyncCallback, void(nxtBuffer buffer, uint32_t start, uint32_t size, nxtBufferMapWriteCallback callback, nxtCallbackUserdata userdata)); + MOCK_METHOD3(OnDeviceSetErrorCallback, void(dawnDevice device, dawnDeviceErrorCallback callback, dawnCallbackUserdata userdata)); + MOCK_METHOD4(OnBuilderSetErrorCallback, void(dawnBufferBuilder builder, dawnBuilderErrorCallback callback, dawnCallbackUserdata userdata1, dawnCallbackUserdata userdata2)); + MOCK_METHOD5(OnBufferMapReadAsyncCallback, void(dawnBuffer buffer, uint32_t start, uint32_t size, dawnBufferMapReadCallback callback, dawnCallbackUserdata userdata)); + MOCK_METHOD5(OnBufferMapWriteAsyncCallback, void(dawnBuffer buffer, uint32_t start, uint32_t size, dawnBufferMapWriteCallback callback, dawnCallbackUserdata userdata)); }; #endif // MOCK_NXT_H diff --git a/generator/templates/wire/WireClient.cpp b/generator/templates/wire/WireClient.cpp index 4c7fea3347..655eff1254 100644 --- a/generator/templates/wire/WireClient.cpp +++ b/generator/templates/wire/WireClient.cpp @@ -32,7 +32,7 @@ namespace dawn { namespace wire { class Device; struct BuilderCallbackData { - bool Call(nxtBuilderErrorStatus status, const char* message) { + bool Call(dawnBuilderErrorStatus status, const char* message) { if (canCall && callback != nullptr) { canCall = true; callback(status, message, userdata1, userdata2); @@ -43,9 +43,9 @@ namespace dawn { namespace wire { } //* For help with development, prints all builder errors by default. - nxtBuilderErrorCallback callback = nullptr; - nxtCallbackUserdata userdata1 = 0; - nxtCallbackUserdata userdata2 = 0; + dawnBuilderErrorCallback callback = nullptr; + dawnCallbackUserdata userdata1 = 0; + dawnCallbackUserdata userdata2 = 0; bool canCall = true; }; @@ -81,14 +81,14 @@ namespace dawn { namespace wire { ~Buffer() { //* Callbacks need to be fired in all cases, as they can handle freeing resources //* so we call them with "Unknown" status. - ClearMapRequests(NXT_BUFFER_MAP_ASYNC_STATUS_UNKNOWN); + ClearMapRequests(DAWN_BUFFER_MAP_ASYNC_STATUS_UNKNOWN); if (mappedData) { free(mappedData); } } - void ClearMapRequests(nxtBufferMapAsyncStatus status) { + void ClearMapRequests(dawnBufferMapAsyncStatus status) { for (auto& it : requests) { if (it.second.isWrite) { it.second.writeCallback(status, nullptr, it.second.userdata); @@ -103,9 +103,9 @@ namespace dawn { namespace wire { //* map request in flight at a single time and need to track them separately. //* On well-behaved applications, only one request should exist at a single time. struct MapRequestData { - nxtBufferMapReadCallback readCallback = nullptr; - nxtBufferMapWriteCallback writeCallback = nullptr; - nxtCallbackUserdata userdata = 0; + dawnBufferMapReadCallback readCallback = nullptr; + dawnBufferMapWriteCallback writeCallback = nullptr; + dawnCallbackUserdata userdata = 0; uint32_t size = 0; bool isWrite = false; }; @@ -225,8 +225,8 @@ namespace dawn { namespace wire { } } - nxtDeviceErrorCallback errorCallback = nullptr; - nxtCallbackUserdata errorUserdata; + dawnDeviceErrorCallback errorCallback = nullptr; + dawnCallbackUserdata errorUserdata; private: CommandSerializer* mSerializer = nullptr; @@ -286,9 +286,9 @@ namespace dawn { namespace wire { {% if type.is_builder %} void Client{{as_MethodSuffix(type.name, Name("set error callback"))}}({{Type}}* self, - nxtBuilderErrorCallback callback, - nxtCallbackUserdata userdata1, - nxtCallbackUserdata userdata2) { + dawnBuilderErrorCallback callback, + dawnCallbackUserdata userdata1, + dawnCallbackUserdata userdata2) { self->builderCallback.callback = callback; self->builderCallback.userdata1 = userdata1; self->builderCallback.userdata2 = userdata2; @@ -304,7 +304,7 @@ namespace dawn { namespace wire { return; } - obj->builderCallback.Call(NXT_BUILDER_ERROR_STATUS_UNKNOWN, "Unknown"); + obj->builderCallback.Call(DAWN_BUILDER_ERROR_STATUS_UNKNOWN, "Unknown"); wire::{{as_MethodSuffix(type.name, Name("destroy"))}}Cmd cmd; cmd.objectId = obj->id; @@ -321,7 +321,7 @@ namespace dawn { namespace wire { {% endif %} {% endfor %} - void ClientBufferMapReadAsync(Buffer* buffer, uint32_t start, uint32_t size, nxtBufferMapReadCallback callback, nxtCallbackUserdata userdata) { + void ClientBufferMapReadAsync(Buffer* buffer, uint32_t start, uint32_t size, dawnBufferMapReadCallback callback, dawnCallbackUserdata userdata) { uint32_t serial = buffer->requestSerial++; ASSERT(buffer->requests.find(serial) == buffer->requests.end()); @@ -343,7 +343,7 @@ namespace dawn { namespace wire { *allocCmd = cmd; } - void ClientBufferMapWriteAsync(Buffer* buffer, uint32_t start, uint32_t size, nxtBufferMapWriteCallback callback, nxtCallbackUserdata userdata) { + void ClientBufferMapWriteAsync(Buffer* buffer, uint32_t start, uint32_t size, dawnBufferMapWriteCallback callback, dawnCallbackUserdata userdata) { uint32_t serial = buffer->requestSerial++; ASSERT(buffer->requests.find(serial) == buffer->requests.end()); @@ -365,7 +365,7 @@ namespace dawn { namespace wire { *allocCmd = cmd; } - void ProxyClientBufferUnmap(nxtBuffer cBuffer) { + void ProxyClientBufferUnmap(dawnBuffer cBuffer) { Buffer* buffer = reinterpret_cast(cBuffer); //* Invalidate the local pointer, and cancel all other in-flight requests that would turn into @@ -393,7 +393,7 @@ namespace dawn { namespace wire { free(buffer->mappedData); buffer->mappedData = nullptr; } - buffer->ClearMapRequests(NXT_BUFFER_MAP_ASYNC_STATUS_UNKNOWN); + buffer->ClearMapRequests(DAWN_BUFFER_MAP_ASYNC_STATUS_UNKNOWN); ClientBufferUnmap(cBuffer); } @@ -404,7 +404,7 @@ namespace dawn { namespace wire { void ClientDeviceRelease(Device*) { } - void ClientDeviceSetErrorCallback(Device* self, nxtDeviceErrorCallback callback, nxtCallbackUserdata userdata) { + void ClientDeviceSetErrorCallback(Device* self, dawnDeviceErrorCallback callback, dawnCallbackUserdata userdata) { self->errorCallback = callback; self->errorUserdata = userdata; } @@ -535,10 +535,10 @@ namespace dawn { namespace wire { return true; } - bool called = builtObject->builderCallback.Call(static_cast(cmd->status), message); + bool called = builtObject->builderCallback.Call(static_cast(cmd->status), message); // Unhandled builder errors are forwarded to the device - if (!called && cmd->status != NXT_BUILDER_ERROR_STATUS_SUCCESS && cmd->status != NXT_BUILDER_ERROR_STATUS_UNKNOWN) { + if (!called && cmd->status != DAWN_BUILDER_ERROR_STATUS_SUCCESS && cmd->status != DAWN_BUILDER_ERROR_STATUS_UNKNOWN) { mDevice->HandleError(("Unhandled builder error: " + std::string(message)).c_str()); } @@ -555,7 +555,7 @@ namespace dawn { namespace wire { //* Unconditionnally get the data from the buffer so that the correct amount of data is //* consumed from the buffer, even when we ignore the command and early out. const char* requestData = nullptr; - if (cmd->status == NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS) { + if (cmd->status == DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS) { requestData = GetData(commands, size, cmd->dataLength); if (requestData == nullptr) { return false; @@ -587,7 +587,7 @@ namespace dawn { namespace wire { buffer->requests.erase(requestIt); //* On success, we copy the data locally because the IPC buffer isn't valid outside of this function - if (cmd->status == NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS) { + if (cmd->status == DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS) { //* The server didn't send the right amount of data, this is an error and could cause //* the application to crash if we did call the callback. if (request.size != cmd->dataLength) { @@ -605,9 +605,9 @@ namespace dawn { namespace wire { buffer->mappedData = malloc(request.size); memcpy(buffer->mappedData, requestData, request.size); - request.readCallback(static_cast(cmd->status), buffer->mappedData, request.userdata); + request.readCallback(static_cast(cmd->status), buffer->mappedData, request.userdata); } else { - request.readCallback(static_cast(cmd->status), nullptr, request.userdata); + request.readCallback(static_cast(cmd->status), nullptr, request.userdata); } return true; @@ -643,7 +643,7 @@ namespace dawn { namespace wire { buffer->requests.erase(requestIt); //* On success, we copy the data locally because the IPC buffer isn't valid outside of this function - if (cmd->status == NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS) { + if (cmd->status == DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS) { if (buffer->mappedData != nullptr) { return false; } @@ -653,9 +653,9 @@ namespace dawn { namespace wire { buffer->mappedData = malloc(request.size); memset(buffer->mappedData, 0, request.size); - request.writeCallback(static_cast(cmd->status), buffer->mappedData, request.userdata); + request.writeCallback(static_cast(cmd->status), buffer->mappedData, request.userdata); } else { - request.writeCallback(static_cast(cmd->status), nullptr, request.userdata); + request.writeCallback(static_cast(cmd->status), nullptr, request.userdata); } return true; @@ -664,10 +664,10 @@ namespace dawn { namespace wire { } - CommandHandler* NewClientDevice(nxtProcTable* procs, nxtDevice* device, CommandSerializer* serializer) { + CommandHandler* NewClientDevice(nxtProcTable* procs, dawnDevice* device, CommandSerializer* serializer) { auto clientDevice = new client::Device(serializer); - *device = reinterpret_cast(clientDevice); + *device = reinterpret_cast(clientDevice); *procs = client::GetProcs(); return new client::Client(clientDevice); diff --git a/generator/templates/wire/WireServer.cpp b/generator/templates/wire/WireServer.cpp index a3976b6b17..55c9fd777a 100644 --- a/generator/templates/wire/WireServer.cpp +++ b/generator/templates/wire/WireServer.cpp @@ -141,14 +141,14 @@ namespace dawn { namespace wire { std::vector mKnown; }; - void ForwardDeviceErrorToServer(const char* message, nxtCallbackUserdata userdata); + void ForwardDeviceErrorToServer(const char* message, dawnCallbackUserdata userdata); {% for type in by_category["object"] if type.is_builder%} - void Forward{{type.name.CamelCase()}}ToClient(nxtBuilderErrorStatus status, const char* message, nxtCallbackUserdata userdata1, nxtCallbackUserdata userdata2); + void Forward{{type.name.CamelCase()}}ToClient(dawnBuilderErrorStatus status, const char* message, dawnCallbackUserdata userdata1, dawnCallbackUserdata userdata2); {% endfor %} - void ForwardBufferMapReadAsync(nxtBufferMapAsyncStatus status, const void* ptr, nxtCallbackUserdata userdata); - void ForwardBufferMapWriteAsync(nxtBufferMapAsyncStatus status, void* ptr, nxtCallbackUserdata userdata); + void ForwardBufferMapReadAsync(dawnBufferMapAsyncStatus status, const void* ptr, dawnCallbackUserdata userdata); + void ForwardBufferMapWriteAsync(dawnBufferMapAsyncStatus status, void* ptr, dawnCallbackUserdata userdata); // A really really simple implementation of the DeserializeAllocator. It's main feature // is that it has some inline storage so as to avoid allocations for the majority of @@ -205,14 +205,14 @@ namespace dawn { namespace wire { class Server : public CommandHandler, public ObjectIdResolver { public: - Server(nxtDevice device, const nxtProcTable& procs, CommandSerializer* serializer) + Server(dawnDevice device, const nxtProcTable& procs, CommandSerializer* serializer) : mProcs(procs), mSerializer(serializer) { //* The client-server knowledge is bootstrapped with device 1. auto* deviceData = mKnownDevice.Allocate(1); deviceData->handle = device; deviceData->valid = true; - auto userdata = static_cast(reinterpret_cast(this)); + auto userdata = static_cast(reinterpret_cast(this)); procs.deviceSetErrorCallback(device, ForwardDeviceErrorToServer, userdata); } @@ -229,18 +229,18 @@ namespace dawn { namespace wire { {% for type in by_category["object"] if type.is_builder%} {% set Type = type.name.CamelCase() %} - void On{{Type}}Error(nxtBuilderErrorStatus status, const char* message, uint32_t id, uint32_t serial) { + void On{{Type}}Error(dawnBuilderErrorStatus status, const char* message, uint32_t id, uint32_t serial) { auto* builder = mKnown{{Type}}.Get(id); if (builder == nullptr || builder->serial != serial) { return; } - if (status != NXT_BUILDER_ERROR_STATUS_SUCCESS) { + if (status != DAWN_BUILDER_ERROR_STATUS_SUCCESS) { builder->valid = false; } - if (status != NXT_BUILDER_ERROR_STATUS_UNKNOWN) { + if (status != DAWN_BUILDER_ERROR_STATUS_UNKNOWN) { //* Unknown is the only status that can be returned without a call to GetResult //* so we are guaranteed to have created an object. ASSERT(builder->builtObjectId != 0); @@ -259,7 +259,7 @@ namespace dawn { namespace wire { } {% endfor %} - void OnMapReadAsyncCallback(nxtBufferMapAsyncStatus status, const void* ptr, MapUserdata* data) { + void OnMapReadAsyncCallback(dawnBufferMapAsyncStatus status, const void* ptr, MapUserdata* data) { ReturnBufferMapReadAsyncCallbackCmd cmd; cmd.bufferId = data->bufferId; cmd.bufferSerial = data->bufferSerial; @@ -270,7 +270,7 @@ namespace dawn { namespace wire { auto allocCmd = static_cast(GetCmdSpace(sizeof(cmd))); *allocCmd = cmd; - if (status == NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS) { + if (status == DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS) { allocCmd->dataLength = data->size; void* dataAlloc = GetCmdSpace(data->size); @@ -280,7 +280,7 @@ namespace dawn { namespace wire { delete data; } - void OnMapWriteAsyncCallback(nxtBufferMapAsyncStatus status, void* ptr, MapUserdata* data) { + void OnMapWriteAsyncCallback(dawnBufferMapAsyncStatus status, void* ptr, MapUserdata* data) { ReturnBufferMapWriteAsyncCallbackCmd cmd; cmd.bufferId = data->bufferId; cmd.bufferSerial = data->bufferSerial; @@ -290,7 +290,7 @@ namespace dawn { namespace wire { auto allocCmd = static_cast(GetCmdSpace(sizeof(cmd))); *allocCmd = cmd; - if (status == NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS) { + if (status == DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS) { auto* selfData = mKnownBuffer.Get(data->bufferId); ASSERT(selfData != nullptr); @@ -459,7 +459,7 @@ namespace dawn { namespace wire { selfData->valid = false; //* If we are in GetResult, fake an error callback {% if returns %} - On{{type.name.CamelCase()}}Error(NXT_BUILDER_ERROR_STATUS_ERROR, "Maybe monad", cmd.selfId, selfData->serial); + On{{type.name.CamelCase()}}Error(DAWN_BUILDER_ERROR_STATUS_ERROR, "Maybe monad", cmd.selfId, selfData->serial); {% endif %} {% endif %} return true; @@ -555,9 +555,9 @@ namespace dawn { namespace wire { if (!buffer->valid) { //* Fake the buffer returning a failure, data will be freed in this call. if (isWrite) { - ForwardBufferMapWriteAsync(NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata); + ForwardBufferMapWriteAsync(DAWN_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata); } else { - ForwardBufferMapReadAsync(NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata); + ForwardBufferMapReadAsync(DAWN_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata); } return true; } @@ -597,13 +597,13 @@ namespace dawn { namespace wire { } }; - void ForwardDeviceErrorToServer(const char* message, nxtCallbackUserdata userdata) { + void ForwardDeviceErrorToServer(const char* message, dawnCallbackUserdata userdata) { auto server = reinterpret_cast(static_cast(userdata)); server->OnDeviceError(message); } {% for type in by_category["object"] if type.is_builder%} - void Forward{{type.name.CamelCase()}}ToClient(nxtBuilderErrorStatus status, const char* message, nxtCallbackUserdata userdata1, nxtCallbackUserdata userdata2) { + void Forward{{type.name.CamelCase()}}ToClient(dawnBuilderErrorStatus status, const char* message, dawnCallbackUserdata userdata1, dawnCallbackUserdata userdata2) { auto server = reinterpret_cast(static_cast(userdata1)); uint32_t id = userdata2 & 0xFFFFFFFFu; uint32_t serial = userdata2 >> uint64_t(32); @@ -611,18 +611,18 @@ namespace dawn { namespace wire { } {% endfor %} - void ForwardBufferMapReadAsync(nxtBufferMapAsyncStatus status, const void* ptr, nxtCallbackUserdata userdata) { + void ForwardBufferMapReadAsync(dawnBufferMapAsyncStatus status, const void* ptr, dawnCallbackUserdata userdata) { auto data = reinterpret_cast(static_cast(userdata)); data->server->OnMapReadAsyncCallback(status, ptr, data); } - void ForwardBufferMapWriteAsync(nxtBufferMapAsyncStatus status, void* ptr, nxtCallbackUserdata userdata) { + void ForwardBufferMapWriteAsync(dawnBufferMapAsyncStatus status, void* ptr, dawnCallbackUserdata userdata) { auto data = reinterpret_cast(static_cast(userdata)); data->server->OnMapWriteAsyncCallback(status, ptr, data); } } - CommandHandler* NewServerCommandHandler(nxtDevice device, const nxtProcTable& procs, CommandSerializer* serializer) { + CommandHandler* NewServerCommandHandler(dawnDevice device, const nxtProcTable& procs, CommandSerializer* serializer) { return new server::Server(device, procs, serializer); } diff --git a/src/backend/Buffer.cpp b/src/backend/Buffer.cpp index c0c27b3944..296f3fe865 100644 --- a/src/backend/Buffer.cpp +++ b/src/backend/Buffer.cpp @@ -30,8 +30,8 @@ namespace backend { BufferBase::~BufferBase() { if (mIsMapped) { - CallMapReadCallback(mMapSerial, NXT_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr); - CallMapWriteCallback(mMapSerial, NXT_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr); + CallMapReadCallback(mMapSerial, DAWN_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr); + CallMapWriteCallback(mMapSerial, DAWN_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr); } } @@ -52,26 +52,26 @@ namespace backend { } void BufferBase::CallMapReadCallback(uint32_t serial, - nxtBufferMapAsyncStatus status, + dawnBufferMapAsyncStatus status, const void* pointer) { if (mMapReadCallback != nullptr && serial == mMapSerial) { ASSERT(mMapWriteCallback == nullptr); // Tag the callback as fired before firing it, otherwise it could fire a second time if // for example buffer.Unmap() is called inside the application-provided callback. - nxtBufferMapReadCallback callback = mMapReadCallback; + dawnBufferMapReadCallback callback = mMapReadCallback; mMapReadCallback = nullptr; callback(status, pointer, mMapUserdata); } } void BufferBase::CallMapWriteCallback(uint32_t serial, - nxtBufferMapAsyncStatus status, + dawnBufferMapAsyncStatus status, void* pointer) { if (mMapWriteCallback != nullptr && serial == mMapSerial) { ASSERT(mMapReadCallback == nullptr); // Tag the callback as fired before firing it, otherwise it could fire a second time if // for example buffer.Unmap() is called inside the application-provided callback. - nxtBufferMapWriteCallback callback = mMapWriteCallback; + dawnBufferMapWriteCallback callback = mMapWriteCallback; mMapWriteCallback = nullptr; callback(status, pointer, mMapUserdata); } @@ -93,10 +93,10 @@ namespace backend { void BufferBase::MapReadAsync(uint32_t start, uint32_t size, - nxtBufferMapReadCallback callback, - nxtCallbackUserdata userdata) { + dawnBufferMapReadCallback callback, + dawnCallbackUserdata userdata) { if (!ValidateMapBase(start, size, dawn::BufferUsageBit::MapRead)) { - callback(NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata); + callback(DAWN_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata); return; } @@ -113,10 +113,10 @@ namespace backend { void BufferBase::MapWriteAsync(uint32_t start, uint32_t size, - nxtBufferMapWriteCallback callback, - nxtCallbackUserdata userdata) { + dawnBufferMapWriteCallback callback, + dawnCallbackUserdata userdata) { if (!ValidateMapBase(start, size, dawn::BufferUsageBit::MapWrite)) { - callback(NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata); + callback(DAWN_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata); return; } @@ -139,8 +139,8 @@ namespace backend { // A map request can only be called once, so this will fire only if the request wasn't // completed before the Unmap - CallMapReadCallback(mMapSerial, NXT_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr); - CallMapWriteCallback(mMapSerial, NXT_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr); + CallMapReadCallback(mMapSerial, DAWN_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr); + CallMapWriteCallback(mMapSerial, DAWN_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr); UnmapImpl(); mIsMapped = false; mMapReadCallback = nullptr; diff --git a/src/backend/Buffer.h b/src/backend/Buffer.h index 29398c4a40..aab661669d 100644 --- a/src/backend/Buffer.h +++ b/src/backend/Buffer.h @@ -46,19 +46,19 @@ namespace backend { void SetSubData(uint32_t start, uint32_t count, const uint8_t* data); void MapReadAsync(uint32_t start, uint32_t size, - nxtBufferMapReadCallback callback, - nxtCallbackUserdata userdata); + dawnBufferMapReadCallback callback, + dawnCallbackUserdata userdata); void MapWriteAsync(uint32_t start, uint32_t size, - nxtBufferMapWriteCallback callback, - nxtCallbackUserdata userdata); + dawnBufferMapWriteCallback callback, + dawnCallbackUserdata userdata); void Unmap(); protected: void CallMapReadCallback(uint32_t serial, - nxtBufferMapAsyncStatus status, + dawnBufferMapAsyncStatus status, const void* pointer); - void CallMapWriteCallback(uint32_t serial, nxtBufferMapAsyncStatus status, void* pointer); + void CallMapWriteCallback(uint32_t serial, dawnBufferMapAsyncStatus status, void* pointer); private: virtual void SetSubDataImpl(uint32_t start, uint32_t count, const uint8_t* data) = 0; @@ -72,9 +72,9 @@ namespace backend { uint32_t mSize; dawn::BufferUsageBit mAllowedUsage = dawn::BufferUsageBit::None; - nxtBufferMapReadCallback mMapReadCallback = nullptr; - nxtBufferMapWriteCallback mMapWriteCallback = nullptr; - nxtCallbackUserdata mMapUserdata = 0; + dawnBufferMapReadCallback mMapReadCallback = nullptr; + dawnBufferMapWriteCallback mMapWriteCallback = nullptr; + dawnCallbackUserdata mMapUserdata = 0; uint32_t mMapSerial = 0; bool mIsMapped = false; diff --git a/src/backend/Builder.cpp b/src/backend/Builder.cpp index 023824e85e..fc383b2108 100644 --- a/src/backend/Builder.cpp +++ b/src/backend/Builder.cpp @@ -44,7 +44,7 @@ namespace backend { BuilderBase::~BuilderBase() { if (!mIsConsumed && mCallback != nullptr) { - mCallback(NXT_BUILDER_ERROR_STATUS_UNKNOWN, "Builder destroyed before GetResult", + mCallback(DAWN_BUILDER_ERROR_STATUS_UNKNOWN, "Builder destroyed before GetResult", mUserdata1, mUserdata2); } } @@ -87,7 +87,7 @@ namespace backend { } if (mCallback != nullptr) { - mCallback(static_cast(mStoredStatus), mStoredMessage.c_str(), + mCallback(static_cast(mStoredStatus), mStoredMessage.c_str(), mUserdata1, mUserdata2); } diff --git a/src/backend/SwapChain.cpp b/src/backend/SwapChain.cpp index 0cb5d89ead..65f8f78bc0 100644 --- a/src/backend/SwapChain.cpp +++ b/src/backend/SwapChain.cpp @@ -48,8 +48,8 @@ namespace backend { 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/backend/d3d12/BufferD3D12.cpp b/src/backend/d3d12/BufferD3D12.cpp index b3927e31fc..0d00188dfd 100644 --- a/src/backend/d3d12/BufferD3D12.cpp +++ b/src/backend/d3d12/BufferD3D12.cpp @@ -155,9 +155,9 @@ namespace backend { namespace d3d12 { void Buffer::OnMapCommandSerialFinished(uint32_t mapSerial, void* data, bool isWrite) { if (isWrite) { - CallMapWriteCallback(mapSerial, NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, data); + CallMapWriteCallback(mapSerial, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, data); } else { - CallMapReadCallback(mapSerial, NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, data); + CallMapReadCallback(mapSerial, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, data); } } diff --git a/src/backend/d3d12/DeviceD3D12.cpp b/src/backend/d3d12/DeviceD3D12.cpp index 085c844622..a504a5f115 100644 --- a/src/backend/d3d12/DeviceD3D12.cpp +++ b/src/backend/d3d12/DeviceD3D12.cpp @@ -43,26 +43,26 @@ namespace backend { namespace d3d12 { nxtProcTable GetNonValidatingProcs(); nxtProcTable GetValidatingProcs(); - void Init(nxtProcTable* procs, nxtDevice* device) { + void Init(nxtProcTable* procs, dawnDevice* device) { *device = nullptr; *procs = GetValidatingProcs(); - *device = reinterpret_cast(new Device()); + *device = reinterpret_cast(new Device()); } - dawnSwapChainImplementation CreateNativeSwapChainImpl(nxtDevice device, HWND window) { + dawnSwapChainImplementation CreateNativeSwapChainImpl(dawnDevice device, HWND window) { Device* backendDevice = reinterpret_cast(device); dawnSwapChainImplementation impl; impl = CreateSwapChainImplementation(new NativeSwapChainImpl(backendDevice, window)); - impl.textureUsage = NXT_TEXTURE_USAGE_BIT_PRESENT; + impl.textureUsage = DAWN_TEXTURE_USAGE_BIT_PRESENT; return impl; } - nxtTextureFormat GetNativeSwapChainPreferredFormat( + dawnTextureFormat GetNativeSwapChainPreferredFormat( const dawnSwapChainImplementation* swapChain) { NativeSwapChainImpl* impl = reinterpret_cast(swapChain->userData); - return static_cast(impl->GetPreferredFormat()); + return static_cast(impl->GetPreferredFormat()); } void ASSERT_SUCCESS(HRESULT hr) { diff --git a/src/backend/d3d12/NativeSwapChainImplD3D12.cpp b/src/backend/d3d12/NativeSwapChainImplD3D12.cpp index 577116df9d..aa49e76e57 100644 --- a/src/backend/d3d12/NativeSwapChainImplD3D12.cpp +++ b/src/backend/d3d12/NativeSwapChainImplD3D12.cpp @@ -21,15 +21,15 @@ namespace backend { namespace d3d12 { namespace { - DXGI_USAGE D3D12SwapChainBufferUsage(nxtTextureUsageBit allowedUsages) { + DXGI_USAGE D3D12SwapChainBufferUsage(dawnTextureUsageBit allowedUsages) { DXGI_USAGE usage = DXGI_CPU_ACCESS_NONE; - if (allowedUsages & NXT_TEXTURE_USAGE_BIT_SAMPLED) { + if (allowedUsages & DAWN_TEXTURE_USAGE_BIT_SAMPLED) { usage |= DXGI_USAGE_SHADER_INPUT; } - if (allowedUsages & NXT_TEXTURE_USAGE_BIT_STORAGE) { + if (allowedUsages & DAWN_TEXTURE_USAGE_BIT_STORAGE) { usage |= DXGI_USAGE_UNORDERED_ACCESS; } - if (allowedUsages & NXT_TEXTURE_USAGE_BIT_OUTPUT_ATTACHMENT) { + if (allowedUsages & DAWN_TEXTURE_USAGE_BIT_OUTPUT_ATTACHMENT) { usage |= DXGI_USAGE_RENDER_TARGET_OUTPUT; } return usage; @@ -48,13 +48,13 @@ namespace backend { namespace d3d12 { void NativeSwapChainImpl::Init(dawnWSIContextD3D12* /*context*/) { } - dawnSwapChainError NativeSwapChainImpl::Configure(nxtTextureFormat format, - nxtTextureUsageBit usage, + dawnSwapChainError NativeSwapChainImpl::Configure(dawnTextureFormat format, + dawnTextureUsageBit 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/backend/d3d12/NativeSwapChainImplD3D12.h b/src/backend/d3d12/NativeSwapChainImplD3D12.h index 6a461b3141..ea0ef49508 100644 --- a/src/backend/d3d12/NativeSwapChainImplD3D12.h +++ b/src/backend/d3d12/NativeSwapChainImplD3D12.h @@ -34,8 +34,8 @@ namespace backend { namespace d3d12 { ~NativeSwapChainImpl(); void Init(dawnWSIContextD3D12* context); - dawnSwapChainError Configure(nxtTextureFormat format, - nxtTextureUsageBit, + dawnSwapChainError Configure(dawnTextureFormat format, + dawnTextureUsageBit, uint32_t width, uint32_t height); dawnSwapChainError GetNextTexture(dawnSwapChainNextTexture* nextTexture); diff --git a/src/backend/d3d12/SwapChainD3D12.cpp b/src/backend/d3d12/SwapChainD3D12.cpp index 2b2ff4714f..e5a3fbf956 100644 --- a/src/backend/d3d12/SwapChainD3D12.cpp +++ b/src/backend/d3d12/SwapChainD3D12.cpp @@ -24,10 +24,10 @@ namespace backend { namespace d3d12 { SwapChain::SwapChain(SwapChainBuilder* builder) : SwapChainBase(builder) { const auto& im = GetImplementation(); dawnWSIContextD3D12 wsiContext = {}; - wsiContext.device = reinterpret_cast(GetDevice()); + wsiContext.device = reinterpret_cast(GetDevice()); im.Init(im.userData, &wsiContext); - ASSERT(im.textureUsage != NXT_TEXTURE_USAGE_BIT_NONE); + ASSERT(im.textureUsage != DAWN_TEXTURE_USAGE_BIT_NONE); mTextureUsage = static_cast(im.textureUsage); } diff --git a/src/backend/metal/BufferMTL.mm b/src/backend/metal/BufferMTL.mm index 67ef3a516b..3043092350 100644 --- a/src/backend/metal/BufferMTL.mm +++ b/src/backend/metal/BufferMTL.mm @@ -43,9 +43,9 @@ namespace backend { namespace metal { void Buffer::OnMapCommandSerialFinished(uint32_t mapSerial, uint32_t offset, bool isWrite) { char* data = reinterpret_cast([mMtlBuffer contents]); if (isWrite) { - CallMapWriteCallback(mapSerial, NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, data + offset); + CallMapWriteCallback(mapSerial, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, data + offset); } else { - CallMapReadCallback(mapSerial, NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, data + offset); + CallMapReadCallback(mapSerial, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, data + offset); } } diff --git a/src/backend/metal/DeviceMTL.mm b/src/backend/metal/DeviceMTL.mm index 7fd6b49faf..1dc51dbfdd 100644 --- a/src/backend/metal/DeviceMTL.mm +++ b/src/backend/metal/DeviceMTL.mm @@ -38,11 +38,11 @@ namespace backend { namespace metal { nxtProcTable GetNonValidatingProcs(); nxtProcTable GetValidatingProcs(); - void Init(id metalDevice, nxtProcTable* procs, nxtDevice* device) { + void Init(id metalDevice, nxtProcTable* procs, dawnDevice* device) { *device = nullptr; *procs = GetValidatingProcs(); - *device = reinterpret_cast(new Device(metalDevice)); + *device = reinterpret_cast(new Device(metalDevice)); } // Device diff --git a/src/backend/null/NullBackend.cpp b/src/backend/null/NullBackend.cpp index bc02d49a9c..d2e69da291 100644 --- a/src/backend/null/NullBackend.cpp +++ b/src/backend/null/NullBackend.cpp @@ -23,9 +23,9 @@ namespace backend { namespace null { nxtProcTable GetNonValidatingProcs(); nxtProcTable GetValidatingProcs(); - void Init(nxtProcTable* procs, nxtDevice* device) { + void Init(nxtProcTable* procs, dawnDevice* device) { *procs = GetValidatingProcs(); - *device = reinterpret_cast(new Device); + *device = reinterpret_cast(new Device); } // Device @@ -135,9 +135,9 @@ namespace backend { namespace null { void Buffer::MapReadOperationCompleted(uint32_t serial, void* ptr, bool isWrite) { if (isWrite) { - CallMapWriteCallback(serial, NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, ptr); + CallMapWriteCallback(serial, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, ptr); } else { - CallMapReadCallback(serial, NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, ptr); + CallMapReadCallback(serial, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, ptr); } } diff --git a/src/backend/opengl/BufferGL.cpp b/src/backend/opengl/BufferGL.cpp index 92831e2e1c..be38f38a84 100644 --- a/src/backend/opengl/BufferGL.cpp +++ b/src/backend/opengl/BufferGL.cpp @@ -38,7 +38,7 @@ namespace backend { namespace opengl { // version of OpenGL that would let us map the buffer unsynchronized. glBindBuffer(GL_ARRAY_BUFFER, mBuffer); void* data = glMapBufferRange(GL_ARRAY_BUFFER, start, count, GL_MAP_READ_BIT); - CallMapReadCallback(serial, NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, data); + CallMapReadCallback(serial, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, data); } void Buffer::MapWriteAsyncImpl(uint32_t serial, uint32_t start, uint32_t count) { @@ -46,7 +46,7 @@ namespace backend { namespace opengl { // version of OpenGL that would let us map the buffer unsynchronized. glBindBuffer(GL_ARRAY_BUFFER, mBuffer); void* data = glMapBufferRange(GL_ARRAY_BUFFER, start, count, GL_MAP_WRITE_BIT); - CallMapWriteCallback(serial, NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, data); + CallMapWriteCallback(serial, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, data); } void Buffer::UnmapImpl() { diff --git a/src/backend/opengl/DeviceGL.cpp b/src/backend/opengl/DeviceGL.cpp index fbf188a719..a5798a8057 100644 --- a/src/backend/opengl/DeviceGL.cpp +++ b/src/backend/opengl/DeviceGL.cpp @@ -35,13 +35,13 @@ namespace backend { namespace opengl { nxtProcTable GetNonValidatingProcs(); nxtProcTable GetValidatingProcs(); - void Init(void* (*getProc)(const char*), nxtProcTable* procs, nxtDevice* device) { + void Init(void* (*getProc)(const char*), nxtProcTable* procs, dawnDevice* device) { *device = nullptr; gladLoadGLLoader(reinterpret_cast(getProc)); *procs = GetValidatingProcs(); - *device = reinterpret_cast(new Device); + *device = reinterpret_cast(new Device); glEnable(GL_DEPTH_TEST); glEnable(GL_SCISSOR_TEST); diff --git a/src/backend/vulkan/BufferVk.cpp b/src/backend/vulkan/BufferVk.cpp index 57a4c19526..885e455972 100644 --- a/src/backend/vulkan/BufferVk.cpp +++ b/src/backend/vulkan/BufferVk.cpp @@ -150,11 +150,11 @@ namespace backend { namespace vulkan { } void Buffer::OnMapReadCommandSerialFinished(uint32_t mapSerial, const void* data) { - CallMapReadCallback(mapSerial, NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, data); + CallMapReadCallback(mapSerial, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, data); } void Buffer::OnMapWriteCommandSerialFinished(uint32_t mapSerial, void* data) { - CallMapWriteCallback(mapSerial, NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, data); + CallMapWriteCallback(mapSerial, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, data); } VkBuffer Buffer::GetHandle() const { diff --git a/src/backend/vulkan/DeviceVk.cpp b/src/backend/vulkan/DeviceVk.cpp index 2c8de6b729..feda37926b 100644 --- a/src/backend/vulkan/DeviceVk.cpp +++ b/src/backend/vulkan/DeviceVk.cpp @@ -56,31 +56,31 @@ namespace backend { namespace vulkan { nxtProcTable GetValidatingProcs(); void Init(nxtProcTable* procs, - nxtDevice* device, + dawnDevice* device, const std::vector& requiredInstanceExtensions) { *procs = GetValidatingProcs(); - *device = reinterpret_cast(new Device(requiredInstanceExtensions)); + *device = reinterpret_cast(new Device(requiredInstanceExtensions)); } - VkInstance GetInstance(nxtDevice device) { + VkInstance GetInstance(dawnDevice device) { Device* backendDevice = reinterpret_cast(device); return backendDevice->GetInstance(); } - dawnSwapChainImplementation CreateNativeSwapChainImpl(nxtDevice device, VkSurfaceKHR surface) { + dawnSwapChainImplementation CreateNativeSwapChainImpl(dawnDevice device, VkSurfaceKHR surface) { Device* backendDevice = reinterpret_cast(device); dawnSwapChainImplementation impl; impl = CreateSwapChainImplementation(new NativeSwapChainImpl(backendDevice, surface)); - impl.textureUsage = NXT_TEXTURE_USAGE_BIT_PRESENT; + impl.textureUsage = DAWN_TEXTURE_USAGE_BIT_PRESENT; return impl; } - nxtTextureFormat GetNativeSwapChainPreferredFormat( + dawnTextureFormat GetNativeSwapChainPreferredFormat( const dawnSwapChainImplementation* swapChain) { NativeSwapChainImpl* impl = reinterpret_cast(swapChain->userData); - return static_cast(impl->GetPreferredFormat()); + return static_cast(impl->GetPreferredFormat()); } // Device diff --git a/src/backend/vulkan/NativeSwapChainImplVk.cpp b/src/backend/vulkan/NativeSwapChainImplVk.cpp index f8c985f5e4..f3b8758d75 100644 --- a/src/backend/vulkan/NativeSwapChainImplVk.cpp +++ b/src/backend/vulkan/NativeSwapChainImplVk.cpp @@ -67,8 +67,8 @@ namespace backend { namespace vulkan { } } - dawnSwapChainError NativeSwapChainImpl::Configure(nxtTextureFormat format, - nxtTextureUsageBit usage, + dawnSwapChainError NativeSwapChainImpl::Configure(dawnTextureFormat format, + dawnTextureUsageBit usage, uint32_t width, uint32_t height) { ASSERT(mInfo.capabilities.minImageExtent.width <= width); @@ -76,7 +76,7 @@ namespace backend { 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/backend/vulkan/NativeSwapChainImplVk.h b/src/backend/vulkan/NativeSwapChainImplVk.h index dbb29ab030..462ebfef8c 100644 --- a/src/backend/vulkan/NativeSwapChainImplVk.h +++ b/src/backend/vulkan/NativeSwapChainImplVk.h @@ -32,8 +32,8 @@ namespace backend { namespace vulkan { ~NativeSwapChainImpl(); void Init(dawnWSIContextVulkan* context); - dawnSwapChainError Configure(nxtTextureFormat format, - nxtTextureUsageBit, + dawnSwapChainError Configure(dawnTextureFormat format, + dawnTextureUsageBit, uint32_t width, uint32_t height); dawnSwapChainError GetNextTexture(dawnSwapChainNextTexture* nextTexture); diff --git a/src/backend/vulkan/SwapChainVk.cpp b/src/backend/vulkan/SwapChainVk.cpp index 953bb63370..7f73a56897 100644 --- a/src/backend/vulkan/SwapChainVk.cpp +++ b/src/backend/vulkan/SwapChainVk.cpp @@ -24,7 +24,7 @@ namespace backend { namespace vulkan { dawnWSIContextVulkan wsiContext = {}; im.Init(im.userData, &wsiContext); - ASSERT(im.textureUsage != NXT_TEXTURE_USAGE_BIT_NONE); + ASSERT(im.textureUsage != DAWN_TEXTURE_USAGE_BIT_NONE); mTextureUsage = static_cast(im.textureUsage); } diff --git a/src/common/SwapChainUtils.h b/src/common/SwapChainUtils.h index 7bda21b4d7..50733f77f7 100644 --- a/src/common/SwapChainUtils.h +++ b/src/common/SwapChainUtils.h @@ -24,7 +24,7 @@ dawnSwapChainImplementation CreateSwapChainImplementation(T* swapChain) { reinterpret_cast(userData)->Init(ctx); }; impl.Destroy = [](void* userData) { delete reinterpret_cast(userData); }; - impl.Configure = [](void* userData, nxtTextureFormat format, nxtTextureUsageBit allowedUsage, + impl.Configure = [](void* userData, dawnTextureFormat format, dawnTextureUsageBit allowedUsage, uint32_t width, uint32_t height) { return reinterpret_cast(userData)->Configure(format, allowedUsage, width, height); }; diff --git a/src/include/dawn/dawn_wsi.h b/src/include/dawn/dawn_wsi.h index 1d208c961e..148de5b7f1 100644 --- a/src/include/dawn/dawn_wsi.h +++ b/src/include/dawn/dawn_wsi.h @@ -40,8 +40,8 @@ typedef struct { /// Configure/reconfigure the swap chain. dawnSwapChainError (*Configure)(void* userData, - nxtTextureFormat format, - nxtTextureUsageBit allowedUsage, + dawnTextureFormat format, + dawnTextureUsageBit 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. - nxtTextureUsageBit textureUsage; + dawnTextureUsageBit textureUsage; } dawnSwapChainImplementation; #if defined(DAWN_ENABLE_BACKEND_D3D12) && defined(__cplusplus) typedef struct { - nxtDevice device = nullptr; + dawnDevice device = nullptr; } dawnWSIContextD3D12; #endif diff --git a/src/tests/NXTTest.cpp b/src/tests/NXTTest.cpp index 9b264e4055..bc7b875d05 100644 --- a/src/tests/NXTTest.cpp +++ b/src/tests/NXTTest.cpp @@ -86,7 +86,7 @@ namespace { // End2end tests should test valid commands produce the expected result so no error // should happen. Failure cases should be tested in the validation tests. - void DeviceErrorCauseTestFailure(const char* message, nxtCallbackUserdata) { + void DeviceErrorCauseTestFailure(const char* message, dawnCallbackUserdata) { FAIL() << "Device level failure: " << message; } @@ -136,12 +136,12 @@ void NXTTest::SetUp() { mBinding->SetWindow(testWindow); - nxtDevice backendDevice; + dawnDevice backendDevice; nxtProcTable backendProcs; mBinding->GetProcAndDevice(&backendProcs, &backendDevice); // Choose whether to use the backend procs and devices directly, or set up the wire. - nxtDevice cDevice = nullptr; + dawnDevice cDevice = nullptr; nxtProcTable procs; if (gTestUsesWire) { @@ -151,7 +151,7 @@ void NXTTest::SetUp() { mWireServer = dawn::wire::NewServerCommandHandler(backendDevice, backendProcs, mS2cBuf); mC2sBuf->SetHandler(mWireServer); - nxtDevice clientDevice; + dawnDevice clientDevice; nxtProcTable clientProcs; mWireClient = dawn::wire::NewClientDevice(&clientProcs, &clientDevice, mC2sBuf); mS2cBuf->SetHandler(mWireClient); @@ -320,10 +320,10 @@ void NXTTest::MapSlotsSynchronously() { } // static -void NXTTest::SlotMapReadCallback(nxtBufferMapAsyncStatus status, +void NXTTest::SlotMapReadCallback(dawnBufferMapAsyncStatus status, const void* data, - nxtCallbackUserdata userdata_) { - DAWN_ASSERT(status == NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS); + dawnCallbackUserdata userdata_) { + DAWN_ASSERT(status == DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS); auto userdata = reinterpret_cast(static_cast(userdata_)); userdata->test->mReadbackSlots[userdata->slot].mappedData = data; diff --git a/src/tests/NXTTest.h b/src/tests/NXTTest.h index 9be9b486e4..7b50eb6a29 100644 --- a/src/tests/NXTTest.h +++ b/src/tests/NXTTest.h @@ -128,9 +128,9 @@ class NXTTest : public ::testing::TestWithParam { // Maps all the buffers and fill ReadbackSlot::mappedData void MapSlotsSynchronously(); - static void SlotMapReadCallback(nxtBufferMapAsyncStatus status, + static void SlotMapReadCallback(dawnBufferMapAsyncStatus status, const void* data, - nxtCallbackUserdata userdata); + dawnCallbackUserdata userdata); size_t mNumPendingMapOperations = 0; // Reserve space where the data for an expectation can be copied diff --git a/src/tests/end2end/BufferTests.cpp b/src/tests/end2end/BufferTests.cpp index 7b77c207b1..8e3661a8a0 100644 --- a/src/tests/end2end/BufferTests.cpp +++ b/src/tests/end2end/BufferTests.cpp @@ -19,8 +19,8 @@ class BufferMapReadTests : public NXTTest { protected: - static void MapReadCallback(nxtBufferMapAsyncStatus status, const void* data, nxtCallbackUserdata userdata) { - ASSERT_EQ(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, status); + static void MapReadCallback(dawnBufferMapAsyncStatus status, const void* data, dawnCallbackUserdata userdata) { + ASSERT_EQ(DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, status); ASSERT_NE(nullptr, data); auto test = reinterpret_cast(static_cast(userdata)); @@ -115,8 +115,8 @@ NXT_INSTANTIATE_TEST(BufferMapReadTests, D3D12Backend, MetalBackend, OpenGLBacke class BufferMapWriteTests : public NXTTest { protected: - static void MapWriteCallback(nxtBufferMapAsyncStatus status, void* data, nxtCallbackUserdata userdata) { - ASSERT_EQ(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, status); + static void MapWriteCallback(dawnBufferMapAsyncStatus status, void* data, dawnCallbackUserdata userdata) { + ASSERT_EQ(DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, status); ASSERT_NE(nullptr, data); auto test = reinterpret_cast(static_cast(userdata)); diff --git a/src/tests/unittests/WireTests.cpp b/src/tests/unittests/WireTests.cpp index 9f558a1c5d..b7a5aecfb8 100644 --- a/src/tests/unittests/WireTests.cpp +++ b/src/tests/unittests/WireTests.cpp @@ -73,43 +73,43 @@ inline Matcher> MatchesLambda(Lambda lambda) { // Mock classes to add expectations on the wire calling callbacks class MockDeviceErrorCallback { public: - MOCK_METHOD2(Call, void(const char* message, nxtCallbackUserdata userdata)); + MOCK_METHOD2(Call, void(const char* message, dawnCallbackUserdata userdata)); }; static MockDeviceErrorCallback* mockDeviceErrorCallback = nullptr; -static void ToMockDeviceErrorCallback(const char* message, nxtCallbackUserdata userdata) { +static void ToMockDeviceErrorCallback(const char* message, dawnCallbackUserdata userdata) { mockDeviceErrorCallback->Call(message, userdata); } class MockBuilderErrorCallback { public: - MOCK_METHOD4(Call, void(nxtBuilderErrorStatus status, const char* message, nxtCallbackUserdata userdata1, nxtCallbackUserdata userdata2)); + MOCK_METHOD4(Call, void(dawnBuilderErrorStatus status, const char* message, dawnCallbackUserdata userdata1, dawnCallbackUserdata userdata2)); }; static MockBuilderErrorCallback* mockBuilderErrorCallback = nullptr; -static void ToMockBuilderErrorCallback(nxtBuilderErrorStatus status, const char* message, nxtCallbackUserdata userdata1, nxtCallbackUserdata userdata2) { +static void ToMockBuilderErrorCallback(dawnBuilderErrorStatus status, const char* message, dawnCallbackUserdata userdata1, dawnCallbackUserdata userdata2) { mockBuilderErrorCallback->Call(status, message, userdata1, userdata2); } class MockBufferMapReadCallback { public: - MOCK_METHOD3(Call, void(nxtBufferMapAsyncStatus status, const uint32_t* ptr, nxtCallbackUserdata userdata)); + MOCK_METHOD3(Call, void(dawnBufferMapAsyncStatus status, const uint32_t* ptr, dawnCallbackUserdata userdata)); }; static MockBufferMapReadCallback* mockBufferMapReadCallback = nullptr; -static void ToMockBufferMapReadCallback(nxtBufferMapAsyncStatus status, const void* ptr, nxtCallbackUserdata userdata) { +static void ToMockBufferMapReadCallback(dawnBufferMapAsyncStatus status, const void* ptr, dawnCallbackUserdata userdata) { // Assume the data is uint32_t to make writing matchers easier mockBufferMapReadCallback->Call(status, static_cast(ptr), userdata); } class MockBufferMapWriteCallback { public: - MOCK_METHOD3(Call, void(nxtBufferMapAsyncStatus status, uint32_t* ptr, nxtCallbackUserdata userdata)); + MOCK_METHOD3(Call, void(dawnBufferMapAsyncStatus status, uint32_t* ptr, dawnCallbackUserdata userdata)); }; static MockBufferMapWriteCallback* mockBufferMapWriteCallback = nullptr; uint32_t* lastMapWritePointer = nullptr; -static void ToMockBufferMapWriteCallback(nxtBufferMapAsyncStatus status, void* ptr, nxtCallbackUserdata userdata) { +static void ToMockBufferMapWriteCallback(dawnBufferMapAsyncStatus status, void* ptr, dawnCallbackUserdata userdata) { // Assume the data is uint32_t to make writing matchers easier lastMapWritePointer = static_cast(ptr); mockBufferMapWriteCallback->Call(status, lastMapWritePointer, userdata); @@ -128,7 +128,7 @@ class WireTestsBase : public Test { mockBufferMapWriteCallback = new MockBufferMapWriteCallback; nxtProcTable mockProcs; - nxtDevice mockDevice; + dawnDevice mockDevice; api.GetProcTableAndDevice(&mockProcs, &mockDevice); // This SetCallback call cannot be ignored because it is done as soon as we start the server @@ -173,8 +173,8 @@ class WireTestsBase : public Test { } MockProcTable api; - nxtDevice apiDevice; - nxtDevice device; + dawnDevice apiDevice; + dawnDevice device; private: bool mIgnoreSetCallbackCalls = false; @@ -193,9 +193,9 @@ class WireTests : public WireTestsBase { // One call gets forwarded correctly. TEST_F(WireTests, CallForwarded) { - nxtDeviceCreateCommandBufferBuilder(device); + dawnDeviceCreateCommandBufferBuilder(device); - nxtCommandBufferBuilder apiCmdBufBuilder = api.GetNewCommandBufferBuilder(); + dawnCommandBufferBuilder apiCmdBufBuilder = api.GetNewCommandBufferBuilder(); EXPECT_CALL(api, DeviceCreateCommandBufferBuilder(apiDevice)) .WillOnce(Return(apiCmdBufBuilder)); @@ -204,14 +204,14 @@ TEST_F(WireTests, CallForwarded) { // Test that calling methods on a new object works as expected. TEST_F(WireTests, CreateThenCall) { - nxtCommandBufferBuilder builder = nxtDeviceCreateCommandBufferBuilder(device); - nxtCommandBufferBuilderGetResult(builder); + dawnCommandBufferBuilder builder = dawnDeviceCreateCommandBufferBuilder(device); + dawnCommandBufferBuilderGetResult(builder); - nxtCommandBufferBuilder apiCmdBufBuilder = api.GetNewCommandBufferBuilder(); + dawnCommandBufferBuilder apiCmdBufBuilder = api.GetNewCommandBufferBuilder(); EXPECT_CALL(api, DeviceCreateCommandBufferBuilder(apiDevice)) .WillOnce(Return(apiCmdBufBuilder)); - nxtCommandBuffer apiCmdBuf = api.GetNewCommandBuffer(); + dawnCommandBuffer apiCmdBuf = api.GetNewCommandBuffer(); EXPECT_CALL(api, CommandBufferBuilderGetResult(apiCmdBufBuilder)) .WillOnce(Return(apiCmdBuf)); @@ -220,12 +220,12 @@ TEST_F(WireTests, CreateThenCall) { // Test that client reference/release do not call the backend API. TEST_F(WireTests, RefCountKeptInClient) { - nxtCommandBufferBuilder builder = nxtDeviceCreateCommandBufferBuilder(device); + dawnCommandBufferBuilder builder = dawnDeviceCreateCommandBufferBuilder(device); - nxtCommandBufferBuilderReference(builder); - nxtCommandBufferBuilderRelease(builder); + dawnCommandBufferBuilderReference(builder); + dawnCommandBufferBuilderRelease(builder); - nxtCommandBufferBuilder apiCmdBufBuilder = api.GetNewCommandBufferBuilder(); + dawnCommandBufferBuilder apiCmdBufBuilder = api.GetNewCommandBufferBuilder(); EXPECT_CALL(api, DeviceCreateCommandBufferBuilder(apiDevice)) .WillOnce(Return(apiCmdBufBuilder)); @@ -234,11 +234,11 @@ TEST_F(WireTests, RefCountKeptInClient) { // Test that client reference/release do not call the backend API. TEST_F(WireTests, ReleaseCalledOnRefCount0) { - nxtCommandBufferBuilder builder = nxtDeviceCreateCommandBufferBuilder(device); + dawnCommandBufferBuilder builder = dawnDeviceCreateCommandBufferBuilder(device); - nxtCommandBufferBuilderRelease(builder); + dawnCommandBufferBuilderRelease(builder); - nxtCommandBufferBuilder apiCmdBufBuilder = api.GetNewCommandBufferBuilder(); + dawnCommandBufferBuilder apiCmdBufBuilder = api.GetNewCommandBufferBuilder(); EXPECT_CALL(api, DeviceCreateCommandBufferBuilder(apiDevice)) .WillOnce(Return(apiCmdBufBuilder)); @@ -249,10 +249,10 @@ TEST_F(WireTests, ReleaseCalledOnRefCount0) { // Test that the wire is able to send numerical values TEST_F(WireTests, ValueArgument) { - nxtCommandBufferBuilder builder = nxtDeviceCreateCommandBufferBuilder(device); - nxtCommandBufferBuilderDispatch(builder, 1, 2, 3); + dawnCommandBufferBuilder builder = dawnDeviceCreateCommandBufferBuilder(device); + dawnCommandBufferBuilderDispatch(builder, 1, 2, 3); - nxtCommandBufferBuilder apiBuilder = api.GetNewCommandBufferBuilder(); + dawnCommandBufferBuilder apiBuilder = api.GetNewCommandBufferBuilder(); EXPECT_CALL(api, DeviceCreateCommandBufferBuilder(apiDevice)) .WillOnce(Return(apiBuilder)); @@ -280,14 +280,14 @@ bool CheckPushConstantValues(const uint32_t* values) { } TEST_F(WireTests, ValueArrayArgument) { - nxtCommandBufferBuilder builder = nxtDeviceCreateCommandBufferBuilder(device); - nxtCommandBufferBuilderSetPushConstants(builder, NXT_SHADER_STAGE_BIT_VERTEX, 0, 4, testPushConstantValues); + dawnCommandBufferBuilder builder = dawnDeviceCreateCommandBufferBuilder(device); + dawnCommandBufferBuilderSetPushConstants(builder, DAWN_SHADER_STAGE_BIT_VERTEX, 0, 4, testPushConstantValues); - nxtCommandBufferBuilder apiBuilder = api.GetNewCommandBufferBuilder(); + dawnCommandBufferBuilder apiBuilder = api.GetNewCommandBufferBuilder(); EXPECT_CALL(api, DeviceCreateCommandBufferBuilder(apiDevice)) .WillOnce(Return(apiBuilder)); - EXPECT_CALL(api, CommandBufferBuilderSetPushConstants(apiBuilder, NXT_SHADER_STAGE_BIT_VERTEX, 0, 4, ResultOf(CheckPushConstantValues, Eq(true)))); + EXPECT_CALL(api, CommandBufferBuilderSetPushConstants(apiBuilder, DAWN_SHADER_STAGE_BIT_VERTEX, 0, 4, ResultOf(CheckPushConstantValues, Eq(true)))); FlushClient(); } @@ -295,26 +295,26 @@ TEST_F(WireTests, ValueArrayArgument) { // Test that the wire is able to send C strings TEST_F(WireTests, CStringArgument) { // Create shader module - nxtShaderModuleBuilder shaderModuleBuilder = nxtDeviceCreateShaderModuleBuilder(device); - nxtShaderModule shaderModule = nxtShaderModuleBuilderGetResult(shaderModuleBuilder); + dawnShaderModuleBuilder shaderModuleBuilder = dawnDeviceCreateShaderModuleBuilder(device); + dawnShaderModule shaderModule = dawnShaderModuleBuilderGetResult(shaderModuleBuilder); - nxtShaderModuleBuilder apiShaderModuleBuilder = api.GetNewShaderModuleBuilder(); + dawnShaderModuleBuilder apiShaderModuleBuilder = api.GetNewShaderModuleBuilder(); EXPECT_CALL(api, DeviceCreateShaderModuleBuilder(apiDevice)) .WillOnce(Return(apiShaderModuleBuilder)); - nxtShaderModule apiShaderModule = api.GetNewShaderModule(); + dawnShaderModule apiShaderModule = api.GetNewShaderModule(); EXPECT_CALL(api, ShaderModuleBuilderGetResult(apiShaderModuleBuilder)) .WillOnce(Return(apiShaderModule)); // Create pipeline - nxtRenderPipelineBuilder pipelineBuilder = nxtDeviceCreateRenderPipelineBuilder(device); - nxtRenderPipelineBuilderSetStage(pipelineBuilder, NXT_SHADER_STAGE_FRAGMENT, shaderModule, "my entry point"); + dawnRenderPipelineBuilder pipelineBuilder = dawnDeviceCreateRenderPipelineBuilder(device); + dawnRenderPipelineBuilderSetStage(pipelineBuilder, DAWN_SHADER_STAGE_FRAGMENT, shaderModule, "my entry point"); - nxtRenderPipelineBuilder apiPipelineBuilder = api.GetNewRenderPipelineBuilder(); + dawnRenderPipelineBuilder apiPipelineBuilder = api.GetNewRenderPipelineBuilder(); EXPECT_CALL(api, DeviceCreateRenderPipelineBuilder(apiDevice)) .WillOnce(Return(apiPipelineBuilder)); - EXPECT_CALL(api, RenderPipelineBuilderSetStage(apiPipelineBuilder, NXT_SHADER_STAGE_FRAGMENT, apiShaderModule, StrEq("my entry point"))); + EXPECT_CALL(api, RenderPipelineBuilderSetStage(apiPipelineBuilder, DAWN_SHADER_STAGE_FRAGMENT, apiShaderModule, StrEq("my entry point"))); FlushClient(); } @@ -322,22 +322,22 @@ TEST_F(WireTests, CStringArgument) { // Test that the wire is able to send objects as value arguments TEST_F(WireTests, ObjectAsValueArgument) { // Create pipeline - nxtRenderPipelineBuilder pipelineBuilder = nxtDeviceCreateRenderPipelineBuilder(device); - nxtRenderPipeline pipeline = nxtRenderPipelineBuilderGetResult(pipelineBuilder); + dawnRenderPipelineBuilder pipelineBuilder = dawnDeviceCreateRenderPipelineBuilder(device); + dawnRenderPipeline pipeline = dawnRenderPipelineBuilderGetResult(pipelineBuilder); - nxtRenderPipelineBuilder apiPipelineBuilder = api.GetNewRenderPipelineBuilder(); + dawnRenderPipelineBuilder apiPipelineBuilder = api.GetNewRenderPipelineBuilder(); EXPECT_CALL(api, DeviceCreateRenderPipelineBuilder(apiDevice)) .WillOnce(Return(apiPipelineBuilder)); - nxtRenderPipeline apiPipeline = api.GetNewRenderPipeline(); + dawnRenderPipeline apiPipeline = api.GetNewRenderPipeline(); EXPECT_CALL(api, RenderPipelineBuilderGetResult(apiPipelineBuilder)) .WillOnce(Return(apiPipeline)); // Create command buffer builder, setting pipeline - nxtCommandBufferBuilder cmdBufBuilder = nxtDeviceCreateCommandBufferBuilder(device); - nxtCommandBufferBuilderSetRenderPipeline(cmdBufBuilder, pipeline); + dawnCommandBufferBuilder cmdBufBuilder = dawnDeviceCreateCommandBufferBuilder(device); + dawnCommandBufferBuilderSetRenderPipeline(cmdBufBuilder, pipeline); - nxtCommandBufferBuilder apiCmdBufBuilder = api.GetNewCommandBufferBuilder(); + dawnCommandBufferBuilder apiCmdBufBuilder = api.GetNewCommandBufferBuilder(); EXPECT_CALL(api, DeviceCreateCommandBufferBuilder(apiDevice)) .WillOnce(Return(apiCmdBufBuilder)); @@ -348,17 +348,17 @@ TEST_F(WireTests, ObjectAsValueArgument) { // Test that the wire is able to send array of objects TEST_F(WireTests, ObjectsAsPointerArgument) { - nxtCommandBuffer cmdBufs[2]; - nxtCommandBuffer apiCmdBufs[2]; + dawnCommandBuffer cmdBufs[2]; + dawnCommandBuffer apiCmdBufs[2]; // Create two command buffers we need to use a GMock sequence otherwise the order of the // CreateCommandBufferBuilder might be swapped since they are equivalent in term of matchers Sequence s; for (int i = 0; i < 2; ++i) { - nxtCommandBufferBuilder cmdBufBuilder = nxtDeviceCreateCommandBufferBuilder(device); - cmdBufs[i] = nxtCommandBufferBuilderGetResult(cmdBufBuilder); + dawnCommandBufferBuilder cmdBufBuilder = dawnDeviceCreateCommandBufferBuilder(device); + cmdBufs[i] = dawnCommandBufferBuilderGetResult(cmdBufBuilder); - nxtCommandBufferBuilder apiCmdBufBuilder = api.GetNewCommandBufferBuilder(); + dawnCommandBufferBuilder apiCmdBufBuilder = api.GetNewCommandBufferBuilder(); EXPECT_CALL(api, DeviceCreateCommandBufferBuilder(apiDevice)) .InSequence(s) .WillOnce(Return(apiCmdBufBuilder)); @@ -369,15 +369,15 @@ TEST_F(WireTests, ObjectsAsPointerArgument) { } // Create queue - nxtQueue queue = nxtDeviceCreateQueue(device); - nxtQueue apiQueue = api.GetNewQueue(); + dawnQueue queue = dawnDeviceCreateQueue(device); + dawnQueue apiQueue = api.GetNewQueue(); EXPECT_CALL(api, DeviceCreateQueue(apiDevice)) .WillOnce(Return(apiQueue)); // Submit command buffer and check we got a call with both API-side command buffers - nxtQueueSubmit(queue, 2, cmdBufs); + dawnQueueSubmit(queue, 2, cmdBufs); - EXPECT_CALL(api, QueueSubmit(apiQueue, 2, MatchesLambda([=](const nxtCommandBuffer* cmdBufs) -> bool { + EXPECT_CALL(api, QueueSubmit(apiQueue, 2, MatchesLambda([=](const dawnCommandBuffer* cmdBufs) -> bool { return cmdBufs[0] == apiCmdBufs[0] && cmdBufs[1] == apiCmdBufs[1]; }))); @@ -386,24 +386,24 @@ TEST_F(WireTests, ObjectsAsPointerArgument) { // Test that the wire is able to send structures that contain pure values (non-objects) TEST_F(WireTests, StructureOfValuesArgument) { - nxtSamplerDescriptor descriptor; + dawnSamplerDescriptor descriptor; descriptor.nextInChain = nullptr; - descriptor.magFilter = NXT_FILTER_MODE_LINEAR; - descriptor.minFilter = NXT_FILTER_MODE_NEAREST; - descriptor.mipmapFilter = NXT_FILTER_MODE_LINEAR; - descriptor.addressModeU = NXT_ADDRESS_MODE_CLAMP_TO_EDGE; - descriptor.addressModeV = NXT_ADDRESS_MODE_REPEAT; - descriptor.addressModeW = NXT_ADDRESS_MODE_MIRRORED_REPEAT; + descriptor.magFilter = DAWN_FILTER_MODE_LINEAR; + descriptor.minFilter = DAWN_FILTER_MODE_NEAREST; + descriptor.mipmapFilter = DAWN_FILTER_MODE_LINEAR; + descriptor.addressModeU = DAWN_ADDRESS_MODE_CLAMP_TO_EDGE; + descriptor.addressModeV = DAWN_ADDRESS_MODE_REPEAT; + descriptor.addressModeW = DAWN_ADDRESS_MODE_MIRRORED_REPEAT; - nxtDeviceCreateSampler(device, &descriptor); - EXPECT_CALL(api, DeviceCreateSampler(apiDevice, MatchesLambda([](const nxtSamplerDescriptor* desc) -> bool { + dawnDeviceCreateSampler(device, &descriptor); + EXPECT_CALL(api, DeviceCreateSampler(apiDevice, MatchesLambda([](const dawnSamplerDescriptor* desc) -> bool { return desc->nextInChain == nullptr && - desc->magFilter == NXT_FILTER_MODE_LINEAR && - desc->minFilter == NXT_FILTER_MODE_NEAREST && - desc->mipmapFilter == NXT_FILTER_MODE_LINEAR && - desc->addressModeU == NXT_ADDRESS_MODE_CLAMP_TO_EDGE && - desc->addressModeV == NXT_ADDRESS_MODE_REPEAT && - desc->addressModeW == NXT_ADDRESS_MODE_MIRRORED_REPEAT; + desc->magFilter == DAWN_FILTER_MODE_LINEAR && + desc->minFilter == DAWN_FILTER_MODE_NEAREST && + desc->mipmapFilter == DAWN_FILTER_MODE_LINEAR && + desc->addressModeU == DAWN_ADDRESS_MODE_CLAMP_TO_EDGE && + desc->addressModeV == DAWN_ADDRESS_MODE_REPEAT && + desc->addressModeW == DAWN_ADDRESS_MODE_MIRRORED_REPEAT; }))) .WillOnce(Return(nullptr)); @@ -412,21 +412,21 @@ TEST_F(WireTests, StructureOfValuesArgument) { // Test that the wire is able to send structures that contain objects TEST_F(WireTests, StructureOfObjectArrayArgument) { - nxtBindGroupLayoutDescriptor bglDescriptor; + dawnBindGroupLayoutDescriptor bglDescriptor; bglDescriptor.numBindings = 0; bglDescriptor.bindings = nullptr; - nxtBindGroupLayout bgl = nxtDeviceCreateBindGroupLayout(device, &bglDescriptor); - nxtBindGroupLayout apiBgl = api.GetNewBindGroupLayout(); + dawnBindGroupLayout bgl = dawnDeviceCreateBindGroupLayout(device, &bglDescriptor); + dawnBindGroupLayout apiBgl = api.GetNewBindGroupLayout(); EXPECT_CALL(api, DeviceCreateBindGroupLayout(apiDevice, _)).WillOnce(Return(apiBgl)); - nxtPipelineLayoutDescriptor descriptor; + dawnPipelineLayoutDescriptor descriptor; descriptor.nextInChain = nullptr; descriptor.numBindGroupLayouts = 1; descriptor.bindGroupLayouts = &bgl; - nxtDeviceCreatePipelineLayout(device, &descriptor); - EXPECT_CALL(api, DeviceCreatePipelineLayout(apiDevice, MatchesLambda([apiBgl](const nxtPipelineLayoutDescriptor* desc) -> bool { + dawnDeviceCreatePipelineLayout(device, &descriptor); + EXPECT_CALL(api, DeviceCreatePipelineLayout(apiDevice, MatchesLambda([apiBgl](const dawnPipelineLayoutDescriptor* desc) -> bool { return desc->nextInChain == nullptr && desc->numBindGroupLayouts == 1 && desc->bindGroupLayouts[0] == apiBgl; @@ -439,24 +439,24 @@ TEST_F(WireTests, StructureOfObjectArrayArgument) { // Test that the wire is able to send structures that contain objects TEST_F(WireTests, StructureOfStructureArrayArgument) { static constexpr int NUM_BINDINGS = 3; - nxtBindGroupBinding bindings[NUM_BINDINGS]{ - {0, NXT_SHADER_STAGE_BIT_VERTEX, NXT_BINDING_TYPE_SAMPLER}, - {1, NXT_SHADER_STAGE_BIT_VERTEX, NXT_BINDING_TYPE_SAMPLED_TEXTURE}, + dawnBindGroupBinding bindings[NUM_BINDINGS]{ + {0, DAWN_SHADER_STAGE_BIT_VERTEX, DAWN_BINDING_TYPE_SAMPLER}, + {1, DAWN_SHADER_STAGE_BIT_VERTEX, DAWN_BINDING_TYPE_SAMPLED_TEXTURE}, {2, - static_cast(NXT_SHADER_STAGE_BIT_VERTEX | - NXT_SHADER_STAGE_BIT_FRAGMENT), - NXT_BINDING_TYPE_UNIFORM_BUFFER}, + static_cast(DAWN_SHADER_STAGE_BIT_VERTEX | + DAWN_SHADER_STAGE_BIT_FRAGMENT), + DAWN_BINDING_TYPE_UNIFORM_BUFFER}, }; - nxtBindGroupLayoutDescriptor bglDescriptor; + dawnBindGroupLayoutDescriptor bglDescriptor; bglDescriptor.numBindings = NUM_BINDINGS; bglDescriptor.bindings = bindings; - nxtDeviceCreateBindGroupLayout(device, &bglDescriptor); - nxtBindGroupLayout apiBgl = api.GetNewBindGroupLayout(); + dawnDeviceCreateBindGroupLayout(device, &bglDescriptor); + dawnBindGroupLayout apiBgl = api.GetNewBindGroupLayout(); EXPECT_CALL( api, DeviceCreateBindGroupLayout( - apiDevice, MatchesLambda([bindings](const nxtBindGroupLayoutDescriptor* desc) -> bool { + apiDevice, MatchesLambda([bindings](const dawnBindGroupLayoutDescriptor* desc) -> bool { for (int i = 0; i < NUM_BINDINGS; ++i) { const auto& a = desc->bindings[i]; const auto& b = bindings[i]; @@ -475,30 +475,30 @@ TEST_F(WireTests, StructureOfStructureArrayArgument) { // Test that the server doesn't forward calls to error objects or with error objects // Also test that when GetResult is called on an error builder, the error callback is fired TEST_F(WireTests, CallsSkippedAfterBuilderError) { - nxtCommandBufferBuilder cmdBufBuilder = nxtDeviceCreateCommandBufferBuilder(device); - nxtCommandBufferBuilderSetErrorCallback(cmdBufBuilder, ToMockBuilderErrorCallback, 1, 2); + dawnCommandBufferBuilder cmdBufBuilder = dawnDeviceCreateCommandBufferBuilder(device); + dawnCommandBufferBuilderSetErrorCallback(cmdBufBuilder, ToMockBuilderErrorCallback, 1, 2); - nxtBufferBuilder bufferBuilder = nxtDeviceCreateBufferBuilder(device); - nxtBufferBuilderSetErrorCallback(bufferBuilder, ToMockBuilderErrorCallback, 3, 4); - nxtBuffer buffer = nxtBufferBuilderGetResult(bufferBuilder); // Hey look an error! + dawnBufferBuilder bufferBuilder = dawnDeviceCreateBufferBuilder(device); + dawnBufferBuilderSetErrorCallback(bufferBuilder, ToMockBuilderErrorCallback, 3, 4); + dawnBuffer buffer = dawnBufferBuilderGetResult(bufferBuilder); // Hey look an error! // These calls will be skipped because of the error - nxtBufferSetSubData(buffer, 0, 0, nullptr); - nxtCommandBufferBuilderSetIndexBuffer(cmdBufBuilder, buffer, 0); - nxtCommandBufferBuilderGetResult(cmdBufBuilder); + dawnBufferSetSubData(buffer, 0, 0, nullptr); + dawnCommandBufferBuilderSetIndexBuffer(cmdBufBuilder, buffer, 0); + dawnCommandBufferBuilderGetResult(cmdBufBuilder); - nxtCommandBufferBuilder apiCmdBufBuilder = api.GetNewCommandBufferBuilder(); + dawnCommandBufferBuilder apiCmdBufBuilder = api.GetNewCommandBufferBuilder(); EXPECT_CALL(api, DeviceCreateCommandBufferBuilder(apiDevice)) .WillOnce(Return(apiCmdBufBuilder)); - nxtBufferBuilder apiBufferBuilder = api.GetNewBufferBuilder(); + dawnBufferBuilder apiBufferBuilder = api.GetNewBufferBuilder(); EXPECT_CALL(api, DeviceCreateBufferBuilder(apiDevice)) .WillOnce(Return(apiBufferBuilder)); // Hey look an error! EXPECT_CALL(api, BufferBuilderGetResult(apiBufferBuilder)) - .WillOnce(InvokeWithoutArgs([&]() -> nxtBuffer { - api.CallBuilderErrorCallback(apiBufferBuilder, NXT_BUILDER_ERROR_STATUS_ERROR, "Error"); + .WillOnce(InvokeWithoutArgs([&]() -> dawnBuffer { + api.CallBuilderErrorCallback(apiBufferBuilder, DAWN_BUILDER_ERROR_STATUS_ERROR, "Error"); return nullptr; })); @@ -508,32 +508,32 @@ TEST_F(WireTests, CallsSkippedAfterBuilderError) { FlushClient(); - EXPECT_CALL(*mockBuilderErrorCallback, Call(NXT_BUILDER_ERROR_STATUS_ERROR, _, 1, 2)).Times(1); - EXPECT_CALL(*mockBuilderErrorCallback, Call(NXT_BUILDER_ERROR_STATUS_ERROR, _, 3, 4)).Times(1); + EXPECT_CALL(*mockBuilderErrorCallback, Call(DAWN_BUILDER_ERROR_STATUS_ERROR, _, 1, 2)).Times(1); + EXPECT_CALL(*mockBuilderErrorCallback, Call(DAWN_BUILDER_ERROR_STATUS_ERROR, _, 3, 4)).Times(1); FlushServer(); } // Test that we get a success builder error status when no error happens TEST_F(WireTests, SuccessCallbackOnBuilderSuccess) { - nxtBufferBuilder bufferBuilder = nxtDeviceCreateBufferBuilder(device); - nxtBufferBuilderSetErrorCallback(bufferBuilder, ToMockBuilderErrorCallback, 1, 2); - nxtBufferBuilderGetResult(bufferBuilder); + dawnBufferBuilder bufferBuilder = dawnDeviceCreateBufferBuilder(device); + dawnBufferBuilderSetErrorCallback(bufferBuilder, ToMockBuilderErrorCallback, 1, 2); + dawnBufferBuilderGetResult(bufferBuilder); - nxtBufferBuilder apiBufferBuilder = api.GetNewBufferBuilder(); + dawnBufferBuilder apiBufferBuilder = api.GetNewBufferBuilder(); EXPECT_CALL(api, DeviceCreateBufferBuilder(apiDevice)) .WillOnce(Return(apiBufferBuilder)); - nxtBuffer apiBuffer = api.GetNewBuffer(); + dawnBuffer apiBuffer = api.GetNewBuffer(); EXPECT_CALL(api, BufferBuilderGetResult(apiBufferBuilder)) - .WillOnce(InvokeWithoutArgs([&]() -> nxtBuffer { - api.CallBuilderErrorCallback(apiBufferBuilder, NXT_BUILDER_ERROR_STATUS_SUCCESS, "I like cheese"); + .WillOnce(InvokeWithoutArgs([&]() -> dawnBuffer { + api.CallBuilderErrorCallback(apiBufferBuilder, DAWN_BUILDER_ERROR_STATUS_SUCCESS, "I like cheese"); return apiBuffer; })); FlushClient(); - EXPECT_CALL(*mockBuilderErrorCallback, Call(NXT_BUILDER_ERROR_STATUS_SUCCESS, _ , 1 ,2)); + EXPECT_CALL(*mockBuilderErrorCallback, Call(DAWN_BUILDER_ERROR_STATUS_SUCCESS, _ , 1 ,2)); FlushServer(); } @@ -543,53 +543,53 @@ TEST_F(WireTests, SuccessCallbackOnBuilderSuccess) { TEST_F(WireTests, UnknownBuilderErrorStatusCallback) { // The builder is destroyed before the object is built { - nxtBufferBuilder bufferBuilder = nxtDeviceCreateBufferBuilder(device); - nxtBufferBuilderSetErrorCallback(bufferBuilder, ToMockBuilderErrorCallback, 1, 2); + dawnBufferBuilder bufferBuilder = dawnDeviceCreateBufferBuilder(device); + dawnBufferBuilderSetErrorCallback(bufferBuilder, ToMockBuilderErrorCallback, 1, 2); - EXPECT_CALL(*mockBuilderErrorCallback, Call(NXT_BUILDER_ERROR_STATUS_UNKNOWN, _ , 1 ,2)).Times(1); + EXPECT_CALL(*mockBuilderErrorCallback, Call(DAWN_BUILDER_ERROR_STATUS_UNKNOWN, _ , 1 ,2)).Times(1); - nxtBufferBuilderRelease(bufferBuilder); + dawnBufferBuilderRelease(bufferBuilder); } // If the builder has been consumed, it doesn't fire the callback with unknown { - nxtBufferBuilder bufferBuilder = nxtDeviceCreateBufferBuilder(device); - nxtBufferBuilderSetErrorCallback(bufferBuilder, ToMockBuilderErrorCallback, 3, 4); - nxtBufferBuilderGetResult(bufferBuilder); + dawnBufferBuilder bufferBuilder = dawnDeviceCreateBufferBuilder(device); + dawnBufferBuilderSetErrorCallback(bufferBuilder, ToMockBuilderErrorCallback, 3, 4); + dawnBufferBuilderGetResult(bufferBuilder); - EXPECT_CALL(*mockBuilderErrorCallback, Call(NXT_BUILDER_ERROR_STATUS_UNKNOWN, _ , 3, 4)).Times(0); + EXPECT_CALL(*mockBuilderErrorCallback, Call(DAWN_BUILDER_ERROR_STATUS_UNKNOWN, _ , 3, 4)).Times(0); - nxtBufferBuilderRelease(bufferBuilder); + dawnBufferBuilderRelease(bufferBuilder); } // If the builder has been consumed, and the object is destroyed before the result comes from the server, // then the callback is fired with unknown { - nxtBufferBuilder bufferBuilder = nxtDeviceCreateBufferBuilder(device); - nxtBufferBuilderSetErrorCallback(bufferBuilder, ToMockBuilderErrorCallback, 5, 6); - nxtBuffer buffer = nxtBufferBuilderGetResult(bufferBuilder); + dawnBufferBuilder bufferBuilder = dawnDeviceCreateBufferBuilder(device); + dawnBufferBuilderSetErrorCallback(bufferBuilder, ToMockBuilderErrorCallback, 5, 6); + dawnBuffer buffer = dawnBufferBuilderGetResult(bufferBuilder); - EXPECT_CALL(*mockBuilderErrorCallback, Call(NXT_BUILDER_ERROR_STATUS_UNKNOWN, _ , 5, 6)).Times(1); + EXPECT_CALL(*mockBuilderErrorCallback, Call(DAWN_BUILDER_ERROR_STATUS_UNKNOWN, _ , 5, 6)).Times(1); - nxtBufferRelease(buffer); + dawnBufferRelease(buffer); } } // Test that a builder success status doesn't get forwarded to the device TEST_F(WireTests, SuccessCallbackNotForwardedToDevice) { - nxtDeviceSetErrorCallback(device, ToMockDeviceErrorCallback, 0); + dawnDeviceSetErrorCallback(device, ToMockDeviceErrorCallback, 0); - nxtBufferBuilder bufferBuilder = nxtDeviceCreateBufferBuilder(device); - nxtBufferBuilderGetResult(bufferBuilder); + dawnBufferBuilder bufferBuilder = dawnDeviceCreateBufferBuilder(device); + dawnBufferBuilderGetResult(bufferBuilder); - nxtBufferBuilder apiBufferBuilder = api.GetNewBufferBuilder(); + dawnBufferBuilder apiBufferBuilder = api.GetNewBufferBuilder(); EXPECT_CALL(api, DeviceCreateBufferBuilder(apiDevice)) .WillOnce(Return(apiBufferBuilder)); - nxtBuffer apiBuffer = api.GetNewBuffer(); + dawnBuffer apiBuffer = api.GetNewBuffer(); EXPECT_CALL(api, BufferBuilderGetResult(apiBufferBuilder)) - .WillOnce(InvokeWithoutArgs([&]() -> nxtBuffer { - api.CallBuilderErrorCallback(apiBufferBuilder, NXT_BUILDER_ERROR_STATUS_SUCCESS, "I like cheese"); + .WillOnce(InvokeWithoutArgs([&]() -> dawnBuffer { + api.CallBuilderErrorCallback(apiBufferBuilder, DAWN_BUILDER_ERROR_STATUS_SUCCESS, "I like cheese"); return apiBuffer; })); @@ -600,18 +600,18 @@ TEST_F(WireTests, SuccessCallbackNotForwardedToDevice) { // Test that a builder error status gets forwarded to the device TEST_F(WireTests, ErrorCallbackForwardedToDevice) { uint64_t userdata = 30495; - nxtDeviceSetErrorCallback(device, ToMockDeviceErrorCallback, userdata); + dawnDeviceSetErrorCallback(device, ToMockDeviceErrorCallback, userdata); - nxtBufferBuilder bufferBuilder = nxtDeviceCreateBufferBuilder(device); - nxtBufferBuilderGetResult(bufferBuilder); + dawnBufferBuilder bufferBuilder = dawnDeviceCreateBufferBuilder(device); + dawnBufferBuilderGetResult(bufferBuilder); - nxtBufferBuilder apiBufferBuilder = api.GetNewBufferBuilder(); + dawnBufferBuilder apiBufferBuilder = api.GetNewBufferBuilder(); EXPECT_CALL(api, DeviceCreateBufferBuilder(apiDevice)) .WillOnce(Return(apiBufferBuilder)); EXPECT_CALL(api, BufferBuilderGetResult(apiBufferBuilder)) - .WillOnce(InvokeWithoutArgs([&]() -> nxtBuffer { - api.CallBuilderErrorCallback(apiBufferBuilder, NXT_BUILDER_ERROR_STATUS_ERROR, "Error :("); + .WillOnce(InvokeWithoutArgs([&]() -> dawnBuffer { + api.CallBuilderErrorCallback(apiBufferBuilder, DAWN_BUILDER_ERROR_STATUS_ERROR, "Error :("); return nullptr; })); @@ -631,7 +631,7 @@ class WireSetCallbackTests : public WireTestsBase { // Test the return wire for device error callbacks TEST_F(WireSetCallbackTests, DeviceErrorCallback) { uint64_t userdata = 3049785; - nxtDeviceSetErrorCallback(device, ToMockDeviceErrorCallback, userdata); + dawnDeviceSetErrorCallback(device, ToMockDeviceErrorCallback, userdata); // Setting the error callback should stay on the client side and do nothing FlushClient(); @@ -651,9 +651,9 @@ TEST_F(WireSetCallbackTests, BuilderErrorCallback) { uint64_t userdata2 = 982734239028; // Create the buffer builder, the callback is set immediately on the server side - nxtBufferBuilder bufferBuilder = nxtDeviceCreateBufferBuilder(device); + dawnBufferBuilder bufferBuilder = dawnDeviceCreateBufferBuilder(device); - nxtBufferBuilder apiBufferBuilder = api.GetNewBufferBuilder(); + dawnBufferBuilder apiBufferBuilder = api.GetNewBufferBuilder(); EXPECT_CALL(api, DeviceCreateBufferBuilder(apiDevice)) .WillOnce(Return(apiBufferBuilder)); @@ -663,23 +663,23 @@ TEST_F(WireSetCallbackTests, BuilderErrorCallback) { FlushClient(); // Setting the callback on the client side doesn't do anything on the server side - nxtBufferBuilderSetErrorCallback(bufferBuilder, ToMockBuilderErrorCallback, userdata1, userdata2); + dawnBufferBuilderSetErrorCallback(bufferBuilder, ToMockBuilderErrorCallback, userdata1, userdata2); FlushClient(); // Create an object so that it is a valid case to call the error callback - nxtBufferBuilderGetResult(bufferBuilder); + dawnBufferBuilderGetResult(bufferBuilder); - nxtBuffer apiBuffer = api.GetNewBuffer(); + dawnBuffer apiBuffer = api.GetNewBuffer(); EXPECT_CALL(api, BufferBuilderGetResult(apiBufferBuilder)) - .WillOnce(InvokeWithoutArgs([&]() -> nxtBuffer { - api.CallBuilderErrorCallback(apiBufferBuilder, NXT_BUILDER_ERROR_STATUS_SUCCESS, "Success!"); + .WillOnce(InvokeWithoutArgs([&]() -> dawnBuffer { + api.CallBuilderErrorCallback(apiBufferBuilder, DAWN_BUILDER_ERROR_STATUS_SUCCESS, "Success!"); return apiBuffer; })); FlushClient(); // The error callback gets called on the client side - EXPECT_CALL(*mockBuilderErrorCallback, Call(NXT_BUILDER_ERROR_STATUS_SUCCESS, StrEq("Success!"), userdata1, userdata2)) + EXPECT_CALL(*mockBuilderErrorCallback, Call(DAWN_BUILDER_ERROR_STATUS_SUCCESS, StrEq("Success!"), userdata1, userdata2)) .Times(1); FlushServer(); @@ -694,27 +694,27 @@ class WireBufferMappingTests : public WireTestsBase { WireTestsBase::SetUp(); { - nxtBufferBuilder apiBufferBuilder = api.GetNewBufferBuilder(); - nxtBufferBuilder bufferBuilder = nxtDeviceCreateBufferBuilder(device); + dawnBufferBuilder apiBufferBuilder = api.GetNewBufferBuilder(); + dawnBufferBuilder bufferBuilder = dawnDeviceCreateBufferBuilder(device); EXPECT_CALL(api, DeviceCreateBufferBuilder(apiDevice)) .WillOnce(Return(apiBufferBuilder)) .RetiresOnSaturation(); apiBuffer = api.GetNewBuffer(); - buffer = nxtBufferBuilderGetResult(bufferBuilder); + buffer = dawnBufferBuilderGetResult(bufferBuilder); EXPECT_CALL(api, BufferBuilderGetResult(apiBufferBuilder)) .WillOnce(Return(apiBuffer)) .RetiresOnSaturation(); FlushClient(); } { - nxtBufferBuilder apiBufferBuilder = api.GetNewBufferBuilder(); - nxtBufferBuilder bufferBuilder = nxtDeviceCreateBufferBuilder(device); + dawnBufferBuilder apiBufferBuilder = api.GetNewBufferBuilder(); + dawnBufferBuilder bufferBuilder = dawnDeviceCreateBufferBuilder(device); EXPECT_CALL(api, DeviceCreateBufferBuilder(apiDevice)) .WillOnce(Return(apiBufferBuilder)) .RetiresOnSaturation(); - errorBuffer = nxtBufferBuilderGetResult(bufferBuilder); + errorBuffer = dawnBufferBuilderGetResult(bufferBuilder); EXPECT_CALL(api, BufferBuilderGetResult(apiBufferBuilder)) .WillOnce(Return(nullptr)) .RetiresOnSaturation(); @@ -724,34 +724,34 @@ class WireBufferMappingTests : public WireTestsBase { protected: // A successfully created buffer - nxtBuffer buffer; - nxtBuffer apiBuffer; + dawnBuffer buffer; + dawnBuffer apiBuffer; // An buffer that wasn't created on the server side - nxtBuffer errorBuffer; + dawnBuffer errorBuffer; }; // MapRead-specific tests // Check mapping for reading a succesfully created buffer TEST_F(WireBufferMappingTests, MappingForReadSuccessBuffer) { - nxtCallbackUserdata userdata = 8653; - nxtBufferMapReadAsync(buffer, 40, sizeof(uint32_t), ToMockBufferMapReadCallback, userdata); + dawnCallbackUserdata userdata = 8653; + dawnBufferMapReadAsync(buffer, 40, sizeof(uint32_t), ToMockBufferMapReadCallback, userdata); uint32_t bufferContent = 31337; EXPECT_CALL(api, OnBufferMapReadAsyncCallback(apiBuffer, 40, sizeof(uint32_t), _, _)) .WillOnce(InvokeWithoutArgs([&]() { - api.CallMapReadCallback(apiBuffer, NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, &bufferContent); + api.CallMapReadCallback(apiBuffer, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, &bufferContent); })); FlushClient(); - EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Pointee(Eq(bufferContent)), userdata)) + EXPECT_CALL(*mockBufferMapReadCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Pointee(Eq(bufferContent)), userdata)) .Times(1); FlushServer(); - nxtBufferUnmap(buffer); + dawnBufferUnmap(buffer); EXPECT_CALL(api, BufferUnmap(apiBuffer)) .Times(1); @@ -760,17 +760,17 @@ TEST_F(WireBufferMappingTests, MappingForReadSuccessBuffer) { // Check that things work correctly when a validation error happens when mapping the buffer for reading TEST_F(WireBufferMappingTests, ErrorWhileMappingForRead) { - nxtCallbackUserdata userdata = 8654; - nxtBufferMapReadAsync(buffer, 40, sizeof(uint32_t), ToMockBufferMapReadCallback, userdata); + dawnCallbackUserdata userdata = 8654; + dawnBufferMapReadAsync(buffer, 40, sizeof(uint32_t), ToMockBufferMapReadCallback, userdata); EXPECT_CALL(api, OnBufferMapReadAsyncCallback(apiBuffer, 40, sizeof(uint32_t), _, _)) .WillOnce(InvokeWithoutArgs([&]() { - api.CallMapReadCallback(apiBuffer, NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr); + api.CallMapReadCallback(apiBuffer, DAWN_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr); })); FlushClient(); - EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata)) + EXPECT_CALL(*mockBufferMapReadCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata)) .Times(1); FlushServer(); @@ -778,49 +778,49 @@ TEST_F(WireBufferMappingTests, ErrorWhileMappingForRead) { // Check mapping for reading a buffer that didn't get created on the server side TEST_F(WireBufferMappingTests, MappingForReadErrorBuffer) { - nxtCallbackUserdata userdata = 8655; - nxtBufferMapReadAsync(errorBuffer, 40, sizeof(uint32_t), ToMockBufferMapReadCallback, userdata); + dawnCallbackUserdata userdata = 8655; + dawnBufferMapReadAsync(errorBuffer, 40, sizeof(uint32_t), ToMockBufferMapReadCallback, userdata); FlushClient(); - EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata)) + EXPECT_CALL(*mockBufferMapReadCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata)) .Times(1); FlushServer(); - nxtBufferUnmap(errorBuffer); + dawnBufferUnmap(errorBuffer); FlushClient(); } // Check that the map read callback is called with UNKNOWN when the buffer is destroyed before the request is finished TEST_F(WireBufferMappingTests, DestroyBeforeReadRequestEnd) { - nxtCallbackUserdata userdata = 8656; - nxtBufferMapReadAsync(errorBuffer, 40, sizeof(uint32_t), ToMockBufferMapReadCallback, userdata); + dawnCallbackUserdata userdata = 8656; + dawnBufferMapReadAsync(errorBuffer, 40, sizeof(uint32_t), ToMockBufferMapReadCallback, userdata); - EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, userdata)) + EXPECT_CALL(*mockBufferMapReadCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, userdata)) .Times(1); - nxtBufferRelease(errorBuffer); + dawnBufferRelease(errorBuffer); } // Check the map read callback is called with UNKNOWN when the map request would have worked, but Unmap was called TEST_F(WireBufferMappingTests, UnmapCalledTooEarlyForRead) { - nxtCallbackUserdata userdata = 8657; - nxtBufferMapReadAsync(buffer, 40, sizeof(uint32_t), ToMockBufferMapReadCallback, userdata); + dawnCallbackUserdata userdata = 8657; + dawnBufferMapReadAsync(buffer, 40, sizeof(uint32_t), ToMockBufferMapReadCallback, userdata); uint32_t bufferContent = 31337; EXPECT_CALL(api, OnBufferMapReadAsyncCallback(apiBuffer, 40, sizeof(uint32_t), _, _)) .WillOnce(InvokeWithoutArgs([&]() { - api.CallMapReadCallback(apiBuffer, NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, &bufferContent); + api.CallMapReadCallback(apiBuffer, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, &bufferContent); })); FlushClient(); // Oh no! We are calling Unmap too early! - EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, userdata)) + EXPECT_CALL(*mockBufferMapReadCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, userdata)) .Times(1); - nxtBufferUnmap(buffer); + dawnBufferUnmap(buffer); // The callback shouldn't get called, even when the request succeeded on the server side FlushServer(); @@ -829,34 +829,34 @@ TEST_F(WireBufferMappingTests, UnmapCalledTooEarlyForRead) { // Check that an error map read callback gets nullptr while a buffer is already mapped TEST_F(WireBufferMappingTests, MappingForReadingErrorWhileAlreadyMappedGetsNullptr) { // Successful map - nxtCallbackUserdata userdata = 34098; - nxtBufferMapReadAsync(buffer, 40, sizeof(uint32_t), ToMockBufferMapReadCallback, userdata); + dawnCallbackUserdata userdata = 34098; + dawnBufferMapReadAsync(buffer, 40, sizeof(uint32_t), ToMockBufferMapReadCallback, userdata); uint32_t bufferContent = 31337; EXPECT_CALL(api, OnBufferMapReadAsyncCallback(apiBuffer, 40, sizeof(uint32_t), _, _)) .WillOnce(InvokeWithoutArgs([&]() { - api.CallMapReadCallback(apiBuffer, NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, &bufferContent); + api.CallMapReadCallback(apiBuffer, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, &bufferContent); })) .RetiresOnSaturation(); FlushClient(); - EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Pointee(Eq(bufferContent)), userdata)) + EXPECT_CALL(*mockBufferMapReadCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Pointee(Eq(bufferContent)), userdata)) .Times(1); FlushServer(); // Map failure while the buffer is already mapped userdata ++; - nxtBufferMapReadAsync(buffer, 40, sizeof(uint32_t), ToMockBufferMapReadCallback, userdata); + dawnBufferMapReadAsync(buffer, 40, sizeof(uint32_t), ToMockBufferMapReadCallback, userdata); EXPECT_CALL(api, OnBufferMapReadAsyncCallback(apiBuffer, 40, sizeof(uint32_t), _, _)) .WillOnce(InvokeWithoutArgs([&]() { - api.CallMapReadCallback(apiBuffer, NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr); + api.CallMapReadCallback(apiBuffer, DAWN_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr); })); FlushClient(); - EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata)) + EXPECT_CALL(*mockBufferMapReadCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata)) .Times(1); FlushServer(); @@ -864,20 +864,20 @@ TEST_F(WireBufferMappingTests, MappingForReadingErrorWhileAlreadyMappedGetsNullp // Test that the MapReadCallback isn't fired twice when unmap() is called inside the callback TEST_F(WireBufferMappingTests, UnmapInsideMapReadCallback) { - nxtCallbackUserdata userdata = 2039; - nxtBufferMapReadAsync(buffer, 40, sizeof(uint32_t), ToMockBufferMapReadCallback, userdata); + dawnCallbackUserdata userdata = 2039; + dawnBufferMapReadAsync(buffer, 40, sizeof(uint32_t), ToMockBufferMapReadCallback, userdata); uint32_t bufferContent = 31337; EXPECT_CALL(api, OnBufferMapReadAsyncCallback(apiBuffer, 40, sizeof(uint32_t), _, _)) .WillOnce(InvokeWithoutArgs([&]() { - api.CallMapReadCallback(apiBuffer, NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, &bufferContent); + api.CallMapReadCallback(apiBuffer, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, &bufferContent); })); FlushClient(); - EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Pointee(Eq(bufferContent)), userdata)) + EXPECT_CALL(*mockBufferMapReadCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Pointee(Eq(bufferContent)), userdata)) .WillOnce(InvokeWithoutArgs([&]() { - nxtBufferUnmap(buffer); + dawnBufferUnmap(buffer); })); FlushServer(); @@ -890,20 +890,20 @@ TEST_F(WireBufferMappingTests, UnmapInsideMapReadCallback) { // Test that the MapReadCallback isn't fired twice the buffer external refcount reaches 0 in the callback TEST_F(WireBufferMappingTests, DestroyInsideMapReadCallback) { - nxtCallbackUserdata userdata = 2039; - nxtBufferMapReadAsync(buffer, 40, sizeof(uint32_t), ToMockBufferMapReadCallback, userdata); + dawnCallbackUserdata userdata = 2039; + dawnBufferMapReadAsync(buffer, 40, sizeof(uint32_t), ToMockBufferMapReadCallback, userdata); uint32_t bufferContent = 31337; EXPECT_CALL(api, OnBufferMapReadAsyncCallback(apiBuffer, 40, sizeof(uint32_t), _, _)) .WillOnce(InvokeWithoutArgs([&]() { - api.CallMapReadCallback(apiBuffer, NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, &bufferContent); + api.CallMapReadCallback(apiBuffer, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, &bufferContent); })); FlushClient(); - EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Pointee(Eq(bufferContent)), userdata)) + EXPECT_CALL(*mockBufferMapReadCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Pointee(Eq(bufferContent)), userdata)) .WillOnce(InvokeWithoutArgs([&]() { - nxtBufferRelease(buffer); + dawnBufferRelease(buffer); })); FlushServer(); @@ -918,8 +918,8 @@ TEST_F(WireBufferMappingTests, DestroyInsideMapReadCallback) { // Check mapping for writing a succesfully created buffer TEST_F(WireBufferMappingTests, MappingForWriteSuccessBuffer) { - nxtCallbackUserdata userdata = 8653; - nxtBufferMapWriteAsync(buffer, 40, sizeof(uint32_t), ToMockBufferMapWriteCallback, userdata); + dawnCallbackUserdata userdata = 8653; + dawnBufferMapWriteAsync(buffer, 40, sizeof(uint32_t), ToMockBufferMapWriteCallback, userdata); uint32_t serverBufferContent = 31337; uint32_t updatedContent = 4242; @@ -927,13 +927,13 @@ TEST_F(WireBufferMappingTests, MappingForWriteSuccessBuffer) { EXPECT_CALL(api, OnBufferMapWriteAsyncCallback(apiBuffer, 40, sizeof(uint32_t), _, _)) .WillOnce(InvokeWithoutArgs([&]() { - api.CallMapWriteCallback(apiBuffer, NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, &serverBufferContent); + api.CallMapWriteCallback(apiBuffer, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, &serverBufferContent); })); FlushClient(); // The map write callback always gets a buffer full of zeroes. - EXPECT_CALL(*mockBufferMapWriteCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Pointee(Eq(zero)), userdata)) + EXPECT_CALL(*mockBufferMapWriteCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Pointee(Eq(zero)), userdata)) .Times(1); FlushServer(); @@ -941,7 +941,7 @@ TEST_F(WireBufferMappingTests, MappingForWriteSuccessBuffer) { // Write something to the mapped pointer *lastMapWritePointer = updatedContent; - nxtBufferUnmap(buffer); + dawnBufferUnmap(buffer); EXPECT_CALL(api, BufferUnmap(apiBuffer)) .Times(1); @@ -953,17 +953,17 @@ TEST_F(WireBufferMappingTests, MappingForWriteSuccessBuffer) { // Check that things work correctly when a validation error happens when mapping the buffer for writing TEST_F(WireBufferMappingTests, ErrorWhileMappingForWrite) { - nxtCallbackUserdata userdata = 8654; - nxtBufferMapWriteAsync(buffer, 40, sizeof(uint32_t), ToMockBufferMapWriteCallback, userdata); + dawnCallbackUserdata userdata = 8654; + dawnBufferMapWriteAsync(buffer, 40, sizeof(uint32_t), ToMockBufferMapWriteCallback, userdata); EXPECT_CALL(api, OnBufferMapWriteAsyncCallback(apiBuffer, 40, sizeof(uint32_t), _, _)) .WillOnce(InvokeWithoutArgs([&]() { - api.CallMapWriteCallback(apiBuffer, NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr); + api.CallMapWriteCallback(apiBuffer, DAWN_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr); })); FlushClient(); - EXPECT_CALL(*mockBufferMapWriteCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata)) + EXPECT_CALL(*mockBufferMapWriteCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata)) .Times(1); FlushServer(); @@ -971,49 +971,49 @@ TEST_F(WireBufferMappingTests, ErrorWhileMappingForWrite) { // Check mapping for writing a buffer that didn't get created on the server side TEST_F(WireBufferMappingTests, MappingForWriteErrorBuffer) { - nxtCallbackUserdata userdata = 8655; - nxtBufferMapWriteAsync(errorBuffer, 40, sizeof(uint32_t), ToMockBufferMapWriteCallback, userdata); + dawnCallbackUserdata userdata = 8655; + dawnBufferMapWriteAsync(errorBuffer, 40, sizeof(uint32_t), ToMockBufferMapWriteCallback, userdata); FlushClient(); - EXPECT_CALL(*mockBufferMapWriteCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata)) + EXPECT_CALL(*mockBufferMapWriteCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata)) .Times(1); FlushServer(); - nxtBufferUnmap(errorBuffer); + dawnBufferUnmap(errorBuffer); FlushClient(); } // Check that the map write callback is called with UNKNOWN when the buffer is destroyed before the request is finished TEST_F(WireBufferMappingTests, DestroyBeforeWriteRequestEnd) { - nxtCallbackUserdata userdata = 8656; - nxtBufferMapWriteAsync(errorBuffer, 40, sizeof(uint32_t), ToMockBufferMapWriteCallback, userdata); + dawnCallbackUserdata userdata = 8656; + dawnBufferMapWriteAsync(errorBuffer, 40, sizeof(uint32_t), ToMockBufferMapWriteCallback, userdata); - EXPECT_CALL(*mockBufferMapWriteCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, userdata)) + EXPECT_CALL(*mockBufferMapWriteCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, userdata)) .Times(1); - nxtBufferRelease(errorBuffer); + dawnBufferRelease(errorBuffer); } // Check the map read callback is called with UNKNOWN when the map request would have worked, but Unmap was called TEST_F(WireBufferMappingTests, UnmapCalledTooEarlyForWrite) { - nxtCallbackUserdata userdata = 8657; - nxtBufferMapWriteAsync(buffer, 40, sizeof(uint32_t), ToMockBufferMapWriteCallback, userdata); + dawnCallbackUserdata userdata = 8657; + dawnBufferMapWriteAsync(buffer, 40, sizeof(uint32_t), ToMockBufferMapWriteCallback, userdata); uint32_t bufferContent = 31337; EXPECT_CALL(api, OnBufferMapWriteAsyncCallback(apiBuffer, 40, sizeof(uint32_t), _, _)) .WillOnce(InvokeWithoutArgs([&]() { - api.CallMapWriteCallback(apiBuffer, NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, &bufferContent); + api.CallMapWriteCallback(apiBuffer, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, &bufferContent); })); FlushClient(); // Oh no! We are calling Unmap too early! - EXPECT_CALL(*mockBufferMapWriteCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, userdata)) + EXPECT_CALL(*mockBufferMapWriteCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, userdata)) .Times(1); - nxtBufferUnmap(buffer); + dawnBufferUnmap(buffer); // The callback shouldn't get called, even when the request succeeded on the server side FlushServer(); @@ -1022,35 +1022,35 @@ TEST_F(WireBufferMappingTests, UnmapCalledTooEarlyForWrite) { // Check that an error map read callback gets nullptr while a buffer is already mapped TEST_F(WireBufferMappingTests, MappingForWritingErrorWhileAlreadyMappedGetsNullptr) { // Successful map - nxtCallbackUserdata userdata = 34098; - nxtBufferMapWriteAsync(buffer, 40, sizeof(uint32_t), ToMockBufferMapWriteCallback, userdata); + dawnCallbackUserdata userdata = 34098; + dawnBufferMapWriteAsync(buffer, 40, sizeof(uint32_t), ToMockBufferMapWriteCallback, userdata); uint32_t bufferContent = 31337; uint32_t zero = 0; EXPECT_CALL(api, OnBufferMapWriteAsyncCallback(apiBuffer, 40, sizeof(uint32_t), _, _)) .WillOnce(InvokeWithoutArgs([&]() { - api.CallMapWriteCallback(apiBuffer, NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, &bufferContent); + api.CallMapWriteCallback(apiBuffer, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, &bufferContent); })) .RetiresOnSaturation(); FlushClient(); - EXPECT_CALL(*mockBufferMapWriteCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Pointee(Eq(zero)), userdata)) + EXPECT_CALL(*mockBufferMapWriteCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Pointee(Eq(zero)), userdata)) .Times(1); FlushServer(); // Map failure while the buffer is already mapped userdata ++; - nxtBufferMapWriteAsync(buffer, 40, sizeof(uint32_t), ToMockBufferMapWriteCallback, userdata); + dawnBufferMapWriteAsync(buffer, 40, sizeof(uint32_t), ToMockBufferMapWriteCallback, userdata); EXPECT_CALL(api, OnBufferMapWriteAsyncCallback(apiBuffer, 40, sizeof(uint32_t), _, _)) .WillOnce(InvokeWithoutArgs([&]() { - api.CallMapWriteCallback(apiBuffer, NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr); + api.CallMapWriteCallback(apiBuffer, DAWN_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr); })); FlushClient(); - EXPECT_CALL(*mockBufferMapWriteCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata)) + EXPECT_CALL(*mockBufferMapWriteCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata)) .Times(1); FlushServer(); @@ -1058,21 +1058,21 @@ TEST_F(WireBufferMappingTests, MappingForWritingErrorWhileAlreadyMappedGetsNullp // Test that the MapWriteCallback isn't fired twice when unmap() is called inside the callback TEST_F(WireBufferMappingTests, UnmapInsideMapWriteCallback) { - nxtCallbackUserdata userdata = 2039; - nxtBufferMapWriteAsync(buffer, 40, sizeof(uint32_t), ToMockBufferMapWriteCallback, userdata); + dawnCallbackUserdata userdata = 2039; + dawnBufferMapWriteAsync(buffer, 40, sizeof(uint32_t), ToMockBufferMapWriteCallback, userdata); uint32_t bufferContent = 31337; uint32_t zero = 0; EXPECT_CALL(api, OnBufferMapWriteAsyncCallback(apiBuffer, 40, sizeof(uint32_t), _, _)) .WillOnce(InvokeWithoutArgs([&]() { - api.CallMapWriteCallback(apiBuffer, NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, &bufferContent); + api.CallMapWriteCallback(apiBuffer, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, &bufferContent); })); FlushClient(); - EXPECT_CALL(*mockBufferMapWriteCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Pointee(Eq(zero)), userdata)) + EXPECT_CALL(*mockBufferMapWriteCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Pointee(Eq(zero)), userdata)) .WillOnce(InvokeWithoutArgs([&]() { - nxtBufferUnmap(buffer); + dawnBufferUnmap(buffer); })); FlushServer(); @@ -1085,21 +1085,21 @@ TEST_F(WireBufferMappingTests, UnmapInsideMapWriteCallback) { // Test that the MapWriteCallback isn't fired twice the buffer external refcount reaches 0 in the callback TEST_F(WireBufferMappingTests, DestroyInsideMapWriteCallback) { - nxtCallbackUserdata userdata = 2039; - nxtBufferMapWriteAsync(buffer, 40, sizeof(uint32_t), ToMockBufferMapWriteCallback, userdata); + dawnCallbackUserdata userdata = 2039; + dawnBufferMapWriteAsync(buffer, 40, sizeof(uint32_t), ToMockBufferMapWriteCallback, userdata); uint32_t bufferContent = 31337; uint32_t zero = 0; EXPECT_CALL(api, OnBufferMapWriteAsyncCallback(apiBuffer, 40, sizeof(uint32_t), _, _)) .WillOnce(InvokeWithoutArgs([&]() { - api.CallMapWriteCallback(apiBuffer, NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, &bufferContent); + api.CallMapWriteCallback(apiBuffer, DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, &bufferContent); })); FlushClient(); - EXPECT_CALL(*mockBufferMapWriteCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Pointee(Eq(zero)), userdata)) + EXPECT_CALL(*mockBufferMapWriteCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Pointee(Eq(zero)), userdata)) .WillOnce(InvokeWithoutArgs([&]() { - nxtBufferRelease(buffer); + dawnBufferRelease(buffer); })); FlushServer(); diff --git a/src/tests/unittests/validation/BufferValidationTests.cpp b/src/tests/unittests/validation/BufferValidationTests.cpp index 1a1b78e654..0bb7579cc3 100644 --- a/src/tests/unittests/validation/BufferValidationTests.cpp +++ b/src/tests/unittests/validation/BufferValidationTests.cpp @@ -20,22 +20,22 @@ using namespace testing; class MockBufferMapReadCallback { public: - MOCK_METHOD3(Call, void(nxtBufferMapAsyncStatus status, const uint32_t* ptr, nxtCallbackUserdata userdata)); + MOCK_METHOD3(Call, void(dawnBufferMapAsyncStatus status, const uint32_t* ptr, dawnCallbackUserdata userdata)); }; static MockBufferMapReadCallback* mockBufferMapReadCallback = nullptr; -static void ToMockBufferMapReadCallback(nxtBufferMapAsyncStatus status, const void* ptr, nxtCallbackUserdata userdata) { +static void ToMockBufferMapReadCallback(dawnBufferMapAsyncStatus status, const void* ptr, dawnCallbackUserdata userdata) { // Assume the data is uint32_t to make writing matchers easier mockBufferMapReadCallback->Call(status, reinterpret_cast(ptr), userdata); } class MockBufferMapWriteCallback { public: - MOCK_METHOD3(Call, void(nxtBufferMapAsyncStatus status, uint32_t* ptr, nxtCallbackUserdata userdata)); + MOCK_METHOD3(Call, void(dawnBufferMapAsyncStatus status, uint32_t* ptr, dawnCallbackUserdata userdata)); }; static MockBufferMapWriteCallback* mockBufferMapWriteCallback = nullptr; -static void ToMockBufferMapWriteCallback(nxtBufferMapAsyncStatus status, void* ptr, nxtCallbackUserdata userdata) { +static void ToMockBufferMapWriteCallback(dawnBufferMapAsyncStatus status, void* ptr, dawnCallbackUserdata userdata) { // Assume the data is uint32_t to make writing matchers easier mockBufferMapWriteCallback->Call(status, reinterpret_cast(ptr), userdata); } @@ -171,7 +171,7 @@ TEST_F(BufferValidationTest, MapReadSuccess) { dawn::CallbackUserdata userdata = 40598; buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata); - EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Ne(nullptr), userdata)) + EXPECT_CALL(*mockBufferMapReadCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Ne(nullptr), userdata)) .Times(1); queue.Submit(0, nullptr); @@ -185,7 +185,7 @@ TEST_F(BufferValidationTest, MapWriteSuccess) { dawn::CallbackUserdata userdata = 40598; buf.MapWriteAsync(0, 4, ToMockBufferMapWriteCallback, userdata); - EXPECT_CALL(*mockBufferMapWriteCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Ne(nullptr), userdata)) + EXPECT_CALL(*mockBufferMapWriteCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Ne(nullptr), userdata)) .Times(1); queue.Submit(0, nullptr); @@ -197,7 +197,7 @@ TEST_F(BufferValidationTest, MapReadOutOfRange) { dawn::Buffer buf = CreateMapReadBuffer(4); dawn::CallbackUserdata userdata = 40599; - EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata)) + EXPECT_CALL(*mockBufferMapReadCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata)) .Times(1); ASSERT_DEVICE_ERROR(buf.MapReadAsync(0, 5, ToMockBufferMapReadCallback, userdata)); @@ -208,7 +208,7 @@ TEST_F(BufferValidationTest, MapWriteOutOfRange) { dawn::Buffer buf = CreateMapWriteBuffer(4); dawn::CallbackUserdata userdata = 40599; - EXPECT_CALL(*mockBufferMapWriteCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata)) + EXPECT_CALL(*mockBufferMapWriteCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata)) .Times(1); ASSERT_DEVICE_ERROR(buf.MapWriteAsync(0, 5, ToMockBufferMapWriteCallback, userdata)); @@ -222,7 +222,7 @@ TEST_F(BufferValidationTest, MapReadWrongUsage) { .GetResult(); dawn::CallbackUserdata userdata = 40600; - EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata)) + EXPECT_CALL(*mockBufferMapReadCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata)) .Times(1); ASSERT_DEVICE_ERROR(buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata)); @@ -236,7 +236,7 @@ TEST_F(BufferValidationTest, MapWriteWrongUsage) { .GetResult(); dawn::CallbackUserdata userdata = 40600; - EXPECT_CALL(*mockBufferMapWriteCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata)) + EXPECT_CALL(*mockBufferMapWriteCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata)) .Times(1); ASSERT_DEVICE_ERROR(buf.MapWriteAsync(0, 4, ToMockBufferMapWriteCallback, userdata)); @@ -248,11 +248,11 @@ TEST_F(BufferValidationTest, MapReadAlreadyMapped) { dawn::CallbackUserdata userdata1 = 40601; buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata1); - EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Ne(nullptr), userdata1)) + EXPECT_CALL(*mockBufferMapReadCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Ne(nullptr), userdata1)) .Times(1); dawn::CallbackUserdata userdata2 = 40602; - EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata2)) + EXPECT_CALL(*mockBufferMapReadCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata2)) .Times(1); ASSERT_DEVICE_ERROR(buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata2)); @@ -265,11 +265,11 @@ TEST_F(BufferValidationTest, MapWriteAlreadyMapped) { dawn::CallbackUserdata userdata1 = 40601; buf.MapWriteAsync(0, 4, ToMockBufferMapWriteCallback, userdata1); - EXPECT_CALL(*mockBufferMapWriteCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Ne(nullptr), userdata1)) + EXPECT_CALL(*mockBufferMapWriteCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Ne(nullptr), userdata1)) .Times(1); dawn::CallbackUserdata userdata2 = 40602; - EXPECT_CALL(*mockBufferMapWriteCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata2)) + EXPECT_CALL(*mockBufferMapWriteCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata2)) .Times(1); ASSERT_DEVICE_ERROR(buf.MapWriteAsync(0, 4, ToMockBufferMapWriteCallback, userdata2)); @@ -284,7 +284,7 @@ TEST_F(BufferValidationTest, MapReadUnmapBeforeResult) { dawn::CallbackUserdata userdata = 40603; buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata); - EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, userdata)) + EXPECT_CALL(*mockBufferMapReadCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, userdata)) .Times(1); buf.Unmap(); @@ -300,7 +300,7 @@ TEST_F(BufferValidationTest, MapWriteUnmapBeforeResult) { dawn::CallbackUserdata userdata = 40603; buf.MapWriteAsync(0, 4, ToMockBufferMapWriteCallback, userdata); - EXPECT_CALL(*mockBufferMapWriteCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, userdata)) + EXPECT_CALL(*mockBufferMapWriteCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, userdata)) .Times(1); buf.Unmap(); @@ -319,7 +319,7 @@ TEST_F(BufferValidationTest, DISABLED_MapReadDestroyBeforeResult) { dawn::CallbackUserdata userdata = 40604; buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata); - EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, userdata)) + EXPECT_CALL(*mockBufferMapReadCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, userdata)) .Times(1); } @@ -338,7 +338,7 @@ TEST_F(BufferValidationTest, DISABLED_MapWriteDestroyBeforeResult) { dawn::CallbackUserdata userdata = 40604; buf.MapWriteAsync(0, 4, ToMockBufferMapWriteCallback, userdata); - EXPECT_CALL(*mockBufferMapWriteCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, userdata)) + EXPECT_CALL(*mockBufferMapWriteCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, userdata)) .Times(1); } @@ -355,7 +355,7 @@ TEST_F(BufferValidationTest, MapReadUnmapBeforeResultThenMapAgain) { dawn::CallbackUserdata userdata = 40605; buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata); - EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, userdata)) + EXPECT_CALL(*mockBufferMapReadCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, userdata)) .Times(1); buf.Unmap(); @@ -363,7 +363,7 @@ TEST_F(BufferValidationTest, MapReadUnmapBeforeResultThenMapAgain) { buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata); - EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Ne(nullptr), userdata)) + EXPECT_CALL(*mockBufferMapReadCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Ne(nullptr), userdata)) .Times(1); queue.Submit(0, nullptr); } @@ -377,7 +377,7 @@ TEST_F(BufferValidationTest, MapWriteUnmapBeforeResultThenMapAgain) { dawn::CallbackUserdata userdata = 40605; buf.MapWriteAsync(0, 4, ToMockBufferMapWriteCallback, userdata); - EXPECT_CALL(*mockBufferMapWriteCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, userdata)) + EXPECT_CALL(*mockBufferMapWriteCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, userdata)) .Times(1); buf.Unmap(); @@ -385,7 +385,7 @@ TEST_F(BufferValidationTest, MapWriteUnmapBeforeResultThenMapAgain) { buf.MapWriteAsync(0, 4, ToMockBufferMapWriteCallback, userdata); - EXPECT_CALL(*mockBufferMapWriteCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Ne(nullptr), userdata)) + EXPECT_CALL(*mockBufferMapWriteCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Ne(nullptr), userdata)) .Times(1); queue.Submit(0, nullptr); } @@ -397,7 +397,7 @@ TEST_F(BufferValidationTest, UnmapInsideMapReadCallback) { dawn::CallbackUserdata userdata = 40678; buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata); - EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Ne(nullptr), userdata)) + EXPECT_CALL(*mockBufferMapReadCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Ne(nullptr), userdata)) .WillOnce(InvokeWithoutArgs([&]() { buf.Unmap(); })); @@ -412,7 +412,7 @@ TEST_F(BufferValidationTest, UnmapInsideMapWriteCallback) { dawn::CallbackUserdata userdata = 40678; buf.MapWriteAsync(0, 4, ToMockBufferMapWriteCallback, userdata); - EXPECT_CALL(*mockBufferMapWriteCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Ne(nullptr), userdata)) + EXPECT_CALL(*mockBufferMapWriteCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Ne(nullptr), userdata)) .WillOnce(InvokeWithoutArgs([&]() { buf.Unmap(); })); @@ -427,7 +427,7 @@ TEST_F(BufferValidationTest, DestroyInsideMapReadCallback) { dawn::CallbackUserdata userdata = 40679; buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata); - EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Ne(nullptr), userdata)) + EXPECT_CALL(*mockBufferMapReadCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Ne(nullptr), userdata)) .WillOnce(InvokeWithoutArgs([&]() { buf = dawn::Buffer(); })); @@ -442,7 +442,7 @@ TEST_F(BufferValidationTest, DestroyInsideMapWriteCallback) { dawn::CallbackUserdata userdata = 40679; buf.MapWriteAsync(0, 4, ToMockBufferMapWriteCallback, userdata); - EXPECT_CALL(*mockBufferMapWriteCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Ne(nullptr), userdata)) + EXPECT_CALL(*mockBufferMapWriteCallback, Call(DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Ne(nullptr), userdata)) .WillOnce(InvokeWithoutArgs([&]() { buf = dawn::Buffer(); })); diff --git a/src/tests/unittests/validation/ValidationTest.cpp b/src/tests/unittests/validation/ValidationTest.cpp index e54b99e10c..3fa11eac7d 100644 --- a/src/tests/unittests/validation/ValidationTest.cpp +++ b/src/tests/unittests/validation/ValidationTest.cpp @@ -18,19 +18,19 @@ namespace backend { namespace null { - void Init(nxtProcTable* procs, nxtDevice* device); + void Init(nxtProcTable* procs, dawnDevice* device); } } ValidationTest::ValidationTest() { nxtProcTable procs; - nxtDevice cDevice; + dawnDevice cDevice; backend::null::Init(&procs, &cDevice); nxtSetProcs(&procs); device = dawn::Device::Acquire(cDevice); - device.SetErrorCallback(ValidationTest::OnDeviceError, static_cast(reinterpret_cast(this))); + device.SetErrorCallback(ValidationTest::OnDeviceError, static_cast(reinterpret_cast(this))); } ValidationTest::~ValidationTest() { @@ -51,9 +51,9 @@ void ValidationTest::TearDown() { ASSERT_TRUE(expectation.gotStatus) << "Didn't get a status for " << name; - ASSERT_NE(NXT_BUILDER_ERROR_STATUS_UNKNOWN, expectation.status) << "Got unknown status for " << name; + ASSERT_NE(DAWN_BUILDER_ERROR_STATUS_UNKNOWN, expectation.status) << "Got unknown status for " << name; - bool wasSuccess = expectation.status == NXT_BUILDER_ERROR_STATUS_SUCCESS; + bool wasSuccess = expectation.status == DAWN_BUILDER_ERROR_STATUS_SUCCESS; ASSERT_EQ(expectation.expectSuccess, wasSuccess) << "Got wrong status value for " << name << ", status was " << expectation.status << " with \"" << expectation.statusMessage << "\""; @@ -85,7 +85,7 @@ dawn::RenderPassDescriptor ValidationTest::CreateSimpleRenderPass() { .GetResult(); } -void ValidationTest::OnDeviceError(const char* message, nxtCallbackUserdata userdata) { +void ValidationTest::OnDeviceError(const char* message, dawnCallbackUserdata userdata) { // Skip this one specific error that is raised when a builder is used after it got an error // this is important because we don't want to wrap all creation tests in ASSERT_DEVICE_ERROR. // Yes the error message is misleading. @@ -99,7 +99,7 @@ void ValidationTest::OnDeviceError(const char* message, nxtCallbackUserdata user self->mError = true; } -void ValidationTest::OnBuilderErrorStatus(nxtBuilderErrorStatus status, const char* message, dawn::CallbackUserdata userdata1, dawn::CallbackUserdata userdata2) { +void ValidationTest::OnBuilderErrorStatus(dawnBuilderErrorStatus status, const char* message, dawn::CallbackUserdata userdata1, dawn::CallbackUserdata userdata2) { auto* self = reinterpret_cast(static_cast(userdata1)); size_t index = static_cast(userdata2); diff --git a/src/tests/unittests/validation/ValidationTest.h b/src/tests/unittests/validation/ValidationTest.h index 2644aa35e8..2189b1077c 100644 --- a/src/tests/unittests/validation/ValidationTest.h +++ b/src/tests/unittests/validation/ValidationTest.h @@ -65,7 +65,7 @@ class ValidationTest : public testing::Test { dawn::Device device; private: - static void OnDeviceError(const char* message, nxtCallbackUserdata userdata); + static void OnDeviceError(const char* message, dawnCallbackUserdata userdata); bool mExpectError = false; bool mError = false; @@ -75,14 +75,14 @@ class ValidationTest : public testing::Test { bool gotStatus = false; std::string statusMessage; - nxtBuilderErrorStatus status; + dawnBuilderErrorStatus status; }; std::vector mExpectations; template Builder AddExpectation(Builder& builder, std::string debugName, bool expectSuccess); - static void OnBuilderErrorStatus(nxtBuilderErrorStatus status, const char* message, dawn::CallbackUserdata userdata1, dawn::CallbackUserdata userdata2); + static void OnBuilderErrorStatus(dawnBuilderErrorStatus status, const char* message, dawn::CallbackUserdata userdata1, dawn::CallbackUserdata userdata2); }; // Template implementation details diff --git a/src/utils/BackendBinding.h b/src/utils/BackendBinding.h index bee8636c7e..99d6c80a6d 100644 --- a/src/utils/BackendBinding.h +++ b/src/utils/BackendBinding.h @@ -19,7 +19,7 @@ struct GLFWwindow; typedef struct nxtProcTable_s nxtProcTable; -typedef struct nxtDeviceImpl* nxtDevice; +typedef struct dawnDeviceImpl* dawnDevice; namespace utils { @@ -36,9 +36,9 @@ namespace utils { virtual ~BackendBinding() = default; virtual void SetupGLFWWindowHints() = 0; - virtual void GetProcAndDevice(nxtProcTable* procs, nxtDevice* device) = 0; + virtual void GetProcAndDevice(nxtProcTable* procs, dawnDevice* device) = 0; virtual uint64_t GetSwapChainImplementation() = 0; - virtual nxtTextureFormat GetPreferredSwapChainTextureFormat() = 0; + virtual dawnTextureFormat GetPreferredSwapChainTextureFormat() = 0; void SetWindow(GLFWwindow* window); diff --git a/src/utils/D3D12Binding.cpp b/src/utils/D3D12Binding.cpp index ff87fa68a3..950a965cb4 100644 --- a/src/utils/D3D12Binding.cpp +++ b/src/utils/D3D12Binding.cpp @@ -22,10 +22,10 @@ #include "GLFW/glfw3native.h" namespace backend { namespace d3d12 { - void Init(nxtProcTable* procs, nxtDevice* device); + void Init(nxtProcTable* procs, dawnDevice* device); - dawnSwapChainImplementation CreateNativeSwapChainImpl(nxtDevice device, HWND window); - nxtTextureFormat GetNativeSwapChainPreferredFormat( + dawnSwapChainImplementation CreateNativeSwapChainImpl(dawnDevice device, HWND window); + dawnTextureFormat GetNativeSwapChainPreferredFormat( const dawnSwapChainImplementation* swapChain); }} // namespace backend::d3d12 @@ -37,7 +37,7 @@ namespace utils { glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); } - void GetProcAndDevice(nxtProcTable* procs, nxtDevice* device) override { + void GetProcAndDevice(nxtProcTable* procs, dawnDevice* device) override { backend::d3d12::Init(procs, device); mBackendDevice = *device; } @@ -51,13 +51,13 @@ namespace utils { return reinterpret_cast(&mSwapchainImpl); } - nxtTextureFormat GetPreferredSwapChainTextureFormat() override { + dawnTextureFormat GetPreferredSwapChainTextureFormat() override { ASSERT(mSwapchainImpl.userData != nullptr); return backend::d3d12::GetNativeSwapChainPreferredFormat(&mSwapchainImpl); } private: - nxtDevice mBackendDevice = nullptr; + dawnDevice mBackendDevice = nullptr; dawnSwapChainImplementation mSwapchainImpl = {}; }; diff --git a/src/utils/MetalBinding.mm b/src/utils/MetalBinding.mm index 32b2573f5e..2fe0e99a9d 100644 --- a/src/utils/MetalBinding.mm +++ b/src/utils/MetalBinding.mm @@ -26,9 +26,9 @@ #import namespace backend { namespace metal { - void Init(id metalDevice, nxtProcTable* procs, nxtDevice* device); - void SetNextDrawable(nxtDevice device, id drawable); - void Present(nxtDevice device); + void Init(id metalDevice, nxtProcTable* procs, dawnDevice* device); + void SetNextDrawable(dawnDevice device, id drawable); + void Present(dawnDevice device); }} namespace utils { @@ -49,11 +49,11 @@ namespace utils { mCommandQueue = [mMtlDevice newCommandQueue]; } - dawnSwapChainError Configure(nxtTextureFormat format, - nxtTextureUsageBit, + dawnSwapChainError Configure(dawnTextureFormat format, + dawnTextureUsageBit, uint32_t width, uint32_t height) { - if (format != NXT_TEXTURE_FORMAT_B8_G8_R8_A8_UNORM) { + if (format != DAWN_TEXTURE_FORMAT_B8_G8_R8_A8_UNORM) { return "unsupported format"; } ASSERT(width > 0); @@ -114,7 +114,7 @@ namespace utils { void SetupGLFWWindowHints() override { glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); } - void GetProcAndDevice(nxtProcTable* procs, nxtDevice* device) override { + void GetProcAndDevice(nxtProcTable* procs, dawnDevice* device) override { mMetalDevice = MTLCreateSystemDefaultDevice(); backend::metal::Init(mMetalDevice, procs, device); @@ -129,13 +129,13 @@ namespace utils { return reinterpret_cast(&mSwapchainImpl); } - nxtTextureFormat GetPreferredSwapChainTextureFormat() override { - return NXT_TEXTURE_FORMAT_B8_G8_R8_A8_UNORM; + dawnTextureFormat GetPreferredSwapChainTextureFormat() override { + return DAWN_TEXTURE_FORMAT_B8_G8_R8_A8_UNORM; } private: id mMetalDevice = nil; - nxtDevice mBackendDevice = nullptr; + dawnDevice mBackendDevice = nullptr; dawnSwapChainImplementation mSwapchainImpl = {}; }; diff --git a/src/utils/NullBinding.cpp b/src/utils/NullBinding.cpp index 05e916bc16..0e86828479 100644 --- a/src/utils/NullBinding.cpp +++ b/src/utils/NullBinding.cpp @@ -15,7 +15,7 @@ #include "utils/BackendBinding.h" namespace backend { namespace null { - void Init(nxtProcTable* procs, nxtDevice* device); + void Init(nxtProcTable* procs, dawnDevice* device); }} // namespace backend::null namespace utils { @@ -24,14 +24,14 @@ namespace utils { public: void SetupGLFWWindowHints() override { } - void GetProcAndDevice(nxtProcTable* procs, nxtDevice* device) override { + void GetProcAndDevice(nxtProcTable* procs, dawnDevice* device) override { backend::null::Init(procs, device); } uint64_t GetSwapChainImplementation() override { return 0; } - nxtTextureFormat GetPreferredSwapChainTextureFormat() override { - return NXT_TEXTURE_FORMAT_R8_G8_B8_A8_UNORM; + dawnTextureFormat GetPreferredSwapChainTextureFormat() override { + return DAWN_TEXTURE_FORMAT_R8_G8_B8_A8_UNORM; } }; diff --git a/src/utils/OpenGLBinding.cpp b/src/utils/OpenGLBinding.cpp index 88de05a794..cc5dc2a823 100644 --- a/src/utils/OpenGLBinding.cpp +++ b/src/utils/OpenGLBinding.cpp @@ -26,7 +26,7 @@ #include "GLFW/glfw3.h" namespace backend { namespace opengl { - void Init(void* (*getProc)(const char*), nxtProcTable* procs, nxtDevice* device); + void Init(void* (*getProc)(const char*), nxtProcTable* procs, dawnDevice* device); }} // namespace backend::opengl namespace utils { @@ -53,11 +53,11 @@ namespace utils { mBackTexture, 0); } - dawnSwapChainError Configure(nxtTextureFormat format, - nxtTextureUsageBit, + dawnSwapChainError Configure(dawnTextureFormat format, + dawnTextureUsageBit, uint32_t width, uint32_t height) { - if (format != NXT_TEXTURE_FORMAT_R8_G8_B8_A8_UNORM) { + if (format != DAWN_TEXTURE_FORMAT_R8_G8_B8_A8_UNORM) { return "unsupported format"; } ASSERT(width > 0); @@ -111,7 +111,7 @@ namespace utils { glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); #endif } - void GetProcAndDevice(nxtProcTable* procs, nxtDevice* device) override { + void GetProcAndDevice(nxtProcTable* procs, dawnDevice* device) override { glfwMakeContextCurrent(mWindow); backend::opengl::Init(reinterpret_cast(glfwGetProcAddress), procs, device); @@ -126,12 +126,12 @@ namespace utils { return reinterpret_cast(&mSwapchainImpl); } - nxtTextureFormat GetPreferredSwapChainTextureFormat() override { - return NXT_TEXTURE_FORMAT_R8_G8_B8_A8_UNORM; + dawnTextureFormat GetPreferredSwapChainTextureFormat() override { + return DAWN_TEXTURE_FORMAT_R8_G8_B8_A8_UNORM; } private: - nxtDevice mBackendDevice = nullptr; + dawnDevice mBackendDevice = nullptr; dawnSwapChainImplementation mSwapchainImpl = {}; }; diff --git a/src/utils/VulkanBinding.cpp b/src/utils/VulkanBinding.cpp index 09635972a7..e700e20d29 100644 --- a/src/utils/VulkanBinding.cpp +++ b/src/utils/VulkanBinding.cpp @@ -24,13 +24,13 @@ namespace backend { namespace vulkan { void Init(nxtProcTable* procs, - nxtDevice* device, + dawnDevice* device, const std::vector& requiredInstanceExtensions); - VkInstance GetInstance(nxtDevice device); + VkInstance GetInstance(dawnDevice device); - dawnSwapChainImplementation CreateNativeSwapChainImpl(nxtDevice device, VkSurfaceKHR surface); - nxtTextureFormat GetNativeSwapChainPreferredFormat( + dawnSwapChainImplementation CreateNativeSwapChainImpl(dawnDevice device, VkSurfaceKHR surface); + dawnTextureFormat GetNativeSwapChainPreferredFormat( const dawnSwapChainImplementation* swapChain); }} // namespace backend::vulkan @@ -49,7 +49,7 @@ namespace utils { void Init(dawnWSIContextVulkan*) { } - dawnSwapChainError Configure(nxtTextureFormat, nxtTextureUsageBit, uint32_t, uint32_t) { + dawnSwapChainError Configure(dawnTextureFormat, dawnTextureUsageBit, uint32_t, uint32_t) { return DAWN_SWAP_CHAIN_NO_ERROR; } @@ -67,7 +67,7 @@ namespace utils { void SetupGLFWWindowHints() override { glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); } - void GetProcAndDevice(nxtProcTable* procs, nxtDevice* device) override { + void GetProcAndDevice(nxtProcTable* procs, dawnDevice* device) override { uint32_t extensionCount = 0; const char** glfwInstanceExtensions = glfwGetRequiredInstanceExtensions(&extensionCount); @@ -89,13 +89,13 @@ namespace utils { } return reinterpret_cast(&mSwapchainImpl); } - nxtTextureFormat GetPreferredSwapChainTextureFormat() override { + dawnTextureFormat GetPreferredSwapChainTextureFormat() override { ASSERT(mSwapchainImpl.userData != nullptr); return backend::vulkan::GetNativeSwapChainPreferredFormat(&mSwapchainImpl); } private: - nxtDevice mDevice; + dawnDevice mDevice; dawnSwapChainImplementation mSwapchainImpl = {}; }; diff --git a/src/wire/Wire.h b/src/wire/Wire.h index b20a39fda2..88d37ade02 100644 --- a/src/wire/Wire.h +++ b/src/wire/Wire.h @@ -35,9 +35,9 @@ namespace dawn { namespace wire { }; CommandHandler* NewClientDevice(nxtProcTable* procs, - nxtDevice* device, + dawnDevice* device, CommandSerializer* serializer); - CommandHandler* NewServerCommandHandler(nxtDevice device, + CommandHandler* NewServerCommandHandler(dawnDevice device, const nxtProcTable& procs, CommandSerializer* serializer);