From 47c0c87c4735fafe943eaa0281d8229ca3c315da Mon Sep 17 00:00:00 2001 From: wwylele Date: Wed, 1 Nov 2017 11:47:39 +0200 Subject: [PATCH] video_core: clean format warnings --- src/video_core/regs_framebuffer.h | 6 +++--- .../renderer_opengl/gl_rasterizer.cpp | 3 ++- .../renderer_opengl/gl_shader_gen.cpp | 14 ++++++++------ src/video_core/renderer_opengl/pica_to_gl.h | 10 +++++----- .../shader/shader_jit_x64_compiler.cpp | 2 +- src/video_core/swrasterizer/framebuffer.cpp | 17 ++++++++++------- src/video_core/swrasterizer/lighting.cpp | 3 ++- src/video_core/swrasterizer/rasterizer.cpp | 2 +- 8 files changed, 32 insertions(+), 25 deletions(-) diff --git a/src/video_core/regs_framebuffer.h b/src/video_core/regs_framebuffer.h index 7b565f9111..8020faee8e 100644 --- a/src/video_core/regs_framebuffer.h +++ b/src/video_core/regs_framebuffer.h @@ -193,7 +193,7 @@ struct FramebufferRegs { case ColorFormat::RGBA4: return 2; default: - LOG_CRITICAL(HW_GPU, "Unknown color format %u", format); + LOG_CRITICAL(HW_GPU, "Unknown color format %u", static_cast(format)); UNIMPLEMENTED(); } } @@ -258,7 +258,7 @@ struct FramebufferRegs { return 4; } - ASSERT_MSG(false, "Unknown depth format %u", format); + ASSERT_MSG(false, "Unknown depth format %u", static_cast(format)); } // Returns the number of bits per depth component of the specified depth format @@ -271,7 +271,7 @@ struct FramebufferRegs { return 24; } - ASSERT_MSG(false, "Unknown depth format %u", format); + ASSERT_MSG(false, "Unknown depth format %u", static_cast(format)); } INSERT_PADDING_WORDS(0x20); diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 7e09e4712a..16f0726ad0 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -1338,7 +1338,8 @@ void RasterizerOpenGL::SyncCullMode() { break; default: - LOG_CRITICAL(Render_OpenGL, "Unknown cull mode %d", regs.rasterizer.cull_mode.Value()); + LOG_CRITICAL(Render_OpenGL, "Unknown cull mode %u", + static_cast(regs.rasterizer.cull_mode.Value())); UNIMPLEMENTED(); break; } diff --git a/src/video_core/renderer_opengl/gl_shader_gen.cpp b/src/video_core/renderer_opengl/gl_shader_gen.cpp index 9fe1839448..531247d2a1 100644 --- a/src/video_core/renderer_opengl/gl_shader_gen.cpp +++ b/src/video_core/renderer_opengl/gl_shader_gen.cpp @@ -265,7 +265,7 @@ static void AppendSource(std::string& out, const PicaShaderConfig& config, break; default: out += "vec4(0.0)"; - LOG_CRITICAL(Render_OpenGL, "Unknown source op %u", source); + LOG_CRITICAL(Render_OpenGL, "Unknown source op %u", static_cast(source)); break; } } @@ -323,7 +323,7 @@ static void AppendColorModifier(std::string& out, const PicaShaderConfig& config break; default: out += "vec3(0.0)"; - LOG_CRITICAL(Render_OpenGL, "Unknown color modifier op %u", modifier); + LOG_CRITICAL(Render_OpenGL, "Unknown color modifier op %u", static_cast(modifier)); break; } } @@ -372,7 +372,7 @@ static void AppendAlphaModifier(std::string& out, const PicaShaderConfig& config break; default: out += "0.0"; - LOG_CRITICAL(Render_OpenGL, "Unknown alpha modifier op %u", modifier); + LOG_CRITICAL(Render_OpenGL, "Unknown alpha modifier op %u", static_cast(modifier)); break; } } @@ -416,7 +416,8 @@ static void AppendColorCombiner(std::string& out, TevStageConfig::Operation oper break; default: out += "vec3(0.0)"; - LOG_CRITICAL(Render_OpenGL, "Unknown color combiner operation: %u", operation); + LOG_CRITICAL(Render_OpenGL, "Unknown color combiner operation: %u", + static_cast(operation)); break; } out += ", vec3(0.0), vec3(1.0))"; // Clamp result to 0.0, 1.0 @@ -456,7 +457,8 @@ static void AppendAlphaCombiner(std::string& out, TevStageConfig::Operation oper break; default: out += "0.0"; - LOG_CRITICAL(Render_OpenGL, "Unknown alpha combiner operation: %u", operation); + LOG_CRITICAL(Render_OpenGL, "Unknown alpha combiner operation: %u", + static_cast(operation)); break; } out += ", 0.0, 1.0)"; @@ -486,7 +488,7 @@ static void AppendAlphaTestCondition(std::string& out, FramebufferRegs::CompareF default: out += "false"; - LOG_CRITICAL(Render_OpenGL, "Unknown alpha test condition %u", func); + LOG_CRITICAL(Render_OpenGL, "Unknown alpha test condition %u", static_cast(func)); break; } } diff --git a/src/video_core/renderer_opengl/pica_to_gl.h b/src/video_core/renderer_opengl/pica_to_gl.h index c7fa1f873a..640c6ea51b 100644 --- a/src/video_core/renderer_opengl/pica_to_gl.h +++ b/src/video_core/renderer_opengl/pica_to_gl.h @@ -103,7 +103,7 @@ inline GLenum BlendEquation(Pica::FramebufferRegs::BlendEquation equation) { // Range check table for input if (static_cast(equation) >= ARRAY_SIZE(blend_equation_table)) { - LOG_CRITICAL(Render_OpenGL, "Unknown blend equation %d", equation); + LOG_CRITICAL(Render_OpenGL, "Unknown blend equation %u", static_cast(equation)); UNREACHABLE(); return GL_FUNC_ADD; @@ -133,7 +133,7 @@ inline GLenum BlendFunc(Pica::FramebufferRegs::BlendFactor factor) { // Range check table for input if (static_cast(factor) >= ARRAY_SIZE(blend_func_table)) { - LOG_CRITICAL(Render_OpenGL, "Unknown blend factor %d", factor); + LOG_CRITICAL(Render_OpenGL, "Unknown blend factor %u", static_cast(factor)); UNREACHABLE(); return GL_ONE; @@ -164,7 +164,7 @@ inline GLenum LogicOp(Pica::FramebufferRegs::LogicOp op) { // Range check table for input if (static_cast(op) >= ARRAY_SIZE(logic_op_table)) { - LOG_CRITICAL(Render_OpenGL, "Unknown logic op %d", op); + LOG_CRITICAL(Render_OpenGL, "Unknown logic op %u", static_cast(op)); UNREACHABLE(); return GL_COPY; @@ -187,7 +187,7 @@ inline GLenum CompareFunc(Pica::FramebufferRegs::CompareFunc func) { // Range check table for input if (static_cast(func) >= ARRAY_SIZE(compare_func_table)) { - LOG_CRITICAL(Render_OpenGL, "Unknown compare function %d", func); + LOG_CRITICAL(Render_OpenGL, "Unknown compare function %u", static_cast(func)); UNREACHABLE(); return GL_ALWAYS; @@ -210,7 +210,7 @@ inline GLenum StencilOp(Pica::FramebufferRegs::StencilAction action) { // Range check table for input if (static_cast(action) >= ARRAY_SIZE(stencil_op_table)) { - LOG_CRITICAL(Render_OpenGL, "Unknown stencil op %d", action); + LOG_CRITICAL(Render_OpenGL, "Unknown stencil op %u", static_cast(action)); UNREACHABLE(); return GL_KEEP; diff --git a/src/video_core/shader/shader_jit_x64_compiler.cpp b/src/video_core/shader/shader_jit_x64_compiler.cpp index 1b31623bd5..5a856dcaa6 100644 --- a/src/video_core/shader/shader_jit_x64_compiler.cpp +++ b/src/video_core/shader/shader_jit_x64_compiler.cpp @@ -853,7 +853,7 @@ void JitShader::Compile_NextInstr() { } else { // Unhandled instruction LOG_CRITICAL(HW_GPU, "Unhandled instruction: 0x%02x (0x%08x)", - instr.opcode.Value().EffectiveOpCode(), instr.hex); + static_cast(instr.opcode.Value().EffectiveOpCode()), instr.hex); } } diff --git a/src/video_core/swrasterizer/framebuffer.cpp b/src/video_core/swrasterizer/framebuffer.cpp index f34eab6cf9..fb41ce4f5e 100644 --- a/src/video_core/swrasterizer/framebuffer.cpp +++ b/src/video_core/swrasterizer/framebuffer.cpp @@ -58,7 +58,7 @@ void DrawPixel(int x, int y, const Math::Vec4& color) { default: LOG_CRITICAL(Render_Software, "Unknown framebuffer color format %x", - framebuffer.color_format.Value()); + static_cast(framebuffer.color_format.Value())); UNIMPLEMENTED(); } } @@ -94,7 +94,7 @@ const Math::Vec4 GetPixel(int x, int y) { default: LOG_CRITICAL(Render_Software, "Unknown framebuffer color format %x", - framebuffer.color_format.Value()); + static_cast(framebuffer.color_format.Value())); UNIMPLEMENTED(); } @@ -123,7 +123,8 @@ u32 GetDepth(int x, int y) { case FramebufferRegs::DepthFormat::D24S8: return Color::DecodeD24S8(src_pixel).x; default: - LOG_CRITICAL(HW_GPU, "Unimplemented depth format %u", framebuffer.depth_format); + LOG_CRITICAL(HW_GPU, "Unimplemented depth format %u", + static_cast(framebuffer.depth_format.Value())); UNIMPLEMENTED(); return 0; } @@ -151,7 +152,7 @@ u8 GetStencil(int x, int y) { LOG_WARNING( HW_GPU, "GetStencil called for function which doesn't have a stencil component (format %u)", - framebuffer.depth_format); + static_cast(framebuffer.depth_format.Value())); return 0; } } @@ -184,7 +185,8 @@ void SetDepth(int x, int y, u32 value) { break; default: - LOG_CRITICAL(HW_GPU, "Unimplemented depth format %u", framebuffer.depth_format); + LOG_CRITICAL(HW_GPU, "Unimplemented depth format %u", + static_cast(framebuffer.depth_format.Value())); UNIMPLEMENTED(); break; } @@ -215,7 +217,8 @@ void SetStencil(int x, int y, u8 value) { break; default: - LOG_CRITICAL(HW_GPU, "Unimplemented depth format %u", framebuffer.depth_format); + LOG_CRITICAL(HW_GPU, "Unimplemented depth format %u", + static_cast(framebuffer.depth_format.Value())); UNIMPLEMENTED(); break; } @@ -294,7 +297,7 @@ Math::Vec4 EvaluateBlendEquation(const Math::Vec4& src, const Math::Vec4 break; default: - LOG_CRITICAL(HW_GPU, "Unknown RGB blend equation %x", equation); + LOG_CRITICAL(HW_GPU, "Unknown RGB blend equation 0x%x", static_cast(equation)); UNIMPLEMENTED(); } diff --git a/src/video_core/swrasterizer/lighting.cpp b/src/video_core/swrasterizer/lighting.cpp index 5fa7486117..04f81ef400 100644 --- a/src/video_core/swrasterizer/lighting.cpp +++ b/src/video_core/swrasterizer/lighting.cpp @@ -43,7 +43,8 @@ std::tuple, Math::Vec4> ComputeFragmentsColors( surface_normal = Math::MakeVec(0.0f, 0.0f, 1.0f); surface_tangent = perturbation; } else { - LOG_ERROR(HW_GPU, "Unknown bump mode %u", lighting.config0.bump_mode.Value()); + LOG_ERROR(HW_GPU, "Unknown bump mode %u", + static_cast(lighting.config0.bump_mode.Value())); } } else { surface_normal = Math::MakeVec(0.0f, 0.0f, 1.0f); diff --git a/src/video_core/swrasterizer/rasterizer.cpp b/src/video_core/swrasterizer/rasterizer.cpp index 586587eb84..533ee6f01f 100644 --- a/src/video_core/swrasterizer/rasterizer.cpp +++ b/src/video_core/swrasterizer/rasterizer.cpp @@ -801,7 +801,7 @@ static void ProcessTriangleInternal(const Vertex& v0, const Vertex& v1, const Ve return std::min(combiner_output.a(), static_cast(255 - dest.a())); default: - LOG_CRITICAL(HW_GPU, "Unknown blend factor %x", factor); + LOG_CRITICAL(HW_GPU, "Unknown blend factor %x", static_cast(factor)); UNIMPLEMENTED(); break; }