1 module sbylib.wrapper.vulkan.formatproperties;
2 
3 import std;
4 import erupted;
5 import sbylib.wrapper.vulkan.util;
6 
7 struct FormatProperties {
8 
9     struct Feature {
10         VkFormatFeatureFlags flags;
11 
12         bool supports(Flags flag) const {
13             return cast(bool)(this.flags & flag);
14         }
15     }
16 
17     @vkProp() {
18         VkFormatFeatureFlags    linearTilingFeatures;
19         VkFormatFeatureFlags    optimalTilingFeatures;
20         VkFormatFeatureFlags    bufferFeatures;
21     }
22 
23     mixin VkFrom!(VkFormatProperties);
24 
25     enum Flags {
26         SampledImage = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT,
27         StorageImage = VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT,
28         StorageImageAtomic = VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT,
29         UniformTexelBuffer = VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT,
30         StorageTexelBuffer = VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT,
31         StorageTexelBufferAtomic = VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT,
32         VertexBuffer = VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT,
33         ColorAttachment = VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT,
34         ColorAttachmentBlend = VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT,
35         DepthStencilAttachment = VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT,
36         BlitSrc = VK_FORMAT_FEATURE_BLIT_SRC_BIT,
37         BlitDst = VK_FORMAT_FEATURE_BLIT_DST_BIT,
38         SampledImageFilterLinear = VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT,
39         TransferSrc = VK_FORMAT_FEATURE_TRANSFER_SRC_BIT,
40         TransferDst = VK_FORMAT_FEATURE_TRANSFER_DST_BIT,
41         MidpointChromaSamples = VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT,
42         YCBCRConversionLinearFilter = VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT,
43         YCBCRConversionSeparateReconstructionFilter = VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT,
44         SampledImageYCBCRConversionChromaReconstructionExplicit = VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT,
45         SampledImageYCBCRConversionChromaReconstructionExplicitForceable = VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT,
46         Disjoint = VK_FORMAT_FEATURE_DISJOINT_BIT,
47         CositedChromaSamples = VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT,
48         SampedImageFilterCubic = VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG,
49         SampledImageFilterMinMax = VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT_EXT,
50         FragmentDensityMap = VK_FORMAT_FEATURE_FRAGMENT_DENSITY_MAP_BIT_EXT,
51     }
52 
53     Feature linearTiling() {
54         return Feature(linearTilingFeatures);
55     }
56 
57     Feature optimalTiling() {
58         return Feature(optimalTilingFeatures);
59     }
60 
61     Feature buffer() {
62         return Feature(bufferFeatures);
63     }
64 }