mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-17 04:15:44 +00:00
c/client: Correctly check for sRGB format
This commit is contained in:
parent
a0724d8ea7
commit
022f23b26c
|
@ -140,24 +140,23 @@ gl_format_to_bpp(uint64_t format)
|
|||
|
||||
#if defined(XRT_GRAPHICS_BUFFER_HANDLE_IS_AHARDWAREBUFFER)
|
||||
static inline bool
|
||||
vk_format_to_srgb(uint64_t format)
|
||||
is_gl_format_srgb(uint64_t format)
|
||||
{
|
||||
switch (format) {
|
||||
case 37 /*VK_FORMAT_R8G8B8A8_UNORM*/: return false;
|
||||
case 64 /*VK_FORMAT_A2B10G10R10_UNORM_PACK32*/: return false;
|
||||
case 50 /*VK_FORMAT_B8G8R8A8_SRGB*/: return true;
|
||||
case 124 /*VK_FORMAT_D16_UNORM*/: return false;
|
||||
case 44 /*VK_FORMAT_B8G8R8A8_UNORM*/: return false;
|
||||
case 129 /*VK_FORMAT_D24_UNORM_S8_UINT*/: return false;
|
||||
case 130 /*VK_FORMAT_D32_SFLOAT_S8_UINT*/: return false;
|
||||
case 23 /*VK_FORMAT_R8G8B8_UNORM*/: return false;
|
||||
case 127 /*VK_FORMAT_S8_UINT*/: return false;
|
||||
case 4 /*VK_FORMAT_R5G6B5_UNORM_PACK16*/: return false;
|
||||
case 97 /*VK_FORMAT_R16G16B16A16_SFLOAT*/: return false;
|
||||
case 126 /*VK_FORMAT_D32_SFLOAT*/: return false;
|
||||
case 125 /*VK_FORMAT_X8_D24_UNORM_PACK32*/: return false;
|
||||
case 43 /*VK_FORMAT_R8G8B8A8_SRGB*/: return true;
|
||||
default: return false;
|
||||
case GL_RGB8: return false;
|
||||
case GL_SRGB8: return true; // sRGB
|
||||
case GL_RGBA8: return false;
|
||||
case GL_SRGB8_ALPHA8: return true; // sRGB
|
||||
case GL_RGB10_A2: return false;
|
||||
case GL_RGB16: return false;
|
||||
case GL_RGB16F: return false;
|
||||
case GL_RGBA16: return false;
|
||||
case GL_RGBA16F: return false;
|
||||
case GL_DEPTH_COMPONENT16: return false;
|
||||
case GL_DEPTH_COMPONENT32F: return false;
|
||||
case GL_DEPTH24_STENCIL8: return false;
|
||||
case GL_DEPTH32F_STENCIL8: return false;
|
||||
default: U_LOG_W("Cannot check GL format %" PRIu64 " for sRGB-ness!", format); return false;
|
||||
}
|
||||
}
|
||||
#endif // defined(XRT_GRAPHICS_BUFFER_HANDLE_IS_AHARDWAREBUFFER)
|
||||
|
@ -245,12 +244,15 @@ client_gl_eglimage_swapchain_create(struct xrt_compositor *xc,
|
|||
EGL_NONE,
|
||||
EGL_NONE,
|
||||
};
|
||||
|
||||
EGL_SC_INFO("EGL_PROTECTED_CONTENT_EXT %s",
|
||||
(desc.usage & AHARDWAREBUFFER_USAGE_PROTECTED_CONTENT) ? "TRUE" : "FALSE");
|
||||
if (vk_format_to_srgb(info->format)) {
|
||||
|
||||
if (is_gl_format_srgb(info->format)) {
|
||||
attrs[4] = EGL_GL_COLORSPACE_KHR;
|
||||
attrs[5] = EGL_GL_COLORSPACE_SRGB_KHR;
|
||||
}
|
||||
|
||||
EGLenum source = EGL_NATIVE_BUFFER_ANDROID;
|
||||
#elif defined(XRT_GRAPHICS_BUFFER_HANDLE_IS_FD)
|
||||
EGLint attrs[] = {EGL_IMAGE_PRESERVED_KHR,
|
||||
|
|
Loading…
Reference in a new issue