From e1a4912ade550c7071c9334d7882fce596e2ad06 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 26 Feb 2019 22:47:49 -0500 Subject: [PATCH] common/math_util: Move contents into the Common namespace These types are within the common library, so they should be within the Common namespace. --- src/common/math_util.h | 4 +- src/core/frontend/framebuffer_layout.cpp | 43 ++++++++--------- src/core/frontend/framebuffer_layout.h | 4 +- src/input_common/motion_emu.cpp | 4 +- src/input_common/udp/client.cpp | 6 ++- .../renderer_opengl/gl_rasterizer.cpp | 24 +++++----- .../renderer_opengl/gl_rasterizer_cache.cpp | 48 +++++++++---------- .../renderer_opengl/gl_rasterizer_cache.h | 28 +++++------ .../renderer_opengl/renderer_opengl.cpp | 2 +- .../renderer_opengl/renderer_opengl.h | 2 +- src/video_core/shader/debug_data.h | 3 +- 11 files changed, 85 insertions(+), 83 deletions(-) diff --git a/src/common/math_util.h b/src/common/math_util.h index 94b4394c5..cff3d48c5 100644 --- a/src/common/math_util.h +++ b/src/common/math_util.h @@ -7,7 +7,7 @@ #include #include -namespace MathUtil { +namespace Common { constexpr float PI = 3.14159265f; @@ -41,4 +41,4 @@ struct Rectangle { } }; -} // namespace MathUtil +} // namespace Common diff --git a/src/core/frontend/framebuffer_layout.cpp b/src/core/frontend/framebuffer_layout.cpp index 8456e1300..e90fd3819 100644 --- a/src/core/frontend/framebuffer_layout.cpp +++ b/src/core/frontend/framebuffer_layout.cpp @@ -22,12 +22,12 @@ u16 FramebufferLayout::GetScalingRatio() const { // Finds the largest size subrectangle contained in window area that is confined to the aspect ratio template -static MathUtil::Rectangle maxRectangle(MathUtil::Rectangle window_area, - float screen_aspect_ratio) { +static Common::Rectangle maxRectangle(Common::Rectangle window_area, + float screen_aspect_ratio) { float scale = std::min(static_cast(window_area.GetWidth()), window_area.GetHeight() / screen_aspect_ratio); - return MathUtil::Rectangle{0, 0, static_cast(std::round(scale)), - static_cast(std::round(scale * screen_aspect_ratio))}; + return Common::Rectangle{0, 0, static_cast(std::round(scale)), + static_cast(std::round(scale * screen_aspect_ratio))}; } FramebufferLayout DefaultFrameLayout(unsigned width, unsigned height, bool swapped) { @@ -36,10 +36,10 @@ FramebufferLayout DefaultFrameLayout(unsigned width, unsigned height, bool swapp FramebufferLayout res{width, height, true, true, {}, {}}; // Default layout gives equal screen sizes to the top and bottom screen - MathUtil::Rectangle screen_window_area{0, 0, width, height / 2}; - MathUtil::Rectangle top_screen = + Common::Rectangle screen_window_area{0, 0, width, height / 2}; + Common::Rectangle top_screen = maxRectangle(screen_window_area, TOP_SCREEN_ASPECT_RATIO); - MathUtil::Rectangle bot_screen = + Common::Rectangle bot_screen = maxRectangle(screen_window_area, BOT_SCREEN_ASPECT_RATIO); float window_aspect_ratio = static_cast(height) / width; @@ -77,10 +77,10 @@ FramebufferLayout SingleFrameLayout(unsigned width, unsigned height, bool swappe // so just calculate them both even if the other isn't showing. FramebufferLayout res{width, height, !swapped, swapped, {}, {}}; - MathUtil::Rectangle screen_window_area{0, 0, width, height}; - MathUtil::Rectangle top_screen = + Common::Rectangle screen_window_area{0, 0, width, height}; + Common::Rectangle top_screen = maxRectangle(screen_window_area, TOP_SCREEN_ASPECT_RATIO); - MathUtil::Rectangle bot_screen = + Common::Rectangle bot_screen = maxRectangle(screen_window_area, BOT_SCREEN_ASPECT_RATIO); float window_aspect_ratio = static_cast(height) / width; @@ -116,13 +116,12 @@ FramebufferLayout LargeFrameLayout(unsigned width, unsigned height, bool swapped float large_screen_aspect_ratio = swapped ? BOT_SCREEN_ASPECT_RATIO : TOP_SCREEN_ASPECT_RATIO; float small_screen_aspect_ratio = swapped ? TOP_SCREEN_ASPECT_RATIO : BOT_SCREEN_ASPECT_RATIO; - MathUtil::Rectangle screen_window_area{0, 0, width, height}; - MathUtil::Rectangle total_rect = + Common::Rectangle screen_window_area{0, 0, width, height}; + Common::Rectangle total_rect = maxRectangle(screen_window_area, emulation_aspect_ratio); - MathUtil::Rectangle large_screen = - maxRectangle(total_rect, large_screen_aspect_ratio); - MathUtil::Rectangle fourth_size_rect = total_rect.Scale(.25f); - MathUtil::Rectangle small_screen = + Common::Rectangle large_screen = maxRectangle(total_rect, large_screen_aspect_ratio); + Common::Rectangle fourth_size_rect = total_rect.Scale(.25f); + Common::Rectangle small_screen = maxRectangle(fourth_size_rect, small_screen_aspect_ratio); if (window_aspect_ratio < emulation_aspect_ratio) { @@ -149,13 +148,13 @@ FramebufferLayout SideFrameLayout(unsigned width, unsigned height, bool swapped) const float emulation_aspect_ratio = static_cast(Core::kScreenTopHeight) / (Core::kScreenTopWidth + Core::kScreenBottomWidth); float window_aspect_ratio = static_cast(height) / width; - MathUtil::Rectangle screen_window_area{0, 0, width, height}; + Common::Rectangle screen_window_area{0, 0, width, height}; // Find largest Rectangle that can fit in the window size with the given aspect ratio - MathUtil::Rectangle screen_rect = + Common::Rectangle screen_rect = maxRectangle(screen_window_area, emulation_aspect_ratio); // Find sizes of top and bottom screen - MathUtil::Rectangle top_screen = maxRectangle(screen_rect, TOP_SCREEN_ASPECT_RATIO); - MathUtil::Rectangle bot_screen = maxRectangle(screen_rect, BOT_SCREEN_ASPECT_RATIO); + Common::Rectangle top_screen = maxRectangle(screen_rect, TOP_SCREEN_ASPECT_RATIO); + Common::Rectangle bot_screen = maxRectangle(screen_rect, BOT_SCREEN_ASPECT_RATIO); if (window_aspect_ratio < emulation_aspect_ratio) { // Apply borders to the left and right sides of the window. @@ -180,10 +179,10 @@ FramebufferLayout CustomFrameLayout(unsigned width, unsigned height) { FramebufferLayout res{width, height, true, true, {}, {}}; - MathUtil::Rectangle top_screen{ + Common::Rectangle top_screen{ Settings::values.custom_top_left, Settings::values.custom_top_top, Settings::values.custom_top_right, Settings::values.custom_top_bottom}; - MathUtil::Rectangle bot_screen{ + Common::Rectangle bot_screen{ Settings::values.custom_bottom_left, Settings::values.custom_bottom_top, Settings::values.custom_bottom_right, Settings::values.custom_bottom_bottom}; diff --git a/src/core/frontend/framebuffer_layout.h b/src/core/frontend/framebuffer_layout.h index 3eb9d468c..fae0ddb0a 100644 --- a/src/core/frontend/framebuffer_layout.h +++ b/src/core/frontend/framebuffer_layout.h @@ -14,8 +14,8 @@ struct FramebufferLayout { unsigned height; bool top_screen_enabled; bool bottom_screen_enabled; - MathUtil::Rectangle top_screen; - MathUtil::Rectangle bottom_screen; + Common::Rectangle top_screen; + Common::Rectangle bottom_screen; /** * Returns the ration of pixel size of the top screen, compared to the native size of the 3DS diff --git a/src/input_common/motion_emu.cpp b/src/input_common/motion_emu.cpp index ed7042847..424a10e75 100644 --- a/src/input_common/motion_emu.cpp +++ b/src/input_common/motion_emu.cpp @@ -46,7 +46,7 @@ public: } else { tilt_direction = mouse_move.Cast(); tilt_angle = std::clamp(tilt_direction.Normalize() * sensitivity, 0.0f, - MathUtil::PI * this->tilt_clamp / 180.0f); + Common::PI * this->tilt_clamp / 180.0f); } } } @@ -109,7 +109,7 @@ private: // Find the angular rate vector in world space auto angular_rate = ((q - old_q) * inv_q).xyz * 2; - angular_rate *= 1000 / update_millisecond / MathUtil::PI * 180; + angular_rate *= 1000 / update_millisecond / Common::PI * 180; // Transform the two vectors from world space to 3DS space gravity = QuaternionRotate(inv_q, gravity); diff --git a/src/input_common/udp/client.cpp b/src/input_common/udp/client.cpp index 0675f5c4a..61249ab77 100644 --- a/src/input_common/udp/client.cpp +++ b/src/input_common/udp/client.cpp @@ -217,7 +217,8 @@ void TestCommunication(const std::string& host, u16 port, u8 pad_index, u32 clie success_callback(); else failure_callback(); - }).detach(); + }) + .detach(); } CalibrationConfigurationJob::CalibrationConfigurationJob( @@ -268,7 +269,8 @@ CalibrationConfigurationJob::CalibrationConfigurationJob( complete_event.Wait(); socket.Stop(); worker_thread.join(); - }).detach(); + }) + .detach(); } CalibrationConfigurationJob::~CalibrationConfigurationJob() { diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 0fc5a5580..923f2efd3 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -522,7 +522,7 @@ bool RasterizerOpenGL::Draw(bool accelerate, bool is_indexed) { (write_depth_fb || regs.framebuffer.output_merger.depth_test_enable != 0 || (has_stencil && state.stencil.test_enabled)); - MathUtil::Rectangle viewport_rect_unscaled{ + Common::Rectangle viewport_rect_unscaled{ // These registers hold half-width and half-height, so must be multiplied by 2 regs.rasterizer.viewport_corner.x, // left regs.rasterizer.viewport_corner.y + // top @@ -536,7 +536,7 @@ bool RasterizerOpenGL::Draw(bool accelerate, bool is_indexed) { Surface color_surface; Surface depth_surface; - MathUtil::Rectangle surfaces_rect; + Common::Rectangle surfaces_rect; std::tie(color_surface, depth_surface, surfaces_rect) = res_cache.GetFramebufferSurfaces(using_color_fb, using_depth_fb, viewport_rect_unscaled); @@ -544,7 +544,7 @@ bool RasterizerOpenGL::Draw(bool accelerate, bool is_indexed) { ? color_surface->res_scale : (depth_surface == nullptr ? 1u : depth_surface->res_scale); - MathUtil::Rectangle draw_rect{ + Common::Rectangle draw_rect{ static_cast(std::clamp(static_cast(surfaces_rect.left) + viewport_rect_unscaled.left * res_scale, surfaces_rect.left, surfaces_rect.right)), // Left @@ -841,9 +841,9 @@ bool RasterizerOpenGL::Draw(bool accelerate, bool is_indexed) { } // Mark framebuffer surfaces as dirty - MathUtil::Rectangle draw_rect_unscaled{ - draw_rect.left / res_scale, draw_rect.top / res_scale, draw_rect.right / res_scale, - draw_rect.bottom / res_scale}; + Common::Rectangle draw_rect_unscaled{draw_rect.left / res_scale, draw_rect.top / res_scale, + draw_rect.right / res_scale, + draw_rect.bottom / res_scale}; if (color_surface != nullptr && write_color_fb) { auto interval = color_surface->GetSubRectInterval(draw_rect_unscaled); @@ -1392,7 +1392,7 @@ bool RasterizerOpenGL::AccelerateDisplayTransfer(const GPU::Regs::DisplayTransfe dst_params.pixel_format = SurfaceParams::PixelFormatFromGPUPixelFormat(config.output_format); dst_params.UpdateParams(); - MathUtil::Rectangle src_rect; + Common::Rectangle src_rect; Surface src_surface; std::tie(src_surface, src_rect) = res_cache.GetSurfaceSubRect(src_params, ScaleMatch::Ignore, true); @@ -1401,7 +1401,7 @@ bool RasterizerOpenGL::AccelerateDisplayTransfer(const GPU::Regs::DisplayTransfe dst_params.res_scale = src_surface->res_scale; - MathUtil::Rectangle dst_rect; + Common::Rectangle dst_rect; Surface dst_surface; std::tie(dst_surface, dst_rect) = res_cache.GetSurfaceSubRect(dst_params, ScaleMatch::Upscale, false); @@ -1461,7 +1461,7 @@ bool RasterizerOpenGL::AccelerateTextureCopy(const GPU::Regs::DisplayTransferCon src_params.size = ((src_params.height - 1) * src_params.stride) + src_params.width; src_params.end = src_params.addr + src_params.size; - MathUtil::Rectangle src_rect; + Common::Rectangle src_rect; Surface src_surface; std::tie(src_surface, src_rect) = res_cache.GetTexCopySurface(src_params); if (src_surface == nullptr) { @@ -1486,7 +1486,7 @@ bool RasterizerOpenGL::AccelerateTextureCopy(const GPU::Regs::DisplayTransferCon // Since we are going to invalidate the gap if there is one, we will have to load it first const bool load_gap = output_gap != 0; - MathUtil::Rectangle dst_rect; + Common::Rectangle dst_rect; Surface dst_surface; std::tie(dst_surface, dst_rect) = res_cache.GetSurfaceSubRect(dst_params, ScaleMatch::Upscale, load_gap); @@ -1532,7 +1532,7 @@ bool RasterizerOpenGL::AccelerateDisplay(const GPU::Regs::FramebufferConfig& con src_params.pixel_format = SurfaceParams::PixelFormatFromGPUPixelFormat(config.color_format); src_params.UpdateParams(); - MathUtil::Rectangle src_rect; + Common::Rectangle src_rect; Surface src_surface; std::tie(src_surface, src_rect) = res_cache.GetSurfaceSubRect(src_params, ScaleMatch::Ignore, true); @@ -1544,7 +1544,7 @@ bool RasterizerOpenGL::AccelerateDisplay(const GPU::Regs::FramebufferConfig& con u32 scaled_width = src_surface->GetScaledWidth(); u32 scaled_height = src_surface->GetScaledHeight(); - screen_info.display_texcoords = MathUtil::Rectangle( + screen_info.display_texcoords = Common::Rectangle( (float)src_rect.bottom / (float)scaled_height, (float)src_rect.left / (float)scaled_width, (float)src_rect.top / (float)scaled_height, (float)src_rect.right / (float)scaled_width); diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 2d082d8dd..44dd2e78f 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp @@ -347,8 +347,8 @@ static void AllocateTextureCube(GLuint texture, const FormatTuple& format_tuple, cur_state.Apply(); } -static bool BlitTextures(GLuint src_tex, const MathUtil::Rectangle& src_rect, GLuint dst_tex, - const MathUtil::Rectangle& dst_rect, SurfaceType type, +static bool BlitTextures(GLuint src_tex, const Common::Rectangle& src_rect, GLuint dst_tex, + const Common::Rectangle& dst_rect, SurfaceType type, GLuint read_fb_handle, GLuint draw_fb_handle) { OpenGLState prev_state = OpenGLState::GetCurState(); SCOPE_EXIT({ prev_state.Apply(); }); @@ -407,7 +407,7 @@ static bool BlitTextures(GLuint src_tex, const MathUtil::Rectangle& src_rec } static bool FillSurface(const Surface& surface, const u8* fill_data, - const MathUtil::Rectangle& fill_rect, GLuint draw_fb_handle) { + const Common::Rectangle& fill_rect, GLuint draw_fb_handle) { OpenGLState prev_state = OpenGLState::GetCurState(); SCOPE_EXIT({ prev_state.Apply(); }); @@ -511,7 +511,7 @@ SurfaceParams SurfaceParams::FromInterval(SurfaceInterval interval) const { return params; } -SurfaceInterval SurfaceParams::GetSubRectInterval(MathUtil::Rectangle unscaled_rect) const { +SurfaceInterval SurfaceParams::GetSubRectInterval(Common::Rectangle unscaled_rect) const { if (unscaled_rect.GetHeight() == 0 || unscaled_rect.GetWidth() == 0) { return {}; } @@ -534,24 +534,24 @@ SurfaceInterval SurfaceParams::GetSubRectInterval(MathUtil::Rectangle unsca return {addr + BytesInPixels(pixel_offset), addr + BytesInPixels(pixel_offset + pixels)}; } -MathUtil::Rectangle SurfaceParams::GetSubRect(const SurfaceParams& sub_surface) const { +Common::Rectangle SurfaceParams::GetSubRect(const SurfaceParams& sub_surface) const { const u32 begin_pixel_index = PixelsInBytes(sub_surface.addr - addr); if (is_tiled) { const int x0 = (begin_pixel_index % (stride * 8)) / 8; const int y0 = (begin_pixel_index / (stride * 8)) * 8; // Top to bottom - return MathUtil::Rectangle(x0, height - y0, x0 + sub_surface.width, - height - (y0 + sub_surface.height)); + return Common::Rectangle(x0, height - y0, x0 + sub_surface.width, + height - (y0 + sub_surface.height)); } const int x0 = begin_pixel_index % stride; const int y0 = begin_pixel_index / stride; // Bottom to top - return MathUtil::Rectangle(x0, y0 + sub_surface.height, x0 + sub_surface.width, y0); + return Common::Rectangle(x0, y0 + sub_surface.height, x0 + sub_surface.width, y0); } -MathUtil::Rectangle SurfaceParams::GetScaledSubRect(const SurfaceParams& sub_surface) const { +Common::Rectangle SurfaceParams::GetScaledSubRect(const SurfaceParams& sub_surface) const { auto rect = GetSubRect(sub_surface); rect.left = rect.left * res_scale; rect.right = rect.right * res_scale; @@ -819,7 +819,7 @@ void CachedSurface::FlushGLBuffer(PAddr flush_start, PAddr flush_end) { } MICROPROFILE_DEFINE(OpenGL_TextureUL, "OpenGL", "Texture Upload", MP_RGB(128, 192, 64)); -void CachedSurface::UploadGLTexture(const MathUtil::Rectangle& rect, GLuint read_fb_handle, +void CachedSurface::UploadGLTexture(const Common::Rectangle& rect, GLuint read_fb_handle, GLuint draw_fb_handle) { if (type == SurfaceType::Fill) return; @@ -883,7 +883,7 @@ void CachedSurface::UploadGLTexture(const MathUtil::Rectangle& rect, GLuint } MICROPROFILE_DEFINE(OpenGL_TextureDL, "OpenGL", "Texture Download", MP_RGB(128, 192, 64)); -void CachedSurface::DownloadGLTexture(const MathUtil::Rectangle& rect, GLuint read_fb_handle, +void CachedSurface::DownloadGLTexture(const Common::Rectangle& rect, GLuint read_fb_handle, GLuint draw_fb_handle) { if (type == SurfaceType::Fill) return; @@ -918,7 +918,7 @@ void CachedSurface::DownloadGLTexture(const MathUtil::Rectangle& rect, GLui OGLTexture unscaled_tex; unscaled_tex.Create(); - MathUtil::Rectangle unscaled_tex_rect{0, rect.GetHeight(), rect.GetWidth(), 0}; + Common::Rectangle unscaled_tex_rect{0, rect.GetHeight(), rect.GetWidth(), 0}; AllocateSurfaceTexture(unscaled_tex.handle, tuple, rect.GetWidth(), rect.GetHeight()); BlitTextures(texture.handle, scaled_rect, unscaled_tex.handle, unscaled_tex_rect, type, read_fb_handle, draw_fb_handle); @@ -1122,9 +1122,9 @@ RasterizerCacheOpenGL::~RasterizerCacheOpenGL() { MICROPROFILE_DEFINE(OpenGL_BlitSurface, "OpenGL", "BlitSurface", MP_RGB(128, 192, 64)); bool RasterizerCacheOpenGL::BlitSurfaces(const Surface& src_surface, - const MathUtil::Rectangle& src_rect, + const Common::Rectangle& src_rect, const Surface& dst_surface, - const MathUtil::Rectangle& dst_rect) { + const Common::Rectangle& dst_rect) { MICROPROFILE_SCOPE(OpenGL_BlitSurface); if (!SurfaceParams::CheckFormatsBlittable(src_surface->pixel_format, dst_surface->pixel_format)) @@ -1138,9 +1138,9 @@ bool RasterizerCacheOpenGL::BlitSurfaces(const Surface& src_surface, } void RasterizerCacheOpenGL::ConvertD24S8toABGR(GLuint src_tex, - const MathUtil::Rectangle& src_rect, + const Common::Rectangle& src_rect, GLuint dst_tex, - const MathUtil::Rectangle& dst_rect) { + const Common::Rectangle& dst_rect) { OpenGLState prev_state = OpenGLState::GetCurState(); SCOPE_EXIT({ prev_state.Apply(); }); @@ -1247,7 +1247,7 @@ SurfaceRect_Tuple RasterizerCacheOpenGL::GetSurfaceSubRect(const SurfaceParams& ScaleMatch match_res_scale, bool load_if_create) { if (params.addr == 0 || params.height * params.width == 0) { - return std::make_tuple(nullptr, MathUtil::Rectangle{}); + return std::make_tuple(nullptr, Common::Rectangle{}); } // Attempt to find encompassing surface @@ -1340,7 +1340,7 @@ Surface RasterizerCacheOpenGL::GetTextureSurface(const Pica::Texture::TextureInf if (info.width % 8 != 0 || info.height % 8 != 0) { Surface src_surface; - MathUtil::Rectangle rect; + Common::Rectangle rect; std::tie(src_surface, rect) = GetSurfaceSubRect(params, ScaleMatch::Ignore, true); params.res_scale = src_surface->res_scale; @@ -1447,7 +1447,7 @@ const CachedTextureCube& RasterizerCacheOpenGL::GetTextureCube(const TextureCube } SurfaceSurfaceRect_Tuple RasterizerCacheOpenGL::GetFramebufferSurfaces( - bool using_color_fb, bool using_depth_fb, const MathUtil::Rectangle& viewport_rect) { + bool using_color_fb, bool using_depth_fb, const Common::Rectangle& viewport_rect) { const auto& regs = Pica::g_state.regs; const auto& config = regs.framebuffer.framebuffer; @@ -1461,7 +1461,7 @@ SurfaceSurfaceRect_Tuple RasterizerCacheOpenGL::GetFramebufferSurfaces( texture_cube_cache.clear(); } - MathUtil::Rectangle viewport_clamped{ + Common::Rectangle viewport_clamped{ static_cast(std::clamp(viewport_rect.left, 0, static_cast(config.GetWidth()))), static_cast(std::clamp(viewport_rect.top, 0, static_cast(config.GetHeight()))), static_cast(std::clamp(viewport_rect.right, 0, static_cast(config.GetWidth()))), @@ -1495,19 +1495,19 @@ SurfaceSurfaceRect_Tuple RasterizerCacheOpenGL::GetFramebufferSurfaces( using_depth_fb = false; } - MathUtil::Rectangle color_rect{}; + Common::Rectangle color_rect{}; Surface color_surface = nullptr; if (using_color_fb) std::tie(color_surface, color_rect) = GetSurfaceSubRect(color_params, ScaleMatch::Exact, false); - MathUtil::Rectangle depth_rect{}; + Common::Rectangle depth_rect{}; Surface depth_surface = nullptr; if (using_depth_fb) std::tie(depth_surface, depth_rect) = GetSurfaceSubRect(depth_params, ScaleMatch::Exact, false); - MathUtil::Rectangle fb_rect{}; + Common::Rectangle fb_rect{}; if (color_surface != nullptr && depth_surface != nullptr) { fb_rect = color_rect; // Color and Depth surfaces must have the same dimensions and offsets @@ -1560,7 +1560,7 @@ Surface RasterizerCacheOpenGL::GetFillSurface(const GPU::Regs::MemoryFillConfig& } SurfaceRect_Tuple RasterizerCacheOpenGL::GetTexCopySurface(const SurfaceParams& params) { - MathUtil::Rectangle rect{}; + Common::Rectangle rect{}; Surface match_surface = FindMatch( surface_cache, params, ScaleMatch::Ignore); diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index 85bfcd76b..555e9078b 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h @@ -88,8 +88,8 @@ static_assert(std::is_same(), "incorrect interval types"); -using SurfaceRect_Tuple = std::tuple>; -using SurfaceSurfaceRect_Tuple = std::tuple>; +using SurfaceRect_Tuple = std::tuple>; +using SurfaceSurfaceRect_Tuple = std::tuple>; using PageMap = boost::icl::interval_map; @@ -250,7 +250,7 @@ struct SurfaceParams { // Returns the outer rectangle containing "interval" SurfaceParams FromInterval(SurfaceInterval interval) const; - SurfaceInterval GetSubRectInterval(MathUtil::Rectangle unscaled_rect) const; + SurfaceInterval GetSubRectInterval(Common::Rectangle unscaled_rect) const; // Returns the region of the biggest valid rectange within interval SurfaceInterval GetCopyableInterval(const Surface& src_surface) const; @@ -263,11 +263,11 @@ struct SurfaceParams { return height * res_scale; } - MathUtil::Rectangle GetRect() const { + Common::Rectangle GetRect() const { return {0, height, width, 0}; } - MathUtil::Rectangle GetScaledRect() const { + Common::Rectangle GetScaledRect() const { return {0, GetScaledHeight(), GetScaledWidth(), 0}; } @@ -284,8 +284,8 @@ struct SurfaceParams { bool CanExpand(const SurfaceParams& expanded_surface) const; bool CanTexCopy(const SurfaceParams& texcopy_params) const; - MathUtil::Rectangle GetSubRect(const SurfaceParams& sub_surface) const; - MathUtil::Rectangle GetScaledSubRect(const SurfaceParams& sub_surface) const; + Common::Rectangle GetSubRect(const SurfaceParams& sub_surface) const; + Common::Rectangle GetScaledSubRect(const SurfaceParams& sub_surface) const; PAddr addr = 0; PAddr end = 0; @@ -373,9 +373,9 @@ struct CachedSurface : SurfaceParams, std::enable_shared_from_this& rect, GLuint read_fb_handle, + void UploadGLTexture(const Common::Rectangle& rect, GLuint read_fb_handle, GLuint draw_fb_handle); - void DownloadGLTexture(const MathUtil::Rectangle& rect, GLuint read_fb_handle, + void DownloadGLTexture(const Common::Rectangle& rect, GLuint read_fb_handle, GLuint draw_fb_handle); std::shared_ptr CreateWatcher() { @@ -413,11 +413,11 @@ public: ~RasterizerCacheOpenGL(); /// Blit one surface's texture to another - bool BlitSurfaces(const Surface& src_surface, const MathUtil::Rectangle& src_rect, - const Surface& dst_surface, const MathUtil::Rectangle& dst_rect); + bool BlitSurfaces(const Surface& src_surface, const Common::Rectangle& src_rect, + const Surface& dst_surface, const Common::Rectangle& dst_rect); - void ConvertD24S8toABGR(GLuint src_tex, const MathUtil::Rectangle& src_rect, - GLuint dst_tex, const MathUtil::Rectangle& dst_rect); + void ConvertD24S8toABGR(GLuint src_tex, const Common::Rectangle& src_rect, GLuint dst_tex, + const Common::Rectangle& dst_rect); /// Copy one surface's region to another void CopySurface(const Surface& src_surface, const Surface& dst_surface, @@ -441,7 +441,7 @@ public: /// Get the color and depth surfaces based on the framebuffer configuration SurfaceSurfaceRect_Tuple GetFramebufferSurfaces(bool using_color_fb, bool using_depth_fb, - const MathUtil::Rectangle& viewport_rect); + const Common::Rectangle& viewport_rect); /// Get a surface that matches the fill config Surface GetFillSurface(const GPU::Regs::MemoryFillConfig& config); diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index c3e830a21..fc63bfea7 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp @@ -221,7 +221,7 @@ void RendererOpenGL::LoadFBToScreenInfo(const GPU::Regs::FramebufferConfig& fram static_cast(pixel_stride), screen_info)) { // Reset the screen info's display texture to its own permanent texture screen_info.display_texture = screen_info.texture.resource.handle; - screen_info.display_texcoords = MathUtil::Rectangle(0.f, 0.f, 1.f, 1.f); + screen_info.display_texcoords = Common::Rectangle(0.f, 0.f, 1.f, 1.f); Memory::RasterizerFlushRegion(framebuffer_addr, framebuffer.stride * framebuffer.height); diff --git a/src/video_core/renderer_opengl/renderer_opengl.h b/src/video_core/renderer_opengl/renderer_opengl.h index 0d807db86..97ec0ec33 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.h +++ b/src/video_core/renderer_opengl/renderer_opengl.h @@ -32,7 +32,7 @@ struct TextureInfo { /// Structure used for storing information about the display target for each 3DS screen struct ScreenInfo { GLuint display_texture; - MathUtil::Rectangle display_texcoords; + Common::Rectangle display_texcoords; TextureInfo texture; }; diff --git a/src/video_core/shader/debug_data.h b/src/video_core/shader/debug_data.h index c17001194..70bb8dc31 100644 --- a/src/video_core/shader/debug_data.h +++ b/src/video_core/shader/debug_data.h @@ -152,7 +152,8 @@ inline void SetField(DebugDataRecord& record, bool } template <> -inline void SetField(DebugDataRecord& record, Common::Vec4 value) { +inline void SetField(DebugDataRecord& record, + Common::Vec4 value) { record.loop_int = value; }