From 2b9389202e0d1c8451aff176233cf211feef59dd Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 16 Jul 2019 20:18:48 -0400 Subject: [PATCH] VideoCommon: Remove unused MathUtil.h include from VideoCommon.h This header doesn't actually make use of MathUtil.h within itself, so this can be removed. Many other source files used VideoCommon.h as an indirect include to include MathUtil.h, so these includes can also be adjusted. While we're at it, we can also migrate valid inclusions of VideoCommon.h into cpp files where it can feasibly be done to minimize propagating it via other headers. --- Source/Core/VideoBackends/D3D/PerfQuery.cpp | 1 + Source/Core/VideoBackends/D3D12/PerfQuery.cpp | 4 +++- Source/Core/VideoBackends/D3DCommon/Common.h | 1 - Source/Core/VideoBackends/OGL/PerfQuery.cpp | 4 +++- Source/Core/VideoBackends/Software/DebugUtil.cpp | 1 + Source/Core/VideoBackends/Software/EfbInterface.cpp | 2 +- Source/Core/VideoBackends/Software/EfbInterface.h | 2 +- Source/Core/VideoBackends/Software/Rasterizer.cpp | 4 +++- Source/Core/VideoBackends/Software/SWOGLWindow.h | 7 ++----- Source/Core/VideoBackends/Software/SWRenderer.cpp | 4 +--- Source/Core/VideoBackends/Software/Tev.cpp | 4 +++- Source/Core/VideoBackends/Software/TextureEncoder.h | 2 +- Source/Core/VideoBackends/Vulkan/CommandBufferManager.h | 2 -- Source/Core/VideoBackends/Vulkan/PerfQuery.cpp | 1 + Source/Core/VideoBackends/Vulkan/VulkanContext.cpp | 1 + Source/Core/VideoCommon/BPFunctions.cpp | 3 ++- Source/Core/VideoCommon/BPFunctions.h | 2 +- Source/Core/VideoCommon/PostProcessing.cpp | 3 ++- Source/Core/VideoCommon/PostProcessing.h | 5 +++-- Source/Core/VideoCommon/RenderBase.cpp | 7 +++++-- Source/Core/VideoCommon/RenderBase.h | 5 ++--- Source/Core/VideoCommon/Statistics.cpp | 1 + Source/Core/VideoCommon/TextureCacheBase.h | 4 ++-- Source/Core/VideoCommon/VideoBackendBase.cpp | 3 +-- Source/Core/VideoCommon/VideoCommon.h | 2 +- Source/Core/VideoCommon/VideoConfig.h | 3 ++- 26 files changed, 44 insertions(+), 34 deletions(-) diff --git a/Source/Core/VideoBackends/D3D/PerfQuery.cpp b/Source/Core/VideoBackends/D3D/PerfQuery.cpp index 37d6620abaa..c62cc9f4fce 100644 --- a/Source/Core/VideoBackends/D3D/PerfQuery.cpp +++ b/Source/Core/VideoBackends/D3D/PerfQuery.cpp @@ -8,6 +8,7 @@ #include "Common/Logging/Log.h" #include "VideoBackends/D3D/D3DBase.h" #include "VideoCommon/RenderBase.h" +#include "VideoCommon/VideoCommon.h" namespace DX11 { diff --git a/Source/Core/VideoBackends/D3D12/PerfQuery.cpp b/Source/Core/VideoBackends/D3D12/PerfQuery.cpp index a99a33a61e2..bcea01ab9b9 100644 --- a/Source/Core/VideoBackends/D3D12/PerfQuery.cpp +++ b/Source/Core/VideoBackends/D3D12/PerfQuery.cpp @@ -2,14 +2,16 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "VideoBackends/D3D12/PerfQuery.h" + #include #include "Common/Assert.h" #include "Common/Logging/Log.h" #include "VideoBackends/D3D12/Common.h" #include "VideoBackends/D3D12/DXContext.h" -#include "VideoBackends/D3D12/PerfQuery.h" #include "VideoBackends/D3D12/Renderer.h" +#include "VideoCommon/VideoCommon.h" namespace DX12 { diff --git a/Source/Core/VideoBackends/D3DCommon/Common.h b/Source/Core/VideoBackends/D3DCommon/Common.h index aece64256a0..e98edbbc948 100644 --- a/Source/Core/VideoBackends/D3DCommon/Common.h +++ b/Source/Core/VideoBackends/D3DCommon/Common.h @@ -10,7 +10,6 @@ #include #include "Common/CommonTypes.h" -#include "VideoCommon/VideoCommon.h" struct IDXGIFactory; diff --git a/Source/Core/VideoBackends/OGL/PerfQuery.cpp b/Source/Core/VideoBackends/OGL/PerfQuery.cpp index 61cc951ce75..74bc28ef192 100644 --- a/Source/Core/VideoBackends/OGL/PerfQuery.cpp +++ b/Source/Core/VideoBackends/OGL/PerfQuery.cpp @@ -2,13 +2,15 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "VideoBackends/OGL/PerfQuery.h" + #include #include "Common/CommonTypes.h" #include "Common/GL/GLExtensions/GLExtensions.h" -#include "VideoBackends/OGL/PerfQuery.h" #include "VideoBackends/OGL/Render.h" +#include "VideoCommon/VideoCommon.h" #include "VideoCommon/VideoConfig.h" namespace OGL diff --git a/Source/Core/VideoBackends/Software/DebugUtil.cpp b/Source/Core/VideoBackends/Software/DebugUtil.cpp index 7b9be6e503c..275cc6521d5 100644 --- a/Source/Core/VideoBackends/Software/DebugUtil.cpp +++ b/Source/Core/VideoBackends/Software/DebugUtil.cpp @@ -18,6 +18,7 @@ #include "VideoCommon/BPMemory.h" #include "VideoCommon/ImageWrite.h" #include "VideoCommon/Statistics.h" +#include "VideoCommon/VideoCommon.h" #include "VideoCommon/VideoConfig.h" namespace DebugUtil diff --git a/Source/Core/VideoBackends/Software/EfbInterface.cpp b/Source/Core/VideoBackends/Software/EfbInterface.cpp index d64c5193858..7118ff86155 100644 --- a/Source/Core/VideoBackends/Software/EfbInterface.cpp +++ b/Source/Core/VideoBackends/Software/EfbInterface.cpp @@ -12,12 +12,12 @@ #include "Common/CommonTypes.h" #include "Common/Logging/Log.h" -#include "Common/Swap.h" #include "VideoBackends/Software/CopyRegion.h" #include "VideoCommon/BPMemory.h" #include "VideoCommon/LookUpTables.h" #include "VideoCommon/PerfQueryBase.h" +#include "VideoCommon/VideoCommon.h" namespace EfbInterface { diff --git a/Source/Core/VideoBackends/Software/EfbInterface.h b/Source/Core/VideoBackends/Software/EfbInterface.h index ea3bfc4bf9f..329e260bf0a 100644 --- a/Source/Core/VideoBackends/Software/EfbInterface.h +++ b/Source/Core/VideoBackends/Software/EfbInterface.h @@ -5,8 +5,8 @@ #pragma once #include "Common/CommonTypes.h" +#include "Common/MathUtil.h" #include "VideoCommon/PerfQueryBase.h" -#include "VideoCommon/VideoCommon.h" namespace EfbInterface { diff --git a/Source/Core/VideoBackends/Software/Rasterizer.cpp b/Source/Core/VideoBackends/Software/Rasterizer.cpp index 5fc21340fe9..352b995b9c2 100644 --- a/Source/Core/VideoBackends/Software/Rasterizer.cpp +++ b/Source/Core/VideoBackends/Software/Rasterizer.cpp @@ -2,16 +2,18 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "VideoBackends/Software/Rasterizer.h" + #include #include #include "Common/CommonTypes.h" #include "VideoBackends/Software/EfbInterface.h" #include "VideoBackends/Software/NativeVertexFormat.h" -#include "VideoBackends/Software/Rasterizer.h" #include "VideoBackends/Software/Tev.h" #include "VideoCommon/PerfQueryBase.h" #include "VideoCommon/Statistics.h" +#include "VideoCommon/VideoCommon.h" #include "VideoCommon/VideoConfig.h" #include "VideoCommon/XFMemory.h" diff --git a/Source/Core/VideoBackends/Software/SWOGLWindow.h b/Source/Core/VideoBackends/Software/SWOGLWindow.h index ce95c876944..753c1564400 100644 --- a/Source/Core/VideoBackends/Software/SWOGLWindow.h +++ b/Source/Core/VideoBackends/Software/SWOGLWindow.h @@ -5,15 +5,12 @@ #pragma once #include -#include -#include #include "Common/CommonTypes.h" -#include "VideoCommon/VideoCommon.h" - -class GLContext; +#include "Common/MathUtil.h" class AbstractTexture; +class GLContext; struct WindowSystemInfo; class SWOGLWindow diff --git a/Source/Core/VideoBackends/Software/SWRenderer.cpp b/Source/Core/VideoBackends/Software/SWRenderer.cpp index e316ecae511..4d9b821f5ae 100644 --- a/Source/Core/VideoBackends/Software/SWRenderer.cpp +++ b/Source/Core/VideoBackends/Software/SWRenderer.cpp @@ -9,7 +9,6 @@ #include "Common/CommonTypes.h" #include "Common/GL/GLContext.h" -#include "Core/Config/GraphicsSettings.h" #include "Core/HW/Memmap.h" #include "VideoBackends/Software/EfbCopy.h" @@ -22,9 +21,8 @@ #include "VideoCommon/AbstractTexture.h" #include "VideoCommon/BoundingBox.h" #include "VideoCommon/NativeVertexFormat.h" -#include "VideoCommon/OnScreenDisplay.h" #include "VideoCommon/VideoBackendBase.h" -#include "VideoCommon/VideoConfig.h" +#include "VideoCommon/VideoCommon.h" namespace SW { diff --git a/Source/Core/VideoBackends/Software/Tev.cpp b/Source/Core/VideoBackends/Software/Tev.cpp index b0285867b96..580ab586858 100644 --- a/Source/Core/VideoBackends/Software/Tev.cpp +++ b/Source/Core/VideoBackends/Software/Tev.cpp @@ -2,6 +2,8 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "VideoBackends/Software/Tev.h" + #include #include @@ -9,13 +11,13 @@ #include "Common/CommonTypes.h" #include "VideoBackends/Software/DebugUtil.h" #include "VideoBackends/Software/EfbInterface.h" -#include "VideoBackends/Software/Tev.h" #include "VideoBackends/Software/TextureSampler.h" #include "VideoCommon/BoundingBox.h" #include "VideoCommon/PerfQueryBase.h" #include "VideoCommon/PixelShaderManager.h" #include "VideoCommon/Statistics.h" +#include "VideoCommon/VideoCommon.h" #include "VideoCommon/VideoConfig.h" #include "VideoCommon/XFMemory.h" diff --git a/Source/Core/VideoBackends/Software/TextureEncoder.h b/Source/Core/VideoBackends/Software/TextureEncoder.h index a1e1f09cefb..186455a711f 100644 --- a/Source/Core/VideoBackends/Software/TextureEncoder.h +++ b/Source/Core/VideoBackends/Software/TextureEncoder.h @@ -5,8 +5,8 @@ #pragma once #include "Common/CommonTypes.h" +#include "Common/MathUtil.h" #include "VideoCommon/TextureCacheBase.h" -#include "VideoCommon/VideoCommon.h" namespace TextureEncoder { diff --git a/Source/Core/VideoBackends/Vulkan/CommandBufferManager.h b/Source/Core/VideoBackends/Vulkan/CommandBufferManager.h index abc49c0622d..350a576c046 100644 --- a/Source/Core/VideoBackends/Vulkan/CommandBufferManager.h +++ b/Source/Core/VideoBackends/Vulkan/CommandBufferManager.h @@ -19,8 +19,6 @@ #include "Common/Flag.h" #include "Common/Semaphore.h" -#include "VideoCommon/VideoCommon.h" - #include "VideoBackends/Vulkan/Constants.h" namespace Vulkan diff --git a/Source/Core/VideoBackends/Vulkan/PerfQuery.cpp b/Source/Core/VideoBackends/Vulkan/PerfQuery.cpp index 6c64d71b2ef..50a696c26bf 100644 --- a/Source/Core/VideoBackends/Vulkan/PerfQuery.cpp +++ b/Source/Core/VideoBackends/Vulkan/PerfQuery.cpp @@ -16,6 +16,7 @@ #include "VideoBackends/Vulkan/Renderer.h" #include "VideoBackends/Vulkan/StateTracker.h" #include "VideoBackends/Vulkan/VulkanContext.h" +#include "VideoCommon/VideoCommon.h" namespace Vulkan { diff --git a/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp b/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp index 1f0955c9210..1df8080f842 100644 --- a/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp +++ b/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp @@ -14,6 +14,7 @@ #include "VideoBackends/Vulkan/VulkanContext.h" #include "VideoCommon/DriverDetails.h" +#include "VideoCommon/VideoCommon.h" namespace Vulkan { diff --git a/Source/Core/VideoCommon/BPFunctions.cpp b/Source/Core/VideoCommon/BPFunctions.cpp index e7259278607..6c145286716 100644 --- a/Source/Core/VideoCommon/BPFunctions.cpp +++ b/Source/Core/VideoCommon/BPFunctions.cpp @@ -2,13 +2,14 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "VideoCommon/BPFunctions.h" + #include #include "Common/CommonTypes.h" #include "Common/Logging/Log.h" #include "VideoCommon/AbstractFramebuffer.h" -#include "VideoCommon/BPFunctions.h" #include "VideoCommon/BPMemory.h" #include "VideoCommon/FramebufferManager.h" #include "VideoCommon/RenderBase.h" diff --git a/Source/Core/VideoCommon/BPFunctions.h b/Source/Core/VideoCommon/BPFunctions.h index 9f8625233a9..458e4f7cffe 100644 --- a/Source/Core/VideoCommon/BPFunctions.h +++ b/Source/Core/VideoCommon/BPFunctions.h @@ -8,7 +8,7 @@ #pragma once -#include "VideoCommon/VideoCommon.h" +#include "Common/MathUtil.h" struct BPCmd; diff --git a/Source/Core/VideoCommon/PostProcessing.cpp b/Source/Core/VideoCommon/PostProcessing.cpp index d6d2b62625f..77f77cb9ce5 100644 --- a/Source/Core/VideoCommon/PostProcessing.cpp +++ b/Source/Core/VideoCommon/PostProcessing.cpp @@ -2,6 +2,8 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "VideoCommon/PostProcessing.h" + #include #include @@ -20,7 +22,6 @@ #include "VideoCommon/AbstractShader.h" #include "VideoCommon/AbstractTexture.h" #include "VideoCommon/FramebufferManager.h" -#include "VideoCommon/PostProcessing.h" #include "VideoCommon/RenderBase.h" #include "VideoCommon/ShaderCache.h" #include "VideoCommon/VertexManagerBase.h" diff --git a/Source/Core/VideoCommon/PostProcessing.h b/Source/Core/VideoCommon/PostProcessing.h index 55ff1c7c5d8..02400031375 100644 --- a/Source/Core/VideoCommon/PostProcessing.h +++ b/Source/Core/VideoCommon/PostProcessing.h @@ -5,17 +5,18 @@ #pragma once #include +#include #include #include #include "Common/CommonTypes.h" +#include "Common/MathUtil.h" #include "Common/Timer.h" #include "VideoCommon/TextureConfig.h" -#include "VideoCommon/VideoCommon.h" -class AbstractTexture; class AbstractPipeline; class AbstractShader; +class AbstractTexture; namespace VideoCommon { diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp index 795a96e40db..40b6f9d51e0 100644 --- a/Source/Core/VideoCommon/RenderBase.cpp +++ b/Source/Core/VideoCommon/RenderBase.cpp @@ -22,7 +22,7 @@ #include #include -#include "imgui.h" +#include #include "Common/Assert.h" #include "Common/CommonTypes.h" @@ -74,6 +74,7 @@ #include "VideoCommon/VertexManagerBase.h" #include "VideoCommon/VertexShaderManager.h" #include "VideoCommon/VideoBackendBase.h" +#include "VideoCommon/VideoCommon.h" #include "VideoCommon/VideoConfig.h" #include "VideoCommon/XFMemory.h" @@ -87,7 +88,9 @@ static float AspectToWidescreen(float aspect) Renderer::Renderer(int backbuffer_width, int backbuffer_height, float backbuffer_scale, AbstractTextureFormat backbuffer_format) : m_backbuffer_width(backbuffer_width), m_backbuffer_height(backbuffer_height), - m_backbuffer_scale(backbuffer_scale), m_backbuffer_format(backbuffer_format) + m_backbuffer_scale(backbuffer_scale), + m_backbuffer_format(backbuffer_format), m_last_xfb_width{MAX_XFB_WIDTH}, m_last_xfb_height{ + MAX_XFB_HEIGHT} { UpdateActiveConfig(); UpdateDrawRectangle(); diff --git a/Source/Core/VideoCommon/RenderBase.h b/Source/Core/VideoCommon/RenderBase.h index a2740010704..584f07bc415 100644 --- a/Source/Core/VideoCommon/RenderBase.h +++ b/Source/Core/VideoCommon/RenderBase.h @@ -33,7 +33,6 @@ #include "VideoCommon/FrameDump.h" #include "VideoCommon/RenderState.h" #include "VideoCommon/TextureConfig.h" -#include "VideoCommon/VideoCommon.h" class AbstractFramebuffer; class AbstractPipeline; @@ -359,8 +358,8 @@ private: u64 m_last_xfb_id = std::numeric_limits::max(); // Note: Only used for auto-ir - u32 m_last_xfb_width = MAX_XFB_WIDTH; - u32 m_last_xfb_height = MAX_XFB_HEIGHT; + u32 m_last_xfb_width = 0; + u32 m_last_xfb_height = 0; // NOTE: The methods below are called on the framedumping thread. bool StartFrameDumpToFFMPEG(const FrameDumpConfig& config); diff --git a/Source/Core/VideoCommon/Statistics.cpp b/Source/Core/VideoCommon/Statistics.cpp index 98b60dd5da9..366f332c36c 100644 --- a/Source/Core/VideoCommon/Statistics.cpp +++ b/Source/Core/VideoCommon/Statistics.cpp @@ -8,6 +8,7 @@ #include +#include "VideoCommon/VideoCommon.h" #include "VideoCommon/VideoConfig.h" Statistics g_stats; diff --git a/Source/Core/VideoCommon/TextureCacheBase.h b/Source/Core/VideoCommon/TextureCacheBase.h index 2f42df9a057..12b39039ddc 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.h +++ b/Source/Core/VideoCommon/TextureCacheBase.h @@ -16,15 +16,15 @@ #include #include "Common/CommonTypes.h" +#include "Common/MathUtil.h" #include "VideoCommon/AbstractTexture.h" #include "VideoCommon/BPMemory.h" #include "VideoCommon/TextureConfig.h" #include "VideoCommon/TextureDecoder.h" -#include "VideoCommon/VideoCommon.h" -struct VideoConfig; class AbstractFramebuffer; class AbstractStagingTexture; +struct VideoConfig; struct TextureAndTLUTFormat { diff --git a/Source/Core/VideoCommon/VideoBackendBase.cpp b/Source/Core/VideoCommon/VideoBackendBase.cpp index d09b32cf828..aa4cd8f6ddd 100644 --- a/Source/Core/VideoCommon/VideoBackendBase.cpp +++ b/Source/Core/VideoCommon/VideoBackendBase.cpp @@ -16,7 +16,6 @@ #include "Common/Logging/Log.h" #include "Core/ConfigManager.h" #include "Core/Core.h" -#include "Core/Host.h" // TODO: ugly #ifdef _WIN32 @@ -35,7 +34,6 @@ #include "VideoCommon/Fifo.h" #include "VideoCommon/GeometryShaderManager.h" #include "VideoCommon/IndexGenerator.h" -#include "VideoCommon/OnScreenDisplay.h" #include "VideoCommon/OpcodeDecoding.h" #include "VideoCommon/PixelEngine.h" #include "VideoCommon/PixelShaderManager.h" @@ -43,6 +41,7 @@ #include "VideoCommon/TextureCacheBase.h" #include "VideoCommon/VertexLoaderManager.h" #include "VideoCommon/VertexShaderManager.h" +#include "VideoCommon/VideoCommon.h" #include "VideoCommon/VideoConfig.h" #include "VideoCommon/VideoState.h" diff --git a/Source/Core/VideoCommon/VideoCommon.h b/Source/Core/VideoCommon/VideoCommon.h index 21aa5236a9e..5c4b1b3615d 100644 --- a/Source/Core/VideoCommon/VideoCommon.h +++ b/Source/Core/VideoCommon/VideoCommon.h @@ -3,8 +3,8 @@ // Refer to the license.txt file included. #pragma once + #include "Common/CommonTypes.h" -#include "Common/MathUtil.h" // Global flag to signal if FifoRecorder is active. extern bool g_bRecordFifoData; diff --git a/Source/Core/VideoCommon/VideoConfig.h b/Source/Core/VideoCommon/VideoConfig.h index 674dfa8530b..7008199a84b 100644 --- a/Source/Core/VideoCommon/VideoConfig.h +++ b/Source/Core/VideoCommon/VideoConfig.h @@ -14,7 +14,8 @@ #include #include "Common/CommonTypes.h" -#include "VideoCommon/VideoCommon.h" + +enum class APIType; // Log in two categories, and save three other options in the same byte #define CONF_LOG 1