1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-25 04:02:42 +01:00

Use requires syntax in more places

Change style in some places.
This commit is contained in:
Nekotekina 2021-04-19 14:22:03 +03:00
parent 7dae376646
commit 0c9c481cee
10 changed files with 50 additions and 68 deletions

View File

@ -480,8 +480,7 @@ class named_thread final : public Context, result_storage<Context>, thread_base
public:
// Default constructor
template <bool Valid = std::is_default_constructible_v<Context> && thread_thread_name<Context>(), typename = std::enable_if_t<Valid>>
named_thread()
named_thread() requires (std::is_default_constructible_v<Context>) && (thread_thread_name<Context>::value)
: Context()
, thread(trampoline, Context::thread_name)
{

View File

@ -80,13 +80,13 @@ struct ppu_module
ppu_module& operator=(ppu_module&&) = default;
uchar sha1[20]{};
std::string name;
std::string path;
std::string cache;
std::vector<ppu_reloc> relocs;
std::vector<ppu_segment> segs;
std::vector<ppu_segment> secs;
std::vector<ppu_function> funcs;
std::string name{};
std::string path{};
std::string cache{};
std::vector<ppu_reloc> relocs{};
std::vector<ppu_segment> segs{};
std::vector<ppu_segment> secs{};
std::vector<ppu_function> funcs{};
// Copy info without functions
void copy_part(const ppu_module& info)

View File

@ -114,20 +114,20 @@ struct ppu_linkage_info
ppu_static_function* static_func = nullptr;
ppu_static_variable* static_var = nullptr;
u32 export_addr = 0;
std::set<u32> imports;
std::set<u32> frefss;
std::set<u32> imports{};
std::set<u32> frefss{};
};
// FNID -> (export; [imports...])
std::unordered_map<u32, info, value_hash<u32>> functions;
std::unordered_map<u32, info, value_hash<u32>> variables;
std::unordered_map<u32, info, value_hash<u32>> functions{};
std::unordered_map<u32, info, value_hash<u32>> variables{};
// Obsolete
bool imported = false;
};
// Module map
std::unordered_map<std::string, module_data> modules;
std::unordered_map<std::string, module_data> modules{};
};
// Initialize static modules.

View File

@ -75,8 +75,8 @@ class ppu_static_module final
public:
const std::string name;
std::unordered_map<u32, ppu_static_function, value_hash<u32>> functions;
std::unordered_map<u32, ppu_static_variable, value_hash<u32>> variables;
std::unordered_map<u32, ppu_static_function, value_hash<u32>> functions{};
std::unordered_map<u32, ppu_static_variable, value_hash<u32>> variables{};
public:
ppu_static_module(const char* name);

View File

