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
{
// 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)
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
void ARM64FloatEmitter::FMOV(ARM64Reg Rd, uint8_t imm8)
void ARM64FloatEmitter::FMOV(ARM64Reg Rd, u8 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);
// Scalar floating point immediate
void FMOV(ARM64Reg Rd, uint8_t imm8);
void FMOV(ARM64Reg Rd, u8 imm8);
// Vector
void ADD(u8 size, ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm);

View file

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

View file

@ -11,6 +11,8 @@
#include <utility>
#include <vector>
#include "Common/CommonTypes.h"
namespace Common::GekkoAssembler::detail
{
// Hacky implementation of a case insensitive alphanumeric trie supporting extended entries
@ -39,12 +41,12 @@ public:
return nullptr;
}
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:
struct TrieEntry
{
std::array<uint32_t, 36 + sizeof...(ExtraMatches)> _conns;
std::array<u32, 36 + sizeof...(ExtraMatches)> _conns;
std::optional<V> _val;
TrieEntry() { _conns.fill(INVALID_CONN); }
@ -113,7 +115,7 @@ private:
{
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();
}
}

View file

@ -9,6 +9,7 @@
#include "Common/Event.h"
#include "Common/Flag.h"
#include "Common/CommonTypes.h"
namespace Common
{
@ -123,7 +124,7 @@ public:
// 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.
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.
// But a good implementation should call this before already.

View file

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

View file

@ -740,7 +740,7 @@ void* AchievementManager::FilereaderOpenByVolume(const char* path_utf8)
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)
{
@ -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;
}

View file

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

View file

@ -88,7 +88,7 @@ void CEXIModem::ImmWrite(u32 data, u32 size)
}
else
{ // 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;
for (; size && reg_num < m_regs.size(); size--)
{
@ -154,7 +154,7 @@ u32 CEXIModem::ImmRead(u32 size)
else
{
// 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)
{
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& small_image_key = {},
const std::string& small_image_text = {},
const int64_t start_timestamp = 0,
const int64_t end_timestamp = 0, const int party_size = 0,
const s64 start_timestamp = 0,
const s64 end_timestamp = 0, const int party_size = 0,
const int party_max = 0);
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 =
memory.GetString(request.in_vectors[5].address, request.in_vectors[5].size);
int64_t start_timestamp = memory.Read_U64(request.in_vectors[6].address);
int64_t end_timestamp = memory.Read_U64(request.in_vectors[7].address);
s64 start_timestamp = memory.Read_U64(request.in_vectors[6].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_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;
}
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);
if (!handle || !handle->host_file->IsOpen())

View file

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

View file

@ -139,7 +139,7 @@ static void ExceptionThread(mach_port_t port)
NDR_record_t NDR;
exception_type_t exception;
mach_msg_type_number_t codeCnt;
int64_t code[2];
s64 code[2];
int flavor;
mach_msg_type_number_t old_stateCnt;
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)
{
// 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;
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& small_image_key,
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)
{
#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& small_image_key,
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)
{
#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& small_image_key,
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)
{
return false;

View file

@ -316,7 +316,7 @@ private:
public:
IndexedSwitch(const WGI::GameControllerSwitchPosition* swtch, u32 index,
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
@ -331,14 +331,14 @@ private:
// 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
// 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);
}
private:
const WGI::GameControllerSwitchPosition& m_switch;
const u32 m_index;
const int32_t m_direction;
const s32 m_direction;
};
class Battery : public Input
@ -433,7 +433,7 @@ private:
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 &&
button_name_idx < wgi_button_names.size())
AddInput(new NamedButton(&button, wgi_button_names[button_name_idx]));
@ -452,7 +452,7 @@ private:
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::BuzzContinuous(), "Buzz"},
{Haptics::KnownSimpleHapticsControllerWaveforms::RumbleContinuous(), "Rumble"},
@ -467,7 +467,7 @@ private:
for (Haptics::SimpleHapticsControllerFeedback feedback :
haptics_controller.SupportedFeedback())
{
const uint16_t waveform = feedback.Waveform();
const u16 waveform = feedback.Waveform();
auto waveform_name_it = waveform_name_map.find(waveform);
if (waveform_name_it == waveform_name_map.end())
{
@ -582,8 +582,8 @@ private:
break;
}
const int32_t full_value = report.FullChargeCapacityInMilliwattHours().GetInt32();
const int32_t remaining_value = report.RemainingCapacityInMilliwattHours().GetInt32();
const s32 full_value = report.FullChargeCapacityInMilliwattHours().GetInt32();
const s32 remaining_value = report.RemainingCapacityInMilliwattHours().GetInt32();
m_battery_level = BATTERY_INPUT_MAX_VALUE * remaining_value / full_value;
return true;
}

