The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

c/util: Emulate sRGB formats with linear versions

+26
+21
src/xrt/compositor/util/comp_vulkan.c
··· 437 437 438 438 #undef CHECK_COLOR 439 439 #undef CHECK_DS 440 + 441 + #if defined(XRT_GRAPHICS_BUFFER_HANDLE_IS_AHARDWAREBUFFER) 442 + /* 443 + * Some Vulkan drivers will natively support importing and exporting 444 + * SRGB formats (Qualcomm) even tho technically that's not intended 445 + * by the AHardwareBuffer since they don't support sRGB formats. 446 + * While others (Mail) does not support importing and exporting sRGB 447 + * formats. 448 + */ 449 + if (!formats->has_R8G8B8A8_SRGB && formats->has_R8G8B8A8_UNORM) { 450 + formats->has_R8G8B8A8_SRGB = true; 451 + formats->emulated_R8G8B8A8_SRGB = true; 452 + } 453 + #endif 440 454 } 441 455 442 456 void ··· 470 484 471 485 #undef PRINT_NAME 472 486 #undef PRINT_BOOLEAN 487 + 488 + #if defined(XRT_GRAPHICS_BUFFER_HANDLE_IS_AHARDWAREBUFFER) 489 + U_LOG_IFL_I(log_level, 490 + "Emulated formats:" 491 + "\n\tVK_FORMAT_R8G8B8A8_SRGB: %s", 492 + formats->emulated_R8G8B8A8_SRGB ? "emulated" : "native"); 493 + #endif 473 494 }
+5
src/xrt/compositor/util/comp_vulkan.h
··· 109 109 #define FIELD(IDENT) bool has_##IDENT; 110 110 VK_CSCI_FORMATS(FIELD, FIELD, FIELD, FIELD) 111 111 #undef FIELD 112 + 113 + #if defined(XRT_GRAPHICS_BUFFER_HANDLE_IS_AHARDWAREBUFFER) 114 + //! Is VK_FORMAT_R8G8B8A8_SRGB emulated with VK_FORMAT_R8G8B8A8_UNORM? 115 + bool emulated_R8G8B8A8_SRGB; 116 + #endif 112 117 }; 113 118 114 119 /*!