1 module sbylib.wrapper.vulkan.descriptorsetlayout;
2 
3 import std;
4 import erupted;
5 import sbylib.wrapper.vulkan.device;
6 import sbylib.wrapper.vulkan.enums;
7 import sbylib.wrapper.vulkan.util;
8 
9 class DescriptorSetLayout {
10     static struct CreateInfo {
11 
12         static struct Binding {
13             @vkProp() {
14                 uint binding;
15                 DescriptorType descriptorType;
16                 uint descriptorCount;
17                 BitFlags!ShaderStage stageFlags;
18                 const(VkSampler)* pImmutableSamplers;
19             }
20 
21             const mixin VkTo!(VkDescriptorSetLayoutBinding);
22         }
23 
24         @vkProp() {
25             VkDescriptorSetLayoutCreateFlags flags;
26         }
27 
28         @vkProp("pBindings", "bindingCount") {
29             Binding[] bindings;
30         }
31 
32         const mixin VkTo!(VkDescriptorSetLayoutCreateInfo);
33     }
34 
35     private Device device;
36     package VkDescriptorSetLayout descriptorSetLayout;
37 
38     mixin ImplNameSetter!(device, descriptorSetLayout, DebugReportObjectType.DescriptorSetLayout);
39 
40     this(Device device, CreateInfo _info) {
41         import std.exception : enforce;
42 
43         this.device = device;
44 
45         auto info = _info.vkTo();
46 
47         enforceVK(vkCreateDescriptorSetLayout(device.device, &info, null, &descriptorSetLayout));
48         enforce(descriptorSetLayout != VK_NULL_HANDLE);
49     }
50 
51     ~this() {
52         vkDestroyDescriptorSetLayout(device.device, descriptorSetLayout, null);
53     }
54 
55     mixin VkTo!(VkDescriptorSetLayout);
56 }