View file

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

View file

@ -23,11 +23,11 @@ static void Uninhibit();
static constexpr char s_app_id[] = "org.DolphinEmu.dolphin-emu";
// 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
static uint32_t s_xfce_cookie = 0;
static u32 s_xfce_cookie = 0;
// 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
static QString s_portal_handle;
@ -53,7 +53,7 @@ static bool InhibitXfce()
if (!interface.isValid())
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())
{
WARN_LOG_FMT(VIDEO, "org.xfce.ScreenSaver::Inhibit failed: {}",
@ -74,7 +74,7 @@ static bool InhibitMate()
if (!interface.isValid())
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())
{
WARN_LOG_FMT(VIDEO, "org.mate.ScreenSaver::Inhibit failed: {}",
@ -94,7 +94,7 @@ static bool InhibitFDO()
if (!interface.isValid())
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())
{
WARN_LOG_FMT(VIDEO, "org.freedesktop.ScreenSaver::Inhibit failed: {}",
@ -118,7 +118,7 @@ static bool InhibitPortal()
QHash<QString, QVariant> options;
options["handle_token"] = "dolphin_" + QString::number(std::rand(), 0x10);
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);
if (interface.lastError().isValid())
{

View file

@ -36,7 +36,7 @@ namespace
{
Handler* event_handler = nullptr;
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())
.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_text,
const std::string& small_image_key,
const std::string& small_image_text, const int64_t start_timestamp,
const int64_t end_timestamp, const int party_size,
const std::string& small_image_text, const s64 start_timestamp,
const s64 end_timestamp, const int party_size,
const int party_max)
{
#ifdef USE_DISCORD_PRESENCE

View file

@ -6,6 +6,8 @@
#include <functional>
#include <string>
#include "Common/CommonTypes.h"
namespace Discord
{
// 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& small_image_key = {},
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);
void UpdateDiscordPresence(int party_size = 0, SecretType type = SecretType::Empty,
const std::string& secret = {}, const std::string& current_game = {},

View file

@ -68,7 +68,7 @@ bool CommandBufferManager::CreateCommandBuffers()
VkCommandBufferAllocateInfo buffer_info = {
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());
if (res != VK_SUCCESS)
@ -302,7 +302,7 @@ void CommandBufferManager::WaitForCommandBufferCompletion(u32 index)
void CommandBufferManager::SubmitCommandBuffer(bool submit_on_worker_thread,
bool wait_for_completion, bool advance_to_next_frame,
VkSwapchainKHR present_swap_chain,
uint32_t present_image_index)
u32 present_image_index)
{
// End the current command buffer.
CmdBufferResources& resources = GetCurrentCmdBufferResources();
@ -387,7 +387,7 @@ void CommandBufferManager::SubmitCommandBuffer(u32 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.
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,
nullptr,
0,

View file

@ -14,7 +14,7 @@
#include <utility>
#include <vector>
#include <Common/WorkQueueThread.h>
#include "Common/WorkQueueThread.h"
#include "Common/BlockingLoop.h"
#include "Common/Flag.h"
#include "Common/Semaphore.h"
@ -87,7 +87,7 @@ public:
void SubmitCommandBuffer(bool submit_on_worker_thread, bool wait_for_completion,
bool advance_to_next_frame = false,
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.
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)
{
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_attachment_references.push_back(std::move(color_reference));
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)
{
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_ptr = &depth_reference;
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++)
{
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_attachment_references.push_back(std::move(color_reference));
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,
0,
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(),
nullptr,
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,
nullptr,
0,
static_cast<uint32_t>(attachments.size()),
static_cast<u32>(attachments.size()),
attachments.data(),
1,
&subpass,

View file

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

View file

@ -505,7 +505,7 @@ void StateTracker::UpdateGXDescriptorSet()
writes[num_writes++] = {VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
nullptr,
m_gx_descriptor_sets[0],
static_cast<uint32_t>(i),
static_cast<u32>(i),
0,
1,
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC,
@ -721,7 +721,7 @@ void StateTracker::UpdateComputeDescriptorSet()
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);
m_dirty_flags =
(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_usage, // VkBufferUsageFlags usage
VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode sharingMode
0, // uint32_t queueFamilyIndexCount
nullptr // const uint32_t* pQueueFamilyIndices
0, // u32 queueFamilyIndexCount
nullptr // const u32* pQueueFamilyIndices
};
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 = {
{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.
VkClearValue clear_color_value = {};
@ -199,7 +199,7 @@ void VKGfx::ClearRegion(const MathUtil::Rectangle<int>& target_rc, bool color_en
StateTracker::GetInstance()->BeginRenderPass();
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);
}
}

View file

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

View file

@ -206,7 +206,7 @@ GetVulkanAttachmentBlendState(const BlendingState& state, AbstractPipelineUsage
static VkPipelineColorBlendStateCreateInfo
GetVulkanColorBlendState(const BlendingState& state,
const VkPipelineColorBlendAttachmentState* attachments,
uint32_t num_attachments)
u32 num_attachments)
{
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,
@ -232,7 +232,7 @@ GetVulkanColorBlendState(const BlendingState& state,
0, // VkPipelineColorBlendStateCreateFlags flags
vk_logic_op_enable, // VkBool32 logicOpEnable
vk_logic_op, // VkLogicOp logicOp
num_attachments, // uint32_t attachmentCount
num_attachments, // u32 attachmentCount
attachments, // const VkPipelineColorBlendAttachmentState* pAttachments
{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
nullptr, // const void* pNext
0, // VkPipelineVertexInputStateCreateFlags flags
0, // uint32_t vertexBindingDescriptionCount
0, // u32 vertexBindingDescriptionCount
nullptr, // const VkVertexInputBindingDescription* pVertexBindingDescriptions
0, // uint32_t vertexAttributeDescriptionCount
0, // u32 vertexAttributeDescriptionCount
nullptr // const VkVertexInputAttributeDescription* pVertexAttributeDescriptions
};
@ -314,7 +314,7 @@ std::unique_ptr<VKPipeline> VKPipeline::Create(const AbstractPipelineConfig& con
// Shaders to stages
VkPipelineShaderStageCreateInfo shader_stages[3];
uint32_t num_shader_stages = 0;
u32 num_shader_stages = 0;
if (config.vertex_shader)
{
shader_stages[num_shader_stages++] = {
@ -366,7 +366,7 @@ std::unique_ptr<VKPipeline> VKPipeline::Create(const AbstractPipelineConfig& con
}
VkPipelineColorBlendStateCreateInfo blend_state =
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.
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,
nullptr,
0, // VkPipelineViewportStateCreateFlags flags;
1, // uint32_t viewportCount
1, // u32 viewportCount
&viewport, // const VkViewport* pViewports
1, // uint32_t scissorCount
1, // u32 scissorCount
&scissor // const VkRect2D* pScissors
};
@ -389,7 +389,7 @@ std::unique_ptr<VKPipeline> VKPipeline::Create(const AbstractPipelineConfig& con
static const VkPipelineDynamicStateCreateInfo dynamic_state = {
VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO, nullptr,
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
};
@ -398,10 +398,10 @@ std::unique_ptr<VKPipeline> VKPipeline::Create(const AbstractPipelineConfig& con
VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO,
nullptr, // VkStructureType sType
0, // VkPipelineCreateFlags flags
num_shader_stages, // uint32_t stageCount
num_shader_stages, // u32 stageCount
shader_stages, // const VkPipelineShaderStageCreateInfo* pStages
&vertex_input_state, // const VkPipelineVertexInputStateCreateInfo* pVertexInputState
&input_assembly_state, // const VkPipelineInputAssemblyStateCreateInfo* pInputAssemblyState
&input_assembly_state, // const VkPipelineInputAssemblyStateCreateInfo* pInputAssemblyState
nullptr, // const VkPipelineTessellationStateCreateInfo* pTessellationState
&viewport_state, // const VkPipelineViewportStateCreateInfo* pViewportState
&rasterization_state, // const VkPipelineRasterizationStateCreateInfo* pRasterizationState
@ -411,9 +411,9 @@ std::unique_ptr<VKPipeline> VKPipeline::Create(const AbstractPipelineConfig& con
&dynamic_state, // const VkPipelineDynamicStateCreateInfo* pDynamicState
pipeline_layout, // VkPipelineLayout layout
render_pass, // VkRenderPass renderPass
0, // uint32_t subpass
0, // u32 subpass
VK_NULL_HANDLE, // VkPipeline basePipelineHandle
-1 // int32_t basePipelineIndex
-1 // s32 basePipelineIndex
};
VkPipeline pipeline;

View file

@ -24,7 +24,7 @@ VKShader::VKShader(ShaderStage stage, std::vector<u32> spv, VkShaderModule mod,
VkDebugUtilsObjectNameInfoEXT name_info = {};
name_info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT;
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();
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 = {};
name_info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT;
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();
vkSetDebugUtilsObjectNameEXT(g_vulkan_context->GetDevice(), &name_info);
}

View file

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

View file

@ -289,7 +289,7 @@ bool SwapChain::CreateSwapChain()
return false;
// 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.
if (surface_capabilities.maxImageCount > 0)
@ -322,7 +322,7 @@ bool SwapChain::CreateSwapChain()
}
// 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
VkSwapchainKHR old_swap_chain = m_swap_chain;
@ -347,7 +347,7 @@ bool SwapChain::CreateSwapChain()
m_present_mode,
VK_TRUE,
old_swap_chain};
std::array<uint32_t, 2> indices = {{
std::array<u32, 2> indices = {{
g_vulkan_context->GetGraphicsQueueFamilyIndex(),
g_vulkan_context->GetPresentQueueFamilyIndex(),
}};
@ -410,7 +410,7 @@ bool SwapChain::SetupSwapChainImages()
{
ASSERT(m_swap_chain_images.empty());
uint32_t image_count;
u32 image_count;
VkResult res =
vkGetSwapchainImagesKHR(g_vulkan_context->GetDevice(), m_swap_chain, &image_count, nullptr);
if (res != VK_SUCCESS)
@ -438,7 +438,7 @@ bool SwapChain::SetupSwapChainImages()
}
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;
image.image = images[i];

View file

@ -37,7 +37,7 @@ VKTexture::VKTexture(const TextureConfig& tex_config, VmaAllocation alloc, VkIma
VkDebugUtilsObjectNameInfoEXT name_info = {};
name_info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT;
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();
vkSetDebugUtilsObjectNameEXT(g_vulkan_context->GetDevice(), &name_info);
}
@ -299,7 +299,7 @@ void VKTexture::CopyRectangleFromTexture(const AbstractTexture* src,
{src_rect.left, src_rect.top, 0},
{VK_IMAGE_ASPECT_COLOR_BIT, dst_level, dst_layer, copy_layer_count},
{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.
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.
VkBufferImageCopy image_copy = {
upload_buffer_offset, // VkDeviceSize bufferOffset
row_length, // uint32_t bufferRowLength
0, // uint32_t bufferImageHeight
row_length, // u32 bufferRowLength
0, // u32 bufferImageHeight
{VK_IMAGE_ASPECT_COLOR_BIT, level, layer, 1}, // VkImageSubresourceLayers imageSubresource
{0, 0, 0}, // VkOffset3D imageOffset
{width, height, 1} // VkExtent3D imageExtent
@ -473,8 +473,8 @@ void VKTexture::TransitionToLayout(VkCommandBuffer command_buffer, VkImageLayout
0, // VkAccessFlags dstAccessMask
m_layout, // VkImageLayout oldLayout
new_layout, // VkImageLayout newLayout
VK_QUEUE_FAMILY_IGNORED, // uint32_t srcQueueFamilyIndex
VK_QUEUE_FAMILY_IGNORED, // uint32_t dstQueueFamilyIndex
VK_QUEUE_FAMILY_IGNORED, // u32 srcQueueFamilyIndex
VK_QUEUE_FAMILY_IGNORED, // u32 dstQueueFamilyIndex
m_image, // VkImage image
{GetImageAspectForFormat(GetFormat()), 0, GetLevels(), 0,
GetLayers()} // VkImageSubresourceRange subresourceRange
@ -620,8 +620,8 @@ void VKTexture::TransitionToLayout(VkCommandBuffer command_buffer,
0, // VkAccessFlags dstAccessMask
m_layout, // VkImageLayout oldLayout
VK_IMAGE_LAYOUT_GENERAL, // VkImageLayout newLayout
VK_QUEUE_FAMILY_IGNORED, // uint32_t srcQueueFamilyIndex
VK_QUEUE_FAMILY_IGNORED, // uint32_t dstQueueFamilyIndex
VK_QUEUE_FAMILY_IGNORED, // u32 srcQueueFamilyIndex
VK_QUEUE_FAMILY_IGNORED, // u32 dstQueueFamilyIndex
m_image, // VkImage image
{GetImageAspectForFormat(GetFormat()), 0, GetLevels(), 0,
GetLayers()} // VkImageSubresourceRange subresourceRange
@ -1077,7 +1077,7 @@ VKFramebuffer::Create(VKTexture* color_attachment, VKTexture* depth_attachment,
nullptr,
0,
load_render_pass,
static_cast<uint32_t>(attachment_views.size()),
static_cast<u32>(attachment_views.size()),
attachment_views.data(),
width,
height,

View file

@ -14,7 +14,7 @@
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>;
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),
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)
AddAttribute(ShaderAttrib::Normal + i, 0,
@ -93,7 +93,7 @@ void VertexFormat::MapAttributes()
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)
AddAttribute(ShaderAttrib::Color0 + i, 0,
@ -102,7 +102,7 @@ void VertexFormat::MapAttributes()
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)
AddAttribute(ShaderAttrib::TexCoord0 + i, 0,
@ -132,12 +132,12 @@ void VertexFormat::SetupInputState()
m_input_state_info.pVertexAttributeDescriptions = m_attribute_descriptions.data();
}
void VertexFormat::AddAttribute(ShaderAttrib location, uint32_t binding, VkFormat format,
uint32_t offset)
void VertexFormat::AddAttribute(ShaderAttrib location, u32 binding, VkFormat format,
u32 offset)
{
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].format = format;
m_attribute_descriptions[m_num_attributes].offset = offset;

View file

@ -25,7 +25,7 @@ public:
void SetupInputState();
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 = {};
@ -34,6 +34,6 @@ private:
VkPipelineVertexInputStateCreateInfo m_input_state_info = {};
uint32_t m_num_attributes = 0;
u32 m_num_attributes = 0;
};
} // namespace Vulkan

View file

@ -249,7 +249,7 @@ VkInstance VulkanContext::CreateVulkanInstance(WindowSystemType wstype, bool ena
instance_create_info.pNext = nullptr;
instance_create_info.flags = 0;
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.enabledLayerCount = 0;
instance_create_info.ppEnabledLayerNames = nullptr;
@ -697,7 +697,7 @@ bool VulkanContext::CreateDevice(VkSurfaceKHR surface, bool enable_validation_la
// Find graphics and present queues.
m_graphics_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;
if (graphics_supported)
@ -789,7 +789,7 @@ bool VulkanContext::CreateDevice(VkSurfaceKHR surface, bool enable_validation_la
device_info.enabledLayerCount = 0;
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();
WarnMissingDeviceFeatures();

View file

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

View file

@ -126,7 +126,7 @@ bool UpdateVertexStrideFromPrimitive(const tinygltf::Model& model, u32 accessor_
}
const int component_size =
tinygltf::GetComponentSizeInBytes(static_cast<uint32_t>(accessor.componentType));
tinygltf::GetComponentSizeInBytes(static_cast<u32>(accessor.componentType));
if (component_size == -1)
{
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 =
tinygltf::GetComponentSizeInBytes(static_cast<uint32_t>(accessor.componentType));
tinygltf::GetComponentSizeInBytes(static_cast<u32>(accessor.componentType));
if (component_size == -1)
{
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->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->height = m_context->height;
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;
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];
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(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])
#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])
#elif defined(TEXEL_BUFFER_FORMAT_RGBA8)
SSBO_BINDING(0) readonly buffer Input { u8vec4 s_input_buffer[]; };
@ -539,7 +539,7 @@ UBO_BINDING(std140, 1) uniform UBO {
#endif
#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])
#endif
@ -1181,7 +1181,7 @@ float4 DecodePixel(int val)
ss << "\n";
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
ss << "TEXEL_BUFFER_BINDING(0) uniform usamplerBuffer samp0;\n";
ss << "SAMPLER_BINDING(1) uniform sampler2DArray samp1;\n";