mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-19 22:10:52 +00:00
Don't allow SDL_TEXTURE_ADDRESS_WRAP if it's not supported
Fixes https://github.com/libsdl-org/SDL/issues/13908
This commit is contained in:
@@ -4581,8 +4581,8 @@ bool SDL_RenderTextureTiled(SDL_Renderer *renderer, SDL_Texture *texture, const
|
||||
(!srcrect ||
|
||||
(real_srcrect.x == 0.0f && real_srcrect.y == 0.0f &&
|
||||
real_srcrect.w == (float)texture->w && real_srcrect.h == (float)texture->h));
|
||||
if (do_wrapping) {
|
||||
if (renderer->npot_texture_wrap_unsupported && (IsNPOT((int) real_srcrect.w) || IsNPOT((int) real_srcrect.h))) {
|
||||
if (do_wrapping && !renderer->npot_texture_wrap_unsupported) {
|
||||
if (renderer->npot_texture_wrap_unsupported && (IsNPOT(texture->w) || IsNPOT(texture->h))) {
|
||||
do_wrapping = false;
|
||||
}
|
||||
}
|
||||
@@ -5428,6 +5428,12 @@ bool SDL_SetRenderTextureAddressMode(SDL_Renderer *renderer, SDL_TextureAddressM
|
||||
{
|
||||
CHECK_RENDERER_MAGIC(renderer, false);
|
||||
|
||||
if ((u_mode == SDL_TEXTURE_ADDRESS_WRAP || v_mode == SDL_TEXTURE_ADDRESS_WRAP) &&
|
||||
renderer->npot_texture_wrap_unsupported) {
|
||||
// Technically it's supported on power of two textures, but we're assuming that non-power-of-two textures are going to be used.
|
||||
return SDL_SetError("SDL_TEXTURE_ADDRESS_WRAP not supported");
|
||||
}
|
||||
|
||||
renderer->texture_address_mode_u = u_mode;
|
||||
renderer->texture_address_mode_v = v_mode;
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user