mirror of
https://github.com/PabloMK7/citra.git
synced 2025-09-12 05:40:04 +00:00
misc: fix issues pointed out by msvc (#7316)
* do not move constant variables
* applet_manager: avoid possible use after move
* use constant references where pointed out by msvc
* extra_hid: initialize response
* ValidateSaveState: passing slot separately is not necessary
* common: mark HashCombine as nodiscard
* cityhash: remove use of using namespace std
* Prefix all size_t with std::
done automatically by executing regex replace `([^:0-9a-zA-Z_])size_t([^0-9a-zA-Z_])` -> `$1std::size_t$2`
based on 7d8f115
* shared_memory.cpp: fix log error format
* fix compiling with pch off
This commit is contained in:
parent
6069fac76d
commit
c8c2beaeff
73 changed files with 181 additions and 167 deletions
|
@ -207,7 +207,7 @@ void CustomTexManager::PrepareDumping(u64 title_id) {
|
|||
void CustomTexManager::PreloadTextures(const std::atomic_bool& stop_run,
|
||||
const VideoCore::DiskResourceLoadCallback& callback) {
|
||||
u64 size_sum = 0;
|
||||
size_t preloaded = 0;
|
||||
std::size_t preloaded = 0;
|
||||
const u64 sys_mem = Common::GetMemInfo().total_physical_memory;
|
||||
const u64 recommended_min_mem = 2_GiB;
|
||||
|
||||
|
@ -343,7 +343,7 @@ bool CustomTexManager::ReadConfig(u64 title_id, bool options_only) {
|
|||
|
||||
const auto& textures = json["textures"];
|
||||
for (const auto& material : textures.items()) {
|
||||
size_t idx{};
|
||||
std::size_t idx{};
|
||||
const u64 hash = std::stoull(material.key(), &idx, 16);
|
||||
if (!idx) {
|
||||
LOG_ERROR(Render, "Key {} is invalid, skipping", material.key());
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
#include "common/logging/log.h"
|
||||
#include "core/hle/service/gsp/gsp_command.h"
|
||||
|
||||
namespace VideoCore {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "common/common_funcs.h"
|
||||
#include "common/vector_math.h"
|
||||
#include "video_core/pica_types.h"
|
||||
|
||||
|
|
|
@ -398,7 +398,7 @@ void PicaCore::SubmitImmediate(u32 value) {
|
|||
return;
|
||||
}
|
||||
|
||||
constexpr size_t IMMEDIATE_MODE_INDEX = 0xF;
|
||||
constexpr std::size_t IMMEDIATE_MODE_INDEX = 0xF;
|
||||
|
||||
auto& setup = regs.internal.pipeline.vs_default_attributes_setup;
|
||||
if (setup.index > IMMEDIATE_MODE_INDEX) {
|
||||
|
|
|
@ -53,7 +53,7 @@ private:
|
|||
|
||||
public:
|
||||
union Regs {
|
||||
static constexpr size_t NUM_REGS = 0x732;
|
||||
static constexpr std::size_t NUM_REGS = 0x732;
|
||||
|
||||
struct {
|
||||
u32 hardware_id;
|
||||
|
|
|
@ -4,7 +4,12 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <string>
|
||||
#include "common/assert.h"
|
||||
#include "common/bit_field.h"
|
||||
#include "common/common_funcs.h"
|
||||
|
||||
namespace Pica {
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include "common/assert.h"
|
||||
#include "common/bit_field.h"
|
||||
#include "common/common_funcs.h"
|
||||
#include "common/math_util.h"
|
||||
|
|
|
@ -2,8 +2,10 @@
|
|||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "common/assert.h"
|
||||
#include "common/bit_set.h"
|
||||
#include "common/hash.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "video_core/pica/regs_shader.h"
|
||||
#include "video_core/pica/shader_setup.h"
|
||||
|
||||
|
|
|
@ -21,15 +21,15 @@ struct Uniforms {
|
|||
std::array<bool, 16> b;
|
||||
std::array<Common::Vec4<u8>, 4> i;
|
||||
|
||||
static size_t GetFloatUniformOffset(u32 index) {
|
||||
static std::size_t GetFloatUniformOffset(u32 index) {
|
||||
return offsetof(Uniforms, f) + index * sizeof(Common::Vec4<f24>);
|
||||
}
|
||||
|
||||
static size_t GetBoolUniformOffset(u32 index) {
|
||||
static std::size_t GetBoolUniformOffset(u32 index) {
|
||||
return offsetof(Uniforms, b) + index * sizeof(bool);
|
||||
}
|
||||
|
||||
static size_t GetIntUniformOffset(u32 index) {
|
||||
static std::size_t GetIntUniformOffset(u32 index) {
|
||||
return offsetof(Uniforms, i) + index * sizeof(Common::Vec4<u8>);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "common/assert.h"
|
||||
#include "common/bit_set.h"
|
||||
#include "video_core/pica/regs_shader.h"
|
||||
#include "video_core/pica/shader_unit.h"
|
||||
|
|
|
@ -33,15 +33,15 @@ struct ShaderUnit {
|
|||
|
||||
void WriteOutput(const ShaderRegs& config, AttributeBuffer& output);
|
||||
|
||||
static constexpr size_t InputOffset(s32 register_index) {
|
||||
static constexpr std::size_t InputOffset(s32 register_index) {
|
||||
return offsetof(ShaderUnit, input) + register_index * sizeof(Common::Vec4<f24>);
|
||||
}
|
||||
|
||||
static constexpr size_t OutputOffset(s32 register_index) {
|
||||
static constexpr std::size_t OutputOffset(s32 register_index) {
|
||||
return offsetof(ShaderUnit, output) + register_index * sizeof(Common::Vec4<f24>);
|
||||
}
|
||||
|
||||
static constexpr size_t TemporaryOffset(s32 register_index) {
|
||||
static constexpr std::size_t TemporaryOffset(s32 register_index) {
|
||||
return offsetof(ShaderUnit, temporary) + register_index * sizeof(Common::Vec4<f24>);
|
||||
}
|
||||
|
||||
|
|
|
@ -710,7 +710,7 @@ void RasterizerAccelerated::SyncCombinerColor() {
|
|||
}
|
||||
|
||||
void RasterizerAccelerated::SyncTevConstColor(
|
||||
const size_t stage_index, const Pica::TexturingRegs::TevStageConfig& tev_stage) {
|
||||
const std::size_t stage_index, const Pica::TexturingRegs::TevStageConfig& tev_stage) {
|
||||
const auto const_color = ColorRGBA8(tev_stage.const_color);
|
||||
|
||||
if (const_color == fs_uniform_block_data.data.const_color[stage_index]) {
|
||||
|
|
|
@ -777,7 +777,7 @@ typename RasterizerCache<T>::SurfaceRect_Tuple RasterizerCache<T>::GetTexCopySur
|
|||
|
||||
template <class T>
|
||||
template <typename Func>
|
||||
void RasterizerCache<T>::ForEachSurfaceInRegion(PAddr addr, size_t size, Func&& func) {
|
||||
void RasterizerCache<T>::ForEachSurfaceInRegion(PAddr addr, std::size_t size, Func&& func) {
|
||||
using FuncReturn = typename std::invoke_result<Func, SurfaceId, Surface&>::type;
|
||||
static constexpr bool BOOL_BREAK = std::is_same_v<FuncReturn, bool>;
|
||||
boost::container::small_vector<SurfaceId, 8> surfaces;
|
||||
|
|
|
@ -139,7 +139,7 @@ public:
|
|||
private:
|
||||
/// Iterate over all page indices in a range
|
||||
template <typename Func>
|
||||
void ForEachPage(PAddr addr, size_t size, Func&& func) {
|
||||
void ForEachPage(PAddr addr, std::size_t size, Func&& func) {
|
||||
static constexpr bool RETURNS_BOOL = std::is_same_v<std::invoke_result<Func, u64>, bool>;
|
||||
const u64 page_end = (addr + size - 1) >> CITRA_PAGEBITS;
|
||||
for (u64 page = addr >> CITRA_PAGEBITS; page <= page_end; ++page) {
|
||||
|
@ -155,7 +155,7 @@ private:
|
|||
|
||||
/// Iterates over all the surfaces in a region calling func
|
||||
template <typename Func>
|
||||
void ForEachSurfaceInRegion(PAddr addr, size_t size, Func&& func);
|
||||
void ForEachSurfaceInRegion(PAddr addr, std::size_t size, Func&& func);
|
||||
|
||||
/// Get the best surface match (and its match type) for the given flags
|
||||
template <MatchFlags find_flags>
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
/// Returns true if the surface contains a custom material with a normal map.
|
||||
bool HasNormalMap() const noexcept;
|
||||
|
||||
bool Overlaps(PAddr overlap_addr, size_t overlap_size) const noexcept {
|
||||
bool Overlaps(PAddr overlap_addr, std::size_t overlap_size) const noexcept {
|
||||
const PAddr overlap_end = overlap_addr + static_cast<PAddr>(overlap_size);
|
||||
return addr < overlap_end && overlap_addr < end;
|
||||
}
|
||||
|
|
|
@ -310,7 +310,7 @@ void RendererOpenGL::InitOpenGLObjects() {
|
|||
glClearColor(Settings::values.bg_red.GetValue(), Settings::values.bg_green.GetValue(),
|
||||
Settings::values.bg_blue.GetValue(), 0.0f);
|
||||
|
||||
for (size_t i = 0; i < samplers.size(); i++) {
|
||||
for (std::size_t i = 0; i < samplers.size(); i++) {
|
||||
samplers[i].Create();
|
||||
glSamplerParameteri(samplers[i].handle, GL_TEXTURE_MIN_FILTER,
|
||||
i == 0 ? GL_NEAREST : GL_LINEAR);
|
||||
|
|
|
@ -78,12 +78,12 @@ void SwBlitter::TextureCopy(const Pica::DisplayTransferConfig& config) {
|
|||
return;
|
||||
}
|
||||
|
||||
const size_t contiguous_input_size =
|
||||
const std::size_t contiguous_input_size =
|
||||
config.texture_copy.size / input_width * (input_width + input_gap);
|
||||
rasterizer->FlushRegion(config.GetPhysicalInputAddress(),
|
||||
static_cast<u32>(contiguous_input_size));
|
||||
|
||||
const size_t contiguous_output_size =
|
||||
const std::size_t contiguous_output_size =
|
||||
config.texture_copy.size / output_width * (output_width + output_gap);
|
||||
|
||||
// Only need to flush output if it has a gap
|
||||
|
@ -329,7 +329,7 @@ void SwBlitter::MemoryFill(const Pica::MemoryFillConfig& config) {
|
|||
// Fill with 32-bit values
|
||||
if (end > start) {
|
||||
const u32 value = config.value_32bit;
|
||||
const size_t len = (end - start) / sizeof(u32);
|
||||
const std::size_t len = (end - start) / sizeof(u32);
|
||||
for (std::size_t i = 0; i < len; ++i) {
|
||||
std::memcpy(&start[i * sizeof(u32)], &value, sizeof(u32));
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ private:
|
|||
Memory::MemorySystem& memory;
|
||||
Pica::PicaCore& pica;
|
||||
Pica::RegsInternal& regs;
|
||||
size_t num_sw_threads;
|
||||
std::size_t num_sw_threads;
|
||||
Common::ThreadWorker sw_workers;
|
||||
Framebuffer fb;
|
||||
};
|
||||
|
|
|
@ -691,7 +691,7 @@ void Instance::CollectToolingInfo() {
|
|||
|
||||
bool Instance::SetMoltenVkConfig() {
|
||||
#ifdef __APPLE__
|
||||
size_t mvk_config_size = sizeof(MVKConfiguration);
|
||||
std::size_t mvk_config_size = sizeof(MVKConfiguration);
|
||||
MVKConfiguration mvk_config{};
|
||||
|
||||
const auto _vkGetMoltenVKConfigurationMVK =
|
||||
|
|
|
@ -543,7 +543,7 @@ void PipelineCache::BindTexelBuffer(u32 binding, vk::BufferView buffer_view) {
|
|||
}
|
||||
}
|
||||
|
||||
void PipelineCache::SetBufferOffset(u32 binding, size_t offset) {
|
||||
void PipelineCache::SetBufferOffset(u32 binding, std::size_t offset) {
|
||||
if (offsets[binding] != static_cast<u32>(offset)) {
|
||||
offsets[binding] = static_cast<u32>(offset);
|
||||
set_dirty[0] = true;
|
||||
|
|
|
@ -79,7 +79,7 @@ public:
|
|||
void BindTexelBuffer(u32 binding, vk::BufferView buffer_view);
|
||||
|
||||
/// Sets the dynamic offset for the uniform buffer at binding
|
||||
void SetBufferOffset(u32 binding, size_t offset);
|
||||
void SetBufferOffset(u32 binding, std::size_t offset);
|
||||
|
||||
private:
|
||||
/// Builds the rasterizer pipeline layout
|
||||
|
|
|
@ -63,7 +63,7 @@ static VKAPI_ATTR VkBool32 VKAPI_CALL DebugUtilsCallback(
|
|||
|
||||
static VKAPI_ATTR VkBool32 VKAPI_CALL DebugReportCallback(VkDebugReportFlagsEXT flags,
|
||||
VkDebugReportObjectTypeEXT objectType,
|
||||
uint64_t object, size_t location,
|
||||
uint64_t object, std::size_t location,
|
||||
int32_t messageCode,
|
||||
const char* pLayerPrefix,
|
||||
const char* pMessage, void* pUserData) {
|
||||
|
|
|
@ -235,7 +235,7 @@ void RasterizerVulkan::SetupVertexArray() {
|
|||
if (aligned_stride == loader.byte_count) {
|
||||
std::memcpy(dst_ptr, src_ptr, data_size);
|
||||
} else {
|
||||
for (size_t vertex = 0; vertex < vertex_num; vertex++) {
|
||||
for (std::size_t vertex = 0; vertex < vertex_num; vertex++) {
|
||||
std::memcpy(dst_ptr + vertex * aligned_stride, src_ptr + vertex * loader.byte_count,
|
||||
loader.byte_count);
|
||||
}
|
||||
|
|
|
@ -35,8 +35,8 @@ struct RenderPass {
|
|||
};
|
||||
|
||||
class RenderpassCache {
|
||||
static constexpr size_t MAX_COLOR_FORMATS = 13;
|
||||
static constexpr size_t MAX_DEPTH_FORMATS = 4;
|
||||
static constexpr std::size_t MAX_COLOR_FORMATS = 13;
|
||||
static constexpr std::size_t MAX_DEPTH_FORMATS = 4;
|
||||
|
||||
public:
|
||||
explicit RenderpassCache(const Instance& instance, Scheduler& scheduler);
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
namespace Vulkan {
|
||||
|
||||
ResourcePool::ResourcePool(MasterSemaphore* master_semaphore_, size_t grow_step_)
|
||||
ResourcePool::ResourcePool(MasterSemaphore* master_semaphore_, std::size_t grow_step_)
|
||||
: master_semaphore{master_semaphore_}, grow_step{grow_step_} {}
|
||||
|
||||
std::size_t ResourcePool::CommitResource() {
|
||||
|
@ -57,12 +57,12 @@ std::size_t ResourcePool::ManageOverflow() {
|
|||
}
|
||||
|
||||
void ResourcePool::Grow() {
|
||||
const size_t old_capacity = ticks.size();
|
||||
const std::size_t old_capacity = ticks.size();
|
||||
ticks.resize(old_capacity + grow_step);
|
||||
Allocate(old_capacity, old_capacity + grow_step);
|
||||
}
|
||||
|
||||
constexpr size_t COMMAND_BUFFER_POOL_SIZE = 4;
|
||||
constexpr std::size_t COMMAND_BUFFER_POOL_SIZE = 4;
|
||||
|
||||
struct CommandPool::Pool {
|
||||
vk::CommandPool handle;
|
||||
|
|
|
@ -119,9 +119,9 @@ u32 UnpackDepthStencil(const VideoCore::StagingData& data, vk::Format dest) {
|
|||
}
|
||||
|
||||
boost::container::small_vector<vk::ImageMemoryBarrier, 3> MakeInitBarriers(
|
||||
vk::ImageAspectFlags aspect, std::span<const vk::Image> images, size_t num_images) {
|
||||
vk::ImageAspectFlags aspect, std::span<const vk::Image> images, std::size_t num_images) {
|
||||
boost::container::small_vector<vk::ImageMemoryBarrier, 3> barriers;
|
||||
for (size_t i = 0; i < num_images; i++) {
|
||||
for (std::size_t i = 0; i < num_images; i++) {
|
||||
barriers.push_back(vk::ImageMemoryBarrier{
|
||||
.srcAccessMask = vk::AccessFlagBits::eNone,
|
||||
.dstAccessMask = vk::AccessFlagBits::eNone,
|
||||
|
|
|
@ -12,7 +12,7 @@ using ProcTexCombiner = TexturingRegs::ProcTexCombiner;
|
|||
using ProcTexFilter = TexturingRegs::ProcTexFilter;
|
||||
using TextureType = Pica::TexturingRegs::TextureConfig::TextureType;
|
||||
|
||||
constexpr static size_t RESERVE_SIZE = 8 * 1024 * 1024;
|
||||
constexpr static std::size_t RESERVE_SIZE = 8 * 1024 * 1024;
|
||||
|
||||
enum class Semantic : u32 {
|
||||
Position,
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include "common/common_types.h"
|
||||
|
||||
namespace Pica {
|
||||
|
|
|
@ -968,7 +968,7 @@ void JitShader::Compile(const std::array<u32, MAX_PROGRAM_CODE_LENGTH>* program_
|
|||
protect();
|
||||
invalidate_all();
|
||||
|
||||
const size_t code_size =
|
||||
const std::size_t code_size =
|
||||
current_address() - reinterpret_cast<uintptr_t>(oaknut::CodeBlock::ptr());
|
||||
|
||||
ASSERT_MSG(code_size <= MAX_SHADER_SIZE, "Compiled a shader that exceeds the allocated size!");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue