dxil_validator: Add support for Xbox GDK.

In addition to the DLL names being different, we don't have to do the versioning work since we don't have to fuss with known bad versions (for example).

Co-authored-by: Ethan Lee <flibitijibibo@gmail.com>
Co-authored-by: David Jacewicz <david.jacewicz@protonmail.com>
Co-authored-by: tieuchanlong <tieuchanlong@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19022>
This commit is contained in:
Caleb Cornett 2023-01-11 10:48:56 -05:00 committed by Marge Bot
parent 7588164717
commit 75415e58e3

View file

@ -31,7 +31,13 @@ static HMODULE
load_dxil_mod()
{
/* First, try to load DXIL.dll from the default search-path */
#if defined(_GAMING_XBOX_SCARLETT)
HMODULE mod = LoadLibraryA("dxcompiler_xs.dll");
#elif defined (_GAMING_XBOX)
HMODULE mod = LoadLibraryA("dxcompiler_x.dll");
#else
HMODULE mod = LoadLibraryA("DXIL.dll");
#endif
if (mod)
return mod;
@ -101,6 +107,7 @@ get_validator_version(IDxcValidator *val)
return NO_DXIL_VALIDATION;
}
#ifndef _GAMING_XBOX
static uint64_t
get_dll_version(HMODULE mod)
{
@ -139,11 +146,13 @@ get_dll_version(HMODULE mod)
free(version_data);
return ret;
}
#endif
static enum dxil_validator_version
get_filtered_validator_version(HMODULE mod, enum dxil_validator_version raw)
{
switch (raw) {
#ifndef _GAMING_XBOX
case DXIL_VALIDATOR_1_6: {
uint64_t dxil_version = get_dll_version(mod);
static constexpr uint64_t known_bad_version =
@ -153,6 +162,7 @@ get_filtered_validator_version(HMODULE mod, enum dxil_validator_version raw)
return DXIL_VALIDATOR_1_5;
FALLTHROUGH;
}
#endif
default:
return raw;
}