mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-13 10:51:35 +00:00
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:
parent
7d5badd9f4
commit
20cbe6d9e8
@ -216,7 +216,7 @@ add_subdirectory(src/dawn)
|
|||||||
add_subdirectory(src/dawn/common)
|
add_subdirectory(src/dawn/common)
|
||||||
add_subdirectory(src/dawn_platform)
|
add_subdirectory(src/dawn_platform)
|
||||||
add_subdirectory(src/dawn_native)
|
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.
|
# TODO(dawn:269): Remove once the implementation-based swapchains are removed.
|
||||||
add_subdirectory(src/dawn/utils)
|
add_subdirectory(src/dawn/utils)
|
||||||
|
|
||||||
|
@ -15,11 +15,11 @@ This repository contains the implementation of Dawn, which is itself composed of
|
|||||||
- [`src`](../src):
|
- [`src`](../src):
|
||||||
- [`dawn`](../src/dawn): root directory for Dawn code
|
- [`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.
|
- [`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`.
|
- [`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".
|
- [`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`.
|
- `<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_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/).
|
- [`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.
|
- [`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):
|
- [`tests`](../src/tests):
|
||||||
|
@ -39,8 +39,9 @@ static_library("dawn_sample_utils") {
|
|||||||
"${dawn_root}/src/dawn/utils",
|
"${dawn_root}/src/dawn/utils",
|
||||||
"${dawn_root}/src/dawn/utils:bindings",
|
"${dawn_root}/src/dawn/utils:bindings",
|
||||||
"${dawn_root}/src/dawn/utils:glfw",
|
"${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_native",
|
||||||
"${dawn_root}/src/dawn_wire",
|
|
||||||
]
|
]
|
||||||
public_configs = [ "${dawn_root}/src/dawn/common:internal_config" ]
|
public_configs = [ "${dawn_root}/src/dawn/common:internal_config" ]
|
||||||
}
|
}
|
||||||
|
@ -21,12 +21,12 @@
|
|||||||
#include "dawn/utils/BackendBinding.h"
|
#include "dawn/utils/BackendBinding.h"
|
||||||
#include "dawn/utils/GLFWUtils.h"
|
#include "dawn/utils/GLFWUtils.h"
|
||||||
#include "dawn/utils/TerribleCommandBuffer.h"
|
#include "dawn/utils/TerribleCommandBuffer.h"
|
||||||
|
#include "dawn/wire/WireClient.h"
|
||||||
|
#include "dawn/wire/WireServer.h"
|
||||||
|
|
||||||
#include <dawn/dawn_proc.h>
|
#include <dawn/dawn_proc.h>
|
||||||
#include <dawn/dawn_wsi.h>
|
#include <dawn/dawn_wsi.h>
|
||||||
#include <dawn_native/DawnNative.h>
|
#include <dawn_native/DawnNative.h>
|
||||||
#include <dawn_wire/WireClient.h>
|
|
||||||
#include <dawn_wire/WireServer.h>
|
|
||||||
#include "GLFW/glfw3.h"
|
#include "GLFW/glfw3.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -22,7 +22,7 @@ import("dawn_generator.gni")
|
|||||||
_stale_dirs = [
|
_stale_dirs = [
|
||||||
"dawn",
|
"dawn",
|
||||||
"dawn_native",
|
"dawn_native",
|
||||||
"dawn_wire",
|
"dawn/wire",
|
||||||
"mock",
|
"mock",
|
||||||
"src",
|
"src",
|
||||||
]
|
]
|
||||||
|
@ -41,9 +41,9 @@ dawn_allowed_gen_output_dirs = [
|
|||||||
"src/dawn/",
|
"src/dawn/",
|
||||||
"src/dawn_native/",
|
"src/dawn_native/",
|
||||||
"src/dawn_native/opengl/",
|
"src/dawn_native/opengl/",
|
||||||
"src/dawn_wire/client/",
|
"src/dawn/wire/client/",
|
||||||
"src/dawn_wire/server/",
|
"src/dawn/wire/server/",
|
||||||
"src/dawn_wire/",
|
"src/dawn/wire/",
|
||||||
"src/include/dawn/",
|
"src/include/dawn/",
|
||||||
"emscripten-bits/",
|
"emscripten-bits/",
|
||||||
"webgpu-headers/",
|
"webgpu-headers/",
|
||||||
|
@ -71,6 +71,9 @@ class Name:
|
|||||||
def namespace_case(self):
|
def namespace_case(self):
|
||||||
return '::'.join(self.chunks)
|
return '::'.join(self.chunks)
|
||||||
|
|
||||||
|
def Dirs(self):
|
||||||
|
return '/'.join(self.chunks)
|
||||||
|
|
||||||
def js_enum_case(self):
|
def js_enum_case(self):
|
||||||
result = self.chunks[0].lower()
|
result = self.chunks[0].lower()
|
||||||
for chunk in self.chunks[1:]:
|
for chunk in self.chunks[1:]:
|
||||||
@ -761,7 +764,7 @@ class MultiGeneratorFromDawnJSON(Generator):
|
|||||||
def add_commandline_arguments(self, parser):
|
def add_commandline_arguments(self, parser):
|
||||||
allowed_targets = [
|
allowed_targets = [
|
||||||
'dawn_headers', 'dawncpp_headers', 'dawncpp', 'dawn_proc',
|
'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',
|
parser.add_argument('--dawn-json',
|
||||||
@ -942,7 +945,7 @@ class MultiGeneratorFromDawnJSON(Generator):
|
|||||||
'src/' + native_dir + '/ObjectType_autogen.cpp',
|
'src/' + native_dir + '/ObjectType_autogen.cpp',
|
||||||
frontend_params))
|
frontend_params))
|
||||||
|
|
||||||
if 'dawn_wire' in targets:
|
if 'wire' in targets:
|
||||||
params_dawn_wire = parse_json(loaded_json,
|
params_dawn_wire = parse_json(loaded_json,
|
||||||
enabled_tags=['dawn', 'deprecated'],
|
enabled_tags=['dawn', 'deprecated'],
|
||||||
disabled_tags=['native'])
|
disabled_tags=['native'])
|
||||||
@ -957,51 +960,51 @@ class MultiGeneratorFromDawnJSON(Generator):
|
|||||||
}, additional_params
|
}, additional_params
|
||||||
]
|
]
|
||||||
renders.append(
|
renders.append(
|
||||||
FileRender('dawn_wire/ObjectType.h',
|
FileRender('dawn/wire/ObjectType.h',
|
||||||
'src/dawn_wire/ObjectType_autogen.h', wire_params))
|
'src/dawn/wire/ObjectType_autogen.h', wire_params))
|
||||||
renders.append(
|
renders.append(
|
||||||
FileRender('dawn_wire/WireCmd.h',
|
FileRender('dawn/wire/WireCmd.h',
|
||||||
'src/dawn_wire/WireCmd_autogen.h', wire_params))
|
'src/dawn/wire/WireCmd_autogen.h', wire_params))
|
||||||
renders.append(
|
renders.append(
|
||||||
FileRender('dawn_wire/WireCmd.cpp',
|
FileRender('dawn/wire/WireCmd.cpp',
|
||||||
'src/dawn_wire/WireCmd_autogen.cpp', wire_params))
|
'src/dawn/wire/WireCmd_autogen.cpp', wire_params))
|
||||||
renders.append(
|
renders.append(
|
||||||
FileRender('dawn_wire/client/ApiObjects.h',
|
FileRender('dawn/wire/client/ApiObjects.h',
|
||||||
'src/dawn_wire/client/ApiObjects_autogen.h',
|
'src/dawn/wire/client/ApiObjects_autogen.h',
|
||||||
wire_params))
|
wire_params))
|
||||||
renders.append(
|
renders.append(
|
||||||
FileRender('dawn_wire/client/ApiProcs.cpp',
|
FileRender('dawn/wire/client/ApiProcs.cpp',
|
||||||
'src/dawn_wire/client/ApiProcs_autogen.cpp',
|
'src/dawn/wire/client/ApiProcs_autogen.cpp',
|
||||||
wire_params))
|
wire_params))
|
||||||
renders.append(
|
renders.append(
|
||||||
FileRender('dawn_wire/client/ClientBase.h',
|
FileRender('dawn/wire/client/ClientBase.h',
|
||||||
'src/dawn_wire/client/ClientBase_autogen.h',
|
'src/dawn/wire/client/ClientBase_autogen.h',
|
||||||
wire_params))
|
wire_params))
|
||||||
renders.append(
|
renders.append(
|
||||||
FileRender('dawn_wire/client/ClientHandlers.cpp',
|
FileRender('dawn/wire/client/ClientHandlers.cpp',
|
||||||
'src/dawn_wire/client/ClientHandlers_autogen.cpp',
|
'src/dawn/wire/client/ClientHandlers_autogen.cpp',
|
||||||
wire_params))
|
wire_params))
|
||||||
renders.append(
|
renders.append(
|
||||||
FileRender(
|
FileRender(
|
||||||
'dawn_wire/client/ClientPrototypes.inc',
|
'dawn/wire/client/ClientPrototypes.inc',
|
||||||
'src/dawn_wire/client/ClientPrototypes_autogen.inc',
|
'src/dawn/wire/client/ClientPrototypes_autogen.inc',
|
||||||
wire_params))
|
wire_params))
|
||||||
renders.append(
|
renders.append(
|
||||||
FileRender('dawn_wire/server/ServerBase.h',
|
FileRender('dawn/wire/server/ServerBase.h',
|
||||||
'src/dawn_wire/server/ServerBase_autogen.h',
|
'src/dawn/wire/server/ServerBase_autogen.h',
|
||||||
wire_params))
|
wire_params))
|
||||||
renders.append(
|
renders.append(
|
||||||
FileRender('dawn_wire/server/ServerDoers.cpp',
|
FileRender('dawn/wire/server/ServerDoers.cpp',
|
||||||
'src/dawn_wire/server/ServerDoers_autogen.cpp',
|
'src/dawn/wire/server/ServerDoers_autogen.cpp',
|
||||||
wire_params))
|
wire_params))
|
||||||
renders.append(
|
renders.append(
|
||||||
FileRender('dawn_wire/server/ServerHandlers.cpp',
|
FileRender('dawn/wire/server/ServerHandlers.cpp',
|
||||||
'src/dawn_wire/server/ServerHandlers_autogen.cpp',
|
'src/dawn/wire/server/ServerHandlers_autogen.cpp',
|
||||||
wire_params))
|
wire_params))
|
||||||
renders.append(
|
renders.append(
|
||||||
FileRender(
|
FileRender(
|
||||||
'dawn_wire/server/ServerPrototypes.inc',
|
'dawn/wire/server/ServerPrototypes.inc',
|
||||||
'src/dawn_wire/server/ServerPrototypes_autogen.inc',
|
'src/dawn/wire/server/ServerPrototypes_autogen.inc',
|
||||||
wire_params))
|
wire_params))
|
||||||
|
|
||||||
return renders
|
return renders
|
||||||
|
@ -12,12 +12,12 @@
|
|||||||
//* See the License for the specific language governing permissions and
|
//* See the License for the specific language governing permissions and
|
||||||
//* limitations under the License.
|
//* limitations under the License.
|
||||||
|
|
||||||
#include "dawn_wire/WireCmd_autogen.h"
|
#include "dawn/wire/WireCmd_autogen.h"
|
||||||
|
|
||||||
#include "dawn/common/Assert.h"
|
#include "dawn/common/Assert.h"
|
||||||
#include "dawn/common/Log.h"
|
#include "dawn/common/Log.h"
|
||||||
#include "dawn_wire/BufferConsumer_impl.h"
|
#include "dawn/wire/BufferConsumer_impl.h"
|
||||||
#include "dawn_wire/Wire.h"
|
#include "dawn/wire/Wire.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstring>
|
#include <cstring>
|
@ -17,9 +17,9 @@
|
|||||||
|
|
||||||
#include <dawn/webgpu.h>
|
#include <dawn/webgpu.h>
|
||||||
|
|
||||||
#include "dawn_wire/BufferConsumer.h"
|
#include "dawn/wire/BufferConsumer.h"
|
||||||
#include "dawn_wire/ObjectType_autogen.h"
|
#include "dawn/wire/ObjectType_autogen.h"
|
||||||
#include "dawn_wire/WireResult.h"
|
#include "dawn/wire/WireResult.h"
|
||||||
|
|
||||||
namespace dawn::wire {
|
namespace dawn::wire {
|
||||||
|
|
@ -15,8 +15,8 @@
|
|||||||
#ifndef DAWNWIRE_CLIENT_APIOBJECTS_AUTOGEN_H_
|
#ifndef DAWNWIRE_CLIENT_APIOBJECTS_AUTOGEN_H_
|
||||||
#define DAWNWIRE_CLIENT_APIOBJECTS_AUTOGEN_H_
|
#define DAWNWIRE_CLIENT_APIOBJECTS_AUTOGEN_H_
|
||||||
|
|
||||||
#include "dawn_wire/ObjectType_autogen.h"
|
#include "dawn/wire/ObjectType_autogen.h"
|
||||||
#include "dawn_wire/client/ObjectBase.h"
|
#include "dawn/wire/client/ObjectBase.h"
|
||||||
|
|
||||||
namespace dawn::wire::client {
|
namespace dawn::wire::client {
|
||||||
|
|
@ -13,8 +13,8 @@
|
|||||||
//* limitations under the License.
|
//* limitations under the License.
|
||||||
|
|
||||||
#include "dawn/common/Log.h"
|
#include "dawn/common/Log.h"
|
||||||
#include "dawn_wire/client/ApiObjects.h"
|
#include "dawn/wire/client/ApiObjects.h"
|
||||||
#include "dawn_wire/client/Client.h"
|
#include "dawn/wire/client/Client.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstring>
|
#include <cstring>
|
@ -15,10 +15,10 @@
|
|||||||
#ifndef DAWNWIRE_CLIENT_CLIENTBASE_AUTOGEN_H_
|
#ifndef DAWNWIRE_CLIENT_CLIENTBASE_AUTOGEN_H_
|
||||||
#define DAWNWIRE_CLIENT_CLIENTBASE_AUTOGEN_H_
|
#define DAWNWIRE_CLIENT_CLIENTBASE_AUTOGEN_H_
|
||||||
|
|
||||||
#include "dawn_wire/ChunkedCommandHandler.h"
|
#include "dawn/wire/ChunkedCommandHandler.h"
|
||||||
#include "dawn_wire/WireCmd_autogen.h"
|
#include "dawn/wire/WireCmd_autogen.h"
|
||||||
#include "dawn_wire/client/ApiObjects.h"
|
#include "dawn/wire/client/ApiObjects.h"
|
||||||
#include "dawn_wire/client/ObjectAllocator.h"
|
#include "dawn/wire/client/ObjectAllocator.h"
|
||||||
|
|
||||||
namespace dawn::wire::client {
|
namespace dawn::wire::client {
|
||||||
|
|
@ -13,7 +13,7 @@
|
|||||||
//* limitations under the License.
|
//* limitations under the License.
|
||||||
|
|
||||||
#include "dawn/common/Assert.h"
|
#include "dawn/common/Assert.h"
|
||||||
#include "dawn_wire/client/Client.h"
|
#include "dawn/wire/client/Client.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
@ -16,11 +16,11 @@
|
|||||||
#define DAWNWIRE_SERVER_SERVERBASE_H_
|
#define DAWNWIRE_SERVER_SERVERBASE_H_
|
||||||
|
|
||||||
#include "dawn/dawn_proc_table.h"
|
#include "dawn/dawn_proc_table.h"
|
||||||
#include "dawn_wire/ChunkedCommandHandler.h"
|
#include "dawn/wire/ChunkedCommandHandler.h"
|
||||||
#include "dawn_wire/Wire.h"
|
#include "dawn/wire/Wire.h"
|
||||||
#include "dawn_wire/WireCmd_autogen.h"
|
#include "dawn/wire/WireCmd_autogen.h"
|
||||||
#include "dawn_wire/WireDeserializeAllocator.h"
|
#include "dawn/wire/WireDeserializeAllocator.h"
|
||||||
#include "dawn_wire/server/ObjectStorage.h"
|
#include "dawn/wire/server/ObjectStorage.h"
|
||||||
|
|
||||||
namespace dawn::wire::server {
|
namespace dawn::wire::server {
|
||||||
|
|
@ -13,7 +13,7 @@
|
|||||||
//* limitations under the License.
|
//* limitations under the License.
|
||||||
|
|
||||||
#include "dawn/common/Assert.h"
|
#include "dawn/common/Assert.h"
|
||||||
#include "dawn_wire/server/Server.h"
|
#include "dawn/wire/server/Server.h"
|
||||||
|
|
||||||
namespace dawn::wire::server {
|
namespace dawn::wire::server {
|
||||||
//* Implementation of the command doers
|
//* Implementation of the command doers
|
@ -13,7 +13,7 @@
|
|||||||
//* limitations under the License.
|
//* limitations under the License.
|
||||||
|
|
||||||
#include "dawn/common/Assert.h"
|
#include "dawn/common/Assert.h"
|
||||||
#include "dawn_wire/server/Server.h"
|
#include "dawn/wire/server/Server.h"
|
||||||
|
|
||||||
namespace dawn::wire::server {
|
namespace dawn::wire::server {
|
||||||
{% for command in cmd_records["command"] %}
|
{% for command in cmd_records["command"] %}
|
@ -89,8 +89,8 @@ static_library("utils") {
|
|||||||
deps = [
|
deps = [
|
||||||
"${dawn_root}/src/dawn:dawn_proc",
|
"${dawn_root}/src/dawn:dawn_proc",
|
||||||
"${dawn_root}/src/dawn/common",
|
"${dawn_root}/src/dawn/common",
|
||||||
|
"${dawn_root}/src/dawn/wire",
|
||||||
"${dawn_root}/src/dawn_native:dawn_native_headers",
|
"${dawn_root}/src/dawn_native:dawn_native_headers",
|
||||||
"${dawn_root}/src/dawn_wire",
|
|
||||||
"${dawn_spirv_tools_dir}:spvtools_opt",
|
"${dawn_spirv_tools_dir}:spvtools_opt",
|
||||||
]
|
]
|
||||||
libs = []
|
libs = []
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#ifndef UTILS_TERRIBLE_COMMAND_BUFFER_H_
|
#ifndef UTILS_TERRIBLE_COMMAND_BUFFER_H_
|
||||||
#define UTILS_TERRIBLE_COMMAND_BUFFER_H_
|
#define UTILS_TERRIBLE_COMMAND_BUFFER_H_
|
||||||
|
|
||||||
#include "dawn_wire/Wire.h"
|
#include "dawn/wire/Wire.h"
|
||||||
|
|
||||||
namespace utils {
|
namespace utils {
|
||||||
|
|
||||||
|
@ -19,9 +19,9 @@
|
|||||||
#include "dawn/common/SystemUtils.h"
|
#include "dawn/common/SystemUtils.h"
|
||||||
#include "dawn/dawn_proc.h"
|
#include "dawn/dawn_proc.h"
|
||||||
#include "dawn/utils/TerribleCommandBuffer.h"
|
#include "dawn/utils/TerribleCommandBuffer.h"
|
||||||
|
#include "dawn/wire/WireClient.h"
|
||||||
|
#include "dawn/wire/WireServer.h"
|
||||||
#include "dawn_native/DawnNative.h"
|
#include "dawn_native/DawnNative.h"
|
||||||
#include "dawn_wire/WireClient.h"
|
|
||||||
#include "dawn_wire/WireServer.h"
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
111
src/dawn/wire/BUILD.gn
Normal file
111
src/dawn/wire/BUILD.gn
Normal 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" ]
|
||||||
|
}
|
@ -15,7 +15,7 @@
|
|||||||
#ifndef DAWNWIRE_BUFFERCONSUMER_H_
|
#ifndef DAWNWIRE_BUFFERCONSUMER_H_
|
||||||
#define DAWNWIRE_BUFFERCONSUMER_H_
|
#define DAWNWIRE_BUFFERCONSUMER_H_
|
||||||
|
|
||||||
#include "dawn_wire/WireResult.h"
|
#include "dawn/wire/WireResult.h"
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
@ -15,7 +15,7 @@
|
|||||||
#ifndef DAWNWIRE_BUFFERCONSUMER_IMPL_H_
|
#ifndef DAWNWIRE_BUFFERCONSUMER_IMPL_H_
|
||||||
#define DAWNWIRE_BUFFERCONSUMER_IMPL_H_
|
#define DAWNWIRE_BUFFERCONSUMER_IMPL_H_
|
||||||
|
|
||||||
#include "dawn_wire/BufferConsumer.h"
|
#include "dawn/wire/BufferConsumer.h"
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
@ -13,7 +13,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
DawnJSONGenerator(
|
DawnJSONGenerator(
|
||||||
TARGET "dawn_wire"
|
TARGET "wire"
|
||||||
PRINT_NAME "Dawn wire"
|
PRINT_NAME "Dawn wire"
|
||||||
RESULT_VARIABLE "DAWN_WIRE_GEN_SOURCES"
|
RESULT_VARIABLE "DAWN_WIRE_GEN_SOURCES"
|
||||||
)
|
)
|
||||||
@ -26,10 +26,10 @@ if(BUILD_SHARED_LIBS)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_sources(dawn_wire PRIVATE
|
target_sources(dawn_wire PRIVATE
|
||||||
"${DAWN_INCLUDE_DIR}/dawn_wire/Wire.h"
|
"${DAWN_INCLUDE_DIR}/dawn/wire/Wire.h"
|
||||||
"${DAWN_INCLUDE_DIR}/dawn_wire/WireClient.h"
|
"${DAWN_INCLUDE_DIR}/dawn/wire/WireClient.h"
|
||||||
"${DAWN_INCLUDE_DIR}/dawn_wire/WireServer.h"
|
"${DAWN_INCLUDE_DIR}/dawn/wire/WireServer.h"
|
||||||
"${DAWN_INCLUDE_DIR}/dawn_wire/dawn_wire_export.h"
|
"${DAWN_INCLUDE_DIR}/dawn/wire/dawn_wire_export.h"
|
||||||
${DAWN_WIRE_GEN_SOURCES}
|
${DAWN_WIRE_GEN_SOURCES}
|
||||||
"BufferConsumer.h"
|
"BufferConsumer.h"
|
||||||
"BufferConsumer_impl.h"
|
"BufferConsumer_impl.h"
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include "dawn_wire/ChunkedCommandHandler.h"
|
#include "dawn/wire/ChunkedCommandHandler.h"
|
||||||
|
|
||||||
#include "dawn/common/Alloc.h"
|
#include "dawn/common/Alloc.h"
|
||||||
|
|
@ -16,8 +16,8 @@
|
|||||||
#define DAWNWIRE_CHUNKEDCOMMANDHANDLER_H_
|
#define DAWNWIRE_CHUNKEDCOMMANDHANDLER_H_
|
||||||
|
|
||||||
#include "dawn/common/Assert.h"
|
#include "dawn/common/Assert.h"
|
||||||
#include "dawn_wire/Wire.h"
|
#include "dawn/wire/Wire.h"
|
||||||
#include "dawn_wire/WireCmd_autogen.h"
|
#include "dawn/wire/WireCmd_autogen.h"
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <memory>
|
#include <memory>
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include "dawn_wire/ChunkedCommandSerializer.h"
|
#include "dawn/wire/ChunkedCommandSerializer.h"
|
||||||
|
|
||||||
namespace dawn::wire {
|
namespace dawn::wire {
|
||||||
|
|
@ -17,8 +17,8 @@
|
|||||||
|
|
||||||
#include "dawn/common/Alloc.h"
|
#include "dawn/common/Alloc.h"
|
||||||
#include "dawn/common/Compiler.h"
|
#include "dawn/common/Compiler.h"
|
||||||
#include "dawn_wire/Wire.h"
|
#include "dawn/wire/Wire.h"
|
||||||
#include "dawn_wire/WireCmd_autogen.h"
|
#include "dawn/wire/WireCmd_autogen.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstring>
|
#include <cstring>
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include "dawn_wire/SupportedFeatures.h"
|
#include "dawn/wire/SupportedFeatures.h"
|
||||||
|
|
||||||
namespace dawn::wire {
|
namespace dawn::wire {
|
||||||
|
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include "dawn_wire/Wire.h"
|
#include "dawn/wire/Wire.h"
|
||||||
|
|
||||||
namespace dawn::wire {
|
namespace dawn::wire {
|
||||||
|
|
@ -12,8 +12,8 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include "dawn_wire/WireClient.h"
|
#include "dawn/wire/WireClient.h"
|
||||||
#include "dawn_wire/client/Client.h"
|
#include "dawn/wire/client/Client.h"
|
||||||
|
|
||||||
namespace dawn::wire {
|
namespace dawn::wire {
|
||||||
|
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include "dawn_wire/WireDeserializeAllocator.h"
|
#include "dawn/wire/WireDeserializeAllocator.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
@ -15,7 +15,7 @@
|
|||||||
#ifndef DAWNWIRE_WIREDESERIALIZEALLOCATOR_H_
|
#ifndef DAWNWIRE_WIREDESERIALIZEALLOCATOR_H_
|
||||||
#define DAWNWIRE_WIREDESERIALIZEALLOCATOR_H_
|
#define DAWNWIRE_WIREDESERIALIZEALLOCATOR_H_
|
||||||
|
|
||||||
#include "dawn_wire/WireCmd_autogen.h"
|
#include "dawn/wire/WireCmd_autogen.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
@ -12,8 +12,8 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include "dawn_wire/WireServer.h"
|
#include "dawn/wire/WireServer.h"
|
||||||
#include "dawn_wire/server/Server.h"
|
#include "dawn/wire/server/Server.h"
|
||||||
|
|
||||||
namespace dawn::wire {
|
namespace dawn::wire {
|
||||||
|
|
@ -12,10 +12,10 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include "dawn_wire/client/Adapter.h"
|
#include "dawn/wire/client/Adapter.h"
|
||||||
|
|
||||||
#include "dawn/common/Log.h"
|
#include "dawn/common/Log.h"
|
||||||
#include "dawn_wire/client/Client.h"
|
#include "dawn/wire/client/Client.h"
|
||||||
|
|
||||||
namespace dawn::wire::client {
|
namespace dawn::wire::client {
|
||||||
|
|
@ -17,11 +17,11 @@
|
|||||||
|
|
||||||
#include <dawn/webgpu.h>
|
#include <dawn/webgpu.h>
|
||||||
|
|
||||||
#include "dawn_wire/WireClient.h"
|
#include "dawn/wire/WireClient.h"
|
||||||
#include "dawn_wire/WireCmd_autogen.h"
|
#include "dawn/wire/WireCmd_autogen.h"
|
||||||
#include "dawn_wire/client/LimitsAndFeatures.h"
|
#include "dawn/wire/client/LimitsAndFeatures.h"
|
||||||
#include "dawn_wire/client/ObjectBase.h"
|
#include "dawn/wire/client/ObjectBase.h"
|
||||||
#include "dawn_wire/client/RequestTracker.h"
|
#include "dawn/wire/client/RequestTracker.h"
|
||||||
|
|
||||||
namespace dawn::wire::client {
|
namespace dawn::wire::client {
|
||||||
|
|
@ -15,15 +15,15 @@
|
|||||||
#ifndef DAWNWIRE_CLIENT_APIOBJECTS_H_
|
#ifndef DAWNWIRE_CLIENT_APIOBJECTS_H_
|
||||||
#define 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/Adapter.h"
|
||||||
#include "dawn_wire/client/Buffer.h"
|
#include "dawn/wire/client/Buffer.h"
|
||||||
#include "dawn_wire/client/Device.h"
|
#include "dawn/wire/client/Device.h"
|
||||||
#include "dawn_wire/client/Instance.h"
|
#include "dawn/wire/client/Instance.h"
|
||||||
#include "dawn_wire/client/Queue.h"
|
#include "dawn/wire/client/Queue.h"
|
||||||
#include "dawn_wire/client/ShaderModule.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_
|
#endif // DAWNWIRE_CLIENT_APIOBJECTS_H_
|
@ -12,12 +12,12 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// 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/BufferConsumer_impl.h"
|
||||||
#include "dawn_wire/WireCmd_autogen.h"
|
#include "dawn/wire/WireCmd_autogen.h"
|
||||||
#include "dawn_wire/client/Client.h"
|
#include "dawn/wire/client/Client.h"
|
||||||
#include "dawn_wire/client/Device.h"
|
#include "dawn/wire/client/Device.h"
|
||||||
|
|
||||||
namespace dawn::wire::client {
|
namespace dawn::wire::client {
|
||||||
|
|
||||||
@ -212,7 +212,8 @@ namespace dawn::wire::client {
|
|||||||
return false;
|
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) {
|
if (status == WGPUBufferMapAsyncStatus_Success) {
|
||||||
status = request.clientStatus;
|
status = request.clientStatus;
|
||||||
}
|
}
|
@ -17,9 +17,9 @@
|
|||||||
|
|
||||||
#include <dawn/webgpu.h>
|
#include <dawn/webgpu.h>
|
||||||
|
|
||||||
#include "dawn_wire/WireClient.h"
|
#include "dawn/wire/WireClient.h"
|
||||||
#include "dawn_wire/client/ObjectBase.h"
|
#include "dawn/wire/client/ObjectBase.h"
|
||||||
#include "dawn_wire/client/RequestTracker.h"
|
#include "dawn/wire/client/RequestTracker.h"
|
||||||
|
|
||||||
namespace dawn::wire::client {
|
namespace dawn::wire::client {
|
||||||
|
|
@ -12,10 +12,10 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include "dawn_wire/client/Client.h"
|
#include "dawn/wire/client/Client.h"
|
||||||
|
|
||||||
#include "dawn/common/Compiler.h"
|
#include "dawn/common/Compiler.h"
|
||||||
#include "dawn_wire/client/Device.h"
|
#include "dawn/wire/client/Device.h"
|
||||||
|
|
||||||
namespace dawn::wire::client {
|
namespace dawn::wire::client {
|
||||||
|
|
@ -16,15 +16,15 @@
|
|||||||
#define DAWNWIRE_CLIENT_CLIENT_H_
|
#define DAWNWIRE_CLIENT_CLIENT_H_
|
||||||
|
|
||||||
#include <dawn/webgpu.h>
|
#include <dawn/webgpu.h>
|
||||||
#include <dawn_wire/Wire.h>
|
#include <dawn/wire/Wire.h>
|
||||||
|
|
||||||
#include "dawn/common/LinkedList.h"
|
#include "dawn/common/LinkedList.h"
|
||||||
#include "dawn/common/NonCopyable.h"
|
#include "dawn/common/NonCopyable.h"
|
||||||
#include "dawn_wire/ChunkedCommandSerializer.h"
|
#include "dawn/wire/ChunkedCommandSerializer.h"
|
||||||
#include "dawn_wire/WireClient.h"
|
#include "dawn/wire/WireClient.h"
|
||||||
#include "dawn_wire/WireCmd_autogen.h"
|
#include "dawn/wire/WireCmd_autogen.h"
|
||||||
#include "dawn_wire/WireDeserializeAllocator.h"
|
#include "dawn/wire/WireDeserializeAllocator.h"
|
||||||
#include "dawn_wire/client/ClientBase_autogen.h"
|
#include "dawn/wire/client/ClientBase_autogen.h"
|
||||||
|
|
||||||
namespace dawn::wire::client {
|
namespace dawn::wire::client {
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ namespace dawn::wire::client {
|
|||||||
private:
|
private:
|
||||||
void DestroyAllObjects();
|
void DestroyAllObjects();
|
||||||
|
|
||||||
#include "dawn_wire/client/ClientPrototypes_autogen.inc"
|
#include "dawn/wire/client/ClientPrototypes_autogen.inc"
|
||||||
|
|
||||||
ChunkedCommandSerializer mSerializer;
|
ChunkedCommandSerializer mSerializer;
|
||||||
WireDeserializeAllocator mAllocator;
|
WireDeserializeAllocator mAllocator;
|
@ -13,8 +13,8 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include "dawn/common/Assert.h"
|
#include "dawn/common/Assert.h"
|
||||||
#include "dawn_wire/client/Client.h"
|
#include "dawn/wire/client/Client.h"
|
||||||
#include "dawn_wire/client/Device.h"
|
#include "dawn/wire/client/Device.h"
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
@ -14,8 +14,8 @@
|
|||||||
|
|
||||||
#include "dawn/common/Alloc.h"
|
#include "dawn/common/Alloc.h"
|
||||||
#include "dawn/common/Assert.h"
|
#include "dawn/common/Assert.h"
|
||||||
#include "dawn_wire/WireClient.h"
|
#include "dawn/wire/WireClient.h"
|
||||||
#include "dawn_wire/client/Client.h"
|
#include "dawn/wire/client/Client.h"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include "dawn_wire/client/ClientMemoryTransferService_mock.h"
|
#include "dawn/wire/client/ClientMemoryTransferService_mock.h"
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include "dawn/common/Assert.h"
|
#include "dawn/common/Assert.h"
|
@ -17,8 +17,8 @@
|
|||||||
|
|
||||||
#include <gmock/gmock.h>
|
#include <gmock/gmock.h>
|
||||||
|
|
||||||
#include "dawn_wire/WireClient.h"
|
#include "dawn/wire/WireClient.h"
|
||||||
#include "dawn_wire/client/Client.h"
|
#include "dawn/wire/client/Client.h"
|
||||||
|
|
||||||
namespace dawn::wire::client {
|
namespace dawn::wire::client {
|
||||||
|
|
@ -12,13 +12,13 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include "dawn_wire/client/Device.h"
|
#include "dawn/wire/client/Device.h"
|
||||||
|
|
||||||
#include "dawn/common/Assert.h"
|
#include "dawn/common/Assert.h"
|
||||||
#include "dawn/common/Log.h"
|
#include "dawn/common/Log.h"
|
||||||
#include "dawn_wire/client/ApiObjects_autogen.h"
|
#include "dawn/wire/client/ApiObjects_autogen.h"
|
||||||
#include "dawn_wire/client/Client.h"
|
#include "dawn/wire/client/Client.h"
|
||||||
#include "dawn_wire/client/ObjectAllocator.h"
|
#include "dawn/wire/client/ObjectAllocator.h"
|
||||||
|
|
||||||
namespace dawn::wire::client {
|
namespace dawn::wire::client {
|
||||||
|
|
@ -18,11 +18,11 @@
|
|||||||
#include <dawn/webgpu.h>
|
#include <dawn/webgpu.h>
|
||||||
|
|
||||||
#include "dawn/common/LinkedList.h"
|
#include "dawn/common/LinkedList.h"
|
||||||
#include "dawn_wire/WireCmd_autogen.h"
|
#include "dawn/wire/WireCmd_autogen.h"
|
||||||
#include "dawn_wire/client/ApiObjects_autogen.h"
|
#include "dawn/wire/client/ApiObjects_autogen.h"
|
||||||
#include "dawn_wire/client/LimitsAndFeatures.h"
|
#include "dawn/wire/client/LimitsAndFeatures.h"
|
||||||
#include "dawn_wire/client/ObjectBase.h"
|
#include "dawn/wire/client/ObjectBase.h"
|
||||||
#include "dawn_wire/client/RequestTracker.h"
|
#include "dawn/wire/client/RequestTracker.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
@ -12,9 +12,9 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// 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 {
|
namespace dawn::wire::client {
|
||||||
|
|
@ -17,10 +17,10 @@
|
|||||||
|
|
||||||
#include <dawn/webgpu.h>
|
#include <dawn/webgpu.h>
|
||||||
|
|
||||||
#include "dawn_wire/WireClient.h"
|
#include "dawn/wire/WireClient.h"
|
||||||
#include "dawn_wire/WireCmd_autogen.h"
|
#include "dawn/wire/WireCmd_autogen.h"
|
||||||
#include "dawn_wire/client/ObjectBase.h"
|
#include "dawn/wire/client/ObjectBase.h"
|
||||||
#include "dawn_wire/client/RequestTracker.h"
|
#include "dawn/wire/client/RequestTracker.h"
|
||||||
|
|
||||||
namespace dawn::wire::client {
|
namespace dawn::wire::client {
|
||||||
|
|
@ -12,10 +12,10 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include "dawn_wire/client/LimitsAndFeatures.h"
|
#include "dawn/wire/client/LimitsAndFeatures.h"
|
||||||
|
|
||||||
#include "dawn/common/Assert.h"
|
#include "dawn/common/Assert.h"
|
||||||
#include "dawn_wire/SupportedFeatures.h"
|
#include "dawn/wire/SupportedFeatures.h"
|
||||||
|
|
||||||
namespace dawn::wire::client {
|
namespace dawn::wire::client {
|
||||||
|
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
#include "dawn/common/Assert.h"
|
#include "dawn/common/Assert.h"
|
||||||
#include "dawn/common/Compiler.h"
|
#include "dawn/common/Compiler.h"
|
||||||
#include "dawn_wire/WireCmd_autogen.h"
|
#include "dawn/wire/WireCmd_autogen.h"
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <memory>
|
#include <memory>
|
@ -18,7 +18,7 @@
|
|||||||
#include <dawn/webgpu.h>
|
#include <dawn/webgpu.h>
|
||||||
|
|
||||||
#include "dawn/common/LinkedList.h"
|
#include "dawn/common/LinkedList.h"
|
||||||
#include "dawn_wire/ObjectType_autogen.h"
|
#include "dawn/wire/ObjectType_autogen.h"
|
||||||
|
|
||||||
namespace dawn::wire::client {
|
namespace dawn::wire::client {
|
||||||
|
|
@ -12,10 +12,10 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// 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/Client.h"
|
||||||
#include "dawn_wire/client/Device.h"
|
#include "dawn/wire/client/Device.h"
|
||||||
|
|
||||||
namespace dawn::wire::client {
|
namespace dawn::wire::client {
|
||||||
|
|
@ -17,9 +17,9 @@
|
|||||||
|
|
||||||
#include <dawn/webgpu.h>
|
#include <dawn/webgpu.h>
|
||||||
|
|
||||||
#include "dawn_wire/WireClient.h"
|
#include "dawn/wire/WireClient.h"
|
||||||
#include "dawn_wire/client/ObjectBase.h"
|
#include "dawn/wire/client/ObjectBase.h"
|
||||||
#include "dawn_wire/client/RequestTracker.h"
|
#include "dawn/wire/client/RequestTracker.h"
|
||||||
|
|
||||||
namespace dawn::wire::client {
|
namespace dawn::wire::client {
|
||||||
|
|
@ -12,9 +12,9 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// 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 {
|
namespace dawn::wire::client {
|
||||||
|
|
@ -17,8 +17,8 @@
|
|||||||
|
|
||||||
#include <dawn/webgpu.h>
|
#include <dawn/webgpu.h>
|
||||||
|
|
||||||
#include "dawn_wire/client/ObjectBase.h"
|
#include "dawn/wire/client/ObjectBase.h"
|
||||||
#include "dawn_wire/client/RequestTracker.h"
|
#include "dawn/wire/client/RequestTracker.h"
|
||||||
|
|
||||||
namespace dawn::wire::client {
|
namespace dawn::wire::client {
|
||||||
|
|
@ -15,8 +15,8 @@
|
|||||||
#ifndef DAWNWIRE_SERVER_OBJECTSTORAGE_H_
|
#ifndef DAWNWIRE_SERVER_OBJECTSTORAGE_H_
|
||||||
#define DAWNWIRE_SERVER_OBJECTSTORAGE_H_
|
#define DAWNWIRE_SERVER_OBJECTSTORAGE_H_
|
||||||
|
|
||||||
#include "dawn_wire/WireCmd_autogen.h"
|
#include "dawn/wire/WireCmd_autogen.h"
|
||||||
#include "dawn_wire/WireServer.h"
|
#include "dawn/wire/WireServer.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <map>
|
#include <map>
|
@ -12,8 +12,8 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include "dawn_wire/server/Server.h"
|
#include "dawn/wire/server/Server.h"
|
||||||
#include "dawn_wire/WireServer.h"
|
#include "dawn/wire/WireServer.h"
|
||||||
|
|
||||||
namespace dawn::wire::server {
|
namespace dawn::wire::server {
|
||||||
|
|
@ -15,8 +15,8 @@
|
|||||||
#ifndef DAWNWIRE_SERVER_SERVER_H_
|
#ifndef DAWNWIRE_SERVER_SERVER_H_
|
||||||
#define DAWNWIRE_SERVER_SERVER_H_
|
#define DAWNWIRE_SERVER_SERVER_H_
|
||||||
|
|
||||||
#include "dawn_wire/ChunkedCommandSerializer.h"
|
#include "dawn/wire/ChunkedCommandSerializer.h"
|
||||||
#include "dawn_wire/server/ServerBase_autogen.h"
|
#include "dawn/wire/server/ServerBase_autogen.h"
|
||||||
|
|
||||||
namespace dawn::wire::server {
|
namespace dawn::wire::server {
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ namespace dawn::wire::server {
|
|||||||
WGPUDevice device,
|
WGPUDevice device,
|
||||||
const char* message);
|
const char* message);
|
||||||
|
|
||||||
#include "dawn_wire/server/ServerPrototypes_autogen.inc"
|
#include "dawn/wire/server/ServerPrototypes_autogen.inc"
|
||||||
|
|
||||||
WireDeserializeAllocator mAllocator;
|
WireDeserializeAllocator mAllocator;
|
||||||
ChunkedCommandSerializer mSerializer;
|
ChunkedCommandSerializer mSerializer;
|
@ -12,9 +12,9 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// 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 {
|
namespace dawn::wire::server {
|
||||||
|
|
@ -13,9 +13,9 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include "dawn/common/Assert.h"
|
#include "dawn/common/Assert.h"
|
||||||
#include "dawn_wire/BufferConsumer_impl.h"
|
#include "dawn/wire/BufferConsumer_impl.h"
|
||||||
#include "dawn_wire/WireCmd_autogen.h"
|
#include "dawn/wire/WireCmd_autogen.h"
|
||||||
#include "dawn_wire/server/Server.h"
|
#include "dawn/wire/server/Server.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include "dawn_wire/server/Server.h"
|
#include "dawn/wire/server/Server.h"
|
||||||
|
|
||||||
namespace dawn::wire::server {
|
namespace dawn::wire::server {
|
||||||
|
|
@ -13,8 +13,8 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include "dawn/common/Assert.h"
|
#include "dawn/common/Assert.h"
|
||||||
#include "dawn_wire/WireServer.h"
|
#include "dawn/wire/WireServer.h"
|
||||||
#include "dawn_wire/server/Server.h"
|
#include "dawn/wire/server/Server.h"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
@ -12,9 +12,9 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// 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>
|
#include <algorithm>
|
||||||
|
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include "dawn_wire/server/ServerMemoryTransferService_mock.h"
|
#include "dawn/wire/server/ServerMemoryTransferService_mock.h"
|
||||||
|
|
||||||
#include "dawn/common/Assert.h"
|
#include "dawn/common/Assert.h"
|
||||||
|
|
@ -17,8 +17,8 @@
|
|||||||
|
|
||||||
#include <gmock/gmock.h>
|
#include <gmock/gmock.h>
|
||||||
|
|
||||||
#include "dawn_wire/WireServer.h"
|
#include "dawn/wire/WireServer.h"
|
||||||
#include "dawn_wire/server/Server.h"
|
#include "dawn/wire/server/Server.h"
|
||||||
|
|
||||||
namespace dawn::wire::server {
|
namespace dawn::wire::server {
|
||||||
|
|
@ -13,7 +13,7 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include "dawn/common/Assert.h"
|
#include "dawn/common/Assert.h"
|
||||||
#include "dawn_wire/server/Server.h"
|
#include "dawn/wire/server/Server.h"
|
||||||
|
|
||||||
namespace dawn::wire::server {
|
namespace dawn::wire::server {
|
||||||
|
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include "dawn_wire/server/Server.h"
|
#include "dawn/wire/server/Server.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
# Copyright 2019 The Dawn Authors
|
# Copyright 2022 The Dawn Authors
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with 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
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import("../../scripts/dawn_overrides_with_defaults.gni")
|
################################################################################
|
||||||
|
# Build target aliases
|
||||||
import("${dawn_root}/generator/dawn_generator.gni")
|
# TODO(crbug.com/dawn/1275) - remove these
|
||||||
import("${dawn_root}/scripts/dawn_component.gni")
|
################################################################################
|
||||||
|
group("dawn_wire") {
|
||||||
# Public dawn_wire headers so they can be publically visible for
|
public_deps = [ "../dawn/wire" ]
|
||||||
# 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",
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
group("dawn_wire_headers") {
|
||||||
dawn_json_generator("dawn_wire_gen") {
|
public_deps = [ "../dawn/wire:headers" ]
|
||||||
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" ]
|
|
||||||
}
|
}
|
||||||
|
@ -79,8 +79,8 @@ static_library("dawn_wire_server_fuzzer_common") {
|
|||||||
"${dawn_root}/src/dawn:dawncpp",
|
"${dawn_root}/src/dawn:dawncpp",
|
||||||
"${dawn_root}/src/dawn/common",
|
"${dawn_root}/src/dawn/common",
|
||||||
"${dawn_root}/src/dawn/utils",
|
"${dawn_root}/src/dawn/utils",
|
||||||
|
"${dawn_root}/src/dawn/wire:static",
|
||||||
"${dawn_root}/src/dawn_native:static",
|
"${dawn_root}/src/dawn_native:static",
|
||||||
"${dawn_root}/src/dawn_wire:static",
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
#include "dawn/dawn_proc.h"
|
#include "dawn/dawn_proc.h"
|
||||||
#include "dawn/utils/SystemUtils.h"
|
#include "dawn/utils/SystemUtils.h"
|
||||||
#include "dawn/webgpu_cpp.h"
|
#include "dawn/webgpu_cpp.h"
|
||||||
|
#include "dawn/wire/WireServer.h"
|
||||||
#include "dawn_native/DawnNative.h"
|
#include "dawn_native/DawnNative.h"
|
||||||
#include "dawn_wire/WireServer.h"
|
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
79
src/include/dawn/wire/Wire.h
Normal file
79
src/include/dawn/wire/Wire.h
Normal 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_
|
183
src/include/dawn/wire/WireClient.h
Normal file
183
src/include/dawn/wire/WireClient.h
Normal 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_
|
150
src/include/dawn/wire/WireServer.h
Normal file
150
src/include/dawn/wire/WireServer.h
Normal 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_
|
36
src/include/dawn/wire/dawn_wire_export.h
Normal file
36
src/include/dawn/wire/dawn_wire_export.h
Normal 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_
|
@ -1,79 +1 @@
|
|||||||
// Copyright 2017 The Dawn Authors
|
#include <dawn/wire/Wire.h>
|
||||||
//
|
|
||||||
// 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_
|
|
||||||
|
@ -1,183 +1 @@
|
|||||||
// Copyright 2019 The Dawn Authors
|
#include <dawn/wire/WireClient.h>
|
||||||
//
|
|
||||||
// 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_
|
|
||||||
|
@ -1,150 +1 @@
|
|||||||
// Copyright 2019 The Dawn Authors
|
#include <dawn/wire/WireServer.h>
|
||||||
//
|
|
||||||
// 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_
|
|
||||||
|
@ -1,36 +1 @@
|
|||||||
// Copyright 2018 The Dawn Authors
|
#include <dawn/wire/dawn_wire_export.h>
|
||||||
//
|
|
||||||
// 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_
|
|
||||||
|
@ -170,9 +170,9 @@ test("dawn_unittests") {
|
|||||||
"${dawn_root}/src/dawn:dawncpp",
|
"${dawn_root}/src/dawn:dawncpp",
|
||||||
"${dawn_root}/src/dawn/common",
|
"${dawn_root}/src/dawn/common",
|
||||||
"${dawn_root}/src/dawn/utils",
|
"${dawn_root}/src/dawn/utils",
|
||||||
|
"${dawn_root}/src/dawn/wire",
|
||||||
"${dawn_root}/src/dawn_native:dawn_native_sources",
|
"${dawn_root}/src/dawn_native:dawn_native_sources",
|
||||||
"${dawn_root}/src/dawn_native:static",
|
"${dawn_root}/src/dawn_native:static",
|
||||||
"${dawn_root}/src/dawn_wire",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
# Add internal dawn_native config for internal unittests.
|
# Add internal dawn_native config for internal unittests.
|
||||||
@ -180,10 +180,10 @@ test("dawn_unittests") {
|
|||||||
|
|
||||||
sources = get_target_outputs(":mock_webgpu_gen")
|
sources = get_target_outputs(":mock_webgpu_gen")
|
||||||
sources += [
|
sources += [
|
||||||
"${dawn_root}/src/dawn_wire/client/ClientMemoryTransferService_mock.cpp",
|
"${dawn_root}/src/dawn/wire/client/ClientMemoryTransferService_mock.cpp",
|
||||||
"${dawn_root}/src/dawn_wire/client/ClientMemoryTransferService_mock.h",
|
"${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.cpp",
|
||||||
"${dawn_root}/src/dawn_wire/server/ServerMemoryTransferService_mock.h",
|
"${dawn_root}/src/dawn/wire/server/ServerMemoryTransferService_mock.h",
|
||||||
"DawnNativeTest.cpp",
|
"DawnNativeTest.cpp",
|
||||||
"DawnNativeTest.h",
|
"DawnNativeTest.h",
|
||||||
"MockCallback.h",
|
"MockCallback.h",
|
||||||
@ -329,8 +329,8 @@ source_set("dawn_end2end_tests_sources") {
|
|||||||
|
|
||||||
# Statically linked because the end2end white_box tests use Dawn internals.
|
# Statically linked because the end2end white_box tests use Dawn internals.
|
||||||
"${dawn_root}/src/dawn/utils",
|
"${dawn_root}/src/dawn/utils",
|
||||||
|
"${dawn_root}/src/dawn/wire",
|
||||||
"${dawn_root}/src/dawn_native:static",
|
"${dawn_root}/src/dawn_native:static",
|
||||||
"${dawn_root}/src/dawn_wire",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
sources = [
|
sources = [
|
||||||
@ -478,8 +478,8 @@ source_set("dawn_white_box_tests_sources") {
|
|||||||
|
|
||||||
# Statically linked because the end2end white_box tests use Dawn internals.
|
# Statically linked because the end2end white_box tests use Dawn internals.
|
||||||
"${dawn_root}/src/dawn/utils",
|
"${dawn_root}/src/dawn/utils",
|
||||||
|
"${dawn_root}/src/dawn/wire",
|
||||||
"${dawn_root}/src/dawn_native:static",
|
"${dawn_root}/src/dawn_native:static",
|
||||||
"${dawn_root}/src/dawn_wire",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
sources = [
|
sources = [
|
||||||
@ -552,8 +552,8 @@ test("dawn_end2end_tests") {
|
|||||||
"${dawn_root}/src/dawn:dawncpp",
|
"${dawn_root}/src/dawn:dawncpp",
|
||||||
"${dawn_root}/src/dawn/common",
|
"${dawn_root}/src/dawn/common",
|
||||||
"${dawn_root}/src/dawn/utils",
|
"${dawn_root}/src/dawn/utils",
|
||||||
|
"${dawn_root}/src/dawn/wire",
|
||||||
"${dawn_root}/src/dawn_native:static",
|
"${dawn_root}/src/dawn_native:static",
|
||||||
"${dawn_root}/src/dawn_wire",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
sources = [
|
sources = [
|
||||||
@ -593,9 +593,9 @@ test("dawn_perf_tests") {
|
|||||||
"${dawn_root}/src/dawn:dawncpp",
|
"${dawn_root}/src/dawn:dawncpp",
|
||||||
"${dawn_root}/src/dawn/common",
|
"${dawn_root}/src/dawn/common",
|
||||||
"${dawn_root}/src/dawn/utils",
|
"${dawn_root}/src/dawn/utils",
|
||||||
|
"${dawn_root}/src/dawn/wire",
|
||||||
"${dawn_root}/src/dawn_native",
|
"${dawn_root}/src/dawn_native",
|
||||||
"${dawn_root}/src/dawn_platform",
|
"${dawn_root}/src/dawn_platform",
|
||||||
"${dawn_root}/src/dawn_wire",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
sources = [
|
sources = [
|
||||||
|
@ -28,8 +28,8 @@
|
|||||||
#include "dawn/utils/TestUtils.h"
|
#include "dawn/utils/TestUtils.h"
|
||||||
#include "dawn/utils/WGPUHelpers.h"
|
#include "dawn/utils/WGPUHelpers.h"
|
||||||
#include "dawn/utils/WireHelper.h"
|
#include "dawn/utils/WireHelper.h"
|
||||||
#include "dawn_wire/WireClient.h"
|
#include "dawn/wire/WireClient.h"
|
||||||
#include "dawn_wire/WireServer.h"
|
#include "dawn/wire/WireServer.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
@ -16,9 +16,9 @@
|
|||||||
|
|
||||||
#include "dawn/dawn_proc.h"
|
#include "dawn/dawn_proc.h"
|
||||||
#include "dawn/utils/TerribleCommandBuffer.h"
|
#include "dawn/utils/TerribleCommandBuffer.h"
|
||||||
|
#include "dawn/wire/WireClient.h"
|
||||||
#include "dawn_native/Instance.h"
|
#include "dawn_native/Instance.h"
|
||||||
#include "dawn_native/null/DeviceNull.h"
|
#include "dawn_native/null/DeviceNull.h"
|
||||||
#include "dawn_wire/WireClient.h"
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
#include "tests/MockCallback.h"
|
#include "tests/MockCallback.h"
|
||||||
#include "tests/unittests/wire/WireTest.h"
|
#include "tests/unittests/wire/WireTest.h"
|
||||||
|
|
||||||
#include "dawn_wire/WireClient.h"
|
#include "dawn/wire/WireClient.h"
|
||||||
#include "dawn_wire/WireServer.h"
|
#include "dawn/wire/WireServer.h"
|
||||||
|
|
||||||
#include <webgpu/webgpu_cpp.h>
|
#include <webgpu/webgpu_cpp.h>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#include "tests/unittests/wire/WireTest.h"
|
#include "tests/unittests/wire/WireTest.h"
|
||||||
|
|
||||||
#include "dawn_wire/WireClient.h"
|
#include "dawn/wire/WireClient.h"
|
||||||
|
|
||||||
using namespace testing;
|
using namespace testing;
|
||||||
using namespace dawn::wire;
|
using namespace dawn::wire;
|
||||||
@ -24,10 +24,7 @@ namespace {
|
|||||||
// Mock class to add expectations on the wire calling callbacks
|
// Mock class to add expectations on the wire calling callbacks
|
||||||
class MockBufferMapCallback {
|
class MockBufferMapCallback {
|
||||||
public:
|
public:
|
||||||
MOCK_METHOD(void,
|
MOCK_METHOD(void, Call, (WGPUBufferMapAsyncStatus status, void* userdata));
|
||||||
Call,
|
|
||||||
(WGPUBufferMapAsyncStatus status,
|
|
||||||
void* userdata));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
std::unique_ptr<StrictMock<MockBufferMapCallback>> mockBufferMapCallback;
|
std::unique_ptr<StrictMock<MockBufferMapCallback>> mockBufferMapCallback;
|
||||||
@ -216,8 +213,7 @@ TEST_F(WireBufferMappingReadTests, UnmapCalledTooEarlyForReadButServerSideError)
|
|||||||
FlushClient();
|
FlushClient();
|
||||||
|
|
||||||
// The callback should be called with the server-side error and not the UnmappedBeforeCallback.
|
// The callback should be called with the server-side error and not the UnmappedBeforeCallback.
|
||||||
EXPECT_CALL(*mockBufferMapCallback, Call(WGPUBufferMapAsyncStatus_Error, _))
|
EXPECT_CALL(*mockBufferMapCallback, Call(WGPUBufferMapAsyncStatus_Error, _)).Times(1);
|
||||||
.Times(1);
|
|
||||||
|
|
||||||
FlushServer();
|
FlushServer();
|
||||||
}
|
}
|
||||||
@ -267,8 +263,7 @@ TEST_F(WireBufferMappingReadTests, DestroyCalledTooEarlyForReadButServerSideErro
|
|||||||
FlushClient();
|
FlushClient();
|
||||||
|
|
||||||
// The callback should be called with the server-side error and not the DestroyedBeforCallback..
|
// The callback should be called with the server-side error and not the DestroyedBeforCallback..
|
||||||
EXPECT_CALL(*mockBufferMapCallback, Call(WGPUBufferMapAsyncStatus_Error, _))
|
EXPECT_CALL(*mockBufferMapCallback, Call(WGPUBufferMapAsyncStatus_Error, _)).Times(1);
|
||||||
.Times(1);
|
|
||||||
|
|
||||||
FlushServer();
|
FlushServer();
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#include "tests/unittests/wire/WireTest.h"
|
#include "tests/unittests/wire/WireTest.h"
|
||||||
|
|
||||||
#include "dawn_wire/WireClient.h"
|
#include "dawn/wire/WireClient.h"
|
||||||
|
|
||||||
using namespace testing;
|
using namespace testing;
|
||||||
using namespace dawn::wire;
|
using namespace dawn::wire;
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#include "tests/unittests/wire/WireTest.h"
|
#include "tests/unittests/wire/WireTest.h"
|
||||||
|
|
||||||
#include "dawn/common/Assert.h"
|
#include "dawn/common/Assert.h"
|
||||||
#include "dawn_wire/WireClient.h"
|
#include "dawn/wire/WireClient.h"
|
||||||
#include "tests/MockCallback.h"
|
#include "tests/MockCallback.h"
|
||||||
|
|
||||||
using namespace testing;
|
using namespace testing;
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#include "tests/unittests/wire/WireTest.h"
|
#include "tests/unittests/wire/WireTest.h"
|
||||||
|
|
||||||
#include "dawn_wire/WireClient.h"
|
#include "dawn/wire/WireClient.h"
|
||||||
|
|
||||||
using namespace testing;
|
using namespace testing;
|
||||||
using namespace dawn::wire;
|
using namespace dawn::wire;
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
|
|
||||||
#include "tests/unittests/wire/WireTest.h"
|
#include "tests/unittests/wire/WireTest.h"
|
||||||
|
|
||||||
#include "dawn_wire/WireClient.h"
|
#include "dawn/wire/WireClient.h"
|
||||||
#include "dawn_wire/WireServer.h"
|
#include "dawn/wire/WireServer.h"
|
||||||
|
|
||||||
using namespace testing;
|
using namespace testing;
|
||||||
using namespace dawn::wire;
|
using namespace dawn::wire;
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
|
|
||||||
#include "tests/unittests/wire/WireTest.h"
|
#include "tests/unittests/wire/WireTest.h"
|
||||||
|
|
||||||
#include "dawn_wire/WireClient.h"
|
#include "dawn/wire/WireClient.h"
|
||||||
#include "dawn_wire/WireServer.h"
|
#include "dawn/wire/WireServer.h"
|
||||||
|
|
||||||
using namespace testing;
|
using namespace testing;
|
||||||
using namespace dawn::wire;
|
using namespace dawn::wire;
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
|
|
||||||
#include "tests/unittests/wire/WireTest.h"
|
#include "tests/unittests/wire/WireTest.h"
|
||||||
|
|
||||||
#include "dawn_wire/WireClient.h"
|
#include "dawn/wire/WireClient.h"
|
||||||
#include "dawn_wire/WireServer.h"
|
#include "dawn/wire/WireServer.h"
|
||||||
|
|
||||||
using namespace testing;
|
using namespace testing;
|
||||||
using namespace dawn::wire;
|
using namespace dawn::wire;
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
|
|
||||||
#include "tests/unittests/wire/WireTest.h"
|
#include "tests/unittests/wire/WireTest.h"
|
||||||
|
|
||||||
#include "dawn_wire/WireClient.h"
|
#include "dawn/wire/WireClient.h"
|
||||||
#include "dawn_wire/WireServer.h"
|
#include "dawn/wire/WireServer.h"
|
||||||
|
|
||||||
using namespace testing;
|
using namespace testing;
|
||||||
using namespace dawn::wire;
|
using namespace dawn::wire;
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
#include "tests/MockCallback.h"
|
#include "tests/MockCallback.h"
|
||||||
#include "tests/unittests/wire/WireTest.h"
|
#include "tests/unittests/wire/WireTest.h"
|
||||||
|
|
||||||
#include "dawn_wire/WireClient.h"
|
#include "dawn/wire/WireClient.h"
|
||||||
#include "dawn_wire/WireServer.h"
|
#include "dawn/wire/WireServer.h"
|
||||||
|
|
||||||
#include <webgpu/webgpu_cpp.h>
|
#include <webgpu/webgpu_cpp.h>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
|
|
||||||
#include "tests/unittests/wire/WireTest.h"
|
#include "tests/unittests/wire/WireTest.h"
|
||||||
|
|
||||||
#include "dawn_wire/client/ClientMemoryTransferService_mock.h"
|
#include "dawn/wire/client/ClientMemoryTransferService_mock.h"
|
||||||
#include "dawn_wire/server/ServerMemoryTransferService_mock.h"
|
#include "dawn/wire/server/ServerMemoryTransferService_mock.h"
|
||||||
|
|
||||||
using namespace testing;
|
using namespace testing;
|
||||||
using namespace dawn::wire;
|
using namespace dawn::wire;
|
||||||
@ -25,10 +25,7 @@ namespace {
|
|||||||
// Mock class to add expectations on the wire calling callbacks
|
// Mock class to add expectations on the wire calling callbacks
|
||||||
class MockBufferMapCallback {
|
class MockBufferMapCallback {
|
||||||
public:
|
public:
|
||||||
MOCK_METHOD(void,
|
MOCK_METHOD(void, Call, (WGPUBufferMapAsyncStatus status, void* userdata));
|
||||||
Call,
|
|
||||||
(WGPUBufferMapAsyncStatus status,
|
|
||||||
void* userdata));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
std::unique_ptr<StrictMock<MockBufferMapCallback>> mockBufferMapCallback;
|
std::unique_ptr<StrictMock<MockBufferMapCallback>> mockBufferMapCallback;
|
||||||
@ -680,7 +677,6 @@ TEST_F(WireMemoryTransferServiceTests, BufferMapWriteError) {
|
|||||||
.WillOnce(InvokeWithoutArgs(
|
.WillOnce(InvokeWithoutArgs(
|
||||||
[&]() { api.CallBufferMapAsyncCallback(apiBuffer, WGPUBufferMapAsyncStatus_Error); }));
|
[&]() { api.CallBufferMapAsyncCallback(apiBuffer, WGPUBufferMapAsyncStatus_Error); }));
|
||||||
|
|
||||||
|
|
||||||
FlushClient();
|
FlushClient();
|
||||||
|
|
||||||
// The client receives an error callback.
|
// The client receives an error callback.
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#include "tests/unittests/wire/WireTest.h"
|
#include "tests/unittests/wire/WireTest.h"
|
||||||
|
|
||||||
#include "dawn_wire/WireClient.h"
|
#include "dawn/wire/WireClient.h"
|
||||||
|
|
||||||
using namespace testing;
|
using namespace testing;
|
||||||
using namespace dawn::wire;
|
using namespace dawn::wire;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user