1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-25 12:12:50 +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: public:
// Default constructor // Default constructor
template <bool Valid = std::is_default_constructible_v<Context> && thread_thread_name<Context>(), typename = std::enable_if_t<Valid>> named_thread() requires (std::is_default_constructible_v<Context>) && (thread_thread_name<Context>::value)
named_thread()
: Context() : Context()
, thread(trampoline, Context::thread_name) , thread(trampoline, Context::thread_name)
{ {

View File

@ -80,13 +80,13 @@ struct ppu_module
ppu_module& operator=(ppu_module&&) = default; ppu_module& operator=(ppu_module&&) = default;
uchar sha1[20]{}; uchar sha1[20]{};
std::string name; std::string name{};
std::string path; std::string path{};
std::string cache; std::string cache{};
std::vector<ppu_reloc> relocs; std::vector<ppu_reloc> relocs{};
std::vector<ppu_segment> segs; std::vector<ppu_segment> segs{};
std::vector<ppu_segment> secs; std::vector<ppu_segment> secs{};
std::vector<ppu_function> funcs; std::vector<ppu_function> funcs{};
// Copy info without functions // Copy info without functions
void copy_part(const ppu_module& info) 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_function* static_func = nullptr;
ppu_static_variable* static_var = nullptr; ppu_static_variable* static_var = nullptr;
u32 export_addr = 0; u32 export_addr = 0;
std::set<u32> imports; std::set<u32> imports{};
std::set<u32> frefss; std::set<u32> frefss{};
}; };
// FNID -> (export; [imports...]) // FNID -> (export; [imports...])
std::unordered_map<u32, info, value_hash<u32>> functions; 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>> variables{};
// Obsolete // Obsolete
bool imported = false; bool imported = false;
}; };
// Module map // Module map
std::unordered_map<std::string, module_data> modules; std::unordered_map<std::string, module_data> modules{};
}; };
// Initialize static modules. // Initialize static modules.

View File

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

View File

@ -41,8 +41,8 @@ namespace rsx
struct replay_command struct replay_command
{ {
std::pair<u32, u32> rsx_command; // fifo 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::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 tile_state{0}; // tile state for this command
u64 display_buffer_state{0}; u64 display_buffer_state{0};

View File

@ -256,16 +256,13 @@ namespace rsx
struct vertex_input_layout struct vertex_input_layout
{ {
std::vector<interleaved_range_info> interleaved_blocks; // Interleaved blocks to be uploaded as-is 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) 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 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() vertex_input_layout() = default;
{
attribute_placement.fill(attribute_buffer_placement::none);
}
void clear() void clear()
{ {
@ -408,7 +405,7 @@ namespace rsx
bool host_queries_active = false; // The backend/host is gathering Z data for the ZCULL unit 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::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; occlusion_query_info* m_current_task = nullptr;
u32 m_statistics_tag_id = 0; u32 m_statistics_tag_id = 0;
@ -421,8 +418,8 @@ namespace rsx
u64 m_sync_tag = 0; u64 m_sync_tag = 0;
u64 m_timer = 0; u64 m_timer = 0;
std::vector<queued_report_write> m_pending_writes; std::vector<queued_report_write> m_pending_writes{};
std::unordered_map<u32, u32> m_statistics_map; std::unordered_map<u32, u32> m_statistics_map{};
// Enables/disables the ZCULL unit // Enables/disables the ZCULL unit
void set_active(class ::rsx::thread* ptimer, bool state, bool flush_queue); void set_active(class ::rsx::thread* ptimer, bool state, bool flush_queue);
@ -446,7 +443,10 @@ namespace rsx
public: public:
ZCULL_control(); 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_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); 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(); void run_FIFO();
public: public:
thread(const thread&) = delete;
thread& operator=(const thread&) = delete;
virtual void clear_surface(u32 /*arg*/) {} virtual void clear_surface(u32 /*arg*/) {}
virtual void begin(); virtual void begin();
virtual void end(); 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> template<template<typename T> class en_t, typename sz_t>
struct elf_prog final : elf_phdr<en_t, 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>; using base = elf_phdr<en_t, sz_t>;
@ -180,8 +180,8 @@ public:
ehdr_t header{}; ehdr_t header{};
std::vector<prog_t> progs; std::vector<prog_t> progs{};
std::vector<shdr_t> shdrs; std::vector<shdr_t> shdrs{};
public: public:
elf_object() = default; elf_object() = default;

View File

@ -22,7 +22,7 @@ class tar_object
const fs::file& m_file; const fs::file& m_file;
usz largest_offset = 0; // We store the largest offset so we can continue to scan from there. 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; TARHeader read_header(u64 offset) const;

View File

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

View File

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