gpu: internalize Sampler types

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-07-29 23:57:47 -07:00 committed by Stephen Gutekanst
parent 550c5fd55e
commit b0776270d3
4 changed files with 38 additions and 40 deletions

View file

@ -4,6 +4,39 @@ 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);
}
@ -16,36 +49,3 @@ pub const Sampler = opaque {
Impl.samplerRelease(sampler);
}
};
pub const SamplerAddressMode = enum(u32) {
repeat = 0x00000000,
mirror_repeat = 0x00000001,
clamp_to_edge = 0x00000002,
};
pub const SamplerBindingType = enum(u32) {
undef = 0x00000000,
filtering = 0x00000001,
non_filtering = 0x00000002,
comparison = 0x00000003,
};
pub const SamplerBindingLayout = extern struct {
next_in_chain: ?*const ChainedStruct = null,
type: SamplerBindingType = .undef,
};
pub const SamplerDescriptor = extern struct {
next_in_chain: ?*const ChainedStruct = null,
label: ?[*:0]const u8 = null,
address_mode_u: SamplerAddressMode = .clamp_to_edge,
address_mode_v: SamplerAddressMode = .clamp_to_edge,
address_mode_w: SamplerAddressMode = .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,
};