Replace uintXX_t and intXX_t

This commit is contained in:
Xphalnos 2025-02-05 14:04:40 +01:00
parent 99e3c6e265
commit cb15105a9e
46 changed files with 695 additions and 690 deletions

View file

@ -32,7 +32,7 @@ namespace Arm64Gen
namespace namespace
{ {
// For ADD/SUB // For ADD/SUB
std::optional<std::pair<u32, bool>> IsImmArithmetic(uint64_t input) std::optional<std::pair<u32, bool>> IsImmArithmetic(u64 input)
{ {
if (input < 4096) if (input < 4096)
return std::pair{static_cast<u32>(input), false}; return std::pair{static_cast<u32>(input), false};
@ -3094,7 +3094,7 @@ void ARM64FloatEmitter::EmitScalar3Source(bool isDouble, ARM64Reg Rd, ARM64Reg R
} }
// Scalar floating point immediate // Scalar floating point immediate
void ARM64FloatEmitter::FMOV(ARM64Reg Rd, uint8_t imm8) void ARM64FloatEmitter::FMOV(ARM64Reg Rd, u8 imm8)
{ {
EmitScalarImm(0, 0, 0, 0, Rd, imm8); EmitScalarImm(0, 0, 0, 0, Rd, imm8);
} }

View file

@ -1271,7 +1271,7 @@ public:
void FNMSUB(ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm, ARM64Reg Ra); void FNMSUB(ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm, ARM64Reg Ra);
// Scalar floating point immediate // Scalar floating point immediate
void FMOV(ARM64Reg Rd, uint8_t imm8); void FMOV(ARM64Reg Rd, u8 imm8);
// Vector // Vector
void ADD(u8 size, ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm); void ADD(u8 size, ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm);

View file

@ -303,7 +303,7 @@ void CPUInfo::Detect()
int mib[2]; int mib[2];
size_t len; size_t len;
char hwmodel[256]; char hwmodel[256];
uint64_t isar0; u64 isar0;
mib[0] = CTL_HW; mib[0] = CTL_HW;
mib[1] = HW_MODEL; mib[1] = HW_MODEL;

View file

@ -11,6 +11,8 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "Common/CommonTypes.h"
namespace Common::GekkoAssembler::detail namespace Common::GekkoAssembler::detail
{ {
// Hacky implementation of a case insensitive alphanumeric trie supporting extended entries // Hacky implementation of a case insensitive alphanumeric trie supporting extended entries
@ -39,12 +41,12 @@ public:
return nullptr; return nullptr;
} }
static constexpr size_t NUM_CONNS = 36 + sizeof...(ExtraMatches); static constexpr size_t NUM_CONNS = 36 + sizeof...(ExtraMatches);
static constexpr uint32_t INVALID_CONN = static_cast<uint32_t>(-1); static constexpr u32 INVALID_CONN = static_cast<u32>(-1);
private: private:
struct TrieEntry struct TrieEntry
{ {
std::array<uint32_t, 36 + sizeof...(ExtraMatches)> _conns; std::array<u32, 36 + sizeof...(ExtraMatches)> _conns;
std::optional<V> _val; std::optional<V> _val;
TrieEntry() { _conns.fill(INVALID_CONN); } TrieEntry() { _conns.fill(INVALID_CONN); }
@ -113,7 +115,7 @@ private:
{ {
break; break;
} }
last_e->_conns[idx] = static_cast<uint32_t>(m_entry_pool.size()); last_e->_conns[idx] = static_cast<u32>(m_entry_pool.size());
last_e = &m_entry_pool.emplace_back(); last_e = &m_entry_pool.emplace_back();
} }
} }

View file

@ -9,6 +9,7 @@
#include "Common/Event.h" #include "Common/Event.h"
#include "Common/Flag.h" #include "Common/Flag.h"
#include "Common/CommonTypes.h"
namespace Common namespace Common
{ {
@ -123,7 +124,7 @@ public:
// The optional timeout parameter is a timeout for how periodically the payload should be called. // The optional timeout parameter is a timeout for how periodically the payload should be called.
// Use timeout = 0 to run without a timeout at all. // Use timeout = 0 to run without a timeout at all.
template <class F> template <class F>
void Run(F payload, int64_t timeout = 0) void Run(F payload, s64 timeout = 0)
{ {
// Asserts that Prepare is called at least once before we enter the loop. // Asserts that Prepare is called at least once before we enter the loop.
// But a good implementation should call this before already. // But a good implementation should call this before already.

View file

@ -81,7 +81,7 @@ public:
directories = pe->OptionalHeader.DataDirectory; directories = pe->OptionalHeader.DataDirectory;
} }
template <typename T> template <typename T>
T GetRva(uint32_t rva) T GetRva(u32 rva)
{ {
return reinterpret_cast<T>(base + rva); return reinterpret_cast<T>(base + rva);
} }

View file

@ -740,7 +740,7 @@ void* AchievementManager::FilereaderOpenByVolume(const char* path_utf8)
return state.release(); return state.release();
} }
void AchievementManager::FilereaderSeek(void* file_handle, int64_t offset, int origin) void AchievementManager::FilereaderSeek(void* file_handle, s64 offset, int origin)
{ {
switch (origin) switch (origin)
{ {
@ -756,7 +756,7 @@ void AchievementManager::FilereaderSeek(void* file_handle, int64_t offset, int o
} }
} }
int64_t AchievementManager::FilereaderTell(void* file_handle) s64 AchievementManager::FilereaderTell(void* file_handle)
{ {
return static_cast<FilereaderState*>(file_handle)->position; return static_cast<FilereaderState*>(file_handle)->position;
} }

View file

@ -171,7 +171,7 @@ private:
struct FilereaderState struct FilereaderState
{ {
int64_t position = 0; s64 position = 0;
std::unique_ptr<DiscIO::Volume> volume; std::unique_ptr<DiscIO::Volume> volume;
}; };
@ -179,8 +179,8 @@ private:
static void* FilereaderOpenByFilepath(const char* path_utf8); static void* FilereaderOpenByFilepath(const char* path_utf8);
static void* FilereaderOpenByVolume(const char* path_utf8); static void* FilereaderOpenByVolume(const char* path_utf8);
static void FilereaderSeek(void* file_handle, int64_t offset, int origin); static void FilereaderSeek(void* file_handle, s64 offset, int origin);
static int64_t FilereaderTell(void* file_handle); static s64 FilereaderTell(void* file_handle);
static size_t FilereaderRead(void* file_handle, void* buffer, size_t requested_bytes); static size_t FilereaderRead(void* file_handle, void* buffer, size_t requested_bytes);
static void FilereaderClose(void* file_handle); static void FilereaderClose(void* file_handle);

View file

@ -88,7 +88,7 @@ void CEXIModem::ImmWrite(u32 data, u32 size)
} }
else else
{ // Write device register { // Write device register
u8 reg_num = static_cast<uint8_t>((m_transfer_descriptor >> 24) & 0x1F); u8 reg_num = static_cast<u8>((m_transfer_descriptor >> 24) & 0x1F);
bool should_update_interrupts = false; bool should_update_interrupts = false;
for (; size && reg_num < m_regs.size(); size--) for (; size && reg_num < m_regs.size(); size--)
{ {
@ -154,7 +154,7 @@ u32 CEXIModem::ImmRead(u32 size)
else else
{ {
// Read device register // Read device register
const u8 reg_num = static_cast<uint8_t>((m_transfer_descriptor >> 24) & 0x1F); const u8 reg_num = static_cast<u8>((m_transfer_descriptor >> 24) & 0x1F);
if (reg_num == 0) if (reg_num == 0)
{ {
return 0x02020000; // Device ID (modem) return 0x02020000; // Device ID (modem)

View file

@ -74,8 +74,8 @@ bool Host_UpdateDiscordPresenceRaw(const std::string& details = {}, const std::s
const std::string& large_image_text = {}, const std::string& large_image_text = {},
const std::string& small_image_key = {}, const std::string& small_image_key = {},
const std::string& small_image_text = {}, const std::string& small_image_text = {},
const int64_t start_timestamp = 0, const s64 start_timestamp = 0,
const int64_t end_timestamp = 0, const int party_size = 0, const s64 end_timestamp = 0, const int party_size = 0,
const int party_max = 0); const int party_max = 0);
std::unique_ptr<GBAHostInterface> Host_CreateGBAHost(std::weak_ptr<HW::GBA::Core> core); std::unique_ptr<GBAHostInterface> Host_CreateGBAHost(std::weak_ptr<HW::GBA::Core> core);

View file

@ -189,8 +189,8 @@ IPCReply SetDiscordPresence(Core::System& system, const IOCtlVRequest& request)
std::string small_image_text = std::string small_image_text =
memory.GetString(request.in_vectors[5].address, request.in_vectors[5].size); memory.GetString(request.in_vectors[5].address, request.in_vectors[5].size);
int64_t start_timestamp = memory.Read_U64(request.in_vectors[6].address); s64 start_timestamp = memory.Read_U64(request.in_vectors[6].address);
int64_t end_timestamp = memory.Read_U64(request.in_vectors[7].address); s64 end_timestamp = memory.Read_U64(request.in_vectors[7].address);
int party_size = memory.Read_U32(request.in_vectors[8].address); int party_size = memory.Read_U32(request.in_vectors[8].address);
int party_max = memory.Read_U32(request.in_vectors[9].address); int party_max = memory.Read_U32(request.in_vectors[9].address);

View file

@ -163,7 +163,7 @@ Result<u32> HostFileSystem::WriteBytesToFile(Fd fd, const u8* ptr, u32 count)
return count; return count;
} }
Result<u32> HostFileSystem::SeekFile(Fd fd, std::uint32_t offset, SeekMode mode) Result<u32> HostFileSystem::SeekFile(Fd fd, u32 offset, SeekMode mode)
{ {
Handle* handle = GetHandleFromFd(fd); Handle* handle = GetHandleFromFd(fd);
if (!handle || !handle->host_file->IsOpen()) if (!handle || !handle->host_file->IsOpen())

View file

@ -459,7 +459,7 @@ bool BluetoothRealDevice::SendHCIStoreLinkKeyCommand()
if (m_link_keys.empty()) if (m_link_keys.empty())
return false; return false;
// The HCI command field is limited to uint8_t, and libusb to uint16_t. // The HCI command field is limited to u8, and libusb to u16.
const u8 payload_size = const u8 payload_size =
static_cast<u8>(sizeof(hci_write_stored_link_key_cp)) + static_cast<u8>(sizeof(hci_write_stored_link_key_cp)) +
(sizeof(bdaddr_t) + sizeof(linkkey_t)) * static_cast<u8>(m_link_keys.size()); (sizeof(bdaddr_t) + sizeof(linkkey_t)) * static_cast<u8>(m_link_keys.size());

File diff suppressed because it is too large Load diff

View file

@ -156,9 +156,9 @@
#define L2CAP_OPT_HINT(type) ((type)&L2CAP_OPT_HINT_BIT) #define L2CAP_OPT_HINT(type) ((type)&L2CAP_OPT_HINT_BIT)
#define L2CAP_OPT_HINT_MASK 0x7f #define L2CAP_OPT_HINT_MASK 0x7f
#define L2CAP_OPT_MTU 0x01 #define L2CAP_OPT_MTU 0x01
#define L2CAP_OPT_MTU_SIZE sizeof(uint16_t) #define L2CAP_OPT_MTU_SIZE sizeof(u16)
#define L2CAP_OPT_FLUSH_TIMO 0x02 #define L2CAP_OPT_FLUSH_TIMO 0x02
#define L2CAP_OPT_FLUSH_TIMO_SIZE sizeof(uint16_t) #define L2CAP_OPT_FLUSH_TIMO_SIZE sizeof(u16)
#define L2CAP_OPT_QOS 0x03 #define L2CAP_OPT_QOS 0x03
#define L2CAP_OPT_QOS_SIZE sizeof(l2cap_qos_t) #define L2CAP_OPT_QOS_SIZE sizeof(l2cap_qos_t)
#define L2CAP_OPT_RFC 0x04 #define L2CAP_OPT_RFC 0x04
@ -179,13 +179,13 @@
/* L2CAP Quality of Service option */ /* L2CAP Quality of Service option */
typedef struct typedef struct
{ {
uint8_t flags; /* reserved for future use */ u8 flags; /* reserved for future use */
uint8_t service_type; /* service type */ u8 service_type; /* service type */
uint32_t token_rate; /* bytes per second */ u32 token_rate; /* bytes per second */
uint32_t token_bucket_size; /* bytes */ u32 token_bucket_size; /* bytes */
uint32_t peak_bandwidth; /* bytes per second */ u32 peak_bandwidth; /* bytes per second */
uint32_t latency; /* microseconds */ u32 latency; /* microseconds */
uint32_t delay_variation; /* microseconds */ u32 delay_variation; /* microseconds */
} l2cap_qos_t; } l2cap_qos_t;
/* L2CAP QoS type */ /* L2CAP QoS type */
@ -197,12 +197,12 @@ typedef struct
/* L2CAP Retransmission & Flow Control option */ /* L2CAP Retransmission & Flow Control option */
typedef struct typedef struct
{ {
uint8_t mode; /* RFC mode */ u8 mode; /* RFC mode */
uint8_t window_size; /* bytes */ u8 window_size; /* bytes */
uint8_t max_transmit; /* max retransmissions */ u8 max_transmit; /* max retransmissions */
uint16_t retransmit_timo; /* milliseconds */ u16 retransmit_timo; /* milliseconds */
uint16_t monitor_timo; /* milliseconds */ u16 monitor_timo; /* milliseconds */
uint16_t max_pdu_size; /* bytes */ u16 max_pdu_size; /* bytes */
} l2cap_rfc_t; } l2cap_rfc_t;
/* L2CAP RFC mode */ /* L2CAP RFC mode */
@ -220,14 +220,14 @@ typedef struct
/* L2CAP header */ /* L2CAP header */
typedef struct typedef struct
{ {
uint16_t length; /* payload size */ u16 length; /* payload size */
uint16_t dcid; /* destination channel ID */ u16 dcid; /* destination channel ID */
} l2cap_hdr_t; } l2cap_hdr_t;
/* L2CAP ConnectionLess Traffic (dcid == L2CAP_CLT_CID) */ /* L2CAP ConnectionLess Traffic (dcid == L2CAP_CLT_CID) */
typedef struct typedef struct
{ {
uint16_t psm; /* Protocol/Service Multiplexor */ u16 psm; /* Protocol/Service Multiplexor */
} l2cap_clt_hdr_t; } l2cap_clt_hdr_t;
#define L2CAP_CLT_MTU_MAXIMUM (L2CAP_MTU_MAXIMUM - sizeof(l2cap_clt_hdr_t)) #define L2CAP_CLT_MTU_MAXIMUM (L2CAP_MTU_MAXIMUM - sizeof(l2cap_clt_hdr_t))
@ -235,69 +235,69 @@ typedef struct
/* L2CAP Command header (dcid == L2CAP_SIGNAL_CID) */ /* L2CAP Command header (dcid == L2CAP_SIGNAL_CID) */
typedef struct typedef struct
{ {
uint8_t code; /* command OpCode */ u8 code; /* command OpCode */
uint8_t ident; /* identifier to match request and response */ u8 ident; /* identifier to match request and response */
uint16_t length; /* command parameters length */ u16 length; /* command parameters length */
} l2cap_cmd_hdr_t; } l2cap_cmd_hdr_t;
/* L2CAP Command Reject */ /* L2CAP Command Reject */
#define L2CAP_COMMAND_REJ 0x01 #define L2CAP_COMMAND_REJ 0x01
typedef struct typedef struct
{ {
uint16_t reason; /* reason to reject command */ u16 reason; /* reason to reject command */
uint16_t data[2]; /* optional data */ u16 data[2]; /* optional data */
} l2cap_cmd_rej_cp; } l2cap_cmd_rej_cp;
/* L2CAP Connection Request */ /* L2CAP Connection Request */
#define L2CAP_CONNECT_REQ 0x02 #define L2CAP_CONNECT_REQ 0x02
typedef struct typedef struct
{ {
uint16_t psm; /* Protocol/Service Multiplexor (PSM) */ u16 psm; /* Protocol/Service Multiplexor (PSM) */
uint16_t scid; /* source channel ID */ u16 scid; /* source channel ID */
} l2cap_con_req_cp; } l2cap_con_req_cp;
/* L2CAP Connection Response */ /* L2CAP Connection Response */
#define L2CAP_CONNECT_RSP 0x03 #define L2CAP_CONNECT_RSP 0x03
typedef struct typedef struct
{ {
uint16_t dcid; /* destination channel ID */ u16 dcid; /* destination channel ID */
uint16_t scid; /* source channel ID */ u16 scid; /* source channel ID */
uint16_t result; /* 0x00 - success */ u16 result; /* 0x00 - success */
uint16_t status; /* more info if result != 0x00 */ u16 status; /* more info if result != 0x00 */
} l2cap_con_rsp_cp; } l2cap_con_rsp_cp;
/* L2CAP Configuration Request */ /* L2CAP Configuration Request */
#define L2CAP_CONFIG_REQ 0x04 #define L2CAP_CONFIG_REQ 0x04
typedef struct typedef struct
{ {
uint16_t dcid; /* destination channel ID */ u16 dcid; /* destination channel ID */
uint16_t flags; /* flags */ u16 flags; /* flags */
/* uint8_t options[] -- options */ /* u8 options[] -- options */
} l2cap_cfg_req_cp; } l2cap_cfg_req_cp;
/* L2CAP Configuration Response */ /* L2CAP Configuration Response */
#define L2CAP_CONFIG_RSP 0x05 #define L2CAP_CONFIG_RSP 0x05
typedef struct typedef struct
{ {
uint16_t scid; /* source channel ID */ u16 scid; /* source channel ID */
uint16_t flags; /* flags */ u16 flags; /* flags */
uint16_t result; /* 0x00 - success */ u16 result; /* 0x00 - success */
/* uint8_t options[] -- options */ /* u8 options[] -- options */
} l2cap_cfg_rsp_cp; } l2cap_cfg_rsp_cp;
/* L2CAP configuration option */ /* L2CAP configuration option */
typedef struct typedef struct
{ {
uint8_t type; u8 type;
uint8_t length; u8 length;
/* uint8_t value[] -- option value (depends on type) */ /* u8 value[] -- option value (depends on type) */
} l2cap_cfg_opt_t; } l2cap_cfg_opt_t;
/* L2CAP configuration option value */ /* L2CAP configuration option value */
typedef union typedef union
{ {
uint16_t mtu; /* L2CAP_OPT_MTU */ u16 mtu; /* L2CAP_OPT_MTU */
uint16_t flush_timo; /* L2CAP_OPT_FLUSH_TIMO */ u16 flush_timo; /* L2CAP_OPT_FLUSH_TIMO */
l2cap_qos_t qos; /* L2CAP_OPT_QOS */ l2cap_qos_t qos; /* L2CAP_OPT_QOS */
l2cap_rfc_t rfc; /* L2CAP_OPT_RFC */ l2cap_rfc_t rfc; /* L2CAP_OPT_RFC */
} l2cap_cfg_opt_val_t; } l2cap_cfg_opt_val_t;
@ -306,8 +306,8 @@ typedef union
#define L2CAP_DISCONNECT_REQ 0x06 #define L2CAP_DISCONNECT_REQ 0x06
typedef struct typedef struct
{ {
uint16_t dcid; /* destination channel ID */ u16 dcid; /* destination channel ID */
uint16_t scid; /* source channel ID */ u16 scid; /* source channel ID */
} l2cap_discon_req_cp; } l2cap_discon_req_cp;
/* L2CAP Disconnect Response */ /* L2CAP Disconnect Response */
@ -327,16 +327,16 @@ typedef l2cap_discon_req_cp l2cap_discon_rsp_cp;
#define L2CAP_INFO_REQ 0x0a #define L2CAP_INFO_REQ 0x0a
typedef struct typedef struct
{ {
uint16_t type; /* requested information type */ u16 type; /* requested information type */
} l2cap_info_req_cp; } l2cap_info_req_cp;
/* L2CAP Information Response */ /* L2CAP Information Response */
#define L2CAP_INFO_RSP 0x0b #define L2CAP_INFO_RSP 0x0b
typedef struct typedef struct
{ {
uint16_t type; /* requested information type */ u16 type; /* requested information type */
uint16_t result; /* 0x00 - success */ u16 result; /* 0x00 - success */
/* uint8_t info[] -- info data (depends on type) /* u8 info[] -- info data (depends on type)
* *
* L2CAP_CONNLESS_MTU - 2 bytes connectionless MTU * L2CAP_CONNLESS_MTU - 2 bytes connectionless MTU
*/ */
@ -347,7 +347,7 @@ typedef union
/* L2CAP_CONNLESS_MTU */ /* L2CAP_CONNLESS_MTU */
struct struct
{ {
uint16_t mtu; u16 mtu;
} mtu; } mtu;
} l2cap_info_rsp_data_t; } l2cap_info_rsp_data_t;

View file

@ -139,7 +139,7 @@ static void ExceptionThread(mach_port_t port)
NDR_record_t NDR; NDR_record_t NDR;
exception_type_t exception; exception_type_t exception;
mach_msg_type_number_t codeCnt; mach_msg_type_number_t codeCnt;
int64_t code[2]; s64 code[2];
int flavor; int flavor;
mach_msg_type_number_t old_stateCnt; mach_msg_type_number_t old_stateCnt;
natural_t old_state[THREAD_STATE64_COUNT]; natural_t old_state[THREAD_STATE64_COUNT];

View file

@ -616,7 +616,7 @@ LZMACompressor::LZMACompressor(bool lzma2, int compression_level, u8 compressor_
u8* compressor_data_size_out) u8* compressor_data_size_out)
{ {
// lzma_lzma_preset returns false on success for some reason // lzma_lzma_preset returns false on success for some reason
if (lzma_lzma_preset(&m_options, static_cast<uint32_t>(compression_level))) if (lzma_lzma_preset(&m_options, static_cast<u32>(compression_level)))
{ {
m_initialization_failed = true; m_initialization_failed = true;
return; return;

View file

@ -151,7 +151,7 @@ bool Host_UpdateDiscordPresenceRaw(const std::string& details, const std::string
const std::string& large_image_text, const std::string& large_image_text,
const std::string& small_image_key, const std::string& small_image_key,
const std::string& small_image_text, const std::string& small_image_text,
const int64_t start_timestamp, const int64_t end_timestamp, const s64 start_timestamp, const s64 end_timestamp,
const int party_size, const int party_max) const int party_size, const int party_max)
{ {
#ifdef USE_DISCORD_PRESENCE #ifdef USE_DISCORD_PRESENCE

View file

@ -319,7 +319,7 @@ bool Host_UpdateDiscordPresenceRaw(const std::string& details, const std::string
const std::string& large_image_text, const std::string& large_image_text,
const std::string& small_image_key, const std::string& small_image_key,
const std::string& small_image_text, const std::string& small_image_text,
const int64_t start_timestamp, const int64_t end_timestamp, const s64 start_timestamp, const s64 end_timestamp,
const int party_size, const int party_max) const int party_size, const int party_max)
{ {
#ifdef USE_DISCORD_PRESENCE #ifdef USE_DISCORD_PRESENCE

View file

@ -55,7 +55,7 @@ bool Host_UpdateDiscordPresenceRaw(const std::string& details, const std::string
const std::string& large_image_text, const std::string& large_image_text,
const std::string& small_image_key, const std::string& small_image_key,
const std::string& small_image_text, const std::string& small_image_text,
const int64_t start_timestamp, const int64_t end_timestamp, const s64 start_timestamp, const s64 end_timestamp,
const int party_size, const int party_max) const int party_size, const int party_max)
{ {
return false; return false;

View file

@ -316,7 +316,7 @@ private:
public: public:
IndexedSwitch(const WGI::GameControllerSwitchPosition* swtch, u32 index, IndexedSwitch(const WGI::GameControllerSwitchPosition* swtch, u32 index,
WGI::GameControllerSwitchPosition direction) WGI::GameControllerSwitchPosition direction)
: m_switch(*swtch), m_index(index), m_direction(static_cast<int32_t>(direction)) : m_switch(*swtch), m_index(index), m_direction(static_cast<s32>(direction))
{ {
} }
std::string GetName() const override std::string GetName() const override
@ -331,14 +331,14 @@ private:
// All of the "inbetween" states (e.g. Up-Right) are one-off from the four cardinal // All of the "inbetween" states (e.g. Up-Right) are one-off from the four cardinal
// directions. This tests that the current switch state value is within 1 of the desired // directions. This tests that the current switch state value is within 1 of the desired
// state. // state.
const auto direction_diff = std::abs(static_cast<int32_t>(m_switch) - m_direction); const auto direction_diff = std::abs(static_cast<s32>(m_switch) - m_direction);
return ControlState(direction_diff <= 1 || direction_diff == 7); return ControlState(direction_diff <= 1 || direction_diff == 7);
} }
private: private:
const WGI::GameControllerSwitchPosition& m_switch; const WGI::GameControllerSwitchPosition& m_switch;
const u32 m_index; const u32 m_index;
const int32_t m_direction; const s32 m_direction;
}; };
class Battery : public Input class Battery : public Input
@ -433,7 +433,7 @@ private:
lbl = WGI::GameControllerButtonLabel::None; lbl = WGI::GameControllerButtonLabel::None;
} }
const int32_t button_name_idx = static_cast<int32_t>(lbl); const s32 button_name_idx = static_cast<int32_t>(lbl);
if (lbl != WGI::GameControllerButtonLabel::None && if (lbl != WGI::GameControllerButtonLabel::None &&
button_name_idx < wgi_button_names.size()) button_name_idx < wgi_button_names.size())
AddInput(new NamedButton(&button, wgi_button_names[button_name_idx])); AddInput(new NamedButton(&button, wgi_button_names[button_name_idx]));
@ -452,7 +452,7 @@ private:
void PopulateHaptics() void PopulateHaptics()
{ {
static const std::map<uint16_t, std::string> waveform_name_map{ static const std::map<u16, std::string> waveform_name_map{
{Haptics::KnownSimpleHapticsControllerWaveforms::Click(), "Click"}, {Haptics::KnownSimpleHapticsControllerWaveforms::Click(), "Click"},
{Haptics::KnownSimpleHapticsControllerWaveforms::BuzzContinuous(), "Buzz"}, {Haptics::KnownSimpleHapticsControllerWaveforms::BuzzContinuous(), "Buzz"},
{Haptics::KnownSimpleHapticsControllerWaveforms::RumbleContinuous(), "Rumble"}, {Haptics::KnownSimpleHapticsControllerWaveforms::RumbleContinuous(), "Rumble"},
@ -467,7 +467,7 @@ private:
for (Haptics::SimpleHapticsControllerFeedback feedback : for (Haptics::SimpleHapticsControllerFeedback feedback :
haptics_controller.SupportedFeedback()) haptics_controller.SupportedFeedback())
{ {
const uint16_t waveform = feedback.Waveform(); const u16 waveform = feedback.Waveform();
auto waveform_name_it = waveform_name_map.find(waveform); auto waveform_name_it = waveform_name_map.find(waveform);
if (waveform_name_it == waveform_name_map.end()) if (waveform_name_it == waveform_name_map.end())
{ {
@ -582,8 +582,8 @@ private:
break; break;
} }
const int32_t full_value = report.FullChargeCapacityInMilliwattHours().GetInt32(); const s32 full_value = report.FullChargeCapacityInMilliwattHours().GetInt32();
const int32_t remaining_value = report.RemainingCapacityInMilliwattHours().GetInt32(); const s32 remaining_value = report.RemainingCapacityInMilliwattHours().GetInt32();
m_battery_level = BATTERY_INPUT_MAX_VALUE * remaining_value / full_value; m_battery_level = BATTERY_INPUT_MAX_VALUE * remaining_value / full_value;
return true; return true;
} }

View file

@ -416,8 +416,8 @@ void InputBackend::StopHotplugThread()
} }
// Write something to efd so that select() stops blocking. // Write something to efd so that select() stops blocking.
const uint64_t value = 1; const u64 value = 1;
static_cast<void>(!write(m_wakeup_eventfd, &value, sizeof(uint64_t))); static_cast<void>(!write(m_wakeup_eventfd, &value, sizeof(u64)));
m_hotplug_thread.join(); m_hotplug_thread.join();
close(m_wakeup_eventfd); close(m_wakeup_eventfd);

View file

@ -23,11 +23,11 @@ static void Uninhibit();
static constexpr char s_app_id[] = "org.DolphinEmu.dolphin-emu"; static constexpr char s_app_id[] = "org.DolphinEmu.dolphin-emu";
// Cookie for the org.freedesktop.ScreenSaver interface // Cookie for the org.freedesktop.ScreenSaver interface
static uint32_t s_fdo_cookie = 0; static u32 s_fdo_cookie = 0;
// Cookie for the org.xfce.ScreenSaver interface // Cookie for the org.xfce.ScreenSaver interface
static uint32_t s_xfce_cookie = 0; static u32 s_xfce_cookie = 0;
// Cookie for the org.mate.ScreenSaver interface // Cookie for the org.mate.ScreenSaver interface
static uint32_t s_mate_cookie = 0; static u32 s_mate_cookie = 0;
// Return handle for the org.freedesktop.portal.Desktop interface // Return handle for the org.freedesktop.portal.Desktop interface
static QString s_portal_handle; static QString s_portal_handle;
@ -53,7 +53,7 @@ static bool InhibitXfce()
if (!interface.isValid()) if (!interface.isValid())
return false; return false;
QDBusReply<uint32_t> reply = interface.call("Inhibit", s_app_id, QObject::tr("Playing a game")); QDBusReply<u32> reply = interface.call("Inhibit", s_app_id, QObject::tr("Playing a game"));
if (interface.lastError().isValid()) if (interface.lastError().isValid())
{ {
WARN_LOG_FMT(VIDEO, "org.xfce.ScreenSaver::Inhibit failed: {}", WARN_LOG_FMT(VIDEO, "org.xfce.ScreenSaver::Inhibit failed: {}",
@ -74,7 +74,7 @@ static bool InhibitMate()
if (!interface.isValid()) if (!interface.isValid())
return false; return false;
QDBusReply<uint32_t> reply = interface.call("Inhibit", s_app_id, QObject::tr("Playing a game")); QDBusReply<u32> reply = interface.call("Inhibit", s_app_id, QObject::tr("Playing a game"));
if (interface.lastError().isValid()) if (interface.lastError().isValid())
{ {
WARN_LOG_FMT(VIDEO, "org.mate.ScreenSaver::Inhibit failed: {}", WARN_LOG_FMT(VIDEO, "org.mate.ScreenSaver::Inhibit failed: {}",
@ -94,7 +94,7 @@ static bool InhibitFDO()
if (!interface.isValid()) if (!interface.isValid())
return false; return false;
QDBusReply<uint32_t> reply = interface.call("Inhibit", s_app_id, QObject::tr("Playing a game")); QDBusReply<u32> reply = interface.call("Inhibit", s_app_id, QObject::tr("Playing a game"));
if (interface.lastError().isValid()) if (interface.lastError().isValid())
{ {
WARN_LOG_FMT(VIDEO, "org.freedesktop.ScreenSaver::Inhibit failed: {}", WARN_LOG_FMT(VIDEO, "org.freedesktop.ScreenSaver::Inhibit failed: {}",
@ -118,7 +118,7 @@ static bool InhibitPortal()
QHash<QString, QVariant> options; QHash<QString, QVariant> options;
options["handle_token"] = "dolphin_" + QString::number(std::rand(), 0x10); options["handle_token"] = "dolphin_" + QString::number(std::rand(), 0x10);
options["reason"] = QObject::tr("Playing a game"); options["reason"] = QObject::tr("Playing a game");
uint32_t flags = 9; // logout | idle u32 flags = 9; // logout | idle
QDBusReply<QDBusObjectPath> reply = interface.call("Inhibit", "", flags, options); QDBusReply<QDBusObjectPath> reply = interface.call("Inhibit", "", flags, options);
if (interface.lastError().isValid()) if (interface.lastError().isValid())
{ {

View file

@ -36,7 +36,7 @@ namespace
{ {
Handler* event_handler = nullptr; Handler* event_handler = nullptr;
const char* username = ""; const char* username = "";
static int64_t s_start_timestamp = std::chrono::duration_cast<std::chrono::seconds>( static s64 s_start_timestamp = std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::system_clock::now().time_since_epoch()) std::chrono::system_clock::now().time_since_epoch())
.count(); .count();
@ -168,8 +168,8 @@ bool UpdateDiscordPresenceRaw(const std::string& details, const std::string& sta
const std::string& large_image_key, const std::string& large_image_key,
const std::string& large_image_text, const std::string& large_image_text,
const std::string& small_image_key, const std::string& small_image_key,
const std::string& small_image_text, const int64_t start_timestamp, const std::string& small_image_text, const s64 start_timestamp,
const int64_t end_timestamp, const int party_size, const s64 end_timestamp, const int party_size,
const int party_max) const int party_max)
{ {
#ifdef USE_DISCORD_PRESENCE #ifdef USE_DISCORD_PRESENCE

View file

@ -6,6 +6,8 @@
#include <functional> #include <functional>
#include <string> #include <string>
#include "Common/CommonTypes.h"
namespace Discord namespace Discord
{ {
// The number is the client ID for Dolphin, it's used for images and the application name // The number is the client ID for Dolphin, it's used for images and the application name
@ -36,7 +38,7 @@ bool UpdateDiscordPresenceRaw(const std::string& details = {}, const std::string
const std::string& large_image_text = {}, const std::string& large_image_text = {},
const std::string& small_image_key = {}, const std::string& small_image_key = {},
const std::string& small_image_text = {}, const std::string& small_image_text = {},
const int64_t start_timestamp = 0, const int64_t end_timestamp = 0, const s64 start_timestamp = 0, const s64 end_timestamp = 0,
const int party_size = 0, const int party_max = 0); const int party_size = 0, const int party_max = 0);
void UpdateDiscordPresence(int party_size = 0, SecretType type = SecretType::Empty, void UpdateDiscordPresence(int party_size = 0, SecretType type = SecretType::Empty,
const std::string& secret = {}, const std::string& current_game = {}, const std::string& secret = {}, const std::string& current_game = {},

View file

@ -68,7 +68,7 @@ bool CommandBufferManager::CreateCommandBuffers()
VkCommandBufferAllocateInfo buffer_info = { VkCommandBufferAllocateInfo buffer_info = {
VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, nullptr, resources.command_pool, VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, nullptr, resources.command_pool,
VK_COMMAND_BUFFER_LEVEL_PRIMARY, static_cast<uint32_t>(resources.command_buffers.size())}; VK_COMMAND_BUFFER_LEVEL_PRIMARY, static_cast<u32>(resources.command_buffers.size())};
res = vkAllocateCommandBuffers(device, &buffer_info, resources.command_buffers.data()); res = vkAllocateCommandBuffers(device, &buffer_info, resources.command_buffers.data());
if (res != VK_SUCCESS) if (res != VK_SUCCESS)
@ -302,7 +302,7 @@ void CommandBufferManager::WaitForCommandBufferCompletion(u32 index)
void CommandBufferManager::SubmitCommandBuffer(bool submit_on_worker_thread, void CommandBufferManager::SubmitCommandBuffer(bool submit_on_worker_thread,
bool wait_for_completion, bool advance_to_next_frame, bool wait_for_completion, bool advance_to_next_frame,
VkSwapchainKHR present_swap_chain, VkSwapchainKHR present_swap_chain,
uint32_t present_image_index) u32 present_image_index)
{ {
// End the current command buffer. // End the current command buffer.
CmdBufferResources& resources = GetCurrentCmdBufferResources(); CmdBufferResources& resources = GetCurrentCmdBufferResources();
@ -387,7 +387,7 @@ void CommandBufferManager::SubmitCommandBuffer(u32 command_buffer_index,
CmdBufferResources& resources = m_command_buffers[command_buffer_index]; CmdBufferResources& resources = m_command_buffers[command_buffer_index];
// This may be executed on the worker thread, so don't modify any state of the manager class. // This may be executed on the worker thread, so don't modify any state of the manager class.
uint32_t wait_bits = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; u32 wait_bits = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
VkSubmitInfo submit_info = {VK_STRUCTURE_TYPE_SUBMIT_INFO, VkSubmitInfo submit_info = {VK_STRUCTURE_TYPE_SUBMIT_INFO,
nullptr, nullptr,
0, 0,

View file

@ -14,7 +14,7 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include <Common/WorkQueueThread.h> #include "Common/WorkQueueThread.h"
#include "Common/BlockingLoop.h" #include "Common/BlockingLoop.h"
#include "Common/Flag.h" #include "Common/Flag.h"
#include "Common/Semaphore.h" #include "Common/Semaphore.h"
@ -87,7 +87,7 @@ public:
void SubmitCommandBuffer(bool submit_on_worker_thread, bool wait_for_completion, void SubmitCommandBuffer(bool submit_on_worker_thread, bool wait_for_completion,
bool advance_to_next_frame = false, bool advance_to_next_frame = false,
VkSwapchainKHR present_swap_chain = VK_NULL_HANDLE, VkSwapchainKHR present_swap_chain = VK_NULL_HANDLE,
uint32_t present_image_index = 0xFFFFFFFF); u32 present_image_index = 0xFFFFFFFF);
// Was the last present submitted to the queue a failure? If so, we must recreate our swapchain. // Was the last present submitted to the queue a failure? If so, we must recreate our swapchain.
bool CheckLastPresentFail() { return m_last_present_failed.TestAndClear(); } bool CheckLastPresentFail() { return m_last_present_failed.TestAndClear(); }

View file

@ -433,7 +433,7 @@ VkRenderPass ObjectCache::GetRenderPass(VkFormat color_format, VkFormat depth_fo
if (color_format != VK_FORMAT_UNDEFINED) if (color_format != VK_FORMAT_UNDEFINED)
{ {
VkAttachmentReference color_reference; VkAttachmentReference color_reference;
color_reference.attachment = static_cast<uint32_t>(attachments.size()); color_reference.attachment = static_cast<u32>(attachments.size());
color_reference.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; color_reference.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
color_attachment_references.push_back(std::move(color_reference)); color_attachment_references.push_back(std::move(color_reference));
attachments.push_back({0, color_format, static_cast<VkSampleCountFlagBits>(multisamples), attachments.push_back({0, color_format, static_cast<VkSampleCountFlagBits>(multisamples),
@ -444,7 +444,7 @@ VkRenderPass ObjectCache::GetRenderPass(VkFormat color_format, VkFormat depth_fo
} }
if (depth_format != VK_FORMAT_UNDEFINED) if (depth_format != VK_FORMAT_UNDEFINED)
{ {
depth_reference.attachment = static_cast<uint32_t>(attachments.size()); depth_reference.attachment = static_cast<u32>(attachments.size());
depth_reference.layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL; depth_reference.layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
depth_reference_ptr = &depth_reference; depth_reference_ptr = &depth_reference;
attachments.push_back({0, depth_format, static_cast<VkSampleCountFlagBits>(multisamples), attachments.push_back({0, depth_format, static_cast<VkSampleCountFlagBits>(multisamples),
@ -457,7 +457,7 @@ VkRenderPass ObjectCache::GetRenderPass(VkFormat color_format, VkFormat depth_fo
for (u8 i = 0; i < additional_attachment_count; i++) for (u8 i = 0; i < additional_attachment_count; i++)
{ {
VkAttachmentReference color_reference; VkAttachmentReference color_reference;
color_reference.attachment = static_cast<uint32_t>(attachments.size()); color_reference.attachment = static_cast<u32>(attachments.size());
color_reference.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; color_reference.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
color_attachment_references.push_back(std::move(color_reference)); color_attachment_references.push_back(std::move(color_reference));
attachments.push_back({0, color_format, static_cast<VkSampleCountFlagBits>(multisamples), attachments.push_back({0, color_format, static_cast<VkSampleCountFlagBits>(multisamples),
@ -472,7 +472,7 @@ VkRenderPass ObjectCache::GetRenderPass(VkFormat color_format, VkFormat depth_fo
VK_PIPELINE_BIND_POINT_GRAPHICS, VK_PIPELINE_BIND_POINT_GRAPHICS,
0, 0,
nullptr, nullptr,
static_cast<uint32_t>(color_attachment_references.size()), static_cast<u32>(color_attachment_references.size()),
color_attachment_references.empty() ? nullptr : color_attachment_references.data(), color_attachment_references.empty() ? nullptr : color_attachment_references.data(),
nullptr, nullptr,
depth_reference_ptr, depth_reference_ptr,
@ -481,7 +481,7 @@ VkRenderPass ObjectCache::GetRenderPass(VkFormat color_format, VkFormat depth_fo
VkRenderPassCreateInfo pass_info = {VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO, VkRenderPassCreateInfo pass_info = {VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO,
nullptr, nullptr,
0, 0,
static_cast<uint32_t>(attachments.size()), static_cast<u32>(attachments.size()),
attachments.data(), attachments.data(),
1, 1,
&subpass, &subpass,

View file

@ -40,8 +40,8 @@ void StagingBuffer::BufferMemoryBarrier(VkCommandBuffer command_buffer, VkBuffer
nullptr, // const void* pNext nullptr, // const void* pNext
src_access_mask, // VkAccessFlags srcAccessMask src_access_mask, // VkAccessFlags srcAccessMask
dst_access_mask, // VkAccessFlags dstAccessMask dst_access_mask, // VkAccessFlags dstAccessMask
VK_QUEUE_FAMILY_IGNORED, // uint32_t srcQueueFamilyIndex VK_QUEUE_FAMILY_IGNORED, // u32 srcQueueFamilyIndex
VK_QUEUE_FAMILY_IGNORED, // uint32_t dstQueueFamilyIndex VK_QUEUE_FAMILY_IGNORED, // u32 dstQueueFamilyIndex
buffer, // VkBuffer buffer buffer, // VkBuffer buffer
offset, // VkDeviceSize offset offset, // VkDeviceSize offset
size // VkDeviceSize size size // VkDeviceSize size
@ -133,8 +133,8 @@ bool StagingBuffer::AllocateBuffer(STAGING_BUFFER_TYPE type, VkDeviceSize size,
size, // VkDeviceSize size size, // VkDeviceSize size
usage, // VkBufferUsageFlags usage usage, // VkBufferUsageFlags usage
VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode sharingMode VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode sharingMode
0, // uint32_t queueFamilyIndexCount 0, // u32 queueFamilyIndexCount
nullptr // const uint32_t* pQueueFamilyIndices nullptr // const u32* pQueueFamilyIndices
}; };
VmaAllocationCreateInfo alloc_create_info = {}; VmaAllocationCreateInfo alloc_create_info = {};

View file

@ -505,7 +505,7 @@ void StateTracker::UpdateGXDescriptorSet()
writes[num_writes++] = {VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, writes[num_writes++] = {VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
nullptr, nullptr,
m_gx_descriptor_sets[0], m_gx_descriptor_sets[0],
static_cast<uint32_t>(i), static_cast<u32>(i),
0, 0,
1, 1,
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC,
@ -721,7 +721,7 @@ void StateTracker::UpdateComputeDescriptorSet()
nullptr, nullptr,
nullptr}; nullptr};
vkUpdateDescriptorSets(g_vulkan_context->GetDevice(), static_cast<uint32_t>(dswrites.size()), vkUpdateDescriptorSets(g_vulkan_context->GetDevice(), static_cast<u32>(dswrites.size()),
dswrites.data(), 0, nullptr); dswrites.data(), 0, nullptr);
m_dirty_flags = m_dirty_flags =
(m_dirty_flags & ~DIRTY_FLAG_COMPUTE_BINDINGS) | DIRTY_FLAG_COMPUTE_DESCRIPTOR_SET; (m_dirty_flags & ~DIRTY_FLAG_COMPUTE_BINDINGS) | DIRTY_FLAG_COMPUTE_DESCRIPTOR_SET;

View file

@ -112,8 +112,8 @@ bool VKBoundingBox::CreateGPUBuffer()
BUFFER_SIZE, // VkDeviceSize size BUFFER_SIZE, // VkDeviceSize size
buffer_usage, // VkBufferUsageFlags usage buffer_usage, // VkBufferUsageFlags usage
VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode sharingMode VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode sharingMode
0, // uint32_t queueFamilyIndexCount 0, // u32 queueFamilyIndexCount
nullptr // const uint32_t* pQueueFamilyIndices nullptr // const u32* pQueueFamilyIndices
}; };
VmaAllocationCreateInfo alloc_create_info = {}; VmaAllocationCreateInfo alloc_create_info = {};

View file

@ -108,7 +108,7 @@ void VKGfx::ClearRegion(const MathUtil::Rectangle<int>& target_rc, bool color_en
{ {
VkRect2D target_vk_rc = { VkRect2D target_vk_rc = {
{target_rc.left, target_rc.top}, {target_rc.left, target_rc.top},
{static_cast<uint32_t>(target_rc.GetWidth()), static_cast<uint32_t>(target_rc.GetHeight())}}; {static_cast<u32>(target_rc.GetWidth()), static_cast<u32>(target_rc.GetHeight())}};
// Convert RGBA8 -> floating-point values. // Convert RGBA8 -> floating-point values.
VkClearValue clear_color_value = {}; VkClearValue clear_color_value = {};
@ -199,7 +199,7 @@ void VKGfx::ClearRegion(const MathUtil::Rectangle<int>& target_rc, bool color_en
StateTracker::GetInstance()->BeginRenderPass(); StateTracker::GetInstance()->BeginRenderPass();
vkCmdClearAttachments(g_command_buffer_mgr->GetCurrentCommandBuffer(), vkCmdClearAttachments(g_command_buffer_mgr->GetCurrentCommandBuffer(),
static_cast<uint32_t>(clear_attachments.size()), static_cast<u32>(clear_attachments.size()),
clear_attachments.data(), 1, &vk_rect); clear_attachments.data(), 1, &vk_rect);
} }
} }

View file

@ -146,7 +146,7 @@ bool PerfQuery::CreateQueryPool()
nullptr, // const void* pNext nullptr, // const void* pNext
0, // VkQueryPoolCreateFlags flags 0, // VkQueryPoolCreateFlags flags
VK_QUERY_TYPE_OCCLUSION, // VkQueryType queryType VK_QUERY_TYPE_OCCLUSION, // VkQueryType queryType
PERF_QUERY_BUFFER_SIZE, // uint32_t queryCount PERF_QUERY_BUFFER_SIZE, // u32 queryCount
0 // VkQueryPipelineStatisticFlags pipelineStatistics; 0 // VkQueryPipelineStatisticFlags pipelineStatistics;
}; };

View file

@ -206,7 +206,7 @@ GetVulkanAttachmentBlendState(const BlendingState& state, AbstractPipelineUsage
static VkPipelineColorBlendStateCreateInfo static VkPipelineColorBlendStateCreateInfo
GetVulkanColorBlendState(const BlendingState& state, GetVulkanColorBlendState(const BlendingState& state,
const VkPipelineColorBlendAttachmentState* attachments, const VkPipelineColorBlendAttachmentState* attachments,
uint32_t num_attachments) u32 num_attachments)
{ {
static constexpr std::array<VkLogicOp, 16> vk_logic_ops = { static constexpr std::array<VkLogicOp, 16> vk_logic_ops = {
{VK_LOGIC_OP_CLEAR, VK_LOGIC_OP_AND, VK_LOGIC_OP_AND_REVERSE, VK_LOGIC_OP_COPY, {VK_LOGIC_OP_CLEAR, VK_LOGIC_OP_AND, VK_LOGIC_OP_AND_REVERSE, VK_LOGIC_OP_COPY,
@ -232,7 +232,7 @@ GetVulkanColorBlendState(const BlendingState& state,
0, // VkPipelineColorBlendStateCreateFlags flags 0, // VkPipelineColorBlendStateCreateFlags flags
vk_logic_op_enable, // VkBool32 logicOpEnable vk_logic_op_enable, // VkBool32 logicOpEnable
vk_logic_op, // VkLogicOp logicOp vk_logic_op, // VkLogicOp logicOp
num_attachments, // uint32_t attachmentCount num_attachments, // u32 attachmentCount
attachments, // const VkPipelineColorBlendAttachmentState* pAttachments attachments, // const VkPipelineColorBlendAttachmentState* pAttachments
{1.0f, 1.0f, 1.0f, 1.0f} // float blendConstants[4] {1.0f, 1.0f, 1.0f, 1.0f} // float blendConstants[4]
}; };
@ -280,9 +280,9 @@ std::unique_ptr<VKPipeline> VKPipeline::Create(const AbstractPipelineConfig& con
VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO, // VkStructureType sType VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO, // VkStructureType sType
nullptr, // const void* pNext nullptr, // const void* pNext
0, // VkPipelineVertexInputStateCreateFlags flags 0, // VkPipelineVertexInputStateCreateFlags flags
0, // uint32_t vertexBindingDescriptionCount 0, // u32 vertexBindingDescriptionCount
nullptr, // const VkVertexInputBindingDescription* pVertexBindingDescriptions nullptr, // const VkVertexInputBindingDescription* pVertexBindingDescriptions
0, // uint32_t vertexAttributeDescriptionCount 0, // u32 vertexAttributeDescriptionCount
nullptr // const VkVertexInputAttributeDescription* pVertexAttributeDescriptions nullptr // const VkVertexInputAttributeDescription* pVertexAttributeDescriptions
}; };
@ -314,7 +314,7 @@ std::unique_ptr<VKPipeline> VKPipeline::Create(const AbstractPipelineConfig& con
// Shaders to stages // Shaders to stages
VkPipelineShaderStageCreateInfo shader_stages[3]; VkPipelineShaderStageCreateInfo shader_stages[3];
uint32_t num_shader_stages = 0; u32 num_shader_stages = 0;
if (config.vertex_shader) if (config.vertex_shader)
{ {
shader_stages[num_shader_stages++] = { shader_stages[num_shader_stages++] = {
@ -366,7 +366,7 @@ std::unique_ptr<VKPipeline> VKPipeline::Create(const AbstractPipelineConfig& con
} }
VkPipelineColorBlendStateCreateInfo blend_state = VkPipelineColorBlendStateCreateInfo blend_state =
GetVulkanColorBlendState(config.blending_state, blend_attachment_states.data(), GetVulkanColorBlendState(config.blending_state, blend_attachment_states.data(),
static_cast<uint32_t>(blend_attachment_states.size())); static_cast<u32>(blend_attachment_states.size()));
// This viewport isn't used, but needs to be specified anyway. // This viewport isn't used, but needs to be specified anyway.
static const VkViewport viewport = {0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f}; static const VkViewport viewport = {0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f};
@ -375,9 +375,9 @@ std::unique_ptr<VKPipeline> VKPipeline::Create(const AbstractPipelineConfig& con
VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO, VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO,
nullptr, nullptr,
0, // VkPipelineViewportStateCreateFlags flags; 0, // VkPipelineViewportStateCreateFlags flags;
1, // uint32_t viewportCount 1, // u32 viewportCount
&viewport, // const VkViewport* pViewports &viewport, // const VkViewport* pViewports
1, // uint32_t scissorCount 1, // u32 scissorCount
&scissor // const VkRect2D* pScissors &scissor // const VkRect2D* pScissors
}; };
@ -389,7 +389,7 @@ std::unique_ptr<VKPipeline> VKPipeline::Create(const AbstractPipelineConfig& con
static const VkPipelineDynamicStateCreateInfo dynamic_state = { static const VkPipelineDynamicStateCreateInfo dynamic_state = {
VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO, nullptr, VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO, nullptr,
0, // VkPipelineDynamicStateCreateFlags flags 0, // VkPipelineDynamicStateCreateFlags flags
static_cast<u32>(dynamic_states.size()), // uint32_t dynamicStateCount static_cast<u32>(dynamic_states.size()), // u32 dynamicStateCount
dynamic_states.data() // const VkDynamicState* pDynamicStates dynamic_states.data() // const VkDynamicState* pDynamicStates
}; };
@ -398,7 +398,7 @@ std::unique_ptr<VKPipeline> VKPipeline::Create(const AbstractPipelineConfig& con
VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO, VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO,
nullptr, // VkStructureType sType nullptr, // VkStructureType sType
0, // VkPipelineCreateFlags flags 0, // VkPipelineCreateFlags flags
num_shader_stages, // uint32_t stageCount num_shader_stages, // u32 stageCount
shader_stages, // const VkPipelineShaderStageCreateInfo* pStages shader_stages, // const VkPipelineShaderStageCreateInfo* pStages
&vertex_input_state, // const VkPipelineVertexInputStateCreateInfo* pVertexInputState &vertex_input_state, // const VkPipelineVertexInputStateCreateInfo* pVertexInputState
&input_assembly_state, // const VkPipelineInputAssemblyStateCreateInfo* pInputAssemblyState &input_assembly_state, // const VkPipelineInputAssemblyStateCreateInfo* pInputAssemblyState
@ -411,9 +411,9 @@ std::unique_ptr<VKPipeline> VKPipeline::Create(const AbstractPipelineConfig& con
&dynamic_state, // const VkPipelineDynamicStateCreateInfo* pDynamicState &dynamic_state, // const VkPipelineDynamicStateCreateInfo* pDynamicState
pipeline_layout, // VkPipelineLayout layout pipeline_layout, // VkPipelineLayout layout
render_pass, // VkRenderPass renderPass render_pass, // VkRenderPass renderPass
0, // uint32_t subpass 0, // u32 subpass
VK_NULL_HANDLE, // VkPipeline basePipelineHandle VK_NULL_HANDLE, // VkPipeline basePipelineHandle
-1 // int32_t basePipelineIndex -1 // s32 basePipelineIndex
}; };
VkPipeline pipeline; VkPipeline pipeline;

View file

@ -24,7 +24,7 @@ VKShader::VKShader(ShaderStage stage, std::vector<u32> spv, VkShaderModule mod,
VkDebugUtilsObjectNameInfoEXT name_info = {}; VkDebugUtilsObjectNameInfoEXT name_info = {};
name_info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT; name_info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT;
name_info.objectType = VK_OBJECT_TYPE_SHADER_MODULE; name_info.objectType = VK_OBJECT_TYPE_SHADER_MODULE;
name_info.objectHandle = reinterpret_cast<uint64_t>(m_module); name_info.objectHandle = reinterpret_cast<u64>(m_module);
name_info.pObjectName = m_name.data(); name_info.pObjectName = m_name.data();
vkSetDebugUtilsObjectNameEXT(g_vulkan_context->GetDevice(), &name_info); vkSetDebugUtilsObjectNameEXT(g_vulkan_context->GetDevice(), &name_info);
} }
@ -39,7 +39,7 @@ VKShader::VKShader(std::vector<u32> spv, VkPipeline compute_pipeline, std::strin
VkDebugUtilsObjectNameInfoEXT name_info = {}; VkDebugUtilsObjectNameInfoEXT name_info = {};
name_info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT; name_info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT;
name_info.objectType = VK_OBJECT_TYPE_PIPELINE; name_info.objectType = VK_OBJECT_TYPE_PIPELINE;
name_info.objectHandle = reinterpret_cast<uint64_t>(m_compute_pipeline); name_info.objectHandle = reinterpret_cast<u64>(m_compute_pipeline);
name_info.pObjectName = m_name.data(); name_info.pObjectName = m_name.data();
vkSetDebugUtilsObjectNameEXT(g_vulkan_context->GetDevice(), &name_info); vkSetDebugUtilsObjectNameEXT(g_vulkan_context->GetDevice(), &name_info);
} }

View file

@ -46,8 +46,8 @@ bool StreamBuffer::AllocateBuffer()
static_cast<VkDeviceSize>(m_size), // VkDeviceSize size static_cast<VkDeviceSize>(m_size), // VkDeviceSize size
m_usage, // VkBufferUsageFlags usage m_usage, // VkBufferUsageFlags usage
VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode sharingMode VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode sharingMode
0, // uint32_t queueFamilyIndexCount 0, // u32 queueFamilyIndexCount
nullptr // const uint32_t* pQueueFamilyIndices nullptr // const u32* pQueueFamilyIndices
}; };
VmaAllocationCreateInfo alloc_create_info = {}; VmaAllocationCreateInfo alloc_create_info = {};

View file

@ -289,7 +289,7 @@ bool SwapChain::CreateSwapChain()
return false; return false;
// Select number of images in swap chain, we prefer one buffer in the background to work on // Select number of images in swap chain, we prefer one buffer in the background to work on
uint32_t image_count = surface_capabilities.minImageCount + 1; u32 image_count = surface_capabilities.minImageCount + 1;
// maxImageCount can be zero, in which case there isn't an upper limit on the number of buffers. // maxImageCount can be zero, in which case there isn't an upper limit on the number of buffers.
if (surface_capabilities.maxImageCount > 0) if (surface_capabilities.maxImageCount > 0)
@ -322,7 +322,7 @@ bool SwapChain::CreateSwapChain()
} }
// Select the number of image layers for Quad-Buffered stereoscopy // Select the number of image layers for Quad-Buffered stereoscopy
uint32_t image_layers = g_ActiveConfig.stereo_mode == StereoMode::QuadBuffer ? 2 : 1; u32 image_layers = g_ActiveConfig.stereo_mode == StereoMode::QuadBuffer ? 2 : 1;
// Store the old/current swap chain when recreating for resize // Store the old/current swap chain when recreating for resize
VkSwapchainKHR old_swap_chain = m_swap_chain; VkSwapchainKHR old_swap_chain = m_swap_chain;
@ -347,7 +347,7 @@ bool SwapChain::CreateSwapChain()
m_present_mode, m_present_mode,
VK_TRUE, VK_TRUE,
old_swap_chain}; old_swap_chain};
std::array<uint32_t, 2> indices = {{ std::array<u32, 2> indices = {{
g_vulkan_context->GetGraphicsQueueFamilyIndex(), g_vulkan_context->GetGraphicsQueueFamilyIndex(),
g_vulkan_context->GetPresentQueueFamilyIndex(), g_vulkan_context->GetPresentQueueFamilyIndex(),
}}; }};
@ -410,7 +410,7 @@ bool SwapChain::SetupSwapChainImages()
{ {
ASSERT(m_swap_chain_images.empty()); ASSERT(m_swap_chain_images.empty());
uint32_t image_count; u32 image_count;
VkResult res = VkResult res =
vkGetSwapchainImagesKHR(g_vulkan_context->GetDevice(), m_swap_chain, &image_count, nullptr); vkGetSwapchainImagesKHR(g_vulkan_context->GetDevice(), m_swap_chain, &image_count, nullptr);
if (res != VK_SUCCESS) if (res != VK_SUCCESS)
@ -438,7 +438,7 @@ bool SwapChain::SetupSwapChainImages()
} }
m_swap_chain_images.reserve(image_count); m_swap_chain_images.reserve(image_count);
for (uint32_t i = 0; i < image_count; i++) for (u32 i = 0; i < image_count; i++)
{ {
SwapChainImage image; SwapChainImage image;
image.image = images[i]; image.image = images[i];

View file

@ -37,7 +37,7 @@ VKTexture::VKTexture(const TextureConfig& tex_config, VmaAllocation alloc, VkIma
VkDebugUtilsObjectNameInfoEXT name_info = {}; VkDebugUtilsObjectNameInfoEXT name_info = {};
name_info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT; name_info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT;
name_info.objectType = VK_OBJECT_TYPE_IMAGE; name_info.objectType = VK_OBJECT_TYPE_IMAGE;
name_info.objectHandle = reinterpret_cast<uint64_t>(image); name_info.objectHandle = reinterpret_cast<u64>(image);
name_info.pObjectName = m_name.c_str(); name_info.pObjectName = m_name.c_str();
vkSetDebugUtilsObjectNameEXT(g_vulkan_context->GetDevice(), &name_info); vkSetDebugUtilsObjectNameEXT(g_vulkan_context->GetDevice(), &name_info);
} }
@ -299,7 +299,7 @@ void VKTexture::CopyRectangleFromTexture(const AbstractTexture* src,
{src_rect.left, src_rect.top, 0}, {src_rect.left, src_rect.top, 0},
{VK_IMAGE_ASPECT_COLOR_BIT, dst_level, dst_layer, copy_layer_count}, {VK_IMAGE_ASPECT_COLOR_BIT, dst_level, dst_layer, copy_layer_count},
{dst_rect.left, dst_rect.top, 0}, {dst_rect.left, dst_rect.top, 0},
{static_cast<uint32_t>(src_rect.GetWidth()), static_cast<uint32_t>(src_rect.GetHeight()), 1}}; {static_cast<u32>(src_rect.GetWidth()), static_cast<u32>(src_rect.GetHeight()), 1}};
// Must be called outside of a render pass. // Must be called outside of a render pass.
StateTracker::GetInstance()->EndRenderPass(); StateTracker::GetInstance()->EndRenderPass();
@ -426,8 +426,8 @@ void VKTexture::Load(u32 level, u32 width, u32 height, u32 row_length, const u8*
// Copy from the streaming buffer to the actual image. // Copy from the streaming buffer to the actual image.
VkBufferImageCopy image_copy = { VkBufferImageCopy image_copy = {
upload_buffer_offset, // VkDeviceSize bufferOffset upload_buffer_offset, // VkDeviceSize bufferOffset
row_length, // uint32_t bufferRowLength row_length, // u32 bufferRowLength
0, // uint32_t bufferImageHeight 0, // u32 bufferImageHeight
{VK_IMAGE_ASPECT_COLOR_BIT, level, layer, 1}, // VkImageSubresourceLayers imageSubresource {VK_IMAGE_ASPECT_COLOR_BIT, level, layer, 1}, // VkImageSubresourceLayers imageSubresource
{0, 0, 0}, // VkOffset3D imageOffset {0, 0, 0}, // VkOffset3D imageOffset
{width, height, 1} // VkExtent3D imageExtent {width, height, 1} // VkExtent3D imageExtent
@ -473,8 +473,8 @@ void VKTexture::TransitionToLayout(VkCommandBuffer command_buffer, VkImageLayout
0, // VkAccessFlags dstAccessMask 0, // VkAccessFlags dstAccessMask
m_layout, // VkImageLayout oldLayout m_layout, // VkImageLayout oldLayout
new_layout, // VkImageLayout newLayout new_layout, // VkImageLayout newLayout
VK_QUEUE_FAMILY_IGNORED, // uint32_t srcQueueFamilyIndex VK_QUEUE_FAMILY_IGNORED, // u32 srcQueueFamilyIndex
VK_QUEUE_FAMILY_IGNORED, // uint32_t dstQueueFamilyIndex VK_QUEUE_FAMILY_IGNORED, // u32 dstQueueFamilyIndex
m_image, // VkImage image m_image, // VkImage image
{GetImageAspectForFormat(GetFormat()), 0, GetLevels(), 0, {GetImageAspectForFormat(GetFormat()), 0, GetLevels(), 0,
GetLayers()} // VkImageSubresourceRange subresourceRange GetLayers()} // VkImageSubresourceRange subresourceRange
@ -620,8 +620,8 @@ void VKTexture::TransitionToLayout(VkCommandBuffer command_buffer,
0, // VkAccessFlags dstAccessMask 0, // VkAccessFlags dstAccessMask
m_layout, // VkImageLayout oldLayout m_layout, // VkImageLayout oldLayout
VK_IMAGE_LAYOUT_GENERAL, // VkImageLayout newLayout VK_IMAGE_LAYOUT_GENERAL, // VkImageLayout newLayout
VK_QUEUE_FAMILY_IGNORED, // uint32_t srcQueueFamilyIndex VK_QUEUE_FAMILY_IGNORED, // u32 srcQueueFamilyIndex
VK_QUEUE_FAMILY_IGNORED, // uint32_t dstQueueFamilyIndex VK_QUEUE_FAMILY_IGNORED, // u32 dstQueueFamilyIndex
m_image, // VkImage image m_image, // VkImage image
{GetImageAspectForFormat(GetFormat()), 0, GetLevels(), 0, {GetImageAspectForFormat(GetFormat()), 0, GetLevels(), 0,
GetLayers()} // VkImageSubresourceRange subresourceRange GetLayers()} // VkImageSubresourceRange subresourceRange
@ -1077,7 +1077,7 @@ VKFramebuffer::Create(VKTexture* color_attachment, VKTexture* depth_attachment,
nullptr, nullptr,
0, 0,
load_render_pass, load_render_pass,
static_cast<uint32_t>(attachment_views.size()), static_cast<u32>(attachment_views.size()),
attachment_views.data(), attachment_views.data(),
width, width,
height, height,

View file

@ -14,7 +14,7 @@
namespace Vulkan namespace Vulkan
{ {
static VkFormat VarToVkFormat(ComponentFormat t, uint32_t components, bool integer) static VkFormat VarToVkFormat(ComponentFormat t, u32 components, bool integer)
{ {
using ComponentArray = std::array<VkFormat, 4>; using ComponentArray = std::array<VkFormat, 4>;
static constexpr auto f = [](ComponentArray a) { return a; }; // Deduction helper static constexpr auto f = [](ComponentArray a) { return a; }; // Deduction helper
@ -84,7 +84,7 @@ void VertexFormat::MapAttributes()
VarToVkFormat(m_decl.position.type, m_decl.position.components, m_decl.position.integer), VarToVkFormat(m_decl.position.type, m_decl.position.components, m_decl.position.integer),
m_decl.position.offset); m_decl.position.offset);
for (uint32_t i = 0; i < 3; i++) for (u32 i = 0; i < 3; i++)
{ {
if (m_decl.normals[i].enable) if (m_decl.normals[i].enable)
AddAttribute(ShaderAttrib::Normal + i, 0, AddAttribute(ShaderAttrib::Normal + i, 0,
@ -93,7 +93,7 @@ void VertexFormat::MapAttributes()
m_decl.normals[i].offset); m_decl.normals[i].offset);
} }
for (uint32_t i = 0; i < 2; i++) for (u32 i = 0; i < 2; i++)
{ {
if (m_decl.colors[i].enable) if (m_decl.colors[i].enable)
AddAttribute(ShaderAttrib::Color0 + i, 0, AddAttribute(ShaderAttrib::Color0 + i, 0,
@ -102,7 +102,7 @@ void VertexFormat::MapAttributes()
m_decl.colors[i].offset); m_decl.colors[i].offset);
} }
for (uint32_t i = 0; i < 8; i++) for (u32 i = 0; i < 8; i++)
{ {
if (m_decl.texcoords[i].enable) if (m_decl.texcoords[i].enable)
AddAttribute(ShaderAttrib::TexCoord0 + i, 0, AddAttribute(ShaderAttrib::TexCoord0 + i, 0,
@ -132,12 +132,12 @@ void VertexFormat::SetupInputState()
m_input_state_info.pVertexAttributeDescriptions = m_attribute_descriptions.data(); m_input_state_info.pVertexAttributeDescriptions = m_attribute_descriptions.data();
} }
void VertexFormat::AddAttribute(ShaderAttrib location, uint32_t binding, VkFormat format, void VertexFormat::AddAttribute(ShaderAttrib location, u32 binding, VkFormat format,
uint32_t offset) u32 offset)
{ {
ASSERT(m_num_attributes < MAX_VERTEX_ATTRIBUTES); ASSERT(m_num_attributes < MAX_VERTEX_ATTRIBUTES);
m_attribute_descriptions[m_num_attributes].location = static_cast<uint32_t>(location); m_attribute_descriptions[m_num_attributes].location = static_cast<u32>(location);
m_attribute_descriptions[m_num_attributes].binding = binding; m_attribute_descriptions[m_num_attributes].binding = binding;
m_attribute_descriptions[m_num_attributes].format = format; m_attribute_descriptions[m_num_attributes].format = format;
m_attribute_descriptions[m_num_attributes].offset = offset; m_attribute_descriptions[m_num_attributes].offset = offset;

View file

@ -25,7 +25,7 @@ public:
void SetupInputState(); void SetupInputState();
private: private:
void AddAttribute(ShaderAttrib location, uint32_t binding, VkFormat format, uint32_t offset); void AddAttribute(ShaderAttrib location, u32 binding, VkFormat format, u32 offset);
VkVertexInputBindingDescription m_binding_description = {}; VkVertexInputBindingDescription m_binding_description = {};
@ -34,6 +34,6 @@ private:
VkPipelineVertexInputStateCreateInfo m_input_state_info = {}; VkPipelineVertexInputStateCreateInfo m_input_state_info = {};
uint32_t m_num_attributes = 0; u32 m_num_attributes = 0;
}; };
} // namespace Vulkan } // namespace Vulkan

View file

@ -249,7 +249,7 @@ VkInstance VulkanContext::CreateVulkanInstance(WindowSystemType wstype, bool ena
instance_create_info.pNext = nullptr; instance_create_info.pNext = nullptr;
instance_create_info.flags = 0; instance_create_info.flags = 0;
instance_create_info.pApplicationInfo = &app_info; instance_create_info.pApplicationInfo = &app_info;
instance_create_info.enabledExtensionCount = static_cast<uint32_t>(enabled_extensions.size()); instance_create_info.enabledExtensionCount = static_cast<u32>(enabled_extensions.size());
instance_create_info.ppEnabledExtensionNames = enabled_extensions.data(); instance_create_info.ppEnabledExtensionNames = enabled_extensions.data();
instance_create_info.enabledLayerCount = 0; instance_create_info.enabledLayerCount = 0;
instance_create_info.ppEnabledLayerNames = nullptr; instance_create_info.ppEnabledLayerNames = nullptr;
@ -697,7 +697,7 @@ bool VulkanContext::CreateDevice(VkSurfaceKHR surface, bool enable_validation_la
// Find graphics and present queues. // Find graphics and present queues.
m_graphics_queue_family_index = queue_family_count; m_graphics_queue_family_index = queue_family_count;
m_present_queue_family_index = queue_family_count; m_present_queue_family_index = queue_family_count;
for (uint32_t i = 0; i < queue_family_count; i++) for (u32 i = 0; i < queue_family_count; i++)
{ {
VkBool32 graphics_supported = queue_family_properties[i].queueFlags & VK_QUEUE_GRAPHICS_BIT; VkBool32 graphics_supported = queue_family_properties[i].queueFlags & VK_QUEUE_GRAPHICS_BIT;
if (graphics_supported) if (graphics_supported)
@ -789,7 +789,7 @@ bool VulkanContext::CreateDevice(VkSurfaceKHR surface, bool enable_validation_la
device_info.enabledLayerCount = 0; device_info.enabledLayerCount = 0;
device_info.ppEnabledLayerNames = nullptr; device_info.ppEnabledLayerNames = nullptr;
device_info.enabledExtensionCount = static_cast<uint32_t>(extension_name_pointers.size()); device_info.enabledExtensionCount = static_cast<u32>(extension_name_pointers.size());
device_info.ppEnabledExtensionNames = extension_name_pointers.data(); device_info.ppEnabledExtensionNames = extension_name_pointers.data();
WarnMissingDeviceFeatures(); WarnMissingDeviceFeatures();

View file

@ -38,18 +38,18 @@ namespace
#pragma pack(push, 1) #pragma pack(push, 1)
const uint32_t DDS_MAGIC = 0x20534444; // "DDS " const u32 DDS_MAGIC = 0x20534444; // "DDS "
struct DDS_PIXELFORMAT struct DDS_PIXELFORMAT
{ {
uint32_t dwSize; u32 dwSize;
uint32_t dwFlags; u32 dwFlags;
uint32_t dwFourCC; u32 dwFourCC;
uint32_t dwRGBBitCount; u32 dwRGBBitCount;
uint32_t dwRBitMask; u32 dwRBitMask;
uint32_t dwGBitMask; u32 dwGBitMask;
uint32_t dwBBitMask; u32 dwBBitMask;
uint32_t dwABitMask; u32 dwABitMask;
}; };
#define DDS_FOURCC 0x00000004 // DDPF_FOURCC #define DDS_FOURCC 0x00000004 // DDPF_FOURCC
@ -77,8 +77,8 @@ struct DDS_PIXELFORMAT
#ifndef MAKEFOURCC #ifndef MAKEFOURCC
#define MAKEFOURCC(ch0, ch1, ch2, ch3) \ #define MAKEFOURCC(ch0, ch1, ch2, ch3) \
((uint32_t)(uint8_t)(ch0) | ((uint32_t)(uint8_t)(ch1) << 8) | ((uint32_t)(uint8_t)(ch2) << 16) | \ ((u32)(u8)(ch0) | ((u32)(u8)(ch1) << 8) | ((u32)(u8)(ch2) << 16) | \
((uint32_t)(uint8_t)(ch3) << 24)) ((u32)(u8)(ch3) << 24))
#endif /* defined(MAKEFOURCC) */ #endif /* defined(MAKEFOURCC) */
#define DDS_HEADER_FLAGS_TEXTURE \ #define DDS_HEADER_FLAGS_TEXTURE \
@ -98,29 +98,29 @@ enum DDS_RESOURCE_DIMENSION
struct DDS_HEADER struct DDS_HEADER
{ {
uint32_t dwSize; u32 dwSize;
uint32_t dwFlags; u32 dwFlags;
uint32_t dwHeight; u32 dwHeight;
uint32_t dwWidth; u32 dwWidth;
uint32_t dwPitchOrLinearSize; u32 dwPitchOrLinearSize;
uint32_t dwDepth; // only if DDS_HEADER_FLAGS_VOLUME is set in dwFlags u32 dwDepth; // only if DDS_HEADER_FLAGS_VOLUME is set in dwFlags
uint32_t dwMipMapCount; u32 dwMipMapCount;
uint32_t dwReserved1[11]; u32 dwReserved1[11];
DDS_PIXELFORMAT ddspf; DDS_PIXELFORMAT ddspf;
uint32_t dwCaps; u32 dwCaps;
uint32_t dwCaps2; u32 dwCaps2;
uint32_t dwCaps3; u32 dwCaps3;
uint32_t dwCaps4; u32 dwCaps4;
uint32_t dwReserved2; u32 dwReserved2;
}; };
struct DDS_HEADER_DXT10 struct DDS_HEADER_DXT10
{ {
uint32_t dxgiFormat; u32 dxgiFormat;
uint32_t resourceDimension; u32 resourceDimension;
uint32_t miscFlag; // see DDS_RESOURCE_MISC_FLAG u32 miscFlag; // see DDS_RESOURCE_MISC_FLAG
uint32_t arraySize; u32 arraySize;
uint32_t miscFlags2; // see DDS_MISC_FLAGS2 u32 miscFlags2; // see DDS_MISC_FLAGS2
}; };
#pragma pack(pop) #pragma pack(pop)

View file

@ -126,7 +126,7 @@ bool UpdateVertexStrideFromPrimitive(const tinygltf::Model& model, u32 accessor_
} }
const int component_size = const int component_size =
tinygltf::GetComponentSizeInBytes(static_cast<uint32_t>(accessor.componentType)); tinygltf::GetComponentSizeInBytes(static_cast<u32>(accessor.componentType));
if (component_size == -1) if (component_size == -1)
{ {
ERROR_LOG_FMT(VIDEO, "Failed to update vertex stride, component size was invalid"); ERROR_LOG_FMT(VIDEO, "Failed to update vertex stride, component size was invalid");
@ -150,7 +150,7 @@ bool CopyBufferDataFromPrimitive(const tinygltf::Model& model, u32 accessor_inde
} }
const int component_size = const int component_size =
tinygltf::GetComponentSizeInBytes(static_cast<uint32_t>(accessor.componentType)); tinygltf::GetComponentSizeInBytes(static_cast<u32>(accessor.componentType));
if (component_size == -1) if (component_size == -1)
{ {
ERROR_LOG_FMT(VIDEO, "Failed to copy buffer data from primitive, component size was invalid"); ERROR_LOG_FMT(VIDEO, "Failed to copy buffer data from primitive, component size was invalid");

View file

@ -258,7 +258,7 @@ bool FFMpegFrameDump::CreateVideoFile()
m_context->height, time_base.den, time_base.num); m_context->height, time_base.den, time_base.num);
m_context->codec->codec_type = AVMEDIA_TYPE_VIDEO; m_context->codec->codec_type = AVMEDIA_TYPE_VIDEO;
m_context->codec->bit_rate = static_cast<int64_t>(g_Config.iBitrateKbps) * 1000; m_context->codec->bit_rate = static_cast<s64>(g_Config.iBitrateKbps) * 1000;
m_context->codec->width = m_context->width; m_context->codec->width = m_context->width;
m_context->codec->height = m_context->height; m_context->codec->height = m_context->height;
m_context->codec->time_base = time_base; m_context->codec->time_base = time_base;

View file

@ -1195,7 +1195,7 @@ private:
auto* dst_pixel = dst + (j + i * dst_shape.row_length) * 4; auto* dst_pixel = dst + (j + i * dst_shape.row_length) * 4;
for (int channel = 0; channel < 4; channel++) for (int channel = 0; channel < 4; channel++)
{ {
uint32_t channel_value = samples[0][channel] + samples[1][channel] + u32 channel_value = samples[0][channel] + samples[1][channel] +
samples[2][channel] + samples[3][channel]; samples[2][channel] + samples[3][channel];
dst_pixel[channel] = (channel_value + 2) / 4; dst_pixel[channel] = (channel_value + 2) / 4;
} }

View file

@ -523,10 +523,10 @@ UBO_BINDING(std140, 1) uniform UBO {
#if defined(API_METAL) #if defined(API_METAL)
#if defined(TEXEL_BUFFER_FORMAT_R8) #if defined(TEXEL_BUFFER_FORMAT_R8)
SSBO_BINDING(0) readonly buffer Input { uint8_t s_input_buffer[]; }; SSBO_BINDING(0) readonly buffer Input { u8 s_input_buffer[]; };
#define FETCH(offset) uint(s_input_buffer[offset]) #define FETCH(offset) uint(s_input_buffer[offset])
#elif defined(TEXEL_BUFFER_FORMAT_R16) #elif defined(TEXEL_BUFFER_FORMAT_R16)
SSBO_BINDING(0) readonly buffer Input { uint16_t s_input_buffer[]; }; SSBO_BINDING(0) readonly buffer Input { u16 s_input_buffer[]; };
#define FETCH(offset) uint(s_input_buffer[offset]) #define FETCH(offset) uint(s_input_buffer[offset])
#elif defined(TEXEL_BUFFER_FORMAT_RGBA8) #elif defined(TEXEL_BUFFER_FORMAT_RGBA8)
SSBO_BINDING(0) readonly buffer Input { u8vec4 s_input_buffer[]; }; SSBO_BINDING(0) readonly buffer Input { u8vec4 s_input_buffer[]; };
@ -539,7 +539,7 @@ UBO_BINDING(std140, 1) uniform UBO {
#endif #endif
#ifdef HAS_PALETTE #ifdef HAS_PALETTE
SSBO_BINDING(1) readonly buffer Palette { uint16_t s_palette_buffer[]; }; SSBO_BINDING(1) readonly buffer Palette { u16 s_palette_buffer[]; };
#define FETCH_PALETTE(offset) uint(s_palette_buffer[offset]) #define FETCH_PALETTE(offset) uint(s_palette_buffer[offset])
#endif #endif
@ -1181,7 +1181,7 @@ float4 DecodePixel(int val)
ss << "\n"; ss << "\n";
if (api_type == APIType::Metal) if (api_type == APIType::Metal)
ss << "SSBO_BINDING(0) readonly buffer Palette { uint16_t palette[]; };\n"; ss << "SSBO_BINDING(0) readonly buffer Palette { u16 palette[]; };\n";
else else
ss << "TEXEL_BUFFER_BINDING(0) uniform usamplerBuffer samp0;\n"; ss << "TEXEL_BUFFER_BINDING(0) uniform usamplerBuffer samp0;\n";
ss << "SAMPLER_BINDING(1) uniform sampler2DArray samp1;\n"; ss << "SAMPLER_BINDING(1) uniform sampler2DArray samp1;\n";