SDL icon indicating copy to clipboard operation
SDL copied to clipboard

[SDL3] Be able to retrieve real rendering backend name when using GPU backend

Open MrOnlineCoder opened this issue 1 year ago • 3 comments

If renderer is created with SDL_CreateRenderer(window, NULL) and SDL decides to use the new GPU API for it, the call to SDL_GetRendererName function will return gpu as the result for it, giving not much usefulness in terms of logging or debugging about which backend/graphics API is used behind the scenes. Maybe it would be worth adding it as property to renderer? Something like SDL_PROP_RENDERER_GPU_API_STRING

MrOnlineCoder avatar Dec 06 '24 22:12 MrOnlineCoder

Can we just add the backend renderer in brackets to 'SDL_GetRendererName'? So we'd get "GPU (OpenGL)".

AntTheAlchemist avatar Dec 07 '24 01:12 AntTheAlchemist

That's one of solutions, at least I personally use it for mostly debugging and including in crash reports / logs, so that would be just enough. And I am not sure that renderer name is something that should be parsed programatically, so making it more human-readable like you suggested is fine, I guess?

MrOnlineCoder avatar Dec 07 '24 03:12 MrOnlineCoder

No, let's make it a property. The name strings probably shouldn't be messed with like that.

icculus avatar Dec 07 '24 04:12 icculus

Done!

Check https://github.com/libsdl-org/SDL/commit/969f03d9f0b20a32b1e03cc181018c5dc3d5c317 for an example of getting the GPU driver from the renderer.

slouken avatar Dec 24 '24 00:12 slouken