rename mach/gpu to mach/gpu-dawn

See https://github.com/hexops/mach/issues/133#issuecomment-999940767

Helps #109
Helps #133

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2021-12-22 16:37:26 -07:00 committed by Stephen Gutekanst
parent 7ec7fb7af0
commit 7af784bee7
28 changed files with 0 additions and 1 deletions

5
gpu-dawn/src/dawn/c.zig Normal file
View file

@ -0,0 +1,5 @@
pub const c = @cImport({
@cInclude("dawn/webgpu.h");
@cInclude("dawn/dawn_proc.h");
@cInclude("dawn_native_mach.h");
});

View file

@ -0,0 +1,274 @@
#include <dawn_native/DawnNative.h>
#include <dawn_native/wgpu_structs_autogen.h>
#include "utils/BackendBinding.h"
#if defined(DAWN_ENABLE_BACKEND_OPENGL)
#include <dawn_native/OpenGLBackend.h>
#endif
#include "dawn_native_mach.h"
#ifdef __cplusplus
extern "C" {
#endif
// wgpu::AdapterProperties wrappers
MACH_EXPORT void machDawnNativeAdapterProperties_deinit(MachDawnNativeAdapterProperties properties) {
auto self = reinterpret_cast<wgpu::AdapterProperties*>(properties);
delete self;
}
MACH_EXPORT uint32_t machDawnNativeAdapterProperties_getVendorID(MachDawnNativeAdapterProperties properties) {
auto self = reinterpret_cast<wgpu::AdapterProperties*>(properties);
return self->vendorID;
}
MACH_EXPORT uint32_t machDawnNativeAdapterProperties_getDeviceID(MachDawnNativeAdapterProperties properties) {
auto self = reinterpret_cast<wgpu::AdapterProperties*>(properties);
return self->deviceID;
}
MACH_EXPORT char const* machDawnNativeAdapterProperties_getName(MachDawnNativeAdapterProperties properties) {
auto self = reinterpret_cast<wgpu::AdapterProperties*>(properties);
return self->name;
}
MACH_EXPORT char const* machDawnNativeAdapterProperties_getDriverDescription(MachDawnNativeAdapterProperties properties) {
auto self = reinterpret_cast<wgpu::AdapterProperties*>(properties);
return self->driverDescription;
}
MACH_EXPORT WGPUAdapterType machDawnNativeAdapterProperties_getAdapterType(MachDawnNativeAdapterProperties properties) {
auto self = reinterpret_cast<wgpu::AdapterProperties*>(properties);
switch (self->adapterType) {
case wgpu::AdapterType::DiscreteGPU: return WGPUAdapterType_DiscreteGPU;
case wgpu::AdapterType::IntegratedGPU: return WGPUAdapterType_IntegratedGPU;
case wgpu::AdapterType::CPU: return WGPUAdapterType_CPU;
case wgpu::AdapterType::Unknown: return WGPUAdapterType_Unknown;
}
}
MACH_EXPORT WGPUBackendType machDawnNativeAdapterProperties_getBackendType(MachDawnNativeAdapterProperties properties) {
auto self = reinterpret_cast<wgpu::AdapterProperties*>(properties);
switch (self->backendType) {
case wgpu::BackendType::WebGPU: return WGPUBackendType_WebGPU;
case wgpu::BackendType::D3D11: return WGPUBackendType_D3D11;
case wgpu::BackendType::D3D12: return WGPUBackendType_D3D12;
case wgpu::BackendType::Metal: return WGPUBackendType_Metal;
case wgpu::BackendType::Null: return WGPUBackendType_Null;
case wgpu::BackendType::OpenGL: return WGPUBackendType_OpenGL;
case wgpu::BackendType::OpenGLES: return WGPUBackendType_OpenGLES;
case wgpu::BackendType::Vulkan: return WGPUBackendType_Vulkan;
}
}
// dawn_native::Adapter wrappers
MACH_EXPORT MachDawnNativeAdapterProperties machDawnNativeAdapter_getProperties(MachDawnNativeAdapter adapter) {
auto self = reinterpret_cast<dawn_native::Adapter*>(adapter);
auto cppProperties = new wgpu::AdapterProperties();
self->GetProperties(cppProperties);
return reinterpret_cast<MachDawnNativeAdapterProperties>(cppProperties);
}
// TODO(dawn-native-mach):
// std::vector<const char*> GetSupportedExtensions() const;
// WGPUDeviceProperties GetAdapterProperties() const;
// bool GetLimits(WGPUSupportedLimits* limits) const;
// void SetUseTieredLimits(bool useTieredLimits);
// // Check that the Adapter is able to support importing external images. This is necessary
// // to implement the swapchain and interop APIs in Chromium.
// bool SupportsExternalImages() const;
// explicit operator bool() const;
// 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);
if (deviceDescriptor == nullptr) {
return self->CreateDevice(nullptr);
}
std::vector<const char*> cppRequiredExtensions;
for (int i = 0; i < deviceDescriptor->requiredFeaturesLength; i++)
cppRequiredExtensions.push_back(deviceDescriptor->requiredFeatures[i]);
std::vector<const char*> cppForceEnabledToggles;
for (int i = 0; i < deviceDescriptor->forceEnabledTogglesLength; i++)
cppForceEnabledToggles.push_back(deviceDescriptor->forceEnabledToggles[i]);
std::vector<const char*> cppForceDisabledToggles;
for (int i = 0; i < deviceDescriptor->forceDisabledTogglesLength; i++)
cppForceDisabledToggles.push_back(deviceDescriptor->forceDisabledToggles[i]);
auto cppDeviceDescriptor = dawn_native::DawnDeviceDescriptor{
.requiredFeatures = cppRequiredExtensions,
.forceEnabledToggles = cppForceEnabledToggles,
.forceDisabledToggles = cppForceDisabledToggles,
.requiredLimits = deviceDescriptor->requiredLimits,
};
return self->CreateDevice(&cppDeviceDescriptor);
}
// TODO(dawn-native-mach):
// // Create a device on this adapter, note that the interface will change to include at least
// // a device descriptor and a pointer to backend specific options.
// // On an error, nullptr is returned.
// WGPUDevice CreateDevice(const DeviceDescriptor* deviceDescriptor = nullptr);
// TODO(dawn-native-mach):
// void RequestDevice(const DeviceDescriptor* descriptor,
// WGPURequestDeviceCallback callback,
// void* userdata);
// TODO(dawn-native-mach):
// // Reset the backend device object for testing purposes.
// void ResetInternalDeviceForTesting();
// std::vector<Adapter> wrapper
typedef struct MachDawnNativeAdaptersImpl* MachDawnNativeAdapters;
MACH_EXPORT MachDawnNativeAdapter machDawnNativeAdapters_index(MachDawnNativeAdapters adapters, uintptr_t index) {
auto self = reinterpret_cast<std::vector<dawn_native::Adapter>*>(adapters);
return reinterpret_cast<MachDawnNativeAdapter>(&(*self)[index]);
}
MACH_EXPORT uintptr_t machDawnNativeAdapters_length(MachDawnNativeAdapters adapters) {
auto self = reinterpret_cast<std::vector<dawn_native::Adapter>*>(adapters);
return self->size();
};
// dawn_native::Instance wrappers
MACH_EXPORT MachDawnNativeInstance machDawnNativeInstance_init(void) {
return reinterpret_cast<MachDawnNativeInstance>(new dawn_native::Instance());
}
MACH_EXPORT void machDawnNativeInstance_deinit(MachDawnNativeInstance 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) {
dawn_native::Instance* self = reinterpret_cast<dawn_native::Instance*>(instance);
self->DiscoverDefaultAdapters();
}
MACH_EXPORT bool machDawnNativeInstance_discoverAdapters(MachDawnNativeInstance instance, WGPUBackendType backendType, const void* options) {
dawn_native::Instance* self = reinterpret_cast<dawn_native::Instance*>(instance);
switch (backendType) {
case WGPUBackendType_OpenGL:
#if defined(DAWN_ENABLE_BACKEND_DESKTOP_GL)
{
auto opt = reinterpret_cast<const MachDawnNativeAdapterDiscoveryOptions_OpenGL*>(options);
dawn_native::opengl::AdapterDiscoveryOptions adapterOptions = dawn_native::opengl::AdapterDiscoveryOptions();
adapterOptions.getProc = opt->getProc;
return self->DiscoverAdapters(&adapterOptions);
}
#endif
case WGPUBackendType_OpenGLES:
#if defined(DAWN_ENABLE_BACKEND_OPENGLES)
{
auto opt = reinterpret_cast<const MachDawnNativeAdapterDiscoveryOptions_OpenGLES*>(options);
dawn_native::opengl::AdapterDiscoveryOptionsES adapterOptions;
adapterOptions.getProc = opt->getProc;
return self->DiscoverAdapters(&adapterOptions);
}
#endif
case WGPUBackendType_WebGPU:
case WGPUBackendType_D3D11:
case WGPUBackendType_D3D12:
case WGPUBackendType_Metal:
case WGPUBackendType_Null:
case WGPUBackendType_Vulkan:
case WGPUBackendType_Force32:
return false;
}
}
MACH_EXPORT MachDawnNativeAdapters machDawnNativeInstance_getAdapters(MachDawnNativeInstance instance) {
dawn_native::Instance* self = reinterpret_cast<dawn_native::Instance*>(instance);
auto cppAdapters = self->GetAdapters();
auto heapAllocated = new std::vector<dawn_native::Adapter>();
for (int i=0; i<cppAdapters.size(); i++) heapAllocated->push_back(cppAdapters[i]);
return reinterpret_cast<MachDawnNativeAdapters>(heapAllocated);
}
MACH_EXPORT const DawnProcTable* machDawnNativeGetProcs() {
return &dawn_native::GetProcs();
}
// TODO(dawn-native-mach):
// const ToggleInfo* GetToggleInfo(const char* toggleName);
// TODO(dawn-native-mach):
// // Enables backend validation layers
// void EnableBackendValidation(bool enableBackendValidation);
// void SetBackendValidationLevel(BackendValidationLevel validationLevel);
// TODO(dawn-native-mach):
// // Enable debug capture on Dawn startup
// void EnableBeginCaptureOnStartup(bool beginCaptureOnStartup);
// TODO(dawn-native-mach):
// void SetPlatform(dawn_platform::Platform* platform);
// TODO(dawn-native-mach):
// // Returns the underlying WGPUInstance object.
// WGPUInstance Get() const;
// typedef struct MachUtilsBackendBindingImpl* MachUtilsBackendBinding;
MACH_EXPORT MachUtilsBackendBinding machUtilsCreateBinding(WGPUBackendType backendType, GLFWwindow* window, WGPUDevice device) {
wgpu::BackendType cppBackendType;
switch (backendType) {
case WGPUBackendType_WebGPU:
cppBackendType = wgpu::BackendType::WebGPU;
break;
case WGPUBackendType_D3D11:
cppBackendType = wgpu::BackendType::D3D11;
break;
case WGPUBackendType_D3D12:
cppBackendType = wgpu::BackendType::D3D12;
break;
case WGPUBackendType_Metal:
cppBackendType = wgpu::BackendType::Metal;
break;
case WGPUBackendType_Null:
cppBackendType = wgpu::BackendType::Null;
break;
case WGPUBackendType_OpenGL:
cppBackendType = wgpu::BackendType::OpenGL;
break;
case WGPUBackendType_OpenGLES:
cppBackendType = wgpu::BackendType::OpenGLES;
break;
case WGPUBackendType_Vulkan:
cppBackendType = wgpu::BackendType::Vulkan;
break;
case WGPUBackendType_Force32:
// Force32 is just to force the size of the C enum type to 32-bits, so this is technically
// an illegal input.
cppBackendType = wgpu::BackendType::Null;
break;
}
return reinterpret_cast<MachUtilsBackendBinding>(utils::CreateBinding(cppBackendType, window, device));
}
MACH_EXPORT uint64_t machUtilsBackendBinding_getSwapChainImplementation(MachUtilsBackendBinding binding) {
auto self = reinterpret_cast<utils::BackendBinding*>(binding);
return self->GetSwapChainImplementation();
}
MACH_EXPORT WGPUTextureFormat machUtilsBackendBinding_getPreferredSwapChainTextureFormat(MachUtilsBackendBinding binding) {
auto self = reinterpret_cast<utils::BackendBinding*>(binding);
return self->GetPreferredSwapChainTextureFormat();
}
#ifdef __cplusplus
} // extern "C"
#endif

View file

@ -0,0 +1,116 @@
#ifndef MACH_DAWNNATIVE_C_H_
#define MACH_DAWNNATIVE_C_H_
#ifdef __cplusplus
extern "C" {
#endif
#if defined(MACH_DAWNNATIVE_C_SHARED_LIBRARY)
# if defined(_WIN32)
# if defined(MACH_DAWNNATIVE_C_IMPLEMENTATION)
# define MACH_EXPORT __declspec(dllexport)
# else
# define MACH_EXPORT __declspec(dllimport)
# endif
# else // defined(_WIN32)
# if defined(MACH_DAWNNATIVE_C_IMPLEMENTATION)
# define MACH_EXPORT __attribute__((visibility("default")))
# else
# define MACH_EXPORT
# endif
# endif // defined(_WIN32)
#else // defined(MACH_DAWNNATIVE_C_SHARED_LIBRARY)
# define MACH_EXPORT
#endif // defined(MACH_DAWNNATIVE_C_SHARED_LIBRARY)
#include <dawn/webgpu.h>
#include <dawn/dawn_proc_table.h>
// TODO(slimsag): future: Dawn authors want dawn_native::AdapterProperties to eventually be in webgpu.h,
// and there is a corresponding WGPUAdapterProperties struct today, but there aren't corresponding methods
// to actually use / work with it today.
typedef struct MachDawnNativeAdapterPropertiesImpl* MachDawnNativeAdapterProperties;
MACH_EXPORT void machDawnNativeAdapterProperties_deinit(MachDawnNativeAdapterProperties properties);
MACH_EXPORT uint32_t machDawnNativeAdapterProperties_getVendorID(MachDawnNativeAdapterProperties properties);
MACH_EXPORT uint32_t machDawnNativeAdapterProperties_getDeviceID(MachDawnNativeAdapterProperties properties);
MACH_EXPORT char const* machDawnNativeAdapterProperties_getName(MachDawnNativeAdapterProperties properties);
MACH_EXPORT char const* machDawnNativeAdapterProperties_getDriverDescription(MachDawnNativeAdapterProperties properties);
MACH_EXPORT WGPUAdapterType machDawnNativeAdapterProperties_getAdapterType(MachDawnNativeAdapterProperties properties);
MACH_EXPORT WGPUBackendType machDawnNativeAdapterProperties_getBackendType(MachDawnNativeAdapterProperties properties);
// An adapter is an object that represent on possibility of creating devices in the system.
// Most of the time it will represent a combination of a physical GPU and an API. Not that the
// same GPU can be represented by multiple adapters but on different APIs.
//
// The underlying Dawn adapter is owned by the Dawn instance so this is just a reference to an
// underlying adapter.
typedef struct MachDawnNativeAdapterImpl* MachDawnNativeAdapter;
MACH_EXPORT MachDawnNativeAdapterProperties machDawnNativeAdapter_getProperties(MachDawnNativeAdapter adapter);
// 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.
typedef struct MachDawnNativeDawnDeviceDescriptor {
char** requiredFeatures;
uintptr_t requiredFeaturesLength;
char** forceEnabledToggles;
uintptr_t forceEnabledTogglesLength;
char** forceDisabledToggles;
uintptr_t forceDisabledTogglesLength;
// default null
WGPURequiredLimits* requiredLimits;
} MachDawnNativeDawnDeviceDescriptor;
MACH_EXPORT WGPUDevice machDawnNativeAdapter_createDevice(MachDawnNativeAdapter adapter, MachDawnNativeDawnDeviceDescriptor* deviceDescriptor);
typedef struct MachDawnNativeAdaptersImpl* MachDawnNativeAdapters;
MACH_EXPORT MachDawnNativeAdapter machDawnNativeAdapters_index(MachDawnNativeAdapters adapters, uintptr_t index);
MACH_EXPORT uintptr_t machDawnNativeAdapters_length(MachDawnNativeAdapters adapters);
// Represents a connection to dawn_native and is used for dependency injection, discovering
// system adapters and injecting custom adapters (like a Swiftshader Vulkan adapter).
//
// This can be initialized via machDawnNativeInstanceInit and destroyed via
// machDawnNativeInstanceDeinit. The instance controls the lifetime of all adapters for the
// instance.
typedef struct MachDawnNativeInstanceImpl* MachDawnNativeInstance;
MACH_EXPORT MachDawnNativeInstance machDawnNativeInstance_init(void);
MACH_EXPORT void machDawnNativeInstance_deinit(MachDawnNativeInstance);
MACH_EXPORT void machDawnNativeInstance_discoverDefaultAdapters(MachDawnNativeInstance);
// Adds adapters that can be discovered with the options provided (like a getProcAddress).
// You must specify a valid backend type corresponding to the type of MachDawnNativeAdapterDiscoveryOptions_
// struct pointer you pass as options.
// Returns true on success.
MACH_EXPORT bool machDawnNativeInstance_discoverAdapters(MachDawnNativeInstance instance, WGPUBackendType backendType, const void* options);
MACH_EXPORT MachDawnNativeAdapters machDawnNativeInstance_getAdapters(MachDawnNativeInstance instance);
// Backend-agnostic API for dawn_native
MACH_EXPORT const DawnProcTable* machDawnNativeGetProcs();
// Backend-specific options which can be passed to discoverAdapters
typedef struct MachDawnNativeAdapterDiscoveryOptions_OpenGL {
void* (*getProc)(const char*);
} MachDawnNativeAdapterDiscoveryOptions_OpenGL;
typedef struct MachDawnNativeAdapterDiscoveryOptions_OpenGLES {
void* (*getProc)(const char*);
} MachDawnNativeAdapterDiscoveryOptions_OpenGLES;
// utils
#include <GLFW/glfw3.h>
typedef struct MachUtilsBackendBindingImpl* MachUtilsBackendBinding;
MACH_EXPORT MachUtilsBackendBinding machUtilsCreateBinding(WGPUBackendType backendType, GLFWwindow* window, WGPUDevice device);
MACH_EXPORT uint64_t machUtilsBackendBinding_getSwapChainImplementation(MachUtilsBackendBinding binding);
MACH_EXPORT WGPUTextureFormat machUtilsBackendBinding_getPreferredSwapChainTextureFormat(MachUtilsBackendBinding binding);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // MACH_DAWNNATIVE_C_H_

View file

View file

@ -0,0 +1,178 @@
const std = @import("std");
const sample_utils = @import("sample_utils.zig");
const c = @import("c.zig").c;
const glfw = @import("glfw");
// #include "utils/SystemUtils.h"
// #include "utils/WGPUHelpers.h"
// WGPUSwapChain swapchain;
// WGPURenderPipeline pipeline;
// WGPUTextureFormat swapChainFormat;
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
var allocator = gpa.allocator();
const setup = try sample_utils.setup();
const queue = c.wgpuDeviceGetQueue(setup.device);
var descriptor = std.mem.zeroes(c.WGPUSwapChainDescriptor);
descriptor.implementation = c.machUtilsBackendBinding_getSwapChainImplementation(setup.binding);
const swap_chain = c.wgpuDeviceCreateSwapChain(setup.device, null, &descriptor);
const swap_chain_format = c.machUtilsBackendBinding_getPreferredSwapChainTextureFormat(setup.binding);
c.wgpuSwapChainConfigure(swap_chain, swap_chain_format, c.WGPUTextureUsage_RenderAttachment, 640, 480);
const vs =
\\ [[stage(vertex)]] fn main(
\\ [[builtin(vertex_index)]] VertexIndex : u32
\\ ) -> [[builtin(position)]] vec4<f32> {
\\ var pos = array<vec2<f32>, 3>(
\\ vec2<f32>( 0.0, 0.5),
\\ vec2<f32>(-0.5, -0.5),
\\ vec2<f32>( 0.5, -0.5)
\\ );
\\ return vec4<f32>(pos[VertexIndex], 0.0, 1.0);
\\ }
;
var vs_wgsl_descriptor = try allocator.create(c.WGPUShaderModuleWGSLDescriptor);
vs_wgsl_descriptor.chain.next = null;
vs_wgsl_descriptor.chain.sType = c.WGPUSType_ShaderModuleWGSLDescriptor;
vs_wgsl_descriptor.source = vs;
const vs_shader_descriptor = c.WGPUShaderModuleDescriptor{
.nextInChain = @ptrCast(*const c.WGPUChainedStruct, vs_wgsl_descriptor),
.label = "my vertex shader",
};
const vs_module = c.wgpuDeviceCreateShaderModule(setup.device, &vs_shader_descriptor);
const fs =
\\ [[stage(fragment)]] fn main() -> [[location(0)]] vec4<f32> {
\\ return vec4<f32>(1.0, 0.0, 0.0, 1.0);
\\ }
;
var fs_wgsl_descriptor = try allocator.create(c.WGPUShaderModuleWGSLDescriptor);
fs_wgsl_descriptor.chain.next = null;
fs_wgsl_descriptor.chain.sType = c.WGPUSType_ShaderModuleWGSLDescriptor;
fs_wgsl_descriptor.source = fs;
const fs_shader_descriptor = c.WGPUShaderModuleDescriptor{
.nextInChain = @ptrCast(*const c.WGPUChainedStruct, fs_wgsl_descriptor),
.label = "my fragment shader",
};
const fs_module = c.wgpuDeviceCreateShaderModule(setup.device, &fs_shader_descriptor);
// Fragment state
var blend = std.mem.zeroes(c.WGPUBlendState);
blend.color.operation = c.WGPUBlendOperation_Add;
blend.color.srcFactor = c.WGPUBlendFactor_One;
blend.color.dstFactor = c.WGPUBlendFactor_One;
blend.alpha.operation = c.WGPUBlendOperation_Add;
blend.alpha.srcFactor = c.WGPUBlendFactor_One;
blend.alpha.dstFactor = c.WGPUBlendFactor_One;
var color_target = std.mem.zeroes(c.WGPUColorTargetState);
color_target.format = swap_chain_format;
color_target.blend = &blend;
color_target.writeMask = c.WGPUColorWriteMask_All;
var fragment = std.mem.zeroes(c.WGPUFragmentState);
fragment.module = fs_module;
fragment.entryPoint = "main";
fragment.targetCount = 1;
fragment.targets = &color_target;
var pipeline_descriptor = std.mem.zeroes(c.WGPURenderPipelineDescriptor);
pipeline_descriptor.fragment = &fragment;
// Other state
pipeline_descriptor.layout = null;
pipeline_descriptor.depthStencil = null;
pipeline_descriptor.vertex.module = vs_module;
pipeline_descriptor.vertex.entryPoint = "main";
pipeline_descriptor.vertex.bufferCount = 0;
pipeline_descriptor.vertex.buffers = null;
pipeline_descriptor.multisample.count = 1;
pipeline_descriptor.multisample.mask = 0xFFFFFFFF;
pipeline_descriptor.multisample.alphaToCoverageEnabled = false;
pipeline_descriptor.primitive.frontFace = c.WGPUFrontFace_CCW;
pipeline_descriptor.primitive.cullMode = c.WGPUCullMode_None;
pipeline_descriptor.primitive.topology = c.WGPUPrimitiveTopology_TriangleList;
pipeline_descriptor.primitive.stripIndexFormat = c.WGPUIndexFormat_Undefined;
const pipeline = c.wgpuDeviceCreateRenderPipeline(setup.device, &pipeline_descriptor);
c.wgpuShaderModuleRelease(vs_module);
c.wgpuShaderModuleRelease(fs_module);
// Reconfigure the swap chain with the new framebuffer width/height, otherwise e.g. the Vulkan
// device would be lost after a resize.
const CallbackPayload = struct {
swap_chain: c.WGPUSwapChain,
swap_chain_format: c.WGPUTextureFormat,
};
setup.window.setUserPointer(CallbackPayload, &.{ .swap_chain = swap_chain, .swap_chain_format = swap_chain_format });
setup.window.setFramebufferSizeCallback((struct {
fn callback(window: glfw.Window, width: u32, height: u32) void {
const pl = window.getUserPointer(*CallbackPayload);
c.wgpuSwapChainConfigure(pl.?.swap_chain, pl.?.swap_chain_format, c.WGPUTextureUsage_RenderAttachment, @intCast(u32, width), @intCast(u32, height));
}
}).callback);
while (!setup.window.shouldClose()) {
try frame(.{
.device = setup.device,
.swap_chain = swap_chain,
.pipeline = pipeline,
.queue = queue,
});
std.time.sleep(16 * std.time.ns_per_ms);
}
}
const FrameParams = struct {
device: c.WGPUDevice,
swap_chain: c.WGPUSwapChain,
pipeline: c.WGPURenderPipeline,
queue: c.WGPUQueue,
};
fn frame(params: FrameParams) !void {
const back_buffer_view = c.wgpuSwapChainGetCurrentTextureView(params.swap_chain);
var render_pass_info = std.mem.zeroes(c.WGPURenderPassDescriptor);
var color_attachment = std.mem.zeroes(c.WGPURenderPassColorAttachment);
color_attachment.view = back_buffer_view;
color_attachment.resolveTarget = null;
color_attachment.clearColor = c.WGPUColor{ .r = 0.0, .g = 0.0, .b = 0.0, .a = 0.0 };
color_attachment.loadOp = c.WGPULoadOp_Clear;
color_attachment.storeOp = c.WGPUStoreOp_Store;
render_pass_info.colorAttachmentCount = 1;
render_pass_info.colorAttachments = &color_attachment;
render_pass_info.depthStencilAttachment = null;
const encoder = c.wgpuDeviceCreateCommandEncoder(params.device, null);
const pass = c.wgpuCommandEncoderBeginRenderPass(encoder, &render_pass_info);
c.wgpuRenderPassEncoderSetPipeline(pass, params.pipeline);
c.wgpuRenderPassEncoderDraw(pass, 3, 1, 0, 0);
c.wgpuRenderPassEncoderEndPass(pass);
c.wgpuRenderPassEncoderRelease(pass);
const commands = c.wgpuCommandEncoderFinish(encoder, null);
c.wgpuCommandEncoderRelease(encoder);
c.wgpuQueueSubmit(params.queue, 1, &commands);
c.wgpuCommandBufferRelease(commands);
c.wgpuSwapChainPresent(params.swap_chain);
c.wgpuTextureViewRelease(back_buffer_view);
// if (cmdBufType == CmdBufType::Terrible) {
// bool c2sSuccess = c2sBuf->Flush();
// bool s2cSuccess = s2cBuf->Flush();
// ASSERT(c2sSuccess && s2cSuccess);
// }
try glfw.pollEvents();
}

