mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-19 13:18:32 +00:00
c/util: Emulate sRGB formats with linear versions
This commit is contained in:
parent
022f23b26c
commit
4870c34485
|
@ -437,6 +437,20 @@ comp_vulkan_formats_check(struct vk_bundle *vk, struct comp_vulkan_formats *form
|
||||||
|
|
||||||
#undef CHECK_COLOR
|
#undef CHECK_COLOR
|
||||||
#undef CHECK_DS
|
#undef CHECK_DS
|
||||||
|
|
||||||
|
#if defined(XRT_GRAPHICS_BUFFER_HANDLE_IS_AHARDWAREBUFFER)
|
||||||
|
/*
|
||||||
|
* Some Vulkan drivers will natively support importing and exporting
|
||||||
|
* SRGB formats (Qualcomm) even tho technically that's not intended
|
||||||
|
* by the AHardwareBuffer since they don't support sRGB formats.
|
||||||
|
* While others (Mail) does not support importing and exporting sRGB
|
||||||
|
* formats.
|
||||||
|
*/
|
||||||
|
if (!formats->has_R8G8B8A8_SRGB && formats->has_R8G8B8A8_UNORM) {
|
||||||
|
formats->has_R8G8B8A8_SRGB = true;
|
||||||
|
formats->emulated_R8G8B8A8_SRGB = true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -470,4 +484,11 @@ comp_vulkan_formats_log(enum u_logging_level log_level, const struct comp_vulkan
|
||||||
|
|
||||||
#undef PRINT_NAME
|
#undef PRINT_NAME
|
||||||
#undef PRINT_BOOLEAN
|
#undef PRINT_BOOLEAN
|
||||||
|
|
||||||
|
#if defined(XRT_GRAPHICS_BUFFER_HANDLE_IS_AHARDWAREBUFFER)
|
||||||
|
U_LOG_IFL_I(log_level,
|
||||||
|
"Emulated formats:"
|
||||||
|
"\n\tVK_FORMAT_R8G8B8A8_SRGB: %s",
|
||||||
|
formats->emulated_R8G8B8A8_SRGB ? "emulated" : "native");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,6 +109,11 @@ struct comp_vulkan_formats
|
||||||
#define FIELD(IDENT) bool has_##IDENT;
|
#define FIELD(IDENT) bool has_##IDENT;
|
||||||
VK_CSCI_FORMATS(FIELD, FIELD, FIELD, FIELD)
|
VK_CSCI_FORMATS(FIELD, FIELD, FIELD, FIELD)
|
||||||
#undef FIELD
|
#undef FIELD
|
||||||
|
|
||||||
|
#if defined(XRT_GRAPHICS_BUFFER_HANDLE_IS_AHARDWAREBUFFER)
|
||||||
|
//! Is VK_FORMAT_R8G8B8A8_SRGB emulated with VK_FORMAT_R8G8B8A8_UNORM?
|
||||||
|
bool emulated_R8G8B8A8_SRGB;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
Loading…
Reference in a new issue