Improve usage of std::move and const references parameters

Accomplished using `run-clang-tidy` with `performance-move-const-arg,performance-unnecessary-value-param,modernize-pass-by-value`.

Changed arguments to const references, removed them where inappropriate (e.g. sink parameters). Same with std::move.

Manually reviewed each change to make sure that it makes sense, and do something more appropriate if possible.
This commit is contained in:
Martino Fontana
2026-04-06 11:37:26 +02:00
parent 33f62b0f9f
commit 95dec13203
140 changed files with 318 additions and 277 deletions

View File

@@ -3,6 +3,8 @@
#include "VideoCommon/GraphicsModSystem/Runtime/CustomShaderCache.h"
#include <utility>
#include "VideoCommon/AbstractGfx.h"
#include "VideoCommon/VideoConfig.h"
#include "VideoCommon/VideoEvents.h"
@@ -100,11 +102,11 @@ void CustomShaderCache::AsyncCreatePipeline(const VideoCommon::GXPipelineUid& ui
class PipelineWorkItem final : public VideoCommon::AsyncShaderCompiler::WorkItem
{
public:
PipelineWorkItem(CustomShaderCache* shader_cache, const VideoCommon::GXPipelineUid& uid,
const CustomShaderInstance& custom_shaders, PipelineIterator iterator,
const AbstractPipelineConfig& pipeline_config)
: m_shader_cache(shader_cache), m_uid(uid), m_iterator(iterator), m_config(pipeline_config),
m_custom_shaders(custom_shaders)
PipelineWorkItem(CustomShaderCache* shader_cache, VideoCommon::GXPipelineUid uid,
CustomShaderInstance custom_shaders, PipelineIterator iterator,
AbstractPipelineConfig pipeline_config)
: m_shader_cache(shader_cache), m_uid(std::move(uid)), m_iterator(iterator),
m_config(std::move(pipeline_config)), m_custom_shaders(std::move(custom_shaders))
{
SetStagesReady();
}
@@ -184,11 +186,11 @@ void CustomShaderCache::AsyncCreatePipeline(const VideoCommon::GXUberPipelineUid
class PipelineWorkItem final : public VideoCommon::AsyncShaderCompiler::WorkItem
{
public:
PipelineWorkItem(CustomShaderCache* shader_cache, const VideoCommon::GXUberPipelineUid& uid,
const CustomShaderInstance& custom_shaders, UberPipelineIterator iterator,
const AbstractPipelineConfig& pipeline_config)
: m_shader_cache(shader_cache), m_uid(uid), m_iterator(iterator), m_config(pipeline_config),
m_custom_shaders(custom_shaders)
PipelineWorkItem(CustomShaderCache* shader_cache, VideoCommon::GXUberPipelineUid uid,
CustomShaderInstance custom_shaders, UberPipelineIterator iterator,
AbstractPipelineConfig pipeline_config)
: m_shader_cache(shader_cache), m_uid(std::move(uid)), m_iterator(iterator),
m_config(std::move(pipeline_config)), m_custom_shaders(std::move(custom_shaders))
{
SetStagesReady();
}
@@ -281,8 +283,9 @@ void CustomShaderCache::QueuePixelShaderCompile(const PixelShaderUid& uid,
{
public:
PixelShaderWorkItem(CustomShaderCache* shader_cache, const PixelShaderUid& uid,
const CustomShaderInstance& custom_shaders, PixelShaderIterator iter)
: m_shader_cache(shader_cache), m_uid(uid), m_custom_shaders(custom_shaders), m_iter(iter)
CustomShaderInstance custom_shaders, PixelShaderIterator iter)
: m_shader_cache(shader_cache), m_uid(uid), m_custom_shaders(std::move(custom_shaders)),
m_iter(iter)
{
}
@@ -319,8 +322,9 @@ void CustomShaderCache::QueuePixelShaderCompile(const UberShader::PixelShaderUid
{
public:
PixelShaderWorkItem(CustomShaderCache* shader_cache, const UberShader::PixelShaderUid& uid,
const CustomShaderInstance& custom_shaders, UberPixelShaderIterator iter)
: m_shader_cache(shader_cache), m_uid(uid), m_custom_shaders(custom_shaders), m_iter(iter)
CustomShaderInstance custom_shaders, UberPixelShaderIterator iter)
: m_shader_cache(shader_cache), m_uid(uid), m_custom_shaders(std::move(custom_shaders)),
m_iter(iter)
{
}