Added the "SDL.renderer.d3d12.command_queue" property

Fixes https://github.com/libsdl-org/SDL/issues/8491
main
Sam Lantinga 2023-11-08 11:27:00 -08:00
parent 4e8d1ec983
commit 6c91b28e71
2 changed files with 8 additions and 1 deletions

View File

@ -313,6 +313,7 @@ extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer *renderer, SDL_Rend
* "SDL.renderer.d3d9.device" - the IDirect3DDevice9 associated with the renderer * "SDL.renderer.d3d9.device" - the IDirect3DDevice9 associated with the renderer
* "SDL.renderer.d3d11.device" - the ID3D11Device associated with the renderer * "SDL.renderer.d3d11.device" - the ID3D11Device associated with the renderer
* "SDL.renderer.d3d12.device" - the ID3D12Device associated with the renderer * "SDL.renderer.d3d12.device" - the ID3D12Device associated with the renderer
* "SDL.renderer.d3d12.command_queue" - the ID3D12CommandQueue associated with the renderer
* *
* \param renderer the rendering context * \param renderer the rendering context
* \returns a valid property ID on success or 0 on failure; call * \returns a valid property ID on success or 0 on failure; call

View File

@ -323,6 +323,10 @@ static void D3D12_ReleaseAll(SDL_Renderer *renderer)
D3D12_RenderData *data = (D3D12_RenderData *)renderer->driverdata; D3D12_RenderData *data = (D3D12_RenderData *)renderer->driverdata;
SDL_Texture *texture = NULL; SDL_Texture *texture = NULL;
SDL_PropertiesID props = SDL_GetRendererProperties(renderer);
SDL_SetProperty(props, "SDL.renderer.d3d12.device", NULL);
SDL_SetProperty(props, "SDL.renderer.d3d12.command_queue", NULL);
/* Release all textures */ /* Release all textures */
for (texture = renderer->textures; texture; texture = texture->next) { for (texture = renderer->textures; texture; texture = texture->next) {
D3D12_DestroyTexture(renderer, texture); D3D12_DestroyTexture(renderer, texture);
@ -1068,7 +1072,9 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer)
} }
data->srvPoolHead = &data->srvPoolNodes[0]; data->srvPoolHead = &data->srvPoolNodes[0];
SDL_SetProperty(SDL_GetRendererProperties(renderer), "SDL.renderer.d3d12.device", data->d3dDevice); SDL_PropertiesID props = SDL_GetRendererProperties(renderer);
SDL_SetProperty(props, "SDL.renderer.d3d12.device", data->d3dDevice);
SDL_SetProperty(props, "SDL.renderer.d3d12.command_queue", data->commandQueue);
done: done:
SAFE_RELEASE(d3dDevice); SAFE_RELEASE(d3dDevice);