gpu: convert Sampler from enum(usize) to *opaque
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
cb8c874536
commit
34edad6a2c
3 changed files with 35 additions and 38 deletions
|
|
@ -12,7 +12,7 @@ pub const BindGroupEntry = extern struct {
|
|||
buffer: ?Buffer,
|
||||
offset: u64,
|
||||
size: u64,
|
||||
sampler: Sampler = Sampler.none, // nullable
|
||||
sampler: ?Sampler,
|
||||
texture_view: TextureView = TextureView.none, // nullable
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ const ShaderStageFlags = @import("types.zig").ShaderStageFlags;
|
|||
const Buffer = @import("buffer.zig").Buffer;
|
||||
const BufferBindingLayout = @import("buffer.zig").BufferBindingLayout;
|
||||
const Sampler = @import("sampler.zig").Sampler;
|
||||
const SamplerBindingLayout = @import("sampler.zig").SamplerBindingLayout;
|
||||
const Texture = @import("texture.zig").Texture;
|
||||
const StorageTextureBindingLayout = @import("types.zig").StorageTextureBindingLayout;
|
||||
|
||||
|
|
@ -13,7 +14,7 @@ pub const BindGroupLayoutEntry = extern struct {
|
|||
binding: u32,
|
||||
visibility: ShaderStageFlags,
|
||||
buffer: BufferBindingLayout,
|
||||
sampler: Sampler.BindingLayout,
|
||||
sampler: SamplerBindingLayout,
|
||||
texture: Texture.BindingLayout,
|
||||
storage_texture: StorageTextureBindingLayout,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,41 +2,37 @@ const ChainedStruct = @import("types.zig").ChainedStruct;
|
|||
const FilterMode = @import("types.zig").FilterMode;
|
||||
const CompareFunction = @import("types.zig").CompareFunction;
|
||||
|
||||
pub const Sampler = enum(usize) {
|
||||
_,
|
||||
pub const Sampler = *opaque {};
|
||||
|
||||
pub const none: Sampler = @intToEnum(Sampler, 0);
|
||||
|
||||
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,
|
||||
type: BindingType,
|
||||
};
|
||||
|
||||
pub const Descriptor = extern struct {
|
||||
next_in_chain: *const ChainedStruct,
|
||||
label: ?[*:0]const u8 = null,
|
||||
address_mode_u: AddressMode,
|
||||
address_mode_v: AddressMode,
|
||||
address_mode_w: AddressMode,
|
||||
mag_filter: FilterMode,
|
||||
min_filter: FilterMode,
|
||||
mipmap_filter: FilterMode,
|
||||
lod_min_clamp: f32,
|
||||
lod_max_clamp: f32,
|
||||
compare: CompareFunction,
|
||||
max_anisotropy: u16,
|
||||
};
|
||||
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,
|
||||
type: SamplerBindingType,
|
||||
};
|
||||
|
||||
pub const SamplerDescriptor = extern struct {
|
||||
next_in_chain: *const ChainedStruct,
|
||||
label: ?[*:0]const u8 = null,
|
||||
address_mode_u: SamplerAddressMode,
|
||||
address_mode_v: SamplerAddressMode,
|
||||
address_mode_w: SamplerAddressMode,
|
||||
mag_filter: FilterMode,
|
||||
min_filter: FilterMode,
|
||||
mipmap_filter: FilterMode,
|
||||
lod_min_clamp: f32,
|
||||
lod_max_clamp: f32,
|
||||
compare: CompareFunction,
|
||||
max_anisotropy: u16,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue