mirror of https://github.com/PCSX2/pcsx2.git
gsdx: Prefix std:: to min and max
This commit is contained in:
parent
54c320c724
commit
0cde534e30
|
@ -140,8 +140,8 @@ void GSClut::Write(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT)
|
|||
{
|
||||
int size = TEX0.CPSM < PSM_PSMCT16 ? 512 : 256;
|
||||
|
||||
memcpy(m_clut + 512 + offset, m_clut + offset, sizeof(*m_clut) * min(size, 512 - offset));
|
||||
memcpy(m_clut, m_clut + 512, sizeof(*m_clut) * max(0, size + offset - 512));
|
||||
memcpy(m_clut + 512 + offset, m_clut + offset, sizeof(*m_clut) * std::min(size, 512 - offset));
|
||||
memcpy(m_clut, m_clut + 512, sizeof(*m_clut) * std::max(0, size + offset - 512));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -816,7 +816,7 @@ void GSLocalMemory::WriteImageTopBottom(int l, int r, int y, int h, const uint8*
|
|||
|
||||
if(y2 > 0)
|
||||
{
|
||||
int h2 = min(h, csy - y2);
|
||||
int h2 = std::min(h, csy - y2);
|
||||
|
||||
for(int x = l; x < r; x += bsx)
|
||||
{
|
||||
|
@ -969,7 +969,7 @@ void GSLocalMemory::WriteImage(int& tx, int& ty, const uint8* src, int len, GIFR
|
|||
|
||||
if(tx != l)
|
||||
{
|
||||
int n = min(len, (r - tx) * trbpp >> 3);
|
||||
int n = std::min(len, (r - tx) * trbpp >> 3);
|
||||
WriteImageX(tx, ty, src, n, BITBLTBUF, TRXPOS, TRXREG);
|
||||
src += n;
|
||||
len -= n;
|
||||
|
@ -1008,7 +1008,7 @@ void GSLocalMemory::WriteImage(int& tx, int& ty, const uint8* src, int len, GIFR
|
|||
// top part
|
||||
|
||||
{
|
||||
int h2 = min(h, bsy - (ty & (bsy - 1)));
|
||||
int h2 = std::min(h, bsy - (ty & (bsy - 1)));
|
||||
|
||||
if(h2 < bsy)
|
||||
{
|
||||
|
|
|
@ -123,7 +123,7 @@ bool GSDumpLzma::Read(void* ptr, size_t size) {
|
|||
Decompress();
|
||||
}
|
||||
|
||||
size_t l = min(size, m_avail);
|
||||
size_t l = std::min(size, m_avail);
|
||||
memcpy(dst + off, m_area+m_start, l);
|
||||
m_avail -= l;
|
||||
size -= l;
|
||||
|
|
|
@ -101,10 +101,10 @@ bool GSRenderer::Merge(int field)
|
|||
fr[i] = GetFrameRect(i);
|
||||
dr[i] = GetDisplayRect(i);
|
||||
|
||||
display_baseline.x = min(dr[i].left, display_baseline.x);
|
||||
display_baseline.y = min(dr[i].top, display_baseline.y);
|
||||
frame_baseline.x = min(fr[i].left, frame_baseline.x);
|
||||
frame_baseline.y = min(fr[i].top, frame_baseline.y);
|
||||
display_baseline.x = std::min(dr[i].left, display_baseline.x);
|
||||
display_baseline.y = std::min(dr[i].top, display_baseline.y);
|
||||
frame_baseline.x = std::min(fr[i].left, frame_baseline.x);
|
||||
frame_baseline.y = std::min(fr[i].top, frame_baseline.y);
|
||||
|
||||
//printf("[%d]: %d %d %d %d, %d %d %d %d\n", i, fr[i].x,fr[i].y,fr[i].z,fr[i].w , dr[i].x,dr[i].y,dr[i].z,dr[i].w);
|
||||
}
|
||||
|
@ -160,8 +160,8 @@ bool GSRenderer::Merge(int field)
|
|||
// dr[0] = 127 50 639 494
|
||||
// dr[1] = 127 50 639 494
|
||||
|
||||
int top = min(fr[0].top, fr[1].top);
|
||||
int bottom = min(fr[0].bottom, fr[1].bottom);
|
||||
int top = std::min(fr[0].top, fr[1].top);
|
||||
int bottom = std::min(fr[0].bottom, fr[1].bottom);
|
||||
|
||||
fr[0].top = fr[1].top = top;
|
||||
fr[0].bottom = fr[1].bottom = bottom;
|
||||
|
@ -237,8 +237,8 @@ bool GSRenderer::Merge(int field)
|
|||
|
||||
dst[i] = GSVector4(off).xyxy() + scale * GSVector4(r.rsize());
|
||||
|
||||
fs.x = max(fs.x, (int)(dst[i].z + 0.5f));
|
||||
fs.y = max(fs.y, (int)(dst[i].w + 0.5f));
|
||||
fs.x = std::max(fs.x, (int)(dst[i].z + 0.5f));
|
||||
fs.y = std::max(fs.y, (int)(dst[i].w + 0.5f));
|
||||
}
|
||||
|
||||
ds = fs;
|
||||
|
@ -542,7 +542,7 @@ bool GSRenderer::MakeSnapshot(const std::string& path)
|
|||
bool GSRenderer::BeginCapture()
|
||||
{
|
||||
GSVector4i disp = m_wnd->GetClientRect().fit(m_aspectratio);
|
||||
float aspect = (float)disp.width() / max(1, disp.height());
|
||||
float aspect = (float)disp.width() / std::max(1, disp.height());
|
||||
|
||||
return m_capture.BeginCapture(GetTvRefreshRate(), GetInternalResolution(), aspect);
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ void GSRendererHW::SetScaling()
|
|||
// Framebuffer width is always a multiple of 64 so at certain cases it can't cover some weird width values.
|
||||
// 480P , 576P use width as 720 which is not referencable by FBW * 64. so it produces 704 ( the closest value multiple by 64).
|
||||
// In such cases, let's just use the CRTC width.
|
||||
int fb_width = max({ (int)m_context->FRAME.FBW * 64, crtc_size.x , 512 });
|
||||
int fb_width = std::max({ (int)m_context->FRAME.FBW * 64, crtc_size.x , 512 });
|
||||
// GS doesn't have a specific register for the FrameBuffer height. so we get the height
|
||||
// from physical units of the display rectangle in case the game uses a heigher value of height.
|
||||
//
|
||||
|
@ -112,7 +112,7 @@ void GSRendererHW::SetScaling()
|
|||
//
|
||||
// Until performance issue is properly fixed, let's keep an option to reduce the framebuffer size.
|
||||
int fb_height = m_large_framebuffer ? 1280 :
|
||||
(fb_width < 1024) ? max(512, crtc_size.y) : 1024;
|
||||
(fb_width < 1024) ? std::max(512, crtc_size.y) : 1024;
|
||||
|
||||
int upscaled_fb_w = fb_width * m_upscale_multiplier;
|
||||
int upscaled_fb_h = fb_height * m_upscale_multiplier;
|
||||
|
|
|
@ -690,7 +690,7 @@ void GSHacksDlg::OnInit()
|
|||
SendMessage(GetDlgItem(m_hWnd, IDC_MSAACB), CB_ADDSTRING, 0, (LPARAM)text);
|
||||
}
|
||||
|
||||
SendMessage(GetDlgItem(m_hWnd, IDC_MSAACB), CB_SETCURSEL, msaa2cb[min(theApp.GetConfigI("UserHacks_MSAA"), 16)], 0);
|
||||
SendMessage(GetDlgItem(m_hWnd, IDC_MSAACB), CB_SETCURSEL, msaa2cb[std::min(theApp.GetConfigI("UserHacks_MSAA"), 16)], 0);
|
||||
|
||||
CheckDlgButton(m_hWnd, IDC_ALPHAHACK, theApp.GetConfigB("UserHacks_AlphaHack"));
|
||||
CheckDlgButton(m_hWnd, IDC_WILDHACK, theApp.GetConfigI("UserHacks_WildHack"));
|
||||
|
|
|
@ -2250,7 +2250,7 @@ template<int index> void GSState::Transfer(const uint8* mem, uint32 size)
|
|||
case GIF_FLG_IMAGE:
|
||||
|
||||
{
|
||||
int len = (int)min(size, path.nloop);
|
||||
int len = (int)std::min(size, path.nloop);
|
||||
|
||||
//ASSERT(!(len&3));
|
||||
|
||||
|
@ -2964,8 +2964,8 @@ void GSState::GetTextureMinMax(GSVector4i& r, const GIFRegTEX0& TEX0, const GIFR
|
|||
// This commented code cannot be used directly because it needs uv before the intersection
|
||||
/*if (uv_.x >> tw == uv_.z >> tw)
|
||||
{
|
||||
vr.x = max(vr.x, (uv_.x & ((1 << tw) - 1)));
|
||||
vr.z = min(vr.z, (uv_.z & ((1 << tw) - 1)) + 1);
|
||||
vr.x = std::max(vr.x, (uv_.x & ((1 << tw) - 1)));
|
||||
vr.z = std::min(vr.z, (uv_.z & ((1 << tw) - 1)) + 1);
|
||||
}*/
|
||||
if(mask & 0x000f) {if(vr.x < u.x) vr.x = u.x; if(vr.z > u.z + 1) vr.z = u.z + 1;}
|
||||
break;
|
||||
|
@ -3057,8 +3057,8 @@ void GSState::GetAlphaMinMax()
|
|||
a.w = env.TEXA.TA0;
|
||||
break;
|
||||
case 2:
|
||||
a.y = env.TEXA.AEM ? 0 : min(env.TEXA.TA0, env.TEXA.TA1);
|
||||
a.w = max(env.TEXA.TA0, env.TEXA.TA1);
|
||||
a.y = env.TEXA.AEM ? 0 : std::min(env.TEXA.TA0, env.TEXA.TA1);
|
||||
a.w = std::max(env.TEXA.TA0, env.TEXA.TA1);
|
||||
break;
|
||||
case 3:
|
||||
m_mem.m_clut.GetAlphaMinMax32(a.y, a.w);
|
||||
|
|
|
@ -97,8 +97,8 @@ bool GSTexture9::Update(const GSVector4i& r, const void* data, int pitch, int la
|
|||
default: ASSERT(m_desc.Format == D3DFMT_A8R8G8B8); break;
|
||||
}
|
||||
|
||||
bytes = min(bytes, pitch);
|
||||
bytes = min(bytes, lr.Pitch);
|
||||
bytes = std::min(bytes, pitch);
|
||||
bytes = std::min(bytes, lr.Pitch);
|
||||
|
||||
for(int i = 0, j = r.height(); i < j; i++, src += pitch, dst += lr.Pitch)
|
||||
{
|
||||
|
|
|
@ -1767,7 +1767,7 @@ void GSTextureCache::Source::Flush(uint32 count, int layer)
|
|||
|
||||
GSVector4i tr(0, 0, tw, th);
|
||||
|
||||
int pitch = max(tw, psm.bs.x) * sizeof(uint32);
|
||||
int pitch = std::max(tw, psm.bs.x) * sizeof(uint32);
|
||||
|
||||
GSLocalMemory& mem = m_renderer->m_mem;
|
||||
|
||||
|
@ -1852,12 +1852,12 @@ void GSTextureCache::Target::Update()
|
|||
GSVector2 t_scale = m_texture->GetScale();
|
||||
|
||||
//Avoids division by zero when calculating texture size.
|
||||
t_scale = GSVector2(max(1.0f, t_scale.x), max(1.0f, t_scale.y));
|
||||
t_scale = GSVector2(std::max(1.0f, t_scale.x), std::max(1.0f, t_scale.y));
|
||||
t_size.x = lround(static_cast<float>(t_size.x) / t_scale.x);
|
||||
t_size.y = lround(static_cast<float>(t_size.y) / t_scale.y);
|
||||
|
||||
// Don't load above the GS memory
|
||||
int max_y_blocks = (MAX_BLOCKS - m_TEX0.TBP0) / max(1u, m_TEX0.TBW);
|
||||
int max_y_blocks = (MAX_BLOCKS - m_TEX0.TBP0) / std::max(1u, m_TEX0.TBW);
|
||||
int max_y = (max_y_blocks >> 5) * GSLocalMemory::m_psm[m_TEX0.PSM].pgs.y;
|
||||
t_size.y = std::min(t_size.y, max_y);
|
||||
|
||||
|
|
|
@ -151,8 +151,8 @@ GSTextureOGL::GSTextureOGL(int type, int w, int h, int format, GLuint fbo_read,
|
|||
: m_pbo_size(0), m_clean(false), m_generate_mipmap(true), m_local_buffer(NULL), m_r_x(0), m_r_y(0), m_r_w(0), m_r_h(0), m_layer(0)
|
||||
{
|
||||
// OpenGL didn't like dimensions of size 0
|
||||
m_size.x = max(1,w);
|
||||
m_size.y = max(1,h);
|
||||
m_size.x = std::max(1,w);
|
||||
m_size.y = std::max(1,h);
|
||||
m_format = format;
|
||||
m_type = type;
|
||||
m_fbo_read = fbo_read;
|
||||
|
@ -245,7 +245,7 @@ GSTextureOGL::GSTextureOGL(int type, int w, int h, int format, GLuint fbo_read,
|
|||
}
|
||||
|
||||
// Only 32 bits input texture will be supported for mipmap
|
||||
m_max_layer = mipmap && (m_type == GSTexture::Texture) && m_format == GL_RGBA8 ? (int)log2(max(w,h)) : 1;
|
||||
m_max_layer = mipmap && (m_type == GSTexture::Texture) && m_format == GL_RGBA8 ? (int)log2(std::max(w,h)) : 1;
|
||||
|
||||
// Generate & Allocate the buffer
|
||||
switch (m_type) {
|
||||
|
|
|
@ -199,7 +199,7 @@ public:
|
|||
|
||||
#else
|
||||
|
||||
return GSVector4i(min(x, a.x), min(y, a.y), max(z, a.z), max(w, a.w));
|
||||
return GSVector4i(std::min(x, a.x), std::min(y, a.y), std::max(z, a.z), std::max(w, a.w));
|
||||
|
||||
#endif
|
||||
}
|
||||
|
@ -301,10 +301,10 @@ public:
|
|||
{
|
||||
GSVector4i v;
|
||||
|
||||
v.x = min(max(x, a.x), b.x);
|
||||
v.y = min(max(y, a.y), b.y);
|
||||
v.z = min(max(z, a.z), b.z);
|
||||
v.w = min(max(w, a.w), b.w);
|
||||
v.x = std::min(std::max(x, a.x), b.x);
|
||||
v.y = std::min(std::max(y, a.y), b.y);
|
||||
v.z = std::min(std::max(z, a.z), b.z);
|
||||
v.w = std::min(std::max(w, a.w), b.w);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
@ -313,10 +313,10 @@ public:
|
|||
{
|
||||
GSVector4i v;
|
||||
|
||||
v.x = min(max(x, a.x), a.z);
|
||||
v.y = min(max(y, a.y), a.w);
|
||||
v.z = min(max(z, a.x), a.z);
|
||||
v.w = min(max(w, a.y), a.w);
|
||||
v.x = std::min(std::max(x, a.x), a.z);
|
||||
v.y = std::min(std::max(y, a.y), a.w);
|
||||
v.z = std::min(std::max(z, a.x), a.z);
|
||||
v.w = std::min(std::max(w, a.y), a.w);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
|
|
@ -214,11 +214,11 @@ void GPULocalMemory::Invalidate(const GSVector4i& r)
|
|||
}
|
||||
}
|
||||
|
||||
for(int y = 0, ye = min(r.bottom, 512), j = 0; y < ye; y += 256, j++)
|
||||
for(int y = 0, ye = std::min(r.bottom, 512), j = 0; y < ye; y += 256, j++)
|
||||
{
|
||||
if(r.top >= y + 256) continue;
|
||||
|
||||
for(int x = 0, xe = min(r.right, 1024), i = 0; x < xe; x += 64, i++)
|
||||
for(int x = 0, xe = std::min(r.right, 1024), i = 0; x < xe; x += 64, i++)
|
||||
{
|
||||
uint32 flag = 1 << i;
|
||||
|
||||
|
|
|
@ -118,8 +118,8 @@ void GPURendererSW::Draw()
|
|||
|
||||
data->scissor.left = (int)m_env.DRAREATL.X << m_scale.x;
|
||||
data->scissor.top = (int)m_env.DRAREATL.Y << m_scale.y;
|
||||
data->scissor.right = min((int)(m_env.DRAREABR.X + 1) << m_scale.x, m_mem.GetWidth());
|
||||
data->scissor.bottom = min((int)(m_env.DRAREABR.Y + 1) << m_scale.y, m_mem.GetHeight());
|
||||
data->scissor.right = std::min((int)(m_env.DRAREABR.X + 1) << m_scale.x, m_mem.GetWidth());
|
||||
data->scissor.bottom = std::min((int)(m_env.DRAREABR.Y + 1) << m_scale.y, m_mem.GetHeight());
|
||||
|
||||
data->buff = (uint8*)_aligned_malloc(sizeof(GSVertexSW) * m_count, 32);
|
||||
data->vertex = (GSVertexSW*)data->buff;
|
||||
|
|
Loading…
Reference in New Issue