Lint fixes

This commit is contained in:
Scott Mansell
2023-01-31 17:29:16 +13:00
parent 11de923dcb
commit 31cfe8250d
39 changed files with 219 additions and 235 deletions

View File

@ -15,8 +15,8 @@
#include "VideoCommon/VertexManagerBase.h"
#include "VideoCommon/VideoBackendBase.h"
#include "VideoCommon/VideoCommon.h"
#include "VideoCommon/VideoState.h"
#include "VideoCommon/VideoEvents.h"
#include "VideoCommon/VideoState.h"
AsyncRequests AsyncRequests::s_singleton;

View File

@ -31,9 +31,9 @@
#include "VideoCommon/GeometryShaderManager.h"
#include "VideoCommon/OpcodeDecoding.h"
#include "VideoCommon/PerfQueryBase.h"
#include "VideoCommon/Present.h"
#include "VideoCommon/PixelEngine.h"
#include "VideoCommon/PixelShaderManager.h"
#include "VideoCommon/Present.h"
#include "VideoCommon/RenderBase.h"
#include "VideoCommon/Statistics.h"
#include "VideoCommon/TMEM.h"
@ -346,7 +346,6 @@ static void BPWritten(PixelShaderManager& pixel_shader_manager,
// It works 99% of the time.
AfterFrameEvent::Trigger();
if (g_ActiveConfig.bImmediateXFB)
{
// below div two to convert from bytes to pixels - it expects width, not stride

View File

@ -149,16 +149,14 @@ static u32 CalculateEFBLayers()
TextureConfig FramebufferManager::GetEFBColorTextureConfig(u32 width, u32 height)
{
return TextureConfig(width, height, 1,
CalculateEFBLayers(), g_ActiveConfig.iMultisamples, GetEFBColorFormat(),
AbstractTextureFlag_RenderTarget);
return TextureConfig(width, height, 1, CalculateEFBLayers(), g_ActiveConfig.iMultisamples,
GetEFBColorFormat(), AbstractTextureFlag_RenderTarget);
}
TextureConfig FramebufferManager::GetEFBDepthTextureConfig(u32 width, u32 height)
{
return TextureConfig(width, height, 1,
CalculateEFBLayers(), g_ActiveConfig.iMultisamples, GetEFBDepthFormat(),
AbstractTextureFlag_RenderTarget);
return TextureConfig(width, height, 1, CalculateEFBLayers(), g_ActiveConfig.iMultisamples,
GetEFBDepthFormat(), AbstractTextureFlag_RenderTarget);
}
FramebufferState FramebufferManager::GetEFBFramebufferState() const
@ -905,8 +903,7 @@ bool FramebufferManager::CompileClearPipelines()
config.depth_state.testenable = depth_enable != 0;
config.depth_state.updateenable = depth_enable != 0;
m_clear_pipelines[color_enable][alpha_enable][depth_enable] =
g_gfx->CreatePipeline(config);
m_clear_pipelines[color_enable][alpha_enable][depth_enable] = g_gfx->CreatePipeline(config);
if (!m_clear_pipelines[color_enable][alpha_enable][depth_enable])
return false;
}

View File

@ -226,8 +226,7 @@ protected:
// EFB clear pipelines
// Indexed by [color_write_enabled][alpha_write_enabled][depth_write_enabled]
std::array<std::array<std::array<std::unique_ptr<AbstractPipeline>, 2>, 2>, 2>
m_clear_pipelines;
std::array<std::array<std::array<std::unique_ptr<AbstractPipeline>, 2>, 2>, 2> m_clear_pipelines;
// EFB poke drawing setup
std::unique_ptr<NativeVertexFormat> m_poke_vertex_format;

View File

@ -13,8 +13,8 @@
#include "VideoCommon/GraphicsModSystem/Runtime/FBInfo.h"
#include "VideoCommon/GraphicsModSystem/Runtime/GraphicsModAction.h"
#include "VideoCommon/TextureInfo.h"
#include "VideoCommon/XFMemory.h"
#include "VideoCommon/VideoEvents.h"
#include "VideoCommon/XFMemory.h"
class GraphicsModGroupConfig;
class GraphicsModManager

View File

@ -16,7 +16,6 @@ class AbstractPipeline;
namespace VideoCommon
{
// OnScreenUI handles all the ImGui rendering.
class OnScreenUI
{

View File

@ -74,7 +74,8 @@ void PixelShaderManager::Dirty()
// Any constants that can changed based on settings should be re-calculated
m_fog_range_adjusted_changed = true;
SetEfbScaleChanged(g_framebuffer_manager->EFBToScaledXf(1), g_framebuffer_manager->EFBToScaledYf(1));
SetEfbScaleChanged(g_framebuffer_manager->EFBToScaledXf(1),
g_framebuffer_manager->EFBToScaledYf(1));
SetFogParamChanged();
dirty = true;
@ -102,8 +103,8 @@ void PixelShaderManager::SetConstants()
// so to simplify I use the hi coefficient as K in the shader taking 256 as the scale
// TODO: Shouldn't this be EFBToScaledXf?
constants.fogf[2] = ScreenSpaceCenter;
constants.fogf[3] =
static_cast<float>(g_framebuffer_manager->EFBToScaledX(static_cast<int>(2.0f * xfmem.viewport.wd)));
constants.fogf[3] = static_cast<float>(
g_framebuffer_manager->EFBToScaledX(static_cast<int>(2.0f * xfmem.viewport.wd)));
for (size_t i = 0, vec_index = 0; i < std::size(bpmem.fogRange.K); i++)
{

View File

@ -9,6 +9,7 @@
#include "InputCommon/ControllerInterface/ControllerInterface.h"
#include "Present.h"
#include "VideoCommon/AbstractGfx.h"
#include "VideoCommon/FrameDumper.h"
#include "VideoCommon/OnScreenUI.h"
@ -18,7 +19,6 @@
#include "VideoCommon/VertexManagerBase.h"
#include "VideoCommon/VideoConfig.h"
#include "VideoCommon/VideoEvents.h"
#include "Present.h"
std::unique_ptr<VideoCommon::Presenter> g_presenter;
@ -67,7 +67,8 @@ bool Presenter::FetchXFB(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_heigh
{
ReleaseXFBContentLock();
m_xfb_entry = g_texture_cache->GetXFBTexture(xfb_addr, fb_width, fb_height, fb_stride, &m_xfb_rect);
m_xfb_entry =
g_texture_cache->GetXFBTexture(xfb_addr, fb_width, fb_height, fb_stride, &m_xfb_rect);
bool is_duplicate = m_xfb_entry->id == m_last_xfb_id;
m_xfb_entry->AcquireContentLock();
@ -95,7 +96,7 @@ void Presenter::ViSwap(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height,
}
else
{
present_info.frame_count = m_frame_count - 1; // Previous frame
present_info.frame_count = m_frame_count - 1; // Previous frame
present_info.reason = PresentInfo::PresentReason::VideoInterfaceDuplicate;
}
present_info.present_count = m_present_count;
@ -308,7 +309,7 @@ void Presenter::ResizeSurface()
void* Presenter::GetNewSurfaceHandle()
{
void *handle = m_new_surface_handle;
void* handle = m_new_surface_handle;
m_new_surface_handle = nullptr;
return handle;
}
@ -605,11 +606,9 @@ void Presenter::DoState(PointerWrap& p)
AfterFrameEvent::Trigger();
// re-display the most recent XFB
ImmediateSwap(m_last_xfb_addr, m_last_xfb_width, m_last_xfb_stride,
m_last_xfb_height, m_last_xfb_ticks);
ImmediateSwap(m_last_xfb_addr, m_last_xfb_width, m_last_xfb_stride, m_last_xfb_height,
m_last_xfb_ticks);
}
}
} // namespace VideoCommon

View File

@ -31,31 +31,32 @@
#include "Core/System.h"
#include "VideoCommon/AbstractGfx.h"
#include "VideoCommon/BPFunctions.h"
#include "VideoCommon/BPMemory.h"
#include "VideoCommon/BoundingBox.h"
#include "VideoCommon/BPFunctions.h"
#include "VideoCommon/FrameDumper.h"
#include "VideoCommon/FramebufferManager.h"
#include "VideoCommon/FramebufferManager.h"
#include "VideoCommon/PixelEngine.h"
#include "VideoCommon/Present.h"
#include "VideoCommon/VertexManagerBase.h"
#include "VideoCommon/VideoBackendBase.h"
#include "VideoCommon/VideoConfig.h"
#include "VideoCommon/VideoCommon.h"
#include "VideoCommon/VideoConfig.h"
#include "VideoCommon/XFMemory.h"
std::unique_ptr<Renderer> g_renderer;
Renderer::Renderer()
: m_prev_efb_format{PixelFormat::INVALID_FMT}
Renderer::Renderer() : m_prev_efb_format{PixelFormat::INVALID_FMT}
{
UpdateWidescreen();
m_config_changed_handle = ConfigChangedEvent::Register([this](u32 bits) { OnConfigChanged(bits); }, "Renderer");
m_config_changed_handle =
ConfigChangedEvent::Register([this](u32 bits) { OnConfigChanged(bits); }, "Renderer");
// VertexManager doesn't maintain statistics in Wii mode.
if (!SConfig::GetInstance().bWii)
m_update_widescreen_handle = AfterFrameEvent::Register([this] { UpdateWidescreenHeuristic(); }, "WideScreen Heuristic");
m_update_widescreen_handle =
AfterFrameEvent::Register([this] { UpdateWidescreenHeuristic(); }, "WideScreen Heuristic");
}
Renderer::~Renderer() = default;

View File

@ -1,7 +1,6 @@
// Copyright 2010 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <memory>

View File

@ -46,7 +46,8 @@ bool ShaderCache::Initialize()
return false;
m_async_shader_compiler = g_gfx->CreateAsyncShaderCompiler();
m_frame_end_handler = AfterFrameEvent::Register([this] { RetrieveAsyncShaders(); }, "RetreiveAsyncShaders");
m_frame_end_handler =
AfterFrameEvent::Register([this] { RetrieveAsyncShaders(); }, "RetreiveAsyncShaders");
return true;
}

View File

@ -18,17 +18,18 @@
Statistics g_stats;
static EventHook s_before_frame_event = BeforeFrameEvent::Register([] {
g_stats.ResetFrame();
}, "Statistics::ResetFrame");
static EventHook s_before_frame_event =
BeforeFrameEvent::Register([] { g_stats.ResetFrame(); }, "Statistics::ResetFrame");
static EventHook s_after_frame_event = AfterFrameEvent::Register([] {
DolphinAnalytics::PerformanceSample perf_sample;
perf_sample.speed_ratio = SystemTimers::GetEstimatedEmulationPerformance();
perf_sample.num_prims = g_stats.this_frame.num_prims + g_stats.this_frame.num_dl_prims;
perf_sample.num_draw_calls = g_stats.this_frame.num_draw_calls;
DolphinAnalytics::Instance().ReportPerformanceInfo(std::move(perf_sample));
}, "Statistics::PerformanceSample");
static EventHook s_after_frame_event = AfterFrameEvent::Register(
[] {
DolphinAnalytics::PerformanceSample perf_sample;
perf_sample.speed_ratio = SystemTimers::GetEstimatedEmulationPerformance();
perf_sample.num_prims = g_stats.this_frame.num_prims + g_stats.this_frame.num_dl_prims;
perf_sample.num_draw_calls = g_stats.this_frame.num_draw_calls;
DolphinAnalytics::Instance().ReportPerformanceInfo(std::move(perf_sample));
},
"Statistics::PerformanceSample");
static bool clear_scissors;

View File

@ -773,7 +773,7 @@ void TextureCacheBase::OnFrameEnd()
{
if (m_force_reload_textures.TestAndClear())
{
ForceReload();
ForceReload();
}
else
{
@ -920,9 +920,9 @@ RcTcacheEntry TextureCacheBase::DoPartialTextureUpdates(RcTcacheEntry& entry_to_
entry_to_update->native_height != entry_to_update->GetHeight() ||
entry->native_width != entry->GetWidth() || entry->native_height != entry->GetHeight())
{
ScaleTextureCacheEntryTo(entry_to_update,
g_framebuffer_manager->EFBToScaledX(entry_to_update->native_width),
g_framebuffer_manager->EFBToScaledY(entry_to_update->native_height));
ScaleTextureCacheEntryTo(
entry_to_update, g_framebuffer_manager->EFBToScaledX(entry_to_update->native_width),
g_framebuffer_manager->EFBToScaledY(entry_to_update->native_height));
ScaleTextureCacheEntryTo(entry, g_framebuffer_manager->EFBToScaledX(entry->native_width),
g_framebuffer_manager->EFBToScaledY(entry->native_height));
@ -1957,7 +1957,8 @@ void TextureCacheBase::StitchXFBCopy(RcTcacheEntry& stitched_entry)
// copies to be stitched together.
if (create_upscaled_copy)
{
ScaleTextureCacheEntryTo(stitched_entry, g_framebuffer_manager->EFBToScaledX(stitched_entry->native_width),
ScaleTextureCacheEntryTo(stitched_entry,
g_framebuffer_manager->EFBToScaledX(stitched_entry->native_width),
g_framebuffer_manager->EFBToScaledY(stitched_entry->native_height));
}
@ -2269,7 +2270,8 @@ void TextureCacheBase::CopyRenderTargetToTexture(
// TODO: This only produces perfect downsampling for 2x IR, other resolutions will need more
// complex down filtering to average all pixels and produce the correct result.
const bool linear_filter =
!is_depth_copy && (scaleByHalf || g_framebuffer_manager->GetEFBScale() != 1 || y_scale > 1.0f);
!is_depth_copy &&
(scaleByHalf || g_framebuffer_manager->GetEFBScale() != 1 || y_scale > 1.0f);
RcTcacheEntry entry;
if (copy_to_vram)

View File

@ -104,7 +104,7 @@ VertexManagerBase::~VertexManagerBase() = default;
bool VertexManagerBase::Initialize()
{
m_frame_end_event = AfterFrameEvent::Register([this] { OnEndFrame();}, "VertexManagerBase");
m_frame_end_event = AfterFrameEvent::Register([this] { OnEndFrame(); }, "VertexManagerBase");
m_index_generator.Init();
m_cpu_cull.Init();
return true;
@ -562,8 +562,7 @@ void VertexManagerBase::Flush()
{
bool skip = false;
GraphicsModActionData::DrawStarted draw_started{&skip};
for (const auto action :
g_graphics_mod_manager->GetDrawStartedActions(texture_name))
for (const auto action : g_graphics_mod_manager->GetDrawStartedActions(texture_name))
{
action->OnDrawStarted(&draw_started);
}

View File

@ -388,16 +388,15 @@ void VertexShaderManager::SetConstants(const std::vector<std::string>& textures)
std::vector<GraphicsModAction*> projection_actions;
if (g_ActiveConfig.bGraphicMods)
{
for (const auto action :
g_graphics_mod_manager->GetProjectionActions(xfmem.projection.type))
for (const auto action : g_graphics_mod_manager->GetProjectionActions(xfmem.projection.type))
{
projection_actions.push_back(action);
}
for (const auto& texture : textures)
{
for (const auto action : g_graphics_mod_manager->GetProjectionTextureActions(
xfmem.projection.type, texture))
for (const auto action :
g_graphics_mod_manager->GetProjectionTextureActions(xfmem.projection.type, texture))
{
projection_actions.push_back(action);
}

View File

@ -24,8 +24,8 @@
#include "VideoCommon/GraphicsModSystem/Config/GraphicsMod.h"
#include "VideoCommon/GraphicsModSystem/Runtime/GraphicsModManager.h"
#include "VideoCommon/OnScreenDisplay.h"
#include "VideoCommon/Present.h"
#include "VideoCommon/PixelShaderManager.h"
#include "VideoCommon/Present.h"
#include "VideoCommon/ShaderGenCommon.h"
#include "VideoCommon/TextureCacheBase.h"
#include "VideoCommon/VertexManagerBase.h"
@ -355,7 +355,8 @@ void CheckForConfigChanges()
// TODO: Move everything else to the ConfigChanged event
}
static EventHook s_check_config_event = AfterFrameEvent::Register([] {
CheckForConfigChanges();
}, "CheckForConfigChanges");
static EventHook s_check_config_event = AfterFrameEvent::Register(
[] {
CheckForConfigChanges();
},
"CheckForConfigChanges");

View File

@ -59,7 +59,6 @@ enum class TriState : int
Auto
};
// Bitmask containing information about which configuration has changed for the backend.
enum ConfigChangeBits : u32
{

View File

@ -6,7 +6,6 @@
#include "Common/CommonTypes.h"
#include "Common/EventHook.h"
// Called when certain video config setting are changed
using ConfigChangedEvent = Event<"ConfigChanged", u32>;
@ -21,60 +20,60 @@ using AfterFrameEvent = Event<"AfterFrame">;
struct PresentInfo
{
enum class PresentReason
{
Immediate, // FIFO is Presenting the XFB immediately, straight after the XFB copy
VideoInterface, // VideoInterface has triggered a present with a new frame
VideoInterfaceDuplicate, // VideoInterface has triggered a present with a duplicate frame
};
enum class PresentReason
{
Immediate, // FIFO is Presenting the XFB immediately, straight after the XFB copy
VideoInterface, // VideoInterface has triggered a present with a new frame
VideoInterfaceDuplicate, // VideoInterface has triggered a present with a duplicate frame
};
// The number of (unique) frames since the emulated console booted
u64 frame_count;
// The number of (unique) frames since the emulated console booted
u64 frame_count;
// The number of presents since the video backend was initialized.
// never goes backwards.
u64 present_count;
// The number of presents since the video backend was initialized.
// never goes backwards.
u64 present_count;
// The frame is identical to the previous frame
PresentReason reason;
// The frame is identical to the previous frame
PresentReason reason;
// The exact emulated time of the when real hardware would have presented this frame
// FIXME: Immediate should predict the timestamp of this present
u64 emulated_timestamp;
// The exact emulated time of the when real hardware would have presented this frame
// FIXME: Immediate should predict the timestamp of this present
u64 emulated_timestamp;
// TODO:
// u64 intended_present_time;
// TODO:
// u64 intended_present_time;
// AfterPresent only: The actual time the frame was presented
u64 actual_present_time = 0;
// AfterPresent only: The actual time the frame was presented
u64 actual_present_time = 0;
enum class PresentTimeAccuracy
{
// The Driver/OS has given us an exact timestamp of when the first line of the frame started
// scanning out to the monitor
PresentOnScreenExact,
enum class PresentTimeAccuracy
{
// The Driver/OS has given us an exact timestamp of when the first line of the frame started
// scanning out to the monitor
PresentOnScreenExact,
// An approximate timestamp of scanout.
PresentOnScreen,
// An approximate timestamp of scanout.
PresentOnScreen,
// Dolphin doesn't have visibility of the present time. But the present operation has
// been queued with the GPU driver and will happen in the near future.
PresentInProgress,
// Dolphin doesn't have visibility of the present time. But the present operation has
// been queued with the GPU driver and will happen in the near future.
PresentInProgress,
// Not implemented
Unimplemented,
};
// Not implemented
Unimplemented,
};
// Accuracy of actual_present_time
PresentTimeAccuracy present_time_accuracy = PresentTimeAccuracy::Unimplemented;
// Accuracy of actual_present_time
PresentTimeAccuracy present_time_accuracy = PresentTimeAccuracy::Unimplemented;
};
// An event called just as a frame is queued for presentation.
// The exact timing of this event depends on the "Immediately Present XFB" option.
//
// If enabled, this event will trigger immediately after AfterFrame
// If disabled, this event won't trigger until the emulated interface starts drawing out a new frame.
// If disabled, this event won't trigger until the emulated interface starts drawing out a new
// frame.
//
// frame_count: The number of frames
using BeforePresentEvent = Event<"BeforePresent", PresentInfo&>;

View File

@ -7,14 +7,14 @@
#include "Common/ChunkFile.h"
#include "Core/System.h"
#include "VideoCommon/BoundingBox.h"
#include "VideoCommon/BPMemory.h"
#include "VideoCommon/BPStructs.h"
#include "VideoCommon/BoundingBox.h"
#include "VideoCommon/CPMemory.h"
#include "VideoCommon/CommandProcessor.h"
#include "VideoCommon/Fifo.h"
#include "VideoCommon/FramebufferManager.h"
#include "VideoCommon/FrameDumper.h"
#include "VideoCommon/FramebufferManager.h"
#include "VideoCommon/GeometryShaderManager.h"
#include "VideoCommon/PixelEngine.h"
#include "VideoCommon/PixelShaderManager.h"
@ -105,7 +105,6 @@ void VideoCommon_DoState(PointerWrap& p)
g_bounding_box->DoState(p);
p.DoMarker("Bounding Box");
// Refresh state.
if (p.IsReadMode())
{