use lroundf(x) instead of x + 0.5f
This commit is contained in:
parent
b2475c49a1
commit
7c8ce6267a
|
@ -1085,7 +1085,7 @@ u32 CalcAegSteps(float t)
|
|||
//44.1*ms = samples
|
||||
double scnt=44.1*t;
|
||||
double steps=aeg_allsteps/scnt;
|
||||
return (u32)(steps+0.5);
|
||||
return (u32)lroundf(steps);
|
||||
}
|
||||
void sgc_Init()
|
||||
{
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "hw/naomi/naomi_cart.h"
|
||||
#include "hw/pvr/spg.h"
|
||||
#include "input/gamepad.h"
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "deps/zlib/zlib.h"
|
||||
|
@ -1298,13 +1299,13 @@ struct maple_mouse : maple_base
|
|||
|
||||
static u16 mo_cvt(f32 delta)
|
||||
{
|
||||
delta+=0x200 + 0.5;
|
||||
if (delta<=0)
|
||||
delta=0;
|
||||
else if (delta>0x3FF)
|
||||
delta=0x3FF;
|
||||
delta += 0x200;
|
||||
if (delta <= 0)
|
||||
delta = 0;
|
||||
else if (delta > 0x3FF)
|
||||
delta = 0x3FF;
|
||||
|
||||
return (u16) delta;
|
||||
return (u16)lroundf(delta);
|
||||
}
|
||||
|
||||
virtual u32 dma(u32 cmd)
|
||||
|
|
|
@ -751,8 +751,8 @@ static bool RenderFrame()
|
|||
gl4ShaderUniforms.scale_coefs[2] = 1 - 2 * ds2s_offs_x / screen_width;
|
||||
gl4ShaderUniforms.scale_coefs[3] = -1;
|
||||
}
|
||||
rendering_width = screen_width * screen_scaling + 0.5f;
|
||||
rendering_height = screen_height * screen_scaling + 0.5f;
|
||||
rendering_width = (int)lroundf(screen_width * screen_scaling);
|
||||
rendering_height = (int)lroundf(screen_height * screen_scaling);
|
||||
}
|
||||
resize(rendering_width, rendering_height);
|
||||
|
||||
|
@ -859,9 +859,9 @@ static bool RenderFrame()
|
|||
|
||||
bool wide_screen_on = !is_rtt && settings.rend.WideScreen
|
||||
&& pvrrc.fb_X_CLIP.min == 0
|
||||
&& int((pvrrc.fb_X_CLIP.max + 1) / scale_x + 0.5f) == 640
|
||||
&& lroundf((pvrrc.fb_X_CLIP.max + 1) / scale_x) == 640L
|
||||
&& pvrrc.fb_Y_CLIP.min == 0
|
||||
&& int((pvrrc.fb_Y_CLIP.max + 1) / scale_y + 0.5f) == 480;
|
||||
&& lroundf((pvrrc.fb_Y_CLIP.max + 1) / scale_y) == 480L;
|
||||
|
||||
//Color is cleared by the background plane
|
||||
|
||||
|
@ -937,9 +937,9 @@ static bool RenderFrame()
|
|||
|
||||
glcache.ClearColor(0.f, 0.f, 0.f, 0.f);
|
||||
glcache.Enable(GL_SCISSOR_TEST);
|
||||
glScissor(0, 0, scaled_offs_x + 0.5f, rendering_height);
|
||||
glScissor(0, 0, (GLsizei)lroundf(scaled_offs_x), rendering_height);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glScissor(screen_width * screen_scaling - scaled_offs_x + 0.5f, 0, scaled_offs_x + 1.f, rendering_height);
|
||||
glScissor((GLint)lroundf(screen_width * screen_scaling - scaled_offs_x), 0, (GLsizei)lroundf(scaled_offs_x) + 1, rendering_height);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
}
|
||||
|
@ -951,7 +951,7 @@ static bool RenderFrame()
|
|||
height *= settings.rend.RenderToTextureUpscale;
|
||||
}
|
||||
|
||||
glScissor(min_x + 0.5f, min_y + 0.5f, width + 0.5f, height + 0.5f);
|
||||
glScissor((GLint)lroundf(min_x), (GLint)lroundf(min_y), (GLsizei)lroundf(width), (GLsizei)lroundf(height));
|
||||
glcache.Enable(GL_SCISSOR_TEST);
|
||||
}
|
||||
|
||||
|
@ -988,7 +988,7 @@ struct gl4rend : Renderer
|
|||
{
|
||||
screen_width=w;
|
||||
screen_height=h;
|
||||
resize(w * settings.rend.ScreenScaling / 100.f + 0.5f, h * settings.rend.ScreenScaling / 100.f + 0.5f);
|
||||
resize(lroundf(w * settings.rend.ScreenScaling / 100.f), lroundf(h * settings.rend.ScreenScaling / 100.f));
|
||||
}
|
||||
void Term()
|
||||
{
|
||||
|
|
|
@ -1931,7 +1931,7 @@ bool RenderFrame()
|
|||
{
|
||||
if (settings.rend.ScreenScaling != 100 || gl.swap_buffer_not_preserved)
|
||||
{
|
||||
init_output_framebuffer(screen_width * screen_scaling + 0.5f, screen_height * screen_scaling + 0.5f);
|
||||
init_output_framebuffer((int)lroundf(screen_width * screen_scaling), (int)lroundf(screen_height * screen_scaling));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1945,9 +1945,9 @@ bool RenderFrame()
|
|||
|
||||
bool wide_screen_on = !is_rtt && settings.rend.WideScreen
|
||||
&& pvrrc.fb_X_CLIP.min == 0
|
||||
&& int((pvrrc.fb_X_CLIP.max + 1) / scale_x + 0.5f) == 640
|
||||
&& lroundf((pvrrc.fb_X_CLIP.max + 1) / scale_x) == 640L
|
||||
&& pvrrc.fb_Y_CLIP.min == 0
|
||||
&& int((pvrrc.fb_Y_CLIP.max + 1) / scale_y + 0.5f) == 480;
|
||||
&& lroundf((pvrrc.fb_Y_CLIP.max + 1) / scale_y) == 480L;
|
||||
|
||||
//Color is cleared by the background plane
|
||||
|
||||
|
@ -2024,9 +2024,9 @@ bool RenderFrame()
|
|||
|
||||
glcache.ClearColor(0.f, 0.f, 0.f, 0.f);
|
||||
glcache.Enable(GL_SCISSOR_TEST);
|
||||
glScissor(0, 0, scaled_offs_x + 0.5f, screen_height * screen_scaling + 0.5f);
|
||||
glScissor(0, 0, (GLsizei)lroundf(scaled_offs_x), (GLsizei)lroundf(screen_height * screen_scaling));
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glScissor(screen_width * screen_scaling - scaled_offs_x + 0.5f, 0, scaled_offs_x + 1.f, screen_height * screen_scaling + 0.5f);
|
||||
glScissor((GLint)lroundf(screen_width * screen_scaling - scaled_offs_x), 0, (GLsizei)lroundf(scaled_offs_x) + 1, (GLsizei)lroundf(screen_height * screen_scaling));
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
}
|
||||
|
@ -2038,7 +2038,7 @@ bool RenderFrame()
|
|||
height *= settings.rend.RenderToTextureUpscale;
|
||||
}
|
||||
|
||||
glScissor(min_x + 0.5f, min_y + 0.5f, width + 0.5f, height + 0.5f);
|
||||
glScissor((GLint)lroundf(min_x), (GLint)lroundf(min_y), (GLsizei)lroundf(width), (GLsizei)lroundf(height));
|
||||
glcache.Enable(GL_SCISSOR_TEST);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue