hints: Renamed SDL_HINT_LOG_BACKENDS to SDL_DEBUG_LOGGING.
This still logs backend choices, but we might use it for other things. For example, what Android device is being used, or all the devices we enumerated, etc. Ideally this eventually logs all the stuff we often have to ask followup questions about.
This commit is contained in:
@@ -553,11 +553,12 @@ char *SDL_CreateDeviceName(Uint16 vendor, Uint16 product, const char *vendor_nam
|
||||
return name;
|
||||
}
|
||||
|
||||
void SDL_LogBackend(const char *subsystem, const char *backend)
|
||||
#define SDL_DEBUG_LOG_INTRO "SDL_DEBUG: "
|
||||
|
||||
void SDL_DebugLogBackend(const char *subsystem, const char *backend)
|
||||
{
|
||||
if (SDL_GetHintBoolean(SDL_HINT_LOG_BACKENDS, false)) {
|
||||
SDL_Log("SDL_BACKEND: %s -> '%s'", subsystem, backend);
|
||||
if (SDL_GetHintBoolean(SDL_HINT_DEBUG_LOGGING, false)) {
|
||||
SDL_Log(SDL_DEBUG_LOG_INTRO "chose %s backend '%s'", subsystem, backend);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -76,6 +76,6 @@ 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);
|
||||
|
||||
// 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);
|
||||
extern void SDL_DebugLogBackend(const char *subsystem, const char *backend);
|
||||
|
||||
#endif // SDL_utils_h_
|
||||
|
||||
@@ -1007,7 +1007,7 @@ bool SDL_InitAudio(const char *driver_name)
|
||||
}
|
||||
|
||||
if (initialized) {
|
||||
SDL_LogBackend("audio", current_audio.name);
|
||||
SDL_DebugLogBackend("audio", current_audio.name);
|
||||
} else {
|
||||
// specific drivers will set the error message if they fail, but otherwise we do it here.
|
||||
if (!tried_to_init) {
|
||||
|
||||
@@ -1525,7 +1525,7 @@ bool SDL_CameraInit(const char *driver_name)
|
||||
}
|
||||
|
||||
if (initialized) {
|
||||
SDL_LogBackend("camera", camera_driver.name);
|
||||
SDL_DebugLogBackend("camera", camera_driver.name);
|
||||
} else {
|
||||
// specific drivers will set the error message if they fail, but otherwise we do it here.
|
||||
if (!tried_to_init) {
|
||||
|
||||
@@ -711,7 +711,7 @@ SDL_GPUDevice *SDL_CreateGPUDeviceWithProperties(SDL_PropertiesID props)
|
||||
|
||||
selectedBackend = SDL_GPUSelectBackend(props);
|
||||
if (selectedBackend != NULL) {
|
||||
SDL_LogBackend("gpu", selectedBackend->name);
|
||||
SDL_DebugLogBackend("gpu", selectedBackend->name);
|
||||
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);
|
||||
|
||||
|
||||
@@ -512,12 +512,12 @@ static void MaybeInitializeLibUring(void)
|
||||
{
|
||||
if (SDL_ShouldInit(&liburing_init)) {
|
||||
if (LoadLibUring()) {
|
||||
SDL_LogBackend("asyncio", "liburing");
|
||||
SDL_DebugLogBackend("asyncio", "liburing");
|
||||
CreateAsyncIOQueue = SDL_SYS_CreateAsyncIOQueue_liburing;
|
||||
QuitAsyncIO = SDL_SYS_QuitAsyncIO_liburing;
|
||||
AsyncIOFromFile = SDL_SYS_AsyncIOFromFile_liburing;
|
||||
} else { // can't use liburing? Use the "generic" threadpool implementation instead.
|
||||
SDL_LogBackend("asyncio", "generic");
|
||||
SDL_DebugLogBackend("asyncio", "generic");
|
||||
CreateAsyncIOQueue = SDL_SYS_CreateAsyncIOQueue_Generic;
|
||||
QuitAsyncIO = SDL_SYS_QuitAsyncIO_Generic;
|
||||
AsyncIOFromFile = SDL_SYS_AsyncIOFromFile_Generic;
|
||||
|
||||
@@ -511,12 +511,12 @@ static void MaybeInitializeWinIoRing(void)
|
||||
{
|
||||
if (SDL_ShouldInit(&ioring_init)) {
|
||||
if (LoadWinIoRing()) {
|
||||
SDL_LogBackend("asyncio", "ioring");
|
||||
SDL_DebugLogBackend("asyncio", "ioring");
|
||||
CreateAsyncIOQueue = SDL_SYS_CreateAsyncIOQueue_ioring;
|
||||
QuitAsyncIO = SDL_SYS_QuitAsyncIO_ioring;
|
||||
AsyncIOFromFile = SDL_SYS_AsyncIOFromFile_ioring;
|
||||
} else { // can't use ioring? Use the "generic" threadpool implementation instead.
|
||||
SDL_LogBackend("asyncio", "generic");
|
||||
SDL_DebugLogBackend("asyncio", "generic");
|
||||
CreateAsyncIOQueue = SDL_SYS_CreateAsyncIOQueue_Generic;
|
||||
QuitAsyncIO = SDL_SYS_QuitAsyncIO_Generic;
|
||||
AsyncIOFromFile = SDL_SYS_AsyncIOFromFile_Generic;
|
||||
|
||||
@@ -1064,7 +1064,7 @@ SDL_Renderer *SDL_CreateRendererWithProperties(SDL_PropertiesID props)
|
||||
}
|
||||
|
||||
if (rc) {
|
||||
SDL_LogBackend("render", renderer->name);
|
||||
SDL_DebugLogBackend("render", renderer->name);
|
||||
} else {
|
||||
if (driver_name) {
|
||||
SDL_SetError("%s not available", driver_name);
|
||||
|
||||
@@ -119,7 +119,7 @@ SDL_Storage *SDL_OpenTitleStorage(const char *override, SDL_PropertiesID props)
|
||||
}
|
||||
}
|
||||
if (storage) {
|
||||
SDL_LogBackend("title_storage", titlebootstrap[i]->name);
|
||||
SDL_DebugLogBackend("title_storage", titlebootstrap[i]->name);
|
||||
} else {
|
||||
if (driver_name) {
|
||||
SDL_SetError("%s not available", driver_name);
|
||||
@@ -163,7 +163,7 @@ SDL_Storage *SDL_OpenUserStorage(const char *org, const char *app, SDL_Propertie
|
||||
}
|
||||
}
|
||||
if (storage) {
|
||||
SDL_LogBackend("user_storage", userbootstrap[i]->name);
|
||||
SDL_DebugLogBackend("user_storage", userbootstrap[i]->name);
|
||||
} else {
|
||||
if (driver_name) {
|
||||
SDL_SetError("%s not available", driver_name);
|
||||
|
||||
@@ -680,7 +680,7 @@ bool SDL_VideoInit(const char *driver_name)
|
||||
}
|
||||
}
|
||||
if (video) {
|
||||
SDL_LogBackend("video", bootstrap[i]->name);
|
||||
SDL_DebugLogBackend("video", bootstrap[i]->name);
|
||||
} else {
|
||||
if (driver_name) {
|
||||
SDL_SetError("%s not available", driver_name);
|
||||
|
||||
Reference in New Issue
Block a user