Line data Source code
1 : /**
2 : Copyright (c) 2023 Stappler LLC <admin@stappler.dev>
3 :
4 : Permission is hereby granted, free of charge, to any person obtaining a copy
5 : of this software and associated documentation files (the "Software"), to deal
6 : in the Software without restriction, including without limitation the rights
7 : to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 : copies of the Software, and to permit persons to whom the Software is
9 : furnished to do so, subject to the following conditions:
10 :
11 : The above copyright notice and this permission notice shall be included in
12 : all copies or substantial portions of the Software.
13 :
14 : THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 : IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 : FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 : AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 : LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 : OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 : THE SOFTWARE.
21 : **/
22 :
23 : #include "XLCommon.h"
24 : #include "XLCoreObject.h"
25 : #include "XLCoreInput.h"
26 :
27 : namespace STAPPLER_VERSIONIZED stappler::xenolith::core {
28 :
29 : const ColorMode ColorMode::SolidColor = ColorMode();
30 : const ColorMode ColorMode::IntensityChannel(core::ComponentMapping::R, core::ComponentMapping::One);
31 : const ColorMode ColorMode::AlphaChannel(core::ComponentMapping::One, core::ComponentMapping::R);
32 :
33 32 : String getBufferFlagsDescription(BufferFlags fmt) {
34 32 : StringStream stream;
35 32 : if ((fmt & BufferFlags::SparceBinding) != BufferFlags::None) { stream << " SparceBinding"; }
36 32 : if ((fmt & BufferFlags::SparceResidency) != BufferFlags::None) { stream << " SparceResidency"; }
37 32 : if ((fmt & BufferFlags::SparceAliased) != BufferFlags::None) { stream << " SparceAliased"; }
38 32 : if ((fmt & BufferFlags::Protected) != BufferFlags::None) { stream << " Protected"; }
39 64 : return stream.str();
40 32 : }
41 :
42 32 : String getBufferUsageDescription(BufferUsage fmt) {
43 32 : StringStream stream;
44 32 : if ((fmt & BufferUsage::TransferSrc) != BufferUsage::None) { stream << " TransferSrc"; }
45 32 : if ((fmt & BufferUsage::TransferDst) != BufferUsage::None) { stream << " TransferDst"; }
46 32 : if ((fmt & BufferUsage::UniformTexelBuffer) != BufferUsage::None) { stream << " UniformTexelBuffer"; }
47 32 : if ((fmt & BufferUsage::StorageTexelBuffer) != BufferUsage::None) { stream << " StorageTexelBuffer"; }
48 32 : if ((fmt & BufferUsage::UniformBuffer) != BufferUsage::None) { stream << " UniformBuffer"; }
49 32 : if ((fmt & BufferUsage::StorageBuffer) != BufferUsage::None) { stream << " StorageBuffer"; }
50 32 : if ((fmt & BufferUsage::IndexBuffer) != BufferUsage::None) { stream << " IndexBuffer"; }
51 32 : if ((fmt & BufferUsage::VertexBuffer) != BufferUsage::None) { stream << " VertexBuffer"; }
52 32 : if ((fmt & BufferUsage::IndirectBuffer) != BufferUsage::None) { stream << " IndirectBuffer"; }
53 32 : if ((fmt & BufferUsage::ShaderDeviceAddress) != BufferUsage::None) { stream << " ShaderDeviceAddress"; }
54 32 : if ((fmt & BufferUsage::TransformFeedback) != BufferUsage::None) { stream << " TransformFeedback"; }
55 32 : if ((fmt & BufferUsage::TransformFeedbackCounter) != BufferUsage::None) { stream << " TransformFeedbackCounter"; }
56 32 : if ((fmt & BufferUsage::ConditionalRendering) != BufferUsage::None) { stream << " ConditionalRendering"; }
57 32 : if ((fmt & BufferUsage::AccelerationStructureBuildInputReadOnly) != BufferUsage::None) { stream << " AccelerationStructureBuildInputReadOnly"; }
58 32 : if ((fmt & BufferUsage::AccelerationStructureStorage) != BufferUsage::None) { stream << " AccelerationStructureStorage"; }
59 32 : if ((fmt & BufferUsage::ShaderBindingTable) != BufferUsage::None) { stream << " ShaderBindingTable"; }
60 64 : return stream.str();
61 32 : }
62 :
63 32 : String getImageFlagsDescription(ImageFlags fmt) {
64 32 : StringStream stream;
65 32 : if ((fmt & ImageFlags::SparceBinding) != ImageFlags::None) { stream << " SparceBinding"; }
66 32 : if ((fmt & ImageFlags::SparceResidency) != ImageFlags::None) { stream << " SparceResidency"; }
67 32 : if ((fmt & ImageFlags::SparceAliased) != ImageFlags::None) { stream << " SparceAliased"; }
68 32 : if ((fmt & ImageFlags::MutableFormat) != ImageFlags::None) { stream << " MutableFormat"; }
69 32 : if ((fmt & ImageFlags::CubeCompatible) != ImageFlags::None) { stream << " CubeCompatible"; }
70 32 : if ((fmt & ImageFlags::Alias) != ImageFlags::None) { stream << " Alias"; }
71 32 : if ((fmt & ImageFlags::SplitInstanceBindRegions) != ImageFlags::None) { stream << " SplitInstanceBindRegions"; }
72 32 : if ((fmt & ImageFlags::Array2dCompatible) != ImageFlags::None) { stream << " Array2dCompatible"; }
73 32 : if ((fmt & ImageFlags::BlockTexelViewCompatible) != ImageFlags::None) { stream << " BlockTexelViewCompatible"; }
74 32 : if ((fmt & ImageFlags::ExtendedUsage) != ImageFlags::None) { stream << " ExtendedUsage"; }
75 32 : if ((fmt & ImageFlags::Protected) != ImageFlags::None) { stream << " Protected"; }
76 32 : if ((fmt & ImageFlags::Disjoint) != ImageFlags::None) { stream << " Disjoint"; }
77 64 : return stream.str();
78 32 : }
79 :
80 48 : String getSampleCountDescription(SampleCount fmt) {
81 48 : StringStream stream;
82 48 : if ((fmt & SampleCount::X1) != SampleCount::None) { stream << " x1"; }
83 48 : if ((fmt & SampleCount::X2) != SampleCount::None) { stream << " x2"; }
84 48 : if ((fmt & SampleCount::X4) != SampleCount::None) { stream << " x4"; }
85 48 : if ((fmt & SampleCount::X8) != SampleCount::None) { stream << " x8"; }
86 48 : if ((fmt & SampleCount::X16) != SampleCount::None) { stream << " x16"; }
87 48 : if ((fmt & SampleCount::X32) != SampleCount::None) { stream << " x32"; }
88 48 : if ((fmt & SampleCount::X64) != SampleCount::None) { stream << " x64"; }
89 96 : return stream.str();
90 48 : }
91 :
92 80 : StringView getImageTypeName(ImageType type) {
93 80 : switch (type) {
94 16 : case ImageType::Image1D: return StringView("1D"); break;
95 48 : case ImageType::Image2D: return StringView("2D"); break;
96 16 : case ImageType::Image3D: return StringView("3D"); break;
97 : }
98 0 : return StringView("Unknown");
99 : }
100 :
101 128 : StringView getImageViewTypeName(ImageViewType type) {
102 128 : switch (type) {
103 16 : case ImageViewType::ImageView1D: return StringView("1D"); break;
104 16 : case ImageViewType::ImageView1DArray: return StringView("1DArray"); break;
105 16 : case ImageViewType::ImageView2D: return StringView("2D"); break;
106 16 : case ImageViewType::ImageView2DArray: return StringView("2DArray"); break;
107 16 : case ImageViewType::ImageView3D: return StringView("3D"); break;
108 16 : case ImageViewType::ImageViewCube: return StringView("Cube"); break;
109 32 : case ImageViewType::ImageViewCubeArray: return StringView("CubeArray"); break;
110 : }
111 0 : return StringView("Unknown");
112 : }
113 :
114 2947472 : StringView getImageFormatName(ImageFormat fmt) {
115 2947472 : switch (fmt) {
116 48 : case ImageFormat::Undefined: return StringView("Undefined"); break;
117 16 : case ImageFormat::R4G4_UNORM_PACK8: return StringView("R4G4_UNORM_PACK8"); break;
118 16 : case ImageFormat::R4G4B4A4_UNORM_PACK16: return StringView("R4G4B4A4_UNORM_PACK16"); break;
119 16 : case ImageFormat::B4G4R4A4_UNORM_PACK16: return StringView("B4G4R4A4_UNORM_PACK16"); break;
120 16 : case ImageFormat::R5G6B5_UNORM_PACK16: return StringView("R5G6B5_UNORM_PACK16"); break;
121 16 : case ImageFormat::B5G6R5_UNORM_PACK16: return StringView("B5G6R5_UNORM_PACK16"); break;
122 16 : case ImageFormat::R5G5B5A1_UNORM_PACK16: return StringView("R5G5B5A1_UNORM_PACK16"); break;
123 16 : case ImageFormat::B5G5R5A1_UNORM_PACK16: return StringView("B5G5R5A1_UNORM_PACK16"); break;
124 16 : case ImageFormat::A1R5G5B5_UNORM_PACK16: return StringView("A1R5G5B5_UNORM_PACK16"); break;
125 16 : case ImageFormat::R8_UNORM: return StringView("R8_UNORM"); break;
126 16 : case ImageFormat::R8_SNORM: return StringView("R8_SNORM"); break;
127 16 : case ImageFormat::R8_USCALED: return StringView("R8_USCALED"); break;
128 16 : case ImageFormat::R8_SSCALED: return StringView("R8_SSCALED"); break;
129 16 : case ImageFormat::R8_UINT: return StringView("R8_UINT"); break;
130 16 : case ImageFormat::R8_SINT: return StringView("R8_SINT"); break;
131 16 : case ImageFormat::R8_SRGB: return StringView("R8_SRGB"); break;
132 16 : case ImageFormat::R8G8_UNORM: return StringView("R8G8_UNORM"); break;
133 16 : case ImageFormat::R8G8_SNORM: return StringView("R8G8_SNORM"); break;
134 16 : case ImageFormat::R8G8_USCALED: return StringView("R8G8_USCALED"); break;
135 16 : case ImageFormat::R8G8_SSCALED: return StringView("R8G8_SSCALED"); break;
136 16 : case ImageFormat::R8G8_UINT: return StringView("R8G8_UINT"); break;
137 16 : case ImageFormat::R8G8_SINT: return StringView("R8G8_SINT"); break;
138 16 : case ImageFormat::R8G8_SRGB: return StringView("R8G8_SRGB"); break;
139 16 : case ImageFormat::R8G8B8_UNORM: return StringView("R8G8B8_UNORM"); break;
140 16 : case ImageFormat::R8G8B8_SNORM: return StringView("R8G8B8_SNORM"); break;
141 16 : case ImageFormat::R8G8B8_USCALED: return StringView("R8G8B8_USCALED"); break;
142 16 : case ImageFormat::R8G8B8_SSCALED: return StringView("R8G8B8_SSCALED"); break;
143 16 : case ImageFormat::R8G8B8_UINT: return StringView("R8G8B8_UINT"); break;
144 16 : case ImageFormat::R8G8B8_SINT: return StringView("R8G8B8_SINT"); break;
145 16 : case ImageFormat::R8G8B8_SRGB: return StringView("R8G8B8_SRGB"); break;
146 16 : case ImageFormat::B8G8R8_UNORM: return StringView("B8G8R8_UNORM"); break;
147 16 : case ImageFormat::B8G8R8_SNORM: return StringView("B8G8R8_SNORM"); break;
148 16 : case ImageFormat::B8G8R8_USCALED: return StringView("B8G8R8_USCALED"); break;
149 16 : case ImageFormat::B8G8R8_SSCALED: return StringView("B8G8R8_SSCALED"); break;
150 16 : case ImageFormat::B8G8R8_UINT: return StringView("B8G8R8_UINT"); break;
151 16 : case ImageFormat::B8G8R8_SINT: return StringView("B8G8R8_SINT"); break;
152 16 : case ImageFormat::B8G8R8_SRGB: return StringView("B8G8R8_SRGB"); break;
153 48 : case ImageFormat::R8G8B8A8_UNORM: return StringView("R8G8B8A8_UNORM"); break;
154 16 : case ImageFormat::R8G8B8A8_SNORM: return StringView("R8G8B8A8_SNORM"); break;
155 16 : case ImageFormat::R8G8B8A8_USCALED: return StringView("R8G8B8A8_USCALED"); break;
156 16 : case ImageFormat::R8G8B8A8_SSCALED: return StringView("R8G8B8A8_SSCALED"); break;
157 16 : case ImageFormat::R8G8B8A8_UINT: return StringView("R8G8B8A8_UINT"); break;
158 16 : case ImageFormat::R8G8B8A8_SINT: return StringView("R8G8B8A8_SINT"); break;
159 16 : case ImageFormat::R8G8B8A8_SRGB: return StringView("R8G8B8A8_SRGB"); break;
160 48 : case ImageFormat::B8G8R8A8_UNORM: return StringView("B8G8R8A8_UNORM"); break;
161 16 : case ImageFormat::B8G8R8A8_SNORM: return StringView("B8G8R8A8_SNORM"); break;
162 16 : case ImageFormat::B8G8R8A8_USCALED: return StringView("B8G8R8A8_USCALED"); break;
163 16 : case ImageFormat::B8G8R8A8_SSCALED: return StringView("B8G8R8A8_SSCALED"); break;
164 16 : case ImageFormat::B8G8R8A8_UINT: return StringView("B8G8R8A8_UINT"); break;
165 16 : case ImageFormat::B8G8R8A8_SINT: return StringView("B8G8R8A8_SINT"); break;
166 16 : case ImageFormat::B8G8R8A8_SRGB: return StringView("B8G8R8A8_SRGB"); break;
167 16 : case ImageFormat::A8B8G8R8_UNORM_PACK32: return StringView("A8B8G8R8_UNORM_PACK32"); break;
168 16 : case ImageFormat::A8B8G8R8_SNORM_PACK32: return StringView("A8B8G8R8_SNORM_PACK32"); break;
169 16 : case ImageFormat::A8B8G8R8_USCALED_PACK32: return StringView("A8B8G8R8_USCALED_PACK32"); break;
170 16 : case ImageFormat::A8B8G8R8_SSCALED_PACK32: return StringView("A8B8G8R8_SSCALED_PACK32"); break;
171 16 : case ImageFormat::A8B8G8R8_UINT_PACK32: return StringView("A8B8G8R8_UINT_PACK32"); break;
172 16 : case ImageFormat::A8B8G8R8_SINT_PACK32: return StringView("A8B8G8R8_SINT_PACK32"); break;
173 16 : case ImageFormat::A8B8G8R8_SRGB_PACK32: return StringView("A8B8G8R8_SRGB_PACK32"); break;
174 16 : case ImageFormat::A2R10G10B10_UNORM_PACK32: return StringView("A2R10G10B10_UNORM_PACK32"); break;
175 16 : case ImageFormat::A2R10G10B10_SNORM_PACK32: return StringView("A2R10G10B10_SNORM_PACK32"); break;
176 16 : case ImageFormat::A2R10G10B10_USCALED_PACK32: return StringView("A2R10G10B10_USCALED_PACK32"); break;
177 16 : case ImageFormat::A2R10G10B10_SSCALED_PACK32: return StringView("A2R10G10B10_SSCALED_PACK32"); break;
178 16 : case ImageFormat::A2R10G10B10_UINT_PACK32: return StringView("A2R10G10B10_UINT_PACK32"); break;
179 16 : case ImageFormat::A2R10G10B10_SINT_PACK32: return StringView("A2R10G10B10_SINT_PACK32"); break;
180 16 : case ImageFormat::A2B10G10R10_UNORM_PACK32: return StringView("A2B10G10R10_UNORM_PACK32"); break;
181 16 : case ImageFormat::A2B10G10R10_SNORM_PACK32: return StringView("A2B10G10R10_SNORM_PACK32"); break;
182 16 : case ImageFormat::A2B10G10R10_USCALED_PACK32: return StringView("A2B10G10R10_USCALED_PACK32"); break;
183 16 : case ImageFormat::A2B10G10R10_SSCALED_PACK32: return StringView("A2B10G10R10_SSCALED_PACK32"); break;
184 16 : case ImageFormat::A2B10G10R10_UINT_PACK32: return StringView("A2B10G10R10_UINT_PACK32"); break;
185 16 : case ImageFormat::A2B10G10R10_SINT_PACK32: return StringView("A2B10G10R10_SINT_PACK32"); break;
186 16 : case ImageFormat::R16_UNORM: return StringView("R16_UNORM"); break;
187 16 : case ImageFormat::R16_SNORM: return StringView("R16_SNORM"); break;
188 16 : case ImageFormat::R16_USCALED: return StringView("R16_USCALED"); break;
189 16 : case ImageFormat::R16_SSCALED: return StringView("R16_SSCALED"); break;
190 16 : case ImageFormat::R16_UINT: return StringView("R16_UINT"); break;
191 16 : case ImageFormat::R16_SINT: return StringView("R16_SINT"); break;
192 16 : case ImageFormat::R16_SFLOAT: return StringView("R16_SFLOAT"); break;
193 16 : case ImageFormat::R16G16_UNORM: return StringView("R16G16_UNORM"); break;
194 16 : case ImageFormat::R16G16_SNORM: return StringView("R16G16_SNORM"); break;
195 16 : case ImageFormat::R16G16_USCALED: return StringView("R16G16_USCALED"); break;
196 16 : case ImageFormat::R16G16_SSCALED: return StringView("R16G16_SSCALED"); break;
197 16 : case ImageFormat::R16G16_UINT: return StringView("R16G16_UINT"); break;
198 16 : case ImageFormat::R16G16_SINT: return StringView("R16G16_SINT"); break;
199 16 : case ImageFormat::R16G16_SFLOAT: return StringView("R16G16_SFLOAT"); break;
200 16 : case ImageFormat::R16G16B16_UNORM: return StringView("R16G16B16_UNORM"); break;
201 16 : case ImageFormat::R16G16B16_SNORM: return StringView("R16G16B16_SNORM"); break;
202 16 : case ImageFormat::R16G16B16_USCALED: return StringView("R16G16B16_USCALED"); break;
203 16 : case ImageFormat::R16G16B16_SSCALED: return StringView("R16G16B16_SSCALED"); break;
204 16 : case ImageFormat::R16G16B16_UINT: return StringView("R16G16B16_UINT"); break;
205 16 : case ImageFormat::R16G16B16_SINT: return StringView("R16G16B16_SINT"); break;
206 16 : case ImageFormat::R16G16B16_SFLOAT: return StringView("R16G16B16_SFLOAT"); break;
207 16 : case ImageFormat::R16G16B16A16_UNORM: return StringView("R16G16B16A16_UNORM"); break;
208 16 : case ImageFormat::R16G16B16A16_SNORM: return StringView("R16G16B16A16_SNORM"); break;
209 16 : case ImageFormat::R16G16B16A16_USCALED: return StringView("R16G16B16A16_USCALED"); break;
210 16 : case ImageFormat::R16G16B16A16_SSCALED: return StringView("R16G16B16A16_SSCALED"); break;
211 16 : case ImageFormat::R16G16B16A16_UINT: return StringView("R16G16B16A16_UINT"); break;
212 16 : case ImageFormat::R16G16B16A16_SINT: return StringView("R16G16B16A16_SINT"); break;
213 16 : case ImageFormat::R16G16B16A16_SFLOAT: return StringView("R16G16B16A16_SFLOAT"); break;
214 16 : case ImageFormat::R32_UINT: return StringView("R32_UINT"); break;
215 16 : case ImageFormat::R32_SINT: return StringView("R32_SINT"); break;
216 16 : case ImageFormat::R32_SFLOAT: return StringView("R32_SFLOAT"); break;
217 16 : case ImageFormat::R32G32_UINT: return StringView("R32G32_UINT"); break;
218 16 : case ImageFormat::R32G32_SINT: return StringView("R32G32_SINT"); break;
219 16 : case ImageFormat::R32G32_SFLOAT: return StringView("R32G32_SFLOAT"); break;
220 16 : case ImageFormat::R32G32B32_UINT: return StringView("R32G32B32_UINT"); break;
221 16 : case ImageFormat::R32G32B32_SINT: return StringView("R32G32B32_SINT"); break;
222 16 : case ImageFormat::R32G32B32_SFLOAT: return StringView("R32G32B32_SFLOAT"); break;
223 16 : case ImageFormat::R32G32B32A32_UINT: return StringView("R32G32B32A32_UINT"); break;
224 16 : case ImageFormat::R32G32B32A32_SINT: return StringView("R32G32B32A32_SINT"); break;
225 16 : case ImageFormat::R32G32B32A32_SFLOAT: return StringView("R32G32B32A32_SFLOAT"); break;
226 16 : case ImageFormat::R64_UINT: return StringView("R64_UINT"); break;
227 16 : case ImageFormat::R64_SINT: return StringView("R64_SINT"); break;
228 16 : case ImageFormat::R64_SFLOAT: return StringView("R64_SFLOAT"); break;
229 16 : case ImageFormat::R64G64_UINT: return StringView("R64G64_UINT"); break;
230 16 : case ImageFormat::R64G64_SINT: return StringView("R64G64_SINT"); break;
231 16 : case ImageFormat::R64G64_SFLOAT: return StringView("R64G64_SFLOAT"); break;
232 16 : case ImageFormat::R64G64B64_UINT: return StringView("R64G64B64_UINT"); break;
233 16 : case ImageFormat::R64G64B64_SINT: return StringView("R64G64B64_SINT"); break;
234 16 : case ImageFormat::R64G64B64_SFLOAT: return StringView("R64G64B64_SFLOAT"); break;
235 16 : case ImageFormat::R64G64B64A64_UINT: return StringView("R64G64B64A64_UINT"); break;
236 16 : case ImageFormat::R64G64B64A64_SINT: return StringView("R64G64B64A64_SINT"); break;
237 16 : case ImageFormat::R64G64B64A64_SFLOAT: return StringView("R64G64B64A64_SFLOAT"); break;
238 16 : case ImageFormat::B10G11R11_UFLOAT_PACK32: return StringView("B10G11R11_UFLOAT_PACK32"); break;
239 16 : case ImageFormat::E5B9G9R9_UFLOAT_PACK32: return StringView("E5B9G9R9_UFLOAT_PACK32"); break;
240 16 : case ImageFormat::D16_UNORM: return StringView("D16_UNORM"); break;
241 16 : case ImageFormat::X8_D24_UNORM_PACK32: return StringView("X8_D24_UNORM_PACK32"); break;
242 16 : case ImageFormat::D32_SFLOAT: return StringView("D32_SFLOAT"); break;
243 16 : case ImageFormat::S8_UINT: return StringView("S8_UINT"); break;
244 16 : case ImageFormat::D16_UNORM_S8_UINT: return StringView("D16_UNORM_S8_UINT"); break;
245 16 : case ImageFormat::D24_UNORM_S8_UINT: return StringView("D24_UNORM_S8_UINT"); break;
246 16 : case ImageFormat::D32_SFLOAT_S8_UINT: return StringView("D32_SFLOAT_S8_UINT"); break;
247 16 : case ImageFormat::BC1_RGB_UNORM_BLOCK: return StringView("BC1_RGB_UNORM_BLOCK"); break;
248 16 : case ImageFormat::BC1_RGB_SRGB_BLOCK: return StringView("BC1_RGB_SRGB_BLOCK"); break;
249 16 : case ImageFormat::BC1_RGBA_UNORM_BLOCK: return StringView("BC1_RGBA_UNORM_BLOCK"); break;
250 16 : case ImageFormat::BC1_RGBA_SRGB_BLOCK: return StringView("BC1_RGBA_SRGB_BLOCK"); break;
251 16 : case ImageFormat::BC2_UNORM_BLOCK: return StringView("BC2_UNORM_BLOCK"); break;
252 16 : case ImageFormat::BC2_SRGB_BLOCK: return StringView("BC2_SRGB_BLOCK"); break;
253 16 : case ImageFormat::BC3_UNORM_BLOCK: return StringView("BC3_UNORM_BLOCK"); break;
254 16 : case ImageFormat::BC3_SRGB_BLOCK: return StringView("BC3_SRGB_BLOCK"); break;
255 16 : case ImageFormat::BC4_UNORM_BLOCK: return StringView("BC4_UNORM_BLOCK"); break;
256 16 : case ImageFormat::BC4_SNORM_BLOCK: return StringView("BC4_SNORM_BLOCK"); break;
257 16 : case ImageFormat::BC5_UNORM_BLOCK: return StringView("BC5_UNORM_BLOCK"); break;
258 16 : case ImageFormat::BC5_SNORM_BLOCK: return StringView("BC5_SNORM_BLOCK"); break;
259 16 : case ImageFormat::BC6H_UFLOAT_BLOCK: return StringView("BC6H_UFLOAT_BLOCK"); break;
260 16 : case ImageFormat::BC6H_SFLOAT_BLOCK: return StringView("BC6H_SFLOAT_BLOCK"); break;
261 16 : case ImageFormat::BC7_UNORM_BLOCK: return StringView("BC7_UNORM_BLOCK"); break;
262 16 : case ImageFormat::BC7_SRGB_BLOCK: return StringView("BC7_SRGB_BLOCK"); break;
263 16 : case ImageFormat::ETC2_R8G8B8_UNORM_BLOCK: return StringView("ETC2_R8G8B8_UNORM_BLOCK"); break;
264 16 : case ImageFormat::ETC2_R8G8B8_SRGB_BLOCK: return StringView("ETC2_R8G8B8_SRGB_BLOCK"); break;
265 16 : case ImageFormat::ETC2_R8G8B8A1_UNORM_BLOCK: return StringView("ETC2_R8G8B8A1_UNORM_BLOCK"); break;
266 16 : case ImageFormat::ETC2_R8G8B8A1_SRGB_BLOCK: return StringView("ETC2_R8G8B8A1_SRGB_BLOCK"); break;
267 16 : case ImageFormat::ETC2_R8G8B8A8_UNORM_BLOCK: return StringView("ETC2_R8G8B8A8_UNORM_BLOCK"); break;
268 16 : case ImageFormat::ETC2_R8G8B8A8_SRGB_BLOCK: return StringView("ETC2_R8G8B8A8_SRGB_BLOCK"); break;
269 16 : case ImageFormat::EAC_R11_UNORM_BLOCK: return StringView("EAC_R11_UNORM_BLOCK"); break;
270 16 : case ImageFormat::EAC_R11_SNORM_BLOCK: return StringView("EAC_R11_SNORM_BLOCK"); break;
271 16 : case ImageFormat::EAC_R11G11_UNORM_BLOCK: return StringView("EAC_R11G11_UNORM_BLOCK"); break;
272 16 : case ImageFormat::EAC_R11G11_SNORM_BLOCK: return StringView("EAC_R11G11_SNORM_BLOCK"); break;
273 16 : case ImageFormat::ASTC_4x4_UNORM_BLOCK: return StringView("ASTC_4x4_UNORM_BLOCK"); break;
274 16 : case ImageFormat::ASTC_4x4_SRGB_BLOCK: return StringView("ASTC_4x4_SRGB_BLOCK"); break;
275 16 : case ImageFormat::ASTC_5x4_UNORM_BLOCK: return StringView("ASTC_5x4_UNORM_BLOCK"); break;
276 16 : case ImageFormat::ASTC_5x4_SRGB_BLOCK: return StringView("ASTC_5x4_SRGB_BLOCK"); break;
277 16 : case ImageFormat::ASTC_5x5_UNORM_BLOCK: return StringView("ASTC_5x5_UNORM_BLOCK"); break;
278 16 : case ImageFormat::ASTC_5x5_SRGB_BLOCK: return StringView("ASTC_5x5_SRGB_BLOCK"); break;
279 16 : case ImageFormat::ASTC_6x5_UNORM_BLOCK: return StringView("ASTC_6x5_UNORM_BLOCK"); break;
280 16 : case ImageFormat::ASTC_6x5_SRGB_BLOCK: return StringView("ASTC_6x5_SRGB_BLOCK"); break;
281 16 : case ImageFormat::ASTC_6x6_UNORM_BLOCK: return StringView("ASTC_6x6_UNORM_BLOCK"); break;
282 16 : case ImageFormat::ASTC_6x6_SRGB_BLOCK: return StringView("ASTC_6x6_SRGB_BLOCK"); break;
283 16 : case ImageFormat::ASTC_8x5_UNORM_BLOCK: return StringView("ASTC_8x5_UNORM_BLOCK"); break;
284 16 : case ImageFormat::ASTC_8x5_SRGB_BLOCK: return StringView("ASTC_8x5_SRGB_BLOCK"); break;
285 16 : case ImageFormat::ASTC_8x6_UNORM_BLOCK: return StringView("ASTC_8x6_UNORM_BLOCK"); break;
286 16 : case ImageFormat::ASTC_8x6_SRGB_BLOCK: return StringView("ASTC_8x6_SRGB_BLOCK"); break;
287 16 : case ImageFormat::ASTC_8x8_UNORM_BLOCK: return StringView("ASTC_8x8_UNORM_BLOCK"); break;
288 16 : case ImageFormat::ASTC_8x8_SRGB_BLOCK: return StringView("ASTC_8x8_SRGB_BLOCK"); break;
289 16 : case ImageFormat::ASTC_10x5_UNORM_BLOCK: return StringView("ASTC_10x5_UNORM_BLOCK"); break;
290 16 : case ImageFormat::ASTC_10x5_SRGB_BLOCK: return StringView("ASTC_10x5_SRGB_BLOCK"); break;
291 16 : case ImageFormat::ASTC_10x6_UNORM_BLOCK: return StringView("ASTC_10x6_UNORM_BLOCK"); break;
292 16 : case ImageFormat::ASTC_10x6_SRGB_BLOCK: return StringView("ASTC_10x6_SRGB_BLOCK"); break;
293 16 : case ImageFormat::ASTC_10x8_UNORM_BLOCK: return StringView("ASTC_10x8_UNORM_BLOCK"); break;
294 16 : case ImageFormat::ASTC_10x8_SRGB_BLOCK: return StringView("ASTC_10x8_SRGB_BLOCK"); break;
295 16 : case ImageFormat::ASTC_10x10_UNORM_BLOCK: return StringView("ASTC_10x10_UNORM_BLOCK"); break;
296 16 : case ImageFormat::ASTC_10x10_SRGB_BLOCK: return StringView("ASTC_10x10_SRGB_BLOCK"); break;
297 16 : case ImageFormat::ASTC_12x10_UNORM_BLOCK: return StringView("ASTC_12x10_UNORM_BLOCK"); break;
298 16 : case ImageFormat::ASTC_12x10_SRGB_BLOCK: return StringView("ASTC_12x10_SRGB_BLOCK"); break;
299 16 : case ImageFormat::ASTC_12x12_UNORM_BLOCK: return StringView("ASTC_12x12_UNORM_BLOCK"); break;
300 16 : case ImageFormat::ASTC_12x12_SRGB_BLOCK: return StringView("ASTC_12x12_SRGB_BLOCK"); break;
301 16 : case ImageFormat::G8B8G8R8_422_UNORM: return StringView("G8B8G8R8_422_UNORM"); break;
302 16 : case ImageFormat::B8G8R8G8_422_UNORM: return StringView("B8G8R8G8_422_UNORM"); break;
303 16 : case ImageFormat::G8_B8_R8_3PLANE_420_UNORM: return StringView("G8_B8_R8_3PLANE_420_UNORM"); break;
304 16 : case ImageFormat::G8_B8R8_2PLANE_420_UNORM: return StringView("G8_B8R8_2PLANE_420_UNORM"); break;
305 16 : case ImageFormat::G8_B8_R8_3PLANE_422_UNORM: return StringView("G8_B8_R8_3PLANE_422_UNORM"); break;
306 16 : case ImageFormat::G8_B8R8_2PLANE_422_UNORM: return StringView("G8_B8R8_2PLANE_422_UNORM"); break;
307 16 : case ImageFormat::G8_B8_R8_3PLANE_444_UNORM: return StringView("G8_B8_R8_3PLANE_444_UNORM"); break;
308 16 : case ImageFormat::R10X6_UNORM_PACK16: return StringView("R10X6_UNORM_PACK16"); break;
309 16 : case ImageFormat::R10X6G10X6_UNORM_2PACK16: return StringView("R10X6G10X6_UNORM_2PACK16"); break;
310 16 : case ImageFormat::R10X6G10X6B10X6A10X6_UNORM_4PACK16: return StringView("R10X6G10X6B10X6A10X6_UNORM_4PACK16"); break;
311 16 : case ImageFormat::G10X6B10X6G10X6R10X6_422_UNORM_4PACK16: return StringView("G10X6B10X6G10X6R10X6_422_UNORM_4PACK16"); break;
312 16 : case ImageFormat::B10X6G10X6R10X6G10X6_422_UNORM_4PACK16: return StringView("B10X6G10X6R10X6G10X6_422_UNORM_4PACK16"); break;
313 16 : case ImageFormat::G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16: return StringView("G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16"); break;
314 16 : case ImageFormat::G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16: return StringView("G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16"); break;
315 16 : case ImageFormat::G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16: return StringView("G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16"); break;
316 16 : case ImageFormat::G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16: return StringView("G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16"); break;
317 16 : case ImageFormat::G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16: return StringView("G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16"); break;
318 16 : case ImageFormat::R12X4_UNORM_PACK16: return StringView("R12X4_UNORM_PACK16"); break;
319 16 : case ImageFormat::R12X4G12X4_UNORM_2PACK16: return StringView("R12X4G12X4_UNORM_2PACK16"); break;
320 16 : case ImageFormat::R12X4G12X4B12X4A12X4_UNORM_4PACK16: return StringView("R12X4G12X4B12X4A12X4_UNORM_4PACK16"); break;
321 16 : case ImageFormat::G12X4B12X4G12X4R12X4_422_UNORM_4PACK16: return StringView("G12X4B12X4G12X4R12X4_422_UNORM_4PACK16"); break;
322 16 : case ImageFormat::B12X4G12X4R12X4G12X4_422_UNORM_4PACK16: return StringView("B12X4G12X4R12X4G12X4_422_UNORM_4PACK16"); break;
323 16 : case ImageFormat::G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16: return StringView("G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16"); break;
324 16 : case ImageFormat::G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16: return StringView("G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16"); break;
325 16 : case ImageFormat::G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16: return StringView("G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16"); break;
326 16 : case ImageFormat::G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16: return StringView("G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16"); break;
327 16 : case ImageFormat::G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16: return StringView("G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16"); break;
328 16 : case ImageFormat::G16B16G16R16_422_UNORM: return StringView("G16B16G16R16_422_UNORM"); break;
329 16 : case ImageFormat::B16G16R16G16_422_UNORM: return StringView("B16G16R16G16_422_UNORM"); break;
330 16 : case ImageFormat::G16_B16_R16_3PLANE_420_UNORM: return StringView("G16_B16_R16_3PLANE_420_UNORM"); break;
331 16 : case ImageFormat::G16_B16R16_2PLANE_420_UNORM: return StringView("G16_B16R16_2PLANE_420_UNORM"); break;
332 16 : case ImageFormat::G16_B16_R16_3PLANE_422_UNORM: return StringView("G16_B16_R16_3PLANE_422_UNORM"); break;
333 16 : case ImageFormat::G16_B16R16_2PLANE_422_UNORM: return StringView("G16_B16R16_2PLANE_422_UNORM"); break;
334 16 : case ImageFormat::G16_B16_R16_3PLANE_444_UNORM: return StringView("G16_B16_R16_3PLANE_444_UNORM"); break;
335 16 : case ImageFormat::PVRTC1_2BPP_UNORM_BLOCK_IMG: return StringView("PVRTC1_2BPP_UNORM_BLOCK_IMG"); break;
336 16 : case ImageFormat::PVRTC1_4BPP_UNORM_BLOCK_IMG: return StringView("PVRTC1_4BPP_UNORM_BLOCK_IMG"); break;
337 16 : case ImageFormat::PVRTC2_2BPP_UNORM_BLOCK_IMG: return StringView("PVRTC2_2BPP_UNORM_BLOCK_IMG"); break;
338 16 : case ImageFormat::PVRTC2_4BPP_UNORM_BLOCK_IMG: return StringView("PVRTC2_4BPP_UNORM_BLOCK_IMG"); break;
339 16 : case ImageFormat::PVRTC1_2BPP_SRGB_BLOCK_IMG: return StringView("PVRTC1_2BPP_SRGB_BLOCK_IMG"); break;
340 16 : case ImageFormat::PVRTC1_4BPP_SRGB_BLOCK_IMG: return StringView("PVRTC1_4BPP_SRGB_BLOCK_IMG"); break;
341 16 : case ImageFormat::PVRTC2_2BPP_SRGB_BLOCK_IMG: return StringView("PVRTC2_2BPP_SRGB_BLOCK_IMG"); break;
342 16 : case ImageFormat::PVRTC2_4BPP_SRGB_BLOCK_IMG: return StringView("PVRTC2_4BPP_SRGB_BLOCK_IMG"); break;
343 16 : case ImageFormat::ASTC_4x4_SFLOAT_BLOCK_EXT: return StringView("ASTC_4x4_SFLOAT_BLOCK_EXT"); break;
344 16 : case ImageFormat::ASTC_5x4_SFLOAT_BLOCK_EXT: return StringView("ASTC_5x4_SFLOAT_BLOCK_EXT"); break;
345 16 : case ImageFormat::ASTC_5x5_SFLOAT_BLOCK_EXT: return StringView("ASTC_5x5_SFLOAT_BLOCK_EXT"); break;
346 16 : case ImageFormat::ASTC_6x5_SFLOAT_BLOCK_EXT: return StringView("ASTC_6x5_SFLOAT_BLOCK_EXT"); break;
347 16 : case ImageFormat::ASTC_6x6_SFLOAT_BLOCK_EXT: return StringView("ASTC_6x6_SFLOAT_BLOCK_EXT"); break;
348 16 : case ImageFormat::ASTC_8x5_SFLOAT_BLOCK_EXT: return StringView("ASTC_8x5_SFLOAT_BLOCK_EXT"); break;
349 16 : case ImageFormat::ASTC_8x6_SFLOAT_BLOCK_EXT: return StringView("ASTC_8x6_SFLOAT_BLOCK_EXT"); break;
350 16 : case ImageFormat::ASTC_8x8_SFLOAT_BLOCK_EXT: return StringView("ASTC_8x8_SFLOAT_BLOCK_EXT"); break;
351 16 : case ImageFormat::ASTC_10x5_SFLOAT_BLOCK_EXT: return StringView("ASTC_10x5_SFLOAT_BLOCK_EXT"); break;
352 16 : case ImageFormat::ASTC_10x6_SFLOAT_BLOCK_EXT: return StringView("ASTC_10x6_SFLOAT_BLOCK_EXT"); break;
353 16 : case ImageFormat::ASTC_10x8_SFLOAT_BLOCK_EXT: return StringView("ASTC_10x8_SFLOAT_BLOCK_EXT"); break;
354 16 : case ImageFormat::ASTC_10x10_SFLOAT_BLOCK_EXT: return StringView("ASTC_10x10_SFLOAT_BLOCK_EXT"); break;
355 16 : case ImageFormat::ASTC_12x10_SFLOAT_BLOCK_EXT: return StringView("ASTC_12x10_SFLOAT_BLOCK_EXT"); break;
356 16 : case ImageFormat::ASTC_12x12_SFLOAT_BLOCK_EXT: return StringView("ASTC_12x12_SFLOAT_BLOCK_EXT"); break;
357 16 : case ImageFormat::G8_B8R8_2PLANE_444_UNORM_EXT: return StringView("G8_B8R8_2PLANE_444_UNORM_EXT"); break;
358 16 : case ImageFormat::G10X6_B10X6R10X6_2PLANE_444_UNORM_3PACK16_EXT: return StringView("G10X6_B10X6R10X6_2PLANE_444_UNORM_3PACK16_EXT"); break;
359 16 : case ImageFormat::G12X4_B12X4R12X4_2PLANE_444_UNORM_3PACK16_EXT: return StringView("G12X4_B12X4R12X4_2PLANE_444_UNORM_3PACK16_EXT"); break;
360 16 : case ImageFormat::G16_B16R16_2PLANE_444_UNORM_EXT: return StringView("G16_B16R16_2PLANE_444_UNORM_EXT"); break;
361 16 : case ImageFormat::A4R4G4B4_UNORM_PACK16_EXT: return StringView("A4R4G4B4_UNORM_PACK16_EXT"); break;
362 16 : case ImageFormat::A4B4G4R4_UNORM_PACK16_EXT: return StringView("A4B4G4R4_UNORM_PACK16_EXT"); break;
363 : }
364 2943424 : return StringView("Unknown");
365 : }
366 :
367 64 : StringView getImageTilingName(ImageTiling type) {
368 64 : switch (type) {
369 48 : case ImageTiling::Optimal: return StringView("Optimal"); break;
370 16 : case ImageTiling::Linear: return StringView("Linear"); break;
371 : }
372 0 : return StringView("Unknown");
373 : }
374 :
375 176 : StringView getComponentMappingName(ComponentMapping mapping) {
376 176 : switch (mapping) {
377 80 : case ComponentMapping::Identity: return StringView("Id"); break;
378 16 : case ComponentMapping::Zero: return StringView("0"); break;
379 16 : case ComponentMapping::One: return StringView("1"); break;
380 16 : case ComponentMapping::R: return StringView("R"); break;
381 16 : case ComponentMapping::G: return StringView("G"); break;
382 16 : case ComponentMapping::B: return StringView("B"); break;
383 16 : case ComponentMapping::A: return StringView("A"); break;
384 : }
385 0 : return StringView("Unknown");
386 : }
387 :
388 144 : StringView getPresentModeName(PresentMode mode) {
389 144 : switch (mode) {
390 48 : case PresentMode::Immediate: return "IMMEDIATE"; break;
391 32 : case PresentMode::Mailbox: return "MAILBOX"; break;
392 32 : case PresentMode::Fifo: return "FIFO"; break;
393 16 : case PresentMode::FifoRelaxed: return "FIFO_RELAXED"; break;
394 16 : default: return "UNKNOWN"; break;
395 : }
396 : return StringView();
397 : }
398 :
399 1744080 : StringView getColorSpaceName(ColorSpace fmt) {
400 1744080 : switch (fmt) {
401 80 : case ColorSpace::SRGB_NONLINEAR_KHR: return StringView("SRGB_NONLINEAR_KHR"); break;
402 16 : case ColorSpace::DISPLAY_P3_NONLINEAR_EXT: return StringView("DISPLAY_P3_NONLINEAR_EXT"); break;
403 16 : case ColorSpace::EXTENDED_SRGB_LINEAR_EXT: return StringView("EXTENDED_SRGB_LINEAR_EXT"); break;
404 16 : case ColorSpace::DISPLAY_P3_LINEAR_EXT: return StringView("DISPLAY_P3_LINEAR_EXT"); break;
405 16 : case ColorSpace::DCI_P3_NONLINEAR_EXT: return StringView("DCI_P3_NONLINEAR_EXT"); break;
406 16 : case ColorSpace::BT709_LINEAR_EXT: return StringView("BT709_LINEAR_EXT"); break;
407 16 : case ColorSpace::BT709_NONLINEAR_EXT: return StringView("BT709_NONLINEAR_EXT"); break;
408 16 : case ColorSpace::BT2020_LINEAR_EXT: return StringView("BT2020_LINEAR_EXT"); break;
409 16 : case ColorSpace::HDR10_ST2084_EXT: return StringView("HDR10_ST2084_EXT"); break;
410 16 : case ColorSpace::DOLBYVISION_EXT: return StringView("DOLBYVISION_EXT"); break;
411 16 : case ColorSpace::HDR10_HLG_EXT: return StringView("HDR10_HLG_EXT"); break;
412 16 : case ColorSpace::ADOBERGB_LINEAR_EXT: return StringView("ADOBERGB_LINEAR_EXT"); break;
413 16 : case ColorSpace::ADOBERGB_NONLINEAR_EXT: return StringView("ADOBERGB_NONLINEAR_EXT"); break;
414 16 : case ColorSpace::PASS_THROUGH_EXT: return StringView("PASS_THROUGH_EXT"); break;
415 16 : case ColorSpace::EXTENDED_SRGB_NONLINEAR_EXT: return StringView("EXTENDED_SRGB_NONLINEAR_EXT"); break;
416 16 : case ColorSpace::DISPLAY_NATIVE_AMD: return StringView("DISPLAY_NATIVE_AMD"); break;
417 : }
418 1743760 : return StringView();
419 : }
420 :
421 48 : String getCompositeAlphaFlagsDescription(CompositeAlphaFlags fmt) {
422 48 : StringStream stream;
423 48 : if ((fmt & CompositeAlphaFlags::Opaque) != CompositeAlphaFlags::None) { stream << " Opaque"; }
424 48 : if ((fmt & CompositeAlphaFlags::Premultiplied) != CompositeAlphaFlags::None) { stream << " Premultiplied"; }
425 48 : if ((fmt & CompositeAlphaFlags::Postmultiplied) != CompositeAlphaFlags::None) { stream << " Postmultiplied"; }
426 48 : if ((fmt & CompositeAlphaFlags::Inherit) != CompositeAlphaFlags::None) { stream << " Inherit"; }
427 96 : return stream.str();
428 48 : }
429 :
430 64 : String getSurfaceTransformFlagsDescription(SurfaceTransformFlags fmt) {
431 64 : StringStream stream;
432 64 : if ((fmt & SurfaceTransformFlags::Identity) != SurfaceTransformFlags::None) { stream << " Identity"; }
433 64 : if ((fmt & SurfaceTransformFlags::Rotate90) != SurfaceTransformFlags::None) { stream << " Rotate90"; }
434 64 : if ((fmt & SurfaceTransformFlags::Rotate180) != SurfaceTransformFlags::None) { stream << " Rotate180"; }
435 64 : if ((fmt & SurfaceTransformFlags::Rotate270) != SurfaceTransformFlags::None) { stream << " Rotate270"; }
436 64 : if ((fmt & SurfaceTransformFlags::Mirror) != SurfaceTransformFlags::None) { stream << " Mirror"; }
437 64 : if ((fmt & SurfaceTransformFlags::MirrorRotate90) != SurfaceTransformFlags::None) { stream << " MirrorRotate90"; }
438 64 : if ((fmt & SurfaceTransformFlags::MirrorRotate180) != SurfaceTransformFlags::None) { stream << " MirrorRotate180"; }
439 64 : if ((fmt & SurfaceTransformFlags::MirrorRotate270) != SurfaceTransformFlags::None) { stream << " MirrorRotate270"; }
440 64 : if ((fmt & SurfaceTransformFlags::Inherit) != SurfaceTransformFlags::None) { stream << " Inherit"; }
441 64 : if ((fmt & SurfaceTransformFlags::PreRotated) != SurfaceTransformFlags::None) { stream << " PreRotated"; }
442 128 : return stream.str();
443 64 : }
444 :
445 48 : String getImageUsageDescription(ImageUsage fmt) {
446 48 : StringStream stream;
447 48 : if ((fmt & ImageUsage::TransferSrc) != ImageUsage::None) { stream << " TransferSrc"; }
448 48 : if ((fmt & ImageUsage::TransferDst) != ImageUsage::None) { stream << " TransferDst"; }
449 48 : if ((fmt & ImageUsage::Sampled) != ImageUsage::None) { stream << " Sampled"; }
450 48 : if ((fmt & ImageUsage::Storage) != ImageUsage::None) { stream << " Storage"; }
451 48 : if ((fmt & ImageUsage::ColorAttachment) != ImageUsage::None) { stream << " ColorAttachment"; }
452 48 : if ((fmt & ImageUsage::DepthStencilAttachment) != ImageUsage::None) { stream << " DepthStencilAttachment"; }
453 48 : if ((fmt & ImageUsage::TransientAttachment) != ImageUsage::None) { stream << " TransientAttachment"; }
454 48 : if ((fmt & ImageUsage::InputAttachment) != ImageUsage::None) { stream << " InputAttachment"; }
455 96 : return stream.str();
456 48 : }
457 :
458 32 : String BufferInfo::description() const {
459 32 : StringStream stream;
460 :
461 32 : stream << "BufferInfo: " << size << " bytes; Flags:";
462 32 : if (flags != BufferFlags::None) {
463 16 : stream << getBufferFlagsDescription(flags);
464 : } else {
465 16 : stream << " None";
466 : }
467 32 : stream << "; Usage:";
468 32 : if (usage != BufferUsage::None) {
469 16 : stream << getBufferUsageDescription(usage);
470 : } else {
471 16 : stream << " None";
472 : }
473 32 : stream << ";";
474 32 : if (persistent) {
475 16 : stream << " Persistent;";
476 : }
477 64 : return stream.str();
478 32 : }
479 :
480 38768 : size_t BufferData::writeData(uint8_t *mem, size_t expected) const {
481 38768 : if (size > expected) {
482 16 : log::error("core::BufferData", "Not enoudh space for buffer: ", size, " required, ", expected, " allocated");
483 16 : return 0;
484 : }
485 :
486 38752 : if (!data.empty()) {
487 16 : auto outsize = data.size();
488 16 : memcpy(mem, data.data(), size);
489 16 : return outsize;
490 38736 : } else if (memCallback) {
491 320 : size_t outsize = size;
492 320 : memCallback(mem, expected, [&, this] (BytesView data) {
493 16 : outsize = data.size();
494 16 : memcpy(mem, data.data(), size);
495 16 : });
496 320 : return outsize;
497 38416 : } else if (stdCallback) {
498 38416 : size_t outsize = size;
499 38416 : stdCallback(mem, expected, [&, this] (BytesView data) {
500 16 : outsize = data.size();
501 16 : memcpy(mem, data.data(), size);
502 16 : });
503 38416 : return outsize;
504 : }
505 0 : return 0;
506 : }
507 :
508 1058 : ImageViewInfo ImageInfoData::getViewInfo(const ImageViewInfo &info) const {
509 1058 : ImageViewInfo ret(info);
510 1058 : if (ret.format == ImageFormat::Undefined) {
511 80 : ret.format = format;
512 : }
513 1058 : if (ret.layerCount.get() == maxOf<uint32_t>()) {
514 182 : ret.layerCount = ArrayLayers(arrayLayers.get() - ret.baseArrayLayer.get());
515 : }
516 1058 : return ret;
517 : }
518 :
519 32 : bool ImageInfo::isCompatible(const ImageInfo &img) const {
520 32 : if (img.format == format && img.flags == flags && img.imageType == imageType && img.mipLevels == img.mipLevels
521 64 : && img.arrayLayers == arrayLayers && img.samples == samples && img.tiling == tiling && img.usage == usage) {
522 32 : return true;
523 : }
524 0 : return true;
525 : }
526 :
527 32 : String ImageInfo::description() const {
528 32 : StringStream stream;
529 32 : stream << "ImageInfo: " << getImageFormatName(format) << " (" << getImageTypeName(imageType) << "); ";
530 32 : stream << extent.width << " x " << extent.height << " x " << extent.depth << "; Flags:";
531 :
532 32 : if (flags != ImageFlags::None) {
533 16 : stream << getImageFlagsDescription(flags);
534 : } else {
535 16 : stream << " None";
536 : }
537 :
538 32 : stream << "; MipLevels: " << mipLevels.get() << "; ArrayLayers: " << arrayLayers.get()
539 32 : << "; Samples:" << getSampleCountDescription(samples) << "; Tiling: " << getImageTilingName(tiling) << "; Usage:";
540 :
541 32 : if (usage != ImageUsage::None) {
542 16 : stream << getImageUsageDescription(usage);
543 : } else {
544 16 : stream << " None";
545 : }
546 32 : stream << ";";
547 64 : return stream.str();
548 32 : }
549 :
550 112 : size_t ImageData::writeData(uint8_t *mem, size_t expected) const {
551 112 : uint64_t expectedSize = getFormatBlockSize(format) * extent.width * extent.height * extent.depth;
552 112 : if (expectedSize > expected) {
553 16 : log::error("core::ImageData", "Not enoudh space for image: ", expectedSize, " required, ", expected, " allocated");
554 16 : return 0;
555 : }
556 :
557 96 : if (!data.empty()) {
558 16 : auto size = data.size();
559 16 : memcpy(mem, data.data(), size);
560 16 : return size;
561 80 : } else if (memCallback) {
562 64 : size_t size = expectedSize;
563 64 : memCallback(mem, expectedSize, [&] (BytesView data) {
564 16 : size = data.size();
565 16 : memcpy(mem, data.data(), size);
566 16 : });
567 64 : return size;
568 16 : } else if (stdCallback) {
569 16 : size_t size = expectedSize;
570 16 : stdCallback(mem, expectedSize, [&] (BytesView data) {
571 16 : size = data.size();
572 16 : memcpy(mem, data.data(), size);
573 16 : });
574 16 : return size;
575 : }
576 0 : return 0;
577 : }
578 :
579 80 : void ImageViewInfo::setup(const ImageViewInfo &value) {
580 80 : *this = value;
581 80 : }
582 :
583 101316 : void ImageViewInfo::setup(const ImageInfoData &value) {
584 101316 : format = value.format;
585 101316 : baseArrayLayer = BaseArrayLayer(0);
586 101313 : if (layerCount.get() > 1) {
587 101295 : setup(value.imageType, value.arrayLayers);
588 101289 : layerCount = value.arrayLayers;
589 : } else {
590 16 : layerCount = value.arrayLayers;
591 16 : setup(value.imageType, value.arrayLayers);
592 : }
593 101305 : }
594 :
595 101408 : void ImageViewInfo::setup(ColorMode value, bool allowSwizzle) {
596 101408 : switch (value.getMode()) {
597 101410 : case ColorMode::Solid: {
598 101410 : if (!allowSwizzle) {
599 71988 : r = ComponentMapping::Identity;
600 71988 : g = ComponentMapping::Identity;
601 71988 : b = ComponentMapping::Identity;
602 71988 : a = ComponentMapping::Identity;
603 71988 : return;
604 : }
605 29422 : auto f = getImagePixelFormat(format);
606 : switch (f) {
607 0 : case PixelFormat::Unknown: break;
608 48 : case PixelFormat::A:
609 48 : r = ComponentMapping::One;
610 48 : g = ComponentMapping::One;
611 48 : b = ComponentMapping::One;
612 48 : a = ComponentMapping::R;
613 48 : break;
614 29288 : case PixelFormat::IA:
615 29288 : r = ComponentMapping::R;
616 29288 : g = ComponentMapping::R;
617 29288 : b = ComponentMapping::R;
618 29288 : a = ComponentMapping::G;
619 29288 : break;
620 16 : case PixelFormat::RGB:
621 16 : r = ComponentMapping::Identity;
622 16 : g = ComponentMapping::Identity;
623 16 : b = ComponentMapping::Identity;
624 16 : a = ComponentMapping::One;
625 16 : break;
626 70 : case PixelFormat::RGBA:
627 : case PixelFormat::D:
628 : case PixelFormat::DS:
629 : case PixelFormat::S:
630 70 : r = ComponentMapping::Identity;
631 70 : g = ComponentMapping::Identity;
632 70 : b = ComponentMapping::Identity;
633 70 : a = ComponentMapping::Identity;
634 70 : break;
635 : }
636 :
637 29422 : break;
638 : }
639 64 : case ColorMode::Custom:
640 64 : r = value.getR();
641 64 : g = value.getG();
642 64 : b = value.getB();
643 64 : a = value.getA();
644 64 : break;
645 : }
646 : }
647 :
648 101390 : void ImageViewInfo::setup(ImageType t, ArrayLayers layers) {
649 101390 : layerCount = layers;
650 101390 : switch (t) {
651 32 : case ImageType::Image1D:
652 32 : if (layerCount.get() > 1 && layerCount != ArrayLayers::max()) {
653 16 : type = ImageViewType::ImageView1DArray;
654 : } else {
655 16 : type = ImageViewType::ImageView1D;
656 : }
657 32 : break;
658 101342 : case ImageType::Image2D:
659 101342 : if (layerCount.get() > 1 && layerCount != ArrayLayers::max()) {
660 16 : type = ImageViewType::ImageView2DArray;
661 : } else {
662 101323 : type = ImageViewType::ImageView2D;
663 : }
664 101339 : break;
665 16 : case ImageType::Image3D:
666 16 : type = ImageViewType::ImageView3D;
667 16 : break;
668 : }
669 101387 : }
670 :
671 144 : ColorMode ImageViewInfo::getColorMode() const {
672 144 : auto f = getImagePixelFormat(format);
673 144 : switch (f) {
674 16 : case PixelFormat::Unknown: return ColorMode(); break;
675 80 : case PixelFormat::A:
676 80 : if (r == ComponentMapping::One
677 48 : && g == ComponentMapping::One
678 48 : && b == ComponentMapping::One
679 48 : && a == ComponentMapping::R) {
680 48 : return ColorMode();
681 : }
682 32 : break;
683 16 : case PixelFormat::IA:
684 16 : if (r == ComponentMapping::R
685 16 : && g == ComponentMapping::R
686 16 : && b == ComponentMapping::R
687 16 : && a == ComponentMapping::G) {
688 16 : return ColorMode();
689 : }
690 0 : break;
691 16 : case PixelFormat::RGB:
692 16 : if (r == ComponentMapping::Identity
693 16 : && g == ComponentMapping::Identity
694 16 : && b == ComponentMapping::Identity
695 16 : && a == ComponentMapping::One) {
696 16 : return ColorMode();
697 : }
698 0 : break;
699 16 : case PixelFormat::RGBA:
700 : case PixelFormat::D:
701 : case PixelFormat::DS:
702 : case PixelFormat::S:
703 16 : if (r == ComponentMapping::Identity
704 16 : && g == ComponentMapping::Identity
705 16 : && b == ComponentMapping::Identity
706 16 : && a == ComponentMapping::Identity) {
707 16 : return ColorMode();
708 : }
709 0 : break;
710 : }
711 32 : return ColorMode(r, g, b, a);
712 : }
713 :
714 288 : bool ImageViewInfo::isCompatible(const ImageInfo &info) const {
715 : // not perfect, multi-planar format not tracked, bun enough for now
716 288 : if (format != ImageFormat::Undefined && getFormatBlockSize(info.format) != getFormatBlockSize(format)) {
717 16 : return false;
718 : }
719 :
720 : // check type compatibility
721 272 : switch (type) {
722 32 : case ImageViewType::ImageView1D:
723 32 : if (info.imageType != ImageType::Image1D) {
724 16 : return false;
725 : }
726 16 : break;
727 32 : case ImageViewType::ImageView1DArray:
728 32 : if (info.imageType != ImageType::Image1D) {
729 16 : return false;
730 : }
731 16 : break;
732 32 : case ImageViewType::ImageView2D:
733 32 : if (info.imageType != ImageType::Image2D && info.imageType != ImageType::Image3D) {
734 16 : return false;
735 : }
736 16 : break;
737 32 : case ImageViewType::ImageView2DArray:
738 32 : if (info.imageType != ImageType::Image2D && info.imageType != ImageType::Image3D) {
739 16 : return false;
740 : }
741 16 : break;
742 32 : case ImageViewType::ImageView3D:
743 32 : if (info.imageType != ImageType::Image3D) {
744 16 : return false;
745 : }
746 16 : break;
747 32 : case ImageViewType::ImageViewCube:
748 32 : if (info.imageType != ImageType::Image2D) {
749 16 : return false;
750 : }
751 16 : break;
752 80 : case ImageViewType::ImageViewCubeArray:
753 80 : if (info.imageType != ImageType::Image2D) {
754 16 : return false;
755 : }
756 64 : break;
757 : }
758 :
759 : // check array size compatibility
760 160 : if (baseArrayLayer.get() >= info.arrayLayers.get()) {
761 16 : return false;
762 : }
763 :
764 144 : if (layerCount.get() != maxOf<uint32_t>() && baseArrayLayer.get() + layerCount.get() > info.arrayLayers.get()) {
765 16 : return false;
766 : }
767 :
768 128 : return true;
769 : }
770 :
771 16 : String ImageViewInfo::description() const {
772 16 : StringStream stream;
773 16 : stream << "ImageViewInfo: " << getImageFormatName(format) << " (" << getImageViewTypeName(type) << "); ";
774 16 : stream << "ArrayLayers: " << baseArrayLayer.get() << " (" << layerCount.get() << "); ";
775 16 : stream << "R -> " << getComponentMappingName(r) << "; ";
776 16 : stream << "G -> " << getComponentMappingName(g) << "; ";
777 16 : stream << "B -> " << getComponentMappingName(b) << "; ";
778 16 : stream << "A -> " << getComponentMappingName(a) << "; ";
779 32 : return stream.str();
780 16 : }
781 :
782 32 : String SwapchainConfig::description() const {
783 32 : StringStream stream;
784 32 : stream << "\nSurfaceInfo:\n";
785 32 : stream << "\tPresentMode: " << getPresentModeName(presentMode);
786 32 : if (presentModeFast != PresentMode::Unsupported) {
787 32 : stream << " (" << getPresentModeName(presentModeFast) << ")";
788 : }
789 32 : stream << "\n";
790 32 : stream << "\tSurface format: (" << getImageFormatName(imageFormat) << ":" << getColorSpaceName(colorSpace) << ")\n";
791 32 : stream << "\tTransform:" << getSurfaceTransformFlagsDescription(transform) << "\n";
792 32 : stream << "\tAlpha:" << getCompositeAlphaFlagsDescription(alpha) << "\n";
793 32 : stream << "\tImage count: " << imageCount << "\n";
794 32 : stream << "\tExtent: " << extent.width << "x" << extent.height << "\n";
795 64 : return stream.str();
796 32 : }
797 :
798 160 : bool SurfaceInfo::isSupported(const SwapchainConfig &cfg) const {
799 160 : if (std::find(presentModes.begin(), presentModes.end(), cfg.presentMode) == presentModes.end()) {
800 32 : log::error("Vk-Error", "SurfaceInfo: presentMode is not supported");
801 32 : return false;
802 : }
803 :
804 160 : if (cfg.presentModeFast != PresentMode::Unsupported && std::find(presentModes.begin(), presentModes.end(),
805 160 : cfg.presentModeFast) == presentModes.end()) {
806 0 : log::error("Vk-Error", "SurfaceInfo: presentModeFast is not supported");
807 0 : return false;
808 : }
809 :
810 128 : if (std::find(formats.begin(), formats.end(), pair(cfg.imageFormat, cfg.colorSpace)) == formats.end()) {
811 16 : log::error("Vk-Error", "SurfaceInfo: imageFormat or colorSpace is not supported");
812 16 : return false;
813 : }
814 :
815 112 : if ((supportedCompositeAlpha & cfg.alpha) == CompositeAlphaFlags::None) {
816 8 : log::error("Vk-Error", "SurfaceInfo: alpha is not supported");
817 8 : return false;
818 : }
819 :
820 104 : if ((supportedTransforms & cfg.transform) == SurfaceTransformFlags::None) {
821 24 : log::error("Vk-Error", "SurfaceInfo: transform is not supported");
822 24 : return false;
823 : }
824 :
825 80 : if (cfg.imageCount < minImageCount || (maxImageCount != 0 && cfg.imageCount > maxImageCount)) {
826 16 : log::error("Vk-Error", "SurfaceInfo: imageCount is not supported");
827 16 : return false;
828 : }
829 :
830 64 : if (cfg.extent.width < minImageExtent.width || cfg.extent.width > maxImageExtent.width
831 48 : || cfg.extent.height < minImageExtent.height || cfg.extent.height > maxImageExtent.height) {
832 16 : log::error("Vk-Error", "SurfaceInfo: extent is not supported");
833 16 : return false;
834 : }
835 :
836 48 : if (cfg.transfer && (supportedUsageFlags & ImageUsage::TransferDst) == ImageUsage::None) {
837 16 : log::error("Vk-Error", "SurfaceInfo: supportedUsageFlags is not supported");
838 16 : return false;
839 : }
840 :
841 32 : return true;
842 : }
843 :
844 16 : String SurfaceInfo::description() const {
845 16 : StringStream stream;
846 16 : stream << "\nSurfaceInfo:\n";
847 16 : stream << "\tImageCount: " << minImageCount << "-" << maxImageCount << "\n";
848 16 : stream << "\tExtent: " << currentExtent.width << "x" << currentExtent.height
849 16 : << " (" << minImageExtent.width << "x" << minImageExtent.height
850 16 : << " - " << maxImageExtent.width << "x" << maxImageExtent.height << ")\n";
851 16 : stream << "\tMax Layers: " << maxImageArrayLayers << "\n";
852 :
853 16 : stream << "\tSupported transforms:" << getSurfaceTransformFlagsDescription(supportedTransforms) << "\n";
854 16 : stream << "\tCurrent transforms:" << getSurfaceTransformFlagsDescription(currentTransform) << "\n";
855 16 : stream << "\tSupported Alpha:" << getCompositeAlphaFlagsDescription(supportedCompositeAlpha) << "\n";
856 16 : stream << "\tSupported Usage:" << getImageUsageDescription(supportedUsageFlags) << "\n";
857 :
858 16 : stream << "\tSurface format:";
859 32 : for (auto it : formats) {
860 16 : stream << " (" << getImageFormatName(it.first) << ":" << getColorSpaceName(it.second) << ")";
861 : }
862 16 : stream << "\n";
863 :
864 16 : stream << "\tPresent modes:";
865 48 : for (auto &it : presentModes) {
866 32 : stream << " " << getPresentModeName(it);
867 : }
868 16 : stream << "\n";
869 32 : return stream.str();
870 16 : }
871 :
872 2948128 : size_t getFormatBlockSize(ImageFormat format) {
873 2948128 : switch (format) {
874 16 : case ImageFormat::Undefined: return 0; break;
875 16 : case ImageFormat::R4G4_UNORM_PACK8: return 1; break;
876 16 : case ImageFormat::R4G4B4A4_UNORM_PACK16: return 2; break;
877 16 : case ImageFormat::B4G4R4A4_UNORM_PACK16: return 2; break;
878 16 : case ImageFormat::R5G6B5_UNORM_PACK16: return 2; break;
879 16 : case ImageFormat::B5G6R5_UNORM_PACK16: return 2; break;
880 16 : case ImageFormat::R5G5B5A1_UNORM_PACK16: return 2; break;
881 16 : case ImageFormat::B5G5R5A1_UNORM_PACK16: return 2; break;
882 16 : case ImageFormat::A1R5G5B5_UNORM_PACK16: return 2; break;
883 80 : case ImageFormat::R8_UNORM: return 1; break;
884 16 : case ImageFormat::R8_SNORM: return 1; break;
885 16 : case ImageFormat::R8_USCALED: return 1; break;
886 16 : case ImageFormat::R8_SSCALED: return 1; break;
887 16 : case ImageFormat::R8_UINT: return 1; break;
888 16 : case ImageFormat::R8_SINT: return 1; break;
889 16 : case ImageFormat::R8_SRGB: return 1; break;
890 16 : case ImageFormat::R8G8_UNORM: return 2; break;
891 16 : case ImageFormat::R8G8_SNORM: return 2; break;
892 16 : case ImageFormat::R8G8_USCALED: return 2; break;
893 16 : case ImageFormat::R8G8_SSCALED: return 2; break;
894 16 : case ImageFormat::R8G8_UINT: return 2; break;
895 16 : case ImageFormat::R8G8_SINT: return 2; break;
896 16 : case ImageFormat::R8G8_SRGB: return 2; break;
897 32 : case ImageFormat::R8G8B8_UNORM: return 3; break;
898 16 : case ImageFormat::R8G8B8_SNORM: return 3; break;
899 16 : case ImageFormat::R8G8B8_USCALED: return 3; break;
900 16 : case ImageFormat::R8G8B8_SSCALED: return 3; break;
901 16 : case ImageFormat::R8G8B8_UINT: return 3; break;
902 16 : case ImageFormat::R8G8B8_SINT: return 3; break;
903 16 : case ImageFormat::R8G8B8_SRGB: return 3; break;
904 16 : case ImageFormat::B8G8R8_UNORM: return 3; break;
905 16 : case ImageFormat::B8G8R8_SNORM: return 3; break;
906 16 : case ImageFormat::B8G8R8_USCALED: return 3; break;
907 16 : case ImageFormat::B8G8R8_SSCALED: return 3; break;
908 16 : case ImageFormat::B8G8R8_UINT: return 3; break;
909 16 : case ImageFormat::B8G8R8_SINT: return 3; break;
910 16 : case ImageFormat::B8G8R8_SRGB: return 3; break;
911 688 : case ImageFormat::R8G8B8A8_UNORM: return 4; break;
912 16 : case ImageFormat::R8G8B8A8_SNORM: return 4; break;
913 16 : case ImageFormat::R8G8B8A8_USCALED: return 4; break;
914 16 : case ImageFormat::R8G8B8A8_SSCALED: return 4; break;
915 16 : case ImageFormat::R8G8B8A8_UINT: return 4; break;
916 16 : case ImageFormat::R8G8B8A8_SINT: return 4; break;
917 16 : case ImageFormat::R8G8B8A8_SRGB: return 4; break;
918 16 : case ImageFormat::B8G8R8A8_UNORM: return 4; break;
919 16 : case ImageFormat::B8G8R8A8_SNORM: return 4; break;
920 16 : case ImageFormat::B8G8R8A8_USCALED: return 4; break;
921 16 : case ImageFormat::B8G8R8A8_SSCALED: return 4; break;
922 16 : case ImageFormat::B8G8R8A8_UINT: return 4; break;
923 16 : case ImageFormat::B8G8R8A8_SINT: return 4; break;
924 16 : case ImageFormat::B8G8R8A8_SRGB: return 4; break;
925 16 : case ImageFormat::A8B8G8R8_UNORM_PACK32: return 4; break;
926 16 : case ImageFormat::A8B8G8R8_SNORM_PACK32: return 4; break;
927 16 : case ImageFormat::A8B8G8R8_USCALED_PACK32: return 4; break;
928 16 : case ImageFormat::A8B8G8R8_SSCALED_PACK32: return 4; break;
929 16 : case ImageFormat::A8B8G8R8_UINT_PACK32: return 4; break;
930 16 : case ImageFormat::A8B8G8R8_SINT_PACK32: return 4; break;
931 16 : case ImageFormat::A8B8G8R8_SRGB_PACK32: return 4; break;
932 16 : case ImageFormat::A2R10G10B10_UNORM_PACK32: return 4; break;
933 16 : case ImageFormat::A2R10G10B10_SNORM_PACK32: return 4; break;
934 16 : case ImageFormat::A2R10G10B10_USCALED_PACK32: return 4; break;
935 16 : case ImageFormat::A2R10G10B10_SSCALED_PACK32: return 4; break;
936 16 : case ImageFormat::A2R10G10B10_UINT_PACK32: return 4; break;
937 16 : case ImageFormat::A2R10G10B10_SINT_PACK32: return 4; break;
938 16 : case ImageFormat::A2B10G10R10_UNORM_PACK32: return 4; break;
939 16 : case ImageFormat::A2B10G10R10_SNORM_PACK32: return 4; break;
940 16 : case ImageFormat::A2B10G10R10_USCALED_PACK32: return 4; break;
941 16 : case ImageFormat::A2B10G10R10_SSCALED_PACK32: return 4; break;
942 16 : case ImageFormat::A2B10G10R10_UINT_PACK32: return 4; break;
943 16 : case ImageFormat::A2B10G10R10_SINT_PACK32: return 4; break;
944 16 : case ImageFormat::R16_UNORM: return 2; break;
945 16 : case ImageFormat::R16_SNORM: return 2; break;
946 16 : case ImageFormat::R16_USCALED: return 2; break;
947 16 : case ImageFormat::R16_SSCALED: return 2; break;
948 16 : case ImageFormat::R16_UINT: return 2; break;
949 16 : case ImageFormat::R16_SINT: return 2; break;
950 16 : case ImageFormat::R16_SFLOAT: return 2; break;
951 16 : case ImageFormat::R16G16_UNORM: return 4; break;
952 16 : case ImageFormat::R16G16_SNORM: return 4; break;
953 16 : case ImageFormat::R16G16_USCALED: return 4; break;
954 16 : case ImageFormat::R16G16_SSCALED: return 4; break;
955 16 : case ImageFormat::R16G16_UINT: return 4; break;
956 16 : case ImageFormat::R16G16_SINT: return 4; break;
957 16 : case ImageFormat::R16G16_SFLOAT: return 4; break;
958 16 : case ImageFormat::R16G16B16_UNORM: return 6; break;
959 16 : case ImageFormat::R16G16B16_SNORM: return 6; break;
960 16 : case ImageFormat::R16G16B16_USCALED: return 6; break;
961 16 : case ImageFormat::R16G16B16_SSCALED: return 6; break;
962 16 : case ImageFormat::R16G16B16_UINT: return 6; break;
963 16 : case ImageFormat::R16G16B16_SINT: return 6; break;
964 16 : case ImageFormat::R16G16B16_SFLOAT: return 6; break;
965 16 : case ImageFormat::R16G16B16A16_UNORM: return 8; break;
966 16 : case ImageFormat::R16G16B16A16_SNORM: return 8; break;
967 16 : case ImageFormat::R16G16B16A16_USCALED: return 8; break;
968 16 : case ImageFormat::R16G16B16A16_SSCALED: return 8; break;
969 16 : case ImageFormat::R16G16B16A16_UINT: return 8; break;
970 16 : case ImageFormat::R16G16B16A16_SINT: return 8; break;
971 16 : case ImageFormat::R16G16B16A16_SFLOAT: return 8; break;
972 16 : case ImageFormat::R32_UINT: return 4; break;
973 16 : case ImageFormat::R32_SINT: return 4; break;
974 16 : case ImageFormat::R32_SFLOAT: return 4; break;
975 16 : case ImageFormat::R32G32_UINT: return 8; break;
976 16 : case ImageFormat::R32G32_SINT: return 8; break;
977 16 : case ImageFormat::R32G32_SFLOAT: return 8; break;
978 16 : case ImageFormat::R32G32B32_UINT: return 12; break;
979 16 : case ImageFormat::R32G32B32_SINT: return 12; break;
980 16 : case ImageFormat::R32G32B32_SFLOAT: return 12; break;
981 16 : case ImageFormat::R32G32B32A32_UINT: return 16; break;
982 16 : case ImageFormat::R32G32B32A32_SINT: return 16; break;
983 16 : case ImageFormat::R32G32B32A32_SFLOAT: return 16; break;
984 16 : case ImageFormat::R64_UINT: return 8; break;
985 16 : case ImageFormat::R64_SINT: return 8; break;
986 16 : case ImageFormat::R64_SFLOAT: return 8; break;
987 16 : case ImageFormat::R64G64_UINT: return 16; break;
988 16 : case ImageFormat::R64G64_SINT: return 16; break;
989 16 : case ImageFormat::R64G64_SFLOAT: return 16; break;
990 16 : case ImageFormat::R64G64B64_UINT: return 24; break;
991 16 : case ImageFormat::R64G64B64_SINT: return 24; break;
992 16 : case ImageFormat::R64G64B64_SFLOAT: return 24; break;
993 16 : case ImageFormat::R64G64B64A64_UINT: return 32; break;
994 16 : case ImageFormat::R64G64B64A64_SINT: return 32; break;
995 16 : case ImageFormat::R64G64B64A64_SFLOAT: return 32; break;
996 16 : case ImageFormat::B10G11R11_UFLOAT_PACK32: return 4; break;
997 16 : case ImageFormat::E5B9G9R9_UFLOAT_PACK32: return 4; break;
998 16 : case ImageFormat::D16_UNORM: return 2; break;
999 16 : case ImageFormat::X8_D24_UNORM_PACK32: return 4; break;
1000 16 : case ImageFormat::D32_SFLOAT: return 4; break;
1001 16 : case ImageFormat::S8_UINT: return 1; break;
1002 16 : case ImageFormat::D16_UNORM_S8_UINT: return 3; break;
1003 16 : case ImageFormat::D24_UNORM_S8_UINT: return 4; break;
1004 16 : case ImageFormat::D32_SFLOAT_S8_UINT: return 5; break;
1005 16 : case ImageFormat::BC1_RGB_UNORM_BLOCK: return 8; break;
1006 16 : case ImageFormat::BC1_RGB_SRGB_BLOCK: return 8; break;
1007 16 : case ImageFormat::BC1_RGBA_UNORM_BLOCK: return 8; break;
1008 16 : case ImageFormat::BC1_RGBA_SRGB_BLOCK: return 8; break;
1009 16 : case ImageFormat::BC2_UNORM_BLOCK: return 16; break;
1010 16 : case ImageFormat::BC2_SRGB_BLOCK: return 16; break;
1011 16 : case ImageFormat::BC3_UNORM_BLOCK: return 16; break;
1012 16 : case ImageFormat::BC3_SRGB_BLOCK: return 16; break;
1013 16 : case ImageFormat::BC4_UNORM_BLOCK: return 8; break;
1014 16 : case ImageFormat::BC4_SNORM_BLOCK: return 8; break;
1015 16 : case ImageFormat::BC5_UNORM_BLOCK: return 16; break;
1016 16 : case ImageFormat::BC5_SNORM_BLOCK: return 16; break;
1017 16 : case ImageFormat::BC6H_UFLOAT_BLOCK: return 16; break;
1018 16 : case ImageFormat::BC6H_SFLOAT_BLOCK: return 16; break;
1019 16 : case ImageFormat::BC7_UNORM_BLOCK: return 16; break;
1020 16 : case ImageFormat::BC7_SRGB_BLOCK: return 16; break;
1021 16 : case ImageFormat::ETC2_R8G8B8_UNORM_BLOCK: return 8; break;
1022 16 : case ImageFormat::ETC2_R8G8B8_SRGB_BLOCK: return 8; break;
1023 16 : case ImageFormat::ETC2_R8G8B8A1_UNORM_BLOCK: return 8; break;
1024 16 : case ImageFormat::ETC2_R8G8B8A1_SRGB_BLOCK: return 8; break;
1025 16 : case ImageFormat::ETC2_R8G8B8A8_UNORM_BLOCK: return 8; break;
1026 16 : case ImageFormat::ETC2_R8G8B8A8_SRGB_BLOCK: return 8; break;
1027 16 : case ImageFormat::EAC_R11_UNORM_BLOCK: return 8; break;
1028 16 : case ImageFormat::EAC_R11_SNORM_BLOCK: return 8; break;
1029 16 : case ImageFormat::EAC_R11G11_UNORM_BLOCK: return 16; break;
1030 16 : case ImageFormat::EAC_R11G11_SNORM_BLOCK: return 16; break;
1031 16 : case ImageFormat::ASTC_4x4_UNORM_BLOCK: return 16; break;
1032 16 : case ImageFormat::ASTC_4x4_SRGB_BLOCK: return 16; break;
1033 16 : case ImageFormat::ASTC_5x4_UNORM_BLOCK: return 16; break;
1034 16 : case ImageFormat::ASTC_5x4_SRGB_BLOCK: return 16; break;
1035 16 : case ImageFormat::ASTC_5x5_UNORM_BLOCK: return 16; break;
1036 16 : case ImageFormat::ASTC_5x5_SRGB_BLOCK: return 16; break;
1037 16 : case ImageFormat::ASTC_6x5_UNORM_BLOCK: return 16; break;
1038 16 : case ImageFormat::ASTC_6x5_SRGB_BLOCK: return 16; break;
1039 16 : case ImageFormat::ASTC_6x6_UNORM_BLOCK: return 16; break;
1040 16 : case ImageFormat::ASTC_6x6_SRGB_BLOCK: return 16; break;
1041 16 : case ImageFormat::ASTC_8x5_UNORM_BLOCK: return 16; break;
1042 16 : case ImageFormat::ASTC_8x5_SRGB_BLOCK: return 16; break;
1043 16 : case ImageFormat::ASTC_8x6_UNORM_BLOCK: return 16; break;
1044 16 : case ImageFormat::ASTC_8x6_SRGB_BLOCK: return 16; break;
1045 16 : case ImageFormat::ASTC_8x8_UNORM_BLOCK: return 16; break;
1046 16 : case ImageFormat::ASTC_8x8_SRGB_BLOCK: return 16; break;
1047 16 : case ImageFormat::ASTC_10x5_UNORM_BLOCK: return 16; break;
1048 16 : case ImageFormat::ASTC_10x5_SRGB_BLOCK: return 16; break;
1049 16 : case ImageFormat::ASTC_10x6_UNORM_BLOCK: return 16; break;
1050 16 : case ImageFormat::ASTC_10x6_SRGB_BLOCK: return 16; break;
1051 16 : case ImageFormat::ASTC_10x8_UNORM_BLOCK: return 16; break;
1052 16 : case ImageFormat::ASTC_10x8_SRGB_BLOCK: return 16; break;
1053 16 : case ImageFormat::ASTC_10x10_UNORM_BLOCK: return 16; break;
1054 16 : case ImageFormat::ASTC_10x10_SRGB_BLOCK: return 16; break;
1055 16 : case ImageFormat::ASTC_12x10_UNORM_BLOCK: return 16; break;
1056 16 : case ImageFormat::ASTC_12x10_SRGB_BLOCK: return 16; break;
1057 16 : case ImageFormat::ASTC_12x12_UNORM_BLOCK: return 16; break;
1058 16 : case ImageFormat::ASTC_12x12_SRGB_BLOCK: return 16; break;
1059 16 : case ImageFormat::G8B8G8R8_422_UNORM: return 4; break;
1060 16 : case ImageFormat::B8G8R8G8_422_UNORM: return 4; break;
1061 16 : case ImageFormat::G8_B8_R8_3PLANE_420_UNORM: return 3; break;
1062 16 : case ImageFormat::G8_B8R8_2PLANE_420_UNORM: return 3; break;
1063 16 : case ImageFormat::G8_B8_R8_3PLANE_422_UNORM: return 3; break;
1064 16 : case ImageFormat::G8_B8R8_2PLANE_422_UNORM: return 3; break;
1065 16 : case ImageFormat::G8_B8_R8_3PLANE_444_UNORM: return 3; break;
1066 16 : case ImageFormat::R10X6_UNORM_PACK16: return 2; break;
1067 16 : case ImageFormat::R10X6G10X6_UNORM_2PACK16: return 4; break;
1068 16 : case ImageFormat::R10X6G10X6B10X6A10X6_UNORM_4PACK16: return 8; break;
1069 16 : case ImageFormat::G10X6B10X6G10X6R10X6_422_UNORM_4PACK16: return 8; break;
1070 16 : case ImageFormat::B10X6G10X6R10X6G10X6_422_UNORM_4PACK16: return 8; break;
1071 16 : case ImageFormat::G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16: return 6; break;
1072 16 : case ImageFormat::G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16: return 6; break;
1073 16 : case ImageFormat::G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16: return 6; break;
1074 16 : case ImageFormat::G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16: return 4; break;
1075 16 : case ImageFormat::G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16: return 6; break;
1076 16 : case ImageFormat::R12X4_UNORM_PACK16: return 2; break;
1077 16 : case ImageFormat::R12X4G12X4_UNORM_2PACK16: return 4; break;
1078 16 : case ImageFormat::R12X4G12X4B12X4A12X4_UNORM_4PACK16: return 8; break;
1079 16 : case ImageFormat::G12X4B12X4G12X4R12X4_422_UNORM_4PACK16: return 8; break;
1080 16 : case ImageFormat::B12X4G12X4R12X4G12X4_422_UNORM_4PACK16: return 8; break;
1081 16 : case ImageFormat::G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16: return 6; break;
1082 16 : case ImageFormat::G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16: return 6; break;
1083 16 : case ImageFormat::G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16: return 6; break;
1084 16 : case ImageFormat::G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16: return 6; break;
1085 16 : case ImageFormat::G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16: return 6; break;
1086 16 : case ImageFormat::G16B16G16R16_422_UNORM: return 8; break;
1087 16 : case ImageFormat::B16G16R16G16_422_UNORM: return 8; break;
1088 16 : case ImageFormat::G16_B16_R16_3PLANE_420_UNORM: return 6; break;
1089 16 : case ImageFormat::G16_B16R16_2PLANE_420_UNORM: return 6; break;
1090 16 : case ImageFormat::G16_B16_R16_3PLANE_422_UNORM: return 6; break;
1091 16 : case ImageFormat::G16_B16R16_2PLANE_422_UNORM: return 6; break;
1092 16 : case ImageFormat::G16_B16_R16_3PLANE_444_UNORM: return 6; break;
1093 16 : case ImageFormat::PVRTC1_2BPP_UNORM_BLOCK_IMG: return 8; break;
1094 16 : case ImageFormat::PVRTC1_4BPP_UNORM_BLOCK_IMG: return 8; break;
1095 16 : case ImageFormat::PVRTC2_2BPP_UNORM_BLOCK_IMG: return 8; break;
1096 16 : case ImageFormat::PVRTC2_4BPP_UNORM_BLOCK_IMG: return 8; break;
1097 16 : case ImageFormat::PVRTC1_2BPP_SRGB_BLOCK_IMG: return 8; break;
1098 16 : case ImageFormat::PVRTC1_4BPP_SRGB_BLOCK_IMG: return 8; break;
1099 16 : case ImageFormat::PVRTC2_2BPP_SRGB_BLOCK_IMG: return 8; break;
1100 16 : case ImageFormat::PVRTC2_4BPP_SRGB_BLOCK_IMG: return 8; break;
1101 16 : case ImageFormat::ASTC_4x4_SFLOAT_BLOCK_EXT: return 8; break;
1102 16 : case ImageFormat::ASTC_5x4_SFLOAT_BLOCK_EXT: return 8; break;
1103 16 : case ImageFormat::ASTC_5x5_SFLOAT_BLOCK_EXT: return 8; break;
1104 16 : case ImageFormat::ASTC_6x5_SFLOAT_BLOCK_EXT: return 8; break;
1105 16 : case ImageFormat::ASTC_6x6_SFLOAT_BLOCK_EXT: return 8; break;
1106 16 : case ImageFormat::ASTC_8x5_SFLOAT_BLOCK_EXT: return 8; break;
1107 16 : case ImageFormat::ASTC_8x6_SFLOAT_BLOCK_EXT: return 8; break;
1108 16 : case ImageFormat::ASTC_8x8_SFLOAT_BLOCK_EXT: return 8; break;
1109 16 : case ImageFormat::ASTC_10x5_SFLOAT_BLOCK_EXT: return 8; break;
1110 16 : case ImageFormat::ASTC_10x6_SFLOAT_BLOCK_EXT: return 8; break;
1111 16 : case ImageFormat::ASTC_10x8_SFLOAT_BLOCK_EXT: return 8; break;
1112 16 : case ImageFormat::ASTC_10x10_SFLOAT_BLOCK_EXT: return 8; break;
1113 16 : case ImageFormat::ASTC_12x10_SFLOAT_BLOCK_EXT: return 8; break;
1114 16 : case ImageFormat::ASTC_12x12_SFLOAT_BLOCK_EXT: return 8; break;
1115 16 : case ImageFormat::G8_B8R8_2PLANE_444_UNORM_EXT: return 3; break;
1116 16 : case ImageFormat::G10X6_B10X6R10X6_2PLANE_444_UNORM_3PACK16_EXT: return 6; break;
1117 16 : case ImageFormat::G12X4_B12X4R12X4_2PLANE_444_UNORM_3PACK16_EXT: return 6; break;
1118 16 : case ImageFormat::G16_B16R16_2PLANE_444_UNORM_EXT: return 6; break;
1119 16 : case ImageFormat::A4R4G4B4_UNORM_PACK16_EXT: return 2; break;
1120 16 : case ImageFormat::A4B4G4R4_UNORM_PACK16_EXT: return 2; break;
1121 : }
1122 2943424 : return 0;
1123 : }
1124 :
1125 111436 : PixelFormat getImagePixelFormat(ImageFormat format) {
1126 111436 : switch (format) {
1127 16 : case ImageFormat::Undefined: return PixelFormat::Unknown; break;
1128 :
1129 61408 : case ImageFormat::R8_UNORM:
1130 : case ImageFormat::R8_SNORM:
1131 : case ImageFormat::R8_USCALED:
1132 : case ImageFormat::R8_SSCALED:
1133 : case ImageFormat::R8_UINT:
1134 : case ImageFormat::R8_SINT:
1135 : case ImageFormat::R8_SRGB:
1136 : case ImageFormat::R16_UNORM:
1137 : case ImageFormat::R16_SNORM:
1138 : case ImageFormat::R16_USCALED:
1139 : case ImageFormat::R16_SSCALED:
1140 : case ImageFormat::R16_UINT:
1141 : case ImageFormat::R16_SINT:
1142 : case ImageFormat::R16_SFLOAT:
1143 : case ImageFormat::R32_UINT:
1144 : case ImageFormat::R32_SINT:
1145 : case ImageFormat::R32_SFLOAT:
1146 : case ImageFormat::R64_UINT:
1147 : case ImageFormat::R64_SINT:
1148 : case ImageFormat::R64_SFLOAT:
1149 : case ImageFormat::EAC_R11_UNORM_BLOCK:
1150 : case ImageFormat::EAC_R11_SNORM_BLOCK:
1151 : case ImageFormat::R10X6_UNORM_PACK16:
1152 : case ImageFormat::R12X4_UNORM_PACK16:
1153 61408 : return PixelFormat::A;
1154 : break;
1155 :
1156 49498 : case ImageFormat::R4G4_UNORM_PACK8:
1157 : case ImageFormat::R8G8_UNORM:
1158 : case ImageFormat::R8G8_SNORM:
1159 : case ImageFormat::R8G8_USCALED:
1160 : case ImageFormat::R8G8_SSCALED:
1161 : case ImageFormat::R8G8_UINT:
1162 : case ImageFormat::R8G8_SINT:
1163 : case ImageFormat::R8G8_SRGB:
1164 : case ImageFormat::R16G16_UNORM:
1165 : case ImageFormat::R16G16_SNORM:
1166 : case ImageFormat::R16G16_USCALED:
1167 : case ImageFormat::R16G16_SSCALED:
1168 : case ImageFormat::R16G16_UINT:
1169 : case ImageFormat::R16G16_SINT:
1170 : case ImageFormat::R16G16_SFLOAT:
1171 : case ImageFormat::R32G32_UINT:
1172 : case ImageFormat::R32G32_SINT:
1173 : case ImageFormat::R32G32_SFLOAT:
1174 : case ImageFormat::R64G64_UINT:
1175 : case ImageFormat::R64G64_SINT:
1176 : case ImageFormat::R64G64_SFLOAT:
1177 : case ImageFormat::EAC_R11G11_UNORM_BLOCK:
1178 : case ImageFormat::EAC_R11G11_SNORM_BLOCK:
1179 : case ImageFormat::R10X6G10X6_UNORM_2PACK16:
1180 : case ImageFormat::R12X4G12X4_UNORM_2PACK16:
1181 49498 : return PixelFormat::IA;
1182 : break;
1183 :
1184 402 : case ImageFormat::R4G4B4A4_UNORM_PACK16:
1185 : case ImageFormat::B4G4R4A4_UNORM_PACK16:
1186 : case ImageFormat::R5G5B5A1_UNORM_PACK16:
1187 : case ImageFormat::B5G5R5A1_UNORM_PACK16:
1188 : case ImageFormat::A1R5G5B5_UNORM_PACK16:
1189 : case ImageFormat::R8G8B8A8_UNORM:
1190 : case ImageFormat::R8G8B8A8_SNORM:
1191 : case ImageFormat::R8G8B8A8_USCALED:
1192 : case ImageFormat::R8G8B8A8_SSCALED:
1193 : case ImageFormat::R8G8B8A8_UINT:
1194 : case ImageFormat::R8G8B8A8_SINT:
1195 : case ImageFormat::R8G8B8A8_SRGB:
1196 : case ImageFormat::B8G8R8A8_UNORM:
1197 : case ImageFormat::B8G8R8A8_SNORM:
1198 : case ImageFormat::B8G8R8A8_USCALED:
1199 : case ImageFormat::B8G8R8A8_SSCALED:
1200 : case ImageFormat::B8G8R8A8_UINT:
1201 : case ImageFormat::B8G8R8A8_SINT:
1202 : case ImageFormat::B8G8R8A8_SRGB:
1203 : case ImageFormat::A8B8G8R8_UNORM_PACK32:
1204 : case ImageFormat::A8B8G8R8_SNORM_PACK32:
1205 : case ImageFormat::A8B8G8R8_USCALED_PACK32:
1206 : case ImageFormat::A8B8G8R8_SSCALED_PACK32:
1207 : case ImageFormat::A8B8G8R8_UINT_PACK32:
1208 : case ImageFormat::A8B8G8R8_SINT_PACK32:
1209 : case ImageFormat::A8B8G8R8_SRGB_PACK32:
1210 : case ImageFormat::A2R10G10B10_UNORM_PACK32:
1211 : case ImageFormat::A2R10G10B10_SNORM_PACK32:
1212 : case ImageFormat::A2R10G10B10_USCALED_PACK32:
1213 : case ImageFormat::A2R10G10B10_SSCALED_PACK32:
1214 : case ImageFormat::A2R10G10B10_UINT_PACK32:
1215 : case ImageFormat::A2R10G10B10_SINT_PACK32:
1216 : case ImageFormat::A2B10G10R10_UNORM_PACK32:
1217 : case ImageFormat::A2B10G10R10_SNORM_PACK32:
1218 : case ImageFormat::A2B10G10R10_USCALED_PACK32:
1219 : case ImageFormat::A2B10G10R10_SSCALED_PACK32:
1220 : case ImageFormat::A2B10G10R10_UINT_PACK32:
1221 : case ImageFormat::A2B10G10R10_SINT_PACK32:
1222 : case ImageFormat::R16G16B16A16_UNORM:
1223 : case ImageFormat::R16G16B16A16_SNORM:
1224 : case ImageFormat::R16G16B16A16_USCALED:
1225 : case ImageFormat::R16G16B16A16_SSCALED:
1226 : case ImageFormat::R16G16B16A16_UINT:
1227 : case ImageFormat::R16G16B16A16_SINT:
1228 : case ImageFormat::R16G16B16A16_SFLOAT:
1229 : case ImageFormat::R32G32B32A32_UINT:
1230 : case ImageFormat::R32G32B32A32_SINT:
1231 : case ImageFormat::R32G32B32A32_SFLOAT:
1232 : case ImageFormat::R64G64B64A64_UINT:
1233 : case ImageFormat::R64G64B64A64_SINT:
1234 : case ImageFormat::R64G64B64A64_SFLOAT:
1235 : case ImageFormat::BC1_RGBA_UNORM_BLOCK:
1236 : case ImageFormat::BC1_RGBA_SRGB_BLOCK:
1237 : case ImageFormat::ETC2_R8G8B8A1_UNORM_BLOCK:
1238 : case ImageFormat::ETC2_R8G8B8A1_SRGB_BLOCK:
1239 : case ImageFormat::ETC2_R8G8B8A8_UNORM_BLOCK:
1240 : case ImageFormat::ETC2_R8G8B8A8_SRGB_BLOCK:
1241 : case ImageFormat::R10X6G10X6B10X6A10X6_UNORM_4PACK16:
1242 : case ImageFormat::R12X4G12X4B12X4A12X4_UNORM_4PACK16:
1243 : case ImageFormat::A4R4G4B4_UNORM_PACK16_EXT:
1244 : case ImageFormat::A4B4G4R4_UNORM_PACK16_EXT:
1245 402 : return PixelFormat::RGBA;
1246 : break;
1247 :
1248 32 : case ImageFormat::R5G6B5_UNORM_PACK16:
1249 : case ImageFormat::B5G6R5_UNORM_PACK16:
1250 : case ImageFormat::R8G8B8_UNORM:
1251 : case ImageFormat::R8G8B8_SNORM:
1252 : case ImageFormat::R8G8B8_USCALED:
1253 : case ImageFormat::R8G8B8_SSCALED:
1254 : case ImageFormat::R8G8B8_UINT:
1255 : case ImageFormat::R8G8B8_SINT:
1256 : case ImageFormat::R8G8B8_SRGB:
1257 : case ImageFormat::B8G8R8_UNORM:
1258 : case ImageFormat::B8G8R8_SNORM:
1259 : case ImageFormat::B8G8R8_USCALED:
1260 : case ImageFormat::B8G8R8_SSCALED:
1261 : case ImageFormat::B8G8R8_UINT:
1262 : case ImageFormat::B8G8R8_SINT:
1263 : case ImageFormat::B8G8R8_SRGB:
1264 : case ImageFormat::R16G16B16_UNORM:
1265 : case ImageFormat::R16G16B16_SNORM:
1266 : case ImageFormat::R16G16B16_USCALED:
1267 : case ImageFormat::R16G16B16_SSCALED:
1268 : case ImageFormat::R16G16B16_UINT:
1269 : case ImageFormat::R16G16B16_SINT:
1270 : case ImageFormat::R16G16B16_SFLOAT:
1271 : case ImageFormat::R32G32B32_UINT:
1272 : case ImageFormat::R32G32B32_SINT:
1273 : case ImageFormat::R32G32B32_SFLOAT:
1274 : case ImageFormat::R64G64B64_UINT:
1275 : case ImageFormat::R64G64B64_SINT:
1276 : case ImageFormat::R64G64B64_SFLOAT:
1277 : case ImageFormat::B10G11R11_UFLOAT_PACK32:
1278 : case ImageFormat::G8B8G8R8_422_UNORM:
1279 : case ImageFormat::B8G8R8G8_422_UNORM:
1280 : case ImageFormat::BC1_RGB_UNORM_BLOCK:
1281 : case ImageFormat::BC1_RGB_SRGB_BLOCK:
1282 : case ImageFormat::ETC2_R8G8B8_UNORM_BLOCK:
1283 : case ImageFormat::ETC2_R8G8B8_SRGB_BLOCK:
1284 : case ImageFormat::G8_B8_R8_3PLANE_420_UNORM:
1285 : case ImageFormat::G8_B8R8_2PLANE_420_UNORM:
1286 : case ImageFormat::G8_B8_R8_3PLANE_422_UNORM:
1287 : case ImageFormat::G8_B8R8_2PLANE_422_UNORM:
1288 : case ImageFormat::G8_B8_R8_3PLANE_444_UNORM:
1289 : case ImageFormat::G10X6B10X6G10X6R10X6_422_UNORM_4PACK16:
1290 : case ImageFormat::B10X6G10X6R10X6G10X6_422_UNORM_4PACK16:
1291 : case ImageFormat::G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16:
1292 : case ImageFormat::G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16:
1293 : case ImageFormat::G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16:
1294 : case ImageFormat::G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16:
1295 : case ImageFormat::G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16:
1296 : case ImageFormat::G12X4B12X4G12X4R12X4_422_UNORM_4PACK16:
1297 : case ImageFormat::B12X4G12X4R12X4G12X4_422_UNORM_4PACK16:
1298 : case ImageFormat::G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16:
1299 : case ImageFormat::G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16:
1300 : case ImageFormat::G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16:
1301 : case ImageFormat::G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16:
1302 : case ImageFormat::G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16:
1303 : case ImageFormat::G16B16G16R16_422_UNORM:
1304 : case ImageFormat::B16G16R16G16_422_UNORM:
1305 : case ImageFormat::G16_B16_R16_3PLANE_420_UNORM:
1306 : case ImageFormat::G16_B16R16_2PLANE_420_UNORM:
1307 : case ImageFormat::G16_B16_R16_3PLANE_422_UNORM:
1308 : case ImageFormat::G16_B16R16_2PLANE_422_UNORM:
1309 : case ImageFormat::G16_B16_R16_3PLANE_444_UNORM:
1310 : case ImageFormat::G8_B8R8_2PLANE_444_UNORM_EXT:
1311 : case ImageFormat::G10X6_B10X6R10X6_2PLANE_444_UNORM_3PACK16_EXT:
1312 : case ImageFormat::G12X4_B12X4R12X4_2PLANE_444_UNORM_3PACK16_EXT:
1313 : case ImageFormat::G16_B16R16_2PLANE_444_UNORM_EXT:
1314 32 : return PixelFormat::RGB;
1315 : break;
1316 :
1317 32 : case ImageFormat::D16_UNORM:
1318 : case ImageFormat::D32_SFLOAT:
1319 : case ImageFormat::X8_D24_UNORM_PACK32:
1320 32 : return PixelFormat::D;
1321 : break;
1322 :
1323 16 : case ImageFormat::S8_UINT:
1324 16 : return PixelFormat::S;
1325 : break;
1326 :
1327 16 : case ImageFormat::D16_UNORM_S8_UINT:
1328 : case ImageFormat::D24_UNORM_S8_UINT:
1329 : case ImageFormat::D32_SFLOAT_S8_UINT:
1330 16 : return PixelFormat::DS;
1331 : break;
1332 :
1333 16 : case ImageFormat::E5B9G9R9_UFLOAT_PACK32:
1334 : case ImageFormat::BC2_UNORM_BLOCK:
1335 : case ImageFormat::BC2_SRGB_BLOCK:
1336 : case ImageFormat::BC3_UNORM_BLOCK:
1337 : case ImageFormat::BC3_SRGB_BLOCK:
1338 : case ImageFormat::BC4_UNORM_BLOCK:
1339 : case ImageFormat::BC4_SNORM_BLOCK:
1340 : case ImageFormat::BC5_UNORM_BLOCK:
1341 : case ImageFormat::BC5_SNORM_BLOCK:
1342 : case ImageFormat::BC6H_UFLOAT_BLOCK:
1343 : case ImageFormat::BC6H_SFLOAT_BLOCK:
1344 : case ImageFormat::BC7_UNORM_BLOCK:
1345 : case ImageFormat::BC7_SRGB_BLOCK:
1346 : case ImageFormat::ASTC_4x4_UNORM_BLOCK:
1347 : case ImageFormat::ASTC_4x4_SRGB_BLOCK:
1348 : case ImageFormat::ASTC_5x4_UNORM_BLOCK:
1349 : case ImageFormat::ASTC_5x4_SRGB_BLOCK:
1350 : case ImageFormat::ASTC_5x5_UNORM_BLOCK:
1351 : case ImageFormat::ASTC_5x5_SRGB_BLOCK:
1352 : case ImageFormat::ASTC_6x5_UNORM_BLOCK:
1353 : case ImageFormat::ASTC_6x5_SRGB_BLOCK:
1354 : case ImageFormat::ASTC_6x6_UNORM_BLOCK:
1355 : case ImageFormat::ASTC_6x6_SRGB_BLOCK:
1356 : case ImageFormat::ASTC_8x5_UNORM_BLOCK:
1357 : case ImageFormat::ASTC_8x5_SRGB_BLOCK:
1358 : case ImageFormat::ASTC_8x6_UNORM_BLOCK:
1359 : case ImageFormat::ASTC_8x6_SRGB_BLOCK:
1360 : case ImageFormat::ASTC_8x8_UNORM_BLOCK:
1361 : case ImageFormat::ASTC_8x8_SRGB_BLOCK:
1362 : case ImageFormat::ASTC_10x5_UNORM_BLOCK:
1363 : case ImageFormat::ASTC_10x5_SRGB_BLOCK:
1364 : case ImageFormat::ASTC_10x6_UNORM_BLOCK:
1365 : case ImageFormat::ASTC_10x6_SRGB_BLOCK:
1366 : case ImageFormat::ASTC_10x8_UNORM_BLOCK:
1367 : case ImageFormat::ASTC_10x8_SRGB_BLOCK:
1368 : case ImageFormat::ASTC_10x10_UNORM_BLOCK:
1369 : case ImageFormat::ASTC_10x10_SRGB_BLOCK:
1370 : case ImageFormat::ASTC_12x10_UNORM_BLOCK:
1371 : case ImageFormat::ASTC_12x10_SRGB_BLOCK:
1372 : case ImageFormat::ASTC_12x12_UNORM_BLOCK:
1373 : case ImageFormat::ASTC_12x12_SRGB_BLOCK:
1374 : case ImageFormat::PVRTC1_2BPP_UNORM_BLOCK_IMG:
1375 : case ImageFormat::PVRTC1_4BPP_UNORM_BLOCK_IMG:
1376 : case ImageFormat::PVRTC2_2BPP_UNORM_BLOCK_IMG:
1377 : case ImageFormat::PVRTC2_4BPP_UNORM_BLOCK_IMG:
1378 : case ImageFormat::PVRTC1_2BPP_SRGB_BLOCK_IMG:
1379 : case ImageFormat::PVRTC1_4BPP_SRGB_BLOCK_IMG:
1380 : case ImageFormat::PVRTC2_2BPP_SRGB_BLOCK_IMG:
1381 : case ImageFormat::PVRTC2_4BPP_SRGB_BLOCK_IMG:
1382 : case ImageFormat::ASTC_4x4_SFLOAT_BLOCK_EXT:
1383 : case ImageFormat::ASTC_5x4_SFLOAT_BLOCK_EXT:
1384 : case ImageFormat::ASTC_5x5_SFLOAT_BLOCK_EXT:
1385 : case ImageFormat::ASTC_6x5_SFLOAT_BLOCK_EXT:
1386 : case ImageFormat::ASTC_6x6_SFLOAT_BLOCK_EXT:
1387 : case ImageFormat::ASTC_8x5_SFLOAT_BLOCK_EXT:
1388 : case ImageFormat::ASTC_8x6_SFLOAT_BLOCK_EXT:
1389 : case ImageFormat::ASTC_8x8_SFLOAT_BLOCK_EXT:
1390 : case ImageFormat::ASTC_10x5_SFLOAT_BLOCK_EXT:
1391 : case ImageFormat::ASTC_10x6_SFLOAT_BLOCK_EXT:
1392 : case ImageFormat::ASTC_10x8_SFLOAT_BLOCK_EXT:
1393 : case ImageFormat::ASTC_10x10_SFLOAT_BLOCK_EXT:
1394 : case ImageFormat::ASTC_12x10_SFLOAT_BLOCK_EXT:
1395 : case ImageFormat::ASTC_12x12_SFLOAT_BLOCK_EXT:
1396 16 : return PixelFormat::Unknown;
1397 : break;
1398 : }
1399 0 : return PixelFormat::Unknown;
1400 : }
1401 :
1402 64 : bool isStencilFormat(ImageFormat format) {
1403 64 : switch (format) {
1404 16 : case ImageFormat::S8_UINT:
1405 : case ImageFormat::D16_UNORM_S8_UINT:
1406 : case ImageFormat::D24_UNORM_S8_UINT:
1407 : case ImageFormat::D32_SFLOAT_S8_UINT:
1408 16 : return true;
1409 : break;
1410 48 : default:
1411 48 : break;
1412 : }
1413 48 : return false;
1414 : }
1415 :
1416 64 : bool isDepthFormat(ImageFormat format) {
1417 64 : switch (format) {
1418 48 : case ImageFormat::D16_UNORM:
1419 : case ImageFormat::D32_SFLOAT:
1420 : case ImageFormat::D16_UNORM_S8_UINT:
1421 : case ImageFormat::D24_UNORM_S8_UINT:
1422 : case ImageFormat::D32_SFLOAT_S8_UINT:
1423 : case ImageFormat::X8_D24_UNORM_PACK32:
1424 48 : return true;
1425 : break;
1426 16 : default:
1427 16 : break;
1428 : }
1429 16 : return false;
1430 : }
1431 :
1432 32 : bool hasReadAccess(AccessType access) {
1433 64 : if ((access & (
1434 0 : AccessType::IndirectCommandRead
1435 0 : | AccessType::IndexRead
1436 32 : | AccessType::VertexAttributeRead
1437 32 : | AccessType::UniformRead
1438 32 : | AccessType::InputAttachmantRead
1439 32 : | AccessType::ShaderRead
1440 32 : | AccessType::ColorAttachmentRead
1441 32 : | AccessType::DepthStencilAttachmentRead
1442 32 : | AccessType::TransferRead
1443 32 : | AccessType::HostRead
1444 32 : | AccessType::MemoryRead
1445 32 : | AccessType::ColorAttachmentReadNonCoherent
1446 32 : | AccessType::TransformFeedbackCounterRead
1447 32 : | AccessType::ConditionalRenderingRead
1448 32 : | AccessType::AccelerationStructureRead
1449 32 : | AccessType::ShadingRateImageRead
1450 32 : | AccessType::FragmentDensityMapRead
1451 64 : | AccessType::CommandPreprocessRead
1452 32 : )) != AccessType::None) {
1453 16 : return true;
1454 : }
1455 16 : return false;
1456 : }
1457 :
1458 32 : bool hasWriteAccess(AccessType access) {
1459 64 : if ((access & (
1460 0 : AccessType::ShaderWrite
1461 0 : | AccessType::ColorAttachmentWrite
1462 32 : | AccessType::DepthStencilAttachmentWrite
1463 32 : | AccessType::TransferWrite
1464 32 : | AccessType::HostWrite
1465 32 : | AccessType::MemoryWrite
1466 32 : | AccessType::TransformFeedbackWrite
1467 32 : | AccessType::TransformFeedbackCounterWrite
1468 32 : | AccessType::AccelerationStructureWrite
1469 64 : | AccessType::CommandPreprocessWrite
1470 32 : )) != AccessType::None) {
1471 16 : return true;
1472 : }
1473 16 : return false;
1474 : }
1475 :
1476 16 : std::ostream & operator<<(std::ostream &stream, const ImageInfoData &value) {
1477 16 : stream << "ImageInfoData: " << value.extent << " Layers:" << value.arrayLayers.get();
1478 16 : return stream;
1479 : }
1480 :
1481 16 : String PipelineMaterialInfo::data() const {
1482 16 : BytesView view(reinterpret_cast<const uint8_t *>(this), sizeof(PipelineMaterialInfo));
1483 : return toString(
1484 32 : base16::encode<Interface>(view.sub(0, sizeof(BlendInfo))), "'",
1485 32 : base16::encode<Interface>(view.sub(sizeof(BlendInfo), sizeof(DepthInfo))), "'",
1486 32 : base16::encode<Interface>(view.sub(sizeof(BlendInfo) + sizeof(DepthInfo), sizeof(DepthBounds))), "'",
1487 32 : base16::encode<Interface>(view.sub(sizeof(BlendInfo) + sizeof(DepthInfo) + sizeof(DepthBounds), sizeof(StencilInfo))), "'",
1488 32 : base16::encode<Interface>(view.sub(sizeof(BlendInfo) + sizeof(DepthInfo) + sizeof(DepthBounds) + sizeof(StencilInfo), sizeof(StencilInfo))), "'",
1489 32 : base16::encode<Interface>(view.sub(sizeof(BlendInfo) + sizeof(DepthInfo) + sizeof(DepthBounds) + sizeof(StencilInfo) * 2))
1490 32 : );
1491 : }
1492 :
1493 166 : String PipelineMaterialInfo::description() const {
1494 166 : StringStream stream;
1495 166 : stream << "{" << blend.enabled << "," << blend.srcColor << "," << blend.dstColor << "," << blend.opColor << ","
1496 166 : << blend.srcAlpha << "," << blend.dstAlpha << "," << blend.opAlpha << "," << blend.writeMask
1497 166 : << "},{" << depth.writeEnabled << "," << depth.testEnabled << "," << depth.compare
1498 166 : << "},{" << bounds.enabled << "," << bounds.min << "," << bounds.max
1499 166 : << "},{" << stencil << "}";
1500 332 : return stream.str();
1501 166 : }
1502 :
1503 73134 : PipelineMaterialInfo::PipelineMaterialInfo() {
1504 73134 : memset(this, 0, sizeof(PipelineMaterialInfo));
1505 73134 : }
1506 :
1507 154771 : void PipelineMaterialInfo::setBlendInfo(const BlendInfo &info) {
1508 154771 : if (info.isEnabled()) {
1509 121841 : blend = info;
1510 : } else {
1511 32930 : blend = BlendInfo();
1512 32930 : blend.writeMask = info.writeMask;
1513 : }
1514 154771 : }
1515 :
1516 154759 : void PipelineMaterialInfo::setDepthInfo(const DepthInfo &info) {
1517 154759 : if (info.testEnabled) {
1518 154743 : depth.testEnabled = 1;
1519 154743 : depth.compare = info.compare;
1520 : } else {
1521 16 : depth.testEnabled = 0;
1522 16 : depth.compare = 0;
1523 : }
1524 154759 : if (info.writeEnabled) {
1525 32930 : depth.writeEnabled = 1;
1526 : } else {
1527 121829 : depth.writeEnabled = 0;
1528 : }
1529 154759 : }
1530 :
1531 48 : void PipelineMaterialInfo::setDepthBounds(const DepthBounds &b) {
1532 48 : if (b.enabled) {
1533 16 : bounds = b;
1534 : } else {
1535 32 : bounds = DepthBounds();
1536 : }
1537 48 : }
1538 :
1539 32 : void PipelineMaterialInfo::enableStencil(const StencilInfo &info) {
1540 32 : stencil = 1;
1541 32 : front = info;
1542 32 : back = info;
1543 32 : }
1544 :
1545 16 : void PipelineMaterialInfo::enableStencil(const StencilInfo &f, const StencilInfo &b) {
1546 16 : stencil = 1;
1547 16 : front = f;
1548 16 : back = b;
1549 16 : }
1550 :
1551 16 : void PipelineMaterialInfo::disableStancil() {
1552 16 : stencil = 0;
1553 16 : memset(&front, 0, sizeof(StencilInfo));
1554 16 : memset(&back, 0, sizeof(StencilInfo));
1555 16 : }
1556 :
1557 44 : void PipelineMaterialInfo::setLineWidth(float width) {
1558 44 : if (width == 0.0f) {
1559 22 : memset(&lineWidth, 0, sizeof(float));
1560 : } else {
1561 22 : lineWidth = width;
1562 : }
1563 44 : }
1564 :
1565 96 : void PipelineMaterialInfo::_setup(const BlendInfo &info) {
1566 96 : setBlendInfo(info);
1567 96 : }
1568 :
1569 96 : void PipelineMaterialInfo::_setup(const DepthInfo &info) {
1570 96 : setDepthInfo(info);
1571 96 : }
1572 :
1573 16 : void PipelineMaterialInfo::_setup(const DepthBounds &b) {
1574 16 : setDepthBounds(b);
1575 16 : }
1576 :
1577 16 : void PipelineMaterialInfo::_setup(const StencilInfo &info) {
1578 16 : enableStencil(info);
1579 16 : }
1580 :
1581 16 : void PipelineMaterialInfo::_setup(LineWidth width) {
1582 16 : setLineWidth(width.get());
1583 16 : }
1584 :
1585 2064 : StringView getInputKeyCodeName(InputKeyCode code) {
1586 2064 : switch (code) {
1587 16 : case InputKeyCode::Unknown: return StringView("Unknown"); break;
1588 16 : case InputKeyCode::KP_DECIMAL: return StringView("KP_DECIMAL"); break;
1589 16 : case InputKeyCode::KP_DIVIDE: return StringView("KP_DIVIDE"); break;
1590 16 : case InputKeyCode::KP_MULTIPLY: return StringView("KP_MULTIPLY"); break;
1591 16 : case InputKeyCode::KP_SUBTRACT: return StringView("KP_SUBTRACT"); break;
1592 16 : case InputKeyCode::KP_ADD: return StringView("KP_ADD"); break;
1593 16 : case InputKeyCode::KP_ENTER: return StringView("KP_ENTER"); break;
1594 16 : case InputKeyCode::KP_EQUAL: return StringView("KP_EQUAL"); break;
1595 :
1596 16 : case InputKeyCode::BACKSPACE: return StringView("BACKSPACE"); break;
1597 16 : case InputKeyCode::TAB: return StringView("TAB"); break;
1598 16 : case InputKeyCode::ENTER: return StringView("ENTER"); break;
1599 :
1600 16 : case InputKeyCode::RIGHT: return StringView("RIGHT"); break;
1601 16 : case InputKeyCode::LEFT: return StringView("LEFT"); break;
1602 16 : case InputKeyCode::DOWN: return StringView("DOWN"); break;
1603 16 : case InputKeyCode::UP: return StringView("UP"); break;
1604 16 : case InputKeyCode::PAGE_UP: return StringView("PAGE_UP"); break;
1605 16 : case InputKeyCode::PAGE_DOWN: return StringView("PAGE_DOWN"); break;
1606 16 : case InputKeyCode::HOME: return StringView("HOME"); break;
1607 16 : case InputKeyCode::END: return StringView("END"); break;
1608 16 : case InputKeyCode::LEFT_SHIFT: return StringView("LEFT_SHIFT"); break;
1609 16 : case InputKeyCode::LEFT_CONTROL: return StringView("LEFT_CONTROL"); break;
1610 16 : case InputKeyCode::LEFT_ALT: return StringView("LEFT_ALT"); break;
1611 16 : case InputKeyCode::LEFT_SUPER: return StringView("LEFT_SUPER"); break;
1612 16 : case InputKeyCode::RIGHT_SHIFT: return StringView("RIGHT_SHIFT"); break;
1613 16 : case InputKeyCode::RIGHT_CONTROL: return StringView("RIGHT_CONTROL"); break;
1614 16 : case InputKeyCode::RIGHT_ALT: return StringView("RIGHT_ALT"); break;
1615 16 : case InputKeyCode::RIGHT_SUPER: return StringView("RIGHT_SUPER"); break;
1616 :
1617 16 : case InputKeyCode::ESCAPE: return StringView("ESCAPE"); break;
1618 :
1619 16 : case InputKeyCode::INSERT: return StringView("INSERT"); break;
1620 16 : case InputKeyCode::CAPS_LOCK: return StringView("CAPS_LOCK"); break;
1621 16 : case InputKeyCode::SCROLL_LOCK: return StringView("SCROLL_LOCK"); break;
1622 16 : case InputKeyCode::NUM_LOCK: return StringView("NUM_LOCK"); break;
1623 :
1624 16 : case InputKeyCode::SPACE: return StringView("SPACE"); break;
1625 :
1626 16 : case InputKeyCode::KP_0: return StringView("KP_0"); break;
1627 16 : case InputKeyCode::KP_1: return StringView("KP_1"); break;
1628 16 : case InputKeyCode::KP_2: return StringView("KP_2"); break;
1629 16 : case InputKeyCode::KP_3: return StringView("KP_3"); break;
1630 16 : case InputKeyCode::KP_4: return StringView("KP_4"); break;
1631 16 : case InputKeyCode::KP_5: return StringView("KP_5"); break;
1632 16 : case InputKeyCode::KP_6: return StringView("KP_6"); break;
1633 16 : case InputKeyCode::KP_7: return StringView("KP_7"); break;
1634 16 : case InputKeyCode::KP_8: return StringView("KP_8"); break;
1635 16 : case InputKeyCode::KP_9: return StringView("KP_9"); break;
1636 :
1637 16 : case InputKeyCode::APOSTROPHE: return StringView("APOSTROPHE"); break;
1638 16 : case InputKeyCode::COMMA: return StringView("COMMA"); break;
1639 16 : case InputKeyCode::MINUS: return StringView("MINUS"); break;
1640 16 : case InputKeyCode::PERIOD: return StringView("PERIOD"); break;
1641 16 : case InputKeyCode::SLASH: return StringView("SLASH"); break;
1642 16 : case InputKeyCode::_0: return StringView("0"); break;
1643 16 : case InputKeyCode::_1: return StringView("1"); break;
1644 16 : case InputKeyCode::_2: return StringView("2"); break;
1645 16 : case InputKeyCode::_3: return StringView("3"); break;
1646 16 : case InputKeyCode::_4: return StringView("4"); break;
1647 16 : case InputKeyCode::_5: return StringView("5"); break;
1648 16 : case InputKeyCode::_6: return StringView("6"); break;
1649 16 : case InputKeyCode::_7: return StringView("7"); break;
1650 16 : case InputKeyCode::_8: return StringView("8"); break;
1651 16 : case InputKeyCode::_9: return StringView("9"); break;
1652 16 : case InputKeyCode::SEMICOLON: return StringView("SEMICOLON"); break;
1653 16 : case InputKeyCode::EQUAL: return StringView("EQUAL"); break;
1654 :
1655 16 : case InputKeyCode::WORLD_1: return StringView("WORLD_1"); break;
1656 16 : case InputKeyCode::WORLD_2: return StringView("WORLD_2"); break;
1657 :
1658 32 : case InputKeyCode::A: return StringView("A"); break;
1659 16 : case InputKeyCode::B: return StringView("B"); break;
1660 16 : case InputKeyCode::C: return StringView("C"); break;
1661 16 : case InputKeyCode::D: return StringView("D"); break;
1662 16 : case InputKeyCode::E: return StringView("E"); break;
1663 16 : case InputKeyCode::F: return StringView("F"); break;
1664 16 : case InputKeyCode::G: return StringView("G"); break;
1665 16 : case InputKeyCode::H: return StringView("H"); break;
1666 16 : case InputKeyCode::I: return StringView("I"); break;
1667 16 : case InputKeyCode::J: return StringView("J"); break;
1668 16 : case InputKeyCode::K: return StringView("K"); break;
1669 16 : case InputKeyCode::L: return StringView("L"); break;
1670 16 : case InputKeyCode::M: return StringView("M"); break;
1671 16 : case InputKeyCode::N: return StringView("N"); break;
1672 16 : case InputKeyCode::O: return StringView("O"); break;
1673 16 : case InputKeyCode::P: return StringView("P"); break;
1674 16 : case InputKeyCode::Q: return StringView("Q"); break;
1675 16 : case InputKeyCode::R: return StringView("R"); break;
1676 16 : case InputKeyCode::S: return StringView("S"); break;
1677 16 : case InputKeyCode::T: return StringView("T"); break;
1678 16 : case InputKeyCode::U: return StringView("U"); break;
1679 16 : case InputKeyCode::V: return StringView("V"); break;
1680 16 : case InputKeyCode::W: return StringView("W"); break;
1681 16 : case InputKeyCode::X: return StringView("X"); break;
1682 16 : case InputKeyCode::Y: return StringView("Y"); break;
1683 16 : case InputKeyCode::Z: return StringView("Z"); break;
1684 16 : case InputKeyCode::LEFT_BRACKET: return StringView("LEFT_BRACKET"); break;
1685 16 : case InputKeyCode::BACKSLASH: return StringView("BACKSLASH"); break;
1686 16 : case InputKeyCode::RIGHT_BRACKET: return StringView("RIGHT_BRACKET"); break;
1687 16 : case InputKeyCode::GRAVE_ACCENT: return StringView("GRAVE_ACCENT"); break;
1688 :
1689 : /* Function keys */
1690 16 : case InputKeyCode::F1: return StringView("F1"); break;
1691 16 : case InputKeyCode::F2: return StringView("F2"); break;
1692 16 : case InputKeyCode::F3: return StringView("F3"); break;
1693 16 : case InputKeyCode::F4: return StringView("F4"); break;
1694 16 : case InputKeyCode::F5: return StringView("F5"); break;
1695 16 : case InputKeyCode::F6: return StringView("F6"); break;
1696 16 : case InputKeyCode::F7: return StringView("F7"); break;
1697 16 : case InputKeyCode::F8: return StringView("F8"); break;
1698 16 : case InputKeyCode::F9: return StringView("F9"); break;
1699 16 : case InputKeyCode::F10: return StringView("F10"); break;
1700 16 : case InputKeyCode::F11: return StringView("F11"); break;
1701 16 : case InputKeyCode::F12: return StringView("F12"); break;
1702 16 : case InputKeyCode::F13: return StringView("F13"); break;
1703 16 : case InputKeyCode::F14: return StringView("F14"); break;
1704 16 : case InputKeyCode::F15: return StringView("F15"); break;
1705 16 : case InputKeyCode::F16: return StringView("F16"); break;
1706 16 : case InputKeyCode::F17: return StringView("F17"); break;
1707 16 : case InputKeyCode::F18: return StringView("F18"); break;
1708 16 : case InputKeyCode::F19: return StringView("F19"); break;
1709 16 : case InputKeyCode::F20: return StringView("F20"); break;
1710 16 : case InputKeyCode::F21: return StringView("F21"); break;
1711 16 : case InputKeyCode::F22: return StringView("F22"); break;
1712 16 : case InputKeyCode::F23: return StringView("F23"); break;
1713 16 : case InputKeyCode::F24: return StringView("F24"); break;
1714 16 : case InputKeyCode::F25: return StringView("F25"); break;
1715 :
1716 16 : case InputKeyCode::MENU: return StringView("MENU"); break;
1717 16 : case InputKeyCode::PRINT_SCREEN: return StringView("PRINT_SCREEN"); break;
1718 16 : case InputKeyCode::PAUSE: return StringView("PAUSE"); break;
1719 16 : case InputKeyCode::DELETE: return StringView("DELETE"); break;
1720 112 : default: break;
1721 : }
1722 112 : return StringView();
1723 : }
1724 :
1725 2064 : StringView getInputKeyCodeKeyName(InputKeyCode code) {
1726 2064 : switch (code) {
1727 16 : case InputKeyCode::KP_DECIMAL: return StringView("KPDL"); break;
1728 16 : case InputKeyCode::KP_DIVIDE: return StringView("KPDV"); break;
1729 16 : case InputKeyCode::KP_MULTIPLY: return StringView("KPMU"); break;
1730 16 : case InputKeyCode::KP_SUBTRACT: return StringView("KPSU"); break;
1731 16 : case InputKeyCode::KP_ADD: return StringView("KPAD"); break;
1732 16 : case InputKeyCode::KP_ENTER: return StringView("KPEN"); break;
1733 16 : case InputKeyCode::KP_EQUAL: return StringView("KPEQ"); break;
1734 :
1735 16 : case InputKeyCode::BACKSPACE: return StringView("BKSP"); break;
1736 16 : case InputKeyCode::TAB: return StringView("TAB"); break;
1737 16 : case InputKeyCode::ENTER: return StringView("RTRN"); break;
1738 :
1739 16 : case InputKeyCode::RIGHT: return StringView("RGHT"); break;
1740 16 : case InputKeyCode::LEFT: return StringView("LEFT"); break;
1741 16 : case InputKeyCode::DOWN: return StringView("DOWN"); break;
1742 16 : case InputKeyCode::UP: return StringView("UP"); break;
1743 16 : case InputKeyCode::PAGE_UP: return StringView("PGUP"); break;
1744 16 : case InputKeyCode::PAGE_DOWN: return StringView("PGDN"); break;
1745 16 : case InputKeyCode::HOME: return StringView("HOME"); break;
1746 16 : case InputKeyCode::END: return StringView("END"); break;
1747 16 : case InputKeyCode::LEFT_SHIFT: return StringView("LFSH"); break;
1748 16 : case InputKeyCode::LEFT_CONTROL: return StringView("LCTL"); break;
1749 16 : case InputKeyCode::LEFT_ALT: return StringView("LALT"); break;
1750 16 : case InputKeyCode::LEFT_SUPER: return StringView("LWIN"); break;
1751 16 : case InputKeyCode::RIGHT_SHIFT: return StringView("RTSH"); break;
1752 16 : case InputKeyCode::RIGHT_CONTROL: return StringView("RCTL"); break;
1753 16 : case InputKeyCode::RIGHT_ALT: return StringView("RALT"); break;
1754 16 : case InputKeyCode::RIGHT_SUPER: return StringView("RWIN"); break;
1755 :
1756 16 : case InputKeyCode::ESCAPE: return StringView("ESC"); break;
1757 :
1758 16 : case InputKeyCode::INSERT: return StringView("INS"); break;
1759 16 : case InputKeyCode::CAPS_LOCK: return StringView("CAPS"); break;
1760 16 : case InputKeyCode::SCROLL_LOCK: return StringView("SCLK"); break;
1761 16 : case InputKeyCode::NUM_LOCK: return StringView("NMLK"); break;
1762 :
1763 16 : case InputKeyCode::SPACE: return StringView("SPCE"); break;
1764 :
1765 16 : case InputKeyCode::KP_0: return StringView("KP0"); break;
1766 16 : case InputKeyCode::KP_1: return StringView("KP1"); break;
1767 16 : case InputKeyCode::KP_2: return StringView("KP2"); break;
1768 16 : case InputKeyCode::KP_3: return StringView("KP3"); break;
1769 16 : case InputKeyCode::KP_4: return StringView("KP4"); break;
1770 16 : case InputKeyCode::KP_5: return StringView("KP5"); break;
1771 16 : case InputKeyCode::KP_6: return StringView("KP6"); break;
1772 16 : case InputKeyCode::KP_7: return StringView("KP7"); break;
1773 16 : case InputKeyCode::KP_8: return StringView("KP8"); break;
1774 16 : case InputKeyCode::KP_9: return StringView("KP9"); break;
1775 :
1776 16 : case InputKeyCode::APOSTROPHE: return StringView("AC11"); break;
1777 16 : case InputKeyCode::COMMA: return StringView("AB08"); break;
1778 16 : case InputKeyCode::MINUS: return StringView("AE11"); break;
1779 16 : case InputKeyCode::PERIOD: return StringView("AB09"); break;
1780 16 : case InputKeyCode::SLASH: return StringView("AB10"); break;
1781 16 : case InputKeyCode::_0: return StringView("AE10"); break;
1782 16 : case InputKeyCode::_1: return StringView("AE01"); break;
1783 16 : case InputKeyCode::_2: return StringView("AE02"); break;
1784 16 : case InputKeyCode::_3: return StringView("AE03"); break;
1785 16 : case InputKeyCode::_4: return StringView("AE04"); break;
1786 16 : case InputKeyCode::_5: return StringView("AE05"); break;
1787 16 : case InputKeyCode::_6: return StringView("AE06"); break;
1788 16 : case InputKeyCode::_7: return StringView("AE07"); break;
1789 16 : case InputKeyCode::_8: return StringView("AE08"); break;
1790 16 : case InputKeyCode::_9: return StringView("AE09"); break;
1791 16 : case InputKeyCode::SEMICOLON: return StringView("AC10"); break;
1792 16 : case InputKeyCode::EQUAL: return StringView("AE12"); break;
1793 :
1794 16 : case InputKeyCode::WORLD_1: return StringView("LSGT"); break;
1795 :
1796 32 : case InputKeyCode::A: return StringView("AC01"); break;
1797 16 : case InputKeyCode::B: return StringView("AB05"); break;
1798 16 : case InputKeyCode::C: return StringView("AB03"); break;
1799 16 : case InputKeyCode::D: return StringView("AC03"); break;
1800 16 : case InputKeyCode::E: return StringView("AD03"); break;
1801 16 : case InputKeyCode::F: return StringView("AC04"); break;
1802 16 : case InputKeyCode::G: return StringView("AC05"); break;
1803 16 : case InputKeyCode::H: return StringView("AC06"); break;
1804 16 : case InputKeyCode::I: return StringView("AD08"); break;
1805 16 : case InputKeyCode::J: return StringView("AC07"); break;
1806 16 : case InputKeyCode::K: return StringView("AC08"); break;
1807 16 : case InputKeyCode::L: return StringView("AC09"); break;
1808 16 : case InputKeyCode::M: return StringView("AB07"); break;
1809 16 : case InputKeyCode::N: return StringView("AB06"); break;
1810 16 : case InputKeyCode::O: return StringView("AD09"); break;
1811 16 : case InputKeyCode::P: return StringView("AD10"); break;
1812 16 : case InputKeyCode::Q: return StringView("AD01"); break;
1813 16 : case InputKeyCode::R: return StringView("AD04"); break;
1814 16 : case InputKeyCode::S: return StringView("AC02"); break;
1815 16 : case InputKeyCode::T: return StringView("AD05"); break;
1816 16 : case InputKeyCode::U: return StringView("AD07"); break;
1817 16 : case InputKeyCode::V: return StringView("AB04"); break;
1818 16 : case InputKeyCode::W: return StringView("AD02"); break;
1819 16 : case InputKeyCode::X: return StringView("AB02"); break;
1820 16 : case InputKeyCode::Y: return StringView("AD06"); break;
1821 16 : case InputKeyCode::Z: return StringView("AB01"); break;
1822 16 : case InputKeyCode::LEFT_BRACKET: return StringView("AD11"); break;
1823 16 : case InputKeyCode::BACKSLASH: return StringView("BKSL"); break;
1824 16 : case InputKeyCode::RIGHT_BRACKET: return StringView("AD12"); break;
1825 16 : case InputKeyCode::GRAVE_ACCENT: return StringView("TLDE"); break;
1826 :
1827 : // Function keys
1828 16 : case InputKeyCode::F1: return StringView("FK01"); break;
1829 16 : case InputKeyCode::F2: return StringView("FK02"); break;
1830 16 : case InputKeyCode::F3: return StringView("FK03"); break;
1831 16 : case InputKeyCode::F4: return StringView("FK04"); break;
1832 16 : case InputKeyCode::F5: return StringView("FK05"); break;
1833 16 : case InputKeyCode::F6: return StringView("FK06"); break;
1834 16 : case InputKeyCode::F7: return StringView("FK07"); break;
1835 16 : case InputKeyCode::F8: return StringView("FK08"); break;
1836 16 : case InputKeyCode::F9: return StringView("FK09"); break;
1837 16 : case InputKeyCode::F10: return StringView("FK10"); break;
1838 16 : case InputKeyCode::F11: return StringView("FK11"); break;
1839 16 : case InputKeyCode::F12: return StringView("FK12"); break;
1840 16 : case InputKeyCode::F13: return StringView("FK13"); break;
1841 16 : case InputKeyCode::F14: return StringView("FK14"); break;
1842 16 : case InputKeyCode::F15: return StringView("FK15"); break;
1843 16 : case InputKeyCode::F16: return StringView("FK16"); break;
1844 16 : case InputKeyCode::F17: return StringView("FK17"); break;
1845 16 : case InputKeyCode::F18: return StringView("FK18"); break;
1846 16 : case InputKeyCode::F19: return StringView("FK19"); break;
1847 16 : case InputKeyCode::F20: return StringView("FK20"); break;
1848 16 : case InputKeyCode::F21: return StringView("FK21"); break;
1849 16 : case InputKeyCode::F22: return StringView("FK22"); break;
1850 16 : case InputKeyCode::F23: return StringView("FK23"); break;
1851 16 : case InputKeyCode::F24: return StringView("FK24"); break;
1852 16 : case InputKeyCode::F25: return StringView("FK25"); break;
1853 :
1854 16 : case InputKeyCode::MENU: return StringView("MENU"); break;
1855 16 : case InputKeyCode::PRINT_SCREEN: return StringView("PRSC"); break;
1856 16 : case InputKeyCode::PAUSE: return StringView("PAUS"); break;
1857 16 : case InputKeyCode::DELETE: return StringView("DELE"); break;
1858 144 : default: break;
1859 : }
1860 144 : return StringView();
1861 : }
1862 :
1863 256 : StringView getInputEventName(InputEventName name) {
1864 256 : switch (name) {
1865 16 : case InputEventName::None: return StringView("None"); break;
1866 16 : case InputEventName::Begin: return StringView("Begin"); break;
1867 16 : case InputEventName::Move: return StringView("Move"); break;
1868 16 : case InputEventName::End: return StringView("End"); break;
1869 16 : case InputEventName::Cancel: return StringView("Cancel"); break;
1870 16 : case InputEventName::MouseMove: return StringView("MouseMove"); break;
1871 16 : case InputEventName::Scroll: return StringView("Scroll"); break;
1872 :
1873 32 : case InputEventName::Background: return StringView("Background"); break;
1874 16 : case InputEventName::PointerEnter: return StringView("PointerEnter"); break;
1875 16 : case InputEventName::FocusGain: return StringView("FocusGain"); break;
1876 :
1877 16 : case InputEventName::KeyPressed: return StringView("KeyPressed"); break;
1878 16 : case InputEventName::KeyRepeated: return StringView("KeyRepeated"); break;
1879 16 : case InputEventName::KeyReleased: return StringView("KeyReleased"); break;
1880 16 : case InputEventName::KeyCanceled: return StringView("KeyCanceled"); break;
1881 16 : default: break;
1882 : }
1883 16 : return StringView();
1884 : }
1885 :
1886 256 : StringView getInputButtonName(InputMouseButton btn) {
1887 256 : switch (btn) {
1888 16 : case InputMouseButton::MouseLeft: return StringView("MouseLeft"); break;
1889 16 : case InputMouseButton::MouseMiddle: return StringView("MouseMiddle"); break;
1890 16 : case InputMouseButton::MouseRight: return StringView("MouseRight"); break;
1891 16 : case InputMouseButton::MouseScrollUp: return StringView("MouseScrollUp"); break;
1892 16 : case InputMouseButton::MouseScrollDown: return StringView("MouseScrollDown"); break;
1893 16 : case InputMouseButton::MouseScrollLeft: return StringView("MouseScrollLeft"); break;
1894 16 : case InputMouseButton::MouseScrollRight: return StringView("MouseScrollRight"); break;
1895 16 : case InputMouseButton::Mouse8: return StringView("Mouse8"); break;
1896 16 : case InputMouseButton::Mouse9: return StringView("Mouse9"); break;
1897 16 : case InputMouseButton::Mouse10: return StringView("Mouse10"); break;
1898 16 : case InputMouseButton::Mouse11: return StringView("Mouse11"); break;
1899 16 : case InputMouseButton::Mouse12: return StringView("Mouse12"); break;
1900 16 : case InputMouseButton::Mouse13: return StringView("Mouse13"); break;
1901 16 : case InputMouseButton::Mouse14: return StringView("Mouse14"); break;
1902 16 : case InputMouseButton::Mouse15: return StringView("Mouse15"); break;
1903 16 : default: break;
1904 : }
1905 16 : return StringView();
1906 : }
1907 :
1908 16 : String getInputModifiersNames(InputModifier mod) {
1909 16 : StringStream out;
1910 16 : if ((mod & InputModifier::Shift) != InputModifier::None) { out << " Shift"; }
1911 16 : if ((mod & InputModifier::CapsLock) != InputModifier::None) { out << " CapsLock"; }
1912 16 : if ((mod & InputModifier::Ctrl) != InputModifier::None) { out << " Ctrl"; }
1913 16 : if ((mod & InputModifier::Alt) != InputModifier::None) { out << " Alt"; }
1914 16 : if ((mod & InputModifier::NumLock) != InputModifier::None) { out << " NumLock"; }
1915 16 : if ((mod & InputModifier::Mod3) != InputModifier::None) { out << " Mod3"; }
1916 16 : if ((mod & InputModifier::Mod4) != InputModifier::None) { out << " Mod4"; }
1917 16 : if ((mod & InputModifier::Mod5) != InputModifier::None) { out << " Mod5"; }
1918 16 : if ((mod & InputModifier::LayoutAlternative) != InputModifier::None) { out << " LayoutAlternative"; }
1919 16 : if ((mod & InputModifier::ShiftL) != InputModifier::None) { out << " ShiftL"; }
1920 16 : if ((mod & InputModifier::ShiftR) != InputModifier::None) { out << " ShiftR"; }
1921 16 : if ((mod & InputModifier::CtrlL) != InputModifier::None) { out << " CtrlL"; }
1922 16 : if ((mod & InputModifier::CtrlR) != InputModifier::None) { out << " CtrlR"; }
1923 16 : if ((mod & InputModifier::AltL) != InputModifier::None) { out << " AltL"; }
1924 16 : if ((mod & InputModifier::AltR) != InputModifier::None) { out << " AltR"; }
1925 16 : if ((mod & InputModifier::Mod3L) != InputModifier::None) { out << " Mod3L"; }
1926 16 : if ((mod & InputModifier::Mod3L) != InputModifier::None) { out << " Mod3L"; }
1927 16 : if ((mod & InputModifier::Mod4L) != InputModifier::None) { out << " Mod4L"; }
1928 16 : if ((mod & InputModifier::Mod4R) != InputModifier::None) { out << " Mod4R"; }
1929 16 : if ((mod & InputModifier::ScrollLock) != InputModifier::None) { out << " ScrollLock"; }
1930 32 : return out.str();
1931 16 : }
1932 :
1933 : #ifdef __LCC__
1934 :
1935 : const TextCursor TextCursor::InvalidCursor(maxOf<uint32_t>(), 0.0f);
1936 :
1937 : #endif
1938 : }
1939 :
1940 : namespace std {
1941 :
1942 16 : std::ostream &operator<<(std::ostream &stream, STAPPLER_VERSIONIZED_NAMESPACE::xenolith::core::InputKeyCode code) {
1943 16 : stream << "InputKeyCode(" << STAPPLER_VERSIONIZED_NAMESPACE::toInt(code) << ", "
1944 16 : << getInputKeyCodeName(code) << ", " << getInputKeyCodeKeyName(code) << ")";
1945 16 : return stream;
1946 : }
1947 :
1948 16 : std::ostream &operator<<(std::ostream &stream, STAPPLER_VERSIONIZED_NAMESPACE::xenolith::core::InputEventName name) {
1949 16 : stream << "InputEventName(" << STAPPLER_VERSIONIZED_NAMESPACE::xenolith::core::getInputEventName(name) << ")";
1950 16 : return stream;
1951 : }
1952 :
1953 :
1954 : }
|