View file

@ -0,0 +1,282 @@
const std = @import("std");
const assert = std.debug.assert;
const glfw = @import("glfw");
const c = @import("c.zig").c;
// #include "SampleUtils.h"
// #include "common/Assert.h"
// #include "common/Log.h"
// #include "common/Platform.h"
// #include "common/SystemUtils.h"
// #include "utils/BackendBinding.h"
// #include "utils/GLFWUtils.h"
// #include "utils/TerribleCommandBuffer.h"
// #include <dawn/dawn_proc.h>
// #include <dawn/dawn_wsi.h>
// #include <dawn_native/DawnNative.h>
// #include <dawn_wire/WireClient.h>
// #include <dawn_wire/WireServer.h>
// #include "GLFW/glfw3.h"
// #include <algorithm>
// #include <cstring>
fn printDeviceError(error_type: c.WGPUErrorType, message: [*c]const u8, _: ?*anyopaque) callconv(.C) void {
switch (error_type) {
c.WGPUErrorType_Validation => std.debug.print("dawn: validation error: {s}\n", .{message}),
c.WGPUErrorType_OutOfMemory => std.debug.print("dawn: out of memory: {s}\n", .{message}),
c.WGPUErrorType_Unknown => std.debug.print("dawn: unknown error: {s}\n", .{message}),
c.WGPUErrorType_DeviceLost => std.debug.print("dawn: device lost: {s}\n", .{message}),
else => unreachable,
}
}
const CmdBufType = enum { none, terrible };
// static std::unique_ptr<dawn_native::Instance> instance;
// static utils::BackendBinding* binding = nullptr;
// static GLFWwindow* window = nullptr;
// static dawn_wire::WireServer* wireServer = nullptr;
// static dawn_wire::WireClient* wireClient = nullptr;
// static utils::TerribleCommandBuffer* c2sBuf = nullptr;
// static utils::TerribleCommandBuffer* s2cBuf = nullptr;
const Setup = struct {
device: c.WGPUDevice,
binding: c.MachUtilsBackendBinding,
window: glfw.Window,
};
fn detectBackendType() c.WGPUBackendType {
if (std.os.getenv("WGPU_BACKEND")) |backend| {
if (std.ascii.eqlIgnoreCase(backend, "opengl")) return c.WGPUBackendType_OpenGL;
if (std.ascii.eqlIgnoreCase(backend, "opengles")) return c.WGPUBackendType_OpenGLES;
if (std.ascii.eqlIgnoreCase(backend, "d3d11")) return c.WGPUBackendType_D3D11;
if (std.ascii.eqlIgnoreCase(backend, "d3d12")) return c.WGPUBackendType_D3D12;
if (std.ascii.eqlIgnoreCase(backend, "metal")) return c.WGPUBackendType_Metal;
if (std.ascii.eqlIgnoreCase(backend, "null")) return c.WGPUBackendType_Null;
if (std.ascii.eqlIgnoreCase(backend, "vulkan")) return c.WGPUBackendType_Vulkan;
@panic("unknown BACKEND type");
}
const target = @import("builtin").target;
if (target.isDarwin()) return c.WGPUBackendType_Metal;
if (target.os.tag == .windows) return c.WGPUBackendType_D3D12;
return c.WGPUBackendType_Vulkan;
}
fn backendTypeString(t: c.WGPUBackendType) []const u8 {
return switch (t) {
c.WGPUBackendType_OpenGL => "OpenGL",
c.WGPUBackendType_OpenGLES => "OpenGLES",
c.WGPUBackendType_D3D11 => "D3D11",
c.WGPUBackendType_D3D12 => "D3D12",
c.WGPUBackendType_Metal => "Metal",
c.WGPUBackendType_Null => "Null",
c.WGPUBackendType_Vulkan => "Vulkan",
else => unreachable,
};
}
pub fn setup() !Setup {
const backend_type = detectBackendType();
const cmd_buf_type = CmdBufType.none;
try glfw.init(.{});
// Create the test window and discover adapters using it (esp. for OpenGL)
var hints = glfwWindowHintsForBackend(backend_type);
hints.cocoa_retina_framebuffer = false;
const window = try glfw.Window.create(640, 480, "Dawn window", null, null, hints);
const instance = c.machDawnNativeInstance_init();
try discoverAdapter(instance, window, backend_type);
const adapters = c.machDawnNativeInstance_getAdapters(instance);
var backend_adapter: ?c.MachDawnNativeAdapter = null;
var i: usize = 0;
while (i < c.machDawnNativeAdapters_length(adapters)) : (i += 1) {
const adapter = c.machDawnNativeAdapters_index(adapters, i);
const properties = c.machDawnNativeAdapter_getProperties(adapter);
if (c.machDawnNativeAdapterProperties_getBackendType(properties) == backend_type) {
const name = c.machDawnNativeAdapterProperties_getName(properties);
const driver_description = c.machDawnNativeAdapterProperties_getDriverDescription(properties);
std.debug.print("found {s} adapter: {s}, {s}\n", .{ backendTypeString(backend_type), name, driver_description });
backend_adapter = adapter;
}
}
assert(backend_adapter != null);
const backend_device = c.machDawnNativeAdapter_createDevice(backend_adapter.?, null);
const backend_procs = c.machDawnNativeGetProcs();
const binding = c.machUtilsCreateBinding(backend_type, @ptrCast(*c.GLFWwindow, window.handle), backend_device);
if (binding == null) {
@panic("failed to create binding");
}
// Choose whether to use the backend procs and devices directly, or set up the wire.
var procs: ?*const c.DawnProcTable = null;
var c_device: ?c.WGPUDevice = null;
switch (cmd_buf_type) {
CmdBufType.none => {
procs = backend_procs;
c_device = backend_device;
},
CmdBufType.terrible => {
// TODO(slimsag):
@panic("not implemented");
// c2sBuf = new utils::TerribleCommandBuffer();
// s2cBuf = new utils::TerribleCommandBuffer();
// dawn_wire::WireServerDescriptor serverDesc = {};
// serverDesc.procs = &backendProcs;
// serverDesc.serializer = s2cBuf;
// wireServer = new dawn_wire::WireServer(serverDesc);
// c2sBuf->SetHandler(wireServer);
// dawn_wire::WireClientDescriptor clientDesc = {};
// clientDesc.serializer = c2sBuf;
// wireClient = new dawn_wire::WireClient(clientDesc);
// procs = dawn_wire::client::GetProcs();
// s2cBuf->SetHandler(wireClient);
// auto deviceReservation = wireClient->ReserveDevice();
// wireServer->InjectDevice(backendDevice, deviceReservation.id,
// deviceReservation.generation);
// cDevice = deviceReservation.device;
},
}
c.dawnProcSetProcs(procs.?);
procs.?.deviceSetUncapturedErrorCallback.?(c_device.?, printDeviceError, null);
return Setup{
.device = c_device.?,
.binding = binding,
.window = window,
};
}
fn glfwWindowHintsForBackend(backend: c.WGPUBackendType) glfw.Window.Hints {
return switch (backend) {
c.WGPUBackendType_OpenGL => .{
// Ask for OpenGL 4.4 which is what the GL backend requires for compute shaders and
// texture views.
.context_version_major = 4,
.context_version_minor = 4,
.opengl_forward_compat = true,
.opengl_profile = .opengl_core_profile,
},
c.WGPUBackendType_OpenGLES => .{
.context_version_major = 3,
.context_version_minor = 1,
.client_api = .opengl_es_api,
.context_creation_api = .egl_context_api,
},
else => .{
// Without this GLFW will initialize a GL context on the window, which prevents using
// the window with other APIs (by crashing in weird ways).
.client_api = .no_api,
},
};
}
fn discoverAdapter(instance: c.MachDawnNativeInstance, window: glfw.Window, typ: c.WGPUBackendType) !void {
if (typ == c.WGPUBackendType_OpenGL) {
try glfw.makeContextCurrent(window);
const adapter_options = c.MachDawnNativeAdapterDiscoveryOptions_OpenGL{
.getProc = @ptrCast(fn ([*c]const u8) callconv(.C) ?*anyopaque, glfw.getProcAddress),
};
_ = c.machDawnNativeInstance_discoverAdapters(instance, typ, &adapter_options);
} else if (typ == c.WGPUBackendType_OpenGLES) {
try glfw.makeContextCurrent(window);
const adapter_options = c.MachDawnNativeAdapterDiscoveryOptions_OpenGLES{
.getProc = @ptrCast(fn ([*c]const u8) callconv(.C) ?*anyopaque, glfw.getProcAddress),
};
_ = c.machDawnNativeInstance_discoverAdapters(instance, typ, &adapter_options);
} else {
c.machDawnNativeInstance_discoverDefaultAdapters(instance);
}
}
// wgpu::TextureFormat GetPreferredSwapChainTextureFormat() {
// DoFlush();
// return static_cast<wgpu::TextureFormat>(binding->GetPreferredSwapChainTextureFormat());
// }
// wgpu::TextureView CreateDefaultDepthStencilView(const wgpu::Device& device) {
// wgpu::TextureDescriptor descriptor;
// descriptor.dimension = wgpu::TextureDimension::e2D;
// descriptor.size.width = 640;
// descriptor.size.height = 480;
// descriptor.size.depthOrArrayLayers = 1;
// descriptor.sampleCount = 1;
// descriptor.format = wgpu::TextureFormat::Depth24PlusStencil8;
// descriptor.mipLevelCount = 1;
// descriptor.usage = wgpu::TextureUsage::RenderAttachment;
// auto depthStencilTexture = device.CreateTexture(&descriptor);
// return depthStencilTexture.CreateView();
// }
// bool InitSample(int argc, const char** argv) {
// for (int i = 1; i < argc; i++) {
// if (std::string("-b") == argv[i] || std::string("--backend") == argv[i]) {
// i++;
// if (i < argc && std::string("d3d12") == argv[i]) {
// backendType = wgpu::BackendType::D3D12;
// continue;
// }
// if (i < argc && std::string("metal") == argv[i]) {
// backendType = wgpu::BackendType::Metal;
// continue;
// }
// if (i < argc && std::string("null") == argv[i]) {
// backendType = wgpu::BackendType::Null;
// continue;
// }
// if (i < argc && std::string("opengl") == argv[i]) {
// backendType = wgpu::BackendType::OpenGL;
// continue;
// }
// if (i < argc && std::string("opengles") == argv[i]) {
// backendType = wgpu::BackendType::OpenGLES;
// continue;
// }
// if (i < argc && std::string("vulkan") == argv[i]) {
// backendType = wgpu::BackendType::Vulkan;
// continue;
// }
// fprintf(stderr,
// "--backend expects a backend name (opengl, opengles, metal, d3d12, null, "
// "vulkan)\n");
// return false;
// }
// if (std::string("-c") == argv[i] || std::string("--command-buffer") == argv[i]) {
// i++;
// if (i < argc && std::string("none") == argv[i]) {
// cmdBufType = CmdBufType::None;
// continue;
// }
// if (i < argc && std::string("terrible") == argv[i]) {
// cmdBufType = CmdBufType::Terrible;
// continue;
// }
// fprintf(stderr, "--command-buffer expects a command buffer name (none, terrible)\n");
// return false;
// }
// if (std::string("-h") == argv[i] || std::string("--help") == argv[i]) {
// printf("Usage: %s [-b BACKEND] [-c COMMAND_BUFFER]\n", argv[0]);
// printf(" BACKEND is one of: d3d12, metal, null, opengl, opengles, vulkan\n");
// printf(" COMMAND_BUFFER is one of: none, terrible\n");
// return false;
// }
// }
// return true;
// }

View file

@ -0,0 +1,114 @@
#include "third_party/abseil-cpp/absl/strings/match.cc"
#include "third_party/abseil-cpp/absl/strings/internal/charconv_bigint.cc"
#include "third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_reader.cc"
#include "third_party/abseil-cpp/absl/strings/internal/cordz_info.cc"
#include "third_party/abseil-cpp/absl/strings/internal/cord_internal.cc"
#include "third_party/abseil-cpp/absl/strings/internal/cordz_sample_token.cc"
#include "third_party/abseil-cpp/absl/strings/internal/cord_rep_consume.cc"
#include "third_party/abseil-cpp/absl/strings/internal/charconv_parse.cc"
#include "third_party/abseil-cpp/absl/strings/internal/str_format/arg.cc"
#include "third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc"
#include "third_party/abseil-cpp/absl/strings/internal/str_format/output.cc"
#include "third_party/abseil-cpp/absl/strings/internal/str_format/bind.cc"
#include "third_party/abseil-cpp/absl/strings/internal/str_format/parser.cc"
#include "third_party/abseil-cpp/absl/strings/internal/str_format/extension.cc"
#include "third_party/abseil-cpp/absl/strings/internal/cord_rep_ring.cc"
#include "third_party/abseil-cpp/absl/strings/internal/cordz_handle.cc"
#include "third_party/abseil-cpp/absl/strings/internal/memutil.cc"
#include "third_party/abseil-cpp/absl/strings/internal/ostringstream.cc"
#include "third_party/abseil-cpp/absl/strings/internal/pow10_helper.cc"
#include "third_party/abseil-cpp/absl/strings/internal/utf8.cc"
#include "third_party/abseil-cpp/absl/strings/internal/cordz_functions.cc"
#include "third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.cc"
#include "third_party/abseil-cpp/absl/strings/internal/escaping.cc"
#include "third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.cc"
#include "third_party/abseil-cpp/absl/strings/string_view.cc"
#include "third_party/abseil-cpp/absl/strings/str_cat.cc"
#include "third_party/abseil-cpp/absl/strings/cord.cc"
#include "third_party/abseil-cpp/absl/strings/ascii.cc"
#include "third_party/abseil-cpp/absl/strings/charconv.cc"
#include "third_party/abseil-cpp/absl/strings/str_split.cc"
#include "third_party/abseil-cpp/absl/strings/substitute.cc"
#include "third_party/abseil-cpp/absl/strings/escaping.cc"
#include "third_party/abseil-cpp/absl/strings/str_replace.cc"
#include "third_party/abseil-cpp/absl/types/bad_any_cast.cc"
#include "third_party/abseil-cpp/absl/types/bad_optional_access.cc"
#include "third_party/abseil-cpp/absl/types/bad_variant_access.cc"
#include "third_party/abseil-cpp/absl/flags/parse.cc"
#include "third_party/abseil-cpp/absl/flags/usage.cc"
#include "third_party/abseil-cpp/absl/flags/internal/private_handle_accessor.cc"
#include "third_party/abseil-cpp/absl/flags/internal/usage.cc"
#include "third_party/abseil-cpp/absl/flags/internal/program_name.cc"
#include "third_party/abseil-cpp/absl/flags/internal/flag.cc"
#include "third_party/abseil-cpp/absl/flags/internal/commandlineflag.cc"
#include "third_party/abseil-cpp/absl/flags/reflection.cc"
#include "third_party/abseil-cpp/absl/flags/usage_config.cc"
#include "third_party/abseil-cpp/absl/flags/flag.cc"
#include "third_party/abseil-cpp/absl/flags/marshalling.cc"
#include "third_party/abseil-cpp/absl/flags/commandlineflag.cc"
#include "third_party/abseil-cpp/absl/synchronization/blocking_counter.cc"
#include "third_party/abseil-cpp/absl/synchronization/mutex.cc"
#include "third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.cc"
#include "third_party/abseil-cpp/absl/synchronization/internal/create_thread_identity.cc"
#include "third_party/abseil-cpp/absl/synchronization/internal/waiter.cc"
#include "third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc"
#include "third_party/abseil-cpp/absl/synchronization/barrier.cc"
#include "third_party/abseil-cpp/absl/synchronization/notification.cc"
#include "third_party/abseil-cpp/absl/hash/internal/low_level_hash.cc"
#include "third_party/abseil-cpp/absl/hash/internal/hash.cc"
#include "third_party/abseil-cpp/absl/hash/internal/city.cc"
#include "third_party/abseil-cpp/absl/debugging/symbolize.cc"
#include "third_party/abseil-cpp/absl/debugging/failure_signal_handler.cc"
#include "third_party/abseil-cpp/absl/debugging/leak_check_disable.cc"
#include "third_party/abseil-cpp/absl/debugging/internal/examine_stack.cc"
#include "third_party/abseil-cpp/absl/debugging/internal/vdso_support.cc"
#include "third_party/abseil-cpp/absl/debugging/internal/stack_consumption.cc"
#include "third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc"
#include "third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.cc"
#include "third_party/abseil-cpp/absl/debugging/internal/demangle.cc"
#include "third_party/abseil-cpp/absl/debugging/leak_check.cc"
#include "third_party/abseil-cpp/absl/debugging/stacktrace.cc"
#include "third_party/abseil-cpp/absl/status/status_payload_printer.cc"
#include "third_party/abseil-cpp/absl/status/status.cc"
#include "third_party/abseil-cpp/absl/status/statusor.cc"
#include "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc"
#include "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.cc"
#include "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc"
#include "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc"
#include "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.cc"
#include "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.cc"
#include "third_party/abseil-cpp/absl/time/internal/cctz/src/zone_info_source.cc"
#include "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc"
#include "third_party/abseil-cpp/absl/time/internal/cctz/src/civil_time_detail.cc"
#include "third_party/abseil-cpp/absl/time/clock.cc"
#include "third_party/abseil-cpp/absl/time/duration.cc"
#include "third_party/abseil-cpp/absl/time/civil_time.cc"
#include "third_party/abseil-cpp/absl/time/time.cc"
#include "third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc"
#include "third_party/abseil-cpp/absl/container/internal/hashtablez_sampler_force_weak_definition.cc"
#include "third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc"
#include "third_party/abseil-cpp/absl/numeric/int128.cc"
#include "third_party/abseil-cpp/absl/random/gaussian_distribution.cc"
#include "third_party/abseil-cpp/absl/random/discrete_distribution.cc"
#include "third_party/abseil-cpp/absl/random/seed_gen_exception.cc"
#include "third_party/abseil-cpp/absl/random/internal/seed_material.cc"
#include "third_party/abseil-cpp/absl/random/internal/randen_slow.cc"
#include "third_party/abseil-cpp/absl/random/internal/randen.cc"
#include "third_party/abseil-cpp/absl/random/internal/randen_detect.cc"
#include "third_party/abseil-cpp/absl/random/internal/randen_round_keys.cc"
#include "third_party/abseil-cpp/absl/random/internal/pool_urbg.cc"
#include "third_party/abseil-cpp/absl/random/seed_sequences.cc"
#include "third_party/abseil-cpp/absl/base/internal/spinlock_wait.cc"
#include "third_party/abseil-cpp/absl/base/internal/periodic_sampler.cc"
#include "third_party/abseil-cpp/absl/base/internal/cycleclock.cc"
#include "third_party/abseil-cpp/absl/base/internal/spinlock.cc"
#include "third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.cc"
#include "third_party/abseil-cpp/absl/base/internal/scoped_set_env.cc"
#include "third_party/abseil-cpp/absl/base/internal/sysinfo.cc"
#include "third_party/abseil-cpp/absl/base/internal/raw_logging.cc"
#include "third_party/abseil-cpp/absl/base/internal/throw_delegate.cc"
#include "third_party/abseil-cpp/absl/base/internal/strerror.cc"
#include "third_party/abseil-cpp/absl/base/internal/thread_identity.cc"
#include "third_party/abseil-cpp/absl/base/internal/exponential_biased.cc"
#include "third_party/abseil-cpp/absl/base/internal/low_level_alloc.cc"
#include "third_party/abseil-cpp/absl/base/log_severity.cc"

