Improve OpenXR loader error messages
When the OpenXR loader library fails to load, provide a detailed error message explaining: - On Windows: need openxr_loader.dll in app directory or PATH - On Linux: install libopenxr-loader package or set LD_LIBRARY_PATH - Can use SDL_HINT_OPENXR_LIBRARY hint to specify path Also update D3D12 backend to include the error in its warning log, and remove redundant SDL_SetError in Vulkan backend that was overwriting the detailed message.
This commit is contained in:
committed by
Ethan Lee
parent
5640647e14
commit
1f7db1ebcf
@@ -8686,7 +8686,7 @@ static bool D3D12_PrepareDriver(SDL_VideoDevice *_this, SDL_PropertiesID props)
|
|||||||
bool xr = SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_XR_ENABLE_BOOLEAN, false);
|
bool xr = SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_XR_ENABLE_BOOLEAN, false);
|
||||||
if (xr) {
|
if (xr) {
|
||||||
if (!SDL_OpenXR_LoadLibrary()) {
|
if (!SDL_OpenXR_LoadLibrary()) {
|
||||||
SDL_LogWarn(SDL_LOG_CATEGORY_GPU, "D3D12: Failed to load OpenXR");
|
SDL_LogWarn(SDL_LOG_CATEGORY_GPU, "D3D12: Failed to load OpenXR: %s", SDL_GetError());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12738,7 +12738,7 @@ static bool VULKAN_PrepareDriver(SDL_VideoDevice *_this, SDL_PropertiesID props)
|
|||||||
|
|
||||||
if (xr) {
|
if (xr) {
|
||||||
if (!SDL_OpenXR_LoadLibrary()) {
|
if (!SDL_OpenXR_LoadLibrary()) {
|
||||||
SDL_SetError("Failed to load OpenXR loader or a required symbol");
|
/* SDL_GetError() already has the detailed message from SDL_OpenXR_LoadLibrary() */
|
||||||
SDL_Vulkan_UnloadLibrary();
|
SDL_Vulkan_UnloadLibrary();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -259,7 +259,10 @@ SDL_DECLSPEC bool SDLCALL SDL_OpenXR_LoadLibrary(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!openxr_loader.lib) {
|
if (!openxr_loader.lib) {
|
||||||
SDL_SetError("Failed loading OpenXR library");
|
SDL_SetError("Failed to load OpenXR loader library. "
|
||||||
|
"On Windows, ensure openxr_loader.dll is in your application directory or PATH. "
|
||||||
|
"On Linux, install the OpenXR loader package (libopenxr-loader) or set LD_LIBRARY_PATH. "
|
||||||
|
"You can also use the SDL_HINT_OPENXR_LIBRARY hint to specify the loader path.");
|
||||||
openxr_load_refcount--;
|
openxr_load_refcount--;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user