gpu: add TogglesDeviceDescriptor.init slice helper
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
cb80cfc3c2
commit
5e4aa7e6df
4 changed files with 19 additions and 5 deletions
|
|
@ -52,7 +52,7 @@ pub const BindGroup = opaque {
|
|||
entries: ?[*]const Entry = null,
|
||||
|
||||
/// Provides a slightly friendlier Zig API to initialize this structure.
|
||||
pub fn init(v: struct {
|
||||
pub inline fn init(v: struct {
|
||||
next_in_chain: ?*const ChainedStruct = null,
|
||||
label: ?[*:0]const u8 = null,
|
||||
layout: *BindGroupLayout,
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ pub const BindGroupLayout = opaque {
|
|||
entries: ?[*]const Entry = null,
|
||||
|
||||
/// Provides a slightly friendlier Zig API to initialize this structure.
|
||||
pub fn init(v: struct {
|
||||
pub inline fn init(v: struct {
|
||||
next_in_chain: ?*const ChainedStruct = null,
|
||||
label: ?[*:0]const u8 = null,
|
||||
entries: ?[]const Entry = null,
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ pub const InstanceDescriptor = extern struct {
|
|||
additional_runtime_search_paths: ?[*]const u8 = null,
|
||||
|
||||
/// Provides a slightly friendlier Zig API to initialize this structure.
|
||||
pub fn init(v: struct {
|
||||
pub inline fn init(v: struct {
|
||||
chain: ChainedStruct,
|
||||
additional_runtime_search_paths: ?[]const u8 = null,
|
||||
}) InstanceDescriptor {
|
||||
|
|
@ -42,10 +42,23 @@ pub const TextureInternalUsageDescriptor = extern struct {
|
|||
/// TODO: Can be chained in gpu.Device.Descriptor
|
||||
pub const TogglesDeviceDescriptor = extern struct {
|
||||
chain: ChainedStruct,
|
||||
// TODO: slice helper
|
||||
force_enabled_toggles_count: u32 = 0,
|
||||
force_enabled_toggles: ?[*]const u8 = null,
|
||||
// TODO: slice helper
|
||||
force_disabled_toggles_count: u32 = 0,
|
||||
force_disabled_toggles: ?[*]const u8 = null,
|
||||
|
||||
/// Provides a slightly friendlier Zig API to initialize this structure.
|
||||
pub inline fn init(v: struct {
|
||||
chain: ChainedStruct,
|
||||
force_enabled_toggles: ?[]const u8 = null,
|
||||
force_disabled_toggles: ?[]const u8 = null,
|
||||
}) TogglesDeviceDescriptor {
|
||||
return .{
|
||||
.chain = v.chain,
|
||||
.force_enabled_toggles_count = if (v.force_enabled_toggles) |e| @intCast(u32, e.len) else 0,
|
||||
.force_enabled_toggles = if (v.force_enabled_toggles) |e| e.ptr else null,
|
||||
.force_disabled_toggles_count = if (v.force_disabled_toggles) |e| @intCast(u32, e.len) else 0,
|
||||
.force_disabled_toggles = if (v.force_disabled_toggles) |e| e.ptr else null,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue