Introduce the webgpu[_cpp].h headers.
webgpu.h is the "official" header for WebGPU in native and is being
developed in https://github.com/webgpu-native/webgpu-headers
dawn.h and dawncpp.h are changed to become webgpu.h and webgpu_cpp.h
respectively and use the new naming convention. New dawn.h and dawncpp.h
headers are created that just proxy the types, constants and functions
to their WebGPU counterpart.
Almost no naming change is done in Dawn in this commit, which help check
that the proxying headers work correctly. A couple changes were
necessary, in particular for tests of the internal of dawncpp.h, and a
workaround for a standard library bug for std::underlying_type was
removed because it is no longer needed and got in the way.
Finally since some templates were renamed to match the name of the file
they create instead of using the generic "api" name.
BUG=dawn:22
Change-Id: I12ee22d0b02ccb5b8a52ceccabb3e63ce74da007
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12480
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
diff --git a/generator/dawn_json_generator.py b/generator/dawn_json_generator.py
index 9f52d95..3884ced 100644
--- a/generator/dawn_json_generator.py
+++ b/generator/dawn_json_generator.py
@@ -352,6 +352,12 @@
if name.native:
return name.concatcase()
else:
+ return 'WGPU' + name.CamelCase()
+
+def as_cTypeDawn(name):
+ if name.native:
+ return name.concatcase()
+ else:
return 'Dawn' + name.CamelCase()
def as_cTypeEnumSpecialCase(typ):
@@ -406,6 +412,10 @@
def as_cEnum(type_name, value_name):
assert(not type_name.native and not value_name.native)
+ return 'WGPU' + type_name.CamelCase() + '_' + value_name.CamelCase()
+
+def as_cEnumDawn(type_name, value_name):
+ assert(not type_name.native and not value_name.native)
return 'DAWN' + '_' + type_name.SNAKE_CASE() + '_' + value_name.SNAKE_CASE()
def as_cppEnum(value_name):
@@ -416,6 +426,10 @@
def as_cMethod(type_name, method_name):
assert(not type_name.native and not method_name.native)
+ return 'wgpu' + type_name.CamelCase() + method_name.CamelCase()
+
+def as_cMethodDawn(type_name, method_name):
+ assert(not type_name.native and not method_name.native)
return 'dawn' + type_name.CamelCase() + method_name.CamelCase()
def as_MethodSuffix(type_name, method_name):
@@ -424,6 +438,10 @@
def as_cProc(type_name, method_name):
assert(not type_name.native and not method_name.native)
+ return 'WGPU' + 'Proc' + type_name.CamelCase() + method_name.CamelCase()
+
+def as_cProcDawn(type_name, method_name):
+ assert(not type_name.native and not method_name.native)
return 'Dawn' + 'Proc' + type_name.CamelCase() + method_name.CamelCase()
def as_frontendType(typ):
@@ -488,11 +506,15 @@
'as_annotated_cType': lambda arg: annotated(as_cTypeEnumSpecialCase(arg.type), arg),
'as_annotated_cppType': lambda arg: annotated(as_cppType(arg.type.name), arg),
'as_cEnum': as_cEnum,
+ 'as_cEnumDawn': as_cEnumDawn,
'as_cppEnum': as_cppEnum,
'as_cMethod': as_cMethod,
+ 'as_cMethodDawn': as_cMethodDawn,
'as_MethodSuffix': as_MethodSuffix,
'as_cProc': as_cProc,
+ 'as_cProcDawn': as_cProcDawn,
'as_cType': as_cType,
+ 'as_cTypeDawn': as_cTypeDawn,
'as_cppType': as_cppType,
'convert_cType_to_cppType': convert_cType_to_cppType,
'as_varName': as_varName,
@@ -506,17 +528,19 @@
cpp_params = {'native_methods': lambda typ: cpp_native_methods(api_params['types'], typ)}
if 'dawn_headers' in targets:
- renders.append(FileRender('api.h', 'src/include/dawn/dawn.h', [base_params, api_params, c_params]))
- renders.append(FileRender('api_proc_table.h', 'src/include/dawn/dawn_proc_table.h', [base_params, api_params, c_params]))
+ renders.append(FileRender('webgpu.h', 'src/include/dawn/webgpu.h', [base_params, api_params, c_params]))
+ renders.append(FileRender('dawn.h', 'src/include/dawn/dawn.h', [base_params, api_params, c_params]))
+ renders.append(FileRender('dawn_proc_table.h', 'src/include/dawn/dawn_proc_table.h', [base_params, api_params, c_params]))
if 'dawncpp_headers' in targets:
- renders.append(FileRender('apicpp.h', 'src/include/dawn/dawncpp.h', [base_params, api_params, cpp_params]))
+ renders.append(FileRender('webgpu_cpp.h', 'src/include/dawn/webgpu_cpp.h', [base_params, api_params, cpp_params]))
+ renders.append(FileRender('dawncpp.h', 'src/include/dawn/dawncpp.h', [base_params, api_params, cpp_params]))
if 'dawn_proc' in targets:
- renders.append(FileRender('api_proc.c', 'src/dawn/dawn_proc.c', [base_params, api_params, c_params]))
+ renders.append(FileRender('dawn_proc.c', 'src/dawn/dawn_proc.c', [base_params, api_params, c_params]))
if 'dawncpp' in targets:
- renders.append(FileRender('apicpp.cpp', 'src/dawn/dawncpp.cpp', [base_params, api_params, cpp_params]))
+ renders.append(FileRender('webgpu_cpp.cpp', 'src/dawn/webgpu_cpp.cpp', [base_params, api_params, cpp_params]))
if 'mock_dawn' in targets:
renders.append(FileRender('mock_api.h', 'src/dawn/mock_dawn.h', [base_params, api_params, c_params]))
diff --git a/generator/templates/api.h b/generator/templates/api.h
deleted file mode 100644
index 3782fa7..0000000
--- a/generator/templates/api.h
+++ /dev/null
@@ -1,118 +0,0 @@
-//* Copyright 2017 The Dawn Authors
-//*
-//* Licensed under the Apache License, Version 2.0 (the "License");
-//* you may not use this file except in compliance with the License.
-//* You may obtain a copy of the License at
-//*
-//* http://www.apache.org/licenses/LICENSE-2.0
-//*
-//* Unless required by applicable law or agreed to in writing, software
-//* distributed under the License is distributed on an "AS IS" BASIS,
-//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//* See the License for the specific language governing permissions and
-//* limitations under the License.
-
-#ifndef DAWN_DAWN_H_
-#define DAWN_DAWN_H_
-
-#include "dawn/dawn_export.h"
-
-#include <stdint.h>
-#include <stddef.h>
-#include <stdbool.h>
-
-const uint64_t DAWN_WHOLE_SIZE = 0xffffffffffffffffULL; // UINT64_MAX
-
-typedef uint32_t WGPUFlags;
-
-{% for type in by_category["object"] %}
- typedef struct {{as_cType(type.name)}}Impl* {{as_cType(type.name)}};
-{% endfor %}
-
-{% for type in by_category["enum"] + by_category["bitmask"] %}
- typedef enum {{as_cType(type.name)}} {
- {% for value in type.values %}
- {{as_cEnum(type.name, value.name)}} = 0x{{format(value.value, "08X")}},
- {% endfor %}
- {{as_cEnum(type.name, Name("force32"))}} = 0x7FFFFFFF
- } {{as_cType(type.name)}};
- {% if type.category == "bitmask" %}
- typedef WGPUFlags {{as_cType(type.name)}}Flags;
- {% endif %}
-
-{% endfor %}
-
-{% for type in by_category["structure"] %}
- typedef struct {{as_cType(type.name)}} {
- {% if type.extensible %}
- void const * nextInChain;
- {% endif %}
- {% for member in type.members %}
- {{as_annotated_cType(member)}};
- {% endfor %}
- } {{as_cType(type.name)}};
-
-{% endfor %}
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// Custom types depending on the target language
-typedef void (*DawnBufferCreateMappedCallback)(DawnBufferMapAsyncStatus status,
- DawnCreateBufferMappedResult result,
- void* userdata);
-typedef void (*DawnBufferMapReadCallback)(DawnBufferMapAsyncStatus status,
- const void* data,
- uint64_t dataLength,
- void* userdata);
-typedef void (*DawnBufferMapWriteCallback)(DawnBufferMapAsyncStatus status,
- void* data,
- uint64_t dataLength,
- void* userdata);
-typedef void (*DawnFenceOnCompletionCallback)(DawnFenceCompletionStatus status, void* userdata);
-typedef void (*DawnErrorCallback)(DawnErrorType type, const char* message, void* userdata);
-
-typedef void (*DawnProc)();
-
-#if !defined(DAWN_SKIP_PROCS)
-
-typedef DawnProc (*DawnProcGetProcAddress)(DawnDevice device, const char* procName);
-
-{% for type in by_category["object"] %}
- // Procs of {{type.name.CamelCase()}}
- {% for method in native_methods(type) %}
- typedef {{as_cType(method.return_type.name)}} (*{{as_cProc(type.name, method.name)}})(
- {{-as_cType(type.name)}} {{as_varName(type.name)}}
- {%- for arg in method.arguments -%}
- , {{as_annotated_cType(arg)}}
- {%- endfor -%}
- );
- {% endfor %}
-
-{% endfor %}
-#endif // !defined(DAWN_SKIP_PROCS)
-
-#if !defined(DAWN_SKIP_DECLARATIONS)
-
-DAWN_EXPORT DawnProc DawnGetProcAddress(DawnDevice device, const char* procName);
-
-{% for type in by_category["object"] %}
- // Methods of {{type.name.CamelCase()}}
- {% for method in native_methods(type) %}
- DAWN_EXPORT {{as_cType(method.return_type.name)}} {{as_cMethod(type.name, method.name)}}(
- {{-as_cType(type.name)}} {{as_varName(type.name)}}
- {%- for arg in method.arguments -%}
- , {{as_annotated_cType(arg)}}
- {%- endfor -%}
- );
- {% endfor %}
-
-{% endfor %}
-#endif // !defined(DAWN_SKIP_DECLARATIONS)
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // DAWN_DAWN_H_
diff --git a/generator/templates/dawn.h b/generator/templates/dawn.h
new file mode 100644
index 0000000..7a68347
--- /dev/null
+++ b/generator/templates/dawn.h
@@ -0,0 +1,61 @@
+//* Copyright 2017 The Dawn Authors
+//*
+//* Licensed under the Apache License, Version 2.0 (the "License");
+//* you may not use this file except in compliance with the License.
+//* You may obtain a copy of the License at
+//*
+//* http://www.apache.org/licenses/LICENSE-2.0
+//*
+//* Unless required by applicable law or agreed to in writing, software
+//* distributed under the License is distributed on an "AS IS" BASIS,
+//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//* See the License for the specific language governing permissions and
+//* limitations under the License.
+
+// This temporary header translates all the previous Dawn C API to the webgpu.h
+// API so that during a small transition period both headers are supported.
+
+#ifndef DAWN_DAWN_H_
+#define DAWN_DAWN_H_
+
+#include "webgpu.h"
+
+#define DAWN_WHOLE_SIZE WGPU_WHOLE_SIZE
+
+{% for type in by_category["object"] %}
+ typedef {{as_cType(type.name)}} {{as_cTypeDawn(type.name)}};
+ typedef {{as_cType(type.name)}}Impl {{as_cTypeDawn(type.name)}}Impl;
+ {% for method in native_methods(type) %}
+ typedef {{as_cProc(type.name, method.name)}} {{as_cProcDawn(type.name, method.name)}};
+ #define {{as_cMethodDawn(type.name, method.name)}} {{as_cMethod(type.name, method.name)}}
+ {% endfor %}
+{% endfor %}
+
+{% for type in by_category["enum"] + by_category["bitmask"] %}
+ typedef {{as_cType(type.name)}} {{as_cTypeDawn(type.name)}};
+ {% if type.category == "bitmask" %}
+ typedef {{as_cType(type.name)}}Flags {{as_cTypeDawn(type.name)}}Flags;
+ {% endif %}
+
+ {% for value in type.values %}
+ #define {{as_cEnumDawn(type.name, value.name)}} {{as_cEnum(type.name, value.name)}}
+ {% endfor %}
+ #define {{as_cEnumDawn(type.name, Name("force32"))}} {{as_cEnum(type.name, Name("force32"))}}
+{% endfor %}
+
+{% for type in by_category["structure"] %}
+ typedef {{as_cType(type.name)}} {{as_cTypeDawn(type.name)}};
+{% endfor %}
+
+typedef WGPUBufferCreateMappedCallback DawnBufferCreateMappedCallback;
+typedef WGPUBufferMapReadCallback DawnBufferMapReadCallback;
+typedef WGPUBufferMapWriteCallback DawnBufferMapWriteCallback;
+typedef WGPUFenceOnCompletionCallback DawnFenceOnCompletionCallback;
+typedef WGPUErrorCallback DawnErrorCallback;
+
+typedef WGPUProc DawnProc;
+
+typedef WGPUProcGetProcAddress DawnProcGetProcAddress;
+#define DawnGetProcAddress WGPUGetProcAddress
+
+#endif // DAWN_DAWN_H_
diff --git a/generator/templates/dawn_native/ProcTable.cpp b/generator/templates/dawn_native/ProcTable.cpp
index 68f81d8..9a75bd5 100644
--- a/generator/templates/dawn_native/ProcTable.cpp
+++ b/generator/templates/dawn_native/ProcTable.cpp
@@ -99,7 +99,7 @@
return entry->proc;
}
- if (strcmp(procName, "dawnGetProcAddress") == 0) {
+ if (strcmp(procName, "wgpuGetProcAddress") == 0) {
return reinterpret_cast<DawnProc>(NativeGetProcAddress);
}
diff --git a/generator/templates/api_proc.c b/generator/templates/dawn_proc.c
similarity index 96%
rename from generator/templates/api_proc.c
rename to generator/templates/dawn_proc.c
index a622591..2632124 100644
--- a/generator/templates/api_proc.c
+++ b/generator/templates/dawn_proc.c
@@ -26,7 +26,7 @@
}
}
-DawnProc DawnGetProcAddress(DawnDevice device, const char* procName) {
+WGPUProc WGPUGetProcAddress(WGPUDevice device, const char* procName) {
return procs.getProcAddress(device, procName);
}
diff --git a/generator/templates/api_proc_table.h b/generator/templates/dawn_proc_table.h
similarity index 93%
rename from generator/templates/api_proc_table.h
rename to generator/templates/dawn_proc_table.h
index 9fb850c..a6a9c88 100644
--- a/generator/templates/api_proc_table.h
+++ b/generator/templates/dawn_proc_table.h
@@ -15,10 +15,10 @@
#ifndef DAWN_DAWN_PROC_TABLE_H_
#define DAWN_DAWN_PROC_TABLE_H_
-#include "dawn/dawn.h"
+#include "dawn/webgpu.h"
typedef struct DawnProcTable {
- DawnProcGetProcAddress getProcAddress;
+ WGPUProcGetProcAddress getProcAddress;
{% for type in by_category["object"] %}
{% for method in native_methods(type) %}
diff --git a/generator/templates/dawn_wire/WireCmd.cpp b/generator/templates/dawn_wire/WireCmd.cpp
index adac9fc..af7812a 100644
--- a/generator/templates/dawn_wire/WireCmd.cpp
+++ b/generator/templates/dawn_wire/WireCmd.cpp
@@ -457,31 +457,31 @@
{% endfor %}
// Implementations of serialization/deserialization of DawnDeviceProperties.
- size_t SerializedDawnDevicePropertiesSize(const DawnDeviceProperties* deviceProperties) {
+ size_t SerializedWGPUDevicePropertiesSize(const DawnDeviceProperties* deviceProperties) {
return sizeof(DawnDeviceProperties) +
- DawnDevicePropertiesGetExtraRequiredSize(*deviceProperties);
+ WGPUDevicePropertiesGetExtraRequiredSize(*deviceProperties);
}
- void SerializeDawnDeviceProperties(const DawnDeviceProperties* deviceProperties,
+ void SerializeWGPUDeviceProperties(const DawnDeviceProperties* deviceProperties,
char* serializeBuffer) {
- size_t devicePropertiesSize = SerializedDawnDevicePropertiesSize(deviceProperties);
- DawnDevicePropertiesTransfer* transfer =
- reinterpret_cast<DawnDevicePropertiesTransfer*>(serializeBuffer);
+ size_t devicePropertiesSize = SerializedWGPUDevicePropertiesSize(deviceProperties);
+ WGPUDevicePropertiesTransfer* transfer =
+ reinterpret_cast<WGPUDevicePropertiesTransfer*>(serializeBuffer);
serializeBuffer += devicePropertiesSize;
- DawnDevicePropertiesSerialize(*deviceProperties, transfer, &serializeBuffer);
+ WGPUDevicePropertiesSerialize(*deviceProperties, transfer, &serializeBuffer);
}
- bool DeserializeDawnDeviceProperties(DawnDeviceProperties* deviceProperties,
+ bool DeserializeWGPUDeviceProperties(DawnDeviceProperties* deviceProperties,
const volatile char* deserializeBuffer) {
- size_t devicePropertiesSize = SerializedDawnDevicePropertiesSize(deviceProperties);
- const volatile DawnDevicePropertiesTransfer* transfer = nullptr;
+ size_t devicePropertiesSize = SerializedWGPUDevicePropertiesSize(deviceProperties);
+ const volatile WGPUDevicePropertiesTransfer* transfer = nullptr;
if (GetPtrFromBuffer(&deserializeBuffer, &devicePropertiesSize, 1, &transfer) !=
DeserializeResult::Success) {
return false;
}
- return DawnDevicePropertiesDeserialize(deviceProperties, transfer, &deserializeBuffer,
+ return WGPUDevicePropertiesDeserialize(deviceProperties, transfer, &deserializeBuffer,
&devicePropertiesSize,
nullptr) == DeserializeResult::Success;
}
diff --git a/generator/templates/dawn_wire/client/ApiProcs.cpp b/generator/templates/dawn_wire/client/ApiProcs.cpp
index abf4fbd..b93e144 100644
--- a/generator/templates/dawn_wire/client/ApiProcs.cpp
+++ b/generator/templates/dawn_wire/client/ApiProcs.cpp
@@ -121,7 +121,7 @@
return entry->proc;
}
- if (strcmp(procName, "dawnGetProcAddress") == 0) {
+ if (strcmp(procName, "wgpuGetProcAddress") == 0) {
return reinterpret_cast<DawnProc>(ClientGetProcAddress);
}
diff --git a/generator/templates/dawncpp.h b/generator/templates/dawncpp.h
new file mode 100644
index 0000000..a944e58
--- /dev/null
+++ b/generator/templates/dawncpp.h
@@ -0,0 +1,54 @@
+//* Copyright 2017 The Dawn Authors
+//*
+//* Licensed under the Apache License, Version 2.0 (the "License");
+//* you may not use this file except in compliance with the License.
+//* You may obtain a copy of the License at
+//*
+//* http://www.apache.org/licenses/LICENSE-2.0
+//*
+//* Unless required by applicable law or agreed to in writing, software
+//* distributed under the License is distributed on an "AS IS" BASIS,
+//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//* See the License for the specific language governing permissions and
+//* limitations under the License.
+
+// This temporary header translates all the previous Dawn C++ API to the webgpu_cpp.h
+// API so that during a small transition period both headers are supported.
+
+#ifndef DAWN_DAWNCPP_H_
+#define DAWN_DAWNCPP_H_
+
+#include "dawn/dawn.h"
+#include "dawn/webgpu_cpp.h"
+
+namespace dawn {
+
+ static constexpr uint64_t kWholeSize = wgpu::kWholeSize;
+
+ {% for type in by_category["enum"] %}
+ using {{as_cppType(type.name)}} = wgpu::{{as_cppType(type.name)}};
+ {% endfor %}
+
+ {% for type in by_category["bitmask"] %}
+ using {{as_cppType(type.name)}} = wgpu::{{as_cppType(type.name)}};
+ {% endfor %}
+
+ using Proc = wgpu::Proc;
+ {% for type in by_category["natively defined"] %}
+ using {{as_cppType(type.name)}} = wgpu::{{as_cppType(type.name)}};
+ {% endfor %}
+
+ {% for type in by_category["object"] %}
+ using {{as_cppType(type.name)}} = wgpu::{{as_cppType(type.name)}};
+ {% endfor %}
+
+ {% for type in by_category["structure"] %}
+ using {{as_cppType(type.name)}} = wgpu::{{as_cppType(type.name)}};
+ {% endfor %}
+
+ static inline Proc GetProcAddress(Device const& device, const char* procName) {
+ return wgpu::GetProcAddress(device, procName);
+ }
+} // namespace dawn
+
+#endif // DAWN_DAWNCPP_H_
diff --git a/generator/templates/webgpu.h b/generator/templates/webgpu.h
new file mode 100644
index 0000000..91e6eff
--- /dev/null
+++ b/generator/templates/webgpu.h
@@ -0,0 +1,148 @@
+// BSD 3-Clause License
+//
+// Copyright (c) 2019, "WebGPU native" developers
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice, this
+// list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifndef WEBGPU_H_
+#define WEBGPU_H_
+
+#if defined(WGPU_SHARED_LIBRARY)
+# if defined(_WIN32)
+# if defined(WGPU_IMPLEMENTATION)
+# define WGPU_EXPORT __declspec(dllexport)
+# else
+# define WGPU_EXPORT __declspec(dllimport)
+# endif
+# else // defined(_WIN32)
+# if defined(WGPU_IMPLEMENTATION)
+# define WGPU_EXPORT __attribute__((visibility("default")))
+# else
+# define WGPU_EXPORT
+# endif
+# endif // defined(_WIN32)
+#else // defined(WGPU_SHARED_LIBRARY)
+# define WGPU_EXPORT
+#endif // defined(WGPU_SHARED_LIBRARY)
+
+#include <stdint.h>
+#include <stddef.h>
+#include <stdbool.h>
+
+const uint64_t WGPU_WHOLE_SIZE = 0xffffffffffffffffULL; // UINT64_MAX
+
+typedef uint32_t WGPUFlags;
+
+{% for type in by_category["object"] %}
+ typedef struct {{as_cType(type.name)}}Impl* {{as_cType(type.name)}};
+{% endfor %}
+
+{% for type in by_category["enum"] + by_category["bitmask"] %}
+ typedef enum {{as_cType(type.name)}} {
+ {% for value in type.values %}
+ {{as_cEnum(type.name, value.name)}} = 0x{{format(value.value, "08X")}},
+ {% endfor %}
+ {{as_cEnum(type.name, Name("force32"))}} = 0x7FFFFFFF
+ } {{as_cType(type.name)}};
+ {% if type.category == "bitmask" %}
+ typedef WGPUFlags {{as_cType(type.name)}}Flags;
+ {% endif %}
+
+{% endfor %}
+
+{% for type in by_category["structure"] %}
+ typedef struct {{as_cType(type.name)}} {
+ {% if type.extensible %}
+ void const * nextInChain;
+ {% endif %}
+ {% for member in type.members %}
+ {{as_annotated_cType(member)}};
+ {% endfor %}
+ } {{as_cType(type.name)}};
+
+{% endfor %}
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void (*WGPUBufferCreateMappedCallback)(WGPUBufferMapAsyncStatus status,
+ WGPUCreateBufferMappedResult result,
+ void* userdata);
+typedef void (*WGPUBufferMapReadCallback)(WGPUBufferMapAsyncStatus status,
+ const void* data,
+ uint64_t dataLength,
+ void* userdata);
+typedef void (*WGPUBufferMapWriteCallback)(WGPUBufferMapAsyncStatus status,
+ void* data,
+ uint64_t dataLength,
+ void* userdata);
+typedef void (*WGPUFenceOnCompletionCallback)(WGPUFenceCompletionStatus status, void* userdata);
+typedef void (*WGPUErrorCallback)(WGPUErrorType type, const char* message, void* userdata);
+
+typedef void (*WGPUProc)();
+
+#if !defined(WGPU_SKIP_PROCS)
+
+typedef WGPUProc (*WGPUProcGetProcAddress)(WGPUDevice device, const char* procName);
+
+{% for type in by_category["object"] if len(native_methods(type)) > 0 %}
+ // Procs of {{type.name.CamelCase()}}
+ {% for method in native_methods(type) %}
+ typedef {{as_cType(method.return_type.name)}} (*{{as_cProc(type.name, method.name)}})(
+ {{-as_cType(type.name)}} {{as_varName(type.name)}}
+ {%- for arg in method.arguments -%}
+ , {{as_annotated_cType(arg)}}
+ {%- endfor -%}
+ );
+ {% endfor %}
+
+{% endfor %}
+#endif // !defined(WGPU_SKIP_PROCS)
+
+#if !defined(WGPU_SKIP_DECLARATIONS)
+
+WGPU_EXPORT WGPUProc WGPUGetProcAddress(WGPUDevice device, const char* procName);
+
+{% for type in by_category["object"] if len(native_methods(type)) > 0 %}
+ // Methods of {{type.name.CamelCase()}}
+ {% for method in native_methods(type) %}
+ WGPU_EXPORT {{as_cType(method.return_type.name)}} {{as_cMethod(type.name, method.name)}}(
+ {{-as_cType(type.name)}} {{as_varName(type.name)}}
+ {%- for arg in method.arguments -%}
+ , {{as_annotated_cType(arg)}}
+ {%- endfor -%}
+ );
+ {% endfor %}
+
+{% endfor %}
+#endif // !defined(WGPU_SKIP_DECLARATIONS)
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // WEBGPU_H_
diff --git a/generator/templates/apicpp.cpp b/generator/templates/webgpu_cpp.cpp
similarity index 95%
rename from generator/templates/apicpp.cpp
rename to generator/templates/webgpu_cpp.cpp
index ca2724c..a593fbd 100644
--- a/generator/templates/apicpp.cpp
+++ b/generator/templates/webgpu_cpp.cpp
@@ -12,9 +12,9 @@
//* See the License for the specific language governing permissions and
//* limitations under the License.
-#include "dawn/dawncpp.h"
+#include "dawn/webgpu_cpp.h"
-namespace dawn {
+namespace wgpu {
{% for type in by_category["enum"] %}
{% set CppType = as_cppType(type.name) %}
@@ -112,12 +112,12 @@
{% endif %}
}
{% endfor %}
- void {{CppType}}::DawnReference({{CType}} handle) {
+ void {{CppType}}::WGPUReference({{CType}} handle) {
if (handle != nullptr) {
{{as_cMethod(type.name, Name("reference"))}}(handle);
}
}
- void {{CppType}}::DawnRelease({{CType}} handle) {
+ void {{CppType}}::WGPURelease({{CType}} handle) {
if (handle != nullptr) {
{{as_cMethod(type.name, Name("release"))}}(handle);
}
@@ -126,7 +126,7 @@
{% endfor %}
Proc GetProcAddress(Device const& device, const char* procName) {
- return reinterpret_cast<Proc>(DawnGetProcAddress(device.Get(), procName));
+ return reinterpret_cast<Proc>(WGPUGetProcAddress(device.Get(), procName));
}
}
diff --git a/generator/templates/apicpp.h b/generator/templates/webgpu_cpp.h
similarity index 87%
rename from generator/templates/apicpp.h
rename to generator/templates/webgpu_cpp.h
index a0122c9..1326fcb 100644
--- a/generator/templates/apicpp.h
+++ b/generator/templates/webgpu_cpp.h
@@ -12,15 +12,15 @@
//* See the License for the specific language governing permissions and
//* limitations under the License.
-#ifndef DAWN_DAWNCPP_H_
-#define DAWN_DAWNCPP_H_
+#ifndef WEBGPU_CPP_H_
+#define WEBGPU_CPP_H_
-#include "dawn/dawn.h"
+#include "dawn/webgpu.h"
#include "dawn/EnumClassBitmasks.h"
-namespace dawn {
+namespace wgpu {
- static constexpr uint64_t kWholeSize = DAWN_WHOLE_SIZE;
+ static constexpr uint64_t kWholeSize = WGPU_WHOLE_SIZE;
{% for type in by_category["enum"] %}
enum class {{as_cppType(type.name)}} : uint32_t {
@@ -48,7 +48,7 @@
{% endfor %}
- using Proc = DawnProc;
+ using Proc = WGPUProc;
{% for type in by_category["natively defined"] %}
using {{as_cppType(type.name)}} = {{as_cType(type.name)}};
{% endfor %}
@@ -66,10 +66,10 @@
public:
ObjectBase() = default;
ObjectBase(CType handle): mHandle(handle) {
- if (mHandle) Derived::DawnReference(mHandle);
+ if (mHandle) Derived::WGPUReference(mHandle);
}
~ObjectBase() {
- if (mHandle) Derived::DawnRelease(mHandle);
+ if (mHandle) Derived::WGPURelease(mHandle);
}
ObjectBase(ObjectBase const& other)
@@ -77,9 +77,9 @@
}
Derived& operator=(ObjectBase const& other) {
if (&other != this) {
- if (mHandle) Derived::DawnRelease(mHandle);
+ if (mHandle) Derived::WGPURelease(mHandle);
mHandle = other.mHandle;
- if (mHandle) Derived::DawnReference(mHandle);
+ if (mHandle) Derived::WGPUReference(mHandle);
}
return static_cast<Derived&>(*this);
@@ -91,7 +91,7 @@
}
Derived& operator=(ObjectBase&& other) {
if (&other != this) {
- if (mHandle) Derived::DawnRelease(mHandle);
+ if (mHandle) Derived::WGPURelease(mHandle);
mHandle = other.mHandle;
other.mHandle = 0;
}
@@ -102,7 +102,7 @@
ObjectBase(std::nullptr_t) {}
Derived& operator=(std::nullptr_t) {
if (mHandle != nullptr) {
- Derived::DawnRelease(mHandle);
+ Derived::WGPURelease(mHandle);
mHandle = nullptr;
}
return static_cast<Derived&>(*this);
@@ -170,13 +170,13 @@
private:
friend ObjectBase<{{CppType}}, {{CType}}>;
- static void DawnReference({{CType}} handle);
- static void DawnRelease({{CType}} handle);
+ static void WGPUReference({{CType}} handle);
+ static void WGPURelease({{CType}} handle);
};
{% endfor %}
- DAWN_EXPORT Proc GetProcAddress(Device const& device, const char* procName);
+ Proc GetProcAddress(Device const& device, const char* procName);
{% for type in by_category["structure"] %}
struct {{as_cppType(type.name)}} {
@@ -190,6 +190,6 @@
{% endfor %}
-} // namespace dawn
+} // namespace wgpu
-#endif // DAWN_DAWNCPP_H_
+#endif // WEBGPU_CPP_H_
diff --git a/src/dawn/BUILD.gn b/src/dawn/BUILD.gn
index b0c449e..2ee0996 100644
--- a/src/dawn/BUILD.gn
+++ b/src/dawn/BUILD.gn
@@ -34,6 +34,7 @@
outputs = [
"src/include/dawn/dawn.h",
"src/include/dawn/dawn_proc_table.h",
+ "src/include/dawn/webgpu.h",
]
}
@@ -44,10 +45,7 @@
]
sources = get_target_outputs(":dawn_headers_gen")
- sources += [
- "${dawn_root}/src/include/dawn/dawn_export.h",
- "${dawn_root}/src/include/dawn/dawn_wsi.h",
- ]
+ sources += [ "${dawn_root}/src/include/dawn/dawn_wsi.h" ]
}
###############################################################################
@@ -58,6 +56,7 @@
target = "dawncpp_headers"
outputs = [
"src/include/dawn/dawncpp.h",
+ "src/include/dawn/webgpu_cpp.h",
]
}
@@ -78,7 +77,7 @@
dawn_json_generator("dawncpp_gen") {
target = "dawncpp"
outputs = [
- "src/dawn/dawncpp.cpp",
+ "src/dawn/webgpu_cpp.cpp",
]
}
@@ -102,7 +101,7 @@
}
dawn_component("libdawn_proc") {
- DEFINE_PREFIX = "DAWN"
+ DEFINE_PREFIX = "WGPU"
public_deps = [
":dawn_headers",
diff --git a/src/dawn_native/CommandEncoder.cpp b/src/dawn_native/CommandEncoder.cpp
index e0a9cd2..c41484d 100644
--- a/src/dawn_native/CommandEncoder.cpp
+++ b/src/dawn_native/CommandEncoder.cpp
@@ -243,7 +243,7 @@
}
MaybeError ValidateCanUseAs(BufferBase* buffer, dawn::BufferUsage usage) {
- ASSERT(HasZeroOrOneBits(usage));
+ ASSERT(dawn::HasZeroOrOneBits(usage));
if (!(buffer->GetUsage() & usage)) {
return DAWN_VALIDATION_ERROR("buffer doesn't have the required usage.");
}
@@ -252,7 +252,7 @@
}
MaybeError ValidateCanUseAs(TextureBase* texture, dawn::TextureUsage usage) {
- ASSERT(HasZeroOrOneBits(usage));
+ ASSERT(dawn::HasZeroOrOneBits(usage));
if (!(texture->GetUsage() & usage)) {
return DAWN_VALIDATION_ERROR("texture doesn't have the required usage.");
}
diff --git a/src/dawn_native/ErrorData.h b/src/dawn_native/ErrorData.h
index 8c56b7a..fdc7623 100644
--- a/src/dawn_native/ErrorData.h
+++ b/src/dawn_native/ErrorData.h
@@ -19,10 +19,14 @@
#include <string>
#include <vector>
-namespace dawn {
+namespace wgpu {
enum class ErrorType : uint32_t;
}
+namespace dawn {
+ using ErrorType = wgpu::ErrorType;
+}
+
namespace dawn_native {
enum class InternalErrorType : uint32_t;
diff --git a/src/include/dawn/EnumClassBitmasks.h b/src/include/dawn/EnumClassBitmasks.h
index 7e1d769..3c6cb3f 100644
--- a/src/include/dawn/EnumClassBitmasks.h
+++ b/src/include/dawn/EnumClassBitmasks.h
@@ -19,24 +19,15 @@
namespace dawn {
-// std::underlying_type doesn't work in old GLIBC still used in Chrome
-#define CR_GLIBCXX_4_7_0 20120322
-#define CR_GLIBCXX_4_5_4 20120702
-#define CR_GLIBCXX_4_6_4 20121127
-#if defined(__GLIBCXX__) && (__GLIBCXX__ < CR_GLIBCXX_4_7_0 || __GLIBCXX__ == CR_GLIBCXX_4_5_4 || \
- __GLIBCXX__ == CR_GLIBCXX_4_6_4)
-# define CR_USE_FALLBACKS_FOR_OLD_GLIBCXX
-#endif
+ template <typename T>
+ constexpr bool HasZeroOrOneBits(T value) {
+ using Integral = typename std::underlying_type<T>::type;
+ return (static_cast<Integral>(value) & (static_cast<Integral>(value) - 1)) == 0;
+ }
-#if defined(CR_USE_FALLBACKS_FOR_OLD_GLIBCXX)
- template <typename T>
- struct UnderlyingType {
- using type = __underlying_type(T);
- };
-#else
- template <typename T>
- using UnderlyingType = std::underlying_type<T>;
-#endif
+} // namespace dawn
+
+namespace wgpu {
template <typename T>
struct IsDawnBitmask {
@@ -59,7 +50,7 @@
template <typename T>
struct BoolConvertible {
- using Integral = typename UnderlyingType<T>::type;
+ using Integral = typename std::underlying_type<T>::type;
constexpr BoolConvertible(Integral value) : value(value) {
}
@@ -82,19 +73,13 @@
}
};
- template <typename T>
- constexpr bool HasZeroOrOneBits(T value) {
- using Integral = typename UnderlyingType<T>::type;
- return (static_cast<Integral>(value) & (static_cast<Integral>(value) - 1)) == 0;
- }
-
template <typename T1,
typename T2,
typename = typename std::enable_if<LowerBitmask<T1>::enable &&
LowerBitmask<T2>::enable>::type>
constexpr BoolConvertible<typename LowerBitmask<T1>::type> operator|(T1 left, T2 right) {
using T = typename LowerBitmask<T1>::type;
- using Integral = typename UnderlyingType<T>::type;
+ using Integral = typename std::underlying_type<T>::type;
return static_cast<Integral>(LowerBitmask<T1>::Lower(left)) |
static_cast<Integral>(LowerBitmask<T2>::Lower(right));
}
@@ -105,7 +90,7 @@
LowerBitmask<T2>::enable>::type>
constexpr BoolConvertible<typename LowerBitmask<T1>::type> operator&(T1 left, T2 right) {
using T = typename LowerBitmask<T1>::type;
- using Integral = typename UnderlyingType<T>::type;
+ using Integral = typename std::underlying_type<T>::type;
return static_cast<Integral>(LowerBitmask<T1>::Lower(left)) &
static_cast<Integral>(LowerBitmask<T2>::Lower(right));
}
@@ -116,7 +101,7 @@
LowerBitmask<T2>::enable>::type>
constexpr BoolConvertible<typename LowerBitmask<T1>::type> operator^(T1 left, T2 right) {
using T = typename LowerBitmask<T1>::type;
- using Integral = typename UnderlyingType<T>::type;
+ using Integral = typename std::underlying_type<T>::type;
return static_cast<Integral>(LowerBitmask<T1>::Lower(left)) ^
static_cast<Integral>(LowerBitmask<T2>::Lower(right));
}
@@ -124,7 +109,7 @@
template <typename T1>
constexpr BoolConvertible<typename LowerBitmask<T1>::type> operator~(T1 t) {
using T = typename LowerBitmask<T1>::type;
- using Integral = typename UnderlyingType<T>::type;
+ using Integral = typename std::underlying_type<T>::type;
return ~static_cast<Integral>(LowerBitmask<T1>::Lower(t));
}
@@ -157,6 +142,6 @@
l = l ^ r;
return l;
}
-} // namespace dawn
+} // namespace wgpu
#endif // DAWN_ENUM_CLASS_BITMASKS_H_
diff --git a/src/include/dawn/dawn_export.h b/src/include/dawn/dawn_export.h
deleted file mode 100644
index 354bcff..0000000
--- a/src/include/dawn/dawn_export.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2018 The Dawn Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef DAWN_EXPORT_H_
-#define DAWN_EXPORT_H_
-
-#if defined(DAWN_SHARED_LIBRARY)
-# if defined(_WIN32)
-# if defined(DAWN_IMPLEMENTATION)
-# define DAWN_EXPORT __declspec(dllexport)
-# else
-# define DAWN_EXPORT __declspec(dllimport)
-# endif
-# else // defined(_WIN32)
-# if defined(DAWN_IMPLEMENTATION)
-# define DAWN_EXPORT __attribute__((visibility("default")))
-# else
-# define DAWN_EXPORT
-# endif
-# endif // defined(_WIN32)
-#else // defined(DAWN_SHARED_LIBRARY)
-# define DAWN_EXPORT
-#endif // defined(DAWN_SHARED_LIBRARY)
-
-#endif // DAWN_EXPORT_H_
diff --git a/src/include/dawn/dawn_proc.h b/src/include/dawn/dawn_proc.h
index ad0e393..adeec46 100644
--- a/src/include/dawn/dawn_proc.h
+++ b/src/include/dawn/dawn_proc.h
@@ -15,8 +15,8 @@
#ifndef DAWN_DAWN_PROC_H_
#define DAWN_DAWN_PROC_H_
-#include "dawn/dawn.h"
#include "dawn/dawn_proc_table.h"
+#include "dawn/webgpu.h"
#ifdef __cplusplus
extern "C" {
@@ -27,7 +27,7 @@
// default value of the proctable. Setting the proctable back to null is good practice when you
// are done using libdawn_proc since further usage will cause a segfault instead of calling an
// unexpected function.
-DAWN_EXPORT void dawnProcSetProcs(const DawnProcTable* procs);
+WGPU_EXPORT void dawnProcSetProcs(const DawnProcTable* procs);
#ifdef __cplusplus
} // extern "C"
diff --git a/src/include/dawn_wire/Wire.h b/src/include/dawn_wire/Wire.h
index f24f549..fee4a9a 100644
--- a/src/include/dawn_wire/Wire.h
+++ b/src/include/dawn_wire/Wire.h
@@ -36,12 +36,13 @@
};
DAWN_WIRE_EXPORT size_t
- SerializedDawnDevicePropertiesSize(const DawnDeviceProperties* deviceProperties);
+ SerializedWGPUDevicePropertiesSize(const DawnDeviceProperties* deviceProperties);
- DAWN_WIRE_EXPORT void SerializeDawnDeviceProperties(
+ DAWN_WIRE_EXPORT void SerializeWGPUDeviceProperties(
const DawnDeviceProperties* deviceProperties,
char* serializeBuffer);
- DAWN_WIRE_EXPORT bool DeserializeDawnDeviceProperties(DawnDeviceProperties* deviceProperties,
+
+ DAWN_WIRE_EXPORT bool DeserializeWGPUDeviceProperties(DawnDeviceProperties* deviceProperties,
const volatile char* deserializeBuffer);
} // namespace dawn_wire
diff --git a/src/tests/unittests/EnumClassBitmasksTests.cpp b/src/tests/unittests/EnumClassBitmasksTests.cpp
index ad7f708..11c3801 100644
--- a/src/tests/unittests/EnumClassBitmasksTests.cpp
+++ b/src/tests/unittests/EnumClassBitmasksTests.cpp
@@ -16,7 +16,7 @@
#include "dawn/EnumClassBitmasks.h"
-namespace dawn {
+namespace wgpu {
enum class Color : uint32_t {
R = 1,
@@ -80,14 +80,14 @@
TEST(BitmaskTests, ZeroOrOneBits) {
Color zero = static_cast<Color>(0);
- ASSERT_TRUE(HasZeroOrOneBits(zero));
- ASSERT_TRUE(HasZeroOrOneBits(Color::R));
- ASSERT_TRUE(HasZeroOrOneBits(Color::G));
- ASSERT_TRUE(HasZeroOrOneBits(Color::B));
- ASSERT_TRUE(HasZeroOrOneBits(Color::A));
- ASSERT_FALSE(HasZeroOrOneBits(static_cast<Color>(Color::R | Color::G)));
- ASSERT_FALSE(HasZeroOrOneBits(static_cast<Color>(Color::G | Color::B)));
- ASSERT_FALSE(HasZeroOrOneBits(static_cast<Color>(Color::B | Color::A)));
+ ASSERT_TRUE(dawn::HasZeroOrOneBits(zero));
+ ASSERT_TRUE(dawn::HasZeroOrOneBits(Color::R));
+ ASSERT_TRUE(dawn::HasZeroOrOneBits(Color::G));
+ ASSERT_TRUE(dawn::HasZeroOrOneBits(Color::B));
+ ASSERT_TRUE(dawn::HasZeroOrOneBits(Color::A));
+ ASSERT_FALSE(dawn::HasZeroOrOneBits(static_cast<Color>(Color::R | Color::G)));
+ ASSERT_FALSE(dawn::HasZeroOrOneBits(static_cast<Color>(Color::G | Color::B)));
+ ASSERT_FALSE(dawn::HasZeroOrOneBits(static_cast<Color>(Color::B | Color::A)));
}
-} // namespace dawn
+} // namespace wgpu
diff --git a/src/tests/unittests/GetProcAddressTests.cpp b/src/tests/unittests/GetProcAddressTests.cpp
index e2a93b0..4ecaa78 100644
--- a/src/tests/unittests/GetProcAddressTests.cpp
+++ b/src/tests/unittests/GetProcAddressTests.cpp
@@ -102,13 +102,13 @@
// Test GetProcAddress with and without devices on some valid examples
TEST_P(GetProcAddressTests, ValidExamples) {
- ASSERT_EQ(mProcs.getProcAddress(nullptr, "dawnDeviceCreateBuffer"),
+ ASSERT_EQ(mProcs.getProcAddress(nullptr, "wgpuDeviceCreateBuffer"),
reinterpret_cast<DawnProc>(mProcs.deviceCreateBuffer));
- ASSERT_EQ(mProcs.getProcAddress(mDevice.Get(), "dawnDeviceCreateBuffer"),
+ ASSERT_EQ(mProcs.getProcAddress(mDevice.Get(), "wgpuDeviceCreateBuffer"),
reinterpret_cast<DawnProc>(mProcs.deviceCreateBuffer));
- ASSERT_EQ(mProcs.getProcAddress(nullptr, "dawnQueueSubmit"),
+ ASSERT_EQ(mProcs.getProcAddress(nullptr, "wgpuQueueSubmit"),
reinterpret_cast<DawnProc>(mProcs.queueSubmit));
- ASSERT_EQ(mProcs.getProcAddress(mDevice.Get(), "dawnQueueSubmit"),
+ ASSERT_EQ(mProcs.getProcAddress(mDevice.Get(), "wgpuQueueSubmit"),
reinterpret_cast<DawnProc>(mProcs.queueSubmit));
}
@@ -120,8 +120,8 @@
// Test GetProcAddress with and without devices on some invalid
TEST_P(GetProcAddressTests, InvalidExamples) {
- ASSERT_EQ(mProcs.getProcAddress(nullptr, "dawnDeviceDoSomething"), nullptr);
- ASSERT_EQ(mProcs.getProcAddress(mDevice.Get(), "dawnDeviceDoSomething"), nullptr);
+ ASSERT_EQ(mProcs.getProcAddress(nullptr, "wgpuDeviceDoSomething"), nullptr);
+ ASSERT_EQ(mProcs.getProcAddress(mDevice.Get(), "wgpuDeviceDoSomething"), nullptr);
// Trigger the condition where lower_bound will return the end of the procMap.
ASSERT_EQ(mProcs.getProcAddress(nullptr, "zzzzzzz"), nullptr);
@@ -139,9 +139,9 @@
// Test that GetProcAddress supports itself: it is handled specially because it is a
// freestanding function and not a method on an object.
TEST_P(GetProcAddressTests, GetProcAddressItself) {
- ASSERT_EQ(mProcs.getProcAddress(nullptr, "dawnGetProcAddress"),
+ ASSERT_EQ(mProcs.getProcAddress(nullptr, "wgpuGetProcAddress"),
reinterpret_cast<DawnProc>(mProcs.getProcAddress));
- ASSERT_EQ(mProcs.getProcAddress(mDevice.Get(), "dawnGetProcAddress"),
+ ASSERT_EQ(mProcs.getProcAddress(mDevice.Get(), "wgpuGetProcAddress"),
reinterpret_cast<DawnProc>(mProcs.getProcAddress));
}
diff --git a/src/tests/unittests/ObjectBaseTests.cpp b/src/tests/unittests/ObjectBaseTests.cpp
index b42920f..376d004 100644
--- a/src/tests/unittests/ObjectBaseTests.cpp
+++ b/src/tests/unittests/ObjectBaseTests.cpp
@@ -16,19 +16,19 @@
#include "dawn/dawncpp.h"
-class Object : public dawn::ObjectBase<Object, int*> {
- public:
- using ObjectBase::ObjectBase;
- using ObjectBase::operator=;
+class Object : public wgpu::ObjectBase<Object, int*> {
+ public:
+ using ObjectBase::ObjectBase;
+ using ObjectBase::operator=;
- static void DawnReference(int* handle) {
- ASSERT_LE(0, *handle);
- *handle += 1;
- }
- static void DawnRelease(int* handle) {
- ASSERT_LT(0, *handle);
- *handle -= 1;
- }
+ static void WGPUReference(int* handle) {
+ ASSERT_LE(0, *handle);
+ *handle += 1;
+ }
+ static void WGPURelease(int* handle) {
+ ASSERT_LT(0, *handle);
+ *handle -= 1;
+ }
};
// Test that creating an C++ object from a C object takes a ref.
diff --git a/src/tests/unittests/wire/WireDawnDevicePropertiesTests.cpp b/src/tests/unittests/wire/WireDawnDevicePropertiesTests.cpp
index 851b320..e445d63 100644
--- a/src/tests/unittests/wire/WireDawnDevicePropertiesTests.cpp
+++ b/src/tests/unittests/wire/WireDawnDevicePropertiesTests.cpp
@@ -25,12 +25,12 @@
sentDawnDeviceProperties.textureCompressionBC = true;
size_t sentDawnDevicePropertiesSize =
- dawn_wire::SerializedDawnDevicePropertiesSize(&sentDawnDeviceProperties);
+ dawn_wire::SerializedWGPUDevicePropertiesSize(&sentDawnDeviceProperties);
std::vector<char> buffer;
buffer.resize(sentDawnDevicePropertiesSize);
- dawn_wire::SerializeDawnDeviceProperties(&sentDawnDeviceProperties, buffer.data());
+ dawn_wire::SerializeWGPUDeviceProperties(&sentDawnDeviceProperties, buffer.data());
DawnDeviceProperties receivedDawnDeviceProperties;
- dawn_wire::DeserializeDawnDeviceProperties(&receivedDawnDeviceProperties, buffer.data());
+ dawn_wire::DeserializeWGPUDeviceProperties(&receivedDawnDeviceProperties, buffer.data());
ASSERT_TRUE(receivedDawnDeviceProperties.textureCompressionBC);
}