kiba-engine
bind.h
1 #pragma once
2 
3 #include <kiba/containers/array.h>
4 #include <kiba/gpu/enums.h>
5 #include <kiba/gpu/types.h>
6 
8  enum {
9  GPU_BINDING_TYPE_BUFFER_UNIFORM,
10  GPU_BINDING_TYPE_BUFFER_STORAGE,
11  GPU_BINDING_TYPE_BUFFER_STORAGE_RO,
12  } type;
13 
14  b8 dynamic_offset;
15  // TODO potentially implement min_binding_size
16 };
17 
19  enum {
20  GPU_BINDING_TYPE_SAMPLER_FILTERING,
21  GPU_BINDING_TYPE_SAMPLER_NON_FILTERING,
22  GPU_BINDING_TYPE_SAMPLER_COMPARISON,
23  } type;
24 };
25 
27  enum {
28  GPU_TEXTURE_SAMPLE_TYPE_FLOAT,
29  GPU_TEXTURE_SAMPLE_TYPE_DEPTH,
30  GPU_TEXTURE_SAMPLE_TYPE_SINT,
31  GPU_TEXTURE_SAMPLE_TYPE_UINT,
32  } sample_type;
33 
34  enum gpu_texture_view_dimension view_dimension;
35 
36  b8 multisampled;
37 };
38 
40  enum {
41  GPU_STORAGE_TEXTURE_ACCESS_RO,
42  GPU_STORAGE_TEXTURE_ACCESS_WO,
43  GPU_STORAGE_TEXTURE_ACCESS_RW,
44  } access;
45  enum gpu_texture_format format;
46  enum gpu_texture_view_dimension view_dimension;
47 };
48 
50  usize binding;
51  enum gpu_shader_stage visibility;
52 
53  union {
54  struct gpu_binding_type_buffer buffer;
55  struct gpu_binding_type_sampler sampler;
56  struct gpu_binding_type_texture texture;
57  struct gpu_binding_type_storage_texture storage_texture;
58  } ty;
59 
60  // TODO consider adding `count` to be able to bind arrays in gpu_bind_group_entry
61 };
62 
64  array_of(struct gpu_bind_group_layout_entry) entries;
65 };
66 
67 typedef VkDescriptorSetLayout gpu_bind_group_layout;
68 
70  usize binding;
71 
72  union {
73  struct {
74  void *handle;
75  usize offset;
76  usize size;
77  } buffer;
78 
79  void *sampler; // TODO proper handles
80  void *texture_view;
81  } resource;
82 };
83 
85  gpu_bind_group_layout layout;
86  array_of(struct gpu_bind_group_entry) entries;
87 };
88 
Definition: bind.h:69
Definition: bind.h:49