Fixed clamp texture address mode in software renderer

This commit is contained in:
Sam Lantinga
2025-07-21 10:03:49 -07:00
parent 55e14a2ced
commit 86200d1203
2 changed files with 30 additions and 50 deletions

View File

@@ -5001,6 +5001,22 @@ static bool SDLCALL SDL_SW_RenderGeometryRaw(SDL_Renderer *renderer,
}
}
// Check if UVs within range
if (is_quad) {
const float *uv0_ = (const float *)((const char *)uv + A * 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 *uv3_ = (const float *)((const char *)uv + C2 * color_stride);
if (uv0_[0] >= 0.0f && uv0_[0] <= 1.0f &&
uv1_[0] >= 0.0f && uv1_[0] <= 1.0f &&
uv2_[0] >= 0.0f && uv2_[0] <= 1.0f &&
uv3_[0] >= 0.0f && uv3_[0] <= 1.0f) {
// ok
} else {
is_quad = 0;
}
}
// Start rendering rect
if (is_quad) {
SDL_FRect s;