@@ -4381,6 +4381,27 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
#define SDL_HINT_PEN_TOUCH_EVENTS "SDL_PEN_TOUCH_EVENTS"
|
#define SDL_HINT_PEN_TOUCH_EVENTS "SDL_PEN_TOUCH_EVENTS"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A variable controlling whether SDL backend information is logged.
|
||||||
|
*
|
||||||
|
* The variable can be set to the following values:
|
||||||
|
*
|
||||||
|
* - "0": Subsystem information will not be logged. (default)
|
||||||
|
* - "1": Subsystem information will be logged.
|
||||||
|
*
|
||||||
|
* This is generally meant to be used as an environment variable to let
|
||||||
|
* end-users report what subsystems were chosen on their system, to aid
|
||||||
|
* in debugging. Logged information is sent through SDL_Log(), which
|
||||||
|
* means by default they appear on stdout on most platforms or maybe
|
||||||
|
* OutputDebugString() on Windows, and can be funneled by the app with
|
||||||
|
* SDL_SetLogOutputFunction(), etc.
|
||||||
|
*
|
||||||
|
* This hint can be set anytime, but the specific logs are generated
|
||||||
|
* during subsystem init.
|
||||||
|
*
|
||||||
|
* \since This hint is available since SDL 3.4.0.
|
||||||
|
*/
|
||||||
|
#define SDL_HINT_LOG_BACKENDS "SDL_LOG_BACKENDS"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An enumeration of hint priorities.
|
* An enumeration of hint priorities.
|
||||||
|
|||||||
@@ -552,3 +552,12 @@ char *SDL_CreateDeviceName(Uint16 vendor, Uint16 product, const char *vendor_nam
|
|||||||
|
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SDL_LogBackend(const char *subsystem, const char *backend)
|
||||||
|
{
|
||||||
|
if (SDL_GetHintBoolean(SDL_HINT_LOG_BACKENDS, false)) {
|
||||||
|
SDL_Log("SDL_BACKEND: %s -> '%s'", subsystem, backend);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -75,4 +75,7 @@ extern const char *SDL_GetPersistentString(const char *string);
|
|||||||
|
|
||||||
extern char *SDL_CreateDeviceName(Uint16 vendor, Uint16 product, const char *vendor_name, const char *product_name, const char *default_name);
|
extern char *SDL_CreateDeviceName(Uint16 vendor, Uint16 product, const char *vendor_name, const char *product_name, const char *default_name);
|
||||||
|
|
||||||
|
// Log what backend a subsystem chose, if a hint was set to do so. Useful for debugging.
|
||||||
|
extern void SDL_LogBackend(const char *subsystem, const char *backend);
|
||||||
|
|
||||||
#endif // SDL_utils_h_
|
#endif // SDL_utils_h_
|
||||||
|
|||||||
@@ -1006,7 +1006,9 @@ bool SDL_InitAudio(const char *driver_name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!initialized) {
|
if (initialized) {
|
||||||
|
SDL_LogBackend("audio", current_audio.name);
|
||||||
|
} else {
|
||||||
// specific drivers will set the error message if they fail, but otherwise we do it here.
|
// specific drivers will set the error message if they fail, but otherwise we do it here.
|
||||||
if (!tried_to_init) {
|
if (!tried_to_init) {
|
||||||
if (driver_name) {
|
if (driver_name) {
|
||||||
|
|||||||
@@ -1524,7 +1524,9 @@ bool SDL_CameraInit(const char *driver_name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!initialized) {
|
if (initialized) {
|
||||||
|
SDL_LogBackend("camera", camera_driver.name);
|
||||||
|
} else {
|
||||||
// specific drivers will set the error message if they fail, but otherwise we do it here.
|
// specific drivers will set the error message if they fail, but otherwise we do it here.
|
||||||
if (!tried_to_init) {
|
if (!tried_to_init) {
|
||||||
if (driver_name) {
|
if (driver_name) {
|
||||||
|
|||||||
@@ -711,6 +711,7 @@ SDL_GPUDevice *SDL_CreateGPUDeviceWithProperties(SDL_PropertiesID props)
|
|||||||
|
|
||||||
selectedBackend = SDL_GPUSelectBackend(props);
|
selectedBackend = SDL_GPUSelectBackend(props);
|
||||||
if (selectedBackend != NULL) {
|
if (selectedBackend != NULL) {
|
||||||
|
SDL_LogBackend("gpu", selectedBackend->name);
|
||||||
debug_mode = SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN, true);
|
debug_mode = SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN, true);
|
||||||
preferLowPower = SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOLEAN, false);
|
preferLowPower = SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOLEAN, false);
|
||||||
|
|
||||||
|
|||||||
@@ -512,10 +512,12 @@ static void MaybeInitializeLibUring(void)
|
|||||||
{
|
{
|
||||||
if (SDL_ShouldInit(&liburing_init)) {
|
if (SDL_ShouldInit(&liburing_init)) {
|
||||||
if (LoadLibUring()) {
|
if (LoadLibUring()) {
|
||||||
|
SDL_LogBackend("asyncio", "liburing");
|
||||||
CreateAsyncIOQueue = SDL_SYS_CreateAsyncIOQueue_liburing;
|
CreateAsyncIOQueue = SDL_SYS_CreateAsyncIOQueue_liburing;
|
||||||
QuitAsyncIO = SDL_SYS_QuitAsyncIO_liburing;
|
QuitAsyncIO = SDL_SYS_QuitAsyncIO_liburing;
|
||||||
AsyncIOFromFile = SDL_SYS_AsyncIOFromFile_liburing;
|
AsyncIOFromFile = SDL_SYS_AsyncIOFromFile_liburing;
|
||||||
} else { // can't use liburing? Use the "generic" threadpool implementation instead.
|
} else { // can't use liburing? Use the "generic" threadpool implementation instead.
|
||||||
|
SDL_LogBackend("asyncio", "generic");
|
||||||
CreateAsyncIOQueue = SDL_SYS_CreateAsyncIOQueue_Generic;
|
CreateAsyncIOQueue = SDL_SYS_CreateAsyncIOQueue_Generic;
|
||||||
QuitAsyncIO = SDL_SYS_QuitAsyncIO_Generic;
|
QuitAsyncIO = SDL_SYS_QuitAsyncIO_Generic;
|
||||||
AsyncIOFromFile = SDL_SYS_AsyncIOFromFile_Generic;
|
AsyncIOFromFile = SDL_SYS_AsyncIOFromFile_Generic;
|
||||||
|
|||||||
@@ -511,10 +511,12 @@ static void MaybeInitializeWinIoRing(void)
|
|||||||
{
|
{
|
||||||
if (SDL_ShouldInit(&ioring_init)) {
|
if (SDL_ShouldInit(&ioring_init)) {
|
||||||
if (LoadWinIoRing()) {
|
if (LoadWinIoRing()) {
|
||||||
|
SDL_LogBackend("asyncio", "ioring");
|
||||||
CreateAsyncIOQueue = SDL_SYS_CreateAsyncIOQueue_ioring;
|
CreateAsyncIOQueue = SDL_SYS_CreateAsyncIOQueue_ioring;
|
||||||
QuitAsyncIO = SDL_SYS_QuitAsyncIO_ioring;
|
QuitAsyncIO = SDL_SYS_QuitAsyncIO_ioring;
|
||||||
AsyncIOFromFile = SDL_SYS_AsyncIOFromFile_ioring;
|
AsyncIOFromFile = SDL_SYS_AsyncIOFromFile_ioring;
|
||||||
} else { // can't use ioring? Use the "generic" threadpool implementation instead.
|
} else { // can't use ioring? Use the "generic" threadpool implementation instead.
|
||||||
|
SDL_LogBackend("asyncio", "generic");
|
||||||
CreateAsyncIOQueue = SDL_SYS_CreateAsyncIOQueue_Generic;
|
CreateAsyncIOQueue = SDL_SYS_CreateAsyncIOQueue_Generic;
|
||||||
QuitAsyncIO = SDL_SYS_QuitAsyncIO_Generic;
|
QuitAsyncIO = SDL_SYS_QuitAsyncIO_Generic;
|
||||||
AsyncIOFromFile = SDL_SYS_AsyncIOFromFile_Generic;
|
AsyncIOFromFile = SDL_SYS_AsyncIOFromFile_Generic;
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ static SDL_GetPowerInfo_Impl implementations[] = {
|
|||||||
SDL_PowerState SDL_GetPowerInfo(int *seconds, int *percent)
|
SDL_PowerState SDL_GetPowerInfo(int *seconds, int *percent)
|
||||||
{
|
{
|
||||||
#ifndef SDL_POWER_DISABLED
|
#ifndef SDL_POWER_DISABLED
|
||||||
const int total = sizeof(implementations) / sizeof(implementations[0]);
|
const int total = SDL_arraysize(implementations);
|
||||||
SDL_PowerState result = SDL_POWERSTATE_UNKNOWN;
|
SDL_PowerState result = SDL_POWERSTATE_UNKNOWN;
|
||||||
int i;
|
int i;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1063,7 +1063,9 @@ SDL_Renderer *SDL_CreateRendererWithProperties(SDL_PropertiesID props)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!rc) {
|
if (rc) {
|
||||||
|
SDL_LogBackend("render", renderer->name);
|
||||||
|
} else {
|
||||||
if (driver_name) {
|
if (driver_name) {
|
||||||
SDL_SetError("%s not available", driver_name);
|
SDL_SetError("%s not available", driver_name);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -118,7 +118,9 @@ SDL_Storage *SDL_OpenTitleStorage(const char *override, SDL_PropertiesID props)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!storage) {
|
if (storage) {
|
||||||
|
SDL_LogBackend("title_storage", titlebootstrap[i]->name);
|
||||||
|
} else {
|
||||||
if (driver_name) {
|
if (driver_name) {
|
||||||
SDL_SetError("%s not available", driver_name);
|
SDL_SetError("%s not available", driver_name);
|
||||||
} else {
|
} else {
|
||||||
@@ -160,7 +162,9 @@ SDL_Storage *SDL_OpenUserStorage(const char *org, const char *app, SDL_Propertie
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!storage) {
|
if (storage) {
|
||||||
|
SDL_LogBackend("user_storage", userbootstrap[i]->name);
|
||||||
|
} else {
|
||||||
if (driver_name) {
|
if (driver_name) {
|
||||||
SDL_SetError("%s not available", driver_name);
|
SDL_SetError("%s not available", driver_name);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -679,7 +679,9 @@ bool SDL_VideoInit(const char *driver_name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!video) {
|
if (video) {
|
||||||
|
SDL_LogBackend("video", bootstrap[i]->name);
|
||||||
|
} else {
|
||||||
if (driver_name) {
|
if (driver_name) {
|
||||||
SDL_SetError("%s not available", driver_name);
|
SDL_SetError("%s not available", driver_name);
|
||||||
goto pre_driver_error;
|
goto pre_driver_error;
|
||||||
|
|||||||
Reference in New Issue
Block a user