mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-02 16:08:30 +00:00
Added SDL_PROP_RENDERER_GPU_DEVICE_POINTER
Fixes https://github.com/libsdl-org/SDL/issues/11600
This commit is contained in:
@@ -441,6 +441,11 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetRendererName(SDL_Renderer *rende
|
||||
* swapchain images, or potential frames in flight, used by the Vulkan
|
||||
* renderer
|
||||
*
|
||||
* With the gpu renderer:
|
||||
*
|
||||
* - `SDL_PROP_RENDERER_GPU_DEVICE_POINTER`: the SDL_GPUDevice associated
|
||||
* with the renderer
|
||||
*
|
||||
* \param renderer the rendering context.
|
||||
* \returns a valid property ID on success or 0 on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
@@ -474,6 +479,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetRendererProperties(SDL_Rende
|
||||
#define SDL_PROP_RENDERER_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER "SDL.renderer.vulkan.graphics_queue_family_index"
|
||||
#define SDL_PROP_RENDERER_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER "SDL.renderer.vulkan.present_queue_family_index"
|
||||
#define SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER "SDL.renderer.vulkan.swapchain_image_count"
|
||||
#define SDL_PROP_RENDERER_GPU_DEVICE_POINTER "SDL.renderer.gpu.device"
|
||||
|
||||
/**
|
||||
* Get the output size in pixels of a rendering context.
|
||||
|
@@ -1284,6 +1284,8 @@ static bool GPU_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_P
|
||||
return false;
|
||||
}
|
||||
|
||||
SDL_SetPointerProperty(SDL_GetRendererProperties(renderer), SDL_PROP_RENDERER_GPU_DEVICE_POINTER, data->device);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -1093,6 +1093,10 @@ static void SDLTest_PrintRenderer(SDL_Renderer *renderer)
|
||||
name = SDL_GetRendererName(renderer);
|
||||
|
||||
SDL_Log(" Renderer %s:\n", name);
|
||||
if (SDL_strcmp(name, "gpu") == 0) {
|
||||
SDL_GPUDevice *device = SDL_GetPointerProperty(SDL_GetRendererProperties(renderer), SDL_PROP_RENDERER_GPU_DEVICE_POINTER, NULL);
|
||||
SDL_Log(" Driver: %s\n", SDL_GetGPUDeviceDriver(device));
|
||||
}
|
||||
SDL_Log(" VSync: %d\n", (int)SDL_GetNumberProperty(SDL_GetRendererProperties(renderer), SDL_PROP_RENDERER_VSYNC_NUMBER, 0));
|
||||
|
||||
texture_formats = (const SDL_PixelFormat *)SDL_GetPointerProperty(SDL_GetRendererProperties(renderer), SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER, NULL);
|
||||
|
Reference in New Issue
Block a user