From 396a8d91a4423d9c793eeff0798d544613647511 Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Sun, 18 Sep 2016 18:01:46 -0700 Subject: Manually tweak source formatting and then re-run clang-format --- src/video_core/clipper.cpp | 3 +- src/video_core/command_processor.cpp | 3 +- src/video_core/debug_utils/debug_utils.cpp | 37 ++++++++++--------- src/video_core/debug_utils/debug_utils.h | 6 ++-- src/video_core/gpu_debugger.h | 3 +- src/video_core/pica.h | 25 +++++++++---- src/video_core/primitive_assembly.cpp | 3 +- src/video_core/rasterizer.cpp | 42 +++++++++++----------- src/video_core/rasterizer_interface.h | 3 +- src/video_core/renderer_base.h | 3 +- src/video_core/renderer_opengl/gl_rasterizer.cpp | 10 +++--- src/video_core/renderer_opengl/gl_rasterizer.h | 9 ++--- .../renderer_opengl/gl_rasterizer_cache.cpp | 4 +-- .../renderer_opengl/gl_rasterizer_cache.h | 4 +-- src/video_core/renderer_opengl/gl_shader_gen.cpp | 4 +-- src/video_core/renderer_opengl/pica_to_gl.h | 16 +++++---- src/video_core/renderer_opengl/renderer_opengl.cpp | 32 +++++++---------- src/video_core/renderer_opengl/renderer_opengl.h | 7 ++-- src/video_core/shader/shader.cpp | 4 +-- src/video_core/shader/shader.h | 3 +- src/video_core/shader/shader_interpreter.cpp | 5 ++- src/video_core/shader/shader_jit_x64.cpp | 3 +- src/video_core/swrasterizer.h | 15 +++----- 23 files changed, 119 insertions(+), 125 deletions(-) (limited to 'src/video_core') diff --git a/src/video_core/clipper.cpp b/src/video_core/clipper.cpp index 747285866..82178d249 100644 --- a/src/video_core/clipper.cpp +++ b/src/video_core/clipper.cpp @@ -30,8 +30,7 @@ public: ClippingEdge(Math::Vec4 coeffs, Math::Vec4 bias = Math::Vec4( float24::FromFloat32(0), float24::FromFloat32(0), float24::FromFloat32(0), float24::FromFloat32(0))) - : coeffs(coeffs), bias(bias) { - } + : coeffs(coeffs), bias(bias) {} bool IsInside(const OutputVertex& vertex) const { return Math::Dot(vertex.pos + bias, coeffs) <= float24::FromFloat32(0); diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp index 415b5f74c..04a4ee3a2 100644 --- a/src/video_core/command_processor.cpp +++ b/src/video_core/command_processor.cpp @@ -44,7 +44,8 @@ static u32 default_attr_write_buffer[3]; // Expand a 4-bit mask to 4-byte mask, e.g. 0b0101 -> 0x00FF00FF static const u32 expand_bits_to_bytes[] = { 0x00000000, 0x000000ff, 0x0000ff00, 0x0000ffff, 0x00ff0000, 0x00ff00ff, 0x00ffff00, 0x00ffffff, - 0xff000000, 0xff0000ff, 0xff00ff00, 0xff00ffff, 0xffff0000, 0xffff00ff, 0xffffff00, 0xffffffff}; + 0xff000000, 0xff0000ff, 0xff00ff00, 0xff00ffff, 0xffff0000, 0xffff00ff, 0xffffff00, 0xffffffff, +}; MICROPROFILE_DEFINE(GPU_Drawing, "GPU", "Drawing", MP_RGB(50, 50, 240)); diff --git a/src/video_core/debug_utils/debug_utils.cpp b/src/video_core/debug_utils/debug_utils.cpp index 1cb868ead..194e5833c 100644 --- a/src/video_core/debug_utils/debug_utils.cpp +++ b/src/video_core/debug_utils/debug_utils.cpp @@ -155,7 +155,8 @@ void DumpShader(const std::string& filename, const Regs::ShaderConfig& config, {OutputAttributes::TEXCOORD2_V, {OutputRegisterInfo::TEXCOORD2, 2}}, {OutputAttributes::VIEW_X, {OutputRegisterInfo::VIEW, 1}}, {OutputAttributes::VIEW_Y, {OutputRegisterInfo::VIEW, 2}}, - {OutputAttributes::VIEW_Z, {OutputRegisterInfo::VIEW, 4}}}; + {OutputAttributes::VIEW_Z, {OutputRegisterInfo::VIEW, 4}}, + }; for (const auto& semantic : std::vector{ output_attributes[i].map_x, output_attributes[i].map_y, output_attributes[i].map_z, @@ -529,14 +530,16 @@ const Math::Vec4 LookupTexture(const u8* source, int x, int y, const Texture unsigned table_index = static_cast((x < 2) ? table_index_1.Value() : table_index_2.Value()); - static const std::array, 8> etc1_modifier_table = {{{{2, 8}}, - {{5, 17}}, - {{9, 29}}, - {{13, 42}}, - {{18, 60}}, - {{24, 80}}, - {{33, 106}}, - {{47, 183}}}}; + static const std::array, 8> etc1_modifier_table = {{ + {{2, 8}}, + {{5, 17}}, + {{9, 29}}, + {{13, 42}}, + {{18, 60}}, + {{24, 80}}, + {{33, 106}}, + {{47, 183}}, + }}; int modifier = etc1_modifier_table.at(table_index).at(GetTableSubIndex(texel)); if (GetNegationFlag(texel)) @@ -713,9 +716,9 @@ static std::string GetTevStageConfigSourceString(const Pica::Regs::TevStageConfi return src_it->second; } -static std::string -GetTevStageConfigColorSourceString(const Pica::Regs::TevStageConfig::Source& source, - const Pica::Regs::TevStageConfig::ColorModifier modifier) { +static std::string GetTevStageConfigColorSourceString( + const Pica::Regs::TevStageConfig::Source& source, + const Pica::Regs::TevStageConfig::ColorModifier modifier) { using ColorModifier = Pica::Regs::TevStageConfig::ColorModifier; static const std::map color_modifier_map = { {ColorModifier::SourceColor, "%source.rgb"}, @@ -739,9 +742,9 @@ GetTevStageConfigColorSourceString(const Pica::Regs::TevStageConfig::Source& sou return ReplacePattern(modifier_str, "%source", src_str); } -static std::string -GetTevStageConfigAlphaSourceString(const Pica::Regs::TevStageConfig::Source& source, - const Pica::Regs::TevStageConfig::AlphaModifier modifier) { +static std::string GetTevStageConfigAlphaSourceString( + const Pica::Regs::TevStageConfig::Source& source, + const Pica::Regs::TevStageConfig::AlphaModifier modifier) { using AlphaModifier = Pica::Regs::TevStageConfig::AlphaModifier; static const std::map alpha_modifier_map = { {AlphaModifier::SourceAlpha, "%source.a"}, @@ -763,8 +766,8 @@ GetTevStageConfigAlphaSourceString(const Pica::Regs::TevStageConfig::Source& sou return ReplacePattern(modifier_str, "%source", src_str); } -static std::string -GetTevStageConfigOperationString(const Pica::Regs::TevStageConfig::Operation& operation) { +static std::string GetTevStageConfigOperationString( + const Pica::Regs::TevStageConfig::Operation& operation) { using Operation = Pica::Regs::TevStageConfig::Operation; static const std::map combiner_map = { {Operation::Replace, "%source1"}, diff --git a/src/video_core/debug_utils/debug_utils.h b/src/video_core/debug_utils/debug_utils.h index 1a58f40ff..fe3ed247d 100644 --- a/src/video_core/debug_utils/debug_utils.h +++ b/src/video_core/debug_utils/debug_utils.h @@ -87,15 +87,13 @@ public: * @param data Optional data pointer (if unused, this is a nullptr) * @note This function will perform nothing unless it is overridden in the child class. */ - virtual void OnPicaBreakPointHit(Event, void*) { - } + virtual void OnPicaBreakPointHit(Event, void*) {} /** * Action to perform when emulation is resumed from a breakpoint. * @note This function will perform nothing unless it is overridden in the child class. */ - virtual void OnPicaResume() { - } + virtual void OnPicaResume() {} protected: /** diff --git a/src/video_core/gpu_debugger.h b/src/video_core/gpu_debugger.h index e3ba80d8f..aea391619 100644 --- a/src/video_core/gpu_debugger.h +++ b/src/video_core/gpu_debugger.h @@ -15,8 +15,7 @@ public: // Base class for all objects which need to be notified about GPU events class DebuggerObserver { public: - DebuggerObserver() : observed(nullptr) { - } + DebuggerObserver() : observed(nullptr) {} virtual ~DebuggerObserver() { if (observed) diff --git a/src/video_core/pica.h b/src/video_core/pica.h index 1d1a686e0..b2db609ec 100644 --- a/src/video_core/pica.h +++ b/src/video_core/pica.h @@ -176,7 +176,10 @@ struct Regs { MirroredRepeat = 3, }; - enum TextureFilter : u32 { Nearest = 0, Linear = 1 }; + enum TextureFilter : u32 { + Nearest = 0, + Linear = 1, + }; union { u32 raw; @@ -300,9 +303,11 @@ struct Regs { const TextureFormat format; }; const std::array GetTextures() const { - return {{{texture0_enable.ToBool(), texture0, texture0_format}, - {texture1_enable.ToBool(), texture1, texture1_format}, - {texture2_enable.ToBool(), texture2, texture2_format}}}; + return {{ + {texture0_enable.ToBool(), texture0, texture0_format}, + {texture1_enable.ToBool(), texture1, texture1_format}, + {texture2_enable.ToBool(), texture2, texture2_format}, + }}; } // 0xc0-0xff: Texture Combiner (akin to glTexEnv) @@ -523,7 +528,7 @@ struct Regs { Decrement = 4, Invert = 5, IncrementWrap = 6, - DecrementWrap = 7 + DecrementWrap = 7, }; struct { @@ -1173,7 +1178,10 @@ struct Regs { INSERT_PADDING_WORDS(0x07); - enum class GPUMode : u32 { Drawing = 0, Configuring = 1 }; + enum class GPUMode : u32 { + Drawing = 0, + Configuring = 1, + }; GPUMode gpu_mode; @@ -1249,7 +1257,10 @@ struct Regs { INSERT_PADDING_WORDS(0x2); struct { - enum Format : u32 { FLOAT24 = 0, FLOAT32 = 1 }; + enum Format : u32 { + FLOAT24 = 0, + FLOAT32 = 1, + }; bool IsFloat32() const { return format == FLOAT32; diff --git a/src/video_core/primitive_assembly.cpp b/src/video_core/primitive_assembly.cpp index 343edb191..901cca26b 100644 --- a/src/video_core/primitive_assembly.cpp +++ b/src/video_core/primitive_assembly.cpp @@ -12,8 +12,7 @@ namespace Pica { template PrimitiveAssembler::PrimitiveAssembler(Regs::TriangleTopology topology) - : topology(topology), buffer_index(0) { -} + : topology(topology), buffer_index(0) {} template void PrimitiveAssembler::SubmitVertex(VertexType& vtx, diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp index dbdc37ce6..f815d6cf0 100644 --- a/src/video_core/rasterizer.cpp +++ b/src/video_core/rasterizer.cpp @@ -268,10 +268,8 @@ static u8 PerformStencilAction(Regs::StencilAction action, u8 old_stencil, u8 re // NOTE: Assuming that rasterizer coordinates are 12.4 fixed-point values struct Fix12P4 { - Fix12P4() { - } - Fix12P4(u16 val) : val(val) { - } + Fix12P4() {} + Fix12P4(u16 val) : val(val) {} static u16 FracMask() { return 0xF; @@ -491,7 +489,8 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0, const Shader 255), (u8)( GetInterpolatedAttribute(v0.color.a(), v1.color.a(), v2.color.a()).ToFloat32() * - 255)}; + 255), + }; Math::Vec2 uv[3]; uv[0].u() = GetInterpolatedAttribute(v0.tc0.u(), v1.tc0.u(), v2.tc0.u()); @@ -604,7 +603,8 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0, const Shader Math::Vec4 combiner_buffer = {0, 0, 0, 0}; Math::Vec4 next_combiner_buffer = { regs.tev_combiner_buffer_color.r, regs.tev_combiner_buffer_color.g, - regs.tev_combiner_buffer_color.b, regs.tev_combiner_buffer_color.a}; + regs.tev_combiner_buffer_color.b, regs.tev_combiner_buffer_color.a, + }; for (unsigned tev_stage_index = 0; tev_stage_index < tev_stages.size(); ++tev_stage_index) { @@ -841,18 +841,16 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0, const Shader Math::Vec3 color_result[3] = { GetColorModifier(tev_stage.color_modifier1, GetSource(tev_stage.color_source1)), GetColorModifier(tev_stage.color_modifier2, GetSource(tev_stage.color_source2)), - GetColorModifier(tev_stage.color_modifier3, - GetSource(tev_stage.color_source3))}; + GetColorModifier(tev_stage.color_modifier3, GetSource(tev_stage.color_source3)), + }; auto color_output = ColorCombine(tev_stage.color_op, color_result); // alpha combiner - std::array alpha_result = { - {GetAlphaModifier(tev_stage.alpha_modifier1, - GetSource(tev_stage.alpha_source1)), - GetAlphaModifier(tev_stage.alpha_modifier2, - GetSource(tev_stage.alpha_source2)), - GetAlphaModifier(tev_stage.alpha_modifier3, - GetSource(tev_stage.alpha_source3))}}; + std::array alpha_result = {{ + GetAlphaModifier(tev_stage.alpha_modifier1, GetSource(tev_stage.alpha_source1)), + GetAlphaModifier(tev_stage.alpha_modifier2, GetSource(tev_stage.alpha_source2)), + GetAlphaModifier(tev_stage.alpha_modifier3, GetSource(tev_stage.alpha_source3)), + }}; auto alpha_output = AlphaCombine(tev_stage.alpha_op, alpha_result); combiner_output[0] = @@ -1083,7 +1081,8 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0, const Shader static_cast(output_merger.blend_const.r), static_cast(output_merger.blend_const.g), static_cast(output_merger.blend_const.b), - static_cast(output_merger.blend_const.a)}; + static_cast(output_merger.blend_const.a), + }; switch (factor) { case Regs::BlendFactor::Zero: @@ -1267,11 +1266,12 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0, const Shader LogicOp(combiner_output.a(), dest.a(), output_merger.logic_op)); } - const Math::Vec4 result = {output_merger.red_enable ? blend_output.r() : dest.r(), - output_merger.green_enable ? blend_output.g() : dest.g(), - output_merger.blue_enable ? blend_output.b() : dest.b(), - output_merger.alpha_enable ? blend_output.a() - : dest.a()}; + const Math::Vec4 result = { + output_merger.red_enable ? blend_output.r() : dest.r(), + output_merger.green_enable ? blend_output.g() : dest.g(), + output_merger.blue_enable ? blend_output.b() : dest.b(), + output_merger.alpha_enable ? blend_output.a() : dest.a(), + }; if (regs.framebuffer.allow_color_write != 0) DrawPixel(x >> 4, y >> 4, result); diff --git a/src/video_core/rasterizer_interface.h b/src/video_core/rasterizer_interface.h index ce834bd30..c7bd29f12 100644 --- a/src/video_core/rasterizer_interface.h +++ b/src/video_core/rasterizer_interface.h @@ -20,8 +20,7 @@ namespace VideoCore { class RasterizerInterface { public: - virtual ~RasterizerInterface() { - } + virtual ~RasterizerInterface() {} /// Queues the primitive formed by the given vertices for rendering virtual void AddTriangle(const Pica::Shader::OutputVertex& v0, diff --git a/src/video_core/renderer_base.h b/src/video_core/renderer_base.h index 22e2f9815..daacdb167 100644 --- a/src/video_core/renderer_base.h +++ b/src/video_core/renderer_base.h @@ -17,8 +17,7 @@ public: /// Used to reference a framebuffer enum kFramebuffer { kFramebuffer_VirtualXFB = 0, kFramebuffer_EFB, kFramebuffer_Texture }; - virtual ~RendererBase() { - } + virtual ~RendererBase() {} /// Swap buffers (render frame) virtual void SwapBuffers() = 0; diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 5021f48bc..37977464d 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -136,8 +136,7 @@ RasterizerOpenGL::RasterizerOpenGL() : shader_dirty(true) { SyncDepthWriteMask(); } -RasterizerOpenGL::~RasterizerOpenGL() { -} +RasterizerOpenGL::~RasterizerOpenGL() {} /** * This is a helper function to resolve an issue with opposite quaternions being interpolated by @@ -1156,9 +1155,10 @@ void RasterizerOpenGL::SyncBlendColor() { void RasterizerOpenGL::SyncFogColor() { const auto& regs = Pica::g_state.regs; - uniform_block_data.data.fog_color = {regs.fog_color.r.Value() / 255.0f, - regs.fog_color.g.Value() / 255.0f, - regs.fog_color.b.Value() / 255.0f}; + uniform_block_data.data.fog_color = { + regs.fog_color.r.Value() / 255.0f, regs.fog_color.g.Value() / 255.0f, + regs.fog_color.b.Value() / 255.0f, + }; uniform_block_data.dirty = true; } diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index 70e9e64ef..60d70539c 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h @@ -41,12 +41,9 @@ struct ScreenInfo; * two separate shaders sharing the same key. * * We use a union because "implicitly-defined copy/move constructor for a union X copies the object - * representation of X." - * and "implicitly-defined copy assignment operator for a union X copies the object representation - * (3.9) of X." - * = Bytewise copy instead of memberwise copy. - * This is important because the padding bytes are included in the hash and comparison between - * objects. + * representation of X." and "implicitly-defined copy assignment operator for a union X copies the + * object representation (3.9) of X." = Bytewise copy instead of memberwise copy. This is important + * because the padding bytes are included in the hash and comparison between objects. */ union PicaShaderConfig { diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 8f1477bcd..ec3300ca6 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp @@ -522,8 +522,8 @@ CachedSurface* RasterizerCacheOpenGL::GetSurfaceRect(const CachedSurface& params return GetSurface(params, match_res_scale, load_if_create); } -CachedSurface* -RasterizerCacheOpenGL::GetTextureSurface(const Pica::Regs::FullTextureConfig& config) { +CachedSurface* RasterizerCacheOpenGL::GetTextureSurface( + const Pica::Regs::FullTextureConfig& config) { Pica::DebugUtils::TextureInfo info = Pica::DebugUtils::TextureInfo::FromPicaRegister(config.config, config.format); diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index db5b649da..b2272bda8 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h @@ -212,8 +212,8 @@ public: /// Gets the color and depth surfaces and rect (resolution scaled) based on the framebuffer /// configuration - std::tuple> - GetFramebufferSurfaces(const Pica::Regs::FramebufferConfig& config); + std::tuple> GetFramebufferSurfaces( + const Pica::Regs::FramebufferConfig& config); /// Attempt to get a surface that exactly matches the fill region and format CachedSurface* TryGetFillSurface(const GPU::Regs::MemoryFillConfig& config); diff --git a/src/video_core/renderer_opengl/gl_shader_gen.cpp b/src/video_core/renderer_opengl/gl_shader_gen.cpp index f86cffee5..9392c67b8 100644 --- a/src/video_core/renderer_opengl/gl_shader_gen.cpp +++ b/src/video_core/renderer_opengl/gl_shader_gen.cpp @@ -293,9 +293,7 @@ static void AppendAlphaTestCondition(std::string& out, Regs::CompareFunc func) { case CompareFunc::LessThanOrEqual: case CompareFunc::GreaterThan: case CompareFunc::GreaterThanOrEqual: { - static const char* op[] = { - "!=", "==", ">=", ">", "<=", "<", - }; + static const char* op[] = {"!=", "==", ">=", ">", "<=", "<"}; unsigned index = (unsigned)func - (unsigned)CompareFunc::Equal; out += "int(last_tex_env_out.a * 255.0f) " + std::string(op[index]) + " alphatest_ref"; break; diff --git a/src/video_core/renderer_opengl/pica_to_gl.h b/src/video_core/renderer_opengl/pica_to_gl.h index a604e94d4..415358b6c 100644 --- a/src/video_core/renderer_opengl/pica_to_gl.h +++ b/src/video_core/renderer_opengl/pica_to_gl.h @@ -26,7 +26,7 @@ namespace PicaToGL { inline GLenum TextureFilterMode(Pica::Regs::TextureConfig::TextureFilter mode) { static const GLenum filter_mode_table[] = { GL_NEAREST, // TextureFilter::Nearest - GL_LINEAR // TextureFilter::Linear + GL_LINEAR, // TextureFilter::Linear }; // Range check table for input @@ -55,7 +55,7 @@ inline GLenum WrapMode(Pica::Regs::TextureConfig::WrapMode mode) { GL_CLAMP_TO_EDGE, // WrapMode::ClampToEdge GL_CLAMP_TO_BORDER, // WrapMode::ClampToBorder GL_REPEAT, // WrapMode::Repeat - GL_MIRRORED_REPEAT // WrapMode::MirroredRepeat + GL_MIRRORED_REPEAT, // WrapMode::MirroredRepeat }; // Range check table for input @@ -192,7 +192,7 @@ inline GLenum StencilOp(Pica::Regs::StencilAction action) { GL_DECR, // StencilAction::Decrement GL_INVERT, // StencilAction::Invert GL_INCR_WRAP, // StencilAction::IncrementWrap - GL_DECR_WRAP // StencilAction::DecrementWrap + GL_DECR_WRAP, // StencilAction::DecrementWrap }; // Range check table for input @@ -207,12 +207,16 @@ inline GLenum StencilOp(Pica::Regs::StencilAction action) { } inline GLvec4 ColorRGBA8(const u32 color) { - return {{(color >> 0 & 0xFF) / 255.0f, (color >> 8 & 0xFF) / 255.0f, - (color >> 16 & 0xFF) / 255.0f, (color >> 24 & 0xFF) / 255.0f}}; + return {{ + (color >> 0 & 0xFF) / 255.0f, (color >> 8 & 0xFF) / 255.0f, (color >> 16 & 0xFF) / 255.0f, + (color >> 24 & 0xFF) / 255.0f, + }}; } inline std::array LightColor(const Pica::Regs::LightColor& color) { - return {{color.r / 255.0f, color.g / 255.0f, color.b / 255.0f}}; + return {{ + color.r / 255.0f, color.g / 255.0f, color.b / 255.0f, + }}; } } // namespace diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index 3cabda8f9..a1d08e04d 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp @@ -87,15 +87,13 @@ struct ScreenRectVertex { * by a 3x2 matrix. */ static std::array MakeOrthographicMatrix(const float width, const float height) { - std::array matrix; - - matrix[0] = 2.f / width; - matrix[2] = 0.f; - matrix[4] = -1.f; - matrix[1] = 0.f; - matrix[3] = -2.f / height; - matrix[5] = 1.f; + std::array matrix; // Laid out in column-major order + + // clang-format off + matrix[0] = 2.f / width; matrix[2] = 0.f; matrix[4] = -1.f; + matrix[1] = 0.f; matrix[3] = -2.f / height; matrix[5] = 1.f; // Last matrix row is implicitly assumed to be [0, 0, 1]. + // clang-format on return matrix; } @@ -107,8 +105,7 @@ RendererOpenGL::RendererOpenGL() { } /// RendererOpenGL destructor -RendererOpenGL::~RendererOpenGL() { -} +RendererOpenGL::~RendererOpenGL() {} /// Swap buffers (render frame) void RendererOpenGL::SwapBuffers() { @@ -215,8 +212,7 @@ void RendererOpenGL::LoadFBToScreenInfo(const GPU::Regs::FramebufferConfig& fram // Update existing texture // TODO: Test what happens on hardware when you change the framebuffer dimensions so that - // they - // differ from the LCD resolution. + // they differ from the LCD resolution. // TODO: Applications could theoretically crash Citra here by specifying too large // framebuffer sizes. We should make sure that this cannot happen. glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, framebuffer.width, framebuffer.height, @@ -231,10 +227,8 @@ void RendererOpenGL::LoadFBToScreenInfo(const GPU::Regs::FramebufferConfig& fram } /** - * Fills active OpenGL texture with the given RGB color. - * Since the color is solid, the texture can be 1x1 but will stretch across whatever it's rendered - * on. - * This has the added benefit of being *really fast*. + * Fills active OpenGL texture with the given RGB color. Since the color is solid, the texture can + * be 1x1 but will stretch across whatever it's rendered on. */ void RendererOpenGL::LoadColorToActiveGLTexture(u8 color_r, u8 color_g, u8 color_b, const TextureInfo& texture) { @@ -424,8 +418,7 @@ void RendererOpenGL::DrawScreens() { } /// Updates the framerate -void RendererOpenGL::UpdateFramerate() { -} +void RendererOpenGL::UpdateFramerate() {} /** * Set the emulator window to use for renderer @@ -513,5 +506,4 @@ bool RendererOpenGL::Init() { } /// Shutdown the renderer -void RendererOpenGL::ShutDown() { -} +void RendererOpenGL::ShutDown() {} diff --git a/src/video_core/renderer_opengl/renderer_opengl.h b/src/video_core/renderer_opengl/renderer_opengl.h index faeb519ec..762b790c1 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.h +++ b/src/video_core/renderer_opengl/renderer_opengl.h @@ -81,11 +81,14 @@ private: OGLVertexArray vertex_array; OGLBuffer vertex_buffer; OGLShader shader; - std::array - screen_infos; ///< Display information for top and bottom screens respectively + + /// Display information for top and bottom screens respectively + std::array screen_infos; + // Shader uniform location indices GLuint uniform_modelview_matrix; GLuint uniform_color_texture; + // Shader attribute input indices GLuint attrib_position; GLuint attrib_tex_coord; diff --git a/src/video_core/shader/shader.cpp b/src/video_core/shader/shader.cpp index 852c5a9a0..c38bdcc3c 100644 --- a/src/video_core/shader/shader.cpp +++ b/src/video_core/shader/shader.cpp @@ -96,8 +96,8 @@ void ShaderSetup::Setup() { #ifdef ARCHITECTURE_x86_64 if (VideoCore::g_shader_jit_enabled) { u64 cache_key = - (Common::ComputeHash64(&g_state.vs.program_code, sizeof(g_state.vs.program_code)) ^ - Common::ComputeHash64(&g_state.vs.swizzle_data, sizeof(g_state.vs.swizzle_data))); + Common::ComputeHash64(&g_state.vs.program_code, sizeof(g_state.vs.program_code)) ^ + Common::ComputeHash64(&g_state.vs.swizzle_data, sizeof(g_state.vs.swizzle_data)); auto iter = shader_map.find(cache_key); if (iter != shader_map.end()) { diff --git a/src/video_core/shader/shader.h b/src/video_core/shader/shader.h index 830d933a8..79c716b6e 100644 --- a/src/video_core/shader/shader.h +++ b/src/video_core/shader/shader.h @@ -358,8 +358,7 @@ struct ShaderSetup { /** * Performs any shader unit setup that only needs to happen once per shader (as opposed to once - * per - * vertex, which would happen within the `Run` function). + * per vertex, which would happen within the `Run` function). */ void Setup(); diff --git a/src/video_core/shader/shader_interpreter.cpp b/src/video_core/shader/shader_interpreter.cpp index 681ff9728..41df8a2fd 100644 --- a/src/video_core/shader/shader_interpreter.cpp +++ b/src/video_core/shader/shader_interpreter.cpp @@ -80,9 +80,8 @@ void RunInterpreter(const ShaderSetup& setup, UnitState& state, unsigned auto call = [&program_counter, &call_stack](UnitState& state, u32 offset, u32 num_instructions, u32 return_offset, u8 repeat_count, u8 loop_increment) { - program_counter = - offset - - 1; // -1 to make sure when incrementing the PC we end up at the correct offset + // -1 to make sure when incrementing the PC we end up at the correct offset + program_counter = offset - 1; ASSERT(call_stack.size() < call_stack.capacity()); call_stack.push_back( {offset + num_instructions, return_offset, repeat_count, loop_increment, offset}); diff --git a/src/video_core/shader/shader_jit_x64.cpp b/src/video_core/shader/shader_jit_x64.cpp index 04e04ba1a..d1b2ce8d5 100644 --- a/src/video_core/shader/shader_jit_x64.cpp +++ b/src/video_core/shader/shader_jit_x64.cpp @@ -590,8 +590,7 @@ void JitShader::Compile_RSQ(Instruction instr) { Compile_DestEnable(instr, SRC1); } -void JitShader::Compile_NOP(Instruction instr) { -} +void JitShader::Compile_NOP(Instruction instr) {} void JitShader::Compile_END(Instruction instr) { ABI_PopRegistersAndAdjustStack(ABI_ALL_CALLEE_SAVED, 8); diff --git a/src/video_core/swrasterizer.h b/src/video_core/swrasterizer.h index bca9780e5..12dc56bef 100644 --- a/src/video_core/swrasterizer.h +++ b/src/video_core/swrasterizer.h @@ -19,15 +19,10 @@ namespace VideoCore { class SWRasterizer : public RasterizerInterface { void AddTriangle(const Pica::Shader::OutputVertex& v0, const Pica::Shader::OutputVertex& v1, const Pica::Shader::OutputVertex& v2) override; - void DrawTriangles() override { - } - void NotifyPicaRegisterChanged(u32 id) override { - } - void FlushAll() override { - } - void FlushRegion(PAddr addr, u32 size) override { - } - void FlushAndInvalidateRegion(PAddr addr, u32 size) override { - } + void DrawTriangles() override {} + void NotifyPicaRegisterChanged(u32 id) override {} + void FlushAll() override {} + void FlushRegion(PAddr addr, u32 size) override {} + void FlushAndInvalidateRegion(PAddr addr, u32 size) override {} }; } -- cgit v1.2.3