@ -41,8 +41,8 @@ namespace rsx
struct replay_command
{
std::pair<u32, u32> rsx_command; // fifo command
std::unordered_set<u64> memory_state; // index into memory_map for the various memory blocks that need applying before this command can run
std::pair<u32, u32> rsx_command{}; // fifo command
std::unordered_set<u64> memory_state{}; // index into memory_map for the various memory blocks that need applying before this command can run
u64 tile_state{0}; // tile state for this command
u64 display_buffer_state{0};

View File

@ -256,16 +256,13 @@ namespace rsx
struct vertex_input_layout
{
std::vector<interleaved_range_info> interleaved_blocks; // Interleaved blocks to be uploaded as-is
std::vector<std::pair<u8, u32>> volatile_blocks; // Volatile data blocks (immediate draw vertex data for example)
rsx::simple_array<u8> referenced_registers; // Volatile register data
std::vector<interleaved_range_info> interleaved_blocks{}; // Interleaved blocks to be uploaded as-is
std::vector<std::pair<u8, u32>> volatile_blocks{}; // Volatile data blocks (immediate draw vertex data for example)
rsx::simple_array<u8> referenced_registers{}; // Volatile register data
std::array<attribute_buffer_placement, 16> attribute_placement;
std::array<attribute_buffer_placement, 16> attribute_placement = fill_array(attribute_buffer_placement::none);
vertex_input_layout()
{
attribute_placement.fill(attribute_buffer_placement::none);
}
vertex_input_layout() = default;
void clear()
{
@ -408,7 +405,7 @@ namespace rsx
bool host_queries_active = false; // The backend/host is gathering Z data for the ZCULL unit
std::array<occlusion_query_info, 1024> m_occlusion_query_data = {};
std::stack<occlusion_query_info*> m_free_occlusion_pool;
std::stack<occlusion_query_info*> m_free_occlusion_pool{};
occlusion_query_info* m_current_task = nullptr;
u32 m_statistics_tag_id = 0;
@ -421,8 +418,8 @@ namespace rsx
u64 m_sync_tag = 0;
u64 m_timer = 0;
std::vector<queued_report_write> m_pending_writes;
std::unordered_map<u32, u32> m_statistics_map;
std::vector<queued_report_write> m_pending_writes{};
std::unordered_map<u32, u32> m_statistics_map{};
// Enables/disables the ZCULL unit
void set_active(class ::rsx::thread* ptimer, bool state, bool flush_queue);
@ -446,7 +443,10 @@ namespace rsx
public:
ZCULL_control();
~ZCULL_control();
virtual ~ZCULL_control();
ZCULL_control(const ZCULL_control&) = delete;
ZCULL_control& operator=(const ZCULL_control&) = delete;
void set_enabled(class ::rsx::thread* ptimer, bool state, bool flush_queue = false);
void set_status(class ::rsx::thread* ptimer, bool surface_active, bool zpass_active, bool zcull_stats_active, bool flush_queue = false);
@ -804,6 +804,9 @@ namespace rsx
void run_FIFO();
public:
thread(const thread&) = delete;
thread& operator=(const thread&) = delete;
virtual void clear_surface(u32 /*arg*/) {}
virtual void begin();
virtual void end();

View File

@ -99,7 +99,7 @@ struct elf_phdr<en_t, u32>
template<template<typename T> class en_t, typename sz_t>
struct elf_prog final : elf_phdr<en_t, sz_t>
{
std::vector<uchar> bin;
std::vector<uchar> bin{};
using base = elf_phdr<en_t, sz_t>;
@ -180,8 +180,8 @@ public:
ehdr_t header{};
std::vector<prog_t> progs;
std::vector<shdr_t> shdrs;
std::vector<prog_t> progs{};
std::vector<shdr_t> shdrs{};
public:
elf_object() = default;

View File

@ -22,7 +22,7 @@ class tar_object
const fs::file& m_file;
usz largest_offset = 0; // We store the largest offset so we can continue to scan from there.
std::map<std::string, std::pair<u64, TARHeader>> m_map; // Maps path to offset of file data and its header
std::map<std::string, std::pair<u64, TARHeader>> m_map{}; // Maps path to offset of file data and its header
TARHeader read_header(u64 offset) const;

View File

@ -78,6 +78,8 @@ class TROPUSRLoader
virtual bool LoadTables();
public:
virtual ~TROPUSRLoader() = default;
virtual bool Load(const std::string& filepath, const std::string& configpath);
virtual bool Save(const std::string& filepath);

View File

@ -97,13 +97,13 @@ namespace stx
atomic_t<usz> refs{1};
};
template <usz Size, usz Align, typename = void>
template <usz Size, usz Align>
struct align_filler
{
};
template <usz Size, usz Align>
struct align_filler<Size, Align, std::enable_if_t<(Align > Size)>>
template <usz Size, usz Align> requires (Align > Size)
struct align_filler<Size, Align>
{
char dummy[Align - Size];
};
@ -236,30 +236,19 @@ namespace stx
return m_ptr;
}
decltype(auto) operator*() const noexcept
{
if constexpr (std::is_void_v<element_type>)
{
return;
}
else
decltype(auto) operator*() const noexcept requires (!std::is_void_v<element_type>)
{
return *m_ptr;
}
}
element_type* operator->() const noexcept
{
return m_ptr;
}
decltype(auto) operator[](std::ptrdiff_t idx) const noexcept
decltype(auto) operator[](std::ptrdiff_t idx) const noexcept requires (!std::is_void_v<element_type>)
{
if constexpr (std::is_void_v<element_type>)
{
return;
}
else if constexpr (std::is_array_v<T>)
if constexpr (std::is_array_v<T>)
{
return m_ptr[idx];
}
@ -572,30 +561,19 @@ namespace stx
return m_ptr;
}
decltype(auto) operator*() const noexcept
{
if constexpr (std::is_void_v<element_type>)
{
return;
}
else
decltype(auto) operator*() const noexcept requires (!std::is_void_v<element_type>)
{
return *m_ptr;
}
}
element_type* operator->() const noexcept
{
return m_ptr;
}
decltype(auto) operator[](std::ptrdiff_t idx) const noexcept
decltype(auto) operator[](std::ptrdiff_t idx) const noexcept requires (!std::is_void_v<element_type>)
{
if constexpr (std::is_void_v<element_type>)
{
return;
}
else if constexpr (std::is_array_v<T>)
if constexpr (std::is_array_v<T>)
{
return m_ptr[idx];
}