tint->dawn: Move src/dawn_wire -> src/dawn/wire

Bug: dawn:1275
Change-Id: I56535bf4d387c4bd423140705ea70812be073eac
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/79081
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Ben Clayton 2022-02-04 12:51:25 +00:00
parent 7d5badd9f4
commit 20cbe6d9e8
103 changed files with 796 additions and 772 deletions

View File

@ -216,7 +216,7 @@ add_subdirectory(src/dawn)
add_subdirectory(src/dawn/common)
add_subdirectory(src/dawn_platform)
add_subdirectory(src/dawn_native)
add_subdirectory(src/dawn_wire)
add_subdirectory(src/dawn/wire)
# TODO(dawn:269): Remove once the implementation-based swapchains are removed.
add_subdirectory(src/dawn/utils)

View File

@ -15,11 +15,11 @@ This repository contains the implementation of Dawn, which is itself composed of
- [`src`](../src):
- [`dawn`](../src/dawn): root directory for Dawn code
- [`common`](../src/dawn/common): helper code that is allowed to be used by Dawn's core libraries, `dawn_native` and `dawn_wire`. Also allowed for use in all other Dawn targets.
- [`wire`](../src/dawn/wire): code for an implementation of WebGPU as a client-server architecture.
- [`utils`](../src/dawn/utils): helper code to use Dawn used by tests and samples but disallowed for `dawn_native` and `dawn_wire`.
- [`dawn_native`](../src/dawn_native): code for the implementation of WebGPU on top of graphics APIs. Files in this folder are the "frontend" while subdirectories are "backends".
- `<backend>`: code for the implementation of the backend on a specific graphics API, for example `d3d12`, `metal` or `vulkan`.
- [`dawn_platform`](../src/dawn_platform): definition of interfaces for dependency injection in `dawn_native` or `dawn_wire`.
- [`dawn_wire`](../src/dawn_wire): code for an implementation of WebGPU as a client-server architecture.
- [`fuzzers`](../src/dawn/fuzzers): various fuzzers for Dawn that are running in [Clusterfuzz](https://google.github.io/clusterfuzz/).
- [`include`](../src/include): public headers with subdirectories for each library. Note that some headers are auto-generated and not present directly in the directory.
- [`tests`](../src/tests):

View File

@ -39,8 +39,9 @@ static_library("dawn_sample_utils") {
"${dawn_root}/src/dawn/utils",
"${dawn_root}/src/dawn/utils:bindings",
"${dawn_root}/src/dawn/utils:glfw",
"${dawn_root}/src/dawn/wire",
"${dawn_root}/src/dawn_native",
"${dawn_root}/src/dawn_native",
"${dawn_root}/src/dawn_wire",
]
public_configs = [ "${dawn_root}/src/dawn/common:internal_config" ]
}

View File

@ -21,12 +21,12 @@
#include "dawn/utils/BackendBinding.h"
#include "dawn/utils/GLFWUtils.h"
#include "dawn/utils/TerribleCommandBuffer.h"
#include "dawn/wire/WireClient.h"
#include "dawn/wire/WireServer.h"
#include <dawn/dawn_proc.h>
#include <dawn/dawn_wsi.h>
#include <dawn_native/DawnNative.h>
#include <dawn_wire/WireClient.h>
#include <dawn_wire/WireServer.h>
#include "GLFW/glfw3.h"
#include <algorithm>

View File

@ -22,7 +22,7 @@ import("dawn_generator.gni")
_stale_dirs = [
"dawn",
"dawn_native",
"dawn_wire",
"dawn/wire",
"mock",
"src",
]

View File

