mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-04 06:06:17 +00:00
st/oxr: Quirk UnrealEngine
This commit is contained in:
parent
4ef6211286
commit
2849c7c5ae
|
@ -151,6 +151,17 @@ detect_engine(struct oxr_logger *log, struct oxr_instance *inst, const XrInstanc
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
apply_quirks(struct oxr_logger *log, struct oxr_instance *inst)
|
||||
{
|
||||
if (starts_with("UnrealEngine", inst->appinfo.detected.engine.name) && //
|
||||
inst->appinfo.detected.engine.major == 4 && //
|
||||
inst->appinfo.detected.engine.minor <= 27 && //
|
||||
inst->appinfo.detected.engine.patch <= 0) {
|
||||
inst->quirks.disable_vulkan_format_depth_stencil = true;
|
||||
}
|
||||
}
|
||||
|
||||
XrResult
|
||||
oxr_instance_create(struct oxr_logger *log, const XrInstanceCreateInfo *createInfo, struct oxr_instance **out_instance)
|
||||
{
|
||||
|
@ -356,6 +367,9 @@ oxr_instance_create(struct oxr_logger *log, const XrInstanceCreateInfo *createIn
|
|||
// Detect game engine.
|
||||
detect_engine(log, inst, createInfo);
|
||||
|
||||
// Apply any quirks
|
||||
apply_quirks(log, inst);
|
||||
|
||||
u_var_add_root((void *)inst, "XrInstance", true);
|
||||
|
||||
/* ---- HACK ---- */
|
||||
|
@ -369,15 +383,17 @@ oxr_instance_create(struct oxr_logger *log, const XrInstanceCreateInfo *createIn
|
|||
"\tcreateInfo->applicationInfo.engineName: %s\n"
|
||||
"\tcreateInfo->applicationInfo.engineVersion: %i\n"
|
||||
"\tappinfo.detected.engine.name: %s\n"
|
||||
"\tappinfo.detected.engine.version: %i.%i.%i\n",
|
||||
createInfo->applicationInfo.applicationName, //
|
||||
createInfo->applicationInfo.applicationVersion, //
|
||||
createInfo->applicationInfo.engineName, //
|
||||
createInfo->applicationInfo.engineVersion, //
|
||||
inst->appinfo.detected.engine.name, //
|
||||
inst->appinfo.detected.engine.major, //
|
||||
inst->appinfo.detected.engine.minor, //
|
||||
inst->appinfo.detected.engine.patch); //
|
||||
"\tappinfo.detected.engine.version: %i.%i.%i\n"
|
||||
"\tquirks.disable_vulkan_format_depth_stencil: %s",
|
||||
createInfo->applicationInfo.applicationName, //
|
||||
createInfo->applicationInfo.applicationVersion, //
|
||||
createInfo->applicationInfo.engineName, //
|
||||
createInfo->applicationInfo.engineVersion, //
|
||||
inst->appinfo.detected.engine.name, //
|
||||
inst->appinfo.detected.engine.major, //
|
||||
inst->appinfo.detected.engine.minor, //
|
||||
inst->appinfo.detected.engine.patch, //
|
||||
inst->quirks.disable_vulkan_format_depth_stencil ? "true" : "false"); //
|
||||
|
||||
*out_instance = inst;
|
||||
|
||||
|
|
|
@ -1200,6 +1200,12 @@ struct oxr_instance
|
|||
} detected;
|
||||
} appinfo;
|
||||
|
||||
struct
|
||||
{
|
||||
//! Unreal has a bug in the VulkanRHI backend.
|
||||
bool disable_vulkan_format_depth_stencil;
|
||||
} quirks;
|
||||
|
||||
//! Debug messengers
|
||||
struct oxr_debug_messenger *messengers[XRT_MAX_HANDLE_CHILDREN];
|
||||
|
||||
|
|
|
@ -100,6 +100,7 @@ oxr_session_enumerate_formats(struct oxr_logger *log,
|
|||
uint32_t *formatCountOutput,
|
||||
int64_t *formats)
|
||||
{
|
||||
struct oxr_instance *inst = sess->sys->inst;
|
||||
struct xrt_compositor *xc = sess->compositor;
|
||||
if (formatCountOutput == NULL) {
|
||||
return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, "(formatCountOutput == NULL) can not be null");
|
||||
|
@ -111,8 +112,21 @@ oxr_session_enumerate_formats(struct oxr_logger *log,
|
|||
return oxr_session_success_result(sess);
|
||||
}
|
||||
|
||||
OXR_TWO_CALL_HELPER(log, formatCapacityInput, formatCountOutput, formats, xc->info.num_formats,
|
||||
xc->info.formats, oxr_session_success_result(sess));
|
||||
uint32_t filtered_count = 0;
|
||||
int64_t filtered_formats[XRT_MAX_SWAPCHAIN_FORMATS];
|
||||
for (uint32_t i = 0; i < xc->info.num_formats; i++) {
|
||||
int64_t format = xc->info.formats[i];
|
||||
|
||||
if (inst->quirks.disable_vulkan_format_depth_stencil &&
|
||||
format == 130 /* VK_FORMAT_D32_SFLOAT_S8_UINT */) {
|
||||
continue;
|
||||
}
|
||||
|
||||
filtered_formats[filtered_count++] = format;
|
||||
}
|
||||
|
||||
OXR_TWO_CALL_HELPER(log, formatCapacityInput, formatCountOutput, formats, filtered_count, filtered_formats,
|
||||
oxr_session_success_result(sess));
|
||||
}
|
||||
|
||||
XrResult
|
||||
|
|
Loading…
Reference in a new issue