Added SDL_GetTextureDXGIResource() to get the DXGI resource associated with a render texture.

Also switched the D3D11 and D3D12 renderers to use real NV12 textures for NV12 data.

The combination of these two changes allows us to implement 0-copy video decode and playback for D3D11 in testffmpeg without any access to the renderer internals.
This commit is contained in:
Sam Lantinga 2023-10-10 00:04:45 -07:00
parent a842446f62
commit 2bd478ae65
10 changed files with 336 additions and 265 deletions

View file

@ -404,6 +404,23 @@ extern DECLSPEC SDL_Texture *SDLCALL SDL_CreateTexture(SDL_Renderer *renderer, U
*/
extern DECLSPEC SDL_Texture *SDLCALL SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *surface);
typedef struct IDXGIResource IDXGIResource;
/**
* Get the DXGI resource associated with a texture.
*
* This is available when using the direct3d11 and direct3d12 renderers.
*
* Once you are done using the resource, you should release it to avoid a
* resource leak.
*
* \param texture the texture from which to get the associated resource
* \returns the DXGI resource associated with given texture or NULL if it is
* not available; call SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC IDXGIResource* SDLCALL SDL_GetTextureDXGIResource(SDL_Texture *texture);
/**
* Query the attributes of a texture.
*