Просмотр исходного кода

render: Skip UV check when software-rendering untextured quads

Fixes a crash when calling SDL_RenderGeometryRaw() with both `texture`
and `uv` set to `NULL`, and with geometry that is laid out in a way
that passes the quad checks.
nmlgc 3 дней назад
Родитель
Сommit
989de77f4f
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      src/render/SDL_render.c

+ 1 - 1
src/render/SDL_render.c

@@ -5163,7 +5163,7 @@ static bool SDLCALL SDL_SW_RenderGeometryRaw(SDL_Renderer *renderer,
         }
         }
 
 
         // Check if UVs within range
         // Check if UVs within range
-        if (is_quad) {
+        if (is_quad && uv) {
             const float *uv0_ = (const float *)((const char *)uv + A * color_stride);
             const float *uv0_ = (const float *)((const char *)uv + A * color_stride);
             const float *uv1_ = (const float *)((const char *)uv + B * color_stride);
             const float *uv1_ = (const float *)((const char *)uv + B * color_stride);
             const float *uv2_ = (const float *)((const char *)uv + C * color_stride);
             const float *uv2_ = (const float *)((const char *)uv + C * color_stride);