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/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 +++-- 8 files changed, 40 insertions(+), 46 deletions(-) (limited to 'src/video_core/renderer_opengl') 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; -- cgit v1.2.3