@ -41,9 +41,9 @@ dawn_allowed_gen_output_dirs = [
"src/dawn/",
"src/dawn_native/",
"src/dawn_native/opengl/",
"src/dawn_wire/client/",
"src/dawn_wire/server/",
"src/dawn_wire/",
"src/dawn/wire/client/",
"src/dawn/wire/server/",
"src/dawn/wire/",
"src/include/dawn/",
"emscripten-bits/",
"webgpu-headers/",

View File

@ -71,6 +71,9 @@ class Name:
def namespace_case(self):
return '::'.join(self.chunks)
def Dirs(self):
return '/'.join(self.chunks)
def js_enum_case(self):
result = self.chunks[0].lower()
for chunk in self.chunks[1:]:
@ -761,7 +764,7 @@ class MultiGeneratorFromDawnJSON(Generator):
def add_commandline_arguments(self, parser):
allowed_targets = [
'dawn_headers', 'dawncpp_headers', 'dawncpp', 'dawn_proc',
'mock_api', 'dawn_wire', "dawn_native_utils"
'mock_api', 'wire', "dawn_native_utils"
]
parser.add_argument('--dawn-json',
@ -942,7 +945,7 @@ class MultiGeneratorFromDawnJSON(Generator):
'src/' + native_dir + '/ObjectType_autogen.cpp',
frontend_params))
if 'dawn_wire' in targets:
if 'wire' in targets:
params_dawn_wire = parse_json(loaded_json,
enabled_tags=['dawn', 'deprecated'],
disabled_tags=['native'])
@ -957,51 +960,51 @@ class MultiGeneratorFromDawnJSON(Generator):
}, additional_params
]
renders.append(
FileRender('dawn_wire/ObjectType.h',
'src/dawn_wire/ObjectType_autogen.h', wire_params))
FileRender('dawn/wire/ObjectType.h',
'src/dawn/wire/ObjectType_autogen.h', wire_params))
renders.append(
FileRender('dawn_wire/WireCmd.h',
'src/dawn_wire/WireCmd_autogen.h', wire_params))
FileRender('dawn/wire/WireCmd.h',
'src/dawn/wire/WireCmd_autogen.h', wire_params))
renders.append(
FileRender('dawn_wire/WireCmd.cpp',
'src/dawn_wire/WireCmd_autogen.cpp', wire_params))
FileRender('dawn/wire/WireCmd.cpp',
'src/dawn/wire/WireCmd_autogen.cpp', wire_params))
renders.append(
FileRender('dawn_wire/client/ApiObjects.h',
'src/dawn_wire/client/ApiObjects_autogen.h',
FileRender('dawn/wire/client/ApiObjects.h',
'src/dawn/wire/client/ApiObjects_autogen.h',
wire_params))
renders.append(
FileRender('dawn_wire/client/ApiProcs.cpp',
'src/dawn_wire/client/ApiProcs_autogen.cpp',
FileRender('dawn/wire/client/ApiProcs.cpp',
'src/dawn/wire/client/ApiProcs_autogen.cpp',
wire_params))
renders.append(
FileRender('dawn_wire/client/ClientBase.h',
'src/dawn_wire/client/ClientBase_autogen.h',
FileRender('dawn/wire/client/ClientBase.h',
'src/dawn/wire/client/ClientBase_autogen.h',
wire_params))
renders.append(
FileRender('dawn_wire/client/ClientHandlers.cpp',
'src/dawn_wire/client/ClientHandlers_autogen.cpp',
FileRender('dawn/wire/client/ClientHandlers.cpp',
'src/dawn/wire/client/ClientHandlers_autogen.cpp',
wire_params))
renders.append(
FileRender(
'dawn_wire/client/ClientPrototypes.inc',
'src/dawn_wire/client/ClientPrototypes_autogen.inc',
'dawn/wire/client/ClientPrototypes.inc',
'src/dawn/wire/client/ClientPrototypes_autogen.inc',
wire_params))
renders.append(
FileRender('dawn_wire/server/ServerBase.h',
'src/dawn_wire/server/ServerBase_autogen.h',
FileRender('dawn/wire/server/ServerBase.h',
'src/dawn/wire/server/ServerBase_autogen.h',
wire_params))
renders.append(
FileRender('dawn_wire/server/ServerDoers.cpp',
'src/dawn_wire/server/ServerDoers_autogen.cpp',
FileRender('dawn/wire/server/ServerDoers.cpp',
'src/dawn/wire/server/ServerDoers_autogen.cpp',
wire_params))
renders.append(
FileRender('dawn_wire/server/ServerHandlers.cpp',
'src/dawn_wire/server/ServerHandlers_autogen.cpp',
FileRender('dawn/wire/server/ServerHandlers.cpp',
'src/dawn/wire/server/ServerHandlers_autogen.cpp',
wire_params))
renders.append(
FileRender(
'dawn_wire/server/ServerPrototypes.inc',
'src/dawn_wire/server/ServerPrototypes_autogen.inc',
'dawn/wire/server/ServerPrototypes.inc',
'src/dawn/wire/server/ServerPrototypes_autogen.inc',
wire_params))
return renders

View File

@ -12,12 +12,12 @@
//* See the License for the specific language governing permissions and
//* limitations under the License.
#include "dawn_wire/WireCmd_autogen.h"
#include "dawn/wire/WireCmd_autogen.h"
#include "dawn/common/Assert.h"
#include "dawn/common/Log.h"
#include "dawn_wire/BufferConsumer_impl.h"
#include "dawn_wire/Wire.h"
#include "dawn/wire/BufferConsumer_impl.h"
#include "dawn/wire/Wire.h"
#include <algorithm>
#include <cstring>

View File

@ -17,9 +17,9 @@
#include <dawn/webgpu.h>
#include "dawn_wire/BufferConsumer.h"
#include "dawn_wire/ObjectType_autogen.h"
#include "dawn_wire/WireResult.h"
#include "dawn/wire/BufferConsumer.h"
#include "dawn/wire/ObjectType_autogen.h"
#include "dawn/wire/WireResult.h"
namespace dawn::wire {

View File

@ -15,8 +15,8 @@
#ifndef DAWNWIRE_CLIENT_APIOBJECTS_AUTOGEN_H_
#define DAWNWIRE_CLIENT_APIOBJECTS_AUTOGEN_H_
#include "dawn_wire/ObjectType_autogen.h"
#include "dawn_wire/client/ObjectBase.h"
#include "dawn/wire/ObjectType_autogen.h"
#include "dawn/wire/client/ObjectBase.h"
namespace dawn::wire::client {

View File

@ -13,8 +13,8 @@
//* limitations under the License.
#include "dawn/common/Log.h"
#include "dawn_wire/client/ApiObjects.h"
#include "dawn_wire/client/Client.h"
#include "dawn/wire/client/ApiObjects.h"
#include "dawn/wire/client/Client.h"
#include <algorithm>
#include <cstring>

View File

@ -15,10 +15,10 @@
#ifndef DAWNWIRE_CLIENT_CLIENTBASE_AUTOGEN_H_
#define DAWNWIRE_CLIENT_CLIENTBASE_AUTOGEN_H_
#include "dawn_wire/ChunkedCommandHandler.h"
#include "dawn_wire/WireCmd_autogen.h"
#include "dawn_wire/client/ApiObjects.h"
#include "dawn_wire/client/ObjectAllocator.h"
#include "dawn/wire/ChunkedCommandHandler.h"
#include "dawn/wire/WireCmd_autogen.h"
#include "dawn/wire/client/ApiObjects.h"
#include "dawn/wire/client/ObjectAllocator.h"
namespace dawn::wire::client {

View File

@ -13,7 +13,7 @@
//* limitations under the License.
#include "dawn/common/Assert.h"
#include "dawn_wire/client/Client.h"
#include "dawn/wire/client/Client.h"
#include <string>

View File

@ -16,11 +16,11 @@
#define DAWNWIRE_SERVER_SERVERBASE_H_
#include "dawn/dawn_proc_table.h"
#include "dawn_wire/ChunkedCommandHandler.h"
#include "dawn_wire/Wire.h"
#include "dawn_wire/WireCmd_autogen.h"
#include "dawn_wire/WireDeserializeAllocator.h"
#include "dawn_wire/server/ObjectStorage.h"
#include "dawn/wire/ChunkedCommandHandler.h"
#include "dawn/wire/Wire.h"
#include "dawn/wire/WireCmd_autogen.h"
#include "dawn/wire/WireDeserializeAllocator.h"
#include "dawn/wire/server/ObjectStorage.h"
namespace dawn::wire::server {

View File

@ -13,7 +13,7 @@
//* limitations under the License.
#include "dawn/common/Assert.h"
#include "dawn_wire/server/Server.h"
#include "dawn/wire/server/Server.h"
namespace dawn::wire::server {
//* Implementation of the command doers

View File

@ -13,7 +13,7 @@
//* limitations under the License.
#include "dawn/common/Assert.h"
#include "dawn_wire/server/Server.h"
#include "dawn/wire/server/Server.h"
namespace dawn::wire::server {
{% for command in cmd_records["command"] %}

View File

@ -89,8 +89,8 @@ static_library("utils") {
deps = [
"${dawn_root}/src/dawn:dawn_proc",
"${dawn_root}/src/dawn/common",
"${dawn_root}/src/dawn/wire",
"${dawn_root}/src/dawn_native:dawn_native_headers",
"${dawn_root}/src/dawn_wire",
"${dawn_spirv_tools_dir}:spvtools_opt",
]
libs = []

View File

@ -15,7 +15,7 @@
#ifndef UTILS_TERRIBLE_COMMAND_BUFFER_H_
#define UTILS_TERRIBLE_COMMAND_BUFFER_H_
#include "dawn_wire/Wire.h"
#include "dawn/wire/Wire.h"
namespace utils {

View File

@ -19,9 +19,9 @@
#include "dawn/common/SystemUtils.h"
#include "dawn/dawn_proc.h"
#include "dawn/utils/TerribleCommandBuffer.h"
#include "dawn/wire/WireClient.h"
#include "dawn/wire/WireServer.h"
#include "dawn_native/DawnNative.h"
#include "dawn_wire/WireClient.h"
#include "dawn_wire/WireServer.h"
#include <algorithm>
#include <cstring>

111
src/dawn/wire/BUILD.gn Normal file
View File

@ -0,0 +1,111 @@
# Copyright 2019 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.
import("../../../scripts/dawn_overrides_with_defaults.gni")
import("${dawn_root}/generator/dawn_generator.gni")
import("${dawn_root}/scripts/dawn_component.gni")
# Public dawn wire headers so they can be publically visible for dependencies of
# dawn/wire
source_set("headers") {
public_deps = [ "${dawn_root}/src/dawn:dawn_headers" ]
all_dependent_configs = [ "${dawn_root}/src/dawn/common:public_include_dirs" ]
sources = [
"${dawn_root}/src/include/dawn/wire/Wire.h",
"${dawn_root}/src/include/dawn/wire/WireClient.h",
"${dawn_root}/src/include/dawn/wire/WireServer.h",
"${dawn_root}/src/include/dawn/wire/dawn_wire_export.h",
]
}
dawn_json_generator("gen") {
target = "wire"
outputs = [
"src/dawn/wire/ObjectType_autogen.h",
"src/dawn/wire/WireCmd_autogen.h",
"src/dawn/wire/WireCmd_autogen.cpp",
"src/dawn/wire/client/ApiObjects_autogen.h",
"src/dawn/wire/client/ApiProcs_autogen.cpp",
"src/dawn/wire/client/ClientBase_autogen.h",
"src/dawn/wire/client/ClientHandlers_autogen.cpp",
"src/dawn/wire/client/ClientPrototypes_autogen.inc",
"src/dawn/wire/server/ServerBase_autogen.h",
"src/dawn/wire/server/ServerDoers_autogen.cpp",
"src/dawn/wire/server/ServerHandlers_autogen.cpp",
"src/dawn/wire/server/ServerPrototypes_autogen.inc",
]
}
dawn_component("wire") {
DEFINE_PREFIX = "DAWN_WIRE"
deps = [
":gen",
"${dawn_root}/src/dawn/common",
]
configs = [ "${dawn_root}/src/dawn/common:internal_config" ]
sources = get_target_outputs(":gen")
sources += [
"BufferConsumer.h",
"BufferConsumer_impl.h",
"ChunkedCommandHandler.cpp",
"ChunkedCommandHandler.h",
"ChunkedCommandSerializer.cpp",
"ChunkedCommandSerializer.h",
"SupportedFeatures.cpp",
"SupportedFeatures.h",
"Wire.cpp",
"WireClient.cpp",
"WireDeserializeAllocator.cpp",
"WireDeserializeAllocator.h",
"WireResult.h",
"WireServer.cpp",
"client/Adapter.cpp",
"client/Adapter.h",
"client/ApiObjects.h",
"client/Buffer.cpp",
"client/Buffer.h",
"client/Client.cpp",
"client/Client.h",
"client/ClientDoers.cpp",
"client/ClientInlineMemoryTransferService.cpp",
"client/Device.cpp",
"client/Device.h",
"client/Instance.cpp",
"client/Instance.h",
"client/LimitsAndFeatures.cpp",
"client/LimitsAndFeatures.h",
"client/ObjectAllocator.h",
"client/Queue.cpp",
"client/Queue.h",
"client/RequestTracker.h",
"client/ShaderModule.cpp",
"client/ShaderModule.h",
"server/ObjectStorage.h",
"server/Server.cpp",
"server/Server.h",
"server/ServerAdapter.cpp",
"server/ServerBuffer.cpp",
"server/ServerDevice.cpp",
"server/ServerInlineMemoryTransferService.cpp",
"server/ServerInstance.cpp",
"server/ServerQueue.cpp",
"server/ServerShaderModule.cpp",
]
# Make headers publicly visible
public_deps = [ ":headers" ]
}

View File

@ -15,7 +15,7 @@
#ifndef DAWNWIRE_BUFFERCONSUMER_H_
#define DAWNWIRE_BUFFERCONSUMER_H_
#include "dawn_wire/WireResult.h"
#include "dawn/wire/WireResult.h"
#include <cstddef>
@ -82,4 +82,4 @@ namespace dawn::wire {
} // namespace dawn::wire
#endif // DAWNWIRE_BUFFERCONSUMER_H_
#endif // DAWNWIRE_BUFFERCONSUMER_H_

View File

@ -15,7 +15,7 @@
#ifndef DAWNWIRE_BUFFERCONSUMER_IMPL_H_
#define DAWNWIRE_BUFFERCONSUMER_IMPL_H_
#include "dawn_wire/BufferConsumer.h"
#include "dawn/wire/BufferConsumer.h"
#include <limits>
#include <type_traits>

View File

@ -13,7 +13,7 @@
# limitations under the License.
DawnJSONGenerator(
TARGET "dawn_wire"
TARGET "wire"
PRINT_NAME "Dawn wire"
RESULT_VARIABLE "DAWN_WIRE_GEN_SOURCES"
)
@ -26,10 +26,10 @@ if(BUILD_SHARED_LIBS)
endif()
target_sources(dawn_wire PRIVATE
"${DAWN_INCLUDE_DIR}/dawn_wire/Wire.h"
"${DAWN_INCLUDE_DIR}/dawn_wire/WireClient.h"
"${DAWN_INCLUDE_DIR}/dawn_wire/WireServer.h"
"${DAWN_INCLUDE_DIR}/dawn_wire/dawn_wire_export.h"
"${DAWN_INCLUDE_DIR}/dawn/wire/Wire.h"
"${DAWN_INCLUDE_DIR}/dawn/wire/WireClient.h"
"${DAWN_INCLUDE_DIR}/dawn/wire/WireServer.h"
"${DAWN_INCLUDE_DIR}/dawn/wire/dawn_wire_export.h"
${DAWN_WIRE_GEN_SOURCES}
"BufferConsumer.h"
"BufferConsumer_impl.h"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "dawn_wire/ChunkedCommandHandler.h"
#include "dawn/wire/ChunkedCommandHandler.h"
#include "dawn/common/Alloc.h"

View File

@ -16,8 +16,8 @@
#define DAWNWIRE_CHUNKEDCOMMANDHANDLER_H_
#include "dawn/common/Assert.h"
#include "dawn_wire/Wire.h"
#include "dawn_wire/WireCmd_autogen.h"
#include "dawn/wire/Wire.h"
#include "dawn/wire/WireCmd_autogen.h"
#include <cstdint>
#include <memory>

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "dawn_wire/ChunkedCommandSerializer.h"
#include "dawn/wire/ChunkedCommandSerializer.h"
namespace dawn::wire {

View File

@ -17,8 +17,8 @@
#include "dawn/common/Alloc.h"
#include "dawn/common/Compiler.h"
#include "dawn_wire/Wire.h"
#include "dawn_wire/WireCmd_autogen.h"
#include "dawn/wire/Wire.h"
#include "dawn/wire/WireCmd_autogen.h"
#include <algorithm>
#include <cstring>

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "dawn_wire/SupportedFeatures.h"
#include "dawn/wire/SupportedFeatures.h"
namespace dawn::wire {

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "dawn_wire/Wire.h"
#include "dawn/wire/Wire.h"
namespace dawn::wire {

View File

@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "dawn_wire/WireClient.h"
#include "dawn_wire/client/Client.h"
#include "dawn/wire/WireClient.h"
#include "dawn/wire/client/Client.h"
namespace dawn::wire {

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "dawn_wire/WireDeserializeAllocator.h"
#include "dawn/wire/WireDeserializeAllocator.h"
#include <algorithm>

View File

@ -15,7 +15,7 @@
#ifndef DAWNWIRE_WIREDESERIALIZEALLOCATOR_H_
#define DAWNWIRE_WIREDESERIALIZEALLOCATOR_H_
#include "dawn_wire/WireCmd_autogen.h"
#include "dawn/wire/WireCmd_autogen.h"
#include <vector>

View File

@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "dawn_wire/WireServer.h"
#include "dawn_wire/server/Server.h"
#include "dawn/wire/WireServer.h"
#include "dawn/wire/server/Server.h"
namespace dawn::wire {

View File

@ -12,10 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "dawn_wire/client/Adapter.h"
#include "dawn/wire/client/Adapter.h"
#include "dawn/common/Log.h"
#include "dawn_wire/client/Client.h"
#include "dawn/wire/client/Client.h"
namespace dawn::wire::client {

View File

@ -17,11 +17,11 @@
#include <dawn/webgpu.h>
#include "dawn_wire/WireClient.h"
#include "dawn_wire/WireCmd_autogen.h"
#include "dawn_wire/client/LimitsAndFeatures.h"
#include "dawn_wire/client/ObjectBase.h"
#include "dawn_wire/client/RequestTracker.h"
#include "dawn/wire/WireClient.h"
#include "dawn/wire/WireCmd_autogen.h"
#include "dawn/wire/client/LimitsAndFeatures.h"
#include "dawn/wire/client/ObjectBase.h"
#include "dawn/wire/client/RequestTracker.h"
namespace dawn::wire::client {

View File

@ -15,15 +15,15 @@
#ifndef DAWNWIRE_CLIENT_APIOBJECTS_H_
#define DAWNWIRE_CLIENT_APIOBJECTS_H_
#include "dawn_wire/client/ObjectBase.h"
#include "dawn/wire/client/ObjectBase.h"
#include "dawn_wire/client/Adapter.h"
#include "dawn_wire/client/Buffer.h"
#include "dawn_wire/client/Device.h"
#include "dawn_wire/client/Instance.h"
#include "dawn_wire/client/Queue.h"
#include "dawn_wire/client/ShaderModule.h"
#include "dawn/wire/client/Adapter.h"
#include "dawn/wire/client/Buffer.h"
#include "dawn/wire/client/Device.h"
#include "dawn/wire/client/Instance.h"
#include "dawn/wire/client/Queue.h"
#include "dawn/wire/client/ShaderModule.h"
#include "dawn_wire/client/ApiObjects_autogen.h"
#include "dawn/wire/client/ApiObjects_autogen.h"
#endif // DAWNWIRE_CLIENT_APIOBJECTS_H_

View File

@ -12,12 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "dawn_wire/client/Buffer.h"
#include "dawn/wire/client/Buffer.h"
#include "dawn_wire/BufferConsumer_impl.h"
#include "dawn_wire/WireCmd_autogen.h"
#include "dawn_wire/client/Client.h"
#include "dawn_wire/client/Device.h"
#include "dawn/wire/BufferConsumer_impl.h"
#include "dawn/wire/WireCmd_autogen.h"
#include "dawn/wire/client/Client.h"
#include "dawn/wire/client/Device.h"
namespace dawn::wire::client {
@ -212,7 +212,8 @@ namespace dawn::wire::client {
return false;
};
// Take into account the client-side status of the request if the server says it is a success.
// Take into account the client-side status of the request if the server says it is a
// success.
if (status == WGPUBufferMapAsyncStatus_Success) {
status = request.clientStatus;
}

View File

@ -17,9 +17,9 @@
#include <dawn/webgpu.h>
#include "dawn_wire/WireClient.h"
#include "dawn_wire/client/ObjectBase.h"
#include "dawn_wire/client/RequestTracker.h"
#include "dawn/wire/WireClient.h"
#include "dawn/wire/client/ObjectBase.h"
#include "dawn/wire/client/RequestTracker.h"
namespace dawn::wire::client {

View File

@ -12,10 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "dawn_wire/client/Client.h"
#include "dawn/wire/client/Client.h"
#include "dawn/common/Compiler.h"
#include "dawn_wire/client/Device.h"
#include "dawn/wire/client/Device.h"
namespace dawn::wire::client {

View File

@ -16,15 +16,15 @@
#define DAWNWIRE_CLIENT_CLIENT_H_
#include <dawn/webgpu.h>
#include <dawn_wire/Wire.h>
#include <dawn/wire/Wire.h>
#include "dawn/common/LinkedList.h"
#include "dawn/common/NonCopyable.h"
#include "dawn_wire/ChunkedCommandSerializer.h"
#include "dawn_wire/WireClient.h"
#include "dawn_wire/WireCmd_autogen.h"
#include "dawn_wire/WireDeserializeAllocator.h"
#include "dawn_wire/client/ClientBase_autogen.h"
#include "dawn/wire/ChunkedCommandSerializer.h"
#include "dawn/wire/WireClient.h"
#include "dawn/wire/WireCmd_autogen.h"
#include "dawn/wire/WireDeserializeAllocator.h"
#include "dawn/wire/client/ClientBase_autogen.h"
namespace dawn::wire::client {
@ -77,7 +77,7 @@ namespace dawn::wire::client {
private:
void DestroyAllObjects();
#include "dawn_wire/client/ClientPrototypes_autogen.inc"
#include "dawn/wire/client/ClientPrototypes_autogen.inc"
ChunkedCommandSerializer mSerializer;
WireDeserializeAllocator mAllocator;

View File

@ -13,8 +13,8 @@
// limitations under the License.
#include "dawn/common/Assert.h"
#include "dawn_wire/client/Client.h"
#include "dawn_wire/client/Device.h"
#include "dawn/wire/client/Client.h"
#include "dawn/wire/client/Device.h"
#include <limits>

View File

@ -14,8 +14,8 @@
#include "dawn/common/Alloc.h"
#include "dawn/common/Assert.h"
#include "dawn_wire/WireClient.h"
#include "dawn_wire/client/Client.h"
#include "dawn/wire/WireClient.h"
#include "dawn/wire/client/Client.h"
#include <cstring>

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "dawn_wire/client/ClientMemoryTransferService_mock.h"
#include "dawn/wire/client/ClientMemoryTransferService_mock.h"
#include <cstdio>
#include "dawn/common/Assert.h"

View File

@ -17,8 +17,8 @@
#include <gmock/gmock.h>
#include "dawn_wire/WireClient.h"
#include "dawn_wire/client/Client.h"
#include "dawn/wire/WireClient.h"
#include "dawn/wire/client/Client.h"
namespace dawn::wire::client {

View File

@ -12,13 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "dawn_wire/client/Device.h"
#include "dawn/wire/client/Device.h"
#include "dawn/common/Assert.h"
#include "dawn/common/Log.h"
#include "dawn_wire/client/ApiObjects_autogen.h"
#include "dawn_wire/client/Client.h"
#include "dawn_wire/client/ObjectAllocator.h"
#include "dawn/wire/client/ApiObjects_autogen.h"
#include "dawn/wire/client/Client.h"
#include "dawn/wire/client/ObjectAllocator.h"
namespace dawn::wire::client {

View File

@ -18,11 +18,11 @@
#include <dawn/webgpu.h>
#include "dawn/common/LinkedList.h"
#include "dawn_wire/WireCmd_autogen.h"
#include "dawn_wire/client/ApiObjects_autogen.h"
#include "dawn_wire/client/LimitsAndFeatures.h"
#include "dawn_wire/client/ObjectBase.h"
#include "dawn_wire/client/RequestTracker.h"
#include "dawn/wire/WireCmd_autogen.h"
#include "dawn/wire/client/ApiObjects_autogen.h"
#include "dawn/wire/client/LimitsAndFeatures.h"
#include "dawn/wire/client/ObjectBase.h"
#include "dawn/wire/client/RequestTracker.h"
#include <memory>

View File

@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "dawn_wire/client/Instance.h"
#include "dawn/wire/client/Instance.h"
#include "dawn_wire/client/Client.h"
#include "dawn/wire/client/Client.h"
namespace dawn::wire::client {

View File

@ -17,10 +17,10 @@
#include <dawn/webgpu.h>
#include "dawn_wire/WireClient.h"
#include "dawn_wire/WireCmd_autogen.h"
#include "dawn_wire/client/ObjectBase.h"
#include "dawn_wire/client/RequestTracker.h"
#include "dawn/wire/WireClient.h"
#include "dawn/wire/WireCmd_autogen.h"
#include "dawn/wire/client/ObjectBase.h"
#include "dawn/wire/client/RequestTracker.h"
namespace dawn::wire::client {

View File

@ -12,10 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "dawn_wire/client/LimitsAndFeatures.h"
#include "dawn/wire/client/LimitsAndFeatures.h"
#include "dawn/common/Assert.h"
#include "dawn_wire/SupportedFeatures.h"
#include "dawn/wire/SupportedFeatures.h"
namespace dawn::wire::client {

View File

@ -17,7 +17,7 @@
#include "dawn/common/Assert.h"
#include "dawn/common/Compiler.h"
#include "dawn_wire/WireCmd_autogen.h"
#include "dawn/wire/WireCmd_autogen.h"
#include <limits>
#include <memory>

View File

@ -18,7 +18,7 @@
#include <dawn/webgpu.h>
#include "dawn/common/LinkedList.h"
#include "dawn_wire/ObjectType_autogen.h"
#include "dawn/wire/ObjectType_autogen.h"
namespace dawn::wire::client {

View File

@ -12,10 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "dawn_wire/client/Queue.h"
#include "dawn/wire/client/Queue.h"
#include "dawn_wire/client/Client.h"
#include "dawn_wire/client/Device.h"
#include "dawn/wire/client/Client.h"
#include "dawn/wire/client/Device.h"
namespace dawn::wire::client {

View File

@ -17,9 +17,9 @@
#include <dawn/webgpu.h>
#include "dawn_wire/WireClient.h"
#include "dawn_wire/client/ObjectBase.h"
#include "dawn_wire/client/RequestTracker.h"
#include "dawn/wire/WireClient.h"
#include "dawn/wire/client/ObjectBase.h"
#include "dawn/wire/client/RequestTracker.h"
namespace dawn::wire::client {

View File

@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "dawn_wire/client/ShaderModule.h"
#include "dawn/wire/client/ShaderModule.h"
#include "dawn_wire/client/Client.h"
#include "dawn/wire/client/Client.h"
namespace dawn::wire::client {

View File

@ -17,8 +17,8 @@
#include <dawn/webgpu.h>
#include "dawn_wire/client/ObjectBase.h"
#include "dawn_wire/client/RequestTracker.h"
#include "dawn/wire/client/ObjectBase.h"
#include "dawn/wire/client/RequestTracker.h"
namespace dawn::wire::client {

View File

@ -15,8 +15,8 @@
#ifndef DAWNWIRE_SERVER_OBJECTSTORAGE_H_
#define DAWNWIRE_SERVER_OBJECTSTORAGE_H_
#include "dawn_wire/WireCmd_autogen.h"
#include "dawn_wire/WireServer.h"
#include "dawn/wire/WireCmd_autogen.h"
#include "dawn/wire/WireServer.h"
#include <algorithm>
#include <map>

View File

@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "dawn_wire/server/Server.h"
#include "dawn_wire/WireServer.h"
#include "dawn/wire/server/Server.h"
#include "dawn/wire/WireServer.h"
namespace dawn::wire::server {

View File

@ -15,8 +15,8 @@
#ifndef DAWNWIRE_SERVER_SERVER_H_
#define DAWNWIRE_SERVER_SERVER_H_
#include "dawn_wire/ChunkedCommandSerializer.h"
#include "dawn_wire/server/ServerBase_autogen.h"
#include "dawn/wire/ChunkedCommandSerializer.h"
#include "dawn/wire/server/ServerBase_autogen.h"
namespace dawn::wire::server {
@ -222,7 +222,7 @@ namespace dawn::wire::server {
WGPUDevice device,
const char* message);
#include "dawn_wire/server/ServerPrototypes_autogen.inc"
#include "dawn/wire/server/ServerPrototypes_autogen.inc"
WireDeserializeAllocator mAllocator;
ChunkedCommandSerializer mSerializer;

View File

@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "dawn_wire/server/Server.h"
#include "dawn/wire/server/Server.h"
#include "dawn_wire/SupportedFeatures.h"
#include "dawn/wire/SupportedFeatures.h"
namespace dawn::wire::server {

View File

@ -13,9 +13,9 @@
// limitations under the License.
#include "dawn/common/Assert.h"
#include "dawn_wire/BufferConsumer_impl.h"
#include "dawn_wire/WireCmd_autogen.h"
#include "dawn_wire/server/Server.h"
#include "dawn/wire/BufferConsumer_impl.h"
#include "dawn/wire/WireCmd_autogen.h"
#include "dawn/wire/server/Server.h"
#include <memory>

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "dawn_wire/server/Server.h"
#include "dawn/wire/server/Server.h"
namespace dawn::wire::server {

View File

@ -13,8 +13,8 @@
// limitations under the License.
#include "dawn/common/Assert.h"
#include "dawn_wire/WireServer.h"
#include "dawn_wire/server/Server.h"
#include "dawn/wire/WireServer.h"
#include "dawn/wire/server/Server.h"
#include <cstring>

View File

@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "dawn_wire/server/Server.h"
#include "dawn/wire/server/Server.h"
#include "dawn_wire/SupportedFeatures.h"
#include "dawn/wire/SupportedFeatures.h"
#include <algorithm>

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "dawn_wire/server/ServerMemoryTransferService_mock.h"
#include "dawn/wire/server/ServerMemoryTransferService_mock.h"
#include "dawn/common/Assert.h"

View File

@ -17,8 +17,8 @@
#include <gmock/gmock.h>
#include "dawn_wire/WireServer.h"
#include "dawn_wire/server/Server.h"
#include "dawn/wire/WireServer.h"
#include "dawn/wire/server/Server.h"
namespace dawn::wire::server {

View File

@ -13,7 +13,7 @@
// limitations under the License.
#include "dawn/common/Assert.h"
#include "dawn_wire/server/Server.h"
#include "dawn/wire/server/Server.h"
namespace dawn::wire::server {

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "dawn_wire/server/Server.h"
#include "dawn/wire/server/Server.h"
#include <memory>

View File

@ -1,4 +1,4 @@
# Copyright 2019 The Dawn Authors
# Copyright 2022 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.
@ -12,100 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import("../../scripts/dawn_overrides_with_defaults.gni")
import("${dawn_root}/generator/dawn_generator.gni")
import("${dawn_root}/scripts/dawn_component.gni")
# Public dawn_wire headers so they can be publically visible for
# dependencies of dawn_wire
source_set("dawn_wire_headers") {
public_deps = [ "${dawn_root}/src/dawn:dawn_headers" ]
all_dependent_configs = [ "${dawn_root}/src/dawn/common:public_include_dirs" ]
sources = [
"${dawn_root}/src/include/dawn_wire/Wire.h",
"${dawn_root}/src/include/dawn_wire/WireClient.h",
"${dawn_root}/src/include/dawn_wire/WireServer.h",
"${dawn_root}/src/include/dawn_wire/dawn_wire_export.h",
]
################################################################################
# Build target aliases
# TODO(crbug.com/dawn/1275) - remove these
################################################################################
group("dawn_wire") {
public_deps = [ "../dawn/wire" ]
}
dawn_json_generator("dawn_wire_gen") {
target = "dawn_wire"
outputs = [
"src/dawn_wire/ObjectType_autogen.h",
"src/dawn_wire/WireCmd_autogen.h",
"src/dawn_wire/WireCmd_autogen.cpp",
"src/dawn_wire/client/ApiObjects_autogen.h",
"src/dawn_wire/client/ApiProcs_autogen.cpp",
"src/dawn_wire/client/ClientBase_autogen.h",
"src/dawn_wire/client/ClientHandlers_autogen.cpp",
"src/dawn_wire/client/ClientPrototypes_autogen.inc",
"src/dawn_wire/server/ServerBase_autogen.h",
"src/dawn_wire/server/ServerDoers_autogen.cpp",
"src/dawn_wire/server/ServerHandlers_autogen.cpp",
"src/dawn_wire/server/ServerPrototypes_autogen.inc",
]
}
dawn_component("dawn_wire") {
DEFINE_PREFIX = "DAWN_WIRE"
deps = [
":dawn_wire_gen",
"${dawn_root}/src/dawn/common",
]
configs = [ "${dawn_root}/src/dawn/common:internal_config" ]
sources = get_target_outputs(":dawn_wire_gen")
sources += [
"BufferConsumer.h",
"BufferConsumer_impl.h",
"ChunkedCommandHandler.cpp",
"ChunkedCommandHandler.h",
"ChunkedCommandSerializer.cpp",
"ChunkedCommandSerializer.h",
"SupportedFeatures.cpp",
"SupportedFeatures.h",
"Wire.cpp",
"WireClient.cpp",
"WireDeserializeAllocator.cpp",
"WireDeserializeAllocator.h",
"WireResult.h",
"WireServer.cpp",
"client/Adapter.cpp",
"client/Adapter.h",
"client/ApiObjects.h",
"client/Buffer.cpp",
"client/Buffer.h",
"client/Client.cpp",
"client/Client.h",
"client/ClientDoers.cpp",
"client/ClientInlineMemoryTransferService.cpp",
"client/Device.cpp",
"client/Device.h",
"client/Instance.cpp",
"client/Instance.h",
"client/LimitsAndFeatures.cpp",
"client/LimitsAndFeatures.h",
"client/ObjectAllocator.h",
"client/Queue.cpp",
"client/Queue.h",
"client/RequestTracker.h",
"client/ShaderModule.cpp",
"client/ShaderModule.h",
"server/ObjectStorage.h",
"server/Server.cpp",
"server/Server.h",
"server/ServerAdapter.cpp",
"server/ServerBuffer.cpp",
"server/ServerDevice.cpp",
"server/ServerInlineMemoryTransferService.cpp",
"server/ServerInstance.cpp",
"server/ServerQueue.cpp",
"server/ServerShaderModule.cpp",
]
# Make headers publicly visible
public_deps = [ ":dawn_wire_headers" ]
group("dawn_wire_headers") {
public_deps = [ "../dawn/wire:headers" ]
}

View File

@ -79,8 +79,8 @@ static_library("dawn_wire_server_fuzzer_common") {
"${dawn_root}/src/dawn:dawncpp",
"${dawn_root}/src/dawn/common",
"${dawn_root}/src/dawn/utils",
"${dawn_root}/src/dawn/wire:static",
"${dawn_root}/src/dawn_native:static",
"${dawn_root}/src/dawn_wire:static",
]
}

View File

@ -20,8 +20,8 @@
#include "dawn/dawn_proc.h"
#include "dawn/utils/SystemUtils.h"
#include "dawn/webgpu_cpp.h"
#include "dawn/wire/WireServer.h"
#include "dawn_native/DawnNative.h"
#include "dawn_wire/WireServer.h"
#include <fstream>
#include <vector>

View File

@ -0,0 +1,79 @@
// 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 DAWNWIRE_WIRE_H_
#define DAWNWIRE_WIRE_H_
#include <cstdint>
#include <limits>
#include "dawn/webgpu.h"
#include "dawn/wire/dawn_wire_export.h"
namespace dawn::wire {
class DAWN_WIRE_EXPORT CommandSerializer {
public:
CommandSerializer();
virtual ~CommandSerializer();
CommandSerializer(const CommandSerializer& rhs) = delete;
CommandSerializer& operator=(const CommandSerializer& rhs) = delete;
// Get space for serializing commands.
// GetCmdSpace will never be called with a value larger than
// what GetMaximumAllocationSize returns. Return nullptr to indicate
// a fatal error.
virtual void* GetCmdSpace(size_t size) = 0;
virtual bool Flush() = 0;
virtual size_t GetMaximumAllocationSize() const = 0;
virtual void OnSerializeError();
};
class DAWN_WIRE_EXPORT CommandHandler {
public:
CommandHandler();
virtual ~CommandHandler();
CommandHandler(const CommandHandler& rhs) = delete;
CommandHandler& operator=(const CommandHandler& rhs) = delete;
virtual const volatile char* HandleCommands(const volatile char* commands, size_t size) = 0;
};
DAWN_WIRE_EXPORT size_t
SerializedWGPUDevicePropertiesSize(const WGPUDeviceProperties* deviceProperties);
DAWN_WIRE_EXPORT void SerializeWGPUDeviceProperties(
const WGPUDeviceProperties* deviceProperties,
char* serializeBuffer);
DAWN_WIRE_EXPORT bool DeserializeWGPUDeviceProperties(WGPUDeviceProperties* deviceProperties,
const volatile char* deserializeBuffer,
size_t deserializeBufferSize);
DAWN_WIRE_EXPORT size_t
SerializedWGPUSupportedLimitsSize(const WGPUSupportedLimits* supportedLimits);
DAWN_WIRE_EXPORT void SerializeWGPUSupportedLimits(const WGPUSupportedLimits* supportedLimits,
char* serializeBuffer);
DAWN_WIRE_EXPORT bool DeserializeWGPUSupportedLimits(WGPUSupportedLimits* supportedLimits,
const volatile char* deserializeBuffer,
size_t deserializeBufferSize);
} // namespace dawn::wire
// TODO(dawn:824): Remove once the deprecation period is passed.
namespace dawn_wire = dawn::wire;
#endif // DAWNWIRE_WIRE_H_

View File

@ -0,0 +1,183 @@
// Copyright 2019 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 DAWNWIRE_WIRECLIENT_H_
#define DAWNWIRE_WIRECLIENT_H_
#include "dawn/dawn_proc_table.h"
#include "dawn/wire/Wire.h"
#include <memory>
#include <vector>
namespace dawn::wire {
namespace client {
class Client;
class MemoryTransferService;
DAWN_WIRE_EXPORT const DawnProcTable& GetProcs();
} // namespace client
struct ReservedTexture {
WGPUTexture texture;
uint32_t id;
uint32_t generation;
uint32_t deviceId;
uint32_t deviceGeneration;
};
struct ReservedSwapChain {
WGPUSwapChain swapchain;
uint32_t id;
uint32_t generation;
uint32_t deviceId;
uint32_t deviceGeneration;
};
struct ReservedDevice {
WGPUDevice device;
uint32_t id;
uint32_t generation;
};
struct ReservedInstance {
WGPUInstance instance;
uint32_t id;
uint32_t generation;
};
struct DAWN_WIRE_EXPORT WireClientDescriptor {
CommandSerializer* serializer;
client::MemoryTransferService* memoryTransferService = nullptr;
};
class DAWN_WIRE_EXPORT WireClient : public CommandHandler {
public:
WireClient(const WireClientDescriptor& descriptor);
~WireClient() override;
const volatile char* HandleCommands(const volatile char* commands,
size_t size) override final;
ReservedTexture ReserveTexture(WGPUDevice device);
ReservedSwapChain ReserveSwapChain(WGPUDevice device);
ReservedDevice ReserveDevice();
ReservedInstance ReserveInstance();
void ReclaimTextureReservation(const ReservedTexture& reservation);
void ReclaimSwapChainReservation(const ReservedSwapChain& reservation);
void ReclaimDeviceReservation(const ReservedDevice& reservation);
void ReclaimInstanceReservation(const ReservedInstance& reservation);
// Disconnects the client.
// Commands allocated after this point will not be sent.
void Disconnect();
private:
std::unique_ptr<client::Client> mImpl;
};
namespace client {
class DAWN_WIRE_EXPORT MemoryTransferService {
public:
MemoryTransferService();
virtual ~MemoryTransferService();
class ReadHandle;
class WriteHandle;
// Create a handle for reading server data.
// This may fail and return nullptr.
virtual ReadHandle* CreateReadHandle(size_t) = 0;
// Create a handle for writing server data.
// This may fail and return nullptr.
virtual WriteHandle* CreateWriteHandle(size_t) = 0;
class DAWN_WIRE_EXPORT ReadHandle {
public:
ReadHandle();
virtual ~ReadHandle();
// Get the required serialization size for SerializeCreate
virtual size_t SerializeCreateSize() = 0;
// Serialize the handle into |serializePointer| so it can be received by the server.
virtual void SerializeCreate(void* serializePointer) = 0;
// Simply return the base address of the allocation (without applying any offset)
// Returns nullptr if the allocation failed.
// The data must live at least until the ReadHandle is destructued
virtual const void* GetData() = 0;
// Gets called when a MapReadCallback resolves.
// deserialize the data update and apply
// it to the range (offset, offset + size) of allocation
// There could be nothing to be deserialized (if using shared memory)
// Needs to check potential offset/size OOB and overflow
virtual bool DeserializeDataUpdate(const void* deserializePointer,
size_t deserializeSize,
size_t offset,
size_t size) = 0;
private:
ReadHandle(const ReadHandle&) = delete;
ReadHandle& operator=(const ReadHandle&) = delete;
};
class DAWN_WIRE_EXPORT WriteHandle {
public:
WriteHandle();
virtual ~WriteHandle();
// Get the required serialization size for SerializeCreate
virtual size_t SerializeCreateSize() = 0;
// Serialize the handle into |serializePointer| so it can be received by the server.
virtual void SerializeCreate(void* serializePointer) = 0;
// Simply return the base address of the allocation (without applying any offset)
// The data returned should be zero-initialized.
// The data returned must live at least until the WriteHandle is destructed.
// On failure, the pointer returned should be null.
virtual void* GetData() = 0;
// Get the required serialization size for SerializeDataUpdate
virtual size_t SizeOfSerializeDataUpdate(size_t offset, size_t size) = 0;
// Serialize a command to send the modified contents of
// the subrange (offset, offset + size) of the allocation at buffer unmap
// This subrange is always the whole mapped region for now
// There could be nothing to be serialized (if using shared memory)
virtual void SerializeDataUpdate(void* serializePointer,
size_t offset,
size_t size) = 0;
private:
WriteHandle(const WriteHandle&) = delete;
WriteHandle& operator=(const WriteHandle&) = delete;
};
private:
MemoryTransferService(const MemoryTransferService&) = delete;
MemoryTransferService& operator=(const MemoryTransferService&) = delete;
};
// Backdoor to get the order of the ProcMap for testing
DAWN_WIRE_EXPORT std::vector<const char*> GetProcMapNamesForTesting();
} // namespace client
} // namespace dawn::wire
#endif // DAWNWIRE_WIRECLIENT_H_

View File

@ -0,0 +1,150 @@
// Copyright 2019 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 DAWNWIRE_WIRESERVER_H_
#define DAWNWIRE_WIRESERVER_H_
#include <memory>
#include "dawn/wire/Wire.h"
struct DawnProcTable;
namespace dawn::wire {
namespace server {
class Server;
class MemoryTransferService;
} // namespace server
struct DAWN_WIRE_EXPORT WireServerDescriptor {
const DawnProcTable* procs;
CommandSerializer* serializer;
server::MemoryTransferService* memoryTransferService = nullptr;
};
class DAWN_WIRE_EXPORT WireServer : public CommandHandler {
public:
WireServer(const WireServerDescriptor& descriptor);
~WireServer() override;
const volatile char* HandleCommands(const volatile char* commands,
size_t size) override final;
bool InjectTexture(WGPUTexture texture,
uint32_t id,
uint32_t generation,
uint32_t deviceId,
uint32_t deviceGeneration);
bool InjectSwapChain(WGPUSwapChain swapchain,
uint32_t id,
uint32_t generation,
uint32_t deviceId,
uint32_t deviceGeneration);
bool InjectDevice(WGPUDevice device, uint32_t id, uint32_t generation);
bool InjectInstance(WGPUInstance instance, uint32_t id, uint32_t generation);
// Look up a device by (id, generation) pair. Returns nullptr if the generation
// has expired or the id is not found.
// The Wire does not have destroy hooks to allow an embedder to observe when an object
// has been destroyed, but in Chrome, we need to know the list of live devices so we
// can call device.Tick() on all of them periodically to ensure progress on asynchronous
// work is made. Getting this list can be done by tracking the (id, generation) of
// previously injected devices, and observing if GetDevice(id, generation) returns non-null.
WGPUDevice GetDevice(uint32_t id, uint32_t generation);
private:
std::unique_ptr<server::Server> mImpl;
};
namespace server {
class DAWN_WIRE_EXPORT MemoryTransferService {
public:
MemoryTransferService();
virtual ~MemoryTransferService();
class ReadHandle;
class WriteHandle;
// Deserialize data to create Read/Write handles. These handles are for the client
// to Read/Write data.
virtual bool DeserializeReadHandle(const void* deserializePointer,
size_t deserializeSize,
ReadHandle** readHandle) = 0;
virtual bool DeserializeWriteHandle(const void* deserializePointer,
size_t deserializeSize,
WriteHandle** writeHandle) = 0;
class DAWN_WIRE_EXPORT ReadHandle {
public:
ReadHandle();
virtual ~ReadHandle();
// Return the size of the command serialized if
// SerializeDataUpdate is called with the same offset/size args
virtual size_t SizeOfSerializeDataUpdate(size_t offset, size_t size) = 0;
// Gets called when a MapReadCallback resolves.
// Serialize the data update for the range (offset, offset + size) into
// |serializePointer| to the client There could be nothing to be serialized (if
// using shared memory)
virtual void SerializeDataUpdate(const void* data,
size_t offset,
size_t size,
void* serializePointer) = 0;
private:
ReadHandle(const ReadHandle&) = delete;
ReadHandle& operator=(const ReadHandle&) = delete;
};
class DAWN_WIRE_EXPORT WriteHandle {
public:
WriteHandle();
virtual ~WriteHandle();
// Set the target for writes from the client. DeserializeFlush should copy data
// into the target.
void SetTarget(void* data);
// Set Staging data length for OOB check
void SetDataLength(size_t dataLength);
// This function takes in the serialized result of
// client::MemoryTransferService::WriteHandle::SerializeDataUpdate.
// Needs to check potential offset/size OOB and overflow
virtual bool DeserializeDataUpdate(const void* deserializePointer,
size_t deserializeSize,
size_t offset,
size_t size) = 0;
protected:
void* mTargetData = nullptr;
size_t mDataLength = 0;
private:
WriteHandle(const WriteHandle&) = delete;
WriteHandle& operator=(const WriteHandle&) = delete;
};
private:
MemoryTransferService(const MemoryTransferService&) = delete;
MemoryTransferService& operator=(const MemoryTransferService&) = delete;
};
} // namespace server
} // namespace dawn::wire
#endif // DAWNWIRE_WIRESERVER_H_

View File

@ -0,0 +1,36 @@
// 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 DAWNWIRE_EXPORT_H_
#define DAWNWIRE_EXPORT_H_
#if defined(DAWN_WIRE_SHARED_LIBRARY)
# if defined(_WIN32)
# if defined(DAWN_WIRE_IMPLEMENTATION)
# define DAWN_WIRE_EXPORT __declspec(dllexport)
# else
# define DAWN_WIRE_EXPORT __declspec(dllimport)
# endif
# else // defined(_WIN32)
# if defined(DAWN_WIRE_IMPLEMENTATION)
# define DAWN_WIRE_EXPORT __attribute__((visibility("default")))
# else
# define DAWN_WIRE_EXPORT
# endif
# endif // defined(_WIN32)
#else // defined(DAWN_WIRE_SHARED_LIBRARY)
# define DAWN_WIRE_EXPORT
#endif // defined(DAWN_WIRE_SHARED_LIBRARY)
#endif // DAWNWIRE_EXPORT_H_

View File

@ -1,79 +1 @@
// 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 DAWNWIRE_WIRE_H_
#define DAWNWIRE_WIRE_H_
#include <cstdint>
#include <limits>
#include "dawn/webgpu.h"
#include "dawn_wire/dawn_wire_export.h"
namespace dawn::wire {
class DAWN_WIRE_EXPORT CommandSerializer {
public:
CommandSerializer();
virtual ~CommandSerializer();
CommandSerializer(const CommandSerializer& rhs) = delete;
CommandSerializer& operator=(const CommandSerializer& rhs) = delete;
// Get space for serializing commands.
// GetCmdSpace will never be called with a value larger than
// what GetMaximumAllocationSize returns. Return nullptr to indicate
// a fatal error.
virtual void* GetCmdSpace(size_t size) = 0;
virtual bool Flush() = 0;
virtual size_t GetMaximumAllocationSize() const = 0;
virtual void OnSerializeError();
};
class DAWN_WIRE_EXPORT CommandHandler {
public:
CommandHandler();
virtual ~CommandHandler();
CommandHandler(const CommandHandler& rhs) = delete;
CommandHandler& operator=(const CommandHandler& rhs) = delete;
virtual const volatile char* HandleCommands(const volatile char* commands, size_t size) = 0;
};
DAWN_WIRE_EXPORT size_t
SerializedWGPUDevicePropertiesSize(const WGPUDeviceProperties* deviceProperties);
DAWN_WIRE_EXPORT void SerializeWGPUDeviceProperties(
const WGPUDeviceProperties* deviceProperties,
char* serializeBuffer);
DAWN_WIRE_EXPORT bool DeserializeWGPUDeviceProperties(WGPUDeviceProperties* deviceProperties,
const volatile char* deserializeBuffer,
size_t deserializeBufferSize);
DAWN_WIRE_EXPORT size_t
SerializedWGPUSupportedLimitsSize(const WGPUSupportedLimits* supportedLimits);
DAWN_WIRE_EXPORT void SerializeWGPUSupportedLimits(const WGPUSupportedLimits* supportedLimits,
char* serializeBuffer);
DAWN_WIRE_EXPORT bool DeserializeWGPUSupportedLimits(WGPUSupportedLimits* supportedLimits,
const volatile char* deserializeBuffer,
size_t deserializeBufferSize);
} // namespace dawn::wire
// TODO(dawn:824): Remove once the deprecation period is passed.
namespace dawn_wire = dawn::wire;
#endif // DAWNWIRE_WIRE_H_
#include <dawn/wire/Wire.h>

View File

@ -1,183 +1 @@
// Copyright 2019 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 DAWNWIRE_WIRECLIENT_H_
#define DAWNWIRE_WIRECLIENT_H_
#include "dawn/dawn_proc_table.h"
#include "dawn_wire/Wire.h"
#include <memory>
#include <vector>
namespace dawn::wire {
namespace client {
class Client;
class MemoryTransferService;
DAWN_WIRE_EXPORT const DawnProcTable& GetProcs();
} // namespace client
struct ReservedTexture {
WGPUTexture texture;
uint32_t id;
uint32_t generation;
uint32_t deviceId;
uint32_t deviceGeneration;
};
struct ReservedSwapChain {
WGPUSwapChain swapchain;
uint32_t id;
uint32_t generation;
uint32_t deviceId;
uint32_t deviceGeneration;
};
struct ReservedDevice {
WGPUDevice device;
uint32_t id;
uint32_t generation;
};
struct ReservedInstance {
WGPUInstance instance;
uint32_t id;
uint32_t generation;
};
struct DAWN_WIRE_EXPORT WireClientDescriptor {
CommandSerializer* serializer;
client::MemoryTransferService* memoryTransferService = nullptr;
};
class DAWN_WIRE_EXPORT WireClient : public CommandHandler {
public:
WireClient(const WireClientDescriptor& descriptor);
~WireClient() override;
const volatile char* HandleCommands(const volatile char* commands,
size_t size) override final;
ReservedTexture ReserveTexture(WGPUDevice device);
ReservedSwapChain ReserveSwapChain(WGPUDevice device);
ReservedDevice ReserveDevice();
ReservedInstance ReserveInstance();
void ReclaimTextureReservation(const ReservedTexture& reservation);
void ReclaimSwapChainReservation(const ReservedSwapChain& reservation);
void ReclaimDeviceReservation(const ReservedDevice& reservation);
void ReclaimInstanceReservation(const ReservedInstance& reservation);
// Disconnects the client.
// Commands allocated after this point will not be sent.
void Disconnect();
private:
std::unique_ptr<client::Client> mImpl;
};
namespace client {
class DAWN_WIRE_EXPORT MemoryTransferService {
public:
MemoryTransferService();
virtual ~MemoryTransferService();
class ReadHandle;
class WriteHandle;
// Create a handle for reading server data.
// This may fail and return nullptr.
virtual ReadHandle* CreateReadHandle(size_t) = 0;
// Create a handle for writing server data.
// This may fail and return nullptr.
virtual WriteHandle* CreateWriteHandle(size_t) = 0;
class DAWN_WIRE_EXPORT ReadHandle {
public:
ReadHandle();
virtual ~ReadHandle();
// Get the required serialization size for SerializeCreate
virtual size_t SerializeCreateSize() = 0;
// Serialize the handle into |serializePointer| so it can be received by the server.
virtual void SerializeCreate(void* serializePointer) = 0;
// Simply return the base address of the allocation (without applying any offset)
// Returns nullptr if the allocation failed.
// The data must live at least until the ReadHandle is destructued
virtual const void* GetData() = 0;
// Gets called when a MapReadCallback resolves.
// deserialize the data update and apply
// it to the range (offset, offset + size) of allocation
// There could be nothing to be deserialized (if using shared memory)
// Needs to check potential offset/size OOB and overflow
virtual bool DeserializeDataUpdate(const void* deserializePointer,
size_t deserializeSize,
size_t offset,
size_t size) = 0;
private:
ReadHandle(const ReadHandle&) = delete;
ReadHandle& operator=(const ReadHandle&) = delete;
};
class DAWN_WIRE_EXPORT WriteHandle {
public:
WriteHandle();
virtual ~WriteHandle();
// Get the required serialization size for SerializeCreate
virtual size_t SerializeCreateSize() = 0;
// Serialize the handle into |serializePointer| so it can be received by the server.
virtual void SerializeCreate(void* serializePointer) = 0;
// Simply return the base address of the allocation (without applying any offset)
// The data returned should be zero-initialized.
// The data returned must live at least until the WriteHandle is destructed.
// On failure, the pointer returned should be null.
virtual void* GetData() = 0;
// Get the required serialization size for SerializeDataUpdate
virtual size_t SizeOfSerializeDataUpdate(size_t offset, size_t size) = 0;
// Serialize a command to send the modified contents of
// the subrange (offset, offset + size) of the allocation at buffer unmap
// This subrange is always the whole mapped region for now
// There could be nothing to be serialized (if using shared memory)
virtual void SerializeDataUpdate(void* serializePointer,
size_t offset,
size_t size) = 0;
private:
WriteHandle(const WriteHandle&) = delete;
WriteHandle& operator=(const WriteHandle&) = delete;
};
private:
MemoryTransferService(const MemoryTransferService&) = delete;
MemoryTransferService& operator=(const MemoryTransferService&) = delete;
};
// Backdoor to get the order of the ProcMap for testing
DAWN_WIRE_EXPORT std::vector<const char*> GetProcMapNamesForTesting();
} // namespace client
} // namespace dawn::wire
#endif // DAWNWIRE_WIRECLIENT_H_
#include <dawn/wire/WireClient.h>

View File

@ -1,150 +1 @@
// Copyright 2019 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 DAWNWIRE_WIRESERVER_H_
#define DAWNWIRE_WIRESERVER_H_
#include <memory>
#include "dawn_wire/Wire.h"
struct DawnProcTable;
namespace dawn::wire {
namespace server {
class Server;
class MemoryTransferService;
} // namespace server
struct DAWN_WIRE_EXPORT WireServerDescriptor {
const DawnProcTable* procs;
CommandSerializer* serializer;
server::MemoryTransferService* memoryTransferService = nullptr;
};
class DAWN_WIRE_EXPORT WireServer : public CommandHandler {
public:
WireServer(const WireServerDescriptor& descriptor);
~WireServer() override;
const volatile char* HandleCommands(const volatile char* commands,
size_t size) override final;
bool InjectTexture(WGPUTexture texture,
uint32_t id,
uint32_t generation,
uint32_t deviceId,
uint32_t deviceGeneration);
bool InjectSwapChain(WGPUSwapChain swapchain,
uint32_t id,
uint32_t generation,
uint32_t deviceId,
uint32_t deviceGeneration);
bool InjectDevice(WGPUDevice device, uint32_t id, uint32_t generation);
bool InjectInstance(WGPUInstance instance, uint32_t id, uint32_t generation);
// Look up a device by (id, generation) pair. Returns nullptr if the generation
// has expired or the id is not found.
// The Wire does not have destroy hooks to allow an embedder to observe when an object
// has been destroyed, but in Chrome, we need to know the list of live devices so we
// can call device.Tick() on all of them periodically to ensure progress on asynchronous
// work is made. Getting this list can be done by tracking the (id, generation) of
// previously injected devices, and observing if GetDevice(id, generation) returns non-null.
WGPUDevice GetDevice(uint32_t id, uint32_t generation);
private:
std::unique_ptr<server::Server> mImpl;
};
namespace server {
class DAWN_WIRE_EXPORT MemoryTransferService {
public:
MemoryTransferService();
virtual ~MemoryTransferService();
class ReadHandle;
class WriteHandle;
// Deserialize data to create Read/Write handles. These handles are for the client
// to Read/Write data.
virtual bool DeserializeReadHandle(const void* deserializePointer,
size_t deserializeSize,
ReadHandle** readHandle) = 0;
virtual bool DeserializeWriteHandle(const void* deserializePointer,
size_t deserializeSize,
WriteHandle** writeHandle) = 0;
class DAWN_WIRE_EXPORT ReadHandle {
public:
ReadHandle();
virtual ~ReadHandle();
// Return the size of the command serialized if
// SerializeDataUpdate is called with the same offset/size args
virtual size_t SizeOfSerializeDataUpdate(size_t offset, size_t size) = 0;
// Gets called when a MapReadCallback resolves.
// Serialize the data update for the range (offset, offset + size) into
// |serializePointer| to the client There could be nothing to be serialized (if
// using shared memory)
virtual void SerializeDataUpdate(const void* data,
size_t offset,
size_t size,
void* serializePointer) = 0;
private:
ReadHandle(const ReadHandle&) = delete;
ReadHandle& operator=(const ReadHandle&) = delete;
};
class DAWN_WIRE_EXPORT WriteHandle {
public:
WriteHandle();
virtual ~WriteHandle();
// Set the target for writes from the client. DeserializeFlush should copy data
// into the target.
void SetTarget(void* data);
// Set Staging data length for OOB check
void SetDataLength(size_t dataLength);
// This function takes in the serialized result of
// client::MemoryTransferService::WriteHandle::SerializeDataUpdate.
// Needs to check potential offset/size OOB and overflow
virtual bool DeserializeDataUpdate(const void* deserializePointer,
size_t deserializeSize,
size_t offset,
size_t size) = 0;
protected:
void* mTargetData = nullptr;
size_t mDataLength = 0;
private:
WriteHandle(const WriteHandle&) = delete;
WriteHandle& operator=(const WriteHandle&) = delete;
};
private:
MemoryTransferService(const MemoryTransferService&) = delete;
MemoryTransferService& operator=(const MemoryTransferService&) = delete;
};
} // namespace server
} // namespace dawn::wire
#endif // DAWNWIRE_WIRESERVER_H_
#include <dawn/wire/WireServer.h>

View File

@ -1,36 +1 @@
// 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 DAWNWIRE_EXPORT_H_
#define DAWNWIRE_EXPORT_H_
#if defined(DAWN_WIRE_SHARED_LIBRARY)
# if defined(_WIN32)
# if defined(DAWN_WIRE_IMPLEMENTATION)
# define DAWN_WIRE_EXPORT __declspec(dllexport)
# else
# define DAWN_WIRE_EXPORT __declspec(dllimport)
# endif
# else // defined(_WIN32)
# if defined(DAWN_WIRE_IMPLEMENTATION)
# define DAWN_WIRE_EXPORT __attribute__((visibility("default")))
# else
# define DAWN_WIRE_EXPORT
# endif
# endif // defined(_WIN32)
#else // defined(DAWN_WIRE_SHARED_LIBRARY)
# define DAWN_WIRE_EXPORT
#endif // defined(DAWN_WIRE_SHARED_LIBRARY)
#endif // DAWNWIRE_EXPORT_H_
#include <dawn/wire/dawn_wire_export.h>

View File

@ -170,9 +170,9 @@ test("dawn_unittests") {
"${dawn_root}/src/dawn:dawncpp",
"${dawn_root}/src/dawn/common",
"${dawn_root}/src/dawn/utils",
"${dawn_root}/src/dawn/wire",
"${dawn_root}/src/dawn_native:dawn_native_sources",
"${dawn_root}/src/dawn_native:static",
"${dawn_root}/src/dawn_wire",
]
# Add internal dawn_native config for internal unittests.
@ -180,10 +180,10 @@ test("dawn_unittests") {
sources = get_target_outputs(":mock_webgpu_gen")
sources += [
"${dawn_root}/src/dawn_wire/client/ClientMemoryTransferService_mock.cpp",
"${dawn_root}/src/dawn_wire/client/ClientMemoryTransferService_mock.h",
"${dawn_root}/src/dawn_wire/server/ServerMemoryTransferService_mock.cpp",
"${dawn_root}/src/dawn_wire/server/ServerMemoryTransferService_mock.h",
"${dawn_root}/src/dawn/wire/client/ClientMemoryTransferService_mock.cpp",
"${dawn_root}/src/dawn/wire/client/ClientMemoryTransferService_mock.h",
"${dawn_root}/src/dawn/wire/server/ServerMemoryTransferService_mock.cpp",
"${dawn_root}/src/dawn/wire/server/ServerMemoryTransferService_mock.h",
"DawnNativeTest.cpp",
"DawnNativeTest.h",
"MockCallback.h",
@ -329,8 +329,8 @@ source_set("dawn_end2end_tests_sources") {
# Statically linked because the end2end white_box tests use Dawn internals.
"${dawn_root}/src/dawn/utils",
"${dawn_root}/src/dawn/wire",
"${dawn_root}/src/dawn_native:static",
"${dawn_root}/src/dawn_wire",
]
sources = [
@ -478,8 +478,8 @@ source_set("dawn_white_box_tests_sources") {
# Statically linked because the end2end white_box tests use Dawn internals.
"${dawn_root}/src/dawn/utils",
"${dawn_root}/src/dawn/wire",
"${dawn_root}/src/dawn_native:static",
"${dawn_root}/src/dawn_wire",
]
sources = [
@ -552,8 +552,8 @@ test("dawn_end2end_tests") {
"${dawn_root}/src/dawn:dawncpp",
"${dawn_root}/src/dawn/common",
"${dawn_root}/src/dawn/utils",
"${dawn_root}/src/dawn/wire",
"${dawn_root}/src/dawn_native:static",
"${dawn_root}/src/dawn_wire",
]
sources = [
@ -593,9 +593,9 @@ test("dawn_perf_tests") {
"${dawn_root}/src/dawn:dawncpp",
"${dawn_root}/src/dawn/common",
"${dawn_root}/src/dawn/utils",
"${dawn_root}/src/dawn/wire",
"${dawn_root}/src/dawn_native",
"${dawn_root}/src/dawn_platform",
"${dawn_root}/src/dawn_wire",
]
sources = [

View File

@ -28,8 +28,8 @@
#include "dawn/utils/TestUtils.h"
#include "dawn/utils/WGPUHelpers.h"
#include "dawn/utils/WireHelper.h"
#include "dawn_wire/WireClient.h"
#include "dawn_wire/WireServer.h"
#include "dawn/wire/WireClient.h"
#include "dawn/wire/WireServer.h"
#include <algorithm>
#include <fstream>

View File

@ -16,9 +16,9 @@
#include "dawn/dawn_proc.h"
#include "dawn/utils/TerribleCommandBuffer.h"
#include "dawn/wire/WireClient.h"
#include "dawn_native/Instance.h"
#include "dawn_native/null/DeviceNull.h"
#include "dawn_wire/WireClient.h"
namespace {

View File

@ -15,8 +15,8 @@
#include "tests/MockCallback.h"
#include "tests/unittests/wire/WireTest.h"
#include "dawn_wire/WireClient.h"
#include "dawn_wire/WireServer.h"
#include "dawn/wire/WireClient.h"
#include "dawn/wire/WireServer.h"
#include <webgpu/webgpu_cpp.h>
#include <unordered_set>
@ -327,4 +327,4 @@ namespace {
GetWireClient()->Disconnect();
}
} // anonymous namespace
} // anonymous namespace

View File

@ -14,7 +14,7 @@
#include "tests/unittests/wire/WireTest.h"
#include "dawn_wire/WireClient.h"
#include "dawn/wire/WireClient.h"
using namespace testing;
using namespace dawn::wire;
@ -24,10 +24,7 @@ namespace {
// Mock class to add expectations on the wire calling callbacks
class MockBufferMapCallback {
public:
MOCK_METHOD(void,
Call,
(WGPUBufferMapAsyncStatus status,
void* userdata));
MOCK_METHOD(void, Call, (WGPUBufferMapAsyncStatus status, void* userdata));
};
std::unique_ptr<StrictMock<MockBufferMapCallback>> mockBufferMapCallback;
@ -216,8 +213,7 @@ TEST_F(WireBufferMappingReadTests, UnmapCalledTooEarlyForReadButServerSideError)
FlushClient();
// The callback should be called with the server-side error and not the UnmappedBeforeCallback.
EXPECT_CALL(*mockBufferMapCallback, Call(WGPUBufferMapAsyncStatus_Error, _))
.Times(1);
EXPECT_CALL(*mockBufferMapCallback, Call(WGPUBufferMapAsyncStatus_Error, _)).Times(1);
FlushServer();
}
@ -267,8 +263,7 @@ TEST_F(WireBufferMappingReadTests, DestroyCalledTooEarlyForReadButServerSideErro
FlushClient();
// The callback should be called with the server-side error and not the DestroyedBeforCallback..
EXPECT_CALL(*mockBufferMapCallback, Call(WGPUBufferMapAsyncStatus_Error, _))
.Times(1);
EXPECT_CALL(*mockBufferMapCallback, Call(WGPUBufferMapAsyncStatus_Error, _)).Times(1);
FlushServer();
}
@ -814,4 +809,4 @@ TEST_F(WireBufferMappingWriteTests, MapInsideCallbackBeforeDestruction) {
Call(WGPUBufferMapAsyncStatus_DestroyedBeforeCallback, this))
.Times(1 + testData.numRequests);
wgpuBufferRelease(buffer);
}
}

View File

@ -14,7 +14,7 @@
#include "tests/unittests/wire/WireTest.h"
#include "dawn_wire/WireClient.h"
#include "dawn/wire/WireClient.h"
using namespace testing;
using namespace dawn::wire;

View File

@ -15,7 +15,7 @@
#include "tests/unittests/wire/WireTest.h"
#include "dawn/common/Assert.h"
#include "dawn_wire/WireClient.h"
#include "dawn/wire/WireClient.h"
#include "tests/MockCallback.h"
using namespace testing;

View File

@ -14,7 +14,7 @@
#include "tests/unittests/wire/WireTest.h"
#include "dawn_wire/WireClient.h"
#include "dawn/wire/WireClient.h"
using namespace testing;
using namespace dawn::wire;

View File

@ -14,8 +14,8 @@
#include "tests/unittests/wire/WireTest.h"
#include "dawn_wire/WireClient.h"
#include "dawn_wire/WireServer.h"
#include "dawn/wire/WireClient.h"
#include "dawn/wire/WireServer.h"
using namespace testing;
using namespace dawn::wire;

View File

@ -14,8 +14,8 @@
#include "tests/unittests/wire/WireTest.h"
#include "dawn_wire/WireClient.h"
#include "dawn_wire/WireServer.h"
#include "dawn/wire/WireClient.h"
#include "dawn/wire/WireServer.h"
using namespace testing;
using namespace dawn::wire;

View File

@ -14,8 +14,8 @@
#include "tests/unittests/wire/WireTest.h"
#include "dawn_wire/WireClient.h"
#include "dawn_wire/WireServer.h"
#include "dawn/wire/WireClient.h"
#include "dawn/wire/WireServer.h"
using namespace testing;
using namespace dawn::wire;

View File

@ -14,8 +14,8 @@
#include "tests/unittests/wire/WireTest.h"
#include "dawn_wire/WireClient.h"
#include "dawn_wire/WireServer.h"
#include "dawn/wire/WireClient.h"
#include "dawn/wire/WireServer.h"
using namespace testing;
using namespace dawn::wire;

View File

@ -15,8 +15,8 @@
#include "tests/MockCallback.h"
#include "tests/unittests/wire/WireTest.h"
#include "dawn_wire/WireClient.h"
#include "dawn_wire/WireServer.h"
#include "dawn/wire/WireClient.h"
#include "dawn/wire/WireServer.h"
#include <webgpu/webgpu_cpp.h>
#include <unordered_set>
@ -283,4 +283,4 @@ namespace {
GetWireClient()->Disconnect();
}
} // anonymous namespace
} // anonymous namespace

View File

@ -14,8 +14,8 @@
#include "tests/unittests/wire/WireTest.h"
#include "dawn_wire/client/ClientMemoryTransferService_mock.h"
#include "dawn_wire/server/ServerMemoryTransferService_mock.h"
#include "dawn/wire/client/ClientMemoryTransferService_mock.h"
#include "dawn/wire/server/ServerMemoryTransferService_mock.h"
using namespace testing;
using namespace dawn::wire;
@ -25,10 +25,7 @@ namespace {
// Mock class to add expectations on the wire calling callbacks
class MockBufferMapCallback {
public:
MOCK_METHOD(void,
Call,
(WGPUBufferMapAsyncStatus status,
void* userdata));
MOCK_METHOD(void, Call, (WGPUBufferMapAsyncStatus status, void* userdata));
};
std::unique_ptr<StrictMock<MockBufferMapCallback>> mockBufferMapCallback;
@ -680,7 +677,6 @@ TEST_F(WireMemoryTransferServiceTests, BufferMapWriteError) {
.WillOnce(InvokeWithoutArgs(
[&]() { api.CallBufferMapAsyncCallback(apiBuffer, WGPUBufferMapAsyncStatus_Error); }));
FlushClient();
// The client receives an error callback.
@ -1053,4 +1049,4 @@ TEST_F(WireMemoryTransferServiceTests, MappedAtCreationAndMapWriteSuccess) {
// The writeHandle is preserved after unmap and is destroyed once the buffer is destroyed.
EXPECT_CALL(clientMemoryTransferService, OnWriteHandleDestroy(clientHandle)).Times(1);
EXPECT_CALL(serverMemoryTransferService, OnWriteHandleDestroy(serverHandle)).Times(1);
}
}

View File

@ -14,7 +14,7 @@
#include "tests/unittests/wire/WireTest.h"
#include "dawn_wire/WireClient.h"
#include "dawn/wire/WireClient.h"
using namespace testing;
using namespace dawn::wire;

Some files were not shown because too many files have changed in this diff Show More