Skip to content

Commit

Permalink
tint->dawn: Move src/dawn_native -> src/dawn/native
Browse files Browse the repository at this point in the history
Bug: dawn:1275
Change-Id: Ic60a00107a015bc677ff929c492f1085ffc38482
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/79083
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
  • Loading branch information
ben-clayton authored and Dawn LUCI CQ committed Feb 4, 2022
1 parent b2c4d7a commit 818001d
Show file tree
Hide file tree
Showing 544 changed files with 3,449 additions and 3,421 deletions.
2 changes: 1 addition & 1 deletion BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import("scripts/dawn_overrides_with_defaults.gni")
group("all") {
testonly = true
deps = [
"src/dawn_native:webgpu_dawn",
"src/dawn/native:webgpu_dawn",
"src/fuzzers/dawn:dawn_fuzzers",
"src/tests:dawn_tests",
]
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ add_subdirectory(generator)
add_subdirectory(src/dawn)
add_subdirectory(src/dawn/common)
add_subdirectory(src/dawn/platform)
add_subdirectory(src/dawn_native)
add_subdirectory(src/dawn/native)
add_subdirectory(src/dawn/wire)
# TODO(dawn:269): Remove once the implementation-based swapchains are removed.
add_subdirectory(src/dawn/utils)
Expand Down
2 changes: 1 addition & 1 deletion docs/dawn/codegen.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,4 @@ The schema of `dawn_wire.json` is a dictionary with the following keys:

## OpenGL loader generator

The code to load OpenGL entrypoints from a `GetProcAddress` function is generated from [`gl.xml`](../third_party/khronos/gl.xml) and the [list of extensions](../src/dawn_native/opengl/supported_extensions.json) it supports.
The code to load OpenGL entrypoints from a `GetProcAddress` function is generated from [`gl.xml`](../third_party/khronos/gl.xml) and the [list of extensions](../src/dawn/native/opengl/supported_extensions.json) it supports.
8 changes: 4 additions & 4 deletions docs/dawn/device_facilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ Example of backend facilities are GPU memory allocators or the backing API funct

### Error Handling

Dawn (dawn_native) uses the [Error.h](../src/dawn_native/Error.h) error handling to robustly handle errors.
Dawn (dawn_native) uses the [Error.h](../src/dawn/native/Error.h) error handling to robustly handle errors.
With `DAWN_TRY` errors bubble up all the way to, and are "consumed" by the entry-point that was called by the application.
Error consumption uses `Device::ConsumeError` that expose them via the WebGPU "error scopes" and can also influence the device lifecycle by notifying of a device loss, or triggering a device loss..

See [Error.h](../src/dawn_native/Error.h) for more information about using errors.
See [Error.h](../src/dawn/native/Error.h) for more information about using errors.

### Device Lifecycle

Expand All @@ -26,7 +26,7 @@ The device lifecycle is a bit more complicated than other objects in Dawn for mu
- A device can become "disconnected" when a TDR or hot-unplug happens.
In this case, destruction of the device doesn't need to wait on GPU commands to finish because they just disappeared.

There is a state machine `State` defined in [Device.h](../src/dawn_native/Device.h) that controls all of the above.
There is a state machine `State` defined in [Device.h](../src/dawn/native/Device.h) that controls all of the above.
The most common state is `Alive` when there are potentially GPU commands executing.

Initialization of a device looks like the following:
Expand Down Expand Up @@ -62,7 +62,7 @@ Toggles can be queried using `DeviceBase::IsToggleEnabled`:
bool useRenderPass = device->IsToggleEnabled(Toggle::UseD3D12RenderPass);
```

Toggles are defined in a table in [Toggles.cpp](../src/dawn_native/Toggles.cpp) that also includes their name and description.
Toggles are defined in a table in [Toggles.cpp](../src/dawn/native/Toggles.cpp) that also includes their name and description.
The name can be used to force enabling of a toggle or, at the contrary, force the disabling of a toogle.
This is particularly useful in tests so that the two sides of a code path can be tested (for example using D3D12 render passes and not).

Expand Down
2 changes: 1 addition & 1 deletion docs/dawn/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ This repository contains the implementation of Dawn, which is itself composed of
- [`src`](../src):
- [`dawn`](../src/dawn): root directory for Dawn code
- [`common`](../src/dawn/common): helper code that is allowed to be used by Dawn's core libraries, `dawn_native` and `dawn_wire`. Also allowed for use in all other Dawn targets.
- [`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".
- [`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`.
- [`platform`](../src/dawn/platform): definition of interfaces for dependency injection in `dawn_native` or `dawn_wire`.
- [`dawn_native`](../src/dawn_native): code for the implementation of WebGPU on top of graphics APIs. Files in this folder are the "frontend" while subdirectories are "backends".
- `<backend>`: code for the implementation of the backend on a specific graphics API, for example `d3d12`, `metal` or `vulkan`.
- [`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.
Expand Down
3 changes: 1 addition & 2 deletions examples/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,11 @@ static_library("dawn_sample_utils") {
"${dawn_root}/src/dawn:dawn_proc",
"${dawn_root}/src/dawn:dawncpp",
"${dawn_root}/src/dawn/common",
"${dawn_root}/src/dawn/native",
"${dawn_root}/src/dawn/utils",
"${dawn_root}/src/dawn/utils:bindings",
"${dawn_root}/src/dawn/utils:glfw",
"${dawn_root}/src/dawn/wire",
"${dawn_root}/src/dawn_native",
"${dawn_root}/src/dawn_native",
]
public_configs = [ "${dawn_root}/src/dawn/common:internal_config" ]
}
Expand Down
2 changes: 1 addition & 1 deletion examples/ManualSwapChainTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
#include "dawn/utils/WGPUHelpers.h"

#include <dawn/dawn_proc.h>
#include <dawn/native/DawnNative.h>
#include <dawn/webgpu_cpp.h>
#include <dawn_native/DawnNative.h>
#include "GLFW/glfw3.h"

#include <memory>
Expand Down
2 changes: 1 addition & 1 deletion examples/SampleUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#include <dawn/dawn_proc.h>
#include <dawn/dawn_wsi.h>
#include <dawn_native/DawnNative.h>
#include <dawn/native/DawnNative.h>
#include "GLFW/glfw3.h"

#include <algorithm>
Expand Down
2 changes: 1 addition & 1 deletion generator/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import("dawn_generator.gni")
# autogenerated sources there.
_stale_dirs = [
"dawn",
"dawn_native",
"dawn/native",
"dawn/wire",
"mock",
"src",
Expand Down
6 changes: 3 additions & 3 deletions generator/dawn_generator.gni
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import("generator_lib.gni")
# 2. src/include and dawn_gen_root/src/include has to match the structure of
# the source tree too.
# 3. Dawn files must use include relative to src/ or src/include such as
# "dawn/dawn.h" or "dawn_native/backend/BackendStuff.h".
# "dawn/dawn.h" or "dawn/native/backend/BackendStuff.h".
#
# The allowed list below ensure 1). Include directory rules for Dawn ensure 3)
# and 2) is something we need to enforce in code review.
Expand All @@ -39,8 +39,8 @@ import("generator_lib.gni")

dawn_allowed_gen_output_dirs = [
"src/dawn/",
"src/dawn_native/",
"src/dawn_native/opengl/",
"src/dawn/native/",
"src/dawn/native/opengl/",
"src/dawn/wire/client/",
"src/dawn/wire/server/",
"src/dawn/wire/",
Expand Down
34 changes: 17 additions & 17 deletions generator/dawn_json_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ def get_description(self):
def add_commandline_arguments(self, parser):
allowed_targets = [
'dawn_headers', 'dawncpp_headers', 'dawncpp', 'dawn_proc',
'mock_api', 'wire', "dawn_native_utils"
'mock_api', 'wire', "native_utils"
]

parser.add_argument('--dawn-json',
Expand Down Expand Up @@ -832,8 +832,8 @@ def get_file_renders(self, args):

if 'webgpu_dawn_native_proc' in targets:
renders.append(
FileRender('dawn_native/api_dawn_native_proc.cpp',
'src/dawn_native/webgpu_dawn_native_proc.cpp',
FileRender('dawn/native/api_dawn_native_proc.cpp',
'src/dawn/native/webgpu_dawn_native_proc.cpp',
[RENDER_PARAMS_BASE, params_dawn]))

if 'dawncpp' in targets:
Expand Down Expand Up @@ -882,7 +882,7 @@ def get_file_renders(self, args):
FileRender('mock_api.cpp', 'src/dawn/mock_' + api + '.cpp',
mock_params))

if 'dawn_native_utils' in targets:
if 'native_utils' in targets:
frontend_params = [
RENDER_PARAMS_BASE,
params_dawn,
Expand All @@ -895,53 +895,53 @@ def get_file_renders(self, args):
]

impl_dir = metadata.impl_dir + '/' if metadata.impl_dir else ''
native_dir = impl_dir + Name(metadata.native_namespace).snake_case()
native_dir = impl_dir + Name(metadata.native_namespace).Dirs()
namespace = metadata.namespace
renders.append(
FileRender('dawn_native/ValidationUtils.h',
FileRender('dawn/native/ValidationUtils.h',
'src/' + native_dir + '/ValidationUtils_autogen.h',
frontend_params))
renders.append(
FileRender('dawn_native/ValidationUtils.cpp',
FileRender('dawn/native/ValidationUtils.cpp',
'src/' + native_dir + '/ValidationUtils_autogen.cpp',
frontend_params))
renders.append(
FileRender('dawn_native/dawn_platform.h',
FileRender('dawn/native/dawn_platform.h',
'src/' + native_dir + '/' + prefix + '_platform_autogen.h',
frontend_params))
renders.append(
FileRender('dawn_native/api_structs.h',
FileRender('dawn/native/api_structs.h',
'src/' + native_dir + '/' + namespace + '_structs_autogen.h',
frontend_params))
renders.append(
FileRender('dawn_native/api_structs.cpp',
FileRender('dawn/native/api_structs.cpp',
'src/' + native_dir + '/' + namespace + '_structs_autogen.cpp',
frontend_params))
renders.append(
FileRender('dawn_native/ProcTable.cpp',
FileRender('dawn/native/ProcTable.cpp',
'src/' + native_dir + '/ProcTable.cpp', frontend_params))
renders.append(
FileRender('dawn_native/ChainUtils.h',
FileRender('dawn/native/ChainUtils.h',
'src/' + native_dir + '/ChainUtils_autogen.h',
frontend_params))
renders.append(
FileRender('dawn_native/ChainUtils.cpp',
FileRender('dawn/native/ChainUtils.cpp',
'src/' + native_dir + '/ChainUtils_autogen.cpp',
frontend_params))
renders.append(
FileRender('dawn_native/api_absl_format.h',
FileRender('dawn/native/api_absl_format.h',
'src/' + native_dir + '/' + api + '_absl_format_autogen.h',
frontend_params))
renders.append(
FileRender('dawn_native/api_absl_format.cpp',
FileRender('dawn/native/api_absl_format.cpp',
'src/' + native_dir + '/' + api + '_absl_format_autogen.cpp',
frontend_params))
renders.append(
FileRender('dawn_native/ObjectType.h',
FileRender('dawn/native/ObjectType.h',
'src/' + native_dir + '/ObjectType_autogen.h',
frontend_params))
renders.append(
FileRender('dawn_native/ObjectType.cpp',
FileRender('dawn/native/ObjectType.cpp',
'src/' + native_dir + '/ObjectType_autogen.cpp',
frontend_params))

Expand Down
6 changes: 3 additions & 3 deletions generator/opengl_loader_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,13 @@ def get_file_renders(self, args):
return [
FileRender(
'opengl/OpenGLFunctionsBase.cpp',
'src/dawn_native/opengl/OpenGLFunctionsBase_autogen.cpp',
'src/dawn/native/opengl/OpenGLFunctionsBase_autogen.cpp',
[params]),
FileRender('opengl/OpenGLFunctionsBase.h',
'src/dawn_native/opengl/OpenGLFunctionsBase_autogen.h',
'src/dawn/native/opengl/OpenGLFunctionsBase_autogen.h',
[params]),
FileRender('opengl/opengl_platform.h',
'src/dawn_native/opengl/opengl_platform_autogen.h',
'src/dawn/native/opengl/opengl_platform_autogen.h',
[params]),
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{% set impl_dir = metadata.impl_dir + "/" if metadata.impl_dir else "" %}
{% set namespace_name = Name(metadata.native_namespace) %}
{% set native_namespace = namespace_name.namespace_case() %}
{% set native_dir = impl_dir + namespace_name.snake_case() %}
{% set native_dir = impl_dir + namespace_name.Dirs() %}
#include "{{native_dir}}/ChainUtils_autogen.h"

#include <unordered_set>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
{% set impl_dir = metadata.impl_dir + "/" if metadata.impl_dir else "" %}
{% set namespace_name = Name(metadata.native_namespace) %}
{% set native_namespace = namespace_name.namespace_case() %}
{% set native_dir = impl_dir + namespace_name.snake_case() %}
{% set native_dir = impl_dir + namespace_name.Dirs() %}
{% set prefix = metadata.proc_table_prefix.lower() %}
#include "{{native_dir}}/{{prefix}}_platform.h"
#include "{{native_dir}}/Error.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{% set impl_dir = metadata.impl_dir + "/" if metadata.impl_dir else "" %}
{% set namespace_name = Name(metadata.native_namespace) %}
{% set native_namespace = namespace_name.namespace_case() %}
{% set native_dir = impl_dir + namespace_name.snake_case() %}
{% set native_dir = impl_dir + namespace_name.Dirs() %}
#include "{{native_dir}}/ObjectType_autogen.h"

namespace {{native_namespace}} {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{% set impl_dir = metadata.impl_dir + "/" if metadata.impl_dir else "" %}
{% set namespace_name = Name(metadata.native_namespace) %}
{% set native_namespace = namespace_name.namespace_case() %}
{% set native_dir = impl_dir + namespace_name.snake_case() %}
{% set native_dir = impl_dir + namespace_name.Dirs() %}
#include "{{native_dir}}/{{prefix}}_platform.h"
#include "{{native_dir}}/{{Prefix}}Native.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{% set impl_dir = metadata.impl_dir + "/" if metadata.impl_dir else "" %}
{% set namespace_name = Name(metadata.native_namespace) %}
{% set native_namespace = namespace_name.namespace_case() %}
{% set native_dir = impl_dir + namespace_name.snake_case() %}
{% set native_dir = impl_dir + namespace_name.Dirs() %}
#include "{{native_dir}}/ValidationUtils_autogen.h"

namespace {{native_namespace}} {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
{% set impl_dir = metadata.impl_dir + "/" if metadata.impl_dir else "" %}
{% set namespace_name = Name(metadata.native_namespace) %}
{% set native_namespace = namespace_name.namespace_case() %}
{% set native_dir = impl_dir + namespace_name.snake_case() %}
{% set native_dir = impl_dir + namespace_name.Dirs() %}
#include "{{native_dir}}/Error.h"

namespace {{native_namespace}} {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{% set impl_dir = metadata.impl_dir + "/" if metadata.impl_dir else "" %}
{% set namespace_name = Name(metadata.native_namespace) %}
{% set native_namespace = namespace_name.namespace_case() %}
{% set native_dir = impl_dir + namespace_name.snake_case() %}
{% set native_dir = impl_dir + namespace_name.Dirs() %}
{% set api = metadata.api.lower() %}
#include "{{native_dir}}/{{api}}_absl_format_autogen.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
{% set impl_dir = metadata.impl_dir + "/" if metadata.impl_dir else "" %}
{% set namespace_name = Name(metadata.native_namespace) %}
{% set native_namespace = namespace_name.namespace_case() %}
{% set native_dir = impl_dir + namespace_name.snake_case() %}
{% set native_dir = impl_dir + namespace_name.Dirs() %}
{% set prefix = metadata.proc_table_prefix.lower() %}
#include "{{native_dir}}/{{prefix}}_platform.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

namespace dawn::native {

// This file should be kept in sync with generator/templates/dawn_native/ProcTable.cpp
// This file should be kept in sync with generator/templates/dawn/native/ProcTable.cpp

{% for function in by_category["function"] %}
extern {{as_cType(function.return_type.name)}} Native{{as_cppType(function.name)}}(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{% set impl_dir = metadata.impl_dir + "/" if metadata.impl_dir else "" %}
{% set namespace_name = Name(metadata.native_namespace) %}
{% set native_namespace = namespace_name.namespace_case() %}
{% set native_dir = impl_dir + namespace_name.snake_case() %}
{% set native_dir = impl_dir + namespace_name.Dirs() %}
{% set namespace = metadata.namespace %}
#include "{{native_dir}}/{{namespace}}_structs_autogen.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "dawn/{{api}}_cpp.h"
{% set impl_dir = metadata.impl_dir + "/" if metadata.impl_dir else "" %}
{% set native_namespace = namespace_name.namespace_case() %}
{% set native_dir = impl_dir + namespace_name.snake_case() %}
{% set native_dir = impl_dir + namespace_name.Dirs() %}
#include "{{native_dir}}/Forward.h"

namespace {{native_namespace}} {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "dawn/{{api}}_cpp.h"
{% set impl_dir = metadata.impl_dir + "/" if metadata.impl_dir else "" %}
{% set native_namespace = namespace_name.namespace_case() %}
{% set native_dir = impl_dir + namespace_name.snake_case() %}
{% set native_dir = impl_dir + namespace_name.Dirs() %}
#include "{{native_dir}}/Forward.h"

{% set namespace = metadata.namespace %}
Expand Down
2 changes: 1 addition & 1 deletion generator/templates/opengl/OpenGLFunctionsBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
//* See the License for the specific language governing permissions and
//* limitations under the License.

#include "dawn_native/opengl/OpenGLFunctionsBase_autogen.h"
#include "dawn/native/opengl/OpenGLFunctionsBase_autogen.h"

namespace dawn::native::opengl {

Expand Down
4 changes: 2 additions & 2 deletions generator/templates/opengl/OpenGLFunctionsBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#ifndef DAWNNATIVE_OPENGL_OPENGLFUNCTIONSBASE_H_
#define DAWNNATIVE_OPENGL_OPENGLFUNCTIONSBASE_H_

#include "dawn_native/Error.h"
#include "dawn_native/opengl/opengl_platform.h"
#include "dawn/native/Error.h"
#include "dawn/native/opengl/opengl_platform.h"

namespace dawn::native::opengl {
using GetProcAddress = void* (*) (const char*);
Expand Down
8 changes: 4 additions & 4 deletions src/dawn_native/Adapter.cpp → src/dawn/native/Adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "dawn_native/Adapter.h"
#include "dawn/native/Adapter.h"

#include "dawn/common/Constants.h"
#include "dawn_native/Device.h"
#include "dawn_native/Instance.h"
#include "dawn_native/ValidationUtils_autogen.h"
#include "dawn/native/Device.h"
#include "dawn/native/Instance.h"
#include "dawn/native/ValidationUtils_autogen.h"

namespace dawn::native {

Expand Down
Loading

0 comments on commit 818001d

Please sign in to comment.