sysgpu: remove everything related to dawn
This commit is contained in:
parent
98801a258e
commit
539aadf664
26 changed files with 12 additions and 121 deletions
|
|
@ -1,6 +1,5 @@
|
|||
const std = @import("std");
|
||||
const testing = std.testing;
|
||||
const dawn = @import("dawn.zig");
|
||||
const Bool32 = @import("main.zig").Bool32;
|
||||
const ChainedStructOut = @import("main.zig").ChainedStructOut;
|
||||
const Device = @import("device.zig").Device;
|
||||
|
|
@ -10,6 +9,7 @@ const SupportedLimits = @import("main.zig").SupportedLimits;
|
|||
const RequestDeviceStatus = @import("main.zig").RequestDeviceStatus;
|
||||
const BackendType = @import("main.zig").BackendType;
|
||||
const RequestDeviceCallback = @import("main.zig").RequestDeviceCallback;
|
||||
const PowerPreference = @import("main.zig").PowerPreference;
|
||||
const Impl = @import("interface.zig").Impl;
|
||||
|
||||
pub const Adapter = opaque {
|
||||
|
|
@ -29,10 +29,17 @@ pub const Adapter = opaque {
|
|||
}
|
||||
};
|
||||
|
||||
pub const PropertiesPowerPreference = extern struct {
|
||||
chain: ChainedStructOut = .{
|
||||
.next = null,
|
||||
.s_type = .adapter_properties_power_preference,
|
||||
},
|
||||
power_preference: PowerPreference = .undefined,
|
||||
};
|
||||
|
||||
pub const Properties = extern struct {
|
||||
pub const NextInChain = extern union {
|
||||
generic: ?*const ChainedStructOut,
|
||||
dawn_adapter_properties_power_preference: *const dawn.AdapterPropertiesPowerPreference,
|
||||
};
|
||||
|
||||
next_in_chain: NextInChain = .{ .generic = null },
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
const std = @import("std");
|
||||
const Bool32 = @import("main.zig").Bool32;
|
||||
const ChainedStruct = @import("main.zig").ChainedStruct;
|
||||
const dawn = @import("dawn.zig");
|
||||
const MapModeFlags = @import("main.zig").MapModeFlags;
|
||||
const Impl = @import("interface.zig").Impl;
|
||||
|
||||
|
|
@ -71,7 +70,6 @@ pub const Buffer = opaque {
|
|||
pub const Descriptor = extern struct {
|
||||
pub const NextInChain = extern union {
|
||||
generic: ?*const ChainedStruct,
|
||||
dawn_buffer_descriptor_error_info_from_wire_client: *const dawn.BufferDescriptorErrorInfoFromWireClient,
|
||||
};
|
||||
|
||||
next_in_chain: NextInChain = .{ .generic = null },
|
||||
|
|
|
|||
|
|
@ -11,13 +11,11 @@ const ImageCopyBuffer = @import("main.zig").ImageCopyBuffer;
|
|||
const ImageCopyTexture = @import("main.zig").ImageCopyTexture;
|
||||
const Extent3D = @import("main.zig").Extent3D;
|
||||
const Impl = @import("interface.zig").Impl;
|
||||
const dawn = @import("dawn.zig");
|
||||
|
||||
pub const CommandEncoder = opaque {
|
||||
pub const Descriptor = extern struct {
|
||||
pub const NextInChain = extern union {
|
||||
generic: ?*const ChainedStruct,
|
||||
dawn_encoder_internal_usage_descriptor: *const dawn.EncoderInternalUsageDescriptor,
|
||||
};
|
||||
|
||||
next_in_chain: NextInChain = .{ .generic = null },
|
||||
|
|
|
|||
|
|
@ -1,74 +0,0 @@
|
|||
const Bool32 = @import("main.zig").Bool32;
|
||||
const ChainedStruct = @import("main.zig").ChainedStruct;
|
||||
const ChainedStructOut = @import("main.zig").ChainedStructOut;
|
||||
const PowerPreference = @import("main.zig").PowerPreference;
|
||||
const Texture = @import("texture.zig").Texture;
|
||||
|
||||
pub const CacheDeviceDescriptor = extern struct {
|
||||
chain: ChainedStruct = .{ .next = null, .s_type = .dawn_cache_device_descriptor },
|
||||
isolation_key: [*:0]const u8 = "",
|
||||
};
|
||||
|
||||
pub const EncoderInternalUsageDescriptor = extern struct {
|
||||
chain: ChainedStruct = .{ .next = null, .s_type = .dawn_encoder_internal_usage_descriptor },
|
||||
use_internal_usages: Bool32 = .false,
|
||||
};
|
||||
|
||||
pub const MultisampleStateRenderToSingleSampled = extern struct {
|
||||
chain: ChainedStruct = .{ .next = null, .s_type = .dawn_multisample_state_render_to_single_sampled },
|
||||
enabled: Bool32 = .false,
|
||||
};
|
||||
|
||||
pub const RenderPassColorAttachmentRenderToSingleSampled = extern struct {
|
||||
chain: ChainedStruct = .{ .next = null, .s_type = .dawn_render_pass_color_attachment_render_to_single_sampled },
|
||||
implicit_sample_count: u32 = 1,
|
||||
};
|
||||
|
||||
pub const TextureInternalUsageDescriptor = extern struct {
|
||||
chain: ChainedStruct = .{ .next = null, .s_type = .dawn_texture_internal_usage_descriptor },
|
||||
internal_usage: Texture.UsageFlags = Texture.UsageFlags.none,
|
||||
};
|
||||
|
||||
pub const TogglesDescriptor = extern struct {
|
||||
chain: ChainedStruct = .{ .next = null, .s_type = .dawn_toggles_descriptor },
|
||||
enabled_toggles_count: usize = 0,
|
||||
enabled_toggles: ?[*]const [*:0]const u8 = null,
|
||||
disabled_toggles_count: usize = 0,
|
||||
disabled_toggles: ?[*]const [*:0]const u8 = null,
|
||||
|
||||
/// Provides a slightly friendlier Zig API to initialize this structure.
|
||||
pub inline fn init(v: struct {
|
||||
chain: ChainedStruct = .{ .next = null, .s_type = .dawn_toggles_descriptor },
|
||||
enabled_toggles: ?[]const [*:0]const u8 = null,
|
||||
disabled_toggles: ?[]const [*:0]const u8 = null,
|
||||
}) TogglesDescriptor {
|
||||
return .{
|
||||
.chain = v.chain,
|
||||
.enabled_toggles_count = if (v.enabled_toggles) |e| e.len else 0,
|
||||
.enabled_toggles = if (v.enabled_toggles) |e| e.ptr else null,
|
||||
.disabled_toggles_count = if (v.disabled_toggles) |e| e.len else 0,
|
||||
.disabled_toggles = if (v.disabled_toggles) |e| e.ptr else null,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
pub const ShaderModuleSPIRVOptionsDescriptor = extern struct {
|
||||
chain: ChainedStruct = .{ .next = null, .s_type = .dawn_shader_module_spirv_options_descriptor },
|
||||
allow_non_uniform_derivatives: Bool32 = .false,
|
||||
};
|
||||
|
||||
pub const AdapterPropertiesPowerPreference = extern struct {
|
||||
chain: ChainedStructOut = .{
|
||||
.next = null,
|
||||
.s_type = .dawn_adapter_properties_power_preference,
|
||||
},
|
||||
power_preference: PowerPreference = .undefined,
|
||||
};
|
||||
|
||||
pub const BufferDescriptorErrorInfoFromWireClient = extern struct {
|
||||
chain: ChainedStruct = .{
|
||||
.next = null,
|
||||
.s_type = .dawn_buffer_descriptor_error_info_from_wire_client,
|
||||
},
|
||||
out_of_memory: Bool32 = .false,
|
||||
};
|
||||
|
|
@ -29,7 +29,6 @@ const ErrorCallback = @import("main.zig").ErrorCallback;
|
|||
const CreateComputePipelineAsyncCallback = @import("main.zig").CreateComputePipelineAsyncCallback;
|
||||
const CreateRenderPipelineAsyncCallback = @import("main.zig").CreateRenderPipelineAsyncCallback;
|
||||
const Impl = @import("interface.zig").Impl;
|
||||
const dawn = @import("dawn.zig");
|
||||
|
||||
pub const Device = opaque {
|
||||
pub const LostCallback = *const fn (
|
||||
|
|
@ -46,8 +45,6 @@ pub const Device = opaque {
|
|||
pub const Descriptor = extern struct {
|
||||
pub const NextInChain = extern union {
|
||||
generic: ?*const ChainedStruct,
|
||||
dawn_toggles_descriptor: *const dawn.TogglesDescriptor,
|
||||
dawn_cache_device_descriptor: *const dawn.CacheDeviceDescriptor,
|
||||
};
|
||||
|
||||
next_in_chain: NextInChain = .{ .generic = null },
|
||||
|
|
@ -387,8 +384,6 @@ pub const Device = opaque {
|
|||
Impl.deviceTick(device);
|
||||
}
|
||||
|
||||
// Mach WebGPU extension. Supported with mach-gpu-dawn.
|
||||
//
|
||||
// When making Metal interop with other APIs, we need to be careful that QueueSubmit doesn't
|
||||
// mean that the operations will be visible to other APIs/Metal devices right away. macOS
|
||||
// does have a global queue of graphics operations, but the command buffers are inserted there
|
||||
|
|
|
|||
|
|
@ -5,13 +5,11 @@ const Adapter = @import("adapter.zig").Adapter;
|
|||
const RequestAdapterOptions = @import("main.zig").RequestAdapterOptions;
|
||||
const RequestAdapterCallback = @import("main.zig").RequestAdapterCallback;
|
||||
const Impl = @import("interface.zig").Impl;
|
||||
const dawn = @import("dawn.zig");
|
||||
|
||||
pub const Instance = opaque {
|
||||
pub const Descriptor = extern struct {
|
||||
pub const NextInChain = extern union {
|
||||
generic: ?*const ChainedStruct,
|
||||
dawn_toggles_descriptor: *const dawn.TogglesDescriptor,
|
||||
};
|
||||
|
||||
next_in_chain: NextInChain = .{ .generic = null },
|
||||
|
|
|
|||
|
|
@ -776,7 +776,6 @@ pub fn Export(comptime T: type) type {
|
|||
T.devicePushErrorScope(device, filter);
|
||||
}
|
||||
|
||||
// TODO: dawn: callback not marked as nullable in dawn.json but in fact is.
|
||||
// SYSGPU_EXPORT void sysgpuDeviceSetDeviceLostCallback(WGPUDevice device, WGPUDeviceLostCallback callback, void * userdata);
|
||||
export fn sysgpuDeviceSetDeviceLostCallback(device: *sysgpu.Device, callback: ?sysgpu.Device.LostCallback, userdata: ?*anyopaque) void {
|
||||
T.deviceSetDeviceLostCallback(device, callback, userdata);
|
||||
|
|
@ -787,13 +786,11 @@ pub fn Export(comptime T: type) type {
|
|||
T.deviceSetLabel(device, label);
|
||||
}
|
||||
|
||||
// TODO: dawn: callback not marked as nullable in dawn.json but in fact is.
|
||||
// SYSGPU_EXPORT void sysgpuDeviceSetLoggingCallback(WGPUDevice device, WGPULoggingCallback callback, void * userdata);
|
||||
export fn sysgpuDeviceSetLoggingCallback(device: *sysgpu.Device, callback: ?sysgpu.LoggingCallback, userdata: ?*anyopaque) void {
|
||||
T.deviceSetLoggingCallback(device, callback, userdata);
|
||||
}
|
||||
|
||||
// TODO: dawn: callback not marked as nullable in dawn.json but in fact is.
|
||||
// SYSGPU_EXPORT void sysgpuDeviceSetUncapturedErrorCallback(WGPUDevice device, WGPUErrorCallback callback, void * userdata);
|
||||
export fn sysgpuDeviceSetUncapturedErrorCallback(device: *sysgpu.Device, callback: ?sysgpu.ErrorCallback, userdata: ?*anyopaque) void {
|
||||
T.deviceSetUncapturedErrorCallback(device, callback, userdata);
|
||||
|
|
@ -1489,7 +1486,6 @@ pub const StubInterface = Interface(struct {
|
|||
unreachable;
|
||||
}
|
||||
|
||||
// TODO: dawn: return value not marked as nullable in dawn.json but in fact is.
|
||||
pub inline fn bufferGetConstMappedRange(buffer: *sysgpu.Buffer, offset: usize, size: usize) ?*const anyopaque {
|
||||
_ = buffer;
|
||||
_ = offset;
|
||||
|
|
@ -1497,7 +1493,6 @@ pub const StubInterface = Interface(struct {
|
|||
unreachable;
|
||||
}
|
||||
|
||||
// TODO: dawn: return value not marked as nullable in dawn.json but in fact is.
|
||||
pub inline fn bufferGetMappedRange(buffer: *sysgpu.Buffer, offset: usize, size: usize) ?*anyopaque {
|
||||
_ = buffer;
|
||||
_ = offset;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ pub const SwapChain = @import("swap_chain.zig").SwapChain;
|
|||
pub const Texture = @import("texture.zig").Texture;
|
||||
pub const TextureView = @import("texture_view.zig").TextureView;
|
||||
|
||||
pub const dawn = @import("dawn.zig");
|
||||
const instance = @import("instance.zig");
|
||||
const device = @import("device.zig");
|
||||
const interface = @import("interface.zig");
|
||||
|
|
@ -95,7 +94,6 @@ pub const RenderPassTimestampWrite = extern struct {
|
|||
pub const RequestAdapterOptions = extern struct {
|
||||
pub const NextInChain = extern union {
|
||||
generic: ?*const ChainedStruct,
|
||||
dawn_toggles_descriptor: *const dawn.TogglesDescriptor,
|
||||
};
|
||||
|
||||
next_in_chain: NextInChain = .{ .generic = null },
|
||||
|
|
@ -294,9 +292,6 @@ pub const FeatureName = enum(u32) {
|
|||
rg11_b10_ufloat_renderable = 0x0000000A,
|
||||
bgra8_unorm_storage = 0x0000000B,
|
||||
float32_filterable = 0x0000000C,
|
||||
dawn_internal_usages = 0x000003ea,
|
||||
dawn_multi_planar_formats = 0x000003eb,
|
||||
dawn_native = 0x000003ec,
|
||||
chromium_experimental_dp4a = 0x000003ed,
|
||||
timestamp_query_inside_passes = 0x000003EE,
|
||||
implicit_device_synchronization = 0x000003EF,
|
||||
|
|
@ -434,18 +429,9 @@ pub const SType = enum(u32) {
|
|||
external_texture_binding_layout = 0x0000000D,
|
||||
surface_descriptor_from_windows_swap_chain_panel = 0x0000000E,
|
||||
render_pass_descriptor_max_draw_count = 0x0000000F,
|
||||
dawn_texture_internal_usage_descriptor = 0x000003E8,
|
||||
dawn_encoder_internal_usage_descriptor = 0x000003EB,
|
||||
dawn_instance_descriptor = 0x000003EC,
|
||||
dawn_cache_device_descriptor = 0x000003ED,
|
||||
dawn_adapter_properties_power_preference = 0x000003EE,
|
||||
dawn_buffer_descriptor_error_info_from_wire_client = 0x000003EF,
|
||||
dawn_toggles_descriptor = 0x000003F0,
|
||||
dawn_shader_module_spirv_options_descriptor = 0x000003F1,
|
||||
adapter_properties_power_preference = 0x000003EE,
|
||||
request_adapter_options_luid = 0x000003F2,
|
||||
request_adapter_options_get_gl_proc = 0x000003F3,
|
||||
dawn_multisample_state_render_to_single_sampled = 0x000003F4,
|
||||
dawn_render_pass_color_attachment_render_to_single_sampled = 0x000003F5,
|
||||
shared_texture_memory_vk_image_descriptor = 0x0000044C,
|
||||
shared_texture_memory_vk_dedicated_allocation_descriptor = 0x0000044D,
|
||||
shared_texture_memory_a_hardware_buffer_descriptor = 0x0000044E,
|
||||
|
|
@ -605,13 +591,11 @@ pub const ShaderStageFlags = packed struct(u32) {
|
|||
};
|
||||
|
||||
pub const ChainedStruct = extern struct {
|
||||
// TODO: dawn: not marked as nullable in dawn.json but in fact is.
|
||||
next: ?*const ChainedStruct = null,
|
||||
s_type: SType,
|
||||
};
|
||||
|
||||
pub const ChainedStructOut = extern struct {
|
||||
// TODO: dawn: not marked as nullable in dawn.json but in fact is.
|
||||
next: ?*ChainedStructOut = null,
|
||||
s_type: SType,
|
||||
};
|
||||
|
|
@ -720,7 +704,6 @@ pub const CopyTextureForBrowserOptions = extern struct {
|
|||
pub const MultisampleState = extern struct {
|
||||
pub const NextInChain = extern union {
|
||||
generic: ?*const ChainedStruct,
|
||||
dawn_multisample_state_render_to_single_sampled: *const dawn.MultisampleStateRenderToSingleSampled,
|
||||
};
|
||||
|
||||
next_in_chain: NextInChain = .{ .generic = null },
|
||||
|
|
@ -853,7 +836,6 @@ pub const ProgrammableStageDescriptor = extern struct {
|
|||
pub const RenderPassColorAttachment = extern struct {
|
||||
pub const NextInChain = extern union {
|
||||
generic: ?*const ChainedStruct,
|
||||
dawn_render_pass_color_attachment_render_to_single_sampled: *const dawn.RenderPassColorAttachmentRenderToSingleSampled,
|
||||
};
|
||||
|
||||
next_in_chain: NextInChain = .{ .generic = null },
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ pub const Queue = opaque {
|
|||
Impl.queueCopyTextureForBrowser(queue, source, destination, copy_size, options);
|
||||
}
|
||||
|
||||
// TODO: dawn: does not allow unsetting this callback to null
|
||||
pub inline fn onSubmittedWorkDone(
|
||||
queue: *Queue,
|
||||
signal_value: u64,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ const CompilationInfoCallback = @import("main.zig").CompilationInfoCallback;
|
|||
const CompilationInfoRequestStatus = @import("main.zig").CompilationInfoRequestStatus;
|
||||
const CompilationInfo = @import("main.zig").CompilationInfo;
|
||||
const Impl = @import("interface.zig").Impl;
|
||||
const dawn = @import("dawn.zig");
|
||||
|
||||
pub const ShaderModule = opaque {
|
||||
pub const Descriptor = extern struct {
|
||||
|
|
@ -13,7 +12,6 @@ pub const ShaderModule = opaque {
|
|||
wgsl_descriptor: ?*const WGSLDescriptor,
|
||||
hlsl_descriptor: ?*const HLSLDescriptor,
|
||||
msl_descriptor: ?*const MSLDescriptor,
|
||||
dawn_shader_module_spirv_options_descriptor: ?*const dawn.ShaderModuleSPIRVOptionsDescriptor,
|
||||
};
|
||||
|
||||
next_in_chain: NextInChain = .{ .generic = null },
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ const TextureView = @import("texture_view.zig").TextureView;
|
|||
const Extent3D = @import("main.zig").Extent3D;
|
||||
const Impl = @import("interface.zig").Impl;
|
||||
const types = @import("main.zig");
|
||||
const dawn = @import("dawn.zig");
|
||||
|
||||
pub const Texture = opaque {
|
||||
pub const Aspect = enum(u32) {
|
||||
|
|
@ -171,7 +170,6 @@ pub const Texture = opaque {
|
|||
pub const Descriptor = extern struct {
|
||||
pub const NextInChain = extern union {
|
||||
generic: ?*const ChainedStruct,
|
||||
dawn_texture_internal_usage_descriptor: *const dawn.TextureInternalUsageDescriptor,
|
||||
};
|
||||
|
||||
next_in_chain: NextInChain = .{ .generic = null },
|
||||
|
|
|
|||
|
|
@ -595,14 +595,11 @@ pub const Device = struct {
|
|||
pub fn deinit(device: *Device) void {
|
||||
const vk_device = device.vk_device;
|
||||
|
||||
if (device.lost_cb) |lost_cb| {
|
||||
lost_cb(.destroyed, "Device was destroyed.", device.lost_cb_userdata);
|
||||
}
|
||||
|
||||
device.waitAll() catch {};
|
||||
device.processQueuedOperations();
|
||||
|
||||
device.map_callbacks.deinit(allocator);
|
||||
for (device.submit_objects.items) |*submit_object| submit_object.deinit();
|
||||
device.submit_objects.deinit(allocator);
|
||||
device.streaming_manager.deinit();
|
||||
|
||||
|
|
@ -2941,7 +2938,7 @@ pub const StateTracker = struct {
|
|||
memory_barriers.len,
|
||||
&memory_barriers.buffer,
|
||||
0,
|
||||
undefined,
|
||||
null,
|
||||
@intCast(tracker.image_barriers.items.len),
|
||||
tracker.image_barriers.items.ptr,
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue