mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 00:17:03 +00:00
Updates DawnInstanceDescriptor to pass in the Platform.
Notes: - Separates ChainedStruct to be reusable without cpp header. (Also updates native structs to directly use it.) - Manually implements the descriptor in DawnNative. - Reworks ChainUtils with mapping from struct to STypes. - Updates the tests to use either SetPlatformForTesting which is still required because DawnTest uses a "global" instance for all tests and some tests require setting (and cleaning up) a test specific platform. Bug: dawn:1374 Change-Id: I078c78f22c5137030cf3cf0e8358fe4373ee9c6c Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132268 Reviewed-by: Austin Eng <enga@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Loko Kung <lokokung@google.com>
This commit is contained in:
@@ -44,6 +44,7 @@ dawn_json_generator("cpp_headers_gen") {
|
||||
target = "cpp_headers"
|
||||
outputs = [
|
||||
"include/dawn/webgpu_cpp.h",
|
||||
"include/dawn/webgpu_cpp_chained_struct.h",
|
||||
"include/dawn/webgpu_cpp_print.h",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "dawn/dawn_proc_table.h"
|
||||
#include "dawn/native/dawn_native_export.h"
|
||||
#include "dawn/webgpu.h"
|
||||
#include "dawn/webgpu_cpp_chained_struct.h"
|
||||
|
||||
namespace dawn::platform {
|
||||
class Platform;
|
||||
@@ -128,6 +129,20 @@ struct DAWN_NATIVE_EXPORT AdapterDiscoveryOptionsBase {
|
||||
|
||||
enum BackendValidationLevel { Full, Partial, Disabled };
|
||||
|
||||
// Can be chained in InstanceDescriptor
|
||||
struct DAWN_NATIVE_EXPORT DawnInstanceDescriptor : wgpu::ChainedStruct {
|
||||
DawnInstanceDescriptor();
|
||||
static constexpr size_t kFirstMemberAlignment =
|
||||
wgpu::detail::ConstexprMax(alignof(wgpu::ChainedStruct), alignof(uint32_t));
|
||||
alignas(kFirstMemberAlignment) uint32_t additionalRuntimeSearchPathsCount = 0;
|
||||
const char* const* additionalRuntimeSearchPaths;
|
||||
dawn::platform::Platform* platform = nullptr;
|
||||
|
||||
// Equality operators, mostly for testing. Note that this tests
|
||||
// strict pointer-pointer equality if the struct contains member pointers.
|
||||
bool operator==(const DawnInstanceDescriptor& rhs) const;
|
||||
};
|
||||
|
||||
// Represents a connection to dawn_native and is used for dependency injection, discovering
|
||||
// system adapters and injecting custom adapters (like a Swiftshader Vulkan adapter).
|
||||
//
|
||||
@@ -262,6 +277,12 @@ DAWN_NATIVE_EXPORT bool BindGroupLayoutBindingsEqualForTesting(WGPUBindGroupLayo
|
||||
|
||||
} // namespace dawn::native
|
||||
|
||||
// Alias the DawnInstanceDescriptor up to wgpu.
|
||||
// TODO(dawn:1374) Remove this aliasing once the usages are updated.
|
||||
namespace wgpu {
|
||||
using dawn::native::DawnInstanceDescriptor;
|
||||
} // namespace wgpu
|
||||
|
||||
// TODO(dawn:824): Remove once the deprecation period is passed.
|
||||
namespace dawn_native = dawn::native;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user