1/**************************************************************************/
2/* openxr_opengl_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_opengl_extension.h"
32
33#ifdef GLES3_ENABLED
34
35#include "../openxr_util.h"
36
37#include "drivers/gles3/effects/copy_effects.h"
38#include "drivers/gles3/storage/texture_storage.h"
39#include "servers/rendering/rendering_server_globals.h"
40#include "servers/rendering_server.h"
41
42// OpenXR requires us to submit sRGB textures so that it recognizes the content
43// as being in sRGB color space. We do fall back on "normal" textures but this
44// will likely result in incorrect colors as OpenXR will double the sRGB conversion.
45// All major XR runtimes support sRGB textures.
46
47// In OpenGL output of the fragment shader is assumed to be in the color space of
48// the developers choice, however a linear to sRGB HW conversion can be enabled
49// through enabling GL_FRAMEBUFFER_SRGB if an sRGB color attachment is used.
50// This is a global setting.
51// See: https://www.khronos.org/opengl/wiki/Framebuffer
52
53// In OpenGLES output of the fragment shader is assumed to be in linear color space
54// and will be converted by default to sRGB if an sRGB color attachment is used.
55// The extension GL_EXT_sRGB_write_control was introduced to enable turning this
56// feature off.
57// See: https://registry.khronos.org/OpenGL/extensions/EXT/EXT_sRGB_write_control.txt
58
59// On OpenGLES this is not defined in our standard headers..
60#ifndef GL_FRAMEBUFFER_SRGB
61#define GL_FRAMEBUFFER_SRGB 0x8DB9
62#endif
63
64HashMap<String, bool *> OpenXROpenGLExtension::get_requested_extensions() {
65 HashMap<String, bool *> request_extensions;
66
67#ifdef ANDROID_ENABLED
68 request_extensions[XR_KHR_OPENGL_ES_ENABLE_EXTENSION_NAME] = nullptr;
69#else
70 request_extensions[XR_KHR_OPENGL_ENABLE_EXTENSION_NAME] = nullptr;
71#endif
72
73 return request_extensions;
74}
75
76void OpenXROpenGLExtension::on_instance_created(const XrInstance p_instance) {
77 // Obtain pointers to functions we're accessing here.
78 ERR_FAIL_NULL(OpenXRAPI::get_singleton());
79
80#ifdef ANDROID_ENABLED
81 EXT_INIT_XR_FUNC(xrGetOpenGLESGraphicsRequirementsKHR);
82#else
83 EXT_INIT_XR_FUNC(xrGetOpenGLGraphicsRequirementsKHR);
84#endif
85 EXT_INIT_XR_FUNC(xrEnumerateSwapchainImages);
86}
87
88bool OpenXROpenGLExtension::check_graphics_api_support(XrVersion p_desired_version) {
89 ERR_FAIL_NULL_V(OpenXRAPI::get_singleton(), false);
90
91 XrSystemId system_id = OpenXRAPI::get_singleton()->get_system_id();
92 XrInstance instance = OpenXRAPI::get_singleton()->get_instance();
93
94#ifdef ANDROID_ENABLED
95 XrGraphicsRequirementsOpenGLESKHR opengl_requirements;
96 opengl_requirements.type = XR_TYPE_GRAPHICS_REQUIREMENTS_OPENGL_ES_KHR;
97 opengl_requirements.next = nullptr;
98
99 XrResult result = xrGetOpenGLESGraphicsRequirementsKHR(instance, system_id, &opengl_requirements);
100 if (!OpenXRAPI::get_singleton()->xr_result(result, "Failed to get OpenGL graphics requirements!")) {
101 return false;
102 }
103#else
104 XrGraphicsRequirementsOpenGLKHR opengl_requirements;
105 opengl_requirements.type = XR_TYPE_GRAPHICS_REQUIREMENTS_OPENGL_KHR;
106 opengl_requirements.next = nullptr;
107
108 XrResult result = xrGetOpenGLGraphicsRequirementsKHR(instance, system_id, &opengl_requirements);
109 if (!OpenXRAPI::get_singleton()->xr_result(result, "Failed to get OpenGL graphics requirements!")) {
110 return false;
111 }
112#endif
113
114 if (p_desired_version < opengl_requirements.minApiVersionSupported) {
115 print_line("OpenXR: Requested OpenGL version does not meet the minimum version this runtime supports.");
116 print_line("- desired_version ", OpenXRUtil::make_xr_version_string(p_desired_version));
117 print_line("- minApiVersionSupported ", OpenXRUtil::make_xr_version_string(opengl_requirements.minApiVersionSupported));
118 print_line("- maxApiVersionSupported ", OpenXRUtil::make_xr_version_string(opengl_requirements.maxApiVersionSupported));
119 return false;
120 }
121
122 if (p_desired_version > opengl_requirements.maxApiVersionSupported) {
123 print_line("OpenXR: Requested OpenGL version exceeds the maximum version this runtime has been tested on and is known to support.");
124 print_line("- desired_version ", OpenXRUtil::make_xr_version_string(p_desired_version));
125 print_line("- minApiVersionSupported ", OpenXRUtil::make_xr_version_string(opengl_requirements.minApiVersionSupported));
126 print_line("- maxApiVersionSupported ", OpenXRUtil::make_xr_version_string(opengl_requirements.maxApiVersionSupported));
127 }
128
129 return true;
130}
131
132#ifdef WIN32
133XrGraphicsBindingOpenGLWin32KHR OpenXROpenGLExtension::graphics_binding_gl;
134#elif ANDROID_ENABLED
135XrGraphicsBindingOpenGLESAndroidKHR OpenXROpenGLExtension::graphics_binding_gl;
136#else
137XrGraphicsBindingOpenGLXlibKHR OpenXROpenGLExtension::graphics_binding_gl;
138#endif
139
140void *OpenXROpenGLExtension::set_session_create_and_get_next_pointer(void *p_next_pointer) {
141 XrVersion desired_version = XR_MAKE_VERSION(3, 3, 0);
142
143 if (!check_graphics_api_support(desired_version)) {
144 print_line("OpenXR: Trying to initialize with OpenGL anyway...");
145 //return p_next_pointer;
146 }
147
148 DisplayServer *display_server = DisplayServer::get_singleton();
149
150#ifdef WIN32
151 graphics_binding_gl.type = XR_TYPE_GRAPHICS_BINDING_OPENGL_WIN32_KHR,
152 graphics_binding_gl.next = p_next_pointer;
153
154 graphics_binding_gl.hDC = (HDC)display_server->window_get_native_handle(DisplayServer::WINDOW_VIEW);
155 graphics_binding_gl.hGLRC = (HGLRC)display_server->window_get_native_handle(DisplayServer::OPENGL_CONTEXT);
156#elif ANDROID_ENABLED
157 graphics_binding_gl.type = XR_TYPE_GRAPHICS_BINDING_OPENGL_ES_ANDROID_KHR;
158 graphics_binding_gl.next = p_next_pointer;
159
160 graphics_binding_gl.display = (void *)display_server->window_get_native_handle(DisplayServer::DISPLAY_HANDLE);
161 graphics_binding_gl.config = (EGLConfig)0; // https://github.com/KhronosGroup/OpenXR-SDK-Source/blob/master/src/tests/hello_xr/graphicsplugin_opengles.cpp#L122
162 graphics_binding_gl.context = (void *)display_server->window_get_native_handle(DisplayServer::OPENGL_CONTEXT);
163#else
164 graphics_binding_gl.type = XR_TYPE_GRAPHICS_BINDING_OPENGL_XLIB_KHR;
165 graphics_binding_gl.next = p_next_pointer;
166
167 void *display_handle = (void *)display_server->window_get_native_handle(DisplayServer::DISPLAY_HANDLE);
168 void *glxcontext_handle = (void *)display_server->window_get_native_handle(DisplayServer::OPENGL_CONTEXT);
169 void *glxdrawable_handle = (void *)display_server->window_get_native_handle(DisplayServer::WINDOW_HANDLE);
170
171 graphics_binding_gl.xDisplay = (Display *)display_handle;
172 graphics_binding_gl.glxContext = (GLXContext)glxcontext_handle;
173 graphics_binding_gl.glxDrawable = (GLXDrawable)glxdrawable_handle;
174
175 // spec says to use proper values but runtimes don't care
176 graphics_binding_gl.visualid = 0;
177 graphics_binding_gl.glxFBConfig = 0;
178#endif
179
180 return &graphics_binding_gl;
181}
182
183void OpenXROpenGLExtension::get_usable_swapchain_formats(Vector<int64_t> &p_usable_swap_chains) {
184 p_usable_swap_chains.push_back(GL_SRGB8_ALPHA8);
185 p_usable_swap_chains.push_back(GL_RGBA8);
186}
187
188void OpenXROpenGLExtension::get_usable_depth_formats(Vector<int64_t> &p_usable_depth_formats) {
189 p_usable_depth_formats.push_back(GL_DEPTH_COMPONENT32F);
190 p_usable_depth_formats.push_back(GL_DEPTH24_STENCIL8);
191 p_usable_depth_formats.push_back(GL_DEPTH32F_STENCIL8);
192 p_usable_depth_formats.push_back(GL_DEPTH_COMPONENT24);
193}
194
195void OpenXROpenGLExtension::on_pre_draw_viewport(RID p_render_target) {
196 if (srgb_ext_is_available) {
197 hw_linear_to_srgb_is_enabled = glIsEnabled(GL_FRAMEBUFFER_SRGB);
198 if (hw_linear_to_srgb_is_enabled) {
199 // Disable this.
200 glDisable(GL_FRAMEBUFFER_SRGB);
201 }
202 }
203}
204
205void OpenXROpenGLExtension::on_post_draw_viewport(RID p_render_target) {
206 if (srgb_ext_is_available && hw_linear_to_srgb_is_enabled) {
207 // Re-enable this.
208 glEnable(GL_FRAMEBUFFER_SRGB);
209 }
210}
211
212bool OpenXROpenGLExtension::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) {
213 GLES3::TextureStorage *texture_storage = GLES3::TextureStorage::get_singleton();
214 ERR_FAIL_NULL_V(texture_storage, false);
215
216 uint32_t swapchain_length;
217 XrResult result = xrEnumerateSwapchainImages(p_swapchain, 0, &swapchain_length, nullptr);
218 if (XR_FAILED(result)) {
219 print_line("OpenXR: Failed to get swapchaim image count [", OpenXRAPI::get_singleton()->get_error_string(result), "]");
220 return false;
221 }
222
223#ifdef ANDROID_ENABLED
224 XrSwapchainImageOpenGLESKHR *images = (XrSwapchainImageOpenGLESKHR *)memalloc(sizeof(XrSwapchainImageOpenGLESKHR) * swapchain_length);
225#else
226 XrSwapchainImageOpenGLKHR *images = (XrSwapchainImageOpenGLKHR *)memalloc(sizeof(XrSwapchainImageOpenGLKHR) * swapchain_length);
227#endif
228 ERR_FAIL_NULL_V_MSG(images, false, "OpenXR Couldn't allocate memory for swap chain image");
229
230 for (uint64_t i = 0; i < swapchain_length; i++) {
231#ifdef ANDROID_ENABLED
232 images[i].type = XR_TYPE_SWAPCHAIN_IMAGE_OPENGL_ES_KHR;
233#else
234 images[i].type = XR_TYPE_SWAPCHAIN_IMAGE_OPENGL_KHR;
235#endif
236 images[i].next = nullptr;
237 images[i].image = 0;
238 }
239
240 result = xrEnumerateSwapchainImages(p_swapchain, swapchain_length, &swapchain_length, (XrSwapchainImageBaseHeader *)images);
241 if (XR_FAILED(result)) {
242 print_line("OpenXR: Failed to get swapchaim images [", OpenXRAPI::get_singleton()->get_error_string(result), "]");
243 memfree(images);
244 return false;
245 }
246
247 SwapchainGraphicsData *data = memnew(SwapchainGraphicsData);
248 if (data == nullptr) {
249 print_line("OpenXR: Failed to allocate memory for swapchain data");
250 memfree(images);
251 return false;
252 }
253 *r_swapchain_graphics_data = data;
254 data->is_multiview = (p_array_size > 1);
255
256 Image::Format format = Image::FORMAT_RGBA8;
257
258 Vector<RID> texture_rids;
259
260 for (uint64_t i = 0; i < swapchain_length; i++) {
261 RID texture_rid = texture_storage->texture_create_external(
262 p_array_size == 1 ? GLES3::Texture::TYPE_2D : GLES3::Texture::TYPE_LAYERED,
263 format,
264 images[i].image,
265 p_width,
266 p_height,
267 1,
268 p_array_size);
269
270 texture_rids.push_back(texture_rid);
271 }
272
273 data->texture_rids = texture_rids;
274
275 memfree(images);
276
277 return true;
278}
279
280bool OpenXROpenGLExtension::create_projection_fov(const XrFovf p_fov, double p_z_near, double p_z_far, Projection &r_camera_matrix) {
281 OpenXRUtil::XrMatrix4x4f matrix;
282 OpenXRUtil::XrMatrix4x4f_CreateProjectionFov(&matrix, OpenXRUtil::GRAPHICS_OPENGL, p_fov, (float)p_z_near, (float)p_z_far);
283
284 for (int j = 0; j < 4; j++) {
285 for (int i = 0; i < 4; i++) {
286 r_camera_matrix.columns[j][i] = matrix.m[j * 4 + i];
287 }
288 }
289
290 return true;
291}
292
293RID OpenXROpenGLExtension::get_texture(void *p_swapchain_graphics_data, int p_image_index) {
294 SwapchainGraphicsData *data = (SwapchainGraphicsData *)p_swapchain_graphics_data;
295 ERR_FAIL_NULL_V(data, RID());
296
297 ERR_FAIL_INDEX_V(p_image_index, data->texture_rids.size(), RID());
298 return data->texture_rids[p_image_index];
299}
300
301void OpenXROpenGLExtension::cleanup_swapchain_graphics_data(void **p_swapchain_graphics_data) {
302 if (*p_swapchain_graphics_data == nullptr) {
303 return;
304 }
305
306 GLES3::TextureStorage *texture_storage = GLES3::TextureStorage::get_singleton();
307 ERR_FAIL_NULL(texture_storage);
308
309 SwapchainGraphicsData *data = (SwapchainGraphicsData *)*p_swapchain_graphics_data;
310
311 for (int i = 0; i < data->texture_rids.size(); i++) {
312 texture_storage->texture_free(data->texture_rids[i]);
313 }
314 data->texture_rids.clear();
315
316 memdelete(data);
317 *p_swapchain_graphics_data = nullptr;
318}
319
320#define ENUM_TO_STRING_CASE(e) \
321 case e: { \
322 return String(#e); \
323 } break;
324
325String OpenXROpenGLExtension::get_swapchain_format_name(int64_t p_swapchain_format) const {
326 // These are somewhat different per platform, will need to weed some stuff out...
327 switch (p_swapchain_format) {
328#ifdef ANDROID_ENABLED
329 // using definitions from GLES3/gl3.h
330
331 ENUM_TO_STRING_CASE(GL_RGBA4)
332 ENUM_TO_STRING_CASE(GL_RGB5_A1)
333 ENUM_TO_STRING_CASE(GL_RGB565)
334 ENUM_TO_STRING_CASE(GL_RGB8)
335 ENUM_TO_STRING_CASE(GL_RGBA8)
336 ENUM_TO_STRING_CASE(GL_RGB10_A2)
337 ENUM_TO_STRING_CASE(GL_RGBA32F)
338 ENUM_TO_STRING_CASE(GL_RGB32F)
339 ENUM_TO_STRING_CASE(GL_RGBA16F)
340 ENUM_TO_STRING_CASE(GL_RGB16F)
341 ENUM_TO_STRING_CASE(GL_R11F_G11F_B10F)
342 ENUM_TO_STRING_CASE(GL_UNSIGNED_INT_10F_11F_11F_REV)
343 ENUM_TO_STRING_CASE(GL_RGB9_E5)
344 ENUM_TO_STRING_CASE(GL_UNSIGNED_INT_5_9_9_9_REV)
345 ENUM_TO_STRING_CASE(GL_RGBA32UI)
346 ENUM_TO_STRING_CASE(GL_RGB32UI)
347 ENUM_TO_STRING_CASE(GL_RGBA16UI)
348 ENUM_TO_STRING_CASE(GL_RGB16UI)
349 ENUM_TO_STRING_CASE(GL_RGBA8UI)
350 ENUM_TO_STRING_CASE(GL_RGB8UI)
351 ENUM_TO_STRING_CASE(GL_RGBA32I)
352 ENUM_TO_STRING_CASE(GL_RGB32I)
353 ENUM_TO_STRING_CASE(GL_RGBA16I)
354 ENUM_TO_STRING_CASE(GL_RGB16I)
355 ENUM_TO_STRING_CASE(GL_RGBA8I)
356 ENUM_TO_STRING_CASE(GL_RGB8I)
357 ENUM_TO_STRING_CASE(GL_RG)
358 ENUM_TO_STRING_CASE(GL_RG_INTEGER)
359 ENUM_TO_STRING_CASE(GL_R8)
360 ENUM_TO_STRING_CASE(GL_RG8)
361 ENUM_TO_STRING_CASE(GL_R16F)
362 ENUM_TO_STRING_CASE(GL_R32F)
363 ENUM_TO_STRING_CASE(GL_RG16F)
364 ENUM_TO_STRING_CASE(GL_RG32F)
365 ENUM_TO_STRING_CASE(GL_R8I)
366 ENUM_TO_STRING_CASE(GL_R8UI)
367 ENUM_TO_STRING_CASE(GL_R16I)
368 ENUM_TO_STRING_CASE(GL_R16UI)
369 ENUM_TO_STRING_CASE(GL_R32I)
370 ENUM_TO_STRING_CASE(GL_R32UI)
371 ENUM_TO_STRING_CASE(GL_RG8I)
372 ENUM_TO_STRING_CASE(GL_RG8UI)
373 ENUM_TO_STRING_CASE(GL_RG16I)
374 ENUM_TO_STRING_CASE(GL_RG16UI)
375 ENUM_TO_STRING_CASE(GL_RG32I)
376 ENUM_TO_STRING_CASE(GL_RG32UI)
377 ENUM_TO_STRING_CASE(GL_R8_SNORM)
378 ENUM_TO_STRING_CASE(GL_RG8_SNORM)
379 ENUM_TO_STRING_CASE(GL_RGB8_SNORM)
380 ENUM_TO_STRING_CASE(GL_RGBA8_SNORM)
381 ENUM_TO_STRING_CASE(GL_RGB10_A2UI)
382 ENUM_TO_STRING_CASE(GL_SRGB)
383 ENUM_TO_STRING_CASE(GL_SRGB8)
384 ENUM_TO_STRING_CASE(GL_SRGB8_ALPHA8)
385 ENUM_TO_STRING_CASE(GL_COMPRESSED_R11_EAC)
386 ENUM_TO_STRING_CASE(GL_COMPRESSED_SIGNED_R11_EAC)
387 ENUM_TO_STRING_CASE(GL_COMPRESSED_RG11_EAC)
388 ENUM_TO_STRING_CASE(GL_COMPRESSED_SIGNED_RG11_EAC)
389 ENUM_TO_STRING_CASE(GL_COMPRESSED_RGB8_ETC2)
390 ENUM_TO_STRING_CASE(GL_COMPRESSED_SRGB8_ETC2)
391 ENUM_TO_STRING_CASE(GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2)
392 ENUM_TO_STRING_CASE(GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2)
393 ENUM_TO_STRING_CASE(GL_COMPRESSED_RGBA8_ETC2_EAC)
394 ENUM_TO_STRING_CASE(GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC)
395 ENUM_TO_STRING_CASE(GL_DEPTH_COMPONENT16)
396 ENUM_TO_STRING_CASE(GL_DEPTH_COMPONENT24)
397 ENUM_TO_STRING_CASE(GL_DEPTH24_STENCIL8)
398
399#else
400 // using definitions from GLAD
401 ENUM_TO_STRING_CASE(GL_R8_SNORM)
402 ENUM_TO_STRING_CASE(GL_RG8_SNORM)
403 ENUM_TO_STRING_CASE(GL_RGB8_SNORM)
404 ENUM_TO_STRING_CASE(GL_RGBA8_SNORM)
405 ENUM_TO_STRING_CASE(GL_R16_SNORM)
406 ENUM_TO_STRING_CASE(GL_RG16_SNORM)
407 ENUM_TO_STRING_CASE(GL_RGB16_SNORM)
408 ENUM_TO_STRING_CASE(GL_RGBA16_SNORM)
409 ENUM_TO_STRING_CASE(GL_RGB4)
410 ENUM_TO_STRING_CASE(GL_RGB5)
411 ENUM_TO_STRING_CASE(GL_RGB8)
412 ENUM_TO_STRING_CASE(GL_RGB10)
413 ENUM_TO_STRING_CASE(GL_RGB12)
414 ENUM_TO_STRING_CASE(GL_RGB16)
415 ENUM_TO_STRING_CASE(GL_RGBA2)
416 ENUM_TO_STRING_CASE(GL_RGBA4)
417 ENUM_TO_STRING_CASE(GL_RGB5_A1)
418 ENUM_TO_STRING_CASE(GL_RGBA8)
419 ENUM_TO_STRING_CASE(GL_RGB10_A2)
420 ENUM_TO_STRING_CASE(GL_RGBA12)
421 ENUM_TO_STRING_CASE(GL_RGBA16)
422 ENUM_TO_STRING_CASE(GL_RGBA32F)
423 ENUM_TO_STRING_CASE(GL_RGB32F)
424 ENUM_TO_STRING_CASE(GL_RGBA16F)
425 ENUM_TO_STRING_CASE(GL_RGB16F)
426 ENUM_TO_STRING_CASE(GL_RGBA32UI)
427 ENUM_TO_STRING_CASE(GL_RGB32UI)
428 ENUM_TO_STRING_CASE(GL_RGBA16UI)
429 ENUM_TO_STRING_CASE(GL_RGB16UI)
430 ENUM_TO_STRING_CASE(GL_RGBA8UI)
431 ENUM_TO_STRING_CASE(GL_RGB8UI)
432 ENUM_TO_STRING_CASE(GL_RGBA32I)
433 ENUM_TO_STRING_CASE(GL_RGB32I)
434 ENUM_TO_STRING_CASE(GL_RGBA16I)
435 ENUM_TO_STRING_CASE(GL_RGB16I)
436 ENUM_TO_STRING_CASE(GL_RGBA8I)
437 ENUM_TO_STRING_CASE(GL_RGB8I)
438 ENUM_TO_STRING_CASE(GL_RGB10_A2UI)
439 ENUM_TO_STRING_CASE(GL_SRGB)
440 ENUM_TO_STRING_CASE(GL_SRGB8)
441 ENUM_TO_STRING_CASE(GL_SRGB_ALPHA)
442 ENUM_TO_STRING_CASE(GL_SRGB8_ALPHA8)
443 ENUM_TO_STRING_CASE(GL_DEPTH_COMPONENT16)
444 ENUM_TO_STRING_CASE(GL_DEPTH_COMPONENT24)
445 ENUM_TO_STRING_CASE(GL_DEPTH_COMPONENT32)
446 ENUM_TO_STRING_CASE(GL_DEPTH24_STENCIL8)
447 ENUM_TO_STRING_CASE(GL_R11F_G11F_B10F)
448 ENUM_TO_STRING_CASE(GL_DEPTH_COMPONENT32F)
449 ENUM_TO_STRING_CASE(GL_DEPTH32F_STENCIL8)
450#endif
451 default: {
452 return String("Swapchain format 0x") + String::num_int64(p_swapchain_format, 16);
453 } break;
454 }
455}
456
457#endif // GLES3_ENABLED
458