mach/gpu/src/sampler.zig
Stephen Gutekanst b0776270d3 gpu: internalize Sampler types
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-08-12 00:43:43 -07:00

51 lines
1.6 KiB
Zig

const ChainedStruct = @import("types.zig").ChainedStruct;
const FilterMode = @import("types.zig").FilterMode;
const CompareFunction = @import("types.zig").CompareFunction;
const Impl = @import("interface.zig").Impl;
pub const Sampler = opaque {
pub const AddressMode = enum(u32) {
repeat = 0x00000000,
mirror_repeat = 0x00000001,
clamp_to_edge = 0x00000002,
};
pub const BindingType = enum(u32) {
undef = 0x00000000,
filtering = 0x00000001,
non_filtering = 0x00000002,
comparison = 0x00000003,
};
pub const BindingLayout = extern struct {
next_in_chain: ?*const ChainedStruct = null,
type: BindingType = .undef,
};
pub const Descriptor = extern struct {
next_in_chain: ?*const ChainedStruct = null,
label: ?[*:0]const u8 = null,
address_mode_u: AddressMode = .clamp_to_edge,
address_mode_v: AddressMode = .clamp_to_edge,
address_mode_w: AddressMode = .clamp_to_edge,
mag_filter: FilterMode = .nearest,
min_filter: FilterMode = .nearest,
mipmap_filter: FilterMode = .nearest,
lod_min_clamp: f32 = 0.0,
lod_max_clamp: f32 = 1000.0,
compare: CompareFunction = .undef,
max_anisotropy: u16 = 1,
};
pub inline fn setLabel(sampler: *Sampler, label: [*:0]const u8) void {
Impl.samplerSetLabel(sampler, label);
}
pub inline fn reference(sampler: *Sampler) void {
Impl.samplerReference(sampler);
}
pub inline fn release(sampler: *Sampler) void {
Impl.samplerRelease(sampler);
}
};