View file

@ -0,0 +1,72 @@
#include "out/Debug/gen/src/dawn/dawn_thread_dispatch_proc.cpp"
#include "out/Debug/gen/src/dawn/webgpu_cpp.cpp"
#include "src/dawn_native/Adapter.cpp"
#include "src/dawn_native/AsyncTask.cpp"
#include "src/dawn_native/AttachmentState.cpp"
#include "src/dawn_native/BackendConnection.cpp"
#include "src/dawn_native/BindGroup.cpp"
#include "src/dawn_native/BindGroupLayout.cpp"
#include "src/dawn_native/BindingInfo.cpp"
#include "src/dawn_native/BuddyAllocator.cpp"
#include "src/dawn_native/BuddyMemoryAllocator.cpp"
#include "src/dawn_native/Buffer.cpp"
#include "src/dawn_native/CachedObject.cpp"
#include "src/dawn_native/CallbackTaskManager.cpp"
#include "src/dawn_native/CommandAllocator.cpp"
#include "src/dawn_native/CommandBuffer.cpp"
#include "src/dawn_native/CommandBufferStateTracker.cpp"
#include "src/dawn_native/CommandEncoder.cpp"
#include "src/dawn_native/CommandValidation.cpp"
#include "src/dawn_native/Commands.cpp"
#include "src/dawn_native/CompilationMessages.cpp"
#include "src/dawn_native/ComputePassEncoder.cpp"
#include "src/dawn_native/ComputePipeline.cpp"
#include "src/dawn_native/CopyTextureForBrowserHelper.cpp"
#include "src/dawn_native/CreatePipelineAsyncTask.cpp"
#include "src/dawn_native/Device.cpp"
#include "src/dawn_native/DynamicUploader.cpp"
#include "src/dawn_native/EncodingContext.cpp"
#include "src/dawn_native/Error.cpp"
#include "src/dawn_native/ErrorData.cpp"
#include "src/dawn_native/ErrorInjector.cpp"
#include "src/dawn_native/ErrorScope.cpp"
#include "src/dawn_native/ExternalTexture.cpp"
#include "src/dawn_native/Features.cpp"
#include "src/dawn_native/Format.cpp"
#include "src/dawn_native/IndirectDrawMetadata.cpp"
#include "src/dawn_native/IndirectDrawValidationEncoder.cpp"
#include "src/dawn_native/Instance.cpp"
#include "src/dawn_native/InternalPipelineStore.cpp"
#include "src/dawn_native/Limits.cpp"
#include "src/dawn_native/ObjectBase.cpp"
#include "src/dawn_native/ObjectContentHasher.cpp"
#include "src/dawn_native/PassResourceUsageTracker.cpp"
#include "src/dawn_native/PerStage.cpp"
#include "src/dawn_native/PersistentCache.cpp"
#include "src/dawn_native/Pipeline.cpp"
#include "src/dawn_native/PipelineLayout.cpp"
#include "src/dawn_native/PooledResourceMemoryAllocator.cpp"
#include "src/dawn_native/ProgrammableEncoder.cpp"
#include "src/dawn_native/QueryHelper.cpp"
#include "src/dawn_native/QuerySet.cpp"
#include "src/dawn_native/Queue.cpp"
#include "src/dawn_native/RenderBundle.cpp"
#include "src/dawn_native/RenderBundleEncoder.cpp"
#include "src/dawn_native/RenderEncoderBase.cpp"
#include "src/dawn_native/RenderPassEncoder.cpp"
#include "src/dawn_native/RenderPipeline.cpp"
#include "src/dawn_native/ResourceMemoryAllocation.cpp"
#include "src/dawn_native/RingBufferAllocator.cpp"
#include "src/dawn_native/Sampler.cpp"
#include "src/dawn_native/ScratchBuffer.cpp"
#include "src/dawn_native/ShaderModule.cpp"
#include "src/dawn_native/StagingBuffer.cpp"
#include "src/dawn_native/Subresource.cpp"
#include "src/dawn_native/Surface.cpp"
#include "src/dawn_native/SwapChain.cpp"
#include "src/dawn_native/Texture.cpp"
#include "src/dawn_native/TintUtils.cpp"
#include "src/dawn_native/Toggles.cpp"
#include "src/dawn_native/VertexFormat.cpp"
#include "src/dawn_native/utils/WGPUHelpers.cpp"

View file

@ -0,0 +1,19 @@
#include "src/dawn_native/metal/MetalBackend.mm"
#include "src/dawn_native/Surface_metal.mm"
#include "src/dawn_native/metal/BindGroupLayoutMTL.mm"
#include "src/dawn_native/metal/BindGroupMTL.mm"
#include "src/dawn_native/metal/BufferMTL.mm"
#include "src/dawn_native/metal/CommandBufferMTL.mm"
#include "src/dawn_native/metal/CommandRecordingContext.mm"
#include "src/dawn_native/metal/ComputePipelineMTL.mm"
#include "src/dawn_native/metal/DeviceMTL.mm"
#include "src/dawn_native/metal/PipelineLayoutMTL.mm"
#include "src/dawn_native/metal/QuerySetMTL.mm"
#include "src/dawn_native/metal/QueueMTL.mm"
#include "src/dawn_native/metal/RenderPipelineMTL.mm"
#include "src/dawn_native/metal/SamplerMTL.mm"
#include "src/dawn_native/metal/ShaderModuleMTL.mm"
#include "src/dawn_native/metal/StagingBufferMTL.mm"
#include "src/dawn_native/metal/SwapChainMTL.mm"
#include "src/dawn_native/metal/TextureMTL.mm"
#include "src/dawn_native/metal/UtilsMetal.mm"

View file

@ -0,0 +1,6 @@
#include "out/Debug/gen/src/dawn_native/ChainUtils_autogen.cpp"
#include "out/Debug/gen/src/dawn_native/ProcTable.cpp"
#include "out/Debug/gen/src/dawn_native/wgpu_structs_autogen.cpp"
#include "out/Debug/gen/src/dawn_native/ValidationUtils_autogen.cpp"
#include "out/Debug/gen/src/dawn_native/webgpu_absl_format_autogen.cpp"
#include "out/Debug/gen/src/dawn_native/ObjectType_autogen.cpp"

View file

