gpu: update to latest Dawn revision as of Dec 15, 2021
See hexops/dawn#4 Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
97ebee0e00
commit
c279e0c794
5 changed files with 41 additions and 161 deletions
|
|
@ -1 +1 @@
|
||||||
Subproject commit 2606c6a7b2bcb502637f108189450221ae9d1a2a
|
Subproject commit 0bae4b5373f7d3b117bd11837d1005350eb10f0c
|
||||||
|
|
@ -70,7 +70,23 @@ MACH_EXPORT MachDawnNativeAdapterProperties machDawnNativeAdapter_getProperties(
|
||||||
// // to implement the swapchain and interop APIs in Chromium.
|
// // to implement the swapchain and interop APIs in Chromium.
|
||||||
// bool SupportsExternalImages() const;
|
// bool SupportsExternalImages() const;
|
||||||
// explicit operator bool() const;
|
// explicit operator bool() const;
|
||||||
MACH_EXPORT WGPUDevice machDawnNativeAdapter_createDevice(MachDawnNativeAdapter adapter, MachDawnNativeDeviceDescriptor* deviceDescriptor) {
|
|
||||||
|
// TODO(dawn-native-mach): These API* methods correlate to the new API (which is unified between Dawn
|
||||||
|
// and wgpu-native?), e.g. dawn_native::Instance::APIRequestAdapter corresponds to wgpuInstanceRequestAdapter
|
||||||
|
// These are not implemented in Dawn yet according to austineng, but we should switch to this API once they do:
|
||||||
|
//
|
||||||
|
// "fyi, the requestAdapter/requestedDevice stuff isn't implemented right now. We just added the interface for it, but still working on the implementation. Today, it'll always fail the callback."
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// bool APIGetLimits(SupportedLimits* limits) const;
|
||||||
|
// void APIGetProperties(AdapterProperties* properties) const;
|
||||||
|
// bool APIHasFeature(wgpu::FeatureName feature) const;
|
||||||
|
// uint32_t APIEnumerateFeatures(wgpu::FeatureName* features) const;
|
||||||
|
// void APIRequestDevice(const DeviceDescriptor* descriptor,
|
||||||
|
// WGPURequestDeviceCallback callback,
|
||||||
|
// void* userdata);
|
||||||
|
//
|
||||||
|
MACH_EXPORT WGPUDevice machDawnNativeAdapter_createDevice(MachDawnNativeAdapter adapter, MachDawnNativeDawnDeviceDescriptor* deviceDescriptor) {
|
||||||
auto self = reinterpret_cast<dawn_native::Adapter*>(adapter);
|
auto self = reinterpret_cast<dawn_native::Adapter*>(adapter);
|
||||||
|
|
||||||
if (deviceDescriptor == nullptr) {
|
if (deviceDescriptor == nullptr) {
|
||||||
|
|
@ -89,7 +105,7 @@ MACH_EXPORT WGPUDevice machDawnNativeAdapter_createDevice(MachDawnNativeAdapter
|
||||||
for (int i = 0; i < deviceDescriptor->forceDisabledTogglesLength; i++)
|
for (int i = 0; i < deviceDescriptor->forceDisabledTogglesLength; i++)
|
||||||
cppForceDisabledToggles.push_back(deviceDescriptor->forceDisabledToggles[i]);
|
cppForceDisabledToggles.push_back(deviceDescriptor->forceDisabledToggles[i]);
|
||||||
|
|
||||||
auto cppDeviceDescriptor = dawn_native::DeviceDescriptor{
|
auto cppDeviceDescriptor = dawn_native::DawnDeviceDescriptor{
|
||||||
.requiredFeatures = cppRequiredExtensions,
|
.requiredFeatures = cppRequiredExtensions,
|
||||||
.forceEnabledToggles = cppForceEnabledToggles,
|
.forceEnabledToggles = cppForceEnabledToggles,
|
||||||
.forceDisabledToggles = cppForceDisabledToggles,
|
.forceDisabledToggles = cppForceDisabledToggles,
|
||||||
|
|
@ -131,6 +147,15 @@ MACH_EXPORT MachDawnNativeInstance machDawnNativeInstance_init(void) {
|
||||||
MACH_EXPORT void machDawnNativeInstance_deinit(MachDawnNativeInstance instance) {
|
MACH_EXPORT void machDawnNativeInstance_deinit(MachDawnNativeInstance instance) {
|
||||||
delete reinterpret_cast<dawn_native::Instance*>(instance);
|
delete reinterpret_cast<dawn_native::Instance*>(instance);
|
||||||
}
|
}
|
||||||
|
// TODO(dawn-native-mach): These API* methods correlate to the new API (which is unified between Dawn
|
||||||
|
// and wgpu-native?), e.g. dawn_native::Instance::APIRequestAdapter corresponds to wgpuInstanceRequestAdapter
|
||||||
|
// These are not implemented in Dawn yet according to austineng, but we should switch to this API once they do:
|
||||||
|
//
|
||||||
|
// "fyi, the requestAdapter/requestedDevice stuff isn't implemented right now. We just added the interface for it, but still working on the implementation. Today, it'll always fail the callback."
|
||||||
|
//
|
||||||
|
// void APIRequestAdapter(const RequestAdapterOptions* options,
|
||||||
|
// WGPURequestAdapterCallback callback,
|
||||||
|
// void* userdata);
|
||||||
MACH_EXPORT void machDawnNativeInstance_discoverDefaultAdapters(MachDawnNativeInstance instance) {
|
MACH_EXPORT void machDawnNativeInstance_discoverDefaultAdapters(MachDawnNativeInstance instance) {
|
||||||
dawn_native::Instance* self = reinterpret_cast<dawn_native::Instance*>(instance);
|
dawn_native::Instance* self = reinterpret_cast<dawn_native::Instance*>(instance);
|
||||||
self->DiscoverDefaultAdapters();
|
self->DiscoverDefaultAdapters();
|
||||||
|
|
@ -247,157 +272,3 @@ MACH_EXPORT WGPUTextureFormat machUtilsBackendBinding_getPreferredSwapChainTextu
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// TODO(dawn-native-mach): everything below here is not wrapped
|
|
||||||
|
|
||||||
// #ifndef DAWNNATIVE_DAWNNATIVE_H_
|
|
||||||
// #define DAWNNATIVE_DAWNNATIVE_H_
|
|
||||||
|
|
||||||
// #include <dawn/dawn_proc_table.h>
|
|
||||||
// #include <dawn/webgpu.h>
|
|
||||||
// #include <dawn_native/dawn_native_export.h>
|
|
||||||
|
|
||||||
// #include <string>
|
|
||||||
// #include <vector>
|
|
||||||
|
|
||||||
// namespace dawn_platform {
|
|
||||||
// class Platform;
|
|
||||||
// } // namespace dawn_platform
|
|
||||||
|
|
||||||
// namespace wgpu {
|
|
||||||
// struct AdapterProperties;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// namespace dawn_native {
|
|
||||||
|
|
||||||
// // DEPRECATED: use WGPUAdapterProperties instead.
|
|
||||||
// struct PCIInfo {
|
|
||||||
// uint32_t deviceId = 0;
|
|
||||||
// uint32_t vendorId = 0;
|
|
||||||
// std::string name;
|
|
||||||
// };
|
|
||||||
|
|
||||||
// // DEPRECATED: use WGPUBackendType instead.
|
|
||||||
// enum class BackendType {
|
|
||||||
// D3D12,
|
|
||||||
// Metal,
|
|
||||||
// Null,
|
|
||||||
// OpenGL,
|
|
||||||
// OpenGLES,
|
|
||||||
// Vulkan,
|
|
||||||
// };
|
|
||||||
|
|
||||||
// // DEPRECATED: use WGPUAdapterType instead.
|
|
||||||
// enum class DeviceType {
|
|
||||||
// DiscreteGPU,
|
|
||||||
// IntegratedGPU,
|
|
||||||
// CPU,
|
|
||||||
// Unknown,
|
|
||||||
// };
|
|
||||||
|
|
||||||
// class InstanceBase;
|
|
||||||
// class AdapterBase;
|
|
||||||
|
|
||||||
// // A struct to record the information of a toggle. A toggle is a code path in Dawn device that
|
|
||||||
// // can be manually configured to run or not outside Dawn, including workarounds, special
|
|
||||||
// // features and optimizations.
|
|
||||||
// struct ToggleInfo {
|
|
||||||
// const char* name;
|
|
||||||
// const char* description;
|
|
||||||
// const char* url;
|
|
||||||
// };
|
|
||||||
|
|
||||||
// // A struct to record the information of an extension. An extension is a GPU feature that is not
|
|
||||||
// // required to be supported by all Dawn backends and can only be used when it is enabled on the
|
|
||||||
// // creation of device.
|
|
||||||
// using ExtensionInfo = ToggleInfo;
|
|
||||||
|
|
||||||
// // Base class for options passed to Instance::DiscoverAdapters.
|
|
||||||
// struct DAWN_NATIVE_EXPORT AdapterDiscoveryOptionsBase {
|
|
||||||
// public:
|
|
||||||
// const WGPUBackendType backendType;
|
|
||||||
|
|
||||||
// protected:
|
|
||||||
// AdapterDiscoveryOptionsBase(WGPUBackendType type);
|
|
||||||
// };
|
|
||||||
|
|
||||||
// enum BackendValidationLevel { Full, Partial, Disabled };
|
|
||||||
|
|
||||||
// class DAWN_NATIVE_EXPORT Instance {
|
|
||||||
// };
|
|
||||||
|
|
||||||
// // Query the names of all the toggles that are enabled in device
|
|
||||||
// DAWN_NATIVE_EXPORT std::vector<const char*> GetTogglesUsed(WGPUDevice device);
|
|
||||||
|
|
||||||
// // Backdoor to get the number of lazy clears for testing
|
|
||||||
// DAWN_NATIVE_EXPORT size_t GetLazyClearCountForTesting(WGPUDevice device);
|
|
||||||
|
|
||||||
// // Backdoor to get the number of deprecation warnings for testing
|
|
||||||
// DAWN_NATIVE_EXPORT size_t GetDeprecationWarningCountForTesting(WGPUDevice device);
|
|
||||||
|
|
||||||
// // Query if texture has been initialized
|
|
||||||
// DAWN_NATIVE_EXPORT bool IsTextureSubresourceInitialized(
|
|
||||||
// WGPUTexture texture,
|
|
||||||
// uint32_t baseMipLevel,
|
|
||||||
// uint32_t levelCount,
|
|
||||||
// uint32_t baseArrayLayer,
|
|
||||||
// uint32_t layerCount,
|
|
||||||
// WGPUTextureAspect aspect = WGPUTextureAspect_All);
|
|
||||||
|
|
||||||
// // Backdoor to get the order of the ProcMap for testing
|
|
||||||
// DAWN_NATIVE_EXPORT std::vector<const char*> GetProcMapNamesForTesting();
|
|
||||||
|
|
||||||
// DAWN_NATIVE_EXPORT bool DeviceTick(WGPUDevice device);
|
|
||||||
|
|
||||||
// // ErrorInjector functions used for testing only. Defined in dawn_native/ErrorInjector.cpp
|
|
||||||
// DAWN_NATIVE_EXPORT void EnableErrorInjector();
|
|
||||||
// DAWN_NATIVE_EXPORT void DisableErrorInjector();
|
|
||||||
// DAWN_NATIVE_EXPORT void ClearErrorInjector();
|
|
||||||
// DAWN_NATIVE_EXPORT uint64_t AcquireErrorInjectorCallCount();
|
|
||||||
// DAWN_NATIVE_EXPORT void InjectErrorAt(uint64_t index);
|
|
||||||
|
|
||||||
// // The different types of external images
|
|
||||||
// enum ExternalImageType {
|
|
||||||
// OpaqueFD,
|
|
||||||
// DmaBuf,
|
|
||||||
// IOSurface,
|
|
||||||
// DXGISharedHandle,
|
|
||||||
// EGLImage,
|
|
||||||
// };
|
|
||||||
|
|
||||||
// // Common properties of external images
|
|
||||||
// struct DAWN_NATIVE_EXPORT ExternalImageDescriptor {
|
|
||||||
// public:
|
|
||||||
// const ExternalImageType type;
|
|
||||||
// const WGPUTextureDescriptor* cTextureDescriptor; // Must match image creation params
|
|
||||||
// bool isInitialized; // Whether the texture is initialized on import
|
|
||||||
|
|
||||||
// protected:
|
|
||||||
// ExternalImageDescriptor(ExternalImageType type);
|
|
||||||
// };
|
|
||||||
|
|
||||||
// struct DAWN_NATIVE_EXPORT ExternalImageAccessDescriptor {
|
|
||||||
// public:
|
|
||||||
// bool isInitialized; // Whether the texture is initialized on import
|
|
||||||
// WGPUTextureUsageFlags usage;
|
|
||||||
// };
|
|
||||||
|
|
||||||
// struct DAWN_NATIVE_EXPORT ExternalImageExportInfo {
|
|
||||||
// public:
|
|
||||||
// const ExternalImageType type;
|
|
||||||
// bool isInitialized; // Whether the texture is initialized after export
|
|
||||||
|
|
||||||
// protected:
|
|
||||||
// ExternalImageExportInfo(ExternalImageType type);
|
|
||||||
// };
|
|
||||||
|
|
||||||
// DAWN_NATIVE_EXPORT const char* GetObjectLabelForTesting(void* objectHandle);
|
|
||||||
|
|
||||||
// DAWN_NATIVE_EXPORT uint64_t GetAllocatedSizeForTesting(WGPUBuffer buffer);
|
|
||||||
|
|
||||||
// DAWN_NATIVE_EXPORT bool BindGroupLayoutBindingsEqualForTesting(WGPUBindGroupLayout a,
|
|
||||||
// WGPUBindGroupLayout b);
|
|
||||||
|
|
||||||
// } // namespace dawn_native
|
|
||||||
|
|
||||||
// #endif // DAWNNATIVE_DAWNNATIVE_H_
|
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ MACH_EXPORT MachDawnNativeAdapterProperties machDawnNativeAdapter_getProperties(
|
||||||
|
|
||||||
// An optional parameter of Adapter::CreateDevice() to send additional information when creating
|
// An optional parameter of Adapter::CreateDevice() to send additional information when creating
|
||||||
// a Device. For example, we can use it to enable a workaround, optimization or feature.
|
// a Device. For example, we can use it to enable a workaround, optimization or feature.
|
||||||
typedef struct MachDawnNativeDeviceDescriptor {
|
typedef struct MachDawnNativeDawnDeviceDescriptor {
|
||||||
char** requiredFeatures;
|
char** requiredFeatures;
|
||||||
uintptr_t requiredFeaturesLength;
|
uintptr_t requiredFeaturesLength;
|
||||||
|
|
||||||
|
|
@ -63,8 +63,8 @@ typedef struct MachDawnNativeDeviceDescriptor {
|
||||||
|
|
||||||
// default null
|
// default null
|
||||||
WGPURequiredLimits* requiredLimits;
|
WGPURequiredLimits* requiredLimits;
|
||||||
} MachDawnNativeDeviceDescriptor;
|
} MachDawnNativeDawnDeviceDescriptor;
|
||||||
MACH_EXPORT WGPUDevice machDawnNativeAdapter_createDevice(MachDawnNativeAdapter adapter, MachDawnNativeDeviceDescriptor* deviceDescriptor);
|
MACH_EXPORT WGPUDevice machDawnNativeAdapter_createDevice(MachDawnNativeAdapter adapter, MachDawnNativeDawnDeviceDescriptor* deviceDescriptor);
|
||||||
|
|
||||||
typedef struct MachDawnNativeAdaptersImpl* MachDawnNativeAdapters;
|
typedef struct MachDawnNativeAdaptersImpl* MachDawnNativeAdapters;
|
||||||
MACH_EXPORT MachDawnNativeAdapter machDawnNativeAdapters_index(MachDawnNativeAdapters adapters, uintptr_t index);
|
MACH_EXPORT MachDawnNativeAdapter machDawnNativeAdapters_index(MachDawnNativeAdapters adapters, uintptr_t index);
|
||||||
|
|
|
||||||
|
|
@ -6,20 +6,26 @@
|
||||||
|
|
||||||
#include "src/dawn_wire/ChunkedCommandHandler.cpp"
|
#include "src/dawn_wire/ChunkedCommandHandler.cpp"
|
||||||
#include "src/dawn_wire/ChunkedCommandSerializer.cpp"
|
#include "src/dawn_wire/ChunkedCommandSerializer.cpp"
|
||||||
|
#include "src/dawn_wire/SupportedFeatures.cpp"
|
||||||
#include "src/dawn_wire/Wire.cpp"
|
#include "src/dawn_wire/Wire.cpp"
|
||||||
#include "src/dawn_wire/WireClient.cpp"
|
#include "src/dawn_wire/WireClient.cpp"
|
||||||
#include "src/dawn_wire/WireDeserializeAllocator.cpp"
|
#include "src/dawn_wire/WireDeserializeAllocator.cpp"
|
||||||
#include "src/dawn_wire/WireServer.cpp"
|
#include "src/dawn_wire/WireServer.cpp"
|
||||||
|
#include "src/dawn_wire/client/Adapter.cpp"
|
||||||
#include "src/dawn_wire/client/Buffer.cpp"
|
#include "src/dawn_wire/client/Buffer.cpp"
|
||||||
#include "src/dawn_wire/client/Client.cpp"
|
#include "src/dawn_wire/client/Client.cpp"
|
||||||
#include "src/dawn_wire/client/ClientDoers.cpp"
|
#include "src/dawn_wire/client/ClientDoers.cpp"
|
||||||
#include "src/dawn_wire/client/ClientInlineMemoryTransferService.cpp"
|
#include "src/dawn_wire/client/ClientInlineMemoryTransferService.cpp"
|
||||||
#include "src/dawn_wire/client/Device.cpp"
|
#include "src/dawn_wire/client/Device.cpp"
|
||||||
|
#include "src/dawn_wire/client/Instance.cpp"
|
||||||
|
#include "src/dawn_wire/client/LimitsAndFeatures.cpp"
|
||||||
#include "src/dawn_wire/client/Queue.cpp"
|
#include "src/dawn_wire/client/Queue.cpp"
|
||||||
#include "src/dawn_wire/client/ShaderModule.cpp"
|
#include "src/dawn_wire/client/ShaderModule.cpp"
|
||||||
#include "src/dawn_wire/server/Server.cpp"
|
#include "src/dawn_wire/server/Server.cpp"
|
||||||
|
#include "src/dawn_wire/server/ServerAdapter.cpp"
|
||||||
#include "src/dawn_wire/server/ServerBuffer.cpp"
|
#include "src/dawn_wire/server/ServerBuffer.cpp"
|
||||||
#include "src/dawn_wire/server/ServerDevice.cpp"
|
#include "src/dawn_wire/server/ServerDevice.cpp"
|
||||||
#include "src/dawn_wire/server/ServerInlineMemoryTransferService.cpp"
|
#include "src/dawn_wire/server/ServerInlineMemoryTransferService.cpp"
|
||||||
|
#include "src/dawn_wire/server/ServerInstance.cpp"
|
||||||
#include "src/dawn_wire/server/ServerQueue.cpp"
|
#include "src/dawn_wire/server/ServerQueue.cpp"
|
||||||
#include "src/dawn_wire/server/ServerShaderModule.cpp"
|
#include "src/dawn_wire/server/ServerShaderModule.cpp"
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,7 @@
|
||||||
#include "third_party/tint/src/symbol.cc"
|
#include "third_party/tint/src/symbol.cc"
|
||||||
#include "third_party/tint/src/symbol_table.cc"
|
#include "third_party/tint/src/symbol_table.cc"
|
||||||
#include "third_party/tint/src/transform/add_empty_entry_point.cc"
|
#include "third_party/tint/src/transform/add_empty_entry_point.cc"
|
||||||
|
#include "third_party/tint/src/transform/add_spirv_block_decoration.cc"
|
||||||
#include "third_party/tint/src/transform/array_length_from_uniform.cc"
|
#include "third_party/tint/src/transform/array_length_from_uniform.cc"
|
||||||
#include "third_party/tint/src/transform/binding_remapper.cc"
|
#include "third_party/tint/src/transform/binding_remapper.cc"
|
||||||
#include "third_party/tint/src/transform/calculate_array_length.cc"
|
#include "third_party/tint/src/transform/calculate_array_length.cc"
|
||||||
|
|
@ -104,6 +105,7 @@
|
||||||
#include "third_party/tint/src/transform/fold_constants.cc"
|
#include "third_party/tint/src/transform/fold_constants.cc"
|
||||||
#include "third_party/tint/src/transform/fold_trivial_single_use_lets.cc"
|
#include "third_party/tint/src/transform/fold_trivial_single_use_lets.cc"
|
||||||
#include "third_party/tint/src/transform/for_loop_to_loop.cc"
|
#include "third_party/tint/src/transform/for_loop_to_loop.cc"
|
||||||
|
#include "third_party/tint/src/transform/localize_struct_array_assignment.cc"
|
||||||
#include "third_party/tint/src/transform/loop_to_for_loop.cc"
|
#include "third_party/tint/src/transform/loop_to_for_loop.cc"
|
||||||
#include "third_party/tint/src/transform/manager.cc"
|
#include "third_party/tint/src/transform/manager.cc"
|
||||||
#include "third_party/tint/src/transform/module_scope_var_to_entry_point_param.cc"
|
#include "third_party/tint/src/transform/module_scope_var_to_entry_point_param.cc"
|
||||||
|
|
@ -112,6 +114,7 @@
|
||||||
#include "third_party/tint/src/transform/pad_array_elements.cc"
|
#include "third_party/tint/src/transform/pad_array_elements.cc"
|
||||||
#include "third_party/tint/src/transform/promote_initializers_to_const_var.cc"
|
#include "third_party/tint/src/transform/promote_initializers_to_const_var.cc"
|
||||||
#include "third_party/tint/src/transform/remove_phonies.cc"
|
#include "third_party/tint/src/transform/remove_phonies.cc"
|
||||||
|
#include "third_party/tint/src/transform/remove_unreachable_statements.cc"
|
||||||
#include "third_party/tint/src/transform/renamer.cc"
|
#include "third_party/tint/src/transform/renamer.cc"
|
||||||
#include "third_party/tint/src/transform/robustness.cc"
|
#include "third_party/tint/src/transform/robustness.cc"
|
||||||
#include "third_party/tint/src/transform/simplify_pointers.cc"
|
#include "third_party/tint/src/transform/simplify_pointers.cc"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue