tint->dawn: Move src/include -> include
Also simplify the target names. Bug: dawn:1275 Change-Id: I2929b70897f64903b91b693b48c2e8dd7c11d07b Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/79102 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
b01cf60b55
commit
9fb7a5146a
|
@ -38,7 +38,7 @@ endif()
|
|||
set(DAWN_BUILD_GEN_DIR "${Dawn_BINARY_DIR}/gen")
|
||||
set(DAWN_GENERATOR_DIR "${Dawn_SOURCE_DIR}/generator")
|
||||
set(DAWN_SRC_DIR "${Dawn_SOURCE_DIR}/src")
|
||||
set(DAWN_INCLUDE_DIR "${DAWN_SRC_DIR}/include")
|
||||
set(DAWN_INCLUDE_DIR "${Dawn_SOURCE_DIR}/include")
|
||||
set(DAWN_TEMPLATE_DIR "${DAWN_GENERATOR_DIR}/templates")
|
||||
|
||||
set(DAWN_DUMMY_FILE "${DAWN_SRC_DIR}/Dummy.cpp")
|
||||
|
@ -160,8 +160,8 @@ endif()
|
|||
# The public config contains only the include paths for the Dawn headers.
|
||||
add_library(dawn_public_config INTERFACE)
|
||||
target_include_directories(dawn_public_config INTERFACE
|
||||
"${DAWN_SRC_DIR}/include"
|
||||
"${DAWN_BUILD_GEN_DIR}/src/include"
|
||||
"${DAWN_INCLUDE_DIR}"
|
||||
"${DAWN_BUILD_GEN_DIR}/include"
|
||||
)
|
||||
|
||||
# The internal config conatins additional path but includes the dawn_public_config include paths
|
||||
|
|
|
@ -23,9 +23,9 @@ import("generator_lib.gni")
|
|||
# 1. The generated output file directory structure has to match the structure
|
||||
# of the source tree, starting at dawn_gen_root (gen/ or
|
||||
# gen/third_party/dawn depending on where we are).
|
||||
# 2. src/include and dawn_gen_root/src/include has to match the structure of
|
||||
# 2. include and dawn_gen_root/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
|
||||
# 3. Dawn files must use include relative to src/ or include such as
|
||||
# "dawn/dawn.h" or "dawn/native/backend/BackendStuff.h".
|
||||
#
|
||||
# The allowed list below ensure 1). Include directory rules for Dawn ensure 3)
|
||||
|
@ -44,7 +44,7 @@ dawn_allowed_gen_output_dirs = [
|
|||
"src/dawn/wire/client/",
|
||||
"src/dawn/wire/server/",
|
||||
"src/dawn/wire/",
|
||||
"src/include/dawn/",
|
||||
"include/dawn/",
|
||||
"emscripten-bits/",
|
||||
"webgpu-headers/",
|
||||
]
|
||||
|
|
|
@ -804,21 +804,21 @@ class MultiGeneratorFromDawnJSON(Generator):
|
|||
prefix = metadata.proc_table_prefix.lower()
|
||||
if 'headers' in targets:
|
||||
renders.append(
|
||||
FileRender('api.h', 'src/include/dawn/' + api + '.h',
|
||||
FileRender('api.h', 'include/dawn/' + api + '.h',
|
||||
[RENDER_PARAMS_BASE, params_dawn]))
|
||||
renders.append(
|
||||
FileRender('dawn_proc_table.h',
|
||||
'src/include/dawn/' + prefix + '_proc_table.h',
|
||||
'include/dawn/' + prefix + '_proc_table.h',
|
||||
[RENDER_PARAMS_BASE, params_dawn]))
|
||||
|
||||
if 'cpp_headers' in targets:
|
||||
renders.append(
|
||||
FileRender('api_cpp.h', 'src/include/dawn/' + api + '_cpp.h',
|
||||
FileRender('api_cpp.h', 'include/dawn/' + api + '_cpp.h',
|
||||
[RENDER_PARAMS_BASE, params_dawn]))
|
||||
|
||||
renders.append(
|
||||
FileRender('api_cpp_print.h',
|
||||
'src/include/dawn/' + api + '_cpp_print.h',
|
||||
'include/dawn/' + api + '_cpp_print.h',
|
||||
[RENDER_PARAMS_BASE, params_dawn]))
|
||||
|
||||
if 'proc' in targets:
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
# 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")
|
||||
|
||||
###############################################################################
|
||||
# Dawn headers
|
||||
###############################################################################
|
||||
|
||||
dawn_json_generator("headers_gen") {
|
||||
target = "headers"
|
||||
outputs = [
|
||||
"include/dawn/dawn_proc_table.h",
|
||||
"include/dawn/webgpu.h",
|
||||
]
|
||||
}
|
||||
|
||||
source_set("headers") {
|
||||
all_dependent_configs = [ ":public" ]
|
||||
public_deps = [ ":headers_gen" ]
|
||||
|
||||
sources = get_target_outputs(":headers_gen")
|
||||
sources += [ "${dawn_root}/include/dawn/dawn_wsi.h" ]
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Dawn C++ headers
|
||||
###############################################################################
|
||||
|
||||
dawn_json_generator("cpp_headers_gen") {
|
||||
target = "cpp_headers"
|
||||
outputs = [
|
||||
"include/dawn/webgpu_cpp.h",
|
||||
"include/dawn/webgpu_cpp_print.h",
|
||||
]
|
||||
}
|
||||
|
||||
source_set("cpp_headers") {
|
||||
public_deps = [
|
||||
":cpp_headers_gen",
|
||||
":headers",
|
||||
]
|
||||
|
||||
sources = get_target_outputs(":cpp_headers_gen")
|
||||
sources += [ "${dawn_root}/include/dawn/EnumClassBitmasks.h" ]
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Dawn public include directories
|
||||
###############################################################################
|
||||
|
||||
config("public") {
|
||||
include_dirs = [
|
||||
"${target_gen_dir}/../../include",
|
||||
"${dawn_root}/include",
|
||||
|
||||
"${dawn_root}/src/include", # TODO(crbug.com/dawn/1275) - remove
|
||||
]
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Build target aliases
|
||||
# TODO(crbug.com/dawn/1275) - remove these
|
||||
################################################################################
|
||||
group("dawncpp_headers") {
|
||||
public_deps = [ ":cpp_headers" ]
|
||||
}
|
||||
group("dawn_headers") {
|
||||
public_deps = [ ":headers" ]
|
||||
}
|
|
@ -0,0 +1,156 @@
|
|||
// Copyright 2017 The Dawn Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef DAWN_ENUM_CLASS_BITMASKS_H_
|
||||
#define DAWN_ENUM_CLASS_BITMASKS_H_
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
// The operators in dawn:: namespace need be introduced into other namespaces with
|
||||
// using-declarations for C++ Argument Dependent Lookup to work.
|
||||
#define DAWN_IMPORT_BITMASK_OPERATORS \
|
||||
using dawn::operator|; \
|
||||
using dawn::operator&; \
|
||||
using dawn::operator^; \
|
||||
using dawn::operator~; \
|
||||
using dawn::operator&=; \
|
||||
using dawn::operator|=; \
|
||||
using dawn::operator^=; \
|
||||
using dawn::HasZeroOrOneBits;
|
||||
|
||||
namespace dawn {
|
||||
|
||||
template <typename T>
|
||||
struct IsDawnBitmask {
|
||||
static constexpr bool enable = false;
|
||||
};
|
||||
|
||||
template <typename T, typename Enable = void>
|
||||
struct LowerBitmask {
|
||||
static constexpr bool enable = false;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct LowerBitmask<T, typename std::enable_if<IsDawnBitmask<T>::enable>::type> {
|
||||
static constexpr bool enable = true;
|
||||
using type = T;
|
||||
constexpr static T Lower(T t) {
|
||||
return t;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct BoolConvertible {
|
||||
using Integral = typename std::underlying_type<T>::type;
|
||||
|
||||
constexpr BoolConvertible(Integral value) : value(value) {
|
||||
}
|
||||
constexpr operator bool() const {
|
||||
return value != 0;
|
||||
}
|
||||
constexpr operator T() const {
|
||||
return static_cast<T>(value);
|
||||
}
|
||||
|
||||
Integral value;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct LowerBitmask<BoolConvertible<T>> {
|
||||
static constexpr bool enable = true;
|
||||
using type = T;
|
||||
static constexpr type Lower(BoolConvertible<T> t) {
|
||||
return t;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T1,
|
||||
typename T2,
|
||||
typename = typename std::enable_if<LowerBitmask<T1>::enable &&
|
||||
LowerBitmask<T2>::enable>::type>
|
||||
constexpr BoolConvertible<typename LowerBitmask<T1>::type> operator|(T1 left, T2 right) {
|
||||
using T = typename LowerBitmask<T1>::type;
|
||||
using Integral = typename std::underlying_type<T>::type;
|
||||
return static_cast<Integral>(LowerBitmask<T1>::Lower(left)) |
|
||||
static_cast<Integral>(LowerBitmask<T2>::Lower(right));
|
||||
}
|
||||
|
||||
template <typename T1,
|
||||
typename T2,
|
||||
typename = typename std::enable_if<LowerBitmask<T1>::enable &&
|
||||
LowerBitmask<T2>::enable>::type>
|
||||
constexpr BoolConvertible<typename LowerBitmask<T1>::type> operator&(T1 left, T2 right) {
|
||||
using T = typename LowerBitmask<T1>::type;
|
||||
using Integral = typename std::underlying_type<T>::type;
|
||||
return static_cast<Integral>(LowerBitmask<T1>::Lower(left)) &
|
||||
static_cast<Integral>(LowerBitmask<T2>::Lower(right));
|
||||
}
|
||||
|
||||
template <typename T1,
|
||||
typename T2,
|
||||
typename = typename std::enable_if<LowerBitmask<T1>::enable &&
|
||||
LowerBitmask<T2>::enable>::type>
|
||||
constexpr BoolConvertible<typename LowerBitmask<T1>::type> operator^(T1 left, T2 right) {
|
||||
using T = typename LowerBitmask<T1>::type;
|
||||
using Integral = typename std::underlying_type<T>::type;
|
||||
return static_cast<Integral>(LowerBitmask<T1>::Lower(left)) ^
|
||||
static_cast<Integral>(LowerBitmask<T2>::Lower(right));
|
||||
}
|
||||
|
||||
template <typename T1>
|
||||
constexpr BoolConvertible<typename LowerBitmask<T1>::type> operator~(T1 t) {
|
||||
using T = typename LowerBitmask<T1>::type;
|
||||
using Integral = typename std::underlying_type<T>::type;
|
||||
return ~static_cast<Integral>(LowerBitmask<T1>::Lower(t));
|
||||
}
|
||||
|
||||
template <typename T,
|
||||
typename T2,
|
||||
typename = typename std::enable_if<IsDawnBitmask<T>::enable &&
|
||||
LowerBitmask<T2>::enable>::type>
|
||||
constexpr T& operator&=(T& l, T2 right) {
|
||||
T r = LowerBitmask<T2>::Lower(right);
|
||||
l = l & r;
|
||||
return l;
|
||||
}
|
||||
|
||||
template <typename T,
|
||||
typename T2,
|
||||
typename = typename std::enable_if<IsDawnBitmask<T>::enable &&
|
||||
LowerBitmask<T2>::enable>::type>
|
||||
constexpr T& operator|=(T& l, T2 right) {
|
||||
T r = LowerBitmask<T2>::Lower(right);
|
||||
l = l | r;
|
||||
return l;
|
||||
}
|
||||
|
||||
template <typename T,
|
||||
typename T2,
|
||||
typename = typename std::enable_if<IsDawnBitmask<T>::enable &&
|
||||
LowerBitmask<T2>::enable>::type>
|
||||
constexpr T& operator^=(T& l, T2 right) {
|
||||
T r = LowerBitmask<T2>::Lower(right);
|
||||
l = l ^ r;
|
||||
return l;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
constexpr bool HasZeroOrOneBits(T value) {
|
||||
using Integral = typename std::underlying_type<T>::type;
|
||||
return (static_cast<Integral>(value) & (static_cast<Integral>(value) - 1)) == 0;
|
||||
}
|
||||
|
||||
} // namespace dawn
|
||||
|
||||
#endif // DAWN_ENUM_CLASS_BITMASKS_H_
|
|
@ -0,0 +1,36 @@
|
|||
// 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 DAWN_DAWN_PROC_H_
|
||||
#define DAWN_DAWN_PROC_H_
|
||||
|
||||
#include "dawn/dawn_proc_table.h"
|
||||
#include "dawn/webgpu.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Sets the static proctable used by libdawn_proc to implement the Dawn entrypoints. Passing NULL
|
||||
// for `procs` sets up the null proctable that contains only null function pointers. It is the
|
||||
// default value of the proctable. Setting the proctable back to null is good practice when you
|
||||
// are done using libdawn_proc since further usage will cause a segfault instead of calling an
|
||||
// unexpected function.
|
||||
WGPU_EXPORT void dawnProcSetProcs(const DawnProcTable* procs);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // DAWN_DAWN_PROC_H_
|
|
@ -0,0 +1,33 @@
|
|||
// Copyright 2020 The Dawn Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef DAWN_DAWN_THREAD_DISPATCH_PROC_H_
|
||||
#define DAWN_DAWN_THREAD_DISPATCH_PROC_H_
|
||||
|
||||
#include "dawn/dawn_proc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Call dawnProcSetProcs(&dawnThreadDispatchProcTable) and then use dawnProcSetPerThreadProcs
|
||||
// to set per-thread procs.
|
||||
WGPU_EXPORT extern DawnProcTable dawnThreadDispatchProcTable;
|
||||
WGPU_EXPORT void dawnProcSetPerThreadProcs(const DawnProcTable* procs);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // DAWN_DAWN_THREAD_DISPATCH_PROC_H_
|
|
@ -0,0 +1,86 @@
|
|||
// Copyright 2017 The Dawn Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef DAWN_DAWN_WSI_H_
|
||||
#define DAWN_DAWN_WSI_H_
|
||||
|
||||
#include <dawn/webgpu.h>
|
||||
|
||||
// Error message (or nullptr if there was no error)
|
||||
typedef const char* DawnSwapChainError;
|
||||
constexpr DawnSwapChainError DAWN_SWAP_CHAIN_NO_ERROR = nullptr;
|
||||
|
||||
typedef struct {
|
||||
/// Backend-specific texture id/name/pointer
|
||||
union {
|
||||
void* ptr;
|
||||
uint64_t u64;
|
||||
uint32_t u32;
|
||||
} texture;
|
||||
} DawnSwapChainNextTexture;
|
||||
|
||||
typedef struct {
|
||||
/// Initialize the swap chain implementation.
|
||||
/// (*wsiContext) is one of DawnWSIContext{D3D12,Metal,GL}
|
||||
void (*Init)(void* userData, void* wsiContext);
|
||||
|
||||
/// Destroy the swap chain implementation.
|
||||
void (*Destroy)(void* userData);
|
||||
|
||||
/// Configure/reconfigure the swap chain.
|
||||
DawnSwapChainError (*Configure)(void* userData,
|
||||
WGPUTextureFormat format,
|
||||
WGPUTextureUsage allowedUsage,
|
||||
uint32_t width,
|
||||
uint32_t height);
|
||||
|
||||
/// Acquire the next texture from the swap chain.
|
||||
DawnSwapChainError (*GetNextTexture)(void* userData, DawnSwapChainNextTexture* nextTexture);
|
||||
|
||||
/// Present the last acquired texture to the screen.
|
||||
DawnSwapChainError (*Present)(void* userData);
|
||||
|
||||
/// Each function is called with userData as its first argument.
|
||||
void* userData;
|
||||
|
||||
/// For use by the D3D12 and Vulkan backends: how the swapchain will use the texture.
|
||||
WGPUTextureUsage textureUsage;
|
||||
} DawnSwapChainImplementation;
|
||||
|
||||
#if defined(DAWN_ENABLE_BACKEND_D3D12) && defined(__cplusplus)
|
||||
struct DawnWSIContextD3D12 {
|
||||
WGPUDevice device = nullptr;
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(DAWN_ENABLE_BACKEND_METAL) && defined(__OBJC__)
|
||||
# import <Metal/Metal.h>
|
||||
|
||||
struct DawnWSIContextMetal {
|
||||
id<MTLDevice> device = nil;
|
||||
id<MTLCommandQueue> queue = nil;
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef DAWN_ENABLE_BACKEND_OPENGL
|
||||
typedef struct {
|
||||
} DawnWSIContextGL;
|
||||
#endif
|
||||
|
||||
#ifdef DAWN_ENABLE_BACKEND_VULKAN
|
||||
typedef struct {
|
||||
} DawnWSIContextVulkan;
|
||||
#endif
|
||||
|
||||
#endif // DAWN_DAWN_WSI_H
|
|
@ -0,0 +1 @@
|
|||
#include "dawn/webgpu.h"
|
|
@ -0,0 +1 @@
|
|||
#include <dawn/webgpu_cpp.h>
|
|
@ -17,48 +17,6 @@ import("../../scripts/dawn_overrides_with_defaults.gni")
|
|||
import("${dawn_root}/generator/dawn_generator.gni")
|
||||
import("${dawn_root}/scripts/dawn_component.gni")
|
||||
|
||||
###############################################################################
|
||||
# Dawn headers
|
||||
###############################################################################
|
||||
|
||||
dawn_json_generator("headers_gen") {
|
||||
target = "headers"
|
||||
outputs = [
|
||||
"src/include/dawn/dawn_proc_table.h",
|
||||
"src/include/dawn/webgpu.h",
|
||||
]
|
||||
}
|
||||
|
||||
source_set("headers") {
|
||||
all_dependent_configs = [ "${dawn_root}/src/dawn/common:public_include_dirs" ]
|
||||
public_deps = [ ":headers_gen" ]
|
||||
|
||||
sources = get_target_outputs(":headers_gen")
|
||||
sources += [ "${dawn_root}/src/include/dawn/dawn_wsi.h" ]
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Dawn C++ headers
|
||||
###############################################################################
|
||||
|
||||
dawn_json_generator("cpp_headers_gen") {
|
||||
target = "cpp_headers"
|
||||
outputs = [
|
||||
"src/include/dawn/webgpu_cpp.h",
|
||||
"src/include/dawn/webgpu_cpp_print.h",
|
||||
]
|
||||
}
|
||||
|
||||
source_set("cpp_headers") {
|
||||
public_deps = [
|
||||
":cpp_headers_gen",
|
||||
":headers",
|
||||
]
|
||||
|
||||
sources = get_target_outputs(":cpp_headers_gen")
|
||||
sources += [ "${dawn_root}/src/include/dawn/EnumClassBitmasks.h" ]
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Dawn C++ wrapper
|
||||
###############################################################################
|
||||
|
@ -71,7 +29,7 @@ dawn_json_generator("cpp_gen") {
|
|||
source_set("cpp") {
|
||||
deps = [
|
||||
":cpp_gen",
|
||||
":cpp_headers",
|
||||
"${dawn_root}/include/dawn:cpp_headers",
|
||||
]
|
||||
sources = get_target_outputs(":cpp_gen")
|
||||
}
|
||||
|
@ -91,12 +49,12 @@ dawn_json_generator("proc_gen") {
|
|||
dawn_component("proc") {
|
||||
DEFINE_PREFIX = "WGPU"
|
||||
|
||||
public_deps = [ ":headers" ]
|
||||
public_deps = [ "${dawn_root}/include/dawn:headers" ]
|
||||
deps = [ ":proc_gen" ]
|
||||
sources = get_target_outputs(":proc_gen")
|
||||
sources += [
|
||||
"${dawn_root}/src/include/dawn/dawn_proc.h",
|
||||
"${dawn_root}/src/include/dawn/dawn_thread_dispatch_proc.h",
|
||||
"${dawn_root}/include/dawn/dawn_proc.h",
|
||||
"${dawn_root}/include/dawn/dawn_thread_dispatch_proc.h",
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -128,13 +86,13 @@ group("dawncpp") {
|
|||
public_deps = [ ":cpp" ]
|
||||
}
|
||||
group("dawncpp_headers") {
|
||||
public_deps = [ ":cpp_headers" ]
|
||||
public_deps = [ "${dawn_root}/include/dawn:cpp_headers" ]
|
||||
}
|
||||
group("dawn_proc") {
|
||||
public_deps = [ ":proc" ]
|
||||
}
|
||||
group("dawn_headers") {
|
||||
public_deps = [ ":headers" ]
|
||||
public_deps = [ "${dawn_root}/include/dawn:headers" ]
|
||||
}
|
||||
group("dawn_cpp") {
|
||||
public_deps = [ ":cpp" ]
|
||||
|
|
|
@ -35,13 +35,6 @@ if (build_with_chromium) {
|
|||
# Common dawn configs
|
||||
###############################################################################
|
||||
|
||||
config("public_include_dirs") {
|
||||
include_dirs = [
|
||||
"${target_gen_dir}/../../../src/include",
|
||||
"${dawn_root}/src/include",
|
||||
]
|
||||
}
|
||||
|
||||
config("internal_config") {
|
||||
include_dirs = [
|
||||
"${target_gen_dir}/../../../src",
|
||||
|
@ -237,8 +230,8 @@ if (is_win || is_linux || is_chromeos || is_mac || is_fuchsia || is_android) {
|
|||
|
||||
public_configs = [ ":internal_config" ]
|
||||
deps = [
|
||||
"${dawn_root}/src/dawn:cpp_headers",
|
||||
"${dawn_root}/src/dawn:headers",
|
||||
"${dawn_root}/include/dawn:cpp_headers",
|
||||
"${dawn_root}/include/dawn:headers",
|
||||
]
|
||||
|
||||
if (is_win) {
|
||||
|
|
|
@ -137,19 +137,19 @@ if (dawn_enable_opengl) {
|
|||
# Public dawn native headers so they can be publicly visible for
|
||||
# dependencies of dawn native
|
||||
source_set("headers") {
|
||||
public_deps = [ "${dawn_root}/src/dawn:cpp_headers" ]
|
||||
all_dependent_configs = [ "${dawn_root}/src/dawn/common:public_include_dirs" ]
|
||||
public_deps = [ "${dawn_root}/include/dawn:cpp_headers" ]
|
||||
all_dependent_configs = [ "${dawn_root}/include/dawn:public" ]
|
||||
sources = [
|
||||
"${dawn_root}/src/include/dawn/native/DawnNative.h",
|
||||
"${dawn_root}/src/include/dawn/native/dawn_native_export.h",
|
||||
"${dawn_root}/include/dawn/native/DawnNative.h",
|
||||
"${dawn_root}/include/dawn/native/dawn_native_export.h",
|
||||
|
||||
# Include all backend's public headers so that dependencies can include
|
||||
# them even when the backends are disabled.
|
||||
"${dawn_root}/src/include/dawn/native/D3D12Backend.h",
|
||||
"${dawn_root}/src/include/dawn/native/MetalBackend.h",
|
||||
"${dawn_root}/src/include/dawn/native/NullBackend.h",
|
||||
"${dawn_root}/src/include/dawn/native/OpenGLBackend.h",
|
||||
"${dawn_root}/src/include/dawn/native/VulkanBackend.h",
|
||||
"${dawn_root}/include/dawn/native/D3D12Backend.h",
|
||||
"${dawn_root}/include/dawn/native/MetalBackend.h",
|
||||
"${dawn_root}/include/dawn/native/NullBackend.h",
|
||||
"${dawn_root}/include/dawn/native/OpenGLBackend.h",
|
||||
"${dawn_root}/include/dawn/native/VulkanBackend.h",
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@ dawn_component("platform") {
|
|||
configs = [ "${dawn_root}/src/dawn/common:internal_config" ]
|
||||
|
||||
sources = [
|
||||
"${dawn_root}/src/include/dawn/platform/DawnPlatform.h",
|
||||
"${dawn_root}/src/include/dawn/platform/dawn_platform_export.h",
|
||||
"${dawn_root}/include/dawn/platform/DawnPlatform.h",
|
||||
"${dawn_root}/include/dawn/platform/dawn_platform_export.h",
|
||||
"DawnPlatform.cpp",
|
||||
"WorkerThread.cpp",
|
||||
"WorkerThread.h",
|
||||
|
@ -36,6 +36,6 @@ dawn_component("platform") {
|
|||
|
||||
public_deps = [
|
||||
# DawnPlatform.h has #include <dawn/webgpu.h>
|
||||
"${dawn_root}/src/dawn:headers",
|
||||
"${dawn_root}/include/dawn:headers",
|
||||
]
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ static_library("utils") {
|
|||
}
|
||||
}
|
||||
|
||||
public_deps = [ "${dawn_root}/src/dawn:cpp_headers" ]
|
||||
public_deps = [ "${dawn_root}/include/dawn:cpp_headers" ]
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
|
@ -151,7 +151,7 @@ if (dawn_standalone) {
|
|||
"BackendBinding.h",
|
||||
]
|
||||
|
||||
public_deps = [ "${dawn_root}/src/dawn:headers" ]
|
||||
public_deps = [ "${dawn_root}/include/dawn:headers" ]
|
||||
|
||||
deps = [
|
||||
":glfw",
|
||||
|
|
|
@ -20,13 +20,13 @@ 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:headers" ]
|
||||
all_dependent_configs = [ "${dawn_root}/src/dawn/common:public_include_dirs" ]
|
||||
public_deps = [ "${dawn_root}/include/dawn:headers" ]
|
||||
all_dependent_configs = [ "${dawn_root}/include/dawn:public" ]
|
||||
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_root}/include/dawn/wire/Wire.h",
|
||||
"${dawn_root}/include/dawn/wire/WireClient.h",
|
||||
"${dawn_root}/include/dawn/wire/WireServer.h",
|
||||
"${dawn_root}/include/dawn/wire/dawn_wire_export.h",
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
# TODO(crbug.com/dawn/1275) - remove this directory
|
||||
|
||||
This directory exists as a temporary include directory while migrating Chromium source to the new Dawn include layout.
|
||||
All headers in the subdirectories simply #include to the new location for the header.
|
|
@ -1,156 +1 @@
|
|||
// Copyright 2017 The Dawn Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef DAWN_ENUM_CLASS_BITMASKS_H_
|
||||
#define DAWN_ENUM_CLASS_BITMASKS_H_
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
// The operators in dawn:: namespace need be introduced into other namespaces with
|
||||
// using-declarations for C++ Argument Dependent Lookup to work.
|
||||
#define DAWN_IMPORT_BITMASK_OPERATORS \
|
||||
using dawn::operator|; \
|
||||
using dawn::operator&; \
|
||||
using dawn::operator^; \
|
||||
using dawn::operator~; \
|
||||
using dawn::operator&=; \
|
||||
using dawn::operator|=; \
|
||||
using dawn::operator^=; \
|
||||
using dawn::HasZeroOrOneBits;
|
||||
|
||||
namespace dawn {
|
||||
|
||||
template <typename T>
|
||||
struct IsDawnBitmask {
|
||||
static constexpr bool enable = false;
|
||||
};
|
||||
|
||||
template <typename T, typename Enable = void>
|
||||
struct LowerBitmask {
|
||||
static constexpr bool enable = false;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct LowerBitmask<T, typename std::enable_if<IsDawnBitmask<T>::enable>::type> {
|
||||
static constexpr bool enable = true;
|
||||
using type = T;
|
||||
constexpr static T Lower(T t) {
|
||||
return t;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct BoolConvertible {
|
||||
using Integral = typename std::underlying_type<T>::type;
|
||||
|
||||
constexpr BoolConvertible(Integral value) : value(value) {
|
||||
}
|
||||
constexpr operator bool() const {
|
||||
return value != 0;
|
||||
}
|
||||
constexpr operator T() const {
|
||||
return static_cast<T>(value);
|
||||
}
|
||||
|
||||
Integral value;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct LowerBitmask<BoolConvertible<T>> {
|
||||
static constexpr bool enable = true;
|
||||
using type = T;
|
||||
static constexpr type Lower(BoolConvertible<T> t) {
|
||||
return t;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T1,
|
||||
typename T2,
|
||||
typename = typename std::enable_if<LowerBitmask<T1>::enable &&
|
||||
LowerBitmask<T2>::enable>::type>
|
||||
constexpr BoolConvertible<typename LowerBitmask<T1>::type> operator|(T1 left, T2 right) {
|
||||
using T = typename LowerBitmask<T1>::type;
|
||||
using Integral = typename std::underlying_type<T>::type;
|
||||
return static_cast<Integral>(LowerBitmask<T1>::Lower(left)) |
|
||||
static_cast<Integral>(LowerBitmask<T2>::Lower(right));
|
||||
}
|
||||
|
||||
template <typename T1,
|
||||
typename T2,
|
||||
typename = typename std::enable_if<LowerBitmask<T1>::enable &&
|
||||
LowerBitmask<T2>::enable>::type>
|
||||
constexpr BoolConvertible<typename LowerBitmask<T1>::type> operator&(T1 left, T2 right) {
|
||||
using T = typename LowerBitmask<T1>::type;
|
||||
using Integral = typename std::underlying_type<T>::type;
|
||||
return static_cast<Integral>(LowerBitmask<T1>::Lower(left)) &
|
||||
static_cast<Integral>(LowerBitmask<T2>::Lower(right));
|
||||
}
|
||||
|
||||
template <typename T1,
|
||||
typename T2,
|
||||
typename = typename std::enable_if<LowerBitmask<T1>::enable &&
|
||||
LowerBitmask<T2>::enable>::type>
|
||||
constexpr BoolConvertible<typename LowerBitmask<T1>::type> operator^(T1 left, T2 right) {
|
||||
using T = typename LowerBitmask<T1>::type;
|
||||
using Integral = typename std::underlying_type<T>::type;
|
||||
return static_cast<Integral>(LowerBitmask<T1>::Lower(left)) ^
|
||||
static_cast<Integral>(LowerBitmask<T2>::Lower(right));
|
||||
}
|
||||
|
||||
template <typename T1>
|
||||
constexpr BoolConvertible<typename LowerBitmask<T1>::type> operator~(T1 t) {
|
||||
using T = typename LowerBitmask<T1>::type;
|
||||
using Integral = typename std::underlying_type<T>::type;
|
||||
return ~static_cast<Integral>(LowerBitmask<T1>::Lower(t));
|
||||
}
|
||||
|
||||
template <typename T,
|
||||
typename T2,
|
||||
typename = typename std::enable_if<IsDawnBitmask<T>::enable &&
|
||||
LowerBitmask<T2>::enable>::type>
|
||||
constexpr T& operator&=(T& l, T2 right) {
|
||||
T r = LowerBitmask<T2>::Lower(right);
|
||||
l = l & r;
|
||||
return l;
|
||||
}
|
||||
|
||||
template <typename T,
|
||||
typename T2,
|
||||
typename = typename std::enable_if<IsDawnBitmask<T>::enable &&
|
||||
LowerBitmask<T2>::enable>::type>
|
||||
constexpr T& operator|=(T& l, T2 right) {
|
||||
T r = LowerBitmask<T2>::Lower(right);
|
||||
l = l | r;
|
||||
return l;
|
||||
}
|
||||
|
||||
template <typename T,
|
||||
typename T2,
|
||||
typename = typename std::enable_if<IsDawnBitmask<T>::enable &&
|
||||
LowerBitmask<T2>::enable>::type>
|
||||
constexpr T& operator^=(T& l, T2 right) {
|
||||
T r = LowerBitmask<T2>::Lower(right);
|
||||
l = l ^ r;
|
||||
return l;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
constexpr bool HasZeroOrOneBits(T value) {
|
||||
using Integral = typename std::underlying_type<T>::type;
|
||||
return (static_cast<Integral>(value) & (static_cast<Integral>(value) - 1)) == 0;
|
||||
}
|
||||
|
||||
} // namespace dawn
|
||||
|
||||
#endif // DAWN_ENUM_CLASS_BITMASKS_H_
|
||||
#include <dawn/EnumClassBitmasks.h>
|
||||
|
|
|
@ -1,36 +1 @@
|
|||
// Copyright 2019 The Dawn Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef DAWN_DAWN_PROC_H_
|
||||
#define DAWN_DAWN_PROC_H_
|
||||
|
||||
#include "dawn/dawn_proc_table.h"
|
||||
#include "dawn/webgpu.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Sets the static proctable used by libdawn_proc to implement the Dawn entrypoints. Passing NULL
|
||||
// for `procs` sets up the null proctable that contains only null function pointers. It is the
|
||||
// default value of the proctable. Setting the proctable back to null is good practice when you
|
||||
// are done using libdawn_proc since further usage will cause a segfault instead of calling an
|
||||
// unexpected function.
|
||||
WGPU_EXPORT void dawnProcSetProcs(const DawnProcTable* procs);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // DAWN_DAWN_PROC_H_
|
||||
#include <dawn/dawn_proc.h>
|
||||
|
|
|
@ -1,33 +1 @@
|
|||
// Copyright 2020 The Dawn Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef DAWN_DAWN_THREAD_DISPATCH_PROC_H_
|
||||
#define DAWN_DAWN_THREAD_DISPATCH_PROC_H_
|
||||
|
||||
#include "dawn/dawn_proc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Call dawnProcSetProcs(&dawnThreadDispatchProcTable) and then use dawnProcSetPerThreadProcs
|
||||
// to set per-thread procs.
|
||||
WGPU_EXPORT extern DawnProcTable dawnThreadDispatchProcTable;
|
||||
WGPU_EXPORT void dawnProcSetPerThreadProcs(const DawnProcTable* procs);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // DAWN_DAWN_THREAD_DISPATCH_PROC_H_
|
||||
#include <dawn/dawn_thread_dispatch_proc.h>
|
||||
|
|
|
@ -1,86 +1 @@
|
|||
// Copyright 2017 The Dawn Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef DAWN_DAWN_WSI_H_
|
||||
#define DAWN_DAWN_WSI_H_
|
||||
|
||||
#include <dawn/webgpu.h>
|
||||
|
||||
// Error message (or nullptr if there was no error)
|
||||
typedef const char* DawnSwapChainError;
|
||||
constexpr DawnSwapChainError DAWN_SWAP_CHAIN_NO_ERROR = nullptr;
|
||||
|
||||
typedef struct {
|
||||
/// Backend-specific texture id/name/pointer
|
||||
union {
|
||||
void* ptr;
|
||||
uint64_t u64;
|
||||
uint32_t u32;
|
||||
} texture;
|
||||
} DawnSwapChainNextTexture;
|
||||
|
||||
typedef struct {
|
||||
/// Initialize the swap chain implementation.
|
||||
/// (*wsiContext) is one of DawnWSIContext{D3D12,Metal,GL}
|
||||
void (*Init)(void* userData, void* wsiContext);
|
||||
|
||||
/// Destroy the swap chain implementation.
|
||||
void (*Destroy)(void* userData);
|
||||
|
||||
/// Configure/reconfigure the swap chain.
|
||||
DawnSwapChainError (*Configure)(void* userData,
|
||||
WGPUTextureFormat format,
|
||||
WGPUTextureUsage allowedUsage,
|
||||
uint32_t width,
|
||||
uint32_t height);
|
||||
|
||||
/// Acquire the next texture from the swap chain.
|
||||
DawnSwapChainError (*GetNextTexture)(void* userData, DawnSwapChainNextTexture* nextTexture);
|
||||
|
||||
/// Present the last acquired texture to the screen.
|
||||
DawnSwapChainError (*Present)(void* userData);
|
||||
|
||||
/// Each function is called with userData as its first argument.
|
||||
void* userData;
|
||||
|
||||
/// For use by the D3D12 and Vulkan backends: how the swapchain will use the texture.
|
||||
WGPUTextureUsage textureUsage;
|
||||
} DawnSwapChainImplementation;
|
||||
|
||||
#if defined(DAWN_ENABLE_BACKEND_D3D12) && defined(__cplusplus)
|
||||
struct DawnWSIContextD3D12 {
|
||||
WGPUDevice device = nullptr;
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(DAWN_ENABLE_BACKEND_METAL) && defined(__OBJC__)
|
||||
# import <Metal/Metal.h>
|
||||
|
||||
struct DawnWSIContextMetal {
|
||||
id<MTLDevice> device = nil;
|
||||
id<MTLCommandQueue> queue = nil;
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef DAWN_ENABLE_BACKEND_OPENGL
|
||||
typedef struct {
|
||||
} DawnWSIContextGL;
|
||||
#endif
|
||||
|
||||
#ifdef DAWN_ENABLE_BACKEND_VULKAN
|
||||
typedef struct {
|
||||
} DawnWSIContextVulkan;
|
||||
#endif
|
||||
|
||||
#endif // DAWN_DAWN_WSI_H
|
||||
#include <dawn/dawn_wsi.h>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
#include <dawn/webgpu.h>
|
|
@ -0,0 +1 @@
|
|||
#include "dawn/webgpu_cpp.h"
|
Loading…
Reference in New Issue