blob: ea393ae3412365367abeeb94ba0810a25c8ec01a [file] [log] [blame]
Dave Houlton3c9fca72017-03-27 17:25:54 -06001/* Copyright (c) 2015-2017 The Khronos Group Inc.
2 * Copyright (c) 2015-2017 Valve Corporation
3 * Copyright (c) 2015-2017 LunarG, Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 * Author: Mark Lobodzinski <mark@lunarg.com>
18 * Author: Courtney Goeltzenleuchter <courtney@LunarG.com>
19 * Author: Dave Houlton <daveh@lunarg.com>
20 */
21
22#pragma once
23#include <stdbool.h>
24#include <vector>
25#include "vulkan/vulkan.h"
26
27#if !defined(VK_LAYER_EXPORT)
28#if defined(__GNUC__) && __GNUC__ >= 4
29#define VK_LAYER_EXPORT __attribute__((visibility("default")))
30#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
31#define VK_LAYER_EXPORT __attribute__((visibility("default")))
32#else
33#define VK_LAYER_EXPORT
34#endif
35#endif
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41typedef enum VkFormatCompatibilityClass {
42 VK_FORMAT_COMPATIBILITY_CLASS_NONE_BIT = 0,
43 VK_FORMAT_COMPATIBILITY_CLASS_8_BIT = 1,
44 VK_FORMAT_COMPATIBILITY_CLASS_16_BIT = 2,
45 VK_FORMAT_COMPATIBILITY_CLASS_24_BIT = 3,
46 VK_FORMAT_COMPATIBILITY_CLASS_32_BIT = 4,
47 VK_FORMAT_COMPATIBILITY_CLASS_48_BIT = 5,
48 VK_FORMAT_COMPATIBILITY_CLASS_64_BIT = 6,
49 VK_FORMAT_COMPATIBILITY_CLASS_96_BIT = 7,
50 VK_FORMAT_COMPATIBILITY_CLASS_128_BIT = 8,
51 VK_FORMAT_COMPATIBILITY_CLASS_192_BIT = 9,
52 VK_FORMAT_COMPATIBILITY_CLASS_256_BIT = 10,
53 VK_FORMAT_COMPATIBILITY_CLASS_BC1_RGB_BIT = 11,
54 VK_FORMAT_COMPATIBILITY_CLASS_BC1_RGBA_BIT = 12,
55 VK_FORMAT_COMPATIBILITY_CLASS_BC2_BIT = 13,
56 VK_FORMAT_COMPATIBILITY_CLASS_BC3_BIT = 14,
57 VK_FORMAT_COMPATIBILITY_CLASS_BC4_BIT = 15,
58 VK_FORMAT_COMPATIBILITY_CLASS_BC5_BIT = 16,
59 VK_FORMAT_COMPATIBILITY_CLASS_BC6H_BIT = 17,
60 VK_FORMAT_COMPATIBILITY_CLASS_BC7_BIT = 18,
61 VK_FORMAT_COMPATIBILITY_CLASS_ETC2_RGB_BIT = 19,
62 VK_FORMAT_COMPATIBILITY_CLASS_ETC2_RGBA_BIT = 20,
63 VK_FORMAT_COMPATIBILITY_CLASS_ETC2_EAC_RGBA_BIT = 21,
64 VK_FORMAT_COMPATIBILITY_CLASS_EAC_R_BIT = 22,
65 VK_FORMAT_COMPATIBILITY_CLASS_EAC_RG_BIT = 23,
66 VK_FORMAT_COMPATIBILITY_CLASS_ASTC_4X4_BIT = 24,
67 VK_FORMAT_COMPATIBILITY_CLASS_ASTC_5X4_BIT = 25,
68 VK_FORMAT_COMPATIBILITY_CLASS_ASTC_5X5_BIT = 26,
69 VK_FORMAT_COMPATIBILITY_CLASS_ASTC_6X5_BIT = 27,
70 VK_FORMAT_COMPATIBILITY_CLASS_ASTC_6X6_BIT = 28,
71 VK_FORMAT_COMPATIBILITY_CLASS_ASTC_8X5_BIT = 29,
72 VK_FORMAT_COMPATIBILITY_CLASS_ASTC_8X6_BIT = 20,
73 VK_FORMAT_COMPATIBILITY_CLASS_ASTC_8X8_BIT = 31,
74 VK_FORMAT_COMPATIBILITY_CLASS_ASTC_10X5_BIT = 32,
75 VK_FORMAT_COMPATIBILITY_CLASS_ASTC_10X6_BIT = 33,
76 VK_FORMAT_COMPATIBILITY_CLASS_ASTC_10X8_BIT = 34,
77 VK_FORMAT_COMPATIBILITY_CLASS_ASTC_10X10_BIT = 35,
78 VK_FORMAT_COMPATIBILITY_CLASS_ASTC_12X10_BIT = 36,
79 VK_FORMAT_COMPATIBILITY_CLASS_ASTC_12X12_BIT = 37,
80 VK_FORMAT_COMPATIBILITY_CLASS_D16_BIT = 38,
81 VK_FORMAT_COMPATIBILITY_CLASS_D24_BIT = 39,
82 VK_FORMAT_COMPATIBILITY_CLASS_D32_BIT = 30,
83 VK_FORMAT_COMPATIBILITY_CLASS_S8_BIT = 41,
84 VK_FORMAT_COMPATIBILITY_CLASS_D16S8_BIT = 42,
85 VK_FORMAT_COMPATIBILITY_CLASS_D24S8_BIT = 43,
86 VK_FORMAT_COMPATIBILITY_CLASS_D32S8_BIT = 44,
87 VK_FORMAT_COMPATIBILITY_CLASS_MAX_ENUM = 45
88} VkFormatCompatibilityClass;
89
Dave Houlton1d2022c2017-03-29 11:43:58 -060090VK_LAYER_EXPORT bool FormatIsDepthOrStencil(VkFormat format);
91VK_LAYER_EXPORT bool FormatIsDepthAndStencil(VkFormat format);
92VK_LAYER_EXPORT bool FormatIsDepthOnly(VkFormat format);
93VK_LAYER_EXPORT bool FormatIsStencilOnly(VkFormat format);
94VK_LAYER_EXPORT bool FormatIsCompressed_ETC2_EAC(VkFormat format);
95VK_LAYER_EXPORT bool FormatIsCompressed_ASTC_LDR(VkFormat format);
96VK_LAYER_EXPORT bool FormatIsCompressed_BC(VkFormat format);
97VK_LAYER_EXPORT bool FormatIsNorm(VkFormat format);
98VK_LAYER_EXPORT bool FormatIsUNorm(VkFormat format);
99VK_LAYER_EXPORT bool FormatIsSNorm(VkFormat format);
100VK_LAYER_EXPORT bool FormatIsInt(VkFormat format);
101VK_LAYER_EXPORT bool FormatIsSInt(VkFormat format);
102VK_LAYER_EXPORT bool FormatIsUInt(VkFormat format);
103VK_LAYER_EXPORT bool FormatIsFloat(VkFormat format);
104VK_LAYER_EXPORT bool FormatIsSRGB(VkFormat format);
105VK_LAYER_EXPORT bool FormatIsUScaled(VkFormat format);
106VK_LAYER_EXPORT bool FormatIsSScaled(VkFormat format);
107VK_LAYER_EXPORT bool FormatIsCompressed(VkFormat format);
Dave Houlton3c9fca72017-03-27 17:25:54 -0600108
Dave Houlton1d2022c2017-03-29 11:43:58 -0600109static inline bool FormatIsUndef(VkFormat format) { return (format == VK_FORMAT_UNDEFINED); }
110static inline bool FormatIsColor(VkFormat format) { return !(FormatIsUndef(format) || FormatIsDepthOrStencil(format)); }
111static inline bool FormatHasDepth(VkFormat format) { return (FormatIsDepthOnly(format) || FormatIsDepthAndStencil(format)); }
112static inline bool FormatHasStencil(VkFormat format) { return (FormatIsStencilOnly(format) || FormatIsDepthAndStencil(format)); }
Dave Houlton3c9fca72017-03-27 17:25:54 -0600113
Dave Houlton1d2022c2017-03-29 11:43:58 -0600114VK_LAYER_EXPORT VkExtent3D FormatCompressedTexelBlockExtent(VkFormat format);
115VK_LAYER_EXPORT size_t FormatSize(VkFormat format);
116VK_LAYER_EXPORT unsigned int FormatChannelCount(VkFormat format);
117VK_LAYER_EXPORT VkFormatCompatibilityClass FormatCompatibilityClass(VkFormat format);
118VK_LAYER_EXPORT VkDeviceSize SafeModulo(VkDeviceSize dividend, VkDeviceSize divisor);
Dave Houlton3c9fca72017-03-27 17:25:54 -0600119
120#ifdef __cplusplus
121}
122#endif