zgpu

git clone git://git.electrosoup.com/zgpu
Log | Files | Refs | Submodules | README

bind_group_layout.zig (2647B)


      1 const c = @import("c.zig").c;
      2 const ChainedStruct = @import("common.zig").ChainedStruct;
      3 const StringView = @import("common.zig").StringView;
      4 const Texture = @import("texture.zig").Texture;
      5 const TextureView = @import("texture_view.zig").TextureView;
      6 
      7 pub const BindGroupLayout = opaque {
      8     pub const Descriptor = extern struct {
      9         next: ?*ChainedStruct = null,
     10         label: StringView,
     11         entry_count: usize,
     12         entries: ?[*]const Entry,
     13     };
     14 
     15     pub const Entry = extern struct {
     16         next: ?*ChainedStruct = null,
     17         binding: u32,
     18         visibility: ShaderStage,
     19         buffer: BufferBindingLayout,
     20         sampler: SamplerBindingLayout,
     21         texture: TextureBindingLayout,
     22         storage_texture: StorageTextureBindingLayout,
     23 
     24         const ShaderStage = packed struct(u64) {
     25             vertex: bool = false,
     26             fragment: bool = false,
     27             compute: bool = false,
     28             _padding: u61 = 0,
     29         };
     30 
     31         const BufferBindingLayout = extern struct {
     32             next: ?*ChainedStruct = null,
     33             type: BufferBindingType,
     34             has_dynamic_offset: bool,
     35             min_binding_size: u64,
     36 
     37             const BufferBindingType = enum(u32) {
     38                 binding_not_used = 0x00000000,
     39                 undefined = 0x00000001,
     40                 uniform = 0x00000002,
     41                 storage = 0x00000003,
     42                 read_only_storage = 0x00000004,
     43             };
     44         };
     45 
     46         const SamplerBindingLayout = extern struct {
     47             next: ?*ChainedStruct = null,
     48             type: SamplerBindingType,
     49 
     50             const SamplerBindingType = enum(u32) {
     51                 binding_not_used = 0x00000000,
     52                 undefined = 0x00000001,
     53                 filtering = 0x00000002,
     54                 non_filtering = 0x00000003,
     55                 comparison = 0x00000004,
     56             };
     57         };
     58 
     59         const TextureBindingLayout = extern struct {
     60             next: ?*ChainedStruct = null,
     61             sample_type: Texture.SampleType,
     62             view_dimension: TextureView.Dimension,
     63             multisampled: bool,
     64         };
     65 
     66         const StorageTextureBindingLayout = extern struct {
     67             next: ?*ChainedStruct = null,
     68             access: StorageTextureAccess,
     69             format: Texture.Format,
     70             view_dimension: TextureView.Dimension,
     71 
     72             const StorageTextureAccess = enum(u32) {
     73                 binding_not_used = 0x00000000,
     74                 undefined = 0x00000001,
     75                 write_only = 0x00000002,
     76                 read_only = 0x00000003,
     77                 read_write = 0x00000004,
     78             };
     79         };
     80     };
     81 };