From 646a88139cd0222d73aa4a6e922a4d8be1f40e2c Mon Sep 17 00:00:00 2001 From: Sergey Lipskiy Date: Wed, 3 Feb 2016 22:36:41 +0600 Subject: [PATCH] Fixing FBInfo build on gcc (5.2.1) There was a conflict between signed and unsigned types to std::min. Explicitly setting the literal as unsigned keeps all math as unsigned, which I think is the best case here (assuming that 1 + y0 - y1 will never be negative). Also adding std:: prefix to make it clearer where these functions come from. --- src/F3DEX2.cpp | 1 + src/FrameBuffer.cpp | 5 +++-- src/OGL3X/GLSLCombiner_ogl3x.cpp | 1 + src/OpenGL.cpp | 1 + src/OpenGL.h | 1 + 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/F3DEX2.cpp b/src/F3DEX2.cpp index cf815a1c..35f8e8e2 100644 --- a/src/F3DEX2.cpp +++ b/src/F3DEX2.cpp @@ -1,3 +1,4 @@ +#include #include #include "GLideN64.h" #include "Debug.h" diff --git a/src/FrameBuffer.cpp b/src/FrameBuffer.cpp index 1162bcee..7f88fe67 100644 --- a/src/FrameBuffer.cpp +++ b/src/FrameBuffer.cpp @@ -1,3 +1,4 @@ +#include #include #include #include "OpenGL.h" @@ -1161,7 +1162,7 @@ void FrameBufferToRDRAM::_copy(u32 _startAddress, u32 _endAddress, bool _sync) const GLint x0 = 0; const GLint y0 = max_height - (_endAddress - m_pCurFrameBuffer->m_startAddress) / stride; const GLint y1 = max_height - (_startAddress - m_pCurFrameBuffer->m_startAddress) / stride; - const GLsizei height = min(max_height, 1 + y1 - y0); + const GLsizei height = std::min(max_height, 1u + y1 - y0); GLenum colorFormat, colorType, colorFormatBytes; if (m_pCurFrameBuffer->m_size > G_IM_SIZ_8b) { @@ -1410,7 +1411,7 @@ bool DepthBufferToRDRAM::_copy(u32 _startAddress, u32 _endAddress) const GLint x0 = 0; const GLint y0 = max_height - (_endAddress - m_pCurDepthBuffer->m_address) / stride; const GLint y1 = max_height - (_startAddress - m_pCurDepthBuffer->m_address) / stride; - const GLsizei height = min(max_height, 1 + y1 - y0); + const GLsizei height = std::min(max_height, 1u + y1 - y0); PBOBinder binder(GL_PIXEL_PACK_BUFFER, m_PBO); glBindFramebuffer(GL_READ_FRAMEBUFFER, m_FBO); diff --git a/src/OGL3X/GLSLCombiner_ogl3x.cpp b/src/OGL3X/GLSLCombiner_ogl3x.cpp index ef7b40c1..15a54289 100644 --- a/src/OGL3X/GLSLCombiner_ogl3x.cpp +++ b/src/OGL3X/GLSLCombiner_ogl3x.cpp @@ -1,3 +1,4 @@ +#include #include #include #include diff --git a/src/OpenGL.cpp b/src/OpenGL.cpp index 6b82712e..7746a1ca 100644 --- a/src/OpenGL.cpp +++ b/src/OpenGL.cpp @@ -1,3 +1,4 @@ +#include #include #include #include diff --git a/src/OpenGL.h b/src/OpenGL.h index e7b56529..2f0ddd20 100644 --- a/src/OpenGL.h +++ b/src/OpenGL.h @@ -4,6 +4,7 @@ #include #ifdef OS_WINDOWS +#define NOMINMAX #include #else #include "winlnxdefs.h"