diff --git a/src/swrenderer/drawers/r_draw_span32.h b/src/swrenderer/drawers/r_draw_span32.h index 02a616d46..dcd43312f 100644 --- a/src/swrenderer/drawers/r_draw_span32.h +++ b/src/swrenderer/drawers/r_draw_span32.h @@ -329,7 +329,7 @@ namespace swrenderer float Lyz2 = light_y; // L.y*L.y + L.z*L.z float Lx = light_x - viewpos_x; float dist2 = Lyz2 + Lx * Lx; - float rcp_dist = _mm_cvtss_f32(_mm_rsqrt_ss(_mm_set_ss(dist2))); + float rcp_dist = 1.f/sqrt(dist2); float dist = dist2 * rcp_dist; float distance_attenuation = 256.0f - MIN(dist * light_radius, 256.0f); diff --git a/src/swrenderer/drawers/r_draw_wall32.h b/src/swrenderer/drawers/r_draw_wall32.h index d3b4a7cc4..b39379528 100644 --- a/src/swrenderer/drawers/r_draw_wall32.h +++ b/src/swrenderer/drawers/r_draw_wall32.h @@ -249,7 +249,7 @@ namespace swrenderer float Lxy2 = light_x; // L.x*L.x + L.y*L.y float Lz = light_z - viewpos_z; float dist2 = Lxy2 + Lz * Lz; - float rcp_dist = _mm_cvtss_f32(_mm_rsqrt_ss(_mm_set_ss(dist2))); + float rcp_dist = 1.f/sqrt(dist2); float dist = dist2 * rcp_dist; float distance_attenuation = 256.0f - MIN(dist * light_radius, 256.0f);