gpu: centralize type definitions
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
c7216ed240
commit
34c2590d18
4 changed files with 67 additions and 70 deletions
|
|
@ -3,8 +3,8 @@ const RenderPassEncoder = @import("render_pass_encoder.zig").RenderPassEncoder;
|
||||||
const CommandBuffer = @import("command_buffer.zig").CommandBuffer;
|
const CommandBuffer = @import("command_buffer.zig").CommandBuffer;
|
||||||
const Buffer = @import("buffer.zig").Buffer;
|
const Buffer = @import("buffer.zig").Buffer;
|
||||||
const QuerySet = @import("query_set.zig").QuerySet;
|
const QuerySet = @import("query_set.zig").QuerySet;
|
||||||
const RenderPassDescriptor = @import("main.zig").RenderPassDescriptor;
|
const RenderPassDescriptor = @import("types.zig").RenderPassDescriptor;
|
||||||
const ComputePassDescriptor = @import("main.zig").ComputePassDescriptor;
|
const ComputePassDescriptor = @import("types.zig").ComputePassDescriptor;
|
||||||
const ChainedStruct = @import("types.zig").ChainedStruct;
|
const ChainedStruct = @import("types.zig").ChainedStruct;
|
||||||
const ImageCopyBuffer = @import("types.zig").ImageCopyBuffer;
|
const ImageCopyBuffer = @import("types.zig").ImageCopyBuffer;
|
||||||
const ImageCopyTexture = @import("types.zig").ImageCopyTexture;
|
const ImageCopyTexture = @import("types.zig").ImageCopyTexture;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ const ChainedStruct = @import("types.zig").ChainedStruct;
|
||||||
const RequestAdapterStatus = @import("types.zig").RequestAdapterStatus;
|
const RequestAdapterStatus = @import("types.zig").RequestAdapterStatus;
|
||||||
const Surface = @import("surface.zig").Surface;
|
const Surface = @import("surface.zig").Surface;
|
||||||
const Adapter = @import("adapter.zig").Adapter;
|
const Adapter = @import("adapter.zig").Adapter;
|
||||||
const RequestAdapterOptions = @import("main.zig").RequestAdapterOptions;
|
const RequestAdapterOptions = @import("types.zig").RequestAdapterOptions;
|
||||||
const RequestAdapterCallback = @import("callbacks.zig").RequestAdapterCallback;
|
const RequestAdapterCallback = @import("callbacks.zig").RequestAdapterCallback;
|
||||||
const Impl = @import("interface.zig").Impl;
|
const Impl = @import("interface.zig").Impl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,81 +39,16 @@ pub const dawn = @import("dawn.zig");
|
||||||
pub usingnamespace @import("types.zig");
|
pub usingnamespace @import("types.zig");
|
||||||
pub usingnamespace @import("interface.zig");
|
pub usingnamespace @import("interface.zig");
|
||||||
|
|
||||||
const types = @import("types.zig");
|
|
||||||
const query_set = @import("query_set.zig");
|
|
||||||
const texture_view = @import("texture_view.zig");
|
|
||||||
const surface = @import("surface.zig");
|
|
||||||
const compute_pipeline = @import("compute_pipeline.zig");
|
|
||||||
const render_pipeline = @import("render_pipeline.zig");
|
|
||||||
const instance = @import("instance.zig");
|
const instance = @import("instance.zig");
|
||||||
const device = @import("device.zig");
|
const device = @import("device.zig");
|
||||||
const interface = @import("interface.zig");
|
const interface = @import("interface.zig");
|
||||||
|
const types = @import("types.zig");
|
||||||
/// Generic function pointer type, used for returning API function pointers. Must be
|
|
||||||
/// cast to the right `fn (...) callconv(.C) T` type before use.
|
|
||||||
pub const Proc = fn () callconv(.C) void;
|
|
||||||
|
|
||||||
pub const ComputePassTimestampWrite = extern struct {
|
|
||||||
query_set: *query_set.QuerySet,
|
|
||||||
query_index: u32,
|
|
||||||
location: types.ComputePassTimestampLocation,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub const RenderPassDepthStencilAttachment = extern struct {
|
|
||||||
view: *texture_view.TextureView,
|
|
||||||
depth_load_op: types.LoadOp = .undef,
|
|
||||||
depth_store_op: types.StoreOp = .undef,
|
|
||||||
/// deprecated
|
|
||||||
clear_depth: f32 = std.math.nan(f32),
|
|
||||||
depth_clear_value: f32 = 0,
|
|
||||||
depth_read_only: bool = false,
|
|
||||||
stencil_load_op: types.LoadOp = .undef,
|
|
||||||
stencil_store_op: types.StoreOp = .undef,
|
|
||||||
/// deprecated
|
|
||||||
clear_stencil: u32 = 0,
|
|
||||||
stencil_clear_value: u32 = 0,
|
|
||||||
stencil_read_only: bool = false,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub const RenderPassTimestampWrite = extern struct {
|
|
||||||
query_set: *query_set.QuerySet,
|
|
||||||
query_index: u32,
|
|
||||||
location: types.RenderPassTimestampLocation,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub const RequestAdapterOptions = extern struct {
|
|
||||||
next_in_chain: *const types.ChainedStruct,
|
|
||||||
compatible_surface: ?*surface.Surface,
|
|
||||||
power_preference: types.PowerPreference = .undef,
|
|
||||||
force_fallback_adapter: bool = false,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub const ComputePassDescriptor = extern struct {
|
|
||||||
next_in_chain: *const types.ChainedStruct,
|
|
||||||
label: ?[*:0]const u8 = null,
|
|
||||||
timestamp_write_count: u32 = 0,
|
|
||||||
// TODO: file a bug on Dawn, this is not marked as nullable but in fact is.
|
|
||||||
timestamp_writes: ?[*]const ComputePassTimestampWrite = null,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub const RenderPassDescriptor = extern struct {
|
|
||||||
next_in_chain: *const types.ChainedStruct,
|
|
||||||
label: ?[*:0]const u8 = null,
|
|
||||||
color_attachment_count: u32,
|
|
||||||
// TODO: file a bug on Dawn, this is not marked as nullable but in fact is.
|
|
||||||
color_attachments: ?[*]const types.RenderPassColorAttachment,
|
|
||||||
depth_stencil_attachment: ?[*]const RenderPassDepthStencilAttachment,
|
|
||||||
occlusion_query_set: ?*query_set.QuerySet,
|
|
||||||
timestamp_write_count: u32 = 0,
|
|
||||||
// TODO: file a bug on Dawn, this is not marked as nullable but in fact is.
|
|
||||||
timestamp_writes: ?[*]const RenderPassTimestampWrite = null,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub inline fn createInstance(descriptor: ?*const instance.Instance.Descriptor) ?*instance.Instance {
|
pub inline fn createInstance(descriptor: ?*const instance.Instance.Descriptor) ?*instance.Instance {
|
||||||
return interface.Impl.createInstance(descriptor);
|
return interface.Impl.createInstance(descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub inline fn getProcAddress(_device: *device.Device, proc_name: [*:0]const u8) ?Proc {
|
pub inline fn getProcAddress(_device: *device.Device, proc_name: [*:0]const u8) ?types.Proc {
|
||||||
return interface.Impl.getProcAddress(_device, proc_name);
|
return interface.Impl.getProcAddress(_device, proc_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,71 @@ const Texture = @import("texture.zig").Texture;
|
||||||
const TextureView = @import("texture_view.zig").TextureView;
|
const TextureView = @import("texture_view.zig").TextureView;
|
||||||
const Buffer = @import("buffer.zig").Buffer;
|
const Buffer = @import("buffer.zig").Buffer;
|
||||||
const ShaderModule = @import("shader_module.zig").ShaderModule;
|
const ShaderModule = @import("shader_module.zig").ShaderModule;
|
||||||
|
const QuerySet = @import("query_set.zig").QuerySet;
|
||||||
|
const Surface = @import("surface.zig").Surface;
|
||||||
const limit_u32_undef = @import("main.zig").limit_u32_undef;
|
const limit_u32_undef = @import("main.zig").limit_u32_undef;
|
||||||
const limit_u64_undef = @import("main.zig").limit_u64_undef;
|
const limit_u64_undef = @import("main.zig").limit_u64_undef;
|
||||||
|
|
||||||
|
/// Generic function pointer type, used for returning API function pointers. Must be
|
||||||
|
/// cast to the right `fn (...) callconv(.C) T` type before use.
|
||||||
|
pub const Proc = fn () callconv(.C) void;
|
||||||
|
|
||||||
|
pub const ComputePassTimestampWrite = extern struct {
|
||||||
|
query_set: *QuerySet,
|
||||||
|
query_index: u32,
|
||||||
|
location: ComputePassTimestampLocation,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub const RenderPassDepthStencilAttachment = extern struct {
|
||||||
|
view: *TextureView,
|
||||||
|
depth_load_op: LoadOp = .undef,
|
||||||
|
depth_store_op: StoreOp = .undef,
|
||||||
|
/// deprecated
|
||||||
|
clear_depth: f32 = std.math.nan(f32),
|
||||||
|
depth_clear_value: f32 = 0,
|
||||||
|
depth_read_only: bool = false,
|
||||||
|
stencil_load_op: LoadOp = .undef,
|
||||||
|
stencil_store_op: StoreOp = .undef,
|
||||||
|
/// deprecated
|
||||||
|
clear_stencil: u32 = 0,
|
||||||
|
stencil_clear_value: u32 = 0,
|
||||||
|
stencil_read_only: bool = false,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub const RenderPassTimestampWrite = extern struct {
|
||||||
|
query_set: *QuerySet,
|
||||||
|
query_index: u32,
|
||||||
|
location: RenderPassTimestampLocation,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub const RequestAdapterOptions = extern struct {
|
||||||
|
next_in_chain: *const ChainedStruct,
|
||||||
|
compatible_surface: ?*Surface,
|
||||||
|
power_preference: PowerPreference = .undef,
|
||||||
|
force_fallback_adapter: bool = false,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub const ComputePassDescriptor = extern struct {
|
||||||
|
next_in_chain: *const ChainedStruct,
|
||||||
|
label: ?[*:0]const u8 = null,
|
||||||
|
timestamp_write_count: u32 = 0,
|
||||||
|
// TODO: file a bug on Dawn, this is not marked as nullable but in fact is.
|
||||||
|
timestamp_writes: ?[*]const ComputePassTimestampWrite = null,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub const RenderPassDescriptor = extern struct {
|
||||||
|
next_in_chain: *const ChainedStruct,
|
||||||
|
label: ?[*:0]const u8 = null,
|
||||||
|
color_attachment_count: u32,
|
||||||
|
// TODO: file a bug on Dawn, this is not marked as nullable but in fact is.
|
||||||
|
color_attachments: ?[*]const RenderPassColorAttachment,
|
||||||
|
depth_stencil_attachment: ?[*]const RenderPassDepthStencilAttachment,
|
||||||
|
occlusion_query_set: ?*QuerySet,
|
||||||
|
timestamp_write_count: u32 = 0,
|
||||||
|
// TODO: file a bug on Dawn, this is not marked as nullable but in fact is.
|
||||||
|
timestamp_writes: ?[*]const RenderPassTimestampWrite = null,
|
||||||
|
};
|
||||||
|
|
||||||
pub const AlphaMode = enum(u32) {
|
pub const AlphaMode = enum(u32) {
|
||||||
premultiplied = 0x00000000,
|
premultiplied = 0x00000000,
|
||||||
unpremultiplied = 0x00000001,
|
unpremultiplied = 0x00000001,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue