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,
|
buffer: ?Buffer,
|
||||||
offset: u64,
|
offset: u64,
|
||||||
size: u64,
|
size: u64,
|
||||||
sampler: Sampler = Sampler.none, // nullable
|
sampler: ?Sampler,
|
||||||
texture_view: TextureView = TextureView.none, // nullable
|
texture_view: TextureView = TextureView.none, // nullable
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ const ShaderStageFlags = @import("types.zig").ShaderStageFlags;
|
||||||
const Buffer = @import("buffer.zig").Buffer;
|
const Buffer = @import("buffer.zig").Buffer;
|
||||||
const BufferBindingLayout = @import("buffer.zig").BufferBindingLayout;
|
const BufferBindingLayout = @import("buffer.zig").BufferBindingLayout;
|
||||||
const Sampler = @import("sampler.zig").Sampler;
|
const Sampler = @import("sampler.zig").Sampler;
|
||||||
|
const SamplerBindingLayout = @import("sampler.zig").SamplerBindingLayout;
|
||||||
const Texture = @import("texture.zig").Texture;
|
const Texture = @import("texture.zig").Texture;
|
||||||
const StorageTextureBindingLayout = @import("types.zig").StorageTextureBindingLayout;
|
const StorageTextureBindingLayout = @import("types.zig").StorageTextureBindingLayout;
|
||||||
|
|
||||||
|
|
@ -13,7 +14,7 @@ pub const BindGroupLayoutEntry = extern struct {
|
||||||
binding: u32,
|
binding: u32,
|
||||||
visibility: ShaderStageFlags,
|
visibility: ShaderStageFlags,
|
||||||
buffer: BufferBindingLayout,
|
buffer: BufferBindingLayout,
|
||||||
sampler: Sampler.BindingLayout,
|
sampler: SamplerBindingLayout,
|
||||||
texture: Texture.BindingLayout,
|
texture: Texture.BindingLayout,
|
||||||
storage_texture: StorageTextureBindingLayout,
|
storage_texture: StorageTextureBindingLayout,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -2,35 +2,32 @@ const ChainedStruct = @import("types.zig").ChainedStruct;
|
||||||
const FilterMode = @import("types.zig").FilterMode;
|
const FilterMode = @import("types.zig").FilterMode;
|
||||||
const CompareFunction = @import("types.zig").CompareFunction;
|
const CompareFunction = @import("types.zig").CompareFunction;
|
||||||
|
|
||||||
pub const Sampler = enum(usize) {
|
pub const Sampler = *opaque {};
|
||||||
_,
|
|
||||||
|
|
||||||
pub const none: Sampler = @intToEnum(Sampler, 0);
|
pub const SamplerAddressMode = enum(u32) {
|
||||||
|
|
||||||
pub const AddressMode = enum(u32) {
|
|
||||||
repeat = 0x00000000,
|
repeat = 0x00000000,
|
||||||
mirror_repeat = 0x00000001,
|
mirror_repeat = 0x00000001,
|
||||||
clamp_to_edge = 0x00000002,
|
clamp_to_edge = 0x00000002,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const BindingType = enum(u32) {
|
pub const SamplerBindingType = enum(u32) {
|
||||||
undef = 0x00000000,
|
undef = 0x00000000,
|
||||||
filtering = 0x00000001,
|
filtering = 0x00000001,
|
||||||
non_filtering = 0x00000002,
|
non_filtering = 0x00000002,
|
||||||
comparison = 0x00000003,
|
comparison = 0x00000003,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const BindingLayout = extern struct {
|
pub const SamplerBindingLayout = extern struct {
|
||||||
next_in_chain: *const ChainedStruct,
|
next_in_chain: *const ChainedStruct,
|
||||||
type: BindingType,
|
type: SamplerBindingType,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const Descriptor = extern struct {
|
pub const SamplerDescriptor = extern struct {
|
||||||
next_in_chain: *const ChainedStruct,
|
next_in_chain: *const ChainedStruct,
|
||||||
label: ?[*:0]const u8 = null,
|
label: ?[*:0]const u8 = null,
|
||||||
address_mode_u: AddressMode,
|
address_mode_u: SamplerAddressMode,
|
||||||
address_mode_v: AddressMode,
|
address_mode_v: SamplerAddressMode,
|
||||||
address_mode_w: AddressMode,
|
address_mode_w: SamplerAddressMode,
|
||||||
mag_filter: FilterMode,
|
mag_filter: FilterMode,
|
||||||
min_filter: FilterMode,
|
min_filter: FilterMode,
|
||||||
mipmap_filter: FilterMode,
|
mipmap_filter: FilterMode,
|
||||||
|
|
@ -39,4 +36,3 @@ pub const Sampler = enum(usize) {
|
||||||
compare: CompareFunction,
|
compare: CompareFunction,
|
||||||
max_anisotropy: u16,
|
max_anisotropy: u16,
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue