msvc: resolve all warnings in VideoBackends/OGL.

This commit is contained in:
Shawn Hoffman 2014-08-19 20:18:02 -07:00
parent fd16065979
commit 5471c71819
4 changed files with 35 additions and 18 deletions

View file

@ -282,7 +282,7 @@ std::string OpenGLPostProcessing::LoadShaderOptions(const std::string& code)
} }
else if (it.second.m_type == PostProcessingShaderConfiguration::ConfigurationOption::OptionType::OPTION_INTEGER) else if (it.second.m_type == PostProcessingShaderConfiguration::ConfigurationOption::OptionType::OPTION_INTEGER)
{ {
u32 count = it.second.m_integer_values.size(); u32 count = static_cast<u32>(it.second.m_integer_values.size());
if (count == 1) if (count == 1)
glsl_options += StringFromFormat("uniform int option_%s;\n", it.first.c_str()); glsl_options += StringFromFormat("uniform int option_%s;\n", it.first.c_str());
else else
@ -290,7 +290,7 @@ std::string OpenGLPostProcessing::LoadShaderOptions(const std::string& code)
} }
else if (it.second.m_type == PostProcessingShaderConfiguration::ConfigurationOption::OptionType::OPTION_FLOAT) else if (it.second.m_type == PostProcessingShaderConfiguration::ConfigurationOption::OptionType::OPTION_FLOAT)
{ {
u32 count = it.second.m_float_values.size(); u32 count = static_cast<u32>(it.second.m_float_values.size());
if (count == 1) if (count == 1)
glsl_options += StringFromFormat("uniform float option_%s;\n", it.first.c_str()); glsl_options += StringFromFormat("uniform float option_%s;\n", it.first.c_str());
else else

View file

@ -144,7 +144,8 @@ static void ApplySSAASettings()
if (g_ogl_config.bSupportSampleShading) if (g_ogl_config.bSupportSampleShading)
{ {
glEnable(GL_SAMPLE_SHADING_ARB); glEnable(GL_SAMPLE_SHADING_ARB);
glMinSampleShadingARB(s_MSAASamples); GLfloat min_sample_shading_value = static_cast<GLfloat>(s_MSAASamples);
glMinSampleShadingARB(min_sample_shading_value);
} }
else else
{ {
@ -718,7 +719,7 @@ void Renderer::DrawDebugInfo()
glLineWidth(3.0f); glLineWidth(3.0f);
// 2*Coords + 3*Color // 2*Coords + 3*Color
u32 length = stats.efb_regions.size() * sizeof(GLfloat) * (2+3)*2*6; GLsizeiptr length = stats.efb_regions.size() * sizeof(GLfloat) * (2 + 3) * 2 * 6;
glBindBuffer(GL_ARRAY_BUFFER, s_ShowEFBCopyRegions_VBO); glBindBuffer(GL_ARRAY_BUFFER, s_ShowEFBCopyRegions_VBO);
glBufferData(GL_ARRAY_BUFFER, length, nullptr, GL_STREAM_DRAW); glBufferData(GL_ARRAY_BUFFER, length, nullptr, GL_STREAM_DRAW);
GLfloat *Vertices = (GLfloat*)glMapBufferRange(GL_ARRAY_BUFFER, 0, length, GL_MAP_WRITE_BIT); GLfloat *Vertices = (GLfloat*)glMapBufferRange(GL_ARRAY_BUFFER, 0, length, GL_MAP_WRITE_BIT);
@ -823,7 +824,8 @@ void Renderer::DrawDebugInfo()
s_ShowEFBCopyRegions.Bind(); s_ShowEFBCopyRegions.Bind();
glBindVertexArray(s_ShowEFBCopyRegions_VAO); glBindVertexArray(s_ShowEFBCopyRegions_VAO);
glDrawArrays(GL_LINES, 0, stats.efb_regions.size() * 2*6); GLsizei count = static_cast<GLsizei>(stats.efb_regions.size() * 2*6);
glDrawArrays(GL_LINES, 0, count);
// Restore Line Size // Restore Line Size
SetLineWidth(); SetLineWidth();
@ -1180,7 +1182,11 @@ void Renderer::SetViewport()
} }
else else
{ {
glViewport(ceil(X), ceil(Y), ceil(Width), ceil(Height)); auto iceilf = [](float f)
{
return static_cast<GLint>(ceilf(f));
};
glViewport(iceilf(X), iceilf(Y), iceilf(Width), iceilf(Height));
} }
glDepthRangef(GLNear, GLFar); glDepthRangef(GLNear, GLFar);
} }
@ -1405,10 +1411,10 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangl
if (g_ActiveConfig.bUseRealXFB) if (g_ActiveConfig.bUseRealXFB)
{ {
drawRc.top = flipped_trc.top; drawRc.top = static_cast<float>(flipped_trc.top);
drawRc.bottom = flipped_trc.bottom; drawRc.bottom = static_cast<float>(flipped_trc.bottom);
drawRc.left = flipped_trc.left; drawRc.left = static_cast<float>(flipped_trc.left);
drawRc.right = flipped_trc.right; drawRc.right = static_cast<float>(flipped_trc.right);
} }
else else
{ {
@ -1417,10 +1423,17 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangl
int xfbWidth = xfbSource->srcWidth; int xfbWidth = xfbSource->srcWidth;
int hOffset = ((s32)xfbSource->srcAddr - (s32)xfbAddr) / ((s32)fbWidth * 2); int hOffset = ((s32)xfbSource->srcAddr - (s32)xfbAddr) / ((s32)fbWidth * 2);
drawRc.top = flipped_trc.top - hOffset * flipped_trc.GetHeight() / fbHeight; MathUtil::Rectangle<u32> rect_u32;
drawRc.bottom = flipped_trc.top - (hOffset + xfbHeight) * flipped_trc.GetHeight() / fbHeight;
drawRc.left = flipped_trc.left + (flipped_trc.GetWidth() - xfbWidth * flipped_trc.GetWidth() / fbWidth)/2; rect_u32.top = flipped_trc.top - hOffset * flipped_trc.GetHeight() / fbHeight;
drawRc.right = flipped_trc.left + (flipped_trc.GetWidth() + xfbWidth * flipped_trc.GetWidth() / fbWidth)/2; rect_u32.bottom = flipped_trc.top - (hOffset + xfbHeight) * flipped_trc.GetHeight() / fbHeight;
rect_u32.left = flipped_trc.left + (flipped_trc.GetWidth() - xfbWidth * flipped_trc.GetWidth() / fbWidth)/2;
rect_u32.right = flipped_trc.left + (flipped_trc.GetWidth() + xfbWidth * flipped_trc.GetWidth() / fbWidth)/2;
drawRc.top = static_cast<float>(rect_u32.top);
drawRc.bottom = static_cast<float>(rect_u32.bottom);
drawRc.left = static_cast<float>(rect_u32.left);
drawRc.right = static_cast<float>(rect_u32.right);
// The following code disables auto stretch. Kept for reference. // The following code disables auto stretch. Kept for reference.
// scale draw area for a 1 to 1 pixel mapping with the draw target // scale draw area for a 1 to 1 pixel mapping with the draw target

View file

@ -274,12 +274,14 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
glViewport(0, 0, virtual_width, virtual_height); glViewport(0, 0, virtual_width, virtual_height);
GLuint uniform_location;
if (srcFormat == PEControl::Z24) if (srcFormat == PEControl::Z24)
{ {
s_DepthMatrixProgram.Bind(); s_DepthMatrixProgram.Bind();
if (s_DepthCbufid != cbufid) if (s_DepthCbufid != cbufid)
glUniform4fv(s_DepthMatrixUniform, 5, colmat); glUniform4fv(s_DepthMatrixUniform, 5, colmat);
s_DepthCbufid = cbufid; s_DepthCbufid = cbufid;
uniform_location = s_DepthCopyPositionUniform;
} }
else else
{ {
@ -287,11 +289,12 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
if (s_ColorCbufid != cbufid) if (s_ColorCbufid != cbufid)
glUniform4fv(s_ColorMatrixUniform, 7, colmat); glUniform4fv(s_ColorMatrixUniform, 7, colmat);
s_ColorCbufid = cbufid; s_ColorCbufid = cbufid;
uniform_location = s_ColorCopyPositionUniform;
} }
TargetRectangle R = g_renderer->ConvertEFBRectangle(srcRect); TargetRectangle R = g_renderer->ConvertEFBRectangle(srcRect);
glUniform4f(srcFormat == PEControl::Z24 ? s_DepthCopyPositionUniform : s_ColorCopyPositionUniform, glUniform4f(uniform_location, static_cast<float>(R.left), static_cast<float>(R.top),
R.left, R.top, R.right, R.bottom); static_cast<float>(R.right), static_cast<float>(R.bottom));
GL_REPORT_ERRORD(); GL_REPORT_ERRORD();
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

View file

@ -345,7 +345,8 @@ void EncodeToRamYUYV(GLuint srcTexture, const TargetRectangle& sourceRc, u8* des
s_rgbToYuyvProgram.Bind(); s_rgbToYuyvProgram.Bind();
glUniform4f(s_rgbToYuyvUniform_loc, sourceRc.left, sourceRc.top, sourceRc.right, sourceRc.bottom); glUniform4f(s_rgbToYuyvUniform_loc, static_cast<float>(sourceRc.left), static_cast<float>(sourceRc.top),
static_cast<float>(sourceRc.right), static_cast<float>(sourceRc.bottom));
// We enable linear filtering, because the gamecube does filtering in the vertical direction when // We enable linear filtering, because the gamecube does filtering in the vertical direction when
// yscale is enabled. // yscale is enabled.