Change the API prefix in generators from nxt to dawn

This commit is contained in:
Corentin Wallez 2018-07-18 15:12:52 +02:00 committed by Corentin Wallez
parent ae79c03d45
commit b1669e3fa4
43 changed files with 541 additions and 541 deletions

View File

@ -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<nxtTextureFormat>(GetPreferredSwapChainTextureFormat());
nxtSwapChainConfigure(swapchain, swapChainFormat, NXT_TEXTURE_USAGE_BIT_OUTPUT_ATTACHMENT, 640,
swapChainFormat = static_cast<dawnTextureFormat>(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();
}

View File

@ -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);

View File

@ -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':

View File

@ -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" {

View File

@ -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<ProcTableAsClass::Object*>(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<ProcTableAsClass::Object*>(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<ProcTableAsClass::Object*>(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<ProcTableAsClass::Object*>(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<ProcTableAsClass::Object*>(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<ProcTableAsClass::Object*>(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<ProcTableAsClass::Object*>(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<ProcTableAsClass::Object*>(self);
object->builderErrorCallback = callback;
object->userdata1 = userdata1;
object->userdata2 = userdata2;
OnBuilderSetErrorCallback(reinterpret_cast<nxtBufferBuilder>(self), callback, userdata1, userdata2);
OnBuilderSetErrorCallback(reinterpret_cast<dawnBufferBuilder>(self), callback, userdata1, userdata2);
}
{% endfor %}

View File

@ -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

View File

@ -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<Buffer*>(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<nxtBuilderErrorStatus>(cmd->status), message);
bool called = builtObject->builderCallback.Call(static_cast<dawnBuilderErrorStatus>(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<char>(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<nxtBufferMapAsyncStatus>(cmd->status), buffer->mappedData, request.userdata);
request.readCallback(static_cast<dawnBufferMapAsyncStatus>(cmd->status), buffer->mappedData, request.userdata);
} else {
request.readCallback(static_cast<nxtBufferMapAsyncStatus>(cmd->status), nullptr, request.userdata);
request.readCallback(static_cast<dawnBufferMapAsyncStatus>(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<nxtBufferMapAsyncStatus>(cmd->status), buffer->mappedData, request.userdata);
request.writeCallback(static_cast<dawnBufferMapAsyncStatus>(cmd->status), buffer->mappedData, request.userdata);
} else {
request.writeCallback(static_cast<nxtBufferMapAsyncStatus>(cmd->status), nullptr, request.userdata);
request.writeCallback(static_cast<dawnBufferMapAsyncStatus>(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<nxtDeviceImpl*>(clientDevice);
*device = reinterpret_cast<dawnDeviceImpl*>(clientDevice);
*procs = client::GetProcs();
return new client::Client(clientDevice);

View File

@ -141,14 +141,14 @@ namespace dawn { namespace wire {
std::vector<Data> 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<nxtCallbackUserdata>(reinterpret_cast<intptr_t>(this));
auto userdata = static_cast<dawnCallbackUserdata>(reinterpret_cast<intptr_t>(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<ReturnBufferMapReadAsyncCallbackCmd*>(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<ReturnBufferMapWriteAsyncCallbackCmd*>(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<Server*>(static_cast<intptr_t>(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<Server*>(static_cast<uintptr_t>(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<MapUserdata*>(static_cast<uintptr_t>(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<MapUserdata*>(static_cast<uintptr_t>(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);
}

View File

@ -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;

View File

@ -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;

View File

@ -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<nxtBuilderErrorStatus>(mStoredStatus), mStoredMessage.c_str(),
mCallback(static_cast<dawnBuilderErrorStatus>(mStoredStatus), mStoredMessage.c_str(),
mUserdata1, mUserdata2);
}

View File

@ -48,8 +48,8 @@ namespace backend {
mAllowedUsage = allowedUsage;
mWidth = width;
mHeight = height;
mImplementation.Configure(mImplementation.userData, static_cast<nxtTextureFormat>(format),
static_cast<nxtTextureUsageBit>(allowedUsage), width, height);
mImplementation.Configure(mImplementation.userData, static_cast<dawnTextureFormat>(format),
static_cast<dawnTextureUsageBit>(allowedUsage), width, height);
}
TextureBase* SwapChainBase::GetNextTexture() {

View File

@ -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);
}
}

View File

@ -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<nxtDevice>(new Device());
*device = reinterpret_cast<dawnDevice>(new Device());
}
dawnSwapChainImplementation CreateNativeSwapChainImpl(nxtDevice device, HWND window) {
dawnSwapChainImplementation CreateNativeSwapChainImpl(dawnDevice device, HWND window) {
Device* backendDevice = reinterpret_cast<Device*>(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<NativeSwapChainImpl*>(swapChain->userData);
return static_cast<nxtTextureFormat>(impl->GetPreferredFormat());
return static_cast<dawnTextureFormat>(impl->GetPreferredFormat());
}
void ASSERT_SUCCESS(HRESULT hr) {

View File

@ -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<nxtTextureFormat>(GetPreferredFormat()));
ASSERT(format == static_cast<dawnTextureFormat>(GetPreferredFormat()));
ComPtr<IDXGIFactory4> factory = mDevice->GetFactory();
ComPtr<ID3D12CommandQueue> queue = mDevice->GetCommandQueue();

View File

@ -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);

View File

@ -24,10 +24,10 @@ namespace backend { namespace d3d12 {
SwapChain::SwapChain(SwapChainBuilder* builder) : SwapChainBase(builder) {
const auto& im = GetImplementation();
dawnWSIContextD3D12 wsiContext = {};
wsiContext.device = reinterpret_cast<nxtDevice>(GetDevice());
wsiContext.device = reinterpret_cast<dawnDevice>(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<dawn::TextureUsageBit>(im.textureUsage);
}

View File

@ -43,9 +43,9 @@ namespace backend { namespace metal {
void Buffer::OnMapCommandSerialFinished(uint32_t mapSerial, uint32_t offset, bool isWrite) {
char* data = reinterpret_cast<char*>([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);
}
}

View File

@ -38,11 +38,11 @@ namespace backend { namespace metal {
nxtProcTable GetNonValidatingProcs();
nxtProcTable GetValidatingProcs();
void Init(id<MTLDevice> metalDevice, nxtProcTable* procs, nxtDevice* device) {
void Init(id<MTLDevice> metalDevice, nxtProcTable* procs, dawnDevice* device) {
*device = nullptr;
*procs = GetValidatingProcs();
*device = reinterpret_cast<nxtDevice>(new Device(metalDevice));
*device = reinterpret_cast<dawnDevice>(new Device(metalDevice));
}
// Device

View File

@ -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<nxtDevice>(new Device);
*device = reinterpret_cast<dawnDevice>(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);
}
}

View File

@ -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() {

View File

@ -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<GLADloadproc>(getProc));
*procs = GetValidatingProcs();
*device = reinterpret_cast<nxtDevice>(new Device);
*device = reinterpret_cast<dawnDevice>(new Device);
glEnable(GL_DEPTH_TEST);
glEnable(GL_SCISSOR_TEST);

View File

@ -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 {

View File

@ -56,31 +56,31 @@ namespace backend { namespace vulkan {
nxtProcTable GetValidatingProcs();
void Init(nxtProcTable* procs,
nxtDevice* device,
dawnDevice* device,
const std::vector<const char*>& requiredInstanceExtensions) {
*procs = GetValidatingProcs();
*device = reinterpret_cast<nxtDevice>(new Device(requiredInstanceExtensions));
*device = reinterpret_cast<dawnDevice>(new Device(requiredInstanceExtensions));
}
VkInstance GetInstance(nxtDevice device) {
VkInstance GetInstance(dawnDevice device) {
Device* backendDevice = reinterpret_cast<Device*>(device);
return backendDevice->GetInstance();
}
dawnSwapChainImplementation CreateNativeSwapChainImpl(nxtDevice device, VkSurfaceKHR surface) {
dawnSwapChainImplementation CreateNativeSwapChainImpl(dawnDevice device, VkSurfaceKHR surface) {
Device* backendDevice = reinterpret_cast<Device*>(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<NativeSwapChainImpl*>(swapChain->userData);
return static_cast<nxtTextureFormat>(impl->GetPreferredFormat());
return static_cast<dawnTextureFormat>(impl->GetPreferredFormat());
}
// Device

View File

@ -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<nxtTextureFormat>(GetPreferredFormat()));
ASSERT(format == static_cast<dawnTextureFormat>(GetPreferredFormat()));
// TODO(cwallez@chromium.org): need to check usage works too
// Create the swapchain with the configuration we chose

View File

@ -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);

View File

@ -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<dawn::TextureUsageBit>(im.textureUsage);
}

View File

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

View File

@ -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

View File

@ -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<MapReadUserdata*>(static_cast<uintptr_t>(userdata_));
userdata->test->mReadbackSlots[userdata->slot].mappedData = data;

View File

@ -128,9 +128,9 @@ class NXTTest : public ::testing::TestWithParam<BackendType> {
// 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

View File

@ -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<BufferMapReadTests*>(static_cast<uintptr_t>(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<BufferMapWriteTests*>(static_cast<uintptr_t>(userdata));

File diff suppressed because it is too large Load Diff

View File

@ -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<const uint32_t*>(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<uint32_t*>(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();
}));

View File

@ -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<nxtCallbackUserdata>(reinterpret_cast<uintptr_t>(this)));
device.SetErrorCallback(ValidationTest::OnDeviceError, static_cast<dawnCallbackUserdata>(reinterpret_cast<uintptr_t>(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<ValidationTest*>(static_cast<uintptr_t>(userdata1));
size_t index = static_cast<size_t>(userdata2);

View File

@ -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<BuilderStatusExpectations> mExpectations;
template<typename Builder>
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

View File

@ -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);

View File

@ -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<uint64_t>(&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 = {};
};

View File

@ -26,9 +26,9 @@
#import <QuartzCore/CAMetalLayer.h>
namespace backend { namespace metal {
void Init(id<MTLDevice> metalDevice, nxtProcTable* procs, nxtDevice* device);
void SetNextDrawable(nxtDevice device, id<CAMetalDrawable> drawable);
void Present(nxtDevice device);
void Init(id<MTLDevice> metalDevice, nxtProcTable* procs, dawnDevice* device);
void SetNextDrawable(dawnDevice device, id<CAMetalDrawable> 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<uint64_t>(&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<MTLDevice> mMetalDevice = nil;
nxtDevice mBackendDevice = nullptr;
dawnDevice mBackendDevice = nullptr;
dawnSwapChainImplementation mSwapchainImpl = {};
};

View File

@ -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;
}
};

View File

@ -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<void* (*)(const char*)>(glfwGetProcAddress),
procs, device);
@ -126,12 +126,12 @@ namespace utils {
return reinterpret_cast<uint64_t>(&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 = {};
};

View File

@ -24,13 +24,13 @@
namespace backend { namespace vulkan {
void Init(nxtProcTable* procs,
nxtDevice* device,
dawnDevice* device,
const std::vector<const char*>& 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<uint64_t>(&mSwapchainImpl);
}
nxtTextureFormat GetPreferredSwapChainTextureFormat() override {
dawnTextureFormat GetPreferredSwapChainTextureFormat() override {
ASSERT(mSwapchainImpl.userData != nullptr);
return backend::vulkan::GetNativeSwapChainPreferredFormat(&mSwapchainImpl);
}
private:
nxtDevice mDevice;
dawnDevice mDevice;
dawnSwapChainImplementation mSwapchainImpl = {};
};

View File

@ -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);