SDL_image icon indicating copy to clipboard operation
SDL_image copied to clipboard

Feature Request: Load image directly into SDL GPU texture

Open jsoulier opened this issue 9 months ago • 1 comments

Hey there,

Since SDL_ttf has support for the GPU API, does it make sense to add some convenience functions here for loading an image into a GPU texture?

To start, something like...

extern SDL_DECLSPEC SDL_GPUTexture * SDLCALL IMG_LoadGPUTexture(SDL_GPUDevice *device, SDL_GPUCopyPass *copy_pass, const char *path);

Basically just the same API as:

extern SDL_DECLSPEC SDL_Texture * SDLCALL IMG_LoadTexture(SDL_Renderer *renderer, const char *file);

Thanks

jsoulier avatar Apr 11 '25 01:04 jsoulier

this would be great

relatedly, currently getting an image into a gpu texture requires manually calling SDL_ConvertSurface and requires that you manually choose a pixel format and gpu texture format that are compatible with one another (ie SDL_PIXELFORMAT_RGBA32 and SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM)

this works but it feels more than a little awkward

alterae avatar Jun 28 '25 22:06 alterae