| 1 | /**************************************************************************/ |
| 2 | /* openxr_d3d12_extension.cpp */ |
| 3 | /**************************************************************************/ |
| 4 | /* This file is part of: */ |
| 5 | /* GODOT ENGINE */ |
| 6 | /* https://godotengine.org */ |
| 7 | /**************************************************************************/ |
| 8 | /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ |
| 9 | /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ |
| 10 | /* */ |
| 11 | /* Permission is hereby granted, free of charge, to any person obtaining */ |
| 12 | /* a copy of this software and associated documentation files (the */ |
| 13 | /* "Software"), to deal in the Software without restriction, including */ |
| 14 | /* without limitation the rights to use, copy, modify, merge, publish, */ |
| 15 | /* distribute, sublicense, and/or sell copies of the Software, and to */ |
| 16 | /* permit persons to whom the Software is furnished to do so, subject to */ |
| 17 | /* the following conditions: */ |
| 18 | /* */ |
| 19 | /* The above copyright notice and this permission notice shall be */ |
| 20 | /* included in all copies or substantial portions of the Software. */ |
| 21 | /* */ |
| 22 | /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ |
| 23 | /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ |
| 24 | /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ |
| 25 | /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ |
| 26 | /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ |
| 27 | /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ |
| 28 | /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ |
| 29 | /**************************************************************************/ |
| 30 | |
| 31 | #include "openxr_d3d12_extension.h" |
| 32 | |
| 33 | #ifdef D3D12_ENABLED |
| 34 | |
| 35 | #include "../../openxr_util.h" |
| 36 | |
| 37 | #include "servers/rendering/rendering_server.h" |
| 38 | #include "servers/rendering/rendering_server_globals.h" |
| 39 | |
| 40 | HashMap<String, bool *> OpenXRD3D12Extension::get_requested_extensions(XrVersion p_version) { |
| 41 | HashMap<String, bool *> request_extensions; |
| 42 | |
| 43 | request_extensions[XR_KHR_D3D12_ENABLE_EXTENSION_NAME] = nullptr; |
| 44 | |
| 45 | return request_extensions; |
| 46 | } |
| 47 | |
| 48 | void OpenXRD3D12Extension::on_instance_created(const XrInstance p_instance) { |
| 49 | // Obtain pointers to functions we're accessing here. |
| 50 | ERR_FAIL_NULL(OpenXRAPI::get_singleton()); |
| 51 | |
| 52 | EXT_INIT_XR_FUNC(xrGetD3D12GraphicsRequirementsKHR); |
| 53 | EXT_INIT_XR_FUNC(xrEnumerateSwapchainImages); |
| 54 | } |
| 55 | |
| 56 | D3D_FEATURE_LEVEL OpenXRD3D12Extension::get_feature_level() const { |
| 57 | XrGraphicsRequirementsD3D12KHR d3d12_requirements = { |
| 58 | XR_TYPE_GRAPHICS_REQUIREMENTS_D3D12_KHR, // type |
| 59 | nullptr, // next |
| 60 | { 0, 0 }, // adapterLuid |
| 61 | (D3D_FEATURE_LEVEL)0 // minFeatureLevel |
| 62 | }; |
| 63 | |
| 64 | XrResult result = xrGetD3D12GraphicsRequirementsKHR(OpenXRAPI::get_singleton()->get_instance(), OpenXRAPI::get_singleton()->get_system_id(), &d3d12_requirements); |
| 65 | if (XR_FAILED(result)) { |
| 66 | print_line("OpenXR: Failed to get Direct3D 12 graphics requirements [", OpenXRAPI::get_singleton()->get_error_string(result), "]"); |
| 67 | return D3D_FEATURE_LEVEL_11_0; // Good default. |
| 68 | } |
| 69 | |
| 70 | // #ifdef DEBUG |
| 71 | print_line("OpenXR: xrGetD3D12GraphicsRequirementsKHR:"); |
| 72 | print_line(" - minFeatureLevel: ", (uint32_t)d3d12_requirements.minFeatureLevel); |
| 73 | // #endif |
| 74 | |
| 75 | return d3d12_requirements.minFeatureLevel; |
| 76 | } |
| 77 | |
| 78 | LUID OpenXRD3D12Extension::get_adapter_luid() const { |
| 79 | XrGraphicsRequirementsD3D12KHR d3d12_requirements = { |
| 80 | XR_TYPE_GRAPHICS_REQUIREMENTS_D3D12_KHR, // type |
| 81 | nullptr, // next |
| 82 | { 0, 0 }, // adapterLuid |
| 83 | (D3D_FEATURE_LEVEL)0 // minFeatureLevel |
| 84 | }; |
| 85 | |
| 86 | XrResult result = xrGetD3D12GraphicsRequirementsKHR(OpenXRAPI::get_singleton()->get_instance(), OpenXRAPI::get_singleton()->get_system_id(), &d3d12_requirements); |
| 87 | if (XR_FAILED(result)) { |
| 88 | print_line("OpenXR: Failed to get Direct3D 12 graphics requirements [", OpenXRAPI::get_singleton()->get_error_string(result), "]"); |
| 89 | return {}; |
| 90 | } |
| 91 | |
| 92 | return d3d12_requirements.adapterLuid; |
| 93 | } |
| 94 | |
| 95 | void OpenXRD3D12Extension::set_device(ID3D12Device *p_device) { |
| 96 | graphics_device = p_device; |
| 97 | } |
| 98 | |
| 99 | void OpenXRD3D12Extension::set_command_queue(ID3D12CommandQueue *p_queue) { |
| 100 | command_queue = p_queue; |
| 101 | } |
| 102 | |
| 103 | void OpenXRD3D12Extension::cleanup_device() { |
| 104 | command_queue.Reset(); |
| 105 | graphics_device.Reset(); |
| 106 | } |
| 107 | |
| 108 | XrGraphicsBindingD3D12KHR OpenXRD3D12Extension::graphics_binding_d3d12; |
| 109 | |
| 110 | void *OpenXRD3D12Extension::set_session_create_and_get_next_pointer(void *p_next_pointer) { |
| 111 | DEV_ASSERT(graphics_device && "Graphics Device was not specified yet."); |
| 112 | DEV_ASSERT(command_queue && "Command queue was not specified yet."); |
| 113 | |
| 114 | graphics_binding_d3d12.type = XR_TYPE_GRAPHICS_BINDING_D3D12_KHR, |
| 115 | graphics_binding_d3d12.next = p_next_pointer; |
| 116 | graphics_binding_d3d12.device = graphics_device.Get(); |
| 117 | graphics_binding_d3d12.queue = command_queue.Get(); |
| 118 | |
| 119 | return &graphics_binding_d3d12; |
| 120 | } |
| 121 | |
| 122 | void OpenXRD3D12Extension::get_usable_swapchain_formats(Vector<int64_t> &p_usable_swap_chains) { |
| 123 | p_usable_swap_chains.push_back(DXGI_FORMAT_R8G8B8A8_UNORM_SRGB); |
| 124 | p_usable_swap_chains.push_back(DXGI_FORMAT_B8G8R8A8_UNORM_SRGB); |
| 125 | p_usable_swap_chains.push_back(DXGI_FORMAT_R8G8B8A8_UNORM); |
| 126 | p_usable_swap_chains.push_back(DXGI_FORMAT_B8G8R8A8_UNORM); |
| 127 | } |
| 128 | |
| 129 | void OpenXRD3D12Extension::get_usable_depth_formats(Vector<int64_t> &p_usable_depth_formats) { |
| 130 | p_usable_depth_formats.push_back(DXGI_FORMAT_D32_FLOAT); |
| 131 | p_usable_depth_formats.push_back(DXGI_FORMAT_D32_FLOAT_S8X24_UINT); |
| 132 | p_usable_depth_formats.push_back(DXGI_FORMAT_D24_UNORM_S8_UINT); |
| 133 | p_usable_depth_formats.push_back(DXGI_FORMAT_D16_UNORM); |
| 134 | } |
| 135 | |
| 136 | bool OpenXRD3D12Extension::get_swapchain_image_data(XrSwapchain p_swapchain, int64_t p_swapchain_format, uint32_t p_width, uint32_t p_height, uint32_t p_sample_count, uint32_t p_array_size, void **r_swapchain_graphics_data) { |
| 137 | RenderingServer *rendering_server = RenderingServer::get_singleton(); |
| 138 | ERR_FAIL_NULL_V(rendering_server, false); |
| 139 | RenderingDevice *rendering_device = rendering_server->get_rendering_device(); |
| 140 | ERR_FAIL_NULL_V(rendering_device, false); |
| 141 | |
| 142 | uint32_t swapchain_length; |
| 143 | XrResult result = xrEnumerateSwapchainImages(p_swapchain, 0, &swapchain_length, nullptr); |
| 144 | if (XR_FAILED(result)) { |
| 145 | print_line("OpenXR: Failed to get swapchain image count [", OpenXRAPI::get_singleton()->get_error_string(result), "]"); |
| 146 | return false; |
| 147 | } |
| 148 | |
| 149 | LocalVector<XrSwapchainImageD3D12KHR> images; |
| 150 | images.resize(swapchain_length); |
| 151 | |
| 152 | for (XrSwapchainImageD3D12KHR &image : images) { |
| 153 | image.type = XR_TYPE_SWAPCHAIN_IMAGE_D3D12_KHR; |
| 154 | image.next = nullptr; |
| 155 | image.texture = nullptr; |
| 156 | } |
| 157 | |
| 158 | result = xrEnumerateSwapchainImages(p_swapchain, swapchain_length, &swapchain_length, (XrSwapchainImageBaseHeader *)images.ptr()); |
| 159 | if (XR_FAILED(result)) { |
| 160 | print_line("OpenXR: Failed to get swapchain images [", OpenXRAPI::get_singleton()->get_error_string(result), "]"); |
| 161 | return false; |
| 162 | } |
| 163 | |
| 164 | SwapchainGraphicsData *data = memnew(SwapchainGraphicsData); |
| 165 | if (data == nullptr) { |
| 166 | print_line("OpenXR: Failed to allocate memory for swapchain data"); |
| 167 | return false; |
| 168 | } |
| 169 | *r_swapchain_graphics_data = data; |
| 170 | data->is_multiview = (p_array_size > 1); |
| 171 | |
| 172 | RenderingDevice::DataFormat format = RenderingDevice::DATA_FORMAT_R8G8B8A8_SRGB; |
| 173 | RenderingDevice::TextureSamples samples = RenderingDevice::TEXTURE_SAMPLES_1; |
| 174 | uint64_t usage_flags = RenderingDevice::TEXTURE_USAGE_SAMPLING_BIT; |
| 175 | |
| 176 | switch (p_swapchain_format) { |
| 177 | case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB: |
| 178 | // Even though this is an sRGB framebuffer format we're using UNORM here. |
| 179 | // The reason here is because Godot does a linear to sRGB conversion while |
| 180 | // with the sRGB format, this conversion would be doubled by the hardware. |
| 181 | // This also means we're reading the values as is for our preview on screen. |
| 182 | // The OpenXR runtime however is still treating this as an sRGB format and |
| 183 | // will thus do an sRGB -> Linear conversion as expected. |
| 184 | //format = RenderingDevice::DATA_FORMAT_R8G8B8A8_SRGB; |
| 185 | format = RenderingDevice::DATA_FORMAT_R8G8B8A8_UNORM; |
| 186 | usage_flags |= RenderingDevice::TEXTURE_USAGE_COLOR_ATTACHMENT_BIT; |
| 187 | break; |
| 188 | case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: |
| 189 | //format = RenderingDevice::DATA_FORMAT_B8G8R8A8_SRGB; |
| 190 | format = RenderingDevice::DATA_FORMAT_B8G8R8A8_UNORM; |
| 191 | usage_flags |= RenderingDevice::TEXTURE_USAGE_COLOR_ATTACHMENT_BIT; |
| 192 | break; |
| 193 | case DXGI_FORMAT_R8G8B8A8_UNORM: |
| 194 | format = RenderingDevice::DATA_FORMAT_R8G8B8A8_UINT; |
| 195 | usage_flags |= RenderingDevice::TEXTURE_USAGE_COLOR_ATTACHMENT_BIT; |
| 196 | break; |
| 197 | case DXGI_FORMAT_B8G8R8A8_UNORM: |
| 198 | format = RenderingDevice::DATA_FORMAT_B8G8R8A8_UINT; |
| 199 | usage_flags |= RenderingDevice::TEXTURE_USAGE_COLOR_ATTACHMENT_BIT; |
| 200 | break; |
| 201 | case DXGI_FORMAT_D32_FLOAT: |
| 202 | format = RenderingDevice::DATA_FORMAT_D32_SFLOAT; |
| 203 | usage_flags |= RenderingDevice::TEXTURE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT; |
| 204 | break; |
| 205 | case DXGI_FORMAT_D32_FLOAT_S8X24_UINT: |
| 206 | format = RenderingDevice::DATA_FORMAT_D32_SFLOAT_S8_UINT; |
| 207 | usage_flags |= RenderingDevice::TEXTURE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT; |
| 208 | break; |
| 209 | case DXGI_FORMAT_D24_UNORM_S8_UINT: |
| 210 | format = RenderingDevice::DATA_FORMAT_D24_UNORM_S8_UINT; |
| 211 | usage_flags |= RenderingDevice::TEXTURE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT; |
| 212 | break; |
| 213 | case DXGI_FORMAT_D16_UNORM: |
| 214 | format = RenderingDevice::DATA_FORMAT_D16_UNORM; |
| 215 | usage_flags |= RenderingDevice::TEXTURE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT; |
| 216 | break; |
| 217 | default: |
| 218 | // continue with our default value |
| 219 | print_line("OpenXR: Unsupported swapchain format", p_swapchain_format); |
| 220 | break; |
| 221 | } |
| 222 | |
| 223 | switch (p_sample_count) { |
| 224 | case 1: |
| 225 | samples = RenderingDevice::TEXTURE_SAMPLES_1; |
| 226 | break; |
| 227 | case 2: |
| 228 | samples = RenderingDevice::TEXTURE_SAMPLES_2; |
| 229 | break; |
| 230 | case 4: |
| 231 | samples = RenderingDevice::TEXTURE_SAMPLES_4; |
| 232 | break; |
| 233 | case 8: |
| 234 | samples = RenderingDevice::TEXTURE_SAMPLES_8; |
| 235 | break; |
| 236 | case 16: |
| 237 | samples = RenderingDevice::TEXTURE_SAMPLES_16; |
| 238 | break; |
| 239 | case 32: |
| 240 | samples = RenderingDevice::TEXTURE_SAMPLES_32; |
| 241 | break; |
| 242 | case 64: |
| 243 | samples = RenderingDevice::TEXTURE_SAMPLES_64; |
| 244 | break; |
| 245 | default: |
| 246 | // continue with our default value |
| 247 | print_line("OpenXR: Unsupported sample count", p_sample_count); |
| 248 | break; |
| 249 | } |
| 250 | |
| 251 | Vector<RID> texture_rids; |
| 252 | |
| 253 | for (const XrSwapchainImageD3D12KHR &swapchain_image : images) { |
| 254 | RID texture_rid = rendering_device->texture_create_from_extension( |
| 255 | p_array_size == 1 ? RenderingDevice::TEXTURE_TYPE_2D : RenderingDevice::TEXTURE_TYPE_2D_ARRAY, |
| 256 | format, |
| 257 | samples, |
| 258 | usage_flags, |
| 259 | (uint64_t)swapchain_image.texture, |
| 260 | p_width, |
| 261 | p_height, |
| 262 | 1, |
| 263 | p_array_size, |
| 264 | 1); |
| 265 | |
| 266 | texture_rids.push_back(texture_rid); |
| 267 | } |
| 268 | |
| 269 | data->texture_rids = texture_rids; |
| 270 | |
| 271 | return true; |
| 272 | } |
| 273 | |
| 274 | bool OpenXRD3D12Extension::create_projection_fov(const XrFovf p_fov, double p_z_near, double p_z_far, Projection &r_camera_matrix) { |
| 275 | OpenXRUtil::XrMatrix4x4f matrix; |
| 276 | OpenXRUtil::XrMatrix4x4f_CreateProjectionFov(&matrix, p_fov, (float)p_z_near, (float)p_z_far); |
| 277 | |
| 278 | for (int j = 0; j < 4; j++) { |
| 279 | for (int i = 0; i < 4; i++) { |
| 280 | r_camera_matrix.columns[j][i] = matrix.m[j * 4 + i]; |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | return true; |
| 285 | } |
| 286 | |
| 287 | RID OpenXRD3D12Extension::get_texture(void *p_swapchain_graphics_data, int p_image_index) { |
| 288 | SwapchainGraphicsData *data = (SwapchainGraphicsData *)p_swapchain_graphics_data; |
| 289 | ERR_FAIL_NULL_V(data, RID()); |
| 290 | |
| 291 | ERR_FAIL_INDEX_V(p_image_index, data->texture_rids.size(), RID()); |
| 292 | return data->texture_rids[p_image_index]; |
| 293 | } |
| 294 | |
| 295 | void OpenXRD3D12Extension::cleanup_swapchain_graphics_data(void **p_swapchain_graphics_data) { |
| 296 | if (*p_swapchain_graphics_data == nullptr) { |
| 297 | return; |
| 298 | } |
| 299 | |
| 300 | RenderingServer *rendering_server = RenderingServer::get_singleton(); |
| 301 | ERR_FAIL_NULL(rendering_server); |
| 302 | RenderingDevice *rendering_device = rendering_server->get_rendering_device(); |
| 303 | ERR_FAIL_NULL(rendering_device); |
| 304 | |
| 305 | SwapchainGraphicsData *data = (SwapchainGraphicsData *)*p_swapchain_graphics_data; |
| 306 | |
| 307 | for (const RID &texture_rid : data->texture_rids) { |
| 308 | // This should clean up our RIDs and associated texture objects but shouldn't destroy the images, they are owned by our XrSwapchain. |
| 309 | rendering_device->free_rid(texture_rid); |
| 310 | } |
| 311 | data->texture_rids.clear(); |
| 312 | |
| 313 | memdelete(data); |
| 314 | *p_swapchain_graphics_data = nullptr; |
| 315 | } |
| 316 | |
| 317 | #define ENUM_TO_STRING_CASE(e) \ |
| 318 | case e: { \ |
| 319 | return String(#e); \ |
| 320 | } break; |
| 321 | |
| 322 | String OpenXRD3D12Extension::get_swapchain_format_name(int64_t p_swapchain_format) const { |
| 323 | // These are somewhat different per platform, will need to weed some stuff out... |
| 324 | switch (p_swapchain_format) { |
| 325 | ENUM_TO_STRING_CASE(DXGI_FORMAT_UNKNOWN) |
| 326 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R32G32B32A32_TYPELESS) |
| 327 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R32G32B32A32_FLOAT) |
| 328 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R32G32B32A32_UINT) |
| 329 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R32G32B32A32_SINT) |
| 330 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R32G32B32_TYPELESS) |
| 331 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R32G32B32_FLOAT) |
| 332 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R32G32B32_UINT) |
| 333 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R32G32B32_SINT) |
| 334 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R16G16B16A16_TYPELESS) |
| 335 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R16G16B16A16_FLOAT) |
| 336 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R16G16B16A16_UNORM) |
| 337 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R16G16B16A16_UINT) |
| 338 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R16G16B16A16_SNORM) |
| 339 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R16G16B16A16_SINT) |
| 340 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R32G32_TYPELESS) |
| 341 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R32G32_FLOAT) |
| 342 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R32G32_UINT) |
| 343 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R32G32_SINT) |
| 344 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R32G8X24_TYPELESS) |
| 345 | ENUM_TO_STRING_CASE(DXGI_FORMAT_D32_FLOAT_S8X24_UINT) |
| 346 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS) |
| 347 | ENUM_TO_STRING_CASE(DXGI_FORMAT_X32_TYPELESS_G8X24_UINT) |
| 348 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R10G10B10A2_TYPELESS) |
| 349 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R10G10B10A2_UNORM) |
| 350 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R10G10B10A2_UINT) |
| 351 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R11G11B10_FLOAT) |
| 352 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R8G8B8A8_TYPELESS) |
| 353 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R8G8B8A8_UNORM) |
| 354 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R8G8B8A8_UNORM_SRGB) |
| 355 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R8G8B8A8_UINT) |
| 356 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R8G8B8A8_SNORM) |
| 357 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R8G8B8A8_SINT) |
| 358 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R16G16_TYPELESS) |
| 359 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R16G16_FLOAT) |
| 360 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R16G16_UNORM) |
| 361 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R16G16_UINT) |
| 362 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R16G16_SNORM) |
| 363 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R16G16_SINT) |
| 364 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R32_TYPELESS) |
| 365 | ENUM_TO_STRING_CASE(DXGI_FORMAT_D32_FLOAT) |
| 366 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R32_FLOAT) |
| 367 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R32_UINT) |
| 368 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R32_SINT) |
| 369 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R24G8_TYPELESS) |
| 370 | ENUM_TO_STRING_CASE(DXGI_FORMAT_D24_UNORM_S8_UINT) |
| 371 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R24_UNORM_X8_TYPELESS) |
| 372 | ENUM_TO_STRING_CASE(DXGI_FORMAT_X24_TYPELESS_G8_UINT) |
| 373 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R8G8_TYPELESS) |
| 374 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R8G8_UNORM) |
| 375 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R8G8_UINT) |
| 376 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R8G8_SNORM) |
| 377 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R8G8_SINT) |
| 378 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R16_TYPELESS) |
| 379 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R16_FLOAT) |
| 380 | ENUM_TO_STRING_CASE(DXGI_FORMAT_D16_UNORM) |
| 381 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R16_UNORM) |
| 382 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R16_UINT) |
| 383 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R16_SNORM) |
| 384 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R16_SINT) |
| 385 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R8_TYPELESS) |
| 386 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R8_UNORM) |
| 387 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R8_UINT) |
| 388 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R8_SNORM) |
| 389 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R8_SINT) |
| 390 | ENUM_TO_STRING_CASE(DXGI_FORMAT_A8_UNORM) |
| 391 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R1_UNORM) |
| 392 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R9G9B9E5_SHAREDEXP) |
| 393 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R8G8_B8G8_UNORM) |
| 394 | ENUM_TO_STRING_CASE(DXGI_FORMAT_G8R8_G8B8_UNORM) |
| 395 | ENUM_TO_STRING_CASE(DXGI_FORMAT_BC1_TYPELESS) |
| 396 | ENUM_TO_STRING_CASE(DXGI_FORMAT_BC1_UNORM) |
| 397 | ENUM_TO_STRING_CASE(DXGI_FORMAT_BC1_UNORM_SRGB) |
| 398 | ENUM_TO_STRING_CASE(DXGI_FORMAT_BC2_TYPELESS) |
| 399 | ENUM_TO_STRING_CASE(DXGI_FORMAT_BC2_UNORM) |
| 400 | ENUM_TO_STRING_CASE(DXGI_FORMAT_BC2_UNORM_SRGB) |
| 401 | ENUM_TO_STRING_CASE(DXGI_FORMAT_BC3_TYPELESS) |
| 402 | ENUM_TO_STRING_CASE(DXGI_FORMAT_BC3_UNORM) |
| 403 | ENUM_TO_STRING_CASE(DXGI_FORMAT_BC3_UNORM_SRGB) |
| 404 | ENUM_TO_STRING_CASE(DXGI_FORMAT_BC4_TYPELESS) |
| 405 | ENUM_TO_STRING_CASE(DXGI_FORMAT_BC4_UNORM) |
| 406 | ENUM_TO_STRING_CASE(DXGI_FORMAT_BC4_SNORM) |
| 407 | ENUM_TO_STRING_CASE(DXGI_FORMAT_BC5_TYPELESS) |
| 408 | ENUM_TO_STRING_CASE(DXGI_FORMAT_BC5_UNORM) |
| 409 | ENUM_TO_STRING_CASE(DXGI_FORMAT_BC5_SNORM) |
| 410 | ENUM_TO_STRING_CASE(DXGI_FORMAT_B5G6R5_UNORM) |
| 411 | ENUM_TO_STRING_CASE(DXGI_FORMAT_B5G5R5A1_UNORM) |
| 412 | ENUM_TO_STRING_CASE(DXGI_FORMAT_B8G8R8A8_UNORM) |
| 413 | ENUM_TO_STRING_CASE(DXGI_FORMAT_B8G8R8X8_UNORM) |
| 414 | ENUM_TO_STRING_CASE(DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM) |
| 415 | ENUM_TO_STRING_CASE(DXGI_FORMAT_B8G8R8A8_TYPELESS) |
| 416 | ENUM_TO_STRING_CASE(DXGI_FORMAT_B8G8R8A8_UNORM_SRGB) |
| 417 | ENUM_TO_STRING_CASE(DXGI_FORMAT_B8G8R8X8_TYPELESS) |
| 418 | ENUM_TO_STRING_CASE(DXGI_FORMAT_B8G8R8X8_UNORM_SRGB) |
| 419 | ENUM_TO_STRING_CASE(DXGI_FORMAT_BC6H_TYPELESS) |
| 420 | ENUM_TO_STRING_CASE(DXGI_FORMAT_BC6H_UF16) |
| 421 | ENUM_TO_STRING_CASE(DXGI_FORMAT_BC6H_SF16) |
| 422 | ENUM_TO_STRING_CASE(DXGI_FORMAT_BC7_TYPELESS) |
| 423 | ENUM_TO_STRING_CASE(DXGI_FORMAT_BC7_UNORM) |
| 424 | ENUM_TO_STRING_CASE(DXGI_FORMAT_BC7_UNORM_SRGB) |
| 425 | ENUM_TO_STRING_CASE(DXGI_FORMAT_AYUV) |
| 426 | ENUM_TO_STRING_CASE(DXGI_FORMAT_Y410) |
| 427 | ENUM_TO_STRING_CASE(DXGI_FORMAT_Y416) |
| 428 | ENUM_TO_STRING_CASE(DXGI_FORMAT_NV12) |
| 429 | ENUM_TO_STRING_CASE(DXGI_FORMAT_P010) |
| 430 | ENUM_TO_STRING_CASE(DXGI_FORMAT_P016) |
| 431 | ENUM_TO_STRING_CASE(DXGI_FORMAT_420_OPAQUE) |
| 432 | ENUM_TO_STRING_CASE(DXGI_FORMAT_YUY2) |
| 433 | ENUM_TO_STRING_CASE(DXGI_FORMAT_Y210) |
| 434 | ENUM_TO_STRING_CASE(DXGI_FORMAT_Y216) |
| 435 | ENUM_TO_STRING_CASE(DXGI_FORMAT_NV11) |
| 436 | ENUM_TO_STRING_CASE(DXGI_FORMAT_AI44) |
| 437 | ENUM_TO_STRING_CASE(DXGI_FORMAT_IA44) |
| 438 | ENUM_TO_STRING_CASE(DXGI_FORMAT_P8) |
| 439 | ENUM_TO_STRING_CASE(DXGI_FORMAT_A8P8) |
| 440 | ENUM_TO_STRING_CASE(DXGI_FORMAT_B4G4R4A4_UNORM) |
| 441 | ENUM_TO_STRING_CASE(DXGI_FORMAT_P208) |
| 442 | ENUM_TO_STRING_CASE(DXGI_FORMAT_V208) |
| 443 | ENUM_TO_STRING_CASE(DXGI_FORMAT_V408) |
| 444 | ENUM_TO_STRING_CASE(DXGI_FORMAT_A4B4G4R4_UNORM) |
| 445 | default: { |
| 446 | return String("Swapchain format ") + String::num_int64(int64_t(p_swapchain_format)); |
| 447 | } break; |
| 448 | } |
| 449 | } |
| 450 | |
| 451 | #endif // D3D12_ENABLED |