@ -0,0 +1,31 @@
#include "out/Debug/gen/src/dawn_wire/WireCmd_autogen.cpp"
#include "out/Debug/gen/src/dawn_wire/client/ApiProcs_autogen.cpp"
#include "out/Debug/gen/src/dawn_wire/client/ClientHandlers_autogen.cpp"
#include "out/Debug/gen/src/dawn_wire/server/ServerDoers_autogen.cpp"
#include "out/Debug/gen/src/dawn_wire/server/ServerHandlers_autogen.cpp"
#include "src/dawn_wire/ChunkedCommandHandler.cpp"
#include "src/dawn_wire/ChunkedCommandSerializer.cpp"
#include "src/dawn_wire/SupportedFeatures.cpp"
#include "src/dawn_wire/Wire.cpp"
#include "src/dawn_wire/WireClient.cpp"
#include "src/dawn_wire/WireDeserializeAllocator.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/Client.cpp"
#include "src/dawn_wire/client/ClientDoers.cpp"
#include "src/dawn_wire/client/ClientInlineMemoryTransferService.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/ShaderModule.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/ServerDevice.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/ServerShaderModule.cpp"

View file

@ -0,0 +1,9 @@
#include "third_party/vulkan-deps/spirv-cross/src/spirv_cfg.cpp"
#include "third_party/vulkan-deps/spirv-cross/src/spirv_cross.cpp"
#include "third_party/vulkan-deps/spirv-cross/src/spirv_cross_parsed_ir.cpp"
#include "third_party/vulkan-deps/spirv-cross/src/spirv_cross_util.cpp"
#include "third_party/vulkan-deps/spirv-cross/src/spirv_glsl.cpp"
#include "third_party/vulkan-deps/spirv-cross/src/spirv_hlsl.cpp"
#include "third_party/vulkan-deps/spirv-cross/src/spirv_msl.cpp"
#include "third_party/vulkan-deps/spirv-cross/src/spirv_parser.cpp"
#include "third_party/vulkan-deps/spirv-cross/src/spirv_reflect.cpp"

View file

@ -0,0 +1,24 @@
#include "third_party/vulkan-deps/spirv-tools/src/source/assembly_grammar.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/binary.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/diagnostic.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/disassemble.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/enum_string_mapping.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/ext_inst.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/extensions.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/libspirv.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/name_mapper.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opcode.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/parsed_operand.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/print.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/spirv_endian.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/spirv_fuzzer_options.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/spirv_optimizer_options.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/spirv_target_env.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/spirv_validator_options.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/table.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/text.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/text_handler.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/util/bit_vector.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/util/parse_number.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/util/string_utils.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/util/timer.cpp"

View file

@ -0,0 +1,89 @@
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/aggressive_dead_code_elim_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/amd_ext_to_khr.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/block_merge_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/block_merge_util.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/build_module.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/ccp_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/cfg.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/cfg_cleanup_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/code_sink.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/combine_access_chains.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/compact_ids_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/composite.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/const_folding_rules.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/constants.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/control_dependence.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/convert_to_sampled_image_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/convert_to_half_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/dataflow.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/dead_branch_elim_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/dead_insert_elim_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/dead_variable_elimination.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/debug_info_manager.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/decoration_manager.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/def_use_manager.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/desc_sroa.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/dominator_analysis.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/dominator_tree.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/eliminate_dead_constant_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/eliminate_dead_functions_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/eliminate_dead_functions_util.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/eliminate_dead_members_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/feature_manager.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/fix_storage_class.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/flatten_decoration_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/fold.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/fold_spec_constant_op_and_composite_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/freeze_spec_constant_value_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/function.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/graphics_robust_access_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/if_conversion.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/inline_exhaustive_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/inline_opaque_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/inline_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/inst_bindless_check_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/inst_buff_addr_check_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/inst_debug_printf_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/instruction.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/instruction_list.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/instrument_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/interp_fixup_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/ir_loader.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/licm_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/local_redundancy_elimination.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/local_single_block_elim_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/loop_dependence.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/loop_dependence_helpers.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/loop_descriptor.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/loop_fission.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/loop_fusion.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/loop_fusion_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/loop_peeling.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/loop_unroller.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/loop_utils.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/merge_return_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/module.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/optimizer.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/pass_manager.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/private_to_local_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/propagator.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/reduce_load_size.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/redundancy_elimination.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/register_pressure.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/relax_float_ops_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/remove_duplicates_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/replace_invalid_opc.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/scalar_analysis.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/scalar_analysis_simplification.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/simplification_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/strength_reduction_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/strip_debug_info_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/strip_reflect_info_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/struct_cfg_analysis.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/type_manager.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/types.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/unify_const_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/upgrade_memory_model.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/value_number_table.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/workaround1209.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/wrap_opkill.cpp"

View file

@ -0,0 +1,9 @@
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/basic_block.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/copy_prop_arrays.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/folding_rules.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/ir_context.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/local_access_chain_convert_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/remove_unused_interface_variables_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/scalar_replacement_pass.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/opt/set_spec_constant_default_value_pass.cpp"

View file

@ -0,0 +1,40 @@
#include "third_party/vulkan-deps/spirv-tools/src/source/val/basic_block.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/construct.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/function.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/instruction.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate_adjacency.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate_annotation.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate_arithmetics.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate_atomics.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate_barriers.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate_bitwise.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate_builtins.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate_capability.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate_cfg.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate_composites.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate_constants.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate_conversion.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate_debug.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate_decorations.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate_derivatives.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate_execution_limitations.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate_extensions.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate_function.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate_id.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate_image.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate_instruction.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate_interfaces.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate_layout.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate_literals.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate_logicals.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate_memory.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate_memory_semantics.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate_misc.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate_mode_setting.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate_non_uniform.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate_primitives.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate_scopes.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate_small_type_uses.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validate_type.cpp"
#include "third_party/vulkan-deps/spirv-tools/src/source/val/validation_state.cpp"

View file

