Getting the name of the current used GPU in SDL2 with SDL_Renderer

Is is possible to get the GPU that SDL_Renderer is using? I’ve been looking for like an hour but so far no results.

No, not at the moment

If you are using the OpenGL renderer backend you could grab the name of the underlying hardware with glGetString(GL_RENDERER) from the main thread, after creating the SDL renderer. Here is an example, with error handling omitted.

render_drivers_count = SDL_GetNumRenderDrivers();

for (int i = 0; i < render_drivers_count; i += 1) {
	SDL_GetRenderDriverInfo(i, &renderer_info);

	/* Select the first device that supports an OpenGL backend*/
	if (SDL_strcmp(renderer_info.name, "opengl") == 0) {
		opengl_driver = i;
		break;
	}
}

renderer = SDL_CreateRenderer(window,
	opengl_driver,
	SDL_RENDERER_ACCELERATED);

graphics_device_name = (const char*)glGetString(GL_RENDERER);

To do this, you would need to include SDL_opengl.h and link against your operating system’s OpenGL library. As far as I know, you can’t get the name of a video adapter when using a Direct3D backend.

Unfortunately, there is no portable way to choose which adapter the OpenGL context is created for. Device selection is often controlled by the OS or window system.

https://registry.khronos.org/OpenGL-Refpages/gl4/html/glGetString.xhtml