From d715836c40dd254a0bc326b3607a1561e8f57118 Mon Sep 17 00:00:00 2001 From: scribam Date: Sat, 13 Mar 2021 12:44:59 +0100 Subject: [PATCH 1/6] clang-tidy: run modernize-use-override --- core/archive/7zArchive.h | 10 +- core/archive/ZipArchive.h | 12 +-- core/cfg/option.h | 10 +- core/hw/flashrom/flashrom.h | 10 +- core/hw/maple/maple_devs.cpp | 78 +++++++------- core/hw/maple/maple_devs.h | 14 +-- core/hw/maple/maple_jvs.cpp | 30 +++--- core/hw/naomi/awcartridge.h | 18 ++-- core/hw/naomi/gdcartridge.h | 12 +-- core/hw/naomi/m1cartridge.h | 12 +-- core/hw/naomi/m4cartridge.h | 24 ++--- core/hw/naomi/naomi_cart.h | 24 ++--- core/imgread/chd.cpp | 4 +- core/imgread/common.h | 4 +- core/imgread/ioctl.cpp | 2 +- core/log/ConsoleListener.h | 2 +- core/rec-x64/rec_x64.cpp | 4 +- core/rec-x64/x64_regalloc.h | 8 +- core/rend/gles/gles.h | 10 +- core/rend/vulkan/drawer.h | 10 +- core/rend/vulkan/oit/oit_drawer.h | 16 +-- core/rend/vulkan/oit/oit_renderpass.h | 6 +- core/rend/vulkan/texture.h | 2 +- core/rend/vulkan/vk_mem_alloc.h | 148 +++++++++++++------------- core/rend/vulkan/vulkan_renderer.h | 8 +- core/windows/win_keyboard.h | 4 +- core/windows/xinput_gamepad.h | 12 +-- 27 files changed, 247 insertions(+), 247 deletions(-) diff --git a/core/archive/7zArchive.h b/core/archive/7zArchive.h index 1e6e9ba60..797f1bb45 100644 --- a/core/archive/7zArchive.h +++ b/core/archive/7zArchive.h @@ -33,13 +33,13 @@ public: memset(&archiveStream, 0, sizeof(archiveStream)); memset(&lookStream, 0, sizeof(lookStream)); } - virtual ~SzArchive(); + ~SzArchive() override; - virtual ArchiveFile* OpenFile(const char* name) override; - virtual ArchiveFile *OpenFileByCrc(u32 crc) override; + ArchiveFile* OpenFile(const char* name) override; + ArchiveFile *OpenFileByCrc(u32 crc) override; private: - virtual bool Open(const char* path) override; + bool Open(const char* path) override; CSzArEx szarchive; UInt32 block_idx; /* it can have any value before first call (if outBuffer = 0) */ @@ -54,7 +54,7 @@ class SzArchiveFile : public ArchiveFile { public: SzArchiveFile(u8 *data, u32 offset, u32 length) : data(data), offset(offset), length(length) {} - virtual u32 Read(void *buffer, u32 length) override + u32 Read(void *buffer, u32 length) override { length = std::min(length, this->length); memcpy(buffer, data + offset, length); diff --git a/core/archive/ZipArchive.h b/core/archive/ZipArchive.h index 14b066941..d14dca812 100644 --- a/core/archive/ZipArchive.h +++ b/core/archive/ZipArchive.h @@ -27,13 +27,13 @@ class ZipArchive : public Archive { public: ZipArchive() : zip(NULL) {} - virtual ~ZipArchive(); + ~ZipArchive() override; - virtual ArchiveFile* OpenFile(const char* name) override; - virtual ArchiveFile* OpenFileByCrc(u32 crc) override; + ArchiveFile* OpenFile(const char* name) override; + ArchiveFile* OpenFileByCrc(u32 crc) override; private: - virtual bool Open(const char* path) override; + bool Open(const char* path) override; struct zip *zip; }; @@ -42,8 +42,8 @@ class ZipArchiveFile : public ArchiveFile { public: ZipArchiveFile(struct zip_file *zip_file) : zip_file(zip_file) {} - virtual ~ZipArchiveFile() { zip_fclose(zip_file); } - virtual u32 Read(void* buffer, u32 length) override; + ~ZipArchiveFile() override { zip_fclose(zip_file); } + u32 Read(void* buffer, u32 length) override; private: struct zip_file *zip_file; diff --git a/core/cfg/option.h b/core/cfg/option.h index 5bf18ccc5..d3316e159 100644 --- a/core/cfg/option.h +++ b/core/cfg/option.h @@ -110,12 +110,12 @@ public: settings.options.push_back(this); } - virtual void reset() override { + void reset() override { set(defaultValue); overridden = false; } - virtual void load() override { + void load() override { if (PerGameOption && settings.hasPerGameConfig()) set(doLoad(settings.getGameId(), section + "." + name)); else @@ -126,7 +126,7 @@ public: } } - virtual void save() const override + void save() const override { if (overridden) { if (value == overriddenDefault) @@ -320,14 +320,14 @@ public: } RenderType& operator=(const RenderType& v) { set(v); return value; } - virtual void load() override { + void load() override { RenderType current = value; Option::load(); newValue = value; value = current; } - virtual void reset() override { + void reset() override { RenderType current = value; Option::reset(); newValue = value; diff --git a/core/hw/flashrom/flashrom.h b/core/hw/flashrom/flashrom.h index 745a2cff6..97308cf1e 100644 --- a/core/hw/flashrom/flashrom.h +++ b/core/hw/flashrom/flashrom.h @@ -146,13 +146,13 @@ struct SRamChip : MemChip } } - virtual bool Serialize(void **data, unsigned int *total_size) override + bool Serialize(void **data, unsigned int *total_size) override { REICAST_SA(&this->data[write_protect_size], size - write_protect_size); return true; } - virtual bool Unserialize(void **data, unsigned int *total_size) override + bool Unserialize(void **data, unsigned int *total_size) override { REICAST_USA(&this->data[write_protect_size], size - write_protect_size); return true; @@ -255,7 +255,7 @@ struct DCFlashChip : MemChip }; FlashState state; - virtual void Reset() override + void Reset() override { //reset the flash chip state state = FS_Normal; @@ -750,14 +750,14 @@ private: return result; } - virtual bool Serialize(void **data, unsigned int *total_size) override + bool Serialize(void **data, unsigned int *total_size) override { REICAST_S(state); REICAST_SA(&this->data[write_protect_size], size - write_protect_size); return true; } - virtual bool Unserialize(void **data, unsigned int *total_size) override + bool Unserialize(void **data, unsigned int *total_size) override { REICAST_US(state); REICAST_USA(&this->data[write_protect_size], size - write_protect_size); diff --git a/core/hw/maple/maple_devs.cpp b/core/hw/maple/maple_devs.cpp index 03adb2bb9..1f57ae484 100755 --- a/core/hw/maple/maple_devs.cpp +++ b/core/hw/maple/maple_devs.cpp @@ -79,7 +79,7 @@ struct maple_sega_controller: maple_base return 0x80; // unused } - virtual MapleDeviceType get_device_type() override + MapleDeviceType get_device_type() override { return MDT_SegaController; } @@ -94,7 +94,7 @@ struct maple_sega_controller: maple_base return maple_sega_brand; } - virtual u32 dma(u32 cmd) override + u32 dma(u32 cmd) override { //printf("maple_sega_controller::dma Called 0x%X;Command %d\n", bus_id, cmd); switch (cmd) @@ -181,7 +181,7 @@ struct maple_sega_controller: maple_base struct maple_atomiswave_controller: maple_sega_controller { - virtual u32 get_capabilities() override { + u32 get_capabilities() override { // byte 0: 0 0 0 0 0 0 0 0 // byte 1: 0 0 a5 a4 a3 a2 a1 a0 // byte 2: R2 L2 D2 U2 D X Y Z @@ -190,11 +190,11 @@ struct maple_atomiswave_controller: maple_sega_controller return 0xff663f00; // 6 analog axes, X Y L2/D2(?) A B C Start U D L R } - virtual u32 transform_kcode(u32 kcode) override { + u32 transform_kcode(u32 kcode) override { return kcode | AWAVE_TRIGGER_KEY; } - virtual u32 get_analog_axis(int index, const PlainJoystickState &pjs) override { + u32 get_analog_axis(int index, const PlainJoystickState &pjs) override { if (index < 2 || index > 5) return 0x80; index -= 2; @@ -207,7 +207,7 @@ struct maple_atomiswave_controller: maple_sega_controller */ struct maple_sega_twinstick: maple_sega_controller { - virtual u32 get_capabilities() override { + u32 get_capabilities() override { // byte 0: 0 0 0 0 0 0 0 0 // byte 1: 0 0 a5 a4 a3 a2 a1 a0 // byte 2: R2 L2 D2 U2 D X Y Z @@ -216,19 +216,19 @@ struct maple_sega_twinstick: maple_sega_controller return 0xfefe0000; // no analog axes, X Y A B D Start U/D/L/R U2/D2/L2/R2 } - virtual u32 transform_kcode(u32 kcode) override { + u32 transform_kcode(u32 kcode) override { return kcode | 0x0101; } - virtual MapleDeviceType get_device_type() override { + MapleDeviceType get_device_type() override { return MDT_TwinStick; } - virtual u32 get_analog_axis(int index, const PlainJoystickState &pjs) override { + u32 get_analog_axis(int index, const PlainJoystickState &pjs) override { return 0x80; } - virtual const char *get_device_name() override { + const char *get_device_name() override { return maple_sega_twinstick_name; } }; @@ -239,7 +239,7 @@ struct maple_sega_twinstick: maple_sega_controller */ struct maple_ascii_stick: maple_sega_controller { - virtual u32 get_capabilities() override { + u32 get_capabilities() override { // byte 0: 0 0 0 0 0 0 0 0 // byte 1: 0 0 a5 a4 a3 a2 a1 a0 // byte 2: R2 L2 D2 U2 D X Y Z @@ -248,19 +248,19 @@ struct maple_ascii_stick: maple_sega_controller return 0xff070000; // no analog axes, X Y Z A B C Start U/D/L/R } - virtual u32 transform_kcode(u32 kcode) override { + u32 transform_kcode(u32 kcode) override { return kcode | 0xF800; } - virtual MapleDeviceType get_device_type() override { + MapleDeviceType get_device_type() override { return MDT_AsciiStick; } - virtual u32 get_analog_axis(int index, const PlainJoystickState &pjs) override { + u32 get_analog_axis(int index, const PlainJoystickState &pjs) override { return 0x80; } - virtual const char *get_device_name() override { + const char *get_device_name() override { return maple_ascii_stick_name; } }; @@ -299,7 +299,7 @@ struct maple_sega_vmu: maple_base u8 lcd_data[192]; u8 lcd_data_decoded[48*32]; - virtual MapleDeviceType get_device_type() override + MapleDeviceType get_device_type() override { return MDT_SegaVMU; } @@ -318,7 +318,7 @@ struct maple_sega_vmu: maple_base return (rv == Z_OK && dec_sz == sizeof(flash_data)); } - virtual bool serialize(void **data, unsigned int *total_size) override + bool serialize(void **data, unsigned int *total_size) override { maple_base::serialize(data, total_size); REICAST_SA(flash_data,128*1024); @@ -326,7 +326,7 @@ struct maple_sega_vmu: maple_base REICAST_SA(lcd_data_decoded,48*32); return true ; } - virtual bool unserialize(void **data, unsigned int *total_size, serialize_version_enum version) override + bool unserialize(void **data, unsigned int *total_size, serialize_version_enum version) override { maple_base::unserialize(data, total_size, version); REICAST_USA(flash_data,128*1024); @@ -334,7 +334,7 @@ struct maple_sega_vmu: maple_base REICAST_USA(lcd_data_decoded,48*32); return true ; } - virtual void OnSetup() override + void OnSetup() override { memset(flash_data, 0, sizeof(flash_data)); memset(lcd_data, 0, sizeof(lcd_data)); @@ -388,11 +388,11 @@ struct maple_sega_vmu: maple_base } } - virtual ~maple_sega_vmu() + ~maple_sega_vmu() override { if (file) std::fclose(file); } - virtual u32 dma(u32 cmd) override + u32 dma(u32 cmd) override { //printf("maple_sega_vmu::dma Called for port %d:%d, Command %d\n", bus_id, bus_port, cmd); switch (cmd) @@ -701,17 +701,17 @@ struct maple_microphone: maple_base bool sampling; bool eight_khz; - virtual ~maple_microphone() + ~maple_microphone() override { if (sampling) StopAudioRecording(); } - virtual MapleDeviceType get_device_type() override + MapleDeviceType get_device_type() override { return MDT_Microphone; } - virtual bool serialize(void **data, unsigned int *total_size) override + bool serialize(void **data, unsigned int *total_size) override { maple_base::serialize(data, total_size); REICAST_S(gain); @@ -720,7 +720,7 @@ struct maple_microphone: maple_base REICAST_SKIP(480 - sizeof(u32) - sizeof(bool) * 2); return true; } - virtual bool unserialize(void **data, unsigned int *total_size, serialize_version_enum version) override + bool unserialize(void **data, unsigned int *total_size, serialize_version_enum version) override { if (sampling) StopAudioRecording(); @@ -733,14 +733,14 @@ struct maple_microphone: maple_base StartAudioRecording(eight_khz); return true; } - virtual void OnSetup() override + void OnSetup() override { gain = 0xf; sampling = false; eight_khz = false; } - virtual u32 dma(u32 cmd) override + u32 dma(u32 cmd) override { switch (cmd) { @@ -880,12 +880,12 @@ struct maple_sega_purupuru : maple_base u16 AST = 19, AST_ms = 5000; u32 VIBSET; - virtual MapleDeviceType get_device_type() override + MapleDeviceType get_device_type() override { return MDT_PurupuruPack; } - virtual bool serialize(void **data, unsigned int *total_size) override + bool serialize(void **data, unsigned int *total_size) override { maple_base::serialize(data, total_size); REICAST_S(AST); @@ -893,7 +893,7 @@ struct maple_sega_purupuru : maple_base REICAST_S(VIBSET); return true ; } - virtual bool unserialize(void **data, unsigned int *total_size, serialize_version_enum version) override + bool unserialize(void **data, unsigned int *total_size, serialize_version_enum version) override { maple_base::unserialize(data, total_size, version); REICAST_US(AST); @@ -901,7 +901,7 @@ struct maple_sega_purupuru : maple_base REICAST_US(VIBSET); return true ; } - virtual u32 dma(u32 cmd) override + u32 dma(u32 cmd) override { switch (cmd) { @@ -1024,12 +1024,12 @@ u8 kb_key[6]={0}; // normal keys pressed struct maple_keyboard : maple_base { - virtual MapleDeviceType get_device_type() override + MapleDeviceType get_device_type() override { return MDT_Keyboard; } - virtual u32 dma(u32 cmd) override + u32 dma(u32 cmd) override { switch (cmd) { @@ -1129,7 +1129,7 @@ s32 mo_y_phy; struct maple_mouse : maple_base { - virtual MapleDeviceType get_device_type() override + MapleDeviceType get_device_type() override { return MDT_Mouse; } @@ -1139,7 +1139,7 @@ struct maple_mouse : maple_base return (u16)std::min(0x3FF, std::max(0, delta + 0x200)); } - virtual u32 dma(u32 cmd) override + u32 dma(u32 cmd) override { switch (cmd) { @@ -1223,12 +1223,12 @@ struct maple_lightgun : maple_base return kcode | 0xFF01; } - virtual MapleDeviceType get_device_type() override + MapleDeviceType get_device_type() override { return MDT_LightGun; } - virtual u32 dma(u32 cmd) override + u32 dma(u32 cmd) override { switch (cmd) { @@ -1296,7 +1296,7 @@ struct maple_lightgun : maple_base } } - virtual bool get_lightgun_pos() override + bool get_lightgun_pos() override { PlainJoystickState pjs; config->GetInput(&pjs); @@ -1313,7 +1313,7 @@ struct maple_lightgun : maple_base struct atomiswave_lightgun : maple_lightgun { - virtual u32 transform_kcode(u32 kcode) override { + u32 transform_kcode(u32 kcode) override { // No need for reload on AW return (kcode & AWAVE_TRIGGER_KEY) == 0 ? ~AWAVE_BTN0_KEY : ~0; } diff --git a/core/hw/maple/maple_devs.h b/core/hw/maple/maple_devs.h index 392c04724..36541af28 100755 --- a/core/hw/maple/maple_devs.h +++ b/core/hw/maple/maple_devs.h @@ -246,7 +246,7 @@ struct maple_base: maple_device } virtual u32 dma(u32 cmd) = 0; - virtual u32 RawDma(u32* buffer_in, u32 buffer_in_len, u32* buffer_out) + u32 RawDma(u32* buffer_in, u32 buffer_in_len, u32* buffer_out) override { u32 command=buffer_in[0] &0xFF; //Recipient address @@ -280,9 +280,9 @@ struct maple_naomi_jamma : maple_base u32 jvs_receive_length[32] = { 0 }; maple_naomi_jamma(); - virtual ~maple_naomi_jamma(); + ~maple_naomi_jamma() override; - virtual MapleDeviceType get_device_type() override + MapleDeviceType get_device_type() override { return MDT_NaomiJamma; } @@ -299,9 +299,9 @@ struct maple_naomi_jamma : maple_base void handle_86_subcommand(); - virtual u32 RawDma(u32* buffer_in, u32 buffer_in_len, u32* buffer_out) override; - virtual u32 dma(u32 cmd) override { return 0; } + u32 RawDma(u32* buffer_in, u32 buffer_in_len, u32* buffer_out) override; + u32 dma(u32 cmd) override { return 0; } - virtual bool serialize(void **data, unsigned int *total_size) override; - virtual bool unserialize(void **data, unsigned int *total_size, serialize_version_enum version) override; + bool serialize(void **data, unsigned int *total_size) override; + bool unserialize(void **data, unsigned int *total_size, serialize_version_enum version) override; }; diff --git a/core/hw/maple/maple_jvs.cpp b/core/hw/maple/maple_jvs.cpp index 7c2d13276..ee96840d5 100644 --- a/core/hw/maple/maple_jvs.cpp +++ b/core/hw/maple/maple_jvs.cpp @@ -279,7 +279,7 @@ public: output_count = 6; } protected: - virtual const char *get_id() override { return "SEGA ENTERPRISES,LTD.;I/O BD JVS;837-13551 ;Ver1.00;98/10"; } + const char *get_id() override { return "SEGA ENTERPRISES,LTD.;I/O BD JVS;837-13551 ;Ver1.00;98/10"; } }; @@ -321,7 +321,7 @@ public: output_count = 8; } protected: - virtual const char *get_id() override { return "SEGA ENTERPRISES,LTD.;837-13938 ENCORDER BD ;Ver0.01;99/08"; } + const char *get_id() override { return "SEGA ENTERPRISES,LTD.;837-13938 ENCORDER BD ;Ver0.01;99/08"; } }; @@ -339,7 +339,7 @@ public: output_count = 22; } protected: - virtual const char *get_id() override { return "SEGA ENTERPRISES,LTD.;837-13844-01 I/O CNTL BD2 ;Ver1.00;99/07"; } + const char *get_id() override { return "SEGA ENTERPRISES,LTD.;837-13844-01 I/O CNTL BD2 ;Ver1.00;99/07"; } }; @@ -373,7 +373,7 @@ public: { } protected: - virtual void read_digital_in(u16 *v) override + void read_digital_in(u16 *v) override { jvs_837_13844::read_digital_in(v); @@ -398,7 +398,7 @@ protected: v[1] &= ~NAOMI_BTN2_KEY; } - virtual void write_digital_out(int count, u8 *data) override { + void write_digital_out(int count, u8 *data) override { if (count != 3) return; @@ -448,7 +448,7 @@ public: light_gun_count = 2; } protected: - virtual const char *get_id() override { return "namco ltd.;JYU-PCB;Ver1.00;JPN,2Coins 2Guns"; } + const char *get_id() override { return "namco ltd.;JYU-PCB;Ver1.00;JPN,2Coins 2Guns"; } }; // Mazan @@ -467,9 +467,9 @@ public: encoder_count = 2; } protected: - virtual const char *get_id() override { return "namco ltd.;FCB;Ver1.0;JPN,Touch Panel & Multipurpose"; } + const char *get_id() override { return "namco ltd.;FCB;Ver1.0;JPN,Touch Panel & Multipurpose"; } - virtual u16 read_analog_axis(int player_num, int player_axis, bool inverted) override { + u16 read_analog_axis(int player_num, int player_axis, bool inverted) override { if (init_in_progress) return 0; player_num = std::min(player_num, (int)ARRAY_SIZE(mo_x_abs)); @@ -495,7 +495,7 @@ public: encoder_count = 2; } protected: - virtual const char *get_id() override { return "namco ltd.;FCA-1;Ver1.01;JPN,Multipurpose + Rotary Encoder"; } + const char *get_id() override { return "namco ltd.;FCA-1;Ver1.01;JPN,Multipurpose + Rotary Encoder"; } }; // World Kicks @@ -512,9 +512,9 @@ public: output_count = 6; } protected: - virtual const char *get_id() override { return "SEGA ENTERPRISES,LTD.;I/O BD JVS;837-13551 ;Ver1.00;98/10"; } + const char *get_id() override { return "SEGA ENTERPRISES,LTD.;I/O BD JVS;837-13551 ;Ver1.00;98/10"; } - virtual void read_digital_in(u16 *v) override + void read_digital_in(u16 *v) override { jvs_io_board::read_digital_in(v); // main button @@ -541,7 +541,7 @@ protected: return std::min(0xff, 0x80 - axis_y) << 8; } - virtual u16 read_analog_axis(int player_num, int player_axis, bool inverted) override { + u16 read_analog_axis(int player_num, int player_axis, bool inverted) override { switch (player_axis) { case 0: @@ -591,9 +591,9 @@ public: output_count = 6; } protected: - virtual const char *get_id() override { return "SEGA ENTERPRISES,LTD.;I/O BD JVS;837-13551 ;Ver1.00;98/10"; } + const char *get_id() override { return "SEGA ENTERPRISES,LTD.;I/O BD JVS;837-13551 ;Ver1.00;98/10"; } - virtual void read_digital_in(u16 *v) override + void read_digital_in(u16 *v) override { jvs_io_board::read_digital_in(v); for (u32 player = 0; player < player_count; player++) @@ -621,7 +621,7 @@ protected: return std::min(0xff, 0x80 - axis_y) << 8; } - virtual u16 read_analog_axis(int player_num, int player_axis, bool inverted) override { + u16 read_analog_axis(int player_num, int player_axis, bool inverted) override { switch (player_axis) { case 0: diff --git a/core/hw/naomi/awcartridge.h b/core/hw/naomi/awcartridge.h index b0dac8ca9..3bd52a68d 100644 --- a/core/hw/naomi/awcartridge.h +++ b/core/hw/naomi/awcartridge.h @@ -19,20 +19,20 @@ class AWCartridge: public Cartridge public: AWCartridge(u32 size) : Cartridge(size) {} - virtual void Init() override; - virtual u32 ReadMem(u32 address, u32 size) override; - virtual void WriteMem(u32 address, u32 data, u32 size) override; + void Init() override; + u32 ReadMem(u32 address, u32 size) override; + void WriteMem(u32 address, u32 data, u32 size) override; - virtual void *GetDmaPtr(u32 &limit) override; - virtual void AdvancePtr(u32 size) override; - virtual std::string GetGameId() override; + void *GetDmaPtr(u32 &limit) override; + void AdvancePtr(u32 size) override; + std::string GetGameId() override; void SetKey(u32 key) override; - virtual void Serialize(void **data, unsigned int *total_size) override; - virtual void Unserialize(void **data, unsigned int *total_size) override; + void Serialize(void **data, unsigned int *total_size) override; + void Unserialize(void **data, unsigned int *total_size) override; private: - virtual void device_reset(); + void device_reset(); enum { EPR, MPR_RECORD, MPR_FILE }; diff --git a/core/hw/naomi/gdcartridge.h b/core/hw/naomi/gdcartridge.h index fc6d623b5..5cdc64cd6 100644 --- a/core/hw/naomi/gdcartridge.h +++ b/core/hw/naomi/gdcartridge.h @@ -21,19 +21,19 @@ public: GDCartridge(u32 size) : NaomiCartridge(size) { } - ~GDCartridge() + ~GDCartridge() override { free(dimm_data); } - virtual void Init() override + void Init() override { device_start(); device_reset(); } - virtual void* GetDmaPtr(u32 &size) override; - virtual void AdvancePtr(u32 size) override; - virtual bool Read(u32 offset, u32 size, void* dst) override; - virtual std::string GetGameId() override; + void* GetDmaPtr(u32 &size) override; + void AdvancePtr(u32 size) override; + bool Read(u32 offset, u32 size, void* dst) override; + std::string GetGameId() override; void SetGDRomName(const char *name, const char *parentName) { this->gdrom_name = name; this->gdrom_parent_name = parentName; } diff --git a/core/hw/naomi/m1cartridge.h b/core/hw/naomi/m1cartridge.h index 45efef60d..9ca54a84f 100644 --- a/core/hw/naomi/m1cartridge.h +++ b/core/hw/naomi/m1cartridge.h @@ -15,14 +15,14 @@ class M1Cartridge : public NaomiCartridge public: M1Cartridge(u32 size); - virtual u32 ReadMem(u32 address, u32 size) override + u32 ReadMem(u32 address, u32 size) override { if ((address & 0xff) == 0x14) return actel_id; return NaomiCartridge::ReadMem(address, size); } - virtual void* GetDmaPtr(u32 &size) override + void* GetDmaPtr(u32 &size) override { if (encryption) { @@ -33,14 +33,14 @@ public: return NaomiCartridge::GetDmaPtr(size); } - virtual void AdvancePtr(u32 size) override; - virtual void Serialize(void** data, unsigned int* total_size) override; - virtual void Unserialize(void** data, unsigned int* total_size) override; + void AdvancePtr(u32 size) override; + void Serialize(void** data, unsigned int* total_size) override; + void Unserialize(void** data, unsigned int* total_size) override; void setActelId(u32 actel_id) { this->actel_id = actel_id; } protected: - virtual void DmaOffsetChanged(u32 dma_offset) override + void DmaOffsetChanged(u32 dma_offset) override { rom_cur_address = dma_offset & 0x1fffffff; if ((dma_offset & 0x20000000) == 0 && rom_cur_address < RomSize) diff --git a/core/hw/naomi/m4cartridge.h b/core/hw/naomi/m4cartridge.h index 52b5dd031..40e589b75 100644 --- a/core/hw/naomi/m4cartridge.h +++ b/core/hw/naomi/m4cartridge.h @@ -18,15 +18,15 @@ class M4Cartridge: public NaomiCartridge { public: M4Cartridge(u32 size) : NaomiCartridge(size) { } - ~M4Cartridge(); + ~M4Cartridge() override; - virtual void Init() override + void Init() override { device_start(); device_reset(); } - virtual u32 ReadMem(u32 address, u32 size) override + u32 ReadMem(u32 address, u32 size) override { if ((address & 0xff) == 0x34) return m4id & 0xff80; @@ -39,21 +39,21 @@ public: return data; } - virtual bool Read(u32 offset, u32 size, void *dst) override; - virtual bool Write(u32 offset, u32 size, u32 data) override; + bool Read(u32 offset, u32 size, void *dst) override; + bool Write(u32 offset, u32 size, u32 data) override; - virtual void* GetDmaPtr(u32 &size) override; - virtual void AdvancePtr(u32 size) override; - virtual std::string GetGameId() override; - virtual void Serialize(void** data, unsigned int* total_size) override; - virtual void Unserialize(void** data, unsigned int* total_size) override; + void* GetDmaPtr(u32 &size) override; + void AdvancePtr(u32 size) override; + std::string GetGameId() override; + void Serialize(void** data, unsigned int* total_size) override; + void Unserialize(void** data, unsigned int* total_size) override; void SetKey(u32 key) override { this->m4id = key; } void SetKeyData(u8 *key_data) override { this->m_key_data = key_data; } protected: - virtual void DmaOffsetChanged(u32 dma_offset) override; - virtual void PioOffsetChanged(u32 pio_offset) override; + void DmaOffsetChanged(u32 dma_offset) override; + void PioOffsetChanged(u32 pio_offset) override; private: void device_start(); diff --git a/core/hw/naomi/naomi_cart.h b/core/hw/naomi/naomi_cart.h index a8a5dd622..094b41ce2 100644 --- a/core/hw/naomi/naomi_cart.h +++ b/core/hw/naomi/naomi_cart.h @@ -35,12 +35,12 @@ class NaomiCartridge : public Cartridge public: NaomiCartridge(u32 size) : Cartridge(size), RomPioOffset(0), RomPioAutoIncrement(0), DmaOffset(0), DmaCount(0xffff) {} - virtual u32 ReadMem(u32 address, u32 size) override; - virtual void WriteMem(u32 address, u32 data, u32 size) override; - virtual void* GetDmaPtr(u32 &size) override; - virtual void AdvancePtr(u32 size) override {} - virtual void Serialize(void** data, unsigned int* total_size) override; - virtual void Unserialize(void** data, unsigned int* total_size) override; + u32 ReadMem(u32 address, u32 size) override; + void WriteMem(u32 address, u32 data, u32 size) override; + void* GetDmaPtr(u32 &size) override; + void AdvancePtr(u32 size) override {} + void Serialize(void** data, unsigned int* total_size) override; + void Unserialize(void** data, unsigned int* total_size) override; void SetKey(u32 key) override { this->key = key; } @@ -65,13 +65,13 @@ class M2Cartridge : public NaomiCartridge public: M2Cartridge(u32 size) : NaomiCartridge(size) {} - virtual bool Read(u32 offset, u32 size, void* dst) override; - virtual bool Write(u32 offset, u32 size, u32 data) override; + bool Read(u32 offset, u32 size, void* dst) override; + bool Write(u32 offset, u32 size, u32 data) override; u16 ReadCipheredData(u32 offset); - virtual void Serialize(void** data, unsigned int* total_size) override; - virtual void Unserialize(void** data, unsigned int* total_size) override; - virtual void* GetDmaPtr(u32& size) override; - virtual std::string GetGameId() override; + void Serialize(void** data, unsigned int* total_size) override; + void Unserialize(void** data, unsigned int* total_size) override; + void* GetDmaPtr(u32& size) override; + std::string GetGameId() override; private: u8 naomi_cart_ram[64 * 1024]; diff --git a/core/imgread/chd.cpp b/core/imgread/chd.cpp index b0b54817d..8d5972b21 100644 --- a/core/imgread/chd.cpp +++ b/core/imgread/chd.cpp @@ -17,7 +17,7 @@ struct CHDDisc : Disc bool TryOpen(const char* file); - ~CHDDisc() + ~CHDDisc() override { delete[] hunk_mem; @@ -45,7 +45,7 @@ struct CHDTrack : TrackFile this->swap_bytes = swap_bytes; } - virtual void Read(u32 FAD, u8* dst, SectorFormat* sector_type, u8* subcode, SubcodeFormat* subcode_type) + void Read(u32 FAD, u8* dst, SectorFormat* sector_type, u8* subcode, SubcodeFormat* subcode_type) override { u32 fad_offs = FAD + Offset; u32 hunk=(fad_offs)/disc->sph; diff --git a/core/imgread/common.h b/core/imgread/common.h index a260b0454..fbc146c15 100644 --- a/core/imgread/common.h +++ b/core/imgread/common.h @@ -300,7 +300,7 @@ struct RawTrackFile : TrackFile this->cleanup=true; } - virtual void Read(u32 FAD,u8* dst,SectorFormat* sector_type,u8* subcode,SubcodeFormat* subcode_type) + void Read(u32 FAD,u8* dst,SectorFormat* sector_type,u8* subcode,SubcodeFormat* subcode_type) override { //for now hackish if (fmt==2352) @@ -319,7 +319,7 @@ struct RawTrackFile : TrackFile std::fseek(file, offset + FAD * fmt, SEEK_SET); std::fread(dst, 1, fmt, file); } - virtual ~RawTrackFile() + ~RawTrackFile() override { if (cleanup && file) std::fclose(file); diff --git a/core/imgread/ioctl.cpp b/core/imgread/ioctl.cpp index ed0907bbe..01e303087 100644 --- a/core/imgread/ioctl.cpp +++ b/core/imgread/ioctl.cpp @@ -185,7 +185,7 @@ struct PhysicalTrack:TrackFile PhysicalDrive* disc; PhysicalTrack(PhysicalDrive* disc) { this->disc=disc; } - virtual void Read(u32 FAD,u8* dst,SectorFormat* sector_type,u8* subcode,SubcodeFormat* subcode_type); + void Read(u32 FAD,u8* dst,SectorFormat* sector_type,u8* subcode,SubcodeFormat* subcode_type) override; }; struct PhysicalDrive:Disc diff --git a/core/log/ConsoleListener.h b/core/log/ConsoleListener.h index f1b90ae01..e99146cdd 100644 --- a/core/log/ConsoleListener.h +++ b/core/log/ConsoleListener.h @@ -10,7 +10,7 @@ class ConsoleListener : public LogListener { public: ConsoleListener(); - ~ConsoleListener(); + ~ConsoleListener() override; void Log(LogTypes::LOG_LEVELS, const char* text) override; diff --git a/core/rec-x64/rec_x64.cpp b/core/rec-x64/rec_x64.cpp index 97fe0d886..2d2134286 100644 --- a/core/rec-x64/rec_x64.cpp +++ b/core/rec-x64/rec_x64.cpp @@ -25,11 +25,11 @@ using namespace Xbyak::util; struct DynaRBI : RuntimeBlockInfo { - virtual u32 Relink() { + u32 Relink() override { return 0; } - virtual void Relocate(void* dst) { + void Relocate(void* dst) override { verify(false); } }; diff --git a/core/rec-x64/x64_regalloc.h b/core/rec-x64/x64_regalloc.h index 144cddce5..6ba834a3b 100644 --- a/core/rec-x64/x64_regalloc.h +++ b/core/rec-x64/x64_regalloc.h @@ -50,10 +50,10 @@ struct X64RegAlloc : RegAlloc RegAlloc::DoAlloc(block, alloc_regs, alloc_fregs); } - virtual void Preload(u32 reg, Xbyak::Operand::Code nreg) override; - virtual void Writeback(u32 reg, Xbyak::Operand::Code nreg) override; - virtual void Preload_FPU(u32 reg, s8 nreg) override; - virtual void Writeback_FPU(u32 reg, s8 nreg) override; + void Preload(u32 reg, Xbyak::Operand::Code nreg) override; + void Writeback(u32 reg, Xbyak::Operand::Code nreg) override; + void Preload_FPU(u32 reg, s8 nreg) override; + void Writeback_FPU(u32 reg, s8 nreg) override; Xbyak::Reg32 MapRegister(const shil_param& param) { diff --git a/core/rend/gles/gles.h b/core/rend/gles/gles.h index 179438bff..624a9cccc 100755 --- a/core/rend/gles/gles.h +++ b/core/rend/gles/gles.h @@ -221,9 +221,9 @@ class TextureCacheData final : public BaseTextureCacheData { public: GLuint texID; //gl texture - virtual std::string GetId() override { return std::to_string(texID); } - virtual void UploadToGPU(int width, int height, u8 *temp_tex_buffer, bool mipmapped, bool mipmapsIncluded = false) override; - virtual bool Delete() override; + std::string GetId() override { return std::to_string(texID); } + void UploadToGPU(int width, int height, u8 *temp_tex_buffer, bool mipmapped, bool mipmapsIncluded = false) override; + bool Delete() override; }; class GlTextureCache final : public BaseTextureCache @@ -262,12 +262,12 @@ struct OpenGLRenderer : Renderer void DrawOSD(bool clear_screen) override { OSD_DRAW(clear_screen); } - virtual u64 GetTexture(TSP tsp, TCW tcw) override + u64 GetTexture(TSP tsp, TCW tcw) override { return gl_GetTexture(tsp, tcw); } - virtual bool Present() override + bool Present() override { if (!frameRendered) return false; diff --git a/core/rend/vulkan/drawer.h b/core/rend/vulkan/drawer.h index cbf3b3586..a1ac25859 100644 --- a/core/rend/vulkan/drawer.h +++ b/core/rend/vulkan/drawer.h @@ -194,7 +194,7 @@ class ScreenDrawer : public Drawer { public: void Init(SamplerManager *samplerManager, ShaderManager *shaderManager); - virtual void EndRenderPass() override; + void EndRenderPass() override; bool PresentFrame() { if (!frameRendered) @@ -207,8 +207,8 @@ public: } protected: - virtual vk::CommandBuffer BeginRenderPass() override; - virtual size_t GetSwapChainSize() override { return 2; } + vk::CommandBuffer BeginRenderPass() override; + size_t GetSwapChainSize() override { return 2; } private: std::unique_ptr screenPipelineManager; @@ -230,10 +230,10 @@ class TextureDrawer : public Drawer { public: void Init(SamplerManager *samplerManager, ShaderManager *shaderManager, TextureCache *textureCache); - virtual void EndRenderPass() override; + void EndRenderPass() override; protected: - virtual vk::CommandBuffer BeginRenderPass() override; + vk::CommandBuffer BeginRenderPass() override; private: u32 width = 0; diff --git a/core/rend/vulkan/oit/oit_drawer.h b/core/rend/vulkan/oit/oit_drawer.h index 8310e97a3..33fe6f00d 100644 --- a/core/rend/vulkan/oit/oit_drawer.h +++ b/core/rend/vulkan/oit/oit_drawer.h @@ -177,8 +177,8 @@ public: OITDrawer::Term(); } - virtual vk::CommandBuffer NewFrame() override; - virtual void EndFrame() override + vk::CommandBuffer NewFrame() override; + void EndFrame() override { currentCommandBuffer.endRenderPass(); currentCommandBuffer.end(); @@ -200,8 +200,8 @@ public: } protected: - virtual vk::Framebuffer GetFinalFramebuffer() const override { return *framebuffers[GetCurrentImage()]; } - virtual vk::Format GetColorFormat() const override { return GetContext()->GetColorFormat(); } + vk::Framebuffer GetFinalFramebuffer() const override { return *framebuffers[GetCurrentImage()]; } + vk::Format GetColorFormat() const override { return GetContext()->GetColorFormat(); } private: void MakeFramebuffers(); @@ -235,12 +235,12 @@ public: OITDrawer::Term(); } - virtual void EndFrame() override; + void EndFrame() override; protected: - virtual vk::CommandBuffer NewFrame() override; - virtual vk::Framebuffer GetFinalFramebuffer() const override { return *framebuffers[GetCurrentImage()]; } - virtual vk::Format GetColorFormat() const override { return vk::Format::eR8G8B8A8Unorm; } + vk::CommandBuffer NewFrame() override; + vk::Framebuffer GetFinalFramebuffer() const override { return *framebuffers[GetCurrentImage()]; } + vk::Format GetColorFormat() const override { return vk::Format::eR8G8B8A8Unorm; } private: u32 textureAddr = 0; diff --git a/core/rend/vulkan/oit/oit_renderpass.h b/core/rend/vulkan/oit/oit_renderpass.h index 133c6bc7f..f90eb7ff7 100644 --- a/core/rend/vulkan/oit/oit_renderpass.h +++ b/core/rend/vulkan/oit/oit_renderpass.h @@ -64,7 +64,7 @@ private: class RttRenderPasses : public RenderPasses { protected: - virtual vk::AttachmentDescription GetAttachment0Description(bool initial, bool last) const override + vk::AttachmentDescription GetAttachment0Description(bool initial, bool last) const override { return vk::AttachmentDescription(vk::AttachmentDescriptionFlags(), vk::Format::eR8G8B8A8Unorm, vk::SampleCountFlagBits::e1, vk::AttachmentLoadOp::eClear, vk::AttachmentStoreOp::eStore, @@ -72,8 +72,8 @@ protected: vk::ImageLayout::eUndefined, config::RenderToTextureBuffer && last ? vk::ImageLayout::eTransferSrcOptimal : vk::ImageLayout::eShaderReadOnlyOptimal); } - virtual vk::Format GetColorFormat() const override { return vk::Format::eR8G8B8A8Unorm; } - virtual std::vector GetSubpassDependencies() const override + vk::Format GetColorFormat() const override { return vk::Format::eR8G8B8A8Unorm; } + std::vector GetSubpassDependencies() const override { std::vector deps; if (config::RenderToTextureBuffer) diff --git a/core/rend/vulkan/texture.h b/core/rend/vulkan/texture.h index 8d5a0b85a..b3511d78a 100644 --- a/core/rend/vulkan/texture.h +++ b/core/rend/vulkan/texture.h @@ -43,7 +43,7 @@ public: vk::ImageView GetImageView() const { return *imageView; } vk::ImageView GetReadOnlyImageView() const { return readOnlyImageView ? readOnlyImageView : *imageView; } void SetCommandBuffer(vk::CommandBuffer commandBuffer) { this->commandBuffer = commandBuffer; } - virtual bool Force32BitTexture(TextureType type) const override { return !VulkanContext::Instance()->IsFormatSupported(type); } + bool Force32BitTexture(TextureType type) const override { return !VulkanContext::Instance()->IsFormatSupported(type); } void SetPhysicalDevice(vk::PhysicalDevice physicalDevice) { this->physicalDevice = physicalDevice; } void SetDevice(vk::Device device) { this->device = device; } diff --git a/core/rend/vulkan/vk_mem_alloc.h b/core/rend/vulkan/vk_mem_alloc.h index 0dfb66efc..3322d9b5f 100644 --- a/core/rend/vulkan/vk_mem_alloc.h +++ b/core/rend/vulkan/vk_mem_alloc.h @@ -5705,23 +5705,23 @@ class VmaBlockMetadata_Generic : public VmaBlockMetadata VMA_CLASS_NO_COPY(VmaBlockMetadata_Generic) public: VmaBlockMetadata_Generic(VmaAllocator hAllocator); - virtual ~VmaBlockMetadata_Generic(); - virtual void Init(VkDeviceSize size); + ~VmaBlockMetadata_Generic() override; + void Init(VkDeviceSize size) override; - virtual bool Validate() const; - virtual size_t GetAllocationCount() const { return m_Suballocations.size() - m_FreeCount; } - virtual VkDeviceSize GetSumFreeSize() const { return m_SumFreeSize; } - virtual VkDeviceSize GetUnusedRangeSizeMax() const; - virtual bool IsEmpty() const; + bool Validate() const override; + size_t GetAllocationCount() const override { return m_Suballocations.size() - m_FreeCount; } + VkDeviceSize GetSumFreeSize() const override { return m_SumFreeSize; } + VkDeviceSize GetUnusedRangeSizeMax() const override; + bool IsEmpty() const override; - virtual void CalcAllocationStatInfo(VmaStatInfo& outInfo) const; - virtual void AddPoolStats(VmaPoolStats& inoutStats) const; + void CalcAllocationStatInfo(VmaStatInfo& outInfo) const override; + void AddPoolStats(VmaPoolStats& inoutStats) const override; #if VMA_STATS_STRING_ENABLED - virtual void PrintDetailedMap(class VmaJsonWriter& json) const; + void PrintDetailedMap(class VmaJsonWriter& json) const override; #endif - virtual bool CreateAllocationRequest( + bool CreateAllocationRequest( uint32_t currentFrameIndex, uint32_t frameInUseCount, VkDeviceSize bufferImageGranularity, @@ -5731,25 +5731,25 @@ public: VmaSuballocationType allocType, bool canMakeOtherLost, uint32_t strategy, - VmaAllocationRequest* pAllocationRequest); + VmaAllocationRequest* pAllocationRequest) override; - virtual bool MakeRequestedAllocationsLost( + bool MakeRequestedAllocationsLost( uint32_t currentFrameIndex, uint32_t frameInUseCount, - VmaAllocationRequest* pAllocationRequest); + VmaAllocationRequest* pAllocationRequest) override; - virtual uint32_t MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount); + uint32_t MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount) override; - virtual VkResult CheckCorruption(const void* pBlockData); + VkResult CheckCorruption(const void* pBlockData) override; - virtual void Alloc( + void Alloc( const VmaAllocationRequest& request, VmaSuballocationType type, VkDeviceSize allocSize, - VmaAllocation hAllocation); + VmaAllocation hAllocation) override; - virtual void Free(const VmaAllocation allocation); - virtual void FreeAtOffset(VkDeviceSize offset); + void Free(const VmaAllocation allocation) override; + void FreeAtOffset(VkDeviceSize offset) override; //////////////////////////////////////////////////////////////////////////////// // For defragmentation @@ -5883,23 +5883,23 @@ class VmaBlockMetadata_Linear : public VmaBlockMetadata VMA_CLASS_NO_COPY(VmaBlockMetadata_Linear) public: VmaBlockMetadata_Linear(VmaAllocator hAllocator); - virtual ~VmaBlockMetadata_Linear(); - virtual void Init(VkDeviceSize size); + ~VmaBlockMetadata_Linear() override; + void Init(VkDeviceSize size) override; - virtual bool Validate() const; - virtual size_t GetAllocationCount() const; - virtual VkDeviceSize GetSumFreeSize() const { return m_SumFreeSize; } - virtual VkDeviceSize GetUnusedRangeSizeMax() const; - virtual bool IsEmpty() const { return GetAllocationCount() == 0; } + bool Validate() const override; + size_t GetAllocationCount() const override; + VkDeviceSize GetSumFreeSize() const override { return m_SumFreeSize; } + VkDeviceSize GetUnusedRangeSizeMax() const override; + bool IsEmpty() const override { return GetAllocationCount() == 0; } - virtual void CalcAllocationStatInfo(VmaStatInfo& outInfo) const; - virtual void AddPoolStats(VmaPoolStats& inoutStats) const; + void CalcAllocationStatInfo(VmaStatInfo& outInfo) const override; + void AddPoolStats(VmaPoolStats& inoutStats) const override; #if VMA_STATS_STRING_ENABLED - virtual void PrintDetailedMap(class VmaJsonWriter& json) const; + void PrintDetailedMap(class VmaJsonWriter& json) const override; #endif - virtual bool CreateAllocationRequest( + bool CreateAllocationRequest( uint32_t currentFrameIndex, uint32_t frameInUseCount, VkDeviceSize bufferImageGranularity, @@ -5909,25 +5909,25 @@ public: VmaSuballocationType allocType, bool canMakeOtherLost, uint32_t strategy, - VmaAllocationRequest* pAllocationRequest); + VmaAllocationRequest* pAllocationRequest) override; - virtual bool MakeRequestedAllocationsLost( + bool MakeRequestedAllocationsLost( uint32_t currentFrameIndex, uint32_t frameInUseCount, - VmaAllocationRequest* pAllocationRequest); + VmaAllocationRequest* pAllocationRequest) override; - virtual uint32_t MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount); + uint32_t MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount) override; - virtual VkResult CheckCorruption(const void* pBlockData); + VkResult CheckCorruption(const void* pBlockData) override; - virtual void Alloc( + void Alloc( const VmaAllocationRequest& request, VmaSuballocationType type, VkDeviceSize allocSize, - VmaAllocation hAllocation); + VmaAllocation hAllocation) override; - virtual void Free(const VmaAllocation allocation); - virtual void FreeAtOffset(VkDeviceSize offset); + void Free(const VmaAllocation allocation) override; + void FreeAtOffset(VkDeviceSize offset) override; private: /* @@ -6013,23 +6013,23 @@ class VmaBlockMetadata_Buddy : public VmaBlockMetadata VMA_CLASS_NO_COPY(VmaBlockMetadata_Buddy) public: VmaBlockMetadata_Buddy(VmaAllocator hAllocator); - virtual ~VmaBlockMetadata_Buddy(); - virtual void Init(VkDeviceSize size); + ~VmaBlockMetadata_Buddy() override; + void Init(VkDeviceSize size) override; - virtual bool Validate() const; - virtual size_t GetAllocationCount() const { return m_AllocationCount; } - virtual VkDeviceSize GetSumFreeSize() const { return m_SumFreeSize + GetUnusableSize(); } - virtual VkDeviceSize GetUnusedRangeSizeMax() const; - virtual bool IsEmpty() const { return m_Root->type == Node::TYPE_FREE; } + bool Validate() const override; + size_t GetAllocationCount() const override { return m_AllocationCount; } + VkDeviceSize GetSumFreeSize() const override { return m_SumFreeSize + GetUnusableSize(); } + VkDeviceSize GetUnusedRangeSizeMax() const override; + bool IsEmpty() const override { return m_Root->type == Node::TYPE_FREE; } - virtual void CalcAllocationStatInfo(VmaStatInfo& outInfo) const; - virtual void AddPoolStats(VmaPoolStats& inoutStats) const; + void CalcAllocationStatInfo(VmaStatInfo& outInfo) const override; + void AddPoolStats(VmaPoolStats& inoutStats) const override; #if VMA_STATS_STRING_ENABLED - virtual void PrintDetailedMap(class VmaJsonWriter& json) const; + void PrintDetailedMap(class VmaJsonWriter& json) const override; #endif - virtual bool CreateAllocationRequest( + bool CreateAllocationRequest( uint32_t currentFrameIndex, uint32_t frameInUseCount, VkDeviceSize bufferImageGranularity, @@ -6039,25 +6039,25 @@ public: VmaSuballocationType allocType, bool canMakeOtherLost, uint32_t strategy, - VmaAllocationRequest* pAllocationRequest); + VmaAllocationRequest* pAllocationRequest) override; - virtual bool MakeRequestedAllocationsLost( + bool MakeRequestedAllocationsLost( uint32_t currentFrameIndex, uint32_t frameInUseCount, - VmaAllocationRequest* pAllocationRequest); + VmaAllocationRequest* pAllocationRequest) override; - virtual uint32_t MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount); + uint32_t MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount) override; - virtual VkResult CheckCorruption(const void* pBlockData) { return VK_ERROR_FEATURE_NOT_PRESENT; } + VkResult CheckCorruption(const void* pBlockData) override { return VK_ERROR_FEATURE_NOT_PRESENT; } - virtual void Alloc( + void Alloc( const VmaAllocationRequest& request, VmaSuballocationType type, VkDeviceSize allocSize, - VmaAllocation hAllocation); + VmaAllocation hAllocation) override; - virtual void Free(const VmaAllocation allocation) { FreeAtOffset(allocation, allocation->GetOffset()); } - virtual void FreeAtOffset(VkDeviceSize offset) { FreeAtOffset(VMA_NULL, offset); } + void Free(const VmaAllocation allocation) override { FreeAtOffset(allocation, allocation->GetOffset()); } + void FreeAtOffset(VkDeviceSize offset) override { FreeAtOffset(VMA_NULL, offset); } private: static const VkDeviceSize MIN_NODE_SIZE = 32; @@ -6489,18 +6489,18 @@ public: VmaBlockVector* pBlockVector, uint32_t currentFrameIndex, bool overlappingMoveSupported); - virtual ~VmaDefragmentationAlgorithm_Generic(); + ~VmaDefragmentationAlgorithm_Generic() override; - virtual void AddAllocation(VmaAllocation hAlloc, VkBool32* pChanged); - virtual void AddAll() { m_AllAllocations = true; } + void AddAllocation(VmaAllocation hAlloc, VkBool32* pChanged) override; + void AddAll() override { m_AllAllocations = true; } - virtual VkResult Defragment( + VkResult Defragment( VmaVector< VmaDefragmentationMove, VmaStlAllocator >& moves, VkDeviceSize maxBytesToMove, - uint32_t maxAllocationsToMove); + uint32_t maxAllocationsToMove) override; - virtual VkDeviceSize GetBytesMoved() const { return m_BytesMoved; } - virtual uint32_t GetAllocationsMoved() const { return m_AllocationsMoved; } + VkDeviceSize GetBytesMoved() const override { return m_BytesMoved; } + uint32_t GetAllocationsMoved() const override { return m_AllocationsMoved; } private: uint32_t m_AllocationCount; @@ -6616,18 +6616,18 @@ public: VmaBlockVector* pBlockVector, uint32_t currentFrameIndex, bool overlappingMoveSupported); - virtual ~VmaDefragmentationAlgorithm_Fast(); + ~VmaDefragmentationAlgorithm_Fast() override; - virtual void AddAllocation(VmaAllocation hAlloc, VkBool32* pChanged) { ++m_AllocationCount; } - virtual void AddAll() { m_AllAllocations = true; } + void AddAllocation(VmaAllocation hAlloc, VkBool32* pChanged) override { ++m_AllocationCount; } + void AddAll() override { m_AllAllocations = true; } - virtual VkResult Defragment( + VkResult Defragment( VmaVector< VmaDefragmentationMove, VmaStlAllocator >& moves, VkDeviceSize maxBytesToMove, - uint32_t maxAllocationsToMove); + uint32_t maxAllocationsToMove) override; - virtual VkDeviceSize GetBytesMoved() const { return m_BytesMoved; } - virtual uint32_t GetAllocationsMoved() const { return m_AllocationsMoved; } + VkDeviceSize GetBytesMoved() const override { return m_BytesMoved; } + uint32_t GetAllocationsMoved() const override { return m_AllocationsMoved; } private: struct BlockInfo diff --git a/core/rend/vulkan/vulkan_renderer.h b/core/rend/vulkan/vulkan_renderer.h index 6c15f05d8..e7c71a8e6 100644 --- a/core/rend/vulkan/vulkan_renderer.h +++ b/core/rend/vulkan/vulkan_renderer.h @@ -30,7 +30,7 @@ class BaseVulkanRenderer : public Renderer { public: - virtual bool Init() override + bool Init() override { texCommandPool.Init(); @@ -63,7 +63,7 @@ public: return true; } - virtual void Term() override + void Term() override { GetContext()->PresentFrame(nullptr, vk::Extent2D()); osdBuffer.reset(); @@ -75,7 +75,7 @@ public: framebufferTextures.clear(); } - virtual u64 GetTexture(TSP tsp, TCW tcw) override + u64 GetTexture(TSP tsp, TCW tcw) override { Texture* tf = textureCache.getTextureCacheData(tsp, tcw); @@ -107,7 +107,7 @@ public: return tf->GetIntId(); } - virtual bool Process(TA_context* ctx) override + bool Process(TA_context* ctx) override { if (KillTex) textureCache.Clear(); diff --git a/core/windows/win_keyboard.h b/core/windows/win_keyboard.h index a9b57b97b..515e643d5 100644 --- a/core/windows/win_keyboard.h +++ b/core/windows/win_keyboard.h @@ -141,10 +141,10 @@ public: //E8-FF Reserved } - virtual const char* name() override { return "Windows Keyboard"; } + const char* name() override { return "Windows Keyboard"; } protected: - virtual u8 convert_keycode(u8 keycode) override + u8 convert_keycode(u8 keycode) override { return kb_map[keycode]; } diff --git a/core/windows/xinput_gamepad.h b/core/windows/xinput_gamepad.h index 6e785b8fe..10b33b46d 100644 --- a/core/windows/xinput_gamepad.h +++ b/core/windows/xinput_gamepad.h @@ -106,14 +106,14 @@ public: last_right_thumb_y = 0; } } - virtual void rumble(float power, float inclination, u32 duration_ms) override + void rumble(float power, float inclination, u32 duration_ms) override { vib_inclination = inclination * power; vib_stop_time = os_GetSeconds() + duration_ms / 1000.0; do_rumble(power); } - virtual void update_rumble() override + void update_rumble() override { if (vib_stop_time > 0) { @@ -166,7 +166,7 @@ public: } protected: - virtual void load_axis_min_max(u32 axis) override + void load_axis_min_max(u32 axis) override { if (axis == 0 || axis == 1) { @@ -240,7 +240,7 @@ public: if (!find_mapping()) input_mapper = std::make_shared(); } - virtual ~WinKbGamepadDevice() {} + ~WinKbGamepadDevice() override {} }; class MouseInputMapping : public InputMapping @@ -267,7 +267,7 @@ public: if (!find_mapping()) input_mapper = std::make_shared(); } - virtual ~WinMouseGamepadDevice() {} + ~WinMouseGamepadDevice() override {} bool gamepad_btn_input(u32 code, bool pressed) override { @@ -280,7 +280,7 @@ public: return GamepadDevice::gamepad_btn_input(code, pressed); } - virtual const char *get_button_name(u32 code) override + const char *get_button_name(u32 code) override { switch (code) { From 28d7227ba57ea1147f8ba70bfc7b0ba4e5a58732 Mon Sep 17 00:00:00 2001 From: scribam Date: Sat, 13 Mar 2021 13:04:48 +0100 Subject: [PATCH 2/6] clang-tidy: run modernize-use-bool-literals --- core/hw/arm7/arm_mem.cpp | 2 +- core/hw/bba/rtl8139c.cpp | 2 +- core/hw/naomi/naomi_cart.h | 2 +- core/hw/sh4/dyna/blockmanager.cpp | 2 +- core/rend/gl4/gldraw.cpp | 20 ++++++++++---------- core/rend/gles/gldraw.cpp | 4 ++-- core/rend/osd.cpp | 6 +++--- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/core/hw/arm7/arm_mem.cpp b/core/hw/arm7/arm_mem.cpp index 53c3a4572..4429dde21 100644 --- a/core/hw/arm7/arm_mem.cpp +++ b/core/hw/arm7/arm_mem.cpp @@ -18,7 +18,7 @@ void update_e68k() { //Set the pending signal //Is L register held here too ? - e68k_out=1; + e68k_out=true; e68k_reg_L=aica_reg_L; update_armintc(); diff --git a/core/hw/bba/rtl8139c.cpp b/core/hw/bba/rtl8139c.cpp index b5bbcde3b..fa91b5b7b 100644 --- a/core/hw/bba/rtl8139c.cpp +++ b/core/hw/bba/rtl8139c.cpp @@ -1035,7 +1035,7 @@ static void rtl8139_BasicModeCtrl_write(RTL8139State *s, uint32_t val) /* mask unwritable bits */ uint32_t mask = 0xccff; - if (1 || !rtl8139_config_writable(s)) + if (true || !rtl8139_config_writable(s)) { /* Speed setting and autonegotiation enable bits are read-only */ mask |= 0x3000; diff --git a/core/hw/naomi/naomi_cart.h b/core/hw/naomi/naomi_cart.h index 094b41ce2..24d8a065e 100644 --- a/core/hw/naomi/naomi_cart.h +++ b/core/hw/naomi/naomi_cart.h @@ -33,7 +33,7 @@ protected: class NaomiCartridge : public Cartridge { public: - NaomiCartridge(u32 size) : Cartridge(size), RomPioOffset(0), RomPioAutoIncrement(0), DmaOffset(0), DmaCount(0xffff) {} + NaomiCartridge(u32 size) : Cartridge(size), RomPioOffset(0), RomPioAutoIncrement(false), DmaOffset(0), DmaCount(0xffff) {} u32 ReadMem(u32 address, u32 size) override; void WriteMem(u32 address, u32 data, u32 size) override; diff --git a/core/hw/sh4/dyna/blockmanager.cpp b/core/hw/sh4/dyna/blockmanager.cpp index a1a4b7e12..fa639094e 100644 --- a/core/hw/sh4/dyna/blockmanager.cpp +++ b/core/hw/sh4/dyna/blockmanager.cpp @@ -651,7 +651,7 @@ void print_blocks() if (print_stats) { f=fopen(get_writable_data_path("blkmap.lst").c_str(),"w"); - print_stats=0; + print_stats=false; INFO_LOG(DYNAREC, "Writing blocks to %p", f); } diff --git a/core/rend/gl4/gldraw.cpp b/core/rend/gl4/gldraw.cpp index 551862391..ae53cc132 100644 --- a/core/rend/gl4/gldraw.cpp +++ b/core/rend/gl4/gldraw.cpp @@ -106,13 +106,13 @@ static void SetGPState(const PolyParam* gp) if (pass == Pass::Depth) { - CurrentShader = gl4GetProgram(Type == ListType_Punch_Through ? 1 : 0, + CurrentShader = gl4GetProgram(Type == ListType_Punch_Through ? true : false, clipmode == TileClipping::Inside, - Type == ListType_Punch_Through ? gp->pcw.Texture : 0, - 1, + Type == ListType_Punch_Through ? gp->pcw.Texture : false, + true, gp->tsp.IgnoreTexA, 0, - 0, + false, 2, false, // TODO Can PT have two different textures for area 0 and 1 ?? false, @@ -130,7 +130,7 @@ static void SetGPState(const PolyParam* gp) int fog_ctrl = config::Fog ? gp->tsp.FogCtrl : 2; palette = BaseTextureCacheData::IsGpuHandledPaletted(gp->tsp, gp->tcw); - CurrentShader = gl4GetProgram(Type == ListType_Punch_Through ? 1 : 0, + CurrentShader = gl4GetProgram(Type == ListType_Punch_Through ? true : false, clipmode == TileClipping::Inside, gp->pcw.Texture, gp->tsp.UseAlpha, @@ -677,13 +677,13 @@ static void gl4_draw_quad_texture(GLuint texture, float w, float h) gl4ShaderUniforms.trilinear_alpha = 1.0; - CurrentShader = gl4GetProgram(0, + CurrentShader = gl4GetProgram(false, false, - 1, - 0, - 1, - 0, + true, + false, + true, 0, + false, 2, false, false, diff --git a/core/rend/gles/gldraw.cpp b/core/rend/gles/gldraw.cpp index 854dfa437..2ea6be042 100644 --- a/core/rend/gles/gldraw.cpp +++ b/core/rend/gles/gldraw.cpp @@ -122,7 +122,7 @@ __forceinline TileClipping clipmode = GetTileClip(gp->tileclip, ViewportMatrix, clip_rect); bool palette = BaseTextureCacheData::IsGpuHandledPaletted(gp->tsp, gp->tcw); - CurrentShader = GetProgram(Type == ListType_Punch_Through ? 1 : 0, + CurrentShader = GetProgram(Type == ListType_Punch_Through ? true : false, clipmode == TileClipping::Inside, gp->pcw.Texture, gp->tsp.UseAlpha, @@ -653,7 +653,7 @@ static void DrawQuad(GLuint texId, float x, float y, float w, float h, float u0, ShaderUniforms.trilinear_alpha = 1.0; - PipelineShader *shader = GetProgram(0, false, 1, 0, 1, 0, 0, 2, false, false, false, false, false); + PipelineShader *shader = GetProgram(false, false, true, false, true, 0, false, 2, false, false, false, false, false); glcache.UseProgram(shader->program); glActiveTexture(GL_TEXTURE0); diff --git a/core/rend/osd.cpp b/core/rend/osd.cpp index 26f14b568..2d31fa4b6 100644 --- a/core/rend/osd.cpp +++ b/core/rend/osd.cpp @@ -113,10 +113,10 @@ const std::vector& GetOSDVertices() DrawButton(vjoy_pos[10], rt[0]); - DrawButton2(vjoy_pos[11], 1); - DrawButton2(vjoy_pos[12], 0); + DrawButton2(vjoy_pos[11], true); + DrawButton2(vjoy_pos[12], false); - DrawButton2(vjoy_pos[13], 0); + DrawButton2(vjoy_pos[13], false); return osdVertices; } From ae47ff98757e03d9a4d9cc13141af5eaf7a0b2ad Mon Sep 17 00:00:00 2001 From: scribam Date: Sat, 13 Mar 2021 13:13:22 +0100 Subject: [PATCH 3/6] clang-tidy: run modernize-deprecated-headers --- core/hw/sh4/dyna/shil_canonical.h | 2 +- core/hw/sh4/modules/serial.cpp | 4 ++-- core/imgread/ioctl.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/hw/sh4/dyna/shil_canonical.h b/core/hw/sh4/dyna/shil_canonical.h index 9971e80e8..f03c82c6a 100644 --- a/core/hw/sh4/dyna/shil_canonical.h +++ b/core/hw/sh4/dyna/shil_canonical.h @@ -97,7 +97,7 @@ extern "C" f32 fipr_asm(float* fn, float* fm); #if SHIL_MODE==1 || SHIL_MODE==2 //only in structs we use the code :) -#include +#include #include "types.h" #include "shil.h" #include "decoder.h" diff --git a/core/hw/sh4/modules/serial.cpp b/core/hw/sh4/modules/serial.cpp index 3f9b987c1..504fe0cad 100644 --- a/core/hw/sh4/modules/serial.cpp +++ b/core/hw/sh4/modules/serial.cpp @@ -2,9 +2,9 @@ Dreamcast serial port. This is missing most of the functionality, but works for KOS (And thats all that uses it) */ -#include +#include +#include #include -#include #ifndef _WIN32 #include #include diff --git a/core/imgread/ioctl.cpp b/core/imgread/ioctl.cpp index 01e303087..019d81ade 100644 --- a/core/imgread/ioctl.cpp +++ b/core/imgread/ioctl.cpp @@ -3,7 +3,7 @@ #ifdef _WIN32 #include "common.h" -#include +#include #include #include From d1239dea89f698d7c40aaabe57e3f4b6f216b7a7 Mon Sep 17 00:00:00 2001 From: scribam Date: Sat, 13 Mar 2021 13:43:37 +0100 Subject: [PATCH 4/6] clang-tidy: run modernize-redundant-void-arg --- core/rend/gl4/gles.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/rend/gl4/gles.cpp b/core/rend/gl4/gles.cpp index fa2f70904..22cba56cc 100644 --- a/core/rend/gl4/gles.cpp +++ b/core/rend/gl4/gles.cpp @@ -480,7 +480,7 @@ void gl4_delete_shaders() gl4.modvol_shader.program = 0; } -static void gl4_term(void) +static void gl4_term() { glDeleteBuffers(1, &gl4.vbo.geometry); gl4.vbo.geometry = 0; From af0c267d965f6279ba67a73d552025062c05f25c Mon Sep 17 00:00:00 2001 From: scribam Date: Sat, 13 Mar 2021 13:47:38 +0100 Subject: [PATCH 5/6] clang-tidy: run modernize-use-emplace --- core/hw/naomi/naomi_cart.cpp | 4 ++-- core/network/miniupnp.cpp | 2 +- core/rend/gui_util.cpp | 4 ++-- core/rend/vulkan/oit/oit_buffer.h | 6 +++--- core/rend/vulkan/oit/oit_drawer.h | 2 +- core/rend/vulkan/oit/oit_pipeline.h | 22 +++++++++++----------- core/rend/vulkan/pipeline.h | 16 ++++++++-------- core/rend/vulkan/quad.cpp | 3 +-- 8 files changed, 29 insertions(+), 30 deletions(-) diff --git a/core/hw/naomi/naomi_cart.cpp b/core/hw/naomi/naomi_cart.cpp index 638185a70..d0070864e 100644 --- a/core/hw/naomi/naomi_cart.cpp +++ b/core/hw/naomi/naomi_cart.cpp @@ -443,7 +443,7 @@ void naomi_cart_LoadRom(const char* file) u32 addr, sz; if (sscanf(line, "\"%[^\"]\",%x,%x", filename, &addr, &sz) == 3) { - files.push_back(filename); + files.emplace_back(filename); fstart.push_back(addr); fsize.push_back(sz); romSize = std::max(romSize, (addr + sz)); @@ -465,7 +465,7 @@ void naomi_cart_LoadRom(const char* file) std::fseek(fp, 0, SEEK_END); u32 file_size = (u32)std::ftell(fp); std::fclose(fp); - files.push_back(file); + files.emplace_back(file); fstart.push_back(0); fsize.push_back(file_size); romSize = file_size; diff --git a/core/network/miniupnp.cpp b/core/network/miniupnp.cpp index dc2786ddf..e046a02c0 100644 --- a/core/network/miniupnp.cpp +++ b/core/network/miniupnp.cpp @@ -76,6 +76,6 @@ bool MiniUPnP::AddPortMapping(int port, bool tcp) INFO_LOG(MODEM, "Port %d redirection failed: error %d", port, error); return false; } - mappedPorts.push_back(std::make_pair(portStr, tcp)); + mappedPorts.emplace_back(portStr, tcp); return true; } diff --git a/core/rend/gui_util.cpp b/core/rend/gui_util.cpp index eefaca878..7ea5f1022 100644 --- a/core/rend/gui_util.cpp +++ b/core/rend/gui_util.cpp @@ -134,7 +134,7 @@ void select_directory_popup(const char *prompt, float scaling, StringCallback ca if (dir == NULL) { error_message = "Cannot read " + select_current_directory; - select_subfolders.push_back(".."); + select_subfolders.emplace_back(".."); } else { @@ -183,7 +183,7 @@ void select_directory_popup(const char *prompt, float scaling, StringCallback ca flycast::closedir(dir); #if defined(_WIN32) || defined(__ANDROID__) if (!dotdot_seen) - select_subfolders.push_back(".."); + select_subfolders.emplace_back(".."); #endif } } diff --git a/core/rend/vulkan/oit/oit_buffer.h b/core/rend/vulkan/oit/oit_buffer.h index b76c72e19..c8a9a20e9 100644 --- a/core/rend/vulkan/oit/oit_buffer.h +++ b/core/rend/vulkan/oit/oit_buffer.h @@ -76,11 +76,11 @@ public: vk::DescriptorSetAllocateInfo(context->GetDescriptorPool(), 1, &descSetLayout.get())).front()); std::vector writeDescriptorSets; vk::DescriptorBufferInfo pixelBufferInfo(*pixelBuffer->buffer, 0, VK_WHOLE_SIZE); - writeDescriptorSets.push_back(vk::WriteDescriptorSet(*descSet, 0, 0, 1, vk::DescriptorType::eStorageBuffer, nullptr, &pixelBufferInfo, nullptr)); + writeDescriptorSets.emplace_back(*descSet, 0, 0, 1, vk::DescriptorType::eStorageBuffer, nullptr, &pixelBufferInfo, nullptr); vk::DescriptorBufferInfo pixelCounterBufferInfo(*pixelCounter->buffer, 0, 4); - writeDescriptorSets.push_back(vk::WriteDescriptorSet(*descSet, 1, 0, 1, vk::DescriptorType::eStorageBuffer, nullptr, &pixelCounterBufferInfo, nullptr)); + writeDescriptorSets.emplace_back(*descSet, 1, 0, 1, vk::DescriptorType::eStorageBuffer, nullptr, &pixelCounterBufferInfo, nullptr); vk::DescriptorImageInfo pointerImageInfo(vk::Sampler(), abufferPointerAttachment->GetImageView(), vk::ImageLayout::eGeneral); - writeDescriptorSets.push_back(vk::WriteDescriptorSet(*descSet, 2, 0, 1, vk::DescriptorType::eStorageImage, &pointerImageInfo, nullptr, nullptr)); + writeDescriptorSets.emplace_back(*descSet, 2, 0, 1, vk::DescriptorType::eStorageImage, &pointerImageInfo, nullptr, nullptr); context->GetDevice().updateDescriptorSets(writeDescriptorSets, nullptr); } diff --git a/core/rend/vulkan/oit/oit_drawer.h b/core/rend/vulkan/oit/oit_drawer.h index 33fe6f00d..52ed9dd00 100644 --- a/core/rend/vulkan/oit/oit_drawer.h +++ b/core/rend/vulkan/oit/oit_drawer.h @@ -57,7 +57,7 @@ protected: else while (descriptorSets.size() < GetContext()->GetSwapChainSize()) { - descriptorSets.push_back(OITDescriptorSets()); + descriptorSets.emplace_back(); descriptorSets.back().Init(samplerManager, pipelineManager->GetPipelineLayout(), pipelineManager->GetPerFrameDSLayout(), diff --git a/core/rend/vulkan/oit/oit_pipeline.h b/core/rend/vulkan/oit/oit_pipeline.h index ca01d7951..7296fc75d 100644 --- a/core/rend/vulkan/oit/oit_pipeline.h +++ b/core/rend/vulkan/oit/oit_pipeline.h @@ -100,12 +100,12 @@ public: vk::DescriptorSet perFrameDescSet = *perFrameDescSetsInFlight.back(); std::vector bufferInfos; - bufferInfos.push_back(vk::DescriptorBufferInfo(buffer, vertexUniformOffset, sizeof(VertexShaderUniforms))); - bufferInfos.push_back(vk::DescriptorBufferInfo(buffer, fragmentUniformOffset, sizeof(FragmentShaderUniforms))); + bufferInfos.emplace_back(buffer, vertexUniformOffset, sizeof(VertexShaderUniforms)); + bufferInfos.emplace_back(buffer, fragmentUniformOffset, sizeof(FragmentShaderUniforms)); std::vector writeDescriptorSets; - writeDescriptorSets.push_back(vk::WriteDescriptorSet(perFrameDescSet, 0, 0, 1, vk::DescriptorType::eUniformBuffer, nullptr, &bufferInfos[0], nullptr)); - writeDescriptorSets.push_back(vk::WriteDescriptorSet(perFrameDescSet, 1, 0, 1, vk::DescriptorType::eUniformBuffer, nullptr, &bufferInfos[1], nullptr)); + writeDescriptorSets.emplace_back(perFrameDescSet, 0, 0, 1, vk::DescriptorType::eUniformBuffer, nullptr, &bufferInfos[0], nullptr); + writeDescriptorSets.emplace_back(perFrameDescSet, 1, 0, 1, vk::DescriptorType::eUniformBuffer, nullptr, &bufferInfos[1], nullptr); if (fogImageView) { TSP fogTsp = {}; @@ -115,7 +115,7 @@ public: vk::Sampler fogSampler = samplerManager->GetSampler(fogTsp); static vk::DescriptorImageInfo imageInfo; imageInfo = { fogSampler, fogImageView, vk::ImageLayout::eShaderReadOnlyOptimal }; - writeDescriptorSets.push_back(vk::WriteDescriptorSet(perFrameDescSet, 2, 0, 1, vk::DescriptorType::eCombinedImageSampler, &imageInfo, nullptr, nullptr)); + writeDescriptorSets.emplace_back(perFrameDescSet, 2, 0, 1, vk::DescriptorType::eCombinedImageSampler, &imageInfo, nullptr, nullptr); } if (paletteImageView) { @@ -126,18 +126,18 @@ public: vk::Sampler palSampler = samplerManager->GetSampler(palTsp); static vk::DescriptorImageInfo imageInfo; imageInfo = { palSampler, paletteImageView, vk::ImageLayout::eShaderReadOnlyOptimal }; - writeDescriptorSets.push_back(vk::WriteDescriptorSet(perFrameDescSet, 6, 0, 1, vk::DescriptorType::eCombinedImageSampler, &imageInfo, nullptr, nullptr)); + writeDescriptorSets.emplace_back(perFrameDescSet, 6, 0, 1, vk::DescriptorType::eCombinedImageSampler, &imageInfo, nullptr, nullptr); } if (polyParamsSize > 0) { static vk::DescriptorBufferInfo polyParamsBufferInfo; polyParamsBufferInfo = vk::DescriptorBufferInfo(buffer, polyParamsOffset, polyParamsSize); - writeDescriptorSets.push_back(vk::WriteDescriptorSet(perFrameDescSet, 3, 0, 1, vk::DescriptorType::eStorageBuffer, nullptr, &polyParamsBufferInfo, nullptr)); + writeDescriptorSets.emplace_back(perFrameDescSet, 3, 0, 1, vk::DescriptorType::eStorageBuffer, nullptr, &polyParamsBufferInfo, nullptr); } vk::DescriptorImageInfo stencilImageInfo(vk::Sampler(), stencilImageView, vk::ImageLayout::eDepthStencilReadOnlyOptimal); - writeDescriptorSets.push_back(vk::WriteDescriptorSet(perFrameDescSet, 4, 0, 1, vk::DescriptorType::eInputAttachment, &stencilImageInfo, nullptr, nullptr)); + writeDescriptorSets.emplace_back(perFrameDescSet, 4, 0, 1, vk::DescriptorType::eInputAttachment, &stencilImageInfo, nullptr, nullptr); vk::DescriptorImageInfo depthImageInfo(vk::Sampler(), depthImageView, vk::ImageLayout::eDepthStencilReadOnlyOptimal); - writeDescriptorSets.push_back(vk::WriteDescriptorSet(perFrameDescSet, 5, 0, 1, vk::DescriptorType::eInputAttachment, &depthImageInfo, nullptr, nullptr)); + writeDescriptorSets.emplace_back(perFrameDescSet, 5, 0, 1, vk::DescriptorType::eInputAttachment, &depthImageInfo, nullptr, nullptr); GetContext()->GetDevice().updateDescriptorSets(writeDescriptorSets, nullptr); } @@ -172,14 +172,14 @@ public: vk::DescriptorImageInfo imageInfo0(samplerManager->GetSampler(tsp0), texture->GetReadOnlyImageView(), vk::ImageLayout::eShaderReadOnlyOptimal); std::vector writeDescriptorSets; - writeDescriptorSets.push_back(vk::WriteDescriptorSet(*perPolyDescSets.back(), 0, 0, 1, vk::DescriptorType::eCombinedImageSampler, &imageInfo0, nullptr, nullptr)); + writeDescriptorSets.emplace_back(*perPolyDescSets.back(), 0, 0, 1, vk::DescriptorType::eCombinedImageSampler, &imageInfo0, nullptr, nullptr); if (textureId1 != (u64)-1) { Texture *texture1 = reinterpret_cast(textureId1); vk::DescriptorImageInfo imageInfo1(samplerManager->GetSampler(tsp1), texture1->GetReadOnlyImageView(), vk::ImageLayout::eShaderReadOnlyOptimal); - writeDescriptorSets.push_back(vk::WriteDescriptorSet(*perPolyDescSets.back(), 1, 0, 1, vk::DescriptorType::eCombinedImageSampler, &imageInfo1, nullptr, nullptr)); + writeDescriptorSets.emplace_back(*perPolyDescSets.back(), 1, 0, 1, vk::DescriptorType::eCombinedImageSampler, &imageInfo1, nullptr, nullptr); } GetContext()->GetDevice().updateDescriptorSets(writeDescriptorSets, nullptr); perPolyDescSetsInFlight[index] = std::move(perPolyDescSets.back()); diff --git a/core/rend/vulkan/pipeline.h b/core/rend/vulkan/pipeline.h index 71e4c590d..96e9914ab 100644 --- a/core/rend/vulkan/pipeline.h +++ b/core/rend/vulkan/pipeline.h @@ -54,12 +54,12 @@ public: vk::DescriptorSet perFrameDescSet = *perFrameDescSetsInFlight.back(); std::vector bufferInfos; - bufferInfos.push_back(vk::DescriptorBufferInfo(buffer, vertexUniformOffset, sizeof(VertexShaderUniforms))); - bufferInfos.push_back(vk::DescriptorBufferInfo(buffer, fragmentUniformOffset, sizeof(FragmentShaderUniforms))); + bufferInfos.emplace_back(buffer, vertexUniformOffset, sizeof(VertexShaderUniforms)); + bufferInfos.emplace_back(buffer, fragmentUniformOffset, sizeof(FragmentShaderUniforms)); std::vector writeDescriptorSets; - writeDescriptorSets.push_back(vk::WriteDescriptorSet(perFrameDescSet, 0, 0, 1, vk::DescriptorType::eUniformBuffer, nullptr, &bufferInfos[0], nullptr)); - writeDescriptorSets.push_back(vk::WriteDescriptorSet(perFrameDescSet, 1, 0, 1, vk::DescriptorType::eUniformBuffer, nullptr, &bufferInfos[1], nullptr)); + writeDescriptorSets.emplace_back(perFrameDescSet, 0, 0, 1, vk::DescriptorType::eUniformBuffer, nullptr, &bufferInfos[0], nullptr); + writeDescriptorSets.emplace_back(perFrameDescSet, 1, 0, 1, vk::DescriptorType::eUniformBuffer, nullptr, &bufferInfos[1], nullptr); if (fogImageView) { TSP fogTsp = {}; @@ -69,7 +69,7 @@ public: vk::Sampler fogSampler = samplerManager->GetSampler(fogTsp); static vk::DescriptorImageInfo imageInfo; imageInfo = { fogSampler, fogImageView, vk::ImageLayout::eShaderReadOnlyOptimal }; - writeDescriptorSets.push_back(vk::WriteDescriptorSet(perFrameDescSet, 2, 0, 1, vk::DescriptorType::eCombinedImageSampler, &imageInfo, nullptr, nullptr)); + writeDescriptorSets.emplace_back(perFrameDescSet, 2, 0, 1, vk::DescriptorType::eCombinedImageSampler, &imageInfo, nullptr, nullptr); } if (paletteImageView) { @@ -80,7 +80,7 @@ public: vk::Sampler palSampler = samplerManager->GetSampler(palTsp); static vk::DescriptorImageInfo imageInfo; imageInfo = { palSampler, paletteImageView, vk::ImageLayout::eShaderReadOnlyOptimal }; - writeDescriptorSets.push_back(vk::WriteDescriptorSet(perFrameDescSet, 3, 0, 1, vk::DescriptorType::eCombinedImageSampler, &imageInfo, nullptr, nullptr)); + writeDescriptorSets.emplace_back(perFrameDescSet, 3, 0, 1, vk::DescriptorType::eCombinedImageSampler, &imageInfo, nullptr, nullptr); } GetContext()->GetDevice().updateDescriptorSets(writeDescriptorSets, nullptr); } @@ -102,7 +102,7 @@ public: vk::DescriptorImageInfo imageInfo(samplerManager->GetSampler(tsp), texture->GetReadOnlyImageView(), vk::ImageLayout::eShaderReadOnlyOptimal); std::vector writeDescriptorSets; - writeDescriptorSets.push_back(vk::WriteDescriptorSet(*perPolyDescSets.back(), 0, 0, 1, vk::DescriptorType::eCombinedImageSampler, &imageInfo, nullptr, nullptr)); + writeDescriptorSets.emplace_back(*perPolyDescSets.back(), 0, 0, 1, vk::DescriptorType::eCombinedImageSampler, &imageInfo, nullptr, nullptr); GetContext()->GetDevice().updateDescriptorSets(writeDescriptorSets, nullptr); inFlight[index] = std::move(perPolyDescSets.back()); @@ -365,7 +365,7 @@ public: } vk::DescriptorImageInfo imageInfo(*sampler, imageView, vk::ImageLayout::eShaderReadOnlyOptimal); std::vector writeDescriptorSets; - writeDescriptorSets.push_back(vk::WriteDescriptorSet(*descriptorSet, 0, 0, 1, vk::DescriptorType::eCombinedImageSampler, &imageInfo, nullptr, nullptr)); + writeDescriptorSets.emplace_back(*descriptorSet, 0, 0, 1, vk::DescriptorType::eCombinedImageSampler, &imageInfo, nullptr, nullptr); GetContext()->GetDevice().updateDescriptorSets(writeDescriptorSets, nullptr); } diff --git a/core/rend/vulkan/quad.cpp b/core/rend/vulkan/quad.cpp index 2fc375780..eb1bc87f0 100644 --- a/core/rend/vulkan/quad.cpp +++ b/core/rend/vulkan/quad.cpp @@ -199,8 +199,7 @@ void QuadDrawer::Draw(vk::CommandBuffer commandBuffer, vk::ImageView imageView, } vk::DescriptorImageInfo imageInfo(nearestFilter ? pipeline->GetNearestSampler() : pipeline->GetLinearSampler(), imageView, vk::ImageLayout::eShaderReadOnlyOptimal); std::vector writeDescriptorSets; - writeDescriptorSets.push_back( - vk::WriteDescriptorSet(*descSet, 0, 0, 1, vk::DescriptorType::eCombinedImageSampler, &imageInfo, nullptr, nullptr)); + writeDescriptorSets.emplace_back(*descSet, 0, 0, 1, vk::DescriptorType::eCombinedImageSampler, &imageInfo, nullptr, nullptr); context->GetDevice().updateDescriptorSets(writeDescriptorSets, nullptr); commandBuffer.bindDescriptorSets(vk::PipelineBindPoint::eGraphics, pipeline->GetPipelineLayout(), 0, 1, &descSet.get(), 0, nullptr); From fe17d79e8da08692db31dd9b6610740b0f334a66 Mon Sep 17 00:00:00 2001 From: scribam Date: Sat, 13 Mar 2021 14:13:39 +0100 Subject: [PATCH 6/6] clang-tidy: run performance-unnecessary-value-param --- core/hw/sh4/dyna/blockmanager.cpp | 4 ++-- core/hw/sh4/dyna/blockmanager.h | 4 ++-- core/input/gamepad_device.cpp | 4 ++-- core/input/gamepad_device.h | 4 ++-- core/input/mapping.cpp | 2 +- core/input/mapping.h | 2 +- core/oslib/directory.h | 2 +- core/rend/gui.cpp | 2 +- core/rend/vulkan/buffer.cpp | 2 +- core/rend/vulkan/buffer.h | 4 ++-- core/rend/vulkan/texture.cpp | 6 +++--- core/rend/vulkan/texture.h | 6 +++--- core/rend/vulkan/utils.h | 2 +- 13 files changed, 22 insertions(+), 22 deletions(-) diff --git a/core/hw/sh4/dyna/blockmanager.cpp b/core/hw/sh4/dyna/blockmanager.cpp index fa639094e..47d91af51 100644 --- a/core/hw/sh4/dyna/blockmanager.cpp +++ b/core/hw/sh4/dyna/blockmanager.cpp @@ -507,12 +507,12 @@ RuntimeBlockInfo::~RuntimeBlockInfo() } } -void RuntimeBlockInfo::AddRef(RuntimeBlockInfoPtr other) +void RuntimeBlockInfo::AddRef(const RuntimeBlockInfoPtr& other) { pre_refs.push_back(other); } -void RuntimeBlockInfo::RemRef(RuntimeBlockInfoPtr other) +void RuntimeBlockInfo::RemRef(const RuntimeBlockInfoPtr& other) { bm_List::iterator it = std::find(pre_refs.begin(), pre_refs.end(), other); if (it != pre_refs.end()) diff --git a/core/hw/sh4/dyna/blockmanager.h b/core/hw/sh4/dyna/blockmanager.h index c6d2823c3..b7d1c537f 100644 --- a/core/hw/sh4/dyna/blockmanager.h +++ b/core/hw/sh4/dyna/blockmanager.h @@ -68,8 +68,8 @@ struct RuntimeBlockInfo: RuntimeBlockInfo_Core //predecessors references std::vector pre_refs; - void AddRef(RuntimeBlockInfoPtr other); - void RemRef(RuntimeBlockInfoPtr other); + void AddRef(const RuntimeBlockInfoPtr& other); + void RemRef(const RuntimeBlockInfoPtr& other); void Discard(); void SetProtectedFlags(); diff --git a/core/input/gamepad_device.cpp b/core/input/gamepad_device.cpp index 972c52bc4..6df514507 100644 --- a/core/input/gamepad_device.cpp +++ b/core/input/gamepad_device.cpp @@ -406,7 +406,7 @@ static FILE *get_record_input(bool write) } #endif -void GamepadDevice::Register(std::shared_ptr gamepad) +void GamepadDevice::Register(const std::shared_ptr& gamepad) { int maple_port = cfgLoadInt("input", MAPLE_PORT_CFG_PREFIX + gamepad->unique_id(), 12345); @@ -425,7 +425,7 @@ void GamepadDevice::Register(std::shared_ptr gamepad) _gamepads_mutex.unlock(); } -void GamepadDevice::Unregister(std::shared_ptr gamepad) +void GamepadDevice::Unregister(const std::shared_ptr& gamepad) { gamepad->save_mapping(); _gamepads_mutex.lock(); diff --git a/core/input/gamepad_device.h b/core/input/gamepad_device.h index 9ff9b885a..5b225137b 100644 --- a/core/input/gamepad_device.h +++ b/core/input/gamepad_device.h @@ -57,9 +57,9 @@ public: virtual void update_rumble() {} bool is_rumble_enabled() { return _rumble_enabled; } - static void Register(std::shared_ptr gamepad); + static void Register(const std::shared_ptr& gamepad); - static void Unregister(std::shared_ptr gamepad); + static void Unregister(const std::shared_ptr& gamepad); static int GetGamepadCount(); static std::shared_ptr GetGamepad(int index); diff --git a/core/input/mapping.cpp b/core/input/mapping.cpp index de37282e2..07bae18e7 100644 --- a/core/input/mapping.cpp +++ b/core/input/mapping.cpp @@ -284,7 +284,7 @@ bool InputMapping::save(const char *name) return true; } -void InputMapping::SaveMapping(const char *name, std::shared_ptr mapping) +void InputMapping::SaveMapping(const char *name, const std::shared_ptr& mapping) { mapping->save(name); InputMapping::loaded_mappings[name] = mapping; diff --git a/core/input/mapping.h b/core/input/mapping.h index c68579ab7..95fd773e5 100644 --- a/core/input/mapping.h +++ b/core/input/mapping.h @@ -80,7 +80,7 @@ public: bool is_dirty() { return dirty; } static std::shared_ptr LoadMapping(const char *name); - static void SaveMapping(const char *name, std::shared_ptr mapping); + static void SaveMapping(const char *name, const std::shared_ptr& mapping); protected: bool dirty = false; diff --git a/core/oslib/directory.h b/core/oslib/directory.h index 693b95636..d21870fd1 100644 --- a/core/oslib/directory.h +++ b/core/oslib/directory.h @@ -137,7 +137,7 @@ public: class iterator { private: - iterator(DIR *dir, std::string pathname) { + iterator(DIR *dir, const std::string& pathname) { if (dir != nullptr) { dirs.push_back(dir); diff --git a/core/rend/gui.cpp b/core/rend/gui.cpp index a9969855c..809370c9d 100644 --- a/core/rend/gui.cpp +++ b/core/rend/gui.cpp @@ -634,7 +634,7 @@ static void detect_input_popup(int index, bool analog) ImGui::PopStyleVar(2); } -static void controller_mapping_popup(std::shared_ptr gamepad) +static void controller_mapping_popup(const std::shared_ptr& gamepad) { ImGui::SetNextWindowPos(ImVec2(0, 0)); ImGui::SetNextWindowSize(ImVec2(screen_width, screen_height)); diff --git a/core/rend/vulkan/buffer.cpp b/core/rend/vulkan/buffer.cpp index 70e96421d..19acf3b9f 100644 --- a/core/rend/vulkan/buffer.cpp +++ b/core/rend/vulkan/buffer.cpp @@ -22,7 +22,7 @@ #include "utils.h" #include "vulkan_context.h" -BufferData::BufferData(vk::DeviceSize size, vk::BufferUsageFlags usage, vk::MemoryPropertyFlags propertyFlags) +BufferData::BufferData(vk::DeviceSize size, const vk::BufferUsageFlags& usage, const vk::MemoryPropertyFlags& propertyFlags) : bufferSize(size), m_usage(usage), m_propertyFlags(propertyFlags) { VulkanContext *context = VulkanContext::Instance(); diff --git a/core/rend/vulkan/buffer.h b/core/rend/vulkan/buffer.h index f0fbdd5ad..8c3c64dfd 100644 --- a/core/rend/vulkan/buffer.h +++ b/core/rend/vulkan/buffer.h @@ -24,8 +24,8 @@ struct BufferData { - BufferData(vk::DeviceSize size, vk::BufferUsageFlags usage, - vk::MemoryPropertyFlags propertyFlags = vk::MemoryPropertyFlagBits::eHostVisible | vk::MemoryPropertyFlagBits::eHostCoherent); + BufferData(vk::DeviceSize size, const vk::BufferUsageFlags& usage, + const vk::MemoryPropertyFlags& propertyFlags = vk::MemoryPropertyFlagBits::eHostVisible | vk::MemoryPropertyFlagBits::eHostCoherent); ~BufferData() { buffer.reset(); diff --git a/core/rend/vulkan/texture.cpp b/core/rend/vulkan/texture.cpp index 671071a3c..83eb4c5d8 100644 --- a/core/rend/vulkan/texture.cpp +++ b/core/rend/vulkan/texture.cpp @@ -226,8 +226,8 @@ void Texture::Init(u32 width, u32 height, vk::Format format, u32 dataSize, bool CreateImage(imageTiling, usageFlags, initialLayout, vk::ImageAspectFlagBits::eColor); } -void Texture::CreateImage(vk::ImageTiling tiling, vk::ImageUsageFlags usage, vk::ImageLayout initialLayout, - vk::ImageAspectFlags aspectMask) +void Texture::CreateImage(vk::ImageTiling tiling, const vk::ImageUsageFlags& usage, vk::ImageLayout initialLayout, + const vk::ImageAspectFlags& aspectMask) { vk::ImageCreateInfo imageCreateInfo(vk::ImageCreateFlags(), vk::ImageType::e2D, format, vk::Extent3D(extent, 1), mipmapLevels, 1, vk::SampleCountFlagBits::e1, tiling, usage, @@ -393,7 +393,7 @@ void Texture::GenerateMipmaps() commandBuffer.pipelineBarrier(vk::PipelineStageFlagBits::eTransfer, vk::PipelineStageFlagBits::eFragmentShader, {}, nullptr, nullptr, barrier); } -void FramebufferAttachment::Init(u32 width, u32 height, vk::Format format, vk::ImageUsageFlags usage) +void FramebufferAttachment::Init(u32 width, u32 height, vk::Format format, const vk::ImageUsageFlags& usage) { this->format = format; this->extent = vk::Extent2D { width, height }; diff --git a/core/rend/vulkan/texture.h b/core/rend/vulkan/texture.h index b3511d78a..8fc875baa 100644 --- a/core/rend/vulkan/texture.h +++ b/core/rend/vulkan/texture.h @@ -51,8 +51,8 @@ public: private: void Init(u32 width, u32 height, vk::Format format ,u32 dataSize, bool mipmapped, bool mipmapsIncluded); void SetImage(u32 size, void *data, bool isNew, bool genMipmaps); - void CreateImage(vk::ImageTiling tiling, vk::ImageUsageFlags usage, vk::ImageLayout initialLayout, - vk::ImageAspectFlags aspectMask); + void CreateImage(vk::ImageTiling tiling, const vk::ImageUsageFlags& usage, vk::ImageLayout initialLayout, + const vk::ImageAspectFlags& aspectMask); void GenerateMipmaps(); vk::Format format = vk::Format::eUndefined; @@ -111,7 +111,7 @@ public: FramebufferAttachment(vk::PhysicalDevice physicalDevice, vk::Device device) : format(vk::Format::eUndefined), physicalDevice(physicalDevice), device(device) {} - void Init(u32 width, u32 height, vk::Format format, vk::ImageUsageFlags usage); + void Init(u32 width, u32 height, vk::Format format, const vk::ImageUsageFlags& usage); void Reset() { image.reset(); imageView.reset(); } vk::ImageView GetImageView() const { return *imageView; } diff --git a/core/rend/vulkan/utils.h b/core/rend/vulkan/utils.h index 0caa16178..fe83eb52a 100644 --- a/core/rend/vulkan/utils.h +++ b/core/rend/vulkan/utils.h @@ -60,7 +60,7 @@ static inline vk::BlendFactor getBlendFactor(u32 instr, bool src) } } -static inline u32 findMemoryType(vk::PhysicalDeviceMemoryProperties const& memoryProperties, u32 typeBits, vk::MemoryPropertyFlags requirementsMask) +static inline u32 findMemoryType(vk::PhysicalDeviceMemoryProperties const& memoryProperties, u32 typeBits, const vk::MemoryPropertyFlags& requirementsMask) { u32 typeIndex = u32(~0); for (u32 i = 0; i < memoryProperties.memoryTypeCount; i++)