@ -0,0 +1,132 @@
#include "third_party/tint/src/ast/access.cc"
#include "third_party/tint/src/ast/alias.cc"
#include "third_party/tint/src/ast/array.cc"
#include "third_party/tint/src/ast/assignment_statement.cc"
#include "third_party/tint/src/ast/atomic.cc"
#include "third_party/tint/src/ast/binary_expression.cc"
#include "third_party/tint/src/ast/binding_decoration.cc"
#include "third_party/tint/src/ast/bitcast_expression.cc"
#include "third_party/tint/src/ast/block_statement.cc"
#include "third_party/tint/src/ast/bool.cc"
#include "third_party/tint/src/ast/bool_literal_expression.cc"
#include "third_party/tint/src/ast/break_statement.cc"
#include "third_party/tint/src/ast/builtin.cc"
#include "third_party/tint/src/ast/builtin_decoration.cc"
#include "third_party/tint/src/ast/call_expression.cc"
#include "third_party/tint/src/ast/call_statement.cc"
#include "third_party/tint/src/ast/case_statement.cc"
#include "third_party/tint/src/ast/continue_statement.cc"
#include "third_party/tint/src/ast/depth_multisampled_texture.cc"
#include "third_party/tint/src/ast/disable_validation_decoration.cc"
#include "third_party/tint/src/ast/discard_statement.cc"
#include "third_party/tint/src/ast/else_statement.cc"
#include "third_party/tint/src/ast/external_texture.cc"
#include "third_party/tint/src/ast/f32.cc"
#include "third_party/tint/src/ast/fallthrough_statement.cc"
#include "third_party/tint/src/ast/float_literal_expression.cc"
#include "third_party/tint/src/ast/for_loop_statement.cc"
#include "third_party/tint/src/ast/function.cc"
#include "third_party/tint/src/ast/group_decoration.cc"
#include "third_party/tint/src/ast/i32.cc"
#include "third_party/tint/src/ast/identifier_expression.cc"
#include "third_party/tint/src/ast/if_statement.cc"
#include "third_party/tint/src/ast/index_accessor_expression.cc"
#include "third_party/tint/src/ast/int_literal_expression.cc"
#include "third_party/tint/src/ast/interpolate_decoration.cc"
#include "third_party/tint/src/ast/invariant_decoration.cc"
#include "third_party/tint/src/ast/location_decoration.cc"
#include "third_party/tint/src/ast/loop_statement.cc"
#include "third_party/tint/src/ast/matrix.cc"
#include "third_party/tint/src/ast/member_accessor_expression.cc"
#include "third_party/tint/src/ast/module.cc"
#include "third_party/tint/src/ast/multisampled_texture.cc"
#include "third_party/tint/src/ast/override_decoration.cc"
#include "third_party/tint/src/ast/phony_expression.cc"
#include "third_party/tint/src/ast/pipeline_stage.cc"
#include "third_party/tint/src/ast/pointer.cc"
#include "third_party/tint/src/ast/return_statement.cc"
#include "third_party/tint/src/ast/sampled_texture.cc"
#include "third_party/tint/src/ast/sampler.cc"
#include "third_party/tint/src/ast/sint_literal_expression.cc"
#include "third_party/tint/src/ast/stage_decoration.cc"
#include "third_party/tint/src/ast/storage_class.cc"
#include "third_party/tint/src/ast/storage_texture.cc"
#include "third_party/tint/src/ast/stride_decoration.cc"
#include "third_party/tint/src/ast/struct.cc"
#include "third_party/tint/src/ast/struct_block_decoration.cc"
#include "third_party/tint/src/ast/struct_member.cc"
#include "third_party/tint/src/ast/struct_member_align_decoration.cc"
#include "third_party/tint/src/ast/struct_member_offset_decoration.cc"
#include "third_party/tint/src/ast/struct_member_size_decoration.cc"
#include "third_party/tint/src/ast/switch_statement.cc"
#include "third_party/tint/src/ast/type_name.cc"
#include "third_party/tint/src/ast/u32.cc"
#include "third_party/tint/src/ast/uint_literal_expression.cc"
#include "third_party/tint/src/ast/unary_op.cc"
#include "third_party/tint/src/ast/unary_op_expression.cc"
#include "third_party/tint/src/ast/variable.cc"
#include "third_party/tint/src/ast/variable_decl_statement.cc"
#include "third_party/tint/src/ast/vector.cc"
#include "third_party/tint/src/ast/void.cc"
#include "third_party/tint/src/ast/workgroup_decoration.cc"
#include "third_party/tint/src/castable.cc"
#include "third_party/tint/src/clone_context.cc"
#include "third_party/tint/src/debug.cc"
#include "third_party/tint/src/demangler.cc"
#include "third_party/tint/src/diagnostic/diagnostic.cc"
#include "third_party/tint/src/diagnostic/formatter.cc"
#include "third_party/tint/src/diagnostic/printer.cc"
#include "third_party/tint/src/inspector/entry_point.cc"
#include "third_party/tint/src/inspector/inspector.cc"
#include "third_party/tint/src/inspector/resource_binding.cc"
#include "third_party/tint/src/inspector/scalar.cc"
#include "third_party/tint/src/intrinsic_table.cc"
#include "third_party/tint/src/program.cc"
#include "third_party/tint/src/program_builder.cc"
#include "third_party/tint/src/program_id.cc"
#include "third_party/tint/src/reader/reader.cc"
#include "third_party/tint/src/resolver/dependency_graph.cc"
#include "third_party/tint/src/resolver/resolver.cc"
#include "third_party/tint/src/resolver/resolver_constants.cc"
#include "third_party/tint/src/resolver/resolver_validation.cc"
#include "third_party/tint/src/source.cc"
#include "third_party/tint/src/symbol.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_spirv_block_decoration.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/calculate_array_length.cc"
#include "third_party/tint/src/transform/canonicalize_entry_point_io.cc"
#include "third_party/tint/src/transform/decompose_memory_access.cc"
#include "third_party/tint/src/transform/decompose_strided_matrix.cc"
#include "third_party/tint/src/transform/external_texture_transform.cc"
#include "third_party/tint/src/transform/first_index_offset.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/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/manager.cc"
#include "third_party/tint/src/transform/module_scope_var_to_entry_point_param.cc"
#include "third_party/tint/src/transform/multiplanar_external_texture.cc"
#include "third_party/tint/src/transform/num_workgroups_from_uniform.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/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/robustness.cc"
#include "third_party/tint/src/transform/simplify_pointers.cc"
#include "third_party/tint/src/transform/single_entry_point.cc"
#include "third_party/tint/src/transform/unshadow.cc"
#include "third_party/tint/src/transform/vectorize_scalar_matrix_constructors.cc"
#include "third_party/tint/src/transform/vertex_pulling.cc"
#include "third_party/tint/src/transform/wrap_arrays_in_structs.cc"
#include "third_party/tint/src/transform/zero_init_workgroup_memory.cc"
#include "third_party/tint/src/writer/append_vector.cc"
#include "third_party/tint/src/writer/array_length_from_uniform_options.cc"
#include "third_party/tint/src/writer/float_to_string.cc"
#include "third_party/tint/src/writer/text.cc"
#include "third_party/tint/src/writer/text_generator.cc"
#include "third_party/tint/src/writer/writer.cc"

View file

@ -0,0 +1,9 @@
#include "third_party/tint/src/ast/ast_type.cc"
#include "third_party/tint/src/ast/decoration.cc"
#include "third_party/tint/src/ast/depth_texture.cc"
#include "third_party/tint/src/ast/expression.cc"
#include "third_party/tint/src/ast/internal_decoration.cc"
#include "third_party/tint/src/ast/literal_expression.cc"
#include "third_party/tint/src/ast/statement.cc"
#include "third_party/tint/src/ast/type_decl.cc"
#include "third_party/tint/src/transform/transform.cc"

View file

@ -0,0 +1,37 @@
#include "third_party/tint/src/sem/array.cc"
#include "third_party/tint/src/sem/atomic_type.cc"
#include "third_party/tint/src/sem/behavior.cc"
#include "third_party/tint/src/sem/block_statement.cc"
#include "third_party/tint/src/sem/bool_type.cc"
#include "third_party/tint/src/sem/call.cc"
#include "third_party/tint/src/sem/call_target.cc"
#include "third_party/tint/src/sem/constant.cc"
#include "third_party/tint/src/sem/depth_multisampled_texture_type.cc"
#include "third_party/tint/src/sem/external_texture_type.cc"
#include "third_party/tint/src/sem/f32_type.cc"
#include "third_party/tint/src/sem/for_loop_statement.cc"
#include "third_party/tint/src/sem/function.cc"
#include "third_party/tint/src/sem/i32_type.cc"
#include "third_party/tint/src/sem/if_statement.cc"
#include "third_party/tint/src/sem/info.cc"
#include "third_party/tint/src/sem/intrinsic.cc"
#include "third_party/tint/src/sem/intrinsic_type.cc"
#include "third_party/tint/src/sem/loop_statement.cc"
#include "third_party/tint/src/sem/matrix_type.cc"
#include "third_party/tint/src/sem/member_accessor_expression.cc"
#include "third_party/tint/src/sem/multisampled_texture_type.cc"
#include "third_party/tint/src/sem/parameter_usage.cc"
#include "third_party/tint/src/sem/pointer_type.cc"
#include "third_party/tint/src/sem/reference_type.cc"
#include "third_party/tint/src/sem/sampled_texture_type.cc"
#include "third_party/tint/src/sem/sampler_type.cc"
#include "third_party/tint/src/sem/storage_texture_type.cc"
#include "third_party/tint/src/sem/struct.cc"
#include "third_party/tint/src/sem/switch_statement.cc"
#include "third_party/tint/src/sem/type_constructor.cc"
#include "third_party/tint/src/sem/type_conversion.cc"
#include "third_party/tint/src/sem/type_manager.cc"
#include "third_party/tint/src/sem/u32_type.cc"
#include "third_party/tint/src/sem/variable.cc"
#include "third_party/tint/src/sem/vector_type.cc"
#include "third_party/tint/src/sem/void_type.cc"

View file

@ -0,0 +1,4 @@
#include "third_party/tint/src/sem/depth_texture_type.cc"
#include "third_party/tint/src/sem/expression.cc"
#include "third_party/tint/src/sem/statement.cc"
#include "third_party/tint/src/sem/type.cc"

View file

@ -0,0 +1,9 @@
#include "third_party/tint/src/reader/spirv/construct.cc"
#include "third_party/tint/src/reader/spirv/entry_point_info.cc"
#include "third_party/tint/src/reader/spirv/enum_converter.cc"
#include "third_party/tint/src/reader/spirv/function.cc"
#include "third_party/tint/src/reader/spirv/namer.cc"
#include "third_party/tint/src/reader/spirv/parser.cc"
#include "third_party/tint/src/reader/spirv/parser_impl.cc"
#include "third_party/tint/src/reader/spirv/parser_type.cc"
#include "third_party/tint/src/reader/spirv/usage.cc"

View file

@ -0,0 +1,6 @@
#include "third_party/tint/src/writer/spirv/binary_writer.cc"
#include "third_party/tint/src/writer/spirv/builder.cc"
#include "third_party/tint/src/writer/spirv/function.cc"
#include "third_party/tint/src/writer/spirv/generator.cc"
#include "third_party/tint/src/writer/spirv/instruction.cc"
#include "third_party/tint/src/writer/spirv/operand.cc"

10
gpu-dawn/src/main.zig Normal file
View file

@ -0,0 +1,10 @@
const std = @import("std");
const testing = std.testing;
export fn add(a: i32, b: i32) i32 {
return a + b;
}
test "basic add functionality" {
try testing.expect(add(3, 7) == 10);
}