SDL Render Clamp to Border Texture Address Mode

I am using SDL_Render for image warping and would really like to be able to have a texture address mode CLAMP_TO_BORDER. The big graphics APIs (OpenGL, D3D11 and 12, Vulkan, Metal as of macOS 12 and iOS 14) all support this and I was wondering why it is not offered in SDL_Render (and not in SDL_GPU afaik).

All the workarounds I tried so far suck in some regard while just setting CLAMP_TO_BORDER solves things for me very nicely.

Edit: I only now realize that setting the texture address mode in SDL_Render is not even available in SDL 3.2.x but that it will be available as part of 3.4.0. Still, the available address modes do/will not include BORDER.

Not all the SDL render backends support clamp to border, and it’s not something you can emulate if the texture sampler doesn’t support it.

That said, please feel free to create a PR for this if I’m mistaken.

Thanks for the reply. I think’s it’s a matter of enforcing feature parity. Is it automatically a no-go if just one backend doesn’t support it or only supports it after some version (like Metal)?

If one would add it and not all backends support it, it would also entail adding functions to query if the feature is supported by the current backend, right? And maybe that becomes a little bit much for just one new value in an enum.

You could always just put a border on the texture and then set the mode to clamp to edge (SDL_TEXTURE_ADDRESS_CLAMP)

Yes, that’s what I do as a workaround at the moment. But when loading images I have to either manipulate the image content first or I need to draw over the texture created from that image.