Add usz alias for std::size_t

This commit is contained in:
Nekotekina 2020-12-18 10:39:54 +03:00
parent 360c4d1554
commit fb29933d3d
173 changed files with 718 additions and 717 deletions

View file

@ -578,7 +578,7 @@ int validate_npd_hashes(const char* file_name, const u8* klicensee, NPD_HEADER *
int dev_hash_result = 0;
const s32 file_name_length = ::narrow<s32>(std::strlen(file_name));
const std::size_t buf_len = 0x30 + file_name_length;
const usz buf_len = 0x30 + file_name_length;
std::unique_ptr<u8[]> buf(new u8[buf_len]);
std::unique_ptr<u8[]> buf_lower(new u8[buf_len]);
@ -591,7 +591,7 @@ int validate_npd_hashes(const char* file_name, const u8* klicensee, NPD_HEADER *
std::memcpy(buf_lower.get(), buf.get(), buf_len);
std::memcpy(buf_upper.get(), buf.get(), buf_len);
for (std::size_t i = std::basic_string_view<u8>(buf.get() + 0x30, file_name_length).find_last_of('.'); i < buf_len; i++)
for (usz i = std::basic_string_view<u8>(buf.get() + 0x30, file_name_length).find_last_of('.'); i < buf_len; i++)
{
const u8 c = static_cast<u8>(buf[i]);
buf_upper[i] = std::toupper(c);

View file

@ -697,7 +697,7 @@ bool package_reader::extract_data(atomic_t<double>& sync)
return false;
}
size_t num_failures = 0;
usz num_failures = 0;
std::vector<PKGEntry> entries(header.file_count);
@ -857,7 +857,7 @@ void package_reader::archive_seek(const s64 new_offset, const fs::seek_mode damo
cur_offset += new_offset;
u64 _offset = 0;
for (size_t i = 0; i < filelist.size(); i++)
for (usz i = 0; i < filelist.size(); i++)
{
if (cur_offset < (_offset + filelist[i].size()))
{

View file

@ -117,16 +117,16 @@ struct PKGEntry
struct PKGMetaData
{
private:
static std::string to_hex_string(u8 buf[], size_t size)
static std::string to_hex_string(u8 buf[], usz size)
{
std::stringstream sstream;
for (size_t i = 0; i < size; i++)
for (usz i = 0; i < size; i++)
{
sstream << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(buf[i]);
}
return sstream.str();
}
static std::string to_hex_string(u8 buf[], size_t size, size_t dotpos)
static std::string to_hex_string(u8 buf[], usz size, usz dotpos)
{
std::string result = to_hex_string(buf, size);
if (result.size() > dotpos)
@ -312,14 +312,14 @@ private:
u64 archive_read(void* data_ptr, const u64 num_bytes);
u64 decrypt(u64 offset, u64 size, const uchar* key);
const std::size_t BUF_SIZE = 8192 * 1024; // 8 MB
const usz BUF_SIZE = 8192 * 1024; // 8 MB
bool m_is_valid = false;
std::string m_path;
std::string install_dir;
std::vector<fs::file> filelist;
size_t cur_file = 0;
usz cur_file = 0;
u64 cur_offset = 0;
u64 cur_file_offset = 0;
std::unique_ptr<u128[]> buf;

View file

@ -715,7 +715,7 @@ bool SCEDecrypter::LoadMetadata(const u8 erk[32], const u8 riv[16])
}
// Perform AES-CTR encryption on the metadata headers.
size_t ctr_nc_off = 0;
usz ctr_nc_off = 0;
u8 ctr_stream_block[0x10];
aes_setkey_enc(&aes, meta_info.key, 128);
aes_crypt_ctr(&aes, metadata_headers_size, &ctr_nc_off, meta_info.iv, ctr_stream_block, metadata_headers.get(), metadata_headers.get());
@ -758,7 +758,7 @@ bool SCEDecrypter::DecryptData()
// Parse the metadata section headers to find the offsets of encrypted data.
for (unsigned int i = 0; i < meta_hdr.section_count; i++)
{
size_t ctr_nc_off = 0;
usz ctr_nc_off = 0;
u8 ctr_stream_block[0x10];
u8 data_key[0x10];
u8 data_iv[0x10];
@ -824,7 +824,7 @@ std::vector<fs::file> SCEDecrypter::MakeFile()
// Decompress if necessary.
if (meta_shdr[i].compressed == 2)
{
const size_t BUFSIZE = 32 * 1024;
const usz BUFSIZE = 32 * 1024;
u8 tempbuf[BUFSIZE];
z_stream strm;
strm.zalloc = Z_NULL;
@ -1210,7 +1210,7 @@ bool SELFDecrypter::LoadMetadata(u8* klic_key)
}
// Perform AES-CTR encryption on the metadata headers.
size_t ctr_nc_off = 0;
usz ctr_nc_off = 0;
u8 ctr_stream_block[0x10];
aes_setkey_enc(&aes, meta_info.key, 128);
aes_crypt_ctr(&aes, metadata_headers_size, &ctr_nc_off, meta_info.iv, ctr_stream_block, metadata_headers.get(), metadata_headers.get());
@ -1257,7 +1257,7 @@ bool SELFDecrypter::DecryptData()
// Parse the metadata section headers to find the offsets of encrypted data.
for (unsigned int i = 0; i < meta_hdr.section_count; i++)
{
size_t ctr_nc_off = 0;
usz ctr_nc_off = 0;
u8 ctr_stream_block[0x10];
u8 data_key[0x10];
u8 data_iv[0x10];

View file

@ -96,7 +96,7 @@ protected:
{
if (m_mode != CPUDisAsm_NormalMode)
{
op.resize(std::max<std::size_t>(op.length(), 10), ' ');
op.resize(std::max<usz>(op.length(), 10), ' ');
}
return op;

View file

@ -2917,9 +2917,9 @@ public:
template <>
struct fmt_unveil<llvm::TypeSize, void>
{
using type = std::size_t;
using type = usz;
static inline std::size_t get(const llvm::TypeSize& arg)
static inline usz get(const llvm::TypeSize& arg)
{
return arg;
}

View file

@ -99,7 +99,7 @@ bool statichle_handler::load_patterns()
#define POLY 0x8408
uint16_t statichle_handler::gen_CRC16(const uint8_t* data_p, size_t length)
uint16_t statichle_handler::gen_CRC16(const uint8_t* data_p, usz length)
{
unsigned char i;
unsigned int data;

View file

@ -26,7 +26,7 @@ public:
bool check_against_patterns(vm::cptr<u8>& data, u32 size, u32 addr);
protected:
uint16_t gen_CRC16(const uint8_t* data_p, size_t length);
uint16_t gen_CRC16(const uint8_t* data_p, usz length);
std::vector<shle_pattern> hle_patterns;
};

View file

@ -1071,7 +1071,7 @@ void cell_audio_thread::mix(float *out_buffer, s32 offset)
// 2x CVTPS2DQ (converts float to s32)
// PACKSSDW (converts s32 to s16 with signed saturation)
for (size_t i = 0; i < out_buffer_sz; i += 8)
for (usz i = 0; i < out_buffer_sz; i += 8)
{
const auto scale = _mm_set1_ps(0x8000);
_mm_store_ps(out_buffer + i / 2, _mm_castsi128_ps(_mm_packs_epi32(

View file

@ -60,7 +60,7 @@ struct CellCelp8EncResource
vm::bptr<void> startAddr;
be_t<u32> ppuThreadPriority;
be_t<u32> spuThreadPriority;
be_t<u32/*size_t*/> ppuThreadStackSize;
be_t<u32/*usz*/> ppuThreadStackSize;
};
struct CellCelp8EncParam

View file

@ -55,7 +55,7 @@ struct CellCelpEncResource
vm::bptr<void> startAddr;
be_t<u32> ppuThreadPriority;
be_t<u32> spuThreadPriority;
be_t<u32/*size_t*/> ppuThreadStackSize;
be_t<u32/*usz*/> ppuThreadStackSize;
};
struct CellCelpEncParam

View file

@ -181,7 +181,7 @@ public:
const u32 spec; //addr
std::vector<u8> raw_data; // demultiplexed data stream (managed by demuxer thread)
std::size_t raw_pos = 0; // should be <= raw_data.size()
usz raw_pos = 0; // should be <= raw_data.size()
u64 last_dts = CODEC_TS_INVALID;
u64 last_pts = CODEC_TS_INVALID;

View file

@ -332,7 +332,7 @@ u32 cellGcmGetTiledPitchSize(u32 size)
{
cellGcmSys.trace("cellGcmGetTiledPitchSize(size=%d)", size);
for (size_t i = 0; i < std::size(tiled_pitches) - 1; i++) {
for (usz i = 0; i < std::size(tiled_pitches) - 1; i++) {
if (tiled_pitches[i] < size && size <= tiled_pitches[i + 1]) {
return tiled_pitches[i + 1];
}

View file

@ -886,7 +886,7 @@ error_code cellImeJpGetConfirmYomiString(CellImeJpHandle hImeJpHandle, vm::ptr<u
pYomiString[i] = 0;
}
const size_t max_len = std::min<size_t>(CELL_IMEJP_STRING_MAXLENGTH - 1, manager->confirmed_string.length());
const usz max_len = std::min<usz>(CELL_IMEJP_STRING_MAXLENGTH - 1, manager->confirmed_string.length());
for (u32 i = 0; i < max_len; i++)
{
@ -918,7 +918,7 @@ error_code cellImeJpGetConfirmString(CellImeJpHandle hImeJpHandle, vm::ptr<u16>
pConfirmString[i] = 0;
}
const size_t max_len = std::min<size_t>(CELL_IMEJP_STRING_MAXLENGTH - 1, manager->confirmed_string.length());
const usz max_len = std::min<usz>(CELL_IMEJP_STRING_MAXLENGTH - 1, manager->confirmed_string.length());
for (u32 i = 0; i < max_len; i++)
{
@ -950,7 +950,7 @@ error_code cellImeJpGetConvertYomiString(CellImeJpHandle hImeJpHandle, vm::ptr<u
pYomiString[i] = 0;
}
const size_t max_len = std::min<size_t>(CELL_IMEJP_STRING_MAXLENGTH - 1, manager->input_string.length());
const usz max_len = std::min<usz>(CELL_IMEJP_STRING_MAXLENGTH - 1, manager->input_string.length());
for (u32 i = 0; i < max_len; i++)
{
@ -982,7 +982,7 @@ error_code cellImeJpGetConvertString(CellImeJpHandle hImeJpHandle, vm::ptr<u16>
pConvertString[i] = 0;
}
const size_t max_len = std::min<size_t>(CELL_IMEJP_STRING_MAXLENGTH - 1, manager->input_string.length());
const usz max_len = std::min<usz>(CELL_IMEJP_STRING_MAXLENGTH - 1, manager->input_string.length());
for (u32 i = 0; i < max_len; i++)
{

View file

@ -118,8 +118,8 @@ struct ime_jp_manager
std::u16string confirmed_string;
std::u16string converted_string;
std::u16string input_string;
size_t cursor = 0;
size_t cursor_end = 0;
usz cursor = 0;
usz cursor_end = 0;
s16 fix_input_mode = CELL_IMEJP_FIXINMODE_OFF;
s16 input_char_type = CELL_IMEJP_DSPCHAR_HIRA;
s16 kana_input_mode = CELL_IMEJP_ROMAN_INPUT;

View file

@ -234,7 +234,7 @@ error_code cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data,
const bool flip = current_outParam.outputMode == CELL_JPGDEC_BOTTOM_TO_TOP;
const int bytesPerLine = static_cast<int>(dataCtrlParam->outputBytesPerLine);
size_t image_size = width * height;
usz image_size = width * height;
switch(current_outParam.outputColorSpace)
{

View file

@ -231,11 +231,11 @@ s32 _ConvertStr(s32 src_code, const void *src, s32 src_len, s32 dst_code, void *
#else
s32 retValue = ConversionOK;
iconv_t ict = iconv_open(dstCode, srcCode);
size_t srcLen = src_len;
usz srcLen = src_len;
if (dst != NULL)
{
size_t dstLen = *dst_len;
size_t ictd = iconv(ict, const_cast<char**>(reinterpret_cast<const char**>(&src)), &srcLen, reinterpret_cast<char**>(&dst), &dstLen);
usz dstLen = *dst_len;
usz ictd = iconv(ict, const_cast<char**>(reinterpret_cast<const char**>(&src)), &srcLen, reinterpret_cast<char**>(&dst), &dstLen);
*dst_len -= dstLen;
if (ictd == umax)
{
@ -259,8 +259,8 @@ s32 _ConvertStr(s32 src_code, const void *src, s32 src_len, s32 dst_code, void *
while (srcLen > 0)
{
char *bufPtr = buf;
size_t bufLeft = sizeof(buf);
size_t ictd = iconv(ict, const_cast<char**>(reinterpret_cast<const char**>(&src)), &srcLen, reinterpret_cast<char**>(&dst), &bufLeft);
usz bufLeft = sizeof(buf);
usz ictd = iconv(ict, const_cast<char**>(reinterpret_cast<const char**>(&src)), &srcLen, reinterpret_cast<char**>(&dst), &bufLeft);
*dst_len += sizeof(buf) - bufLeft;
if (ictd == umax && errno != E2BIG)
{

View file

@ -182,7 +182,7 @@ struct CellMicStatus
// --- End of cell definitions ---
template <std::size_t S>
template <usz S>
class simple_ringbuf
{
public:
@ -337,7 +337,7 @@ private:
u32 sample_size = 0; // Determined at opening for internal use
static constexpr std::size_t inbuf_size = 400000; // Default value unknown
static constexpr usz inbuf_size = 400000; // Default value unknown
simple_ringbuf<inbuf_size> rbuf_raw;
simple_ringbuf<inbuf_size> rbuf_dsp;

View file

@ -153,7 +153,7 @@ void pngDecInfoCallback(png_structp png_ptr, png_infop info)
return;
}
const size_t remaining = png_process_data_pause(png_ptr, false);
const usz remaining = png_process_data_pause(png_ptr, false);
stream->buffer->cursor += (stream->buffer->length - remaining);
}

View file

@ -276,8 +276,8 @@ struct PngHandle
struct PngBuffer
{
// The cursor location and data pointer for reading from a buffer
size_t cursor;
size_t length;
usz cursor;
usz length;
vm::bptr<void> data;
// The file descriptor, and whether we need to read from a file descriptor

View file

@ -97,7 +97,7 @@ struct CellPngEncConfig
struct CellPngEncAttr
{
be_t<u32> memSize; // size_t
be_t<u32> memSize; // usz
u8 cmdQueueDepth;
be_t<u32> versionUpper;
be_t<u32> versionLower;
@ -106,7 +106,7 @@ struct CellPngEncAttr
struct CellPngEncResource
{
vm::bptr<void> memAddr;
be_t<u32> memSize; // size_t
be_t<u32> memSize; // usz
be_t<s32> ppuThreadPriority;
be_t<s32> spuThreadPriority;
};
@ -114,7 +114,7 @@ struct CellPngEncResource
struct CellPngEncResourceEx
{
vm::bptr<void> memAddr;
be_t<u32> memSize; // size_t
be_t<u32> memSize; // usz
be_t<s32> ppuThreadPriority;
vm::bptr<void> spurs; // CellSpurs
u8 priority[8];
@ -153,7 +153,7 @@ struct CellPngEncOutputParam
be_t<u32> location; // CellPngEncLocation
vm::bcptr<char> streamFileName;
vm::bptr<void> streamAddr;
be_t<u32> limitSize; // size_t
be_t<u32> limitSize; // usz
};
struct CellPngEncStreamInfo
@ -162,8 +162,8 @@ struct CellPngEncStreamInfo
be_t<u32> location; // CellPngEncLocation
vm::bcptr<char> streamFileName;
vm::bptr<void> streamAddr;
be_t<u32> limitSize; // size_t
be_t<u32> streamSize; // size_t
be_t<u32> limitSize; // usz
be_t<u32> streamSize; // usz
be_t<u32> processedLine;
be_t<u64> userData;
};

View file

@ -87,7 +87,7 @@ struct CellRescDsts
struct CellRescInitConfig
{
be_t<u32> size; // size_t
be_t<u32> size; // usz
be_t<u32> resourcePolicy;
be_t<u32> supportModes;
be_t<u32> ratioMode;

View file

@ -564,7 +564,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
}
// Simulate idle time while data is being sent to VSH
const auto lv2_sleep = [](ppu_thread& ppu, size_t sleep_time)
const auto lv2_sleep = [](ppu_thread& ppu, usz sleep_time)
{
lv2_obj::sleep(ppu);
std::this_thread::sleep_for(std::chrono::microseconds(sleep_time));

View file

@ -163,7 +163,7 @@ void fmt_class_string<SceNpCommunicationSignature>::format(std::string& out, u64
// Format as a C byte array for ease of use
fmt::append(out, "{ ");
for (std::size_t i = 0;; i++)
for (usz i = 0;; i++)
{
if (i == std::size(sign.data) - 1)
{
@ -490,7 +490,7 @@ error_code sceNpTrophyRegisterContext(ppu_thread& ppu, u32 context, u32 handle,
}
// Rename or discard certain entries based on the files found
const size_t kTargetBufferLength = 31;
const usz kTargetBufferLength = 31;
char target[kTargetBufferLength + 1];
target[kTargetBufferLength] = 0;
strcpy_trunc(target, fmt::format("TROP_%02d.SFM", static_cast<s32>(g_cfg.sys.language)));

View file

@ -17,7 +17,7 @@ static bool validateSlotIds(vm::cptr<SceNpTusSlotId> slotIdArray)
}
// TODO: how to properly iterate?
//for (size_t i = 0; i < slotIdArray.size(); ++i)
//for (usz i = 0; i < slotIdArray.size(); ++i)
//{
// if (slotIdArray[i] < 0)
// {
@ -66,7 +66,7 @@ sce_np_tus_title_context* sce_np_tus_manager::get_title_context(s32 titleCtxId)
s32 sce_np_tus_manager::add_transaction_context(s32 titleCtxId)
{
size_t transaction_count = 0;
usz transaction_count = 0;
for (const auto& title_context : title_contexts)
{

View file

@ -16,47 +16,47 @@ struct ps3_fmt_src
ppu_thread* ctx;
u32 g_count;
bool test(std::size_t index) const
bool test(usz index) const
{
return true;
}
template <typename T>
T get(std::size_t index) const
T get(usz index) const
{
const u32 i = static_cast<u32>(index) + g_count;
return ppu_gpr_cast<T>(i < 8 ? ctx->gpr[3 + i] : +*ctx->get_stack_arg(i));
}
void skip(std::size_t extra)
void skip(usz extra)
{
g_count += static_cast<u32>(extra) + 1;
}
std::size_t fmt_string(std::string& out, std::size_t extra) const
usz fmt_string(std::string& out, usz extra) const
{
const std::size_t start = out.size();
const usz start = out.size();
out += vm::_ptr<const char>(get<u32>(extra));
return out.size() - start;
}
std::size_t type(std::size_t extra) const
usz type(usz extra) const
{
return 0;
}
static constexpr std::size_t size_char = 1;
static constexpr std::size_t size_short = 2;
static constexpr std::size_t size_int = 4;
static constexpr std::size_t size_long = 4;
static constexpr std::size_t size_llong = 8;
static constexpr std::size_t size_size = 4;
static constexpr std::size_t size_max = 8;
static constexpr std::size_t size_diff = 4;
static constexpr usz size_char = 1;
static constexpr usz size_short = 2;
static constexpr usz size_int = 4;
static constexpr usz size_long = 4;
static constexpr usz size_llong = 8;
static constexpr usz size_size = 4;
static constexpr usz size_max = 8;
static constexpr usz size_diff = 4;
};
template <>
f64 ps3_fmt_src::get<f64>(std::size_t index) const
f64 ps3_fmt_src::get<f64>(usz index) const
{
return std::bit_cast<f64>(get<u64>(index));
}
@ -404,7 +404,7 @@ s32 _sys_snprintf(ppu_thread& ppu, vm::ptr<char> dst, u32 count, vm::cptr<char>
}
else
{
count = static_cast<u32>(std::min<size_t>(count - 1, result.size()));
count = static_cast<u32>(std::min<usz>(count - 1, result.size()));
std::memcpy(dst.get_ptr(), result.c_str(), count);
dst[count] = 0;

View file

@ -836,7 +836,7 @@ void ppu_module::analyse(u32 lib_toc, u32 entry)
}
// Main loop (func_queue may grow)
for (std::size_t i = 0; i < func_queue.size(); i++)
for (usz i = 0; i < func_queue.size(); i++)
{
ppu_function& func = func_queue[i];
@ -1187,7 +1187,7 @@ void ppu_module::analyse(u32 lib_toc, u32 entry)
const bool was_empty = block_queue.empty();
// Block loop (block_queue may grow, may be aborted via clearing)
for (std::size_t j = 0; j < block_queue.size(); j++)
for (usz j = 0; j < block_queue.size(); j++)
{
auto& block = block_queue[j].get();

View file

@ -117,9 +117,9 @@ struct ppu_pattern
struct ppu_pattern_array
{
const ppu_pattern* ptr;
std::size_t count;
usz count;
template <std::size_t N>
template <usz N>
constexpr ppu_pattern_array(const ppu_pattern(&array)[N])
: ptr(array)
, count(N)
@ -140,9 +140,9 @@ struct ppu_pattern_array
struct ppu_pattern_matrix
{
const ppu_pattern_array* ptr;
std::size_t count;
usz count;
template <std::size_t N>
template <usz N>
constexpr ppu_pattern_matrix(const ppu_pattern_array(&array)[N])
: ptr(array)
, count(N)

View file

@ -698,7 +698,7 @@ static void ppu_check_patch_spu_images(const ppu_segment& seg)
{
const std::string_view seg_view{vm::get_super_ptr<char>(seg.addr), seg.size};
for (std::size_t i = seg_view.find("\177ELF"); i < seg.size; i = seg_view.find("\177ELF", i + 4))
for (usz i = seg_view.find("\177ELF"); i < seg.size; i = seg_view.find("\177ELF", i + 4))
{
const auto elf_header = vm::get_super_ptr<u8>(seg.addr + i);
@ -715,7 +715,7 @@ static void ppu_check_patch_spu_images(const ppu_segment& seg)
std::string name;
std::string dump;
std::size_t applied = 0;
usz applied = 0;
// Executable hash
sha1_context sha2;
@ -867,7 +867,7 @@ std::shared_ptr<lv2_prx> ppu_load_prx(const ppu_prx_object& elf, const std::stri
if (s.sh_type == 1u && addr && size) // TODO: some sections with addr=0 are valid
{
for (std::size_t i = 0; i < prx->segs.size(); i++)
for (usz i = 0; i < prx->segs.size(); i++)
{
const u32 saddr = static_cast<u32>(elf.progs[i].p_vaddr);
if (addr >= saddr && addr < saddr + elf.progs[i].p_memsz)

View file

@ -2105,7 +2105,7 @@ extern void ppu_initialize(const ppu_module& info)
std::vector<std::pair<std::string, u64>> globals;
// Split module into fragments <= 1 MiB
std::size_t fpos = 0;
usz fpos = 0;
// Difference between function name and current location
const u32 reloc = info.name.empty() ? 0 : info.segs.at(0).addr;
@ -2139,7 +2139,7 @@ extern void ppu_initialize(const ppu_module& info)
const u32 suffix = info.funcs.at(fstart).addr - reloc;
// Overall block size in bytes
std::size_t bsize = 0;
usz bsize = 0;
while (fpos < info.funcs.size())
{
@ -2455,7 +2455,7 @@ extern void ppu_initialize(const ppu_module& info)
}
else
{
std::size_t index = 0;
usz index = 0;
// Locate existing functions
for (const auto& func : info.funcs)
@ -2544,7 +2544,7 @@ static void ppu_initialize2(jit_compiler& jit, const ppu_module& module_part, co
//pm.add(createLintPass()); // Check
// Translate functions
for (size_t fi = 0, fmax = module_part.funcs.size(); fi < fmax; fi++)
for (usz fi = 0, fmax = module_part.funcs.size(); fi < fmax; fi++)
{
if (Emu.IsStopped())
{

View file

@ -137,7 +137,7 @@ public:
u8 bits[32];
u32 fields[8];
u8& operator [](std::size_t i)
u8& operator [](usz i)
{
return bits[i];
}

View file

@ -528,7 +528,7 @@ Value* PPUTranslator::Shuffle(Value* left, Value* right, std::initializer_list<u
const u32 mask = cast<VectorType>(type)->getNumElements() - 1;
// Transform indices (works for vectors with size 2^N)
for (std::size_t i = 0; i < indices.size(); i++)
for (usz i = 0; i < indices.size(); i++)
{
data.push_back(indices.end()[~i] ^ mask);
}

View file

@ -209,20 +209,20 @@ public:
// Create sign extension (with double size if type is nullptr)
llvm::Value* SExt(llvm::Value* value, llvm::Type* = nullptr);
template<std::size_t N>
template<usz N>
std::array<llvm::Value*, N> SExt(std::array<llvm::Value*, N> values, llvm::Type* type = nullptr)
{
for (std::size_t i = 0; i < N; i++) values[i] = SExt(values[i], type);
for (usz i = 0; i < N; i++) values[i] = SExt(values[i], type);
return values;
}
// Create zero extension (with double size if type is nullptr)
llvm::Value* ZExt(llvm::Value*, llvm::Type* = nullptr);
template<std::size_t N>
template<usz N>
std::array<llvm::Value*, N> ZExt(std::array<llvm::Value*, N> values, llvm::Type* type = nullptr)
{
for (std::size_t i = 0; i < N; i++) values[i] = ZExt(values[i], type);
for (usz i = 0; i < N; i++) values[i] = ZExt(values[i], type);
return values;
}

View file

@ -389,7 +389,7 @@ void spu_cache::initialize()
// Read cache
auto func_list = cache.get();
atomic_t<std::size_t> fnext{};
atomic_t<usz> fnext{};
atomic_t<u8> fail_flag{0};
if (g_cfg.core.spu_decoder == spu_decoder_type::fast || g_cfg.core.spu_decoder == spu_decoder_type::llvm)
@ -456,7 +456,7 @@ void spu_cache::initialize()
std::vector<be_t<u32>> ls(0x10000);
// Build functions
for (std::size_t func_i = fnext++; func_i < func_list.size(); func_i = fnext++)
for (usz func_i = fnext++; func_i < func_list.size(); func_i = fnext++)
{
const spu_program& func = std::as_const(func_list)[func_i];
@ -750,7 +750,7 @@ spu_function_t spu_runtime::rebuild_ubertrampoline(u32 id_inst)
// LS address starting from PC is already loaded into rcx (see spu_runtime::tr_all)
for (std::size_t i = 0; i < workload.size(); i++)
for (usz i = 0; i < workload.size(); i++)
{
// Get copy of the workload info
auto w = workload[i];
@ -1975,7 +1975,7 @@ spu_program spu_recompiler_base::analyse(const be_t<u32>* ls, u32 entry_point)
workload.push_back(pair.first);
m_bits[pair.first / 4] = true;
for (std::size_t i = 0; !reachable && i < workload.size(); i++)
for (usz i = 0; !reachable && i < workload.size(); i++)
{
for (u32 j = workload[i];; j -= 4)
{
@ -4492,7 +4492,7 @@ public:
m_function_table = new llvm::GlobalVariable(*m_module, llvm::ArrayType::get(entry_chunk->chunk->getType(), m_size / 4), true, llvm::GlobalValue::InternalLinkage, nullptr);
// Create function chunks
for (std::size_t fi = 0; fi < m_function_queue.size(); fi++)
for (usz fi = 0; fi < m_function_queue.size(); fi++)
{
// Initialize function info
m_entry = m_function_queue[fi];
@ -4506,7 +4506,7 @@ public:
m_ir->CreateBr(add_block(m_entry));
// Emit instructions for basic blocks
for (std::size_t bi = 0; bi < m_block_queue.size(); bi++)
for (usz bi = 0; bi < m_block_queue.size(); bi++)
{
// Initialize basic block info
const u32 baddr = m_block_queue[bi];

View file

@ -1226,7 +1226,7 @@ bool lv2_obj::awake_unlocked(cpu_thread* cpu, s32 prio)
case yield_cmd:
{
// Yield command
for (std::size_t i = 0;; i++)
for (usz i = 0;; i++)
{
if (i + 1 >= g_ppu.size())
{
@ -1235,7 +1235,7 @@ bool lv2_obj::awake_unlocked(cpu_thread* cpu, s32 prio)
if (const auto ppu = g_ppu[i]; ppu == cpu)
{
std::size_t j = i + 1;
usz j = i + 1;
for (; j < g_ppu.size(); j++)
{
@ -1325,7 +1325,7 @@ bool lv2_obj::awake_unlocked(cpu_thread* cpu, s32 prio)
}
// Suspend threads if necessary
for (std::size_t i = g_cfg.core.ppu_threads; changed_queue && i < g_ppu.size(); i++)
for (usz i = g_cfg.core.ppu_threads; changed_queue && i < g_ppu.size(); i++)
{
const auto target = g_ppu[i];
@ -1352,7 +1352,7 @@ void lv2_obj::schedule_all()
if (g_pending.empty())
{
// Wake up threads
for (std::size_t i = 0, x = std::min<std::size_t>(g_cfg.core.ppu_threads, g_ppu.size()); i < x; i++)
for (usz i = 0, x = std::min<usz>(g_cfg.core.ppu_threads, g_ppu.size()); i < x; i++)
{
const auto target = g_ppu[i];

View file

@ -238,7 +238,7 @@ public:
const std::vector<u8> data;
// Constructors (should not be used directly)
lv2_config_service(sys_config_service_id _id, u64 _user_id, u64 _verbosity, u32 _padding, const u8 _data[], size_t size)
lv2_config_service(sys_config_service_id _id, u64 _user_id, u64 _verbosity, u32 _padding, const u8 _data[], usz size)
: timestamp(get_system_time())
, id(_id)
, user_id(_user_id)
@ -269,7 +269,7 @@ public:
void notify() const;
// Utilities
size_t get_size() const { return sizeof(sys_config_service_event_t)-1 + data.size(); }
usz get_size() const { return sizeof(sys_config_service_event_t)-1 + data.size(); }
std::shared_ptr<lv2_config_service> get_shared_ptr () const { return wkptr.lock(); };
u32 get_id() const { return idm_id; }
};
@ -304,7 +304,7 @@ public:
const std::vector<u8> data;
// Constructors (should not be used directly)
lv2_config_service_listener(std::shared_ptr<lv2_config_handle>& _handle, sys_config_service_id _service_id, u64 _min_verbosity, sys_config_service_listener_type _type, const u8 _data[], size_t size)
lv2_config_service_listener(std::shared_ptr<lv2_config_handle>& _handle, sys_config_service_id _service_id, u64 _min_verbosity, sys_config_service_listener_type _type, const u8 _data[], usz size)
: handle(_handle)
, service_id(_service_id)
, min_verbosity(_min_verbosity)
@ -406,7 +406,7 @@ public:
void write(sys_config_service_event_t *dst);
// Check if the buffer can fit the current event, return false otherwise
bool check_buffer_size(size_t size) const { return service->get_size() <= size; }
bool check_buffer_size(usz size) const { return service->get_size() <= size; }
};
/*

View file

@ -57,7 +57,7 @@ lv2_fs_mount_point* lv2_fs_object::get_mp(std::string_view filename)
{
std::string_view mp_name, vpath = filename;
for (std::size_t depth = 0;;)
for (usz depth = 0;;)
{
// Skip one or more '/'
const auto pos = vpath.find_first_not_of('/');
@ -833,7 +833,7 @@ error_code sys_fs_readdir(ppu_thread& ppu, u32 fd, vm::ptr<CellFsDirent> dir, vm
if (auto* info = directory->dir_read())
{
dir->d_type = info->is_directory ? CELL_FS_TYPE_DIRECTORY : CELL_FS_TYPE_REGULAR;
dir->d_namlen = u8(std::min<size_t>(info->name.size(), CELL_FS_MAX_FS_FILE_NAME_LENGTH));
dir->d_namlen = u8(std::min<usz>(info->name.size(), CELL_FS_MAX_FS_FILE_NAME_LENGTH));
strcpy_trunc(dir->d_name, info->name);
*nread = sizeof(CellFsDirent);
}
@ -1570,7 +1570,7 @@ error_code sys_fs_fcntl(ppu_thread& ppu, u32 fd, u32 op, vm::ptr<void> _arg, u32
}
entry.entry_name.d_type = info->is_directory ? CELL_FS_TYPE_DIRECTORY : CELL_FS_TYPE_REGULAR;
entry.entry_name.d_namlen = u8(std::min<size_t>(info->name.size(), CELL_FS_MAX_FS_FILE_NAME_LENGTH));
entry.entry_name.d_namlen = u8(std::min<usz>(info->name.size(), CELL_FS_MAX_FS_FILE_NAME_LENGTH));
strcpy_trunc(entry.entry_name.d_name, info->name);
}
}

View file

@ -518,7 +518,7 @@ struct nt_p2p_port
}
}
static u16 tcp_checksum(const u16* buffer, std::size_t size)
static u16 tcp_checksum(const u16* buffer, usz size)
{
u32 cksum = 0;
while (size > 1)
@ -1051,7 +1051,7 @@ struct network_thread
std::lock_guard lock(s_nw_mutex);
for (std::size_t i = 0; i < socklist.size(); i++)
for (usz i = 0; i < socklist.size(); i++)
{
bs_t<lv2_socket::poll> events{};
@ -1114,7 +1114,7 @@ struct network_thread
socklist.emplace_back(idm::get_unlocked<lv2_socket>(id));
});
for (std::size_t i = 0; i < socklist.size(); i++)
for (usz i = 0; i < socklist.size(); i++)
{
#ifdef _WIN32
std::lock_guard lock(socklist[i]->mutex);

View file

@ -382,7 +382,7 @@ struct lv2_socket final
};
static constexpr be_t<u32> U2S_sig = (static_cast<u32>('U') << 24 | static_cast<u32>('2') << 16 | static_cast<u32>('S') << 8 | static_cast<u32>('0'));
static constexpr std::size_t MAX_RECEIVED_BUFFER = (1024*1024*10);
static constexpr usz MAX_RECEIVED_BUFFER = (1024*1024*10);
// P2P stream socket specific
struct encapsulated_tcp
@ -407,7 +407,7 @@ struct lv2_socket final
stream_status status = stream_status::stream_closed;
std::size_t max_backlog = 0; // set on listen
usz max_backlog = 0; // set on listen
std::queue<s32> backlog;
u16 op_port = 0, op_vport = 0;

View file

@ -13,7 +13,7 @@ struct lv2_overlay final : lv2_obj, ppu_module
error_code sys_overlay_load_module(vm::ptr<u32> ovlmid, vm::cptr<char> path, u64 flags, vm::ptr<u32> entry);
error_code sys_overlay_load_module_by_fd(vm::ptr<u32> ovlmid, u32 fd, u64 offset, u64 flags, vm::ptr<u32> entry);
error_code sys_overlay_unload_module(u32 ovlmid);
//error_code sys_overlay_get_module_list(sys_pid_t pid, size_t ovlmids_num, sys_overlay_t * ovlmids, size_t * num_of_modules);
//error_code sys_overlay_get_module_list(sys_pid_t pid, usz ovlmids_num, sys_overlay_t * ovlmids, usz * num_of_modules);
//error_code sys_overlay_get_module_info(sys_pid_t pid, sys_overlay_t ovlmid, sys_overlay_module_info_t * info);
//error_code sys_overlay_get_module_info2(sys_pid_t pid, sys_overlay_t ovlmid, sys_overlay_module_info2_t * info);//
//error_code sys_overlay_get_sdk_version(); //2 params

View file

@ -267,7 +267,7 @@ error_code _sys_process_get_paramsfo(vm::ptr<char> buffer)
}
memset(buffer.get_ptr(), 0, 0x40);
memcpy(buffer.get_ptr() + 1, Emu.GetTitleID().c_str(), std::min<size_t>(Emu.GetTitleID().length(), 9));
memcpy(buffer.get_ptr() + 1, Emu.GetTitleID().c_str(), std::min<usz>(Emu.GetTitleID().length(), 9));
return CELL_OK;
}

View file

@ -207,10 +207,10 @@ error_code sys_rsx_context_allocate(cpu_thread& cpu, vm::ptr<u32> context_id, vm
auto &reports = vm::_ref<RsxReports>(vm::cast(*lpar_reports));
std::memset(&reports, 0, sizeof(RsxReports));
for (size_t i = 0; i < std::size(reports.notify); ++i)
for (usz i = 0; i < std::size(reports.notify); ++i)
reports.notify[i].timestamp = -1;
for (size_t i = 0; i < std::size(reports.semaphore); i += 4)
for (usz i = 0; i < std::size(reports.semaphore); i += 4)
{
reports.semaphore[i + 0].val.raw() = 0x1337C0D3;
reports.semaphore[i + 1].val.raw() = 0x1337BABE;
@ -218,7 +218,7 @@ error_code sys_rsx_context_allocate(cpu_thread& cpu, vm::ptr<u32> context_id, vm
reports.semaphore[i + 3].val.raw() = 0x1337F001;
}
for (size_t i = 0; i < std::size(reports.report); ++i)
for (usz i = 0; i < std::size(reports.report); ++i)
{
reports.report[i].val = 0;
reports.report[i].timestamp = -1;

View file

@ -32,7 +32,7 @@ error_code sys_tty_read(s32 ch, vm::ptr<char> buf, u32 len, vm::ptr<u32> preadle
sys_tty.warning("sys_tty_read called with system channel %d", ch);
}
size_t chars_to_read = 0; // number of chars that will be read from the input string
usz chars_to_read = 0; // number of chars that will be read from the input string
std::string tty_read; // string for storage of read chars
if (len > 0)
@ -45,15 +45,15 @@ error_code sys_tty_read(s32 ch, vm::ptr<char> buf, u32 len, vm::ptr<u32> preadle
std::string& input = g_tty_input[ch].front();
// we have to stop reading at either a new line, the param len, or our input string size
size_t new_line_pos = input.find_first_of('\n');
usz new_line_pos = input.find_first_of('\n');
if (new_line_pos != input.npos)
{
chars_to_read = std::min(new_line_pos, static_cast<size_t>(len));
chars_to_read = std::min(new_line_pos, static_cast<usz>(len));
}
else
{
chars_to_read = std::min(input.size(), static_cast<size_t>(len));
chars_to_read = std::min(input.size(), static_cast<usz>(len));
}
// read the previously calculated number of chars from the beginning of the input string

View file

@ -350,7 +350,7 @@ void gdb_thread::send_cmd(const std::string& cmd)
std::string buf;
buf.reserve(cmd.length() + 4);
buf += "$";
for (std::size_t i = 0; i < cmd.length(); ++i)
for (usz i = 0; i < cmd.length(); ++i)
{
checksum = (checksum + append_encoded_char(cmd[i], buf)) % 256;
}
@ -590,7 +590,7 @@ bool gdb_thread::cmd_write_register(gdb_cmd& cmd)
auto th = selected_thread.lock();
if (th->id_type() == 1) {
auto ppu = static_cast<named_thread<ppu_thread>*>(th.get());
size_t eq_pos = cmd.data.find('=');
usz eq_pos = cmd.data.find('=');
if (eq_pos == umax) {
GDB.warning("Wrong write_register cmd data '%s'.", cmd.data);
return send_cmd_ack("E02");
@ -609,7 +609,7 @@ bool gdb_thread::cmd_write_register(gdb_cmd& cmd)
bool gdb_thread::cmd_read_memory(gdb_cmd& cmd)
{
size_t s = cmd.data.find(',');
usz s = cmd.data.find(',');
u32 addr = hex_to_u32(cmd.data.substr(0, s));
u32 len = hex_to_u32(cmd.data.substr(s + 1));
std::string result;
@ -631,8 +631,8 @@ bool gdb_thread::cmd_read_memory(gdb_cmd& cmd)
bool gdb_thread::cmd_write_memory(gdb_cmd& cmd)
{
size_t s = cmd.data.find(',');
size_t s2 = cmd.data.find(':');
usz s = cmd.data.find(',');
usz s2 = cmd.data.find(':');
if ((s == umax) || (s2 == umax)) {
GDB.warning("Malformed write memory request received: '%s'.", cmd.data);
return send_cmd_ack("E01");

View file

@ -253,7 +253,7 @@ std::string PadHandlerBase::name_string() const
return m_name_string;
}
size_t PadHandlerBase::max_devices() const
usz PadHandlerBase::max_devices() const
{
return m_max_devices;
}
@ -615,7 +615,7 @@ void PadHandlerBase::get_mapping(const std::shared_ptr<PadDevice>& device, const
void PadHandlerBase::ThreadProc()
{
for (size_t i = 0; i < bindings.size(); ++i)
for (usz i = 0; i < bindings.size(); ++i)
{
auto device = bindings[i].first;
auto pad = bindings[i].second;

View file

@ -62,7 +62,7 @@ protected:
std::array<bool, MAX_GAMEPADS> last_connection_status{{ false, false, false, false, false, false, false }};
std::string m_name_string;
size_t m_max_devices = 0;
usz m_max_devices = 0;
int m_trigger_threshold = 0;
int m_thumb_threshold = 0;
@ -132,7 +132,7 @@ public:
pad_handler m_type;
std::string name_string() const;
size_t max_devices() const;
usz max_devices() const;
bool has_config() const;
bool has_rumble() const;
bool has_deadzones() const;

View file

@ -1103,7 +1103,7 @@ namespace vm
// Fill stack guards with STACKGRD
if (this->flags & 0x10)
{
auto fill64 = [](u8* ptr, u64 data, std::size_t count)
auto fill64 = [](u8* ptr, u64 data, usz count)
{
u64* target = reinterpret_cast<u64*>(ptr);

View file

@ -41,17 +41,17 @@ void np_handler::RoomGroup_to_SceNpMatching2RoomGroup(const flatbuffers::Vector<
void np_handler::UserInfo2_to_SceNpUserInfo2(const UserInfo2* user, SceNpUserInfo2* user_info)
{
if (user->npId())
memcpy(user_info->npId.handle.data, user->npId()->c_str(), std::min(sizeof(user_info->npId.handle.data), static_cast<std::size_t>(user->npId()->size())));
memcpy(user_info->npId.handle.data, user->npId()->c_str(), std::min(sizeof(user_info->npId.handle.data), static_cast<usz>(user->npId()->size())));
if (user->onlineName())
{
user_info->onlineName.set(allocate(sizeof(SceNpOnlineName)));
memcpy(user_info->onlineName->data, user->onlineName()->c_str(), std::min(sizeof(user_info->onlineName->data), static_cast<std::size_t>(user->onlineName()->size())));
memcpy(user_info->onlineName->data, user->onlineName()->c_str(), std::min(sizeof(user_info->onlineName->data), static_cast<usz>(user->onlineName()->size())));
}
if (user->avatarUrl())
{
user_info->avatarUrl.set(allocate(sizeof(SceNpAvatarUrl)));
memcpy(user_info->avatarUrl->data, user->avatarUrl()->c_str(), std::min(sizeof(user_info->avatarUrl->data), static_cast<std::size_t>(user->avatarUrl()->size())));
memcpy(user_info->avatarUrl->data, user->avatarUrl()->c_str(), std::min(sizeof(user_info->avatarUrl->data), static_cast<usz>(user->avatarUrl()->size())));
}
}
@ -283,7 +283,7 @@ void np_handler::RoomMemberUpdateInfo_to_SceNpMatching2RoomMemberUpdateInfo(cons
if (update_info->optData())
{
sce_update_info->optData.length = update_info->optData()->data()->size();
for (size_t i = 0; i < 16; i++)
for (usz i = 0; i < 16; i++)
{
sce_update_info->optData.data[i] = update_info->optData()->data()->Get(i);
}
@ -335,7 +335,7 @@ void np_handler::RoomUpdateInfo_to_SceNpMatching2RoomUpdateInfo(const RoomUpdate
if (update_info->optData())
{
sce_update_info->optData.length = update_info->optData()->data()->size();
for (size_t i = 0; i < 16; i++)
for (usz i = 0; i < 16; i++)
{
sce_update_info->optData.data[i] = update_info->optData()->data()->Get(i);
}

View file

@ -77,7 +77,7 @@ np_handler::np_handler()
// Init switch map for dns
auto swaps = fmt::split(g_cfg.net.swap_list.to_string(), {"&&"});
for (std::size_t i = 0; i < swaps.size(); i++)
for (usz i = 0; i < swaps.size(); i++)
{
auto host_and_ip = fmt::split(swaps[i], {"="});
if (host_and_ip.size() != 2)
@ -741,7 +741,7 @@ bool np_handler::reply_get_world_list(u32 req_id, std::vector<u8>& reply_data)
if (!world_list.empty())
{
world_info->world.set(allocate(sizeof(SceNpMatching2World) * world_list.size()));
for (size_t i = 0; i < world_list.size(); i++)
for (usz i = 0; i < world_list.size(); i++)
{
world_info->world[i].worldId = world_list[i];
world_info->world[i].numOfLobby = 1; // TODO
@ -1343,7 +1343,7 @@ u32 np_handler::generate_callback_info(SceNpMatching2ContextId ctx_id, vm::cptr<
return req_id;
}
u8* np_handler::allocate_req_result(u32 event_key, size_t size)
u8* np_handler::allocate_req_result(u32 event_key, usz size)
{
std::lock_guard lock(mutex_req_results);
match2_req_results[event_key] = std::vector<u8>(size, 0);

View file

@ -204,7 +204,7 @@ protected:
return match2_event_cnt.fetch_add(1);
}
shared_mutex mutex_req_results;
u8* allocate_req_result(u32 event_key, size_t size);
u8* allocate_req_result(u32 event_key, usz size);
// RPCN
rpcn_client rpcn;

View file

@ -91,11 +91,11 @@ void rpcn_client::disconnect()
server_info_received = false;
}
rpcn_client::recvn_result rpcn_client::recvn(u8* buf, std::size_t n)
rpcn_client::recvn_result rpcn_client::recvn(u8* buf, usz n)
{
u32 num_timeouts = 0;
size_t n_recv = 0;
usz n_recv = 0;
while (n_recv != n && !is_abort())
{
std::lock_guard lock(mutex_socket);
@ -136,7 +136,7 @@ rpcn_client::recvn_result rpcn_client::recvn(u8* buf, std::size_t n)
bool rpcn_client::send_packet(const std::vector<u8>& packet)
{
u32 num_timeouts = 0;
std::size_t n_sent = 0;
usz n_sent = 0;
while (n_sent != packet.size())
{
std::lock_guard lock(mutex_socket);
@ -723,7 +723,7 @@ bool rpcn_client::createjoin_room(u32 req_id, const SceNpCommunicationId& commun
builder.Finish(req_finished);
u8* buf = builder.GetBufferPointer();
size_t bufsize = builder.GetSize();
usz bufsize = builder.GetSize();
data.resize(COMMUNICATION_ID_SIZE + sizeof(u32) + bufsize);
memcpy(data.data(), communication_id.data, COMMUNICATION_ID_SIZE);
@ -767,7 +767,7 @@ bool rpcn_client::join_room(u32 req_id, const SceNpCommunicationId& communicatio
builder.Finish(req_finished);
u8* buf = builder.GetBufferPointer();
size_t bufsize = builder.GetSize();
usz bufsize = builder.GetSize();
data.resize(COMMUNICATION_ID_SIZE + sizeof(u32) + bufsize);
memcpy(data.data(), communication_id.data, COMMUNICATION_ID_SIZE);
@ -789,7 +789,7 @@ bool rpcn_client::leave_room(u32 req_id, const SceNpCommunicationId& communicati
auto req_finished = CreateLeaveRoomRequest(builder, req->roomId, final_optdata);
builder.Finish(req_finished);
u8* buf = builder.GetBufferPointer();
size_t bufsize = builder.GetSize();
usz bufsize = builder.GetSize();
data.resize(COMMUNICATION_ID_SIZE + sizeof(u32) + bufsize);
memcpy(data.data(), communication_id.data, COMMUNICATION_ID_SIZE);
@ -855,7 +855,7 @@ bool rpcn_client::search_room(u32 req_id, const SceNpCommunicationId& communicat
auto req_finished = s_req.Finish();
builder.Finish(req_finished);
u8* buf = builder.GetBufferPointer();
size_t bufsize = builder.GetSize();
usz bufsize = builder.GetSize();
data.resize(COMMUNICATION_ID_SIZE + bufsize + sizeof(u32));
memcpy(data.data(), communication_id.data, COMMUNICATION_ID_SIZE);
@ -910,7 +910,7 @@ bool rpcn_client::set_roomdata_external(u32 req_id, const SceNpCommunicationId&
builder.Finish(req_finished);
u8* buf = builder.GetBufferPointer();
size_t bufsize = builder.GetSize();
usz bufsize = builder.GetSize();
data.resize(COMMUNICATION_ID_SIZE + bufsize + sizeof(u32));
memcpy(data.data(), communication_id.data, COMMUNICATION_ID_SIZE);
@ -937,7 +937,7 @@ bool rpcn_client::get_roomdata_internal(u32 req_id, const SceNpCommunicationId&
builder.Finish(req_finished);
u8* buf = builder.GetBufferPointer();
size_t bufsize = builder.GetSize();
usz bufsize = builder.GetSize();
data.resize(COMMUNICATION_ID_SIZE + bufsize + sizeof(u32));
memcpy(data.data(), communication_id.data, COMMUNICATION_ID_SIZE);
@ -992,7 +992,7 @@ bool rpcn_client::set_roomdata_internal(u32 req_id, const SceNpCommunicationId&
builder.Finish(req_finished);
u8* buf = builder.GetBufferPointer();
size_t bufsize = builder.GetSize();
usz bufsize = builder.GetSize();
data.resize(COMMUNICATION_ID_SIZE + bufsize + sizeof(u32));
memcpy(data.data(), communication_id.data, COMMUNICATION_ID_SIZE);
@ -1051,7 +1051,7 @@ bool rpcn_client::send_room_message(u32 req_id, const SceNpCommunicationId& comm
builder.Finish(req_finished);
u8* buf = builder.GetBufferPointer();
size_t bufsize = builder.GetSize();
usz bufsize = builder.GetSize();
data.resize(COMMUNICATION_ID_SIZE + bufsize + sizeof(u32));
memcpy(data.data(), communication_id.data, COMMUNICATION_ID_SIZE);

View file

@ -27,7 +27,7 @@ class vec_stream
{
public:
vec_stream() = delete;
vec_stream(std::vector<u8>& _vec, size_t initial_index = 0)
vec_stream(std::vector<u8>& _vec, usz initial_index = 0)
: vec(_vec)
, i(initial_index){};
bool is_error() const
@ -86,7 +86,7 @@ public:
{
value = reinterpret_cast<le_t<T>>(value);
// resize + memcpy instead?
for (size_t index = 0; index < sizeof(T); index++)
for (usz index = 0; index < sizeof(T); index++)
{
vec.push_back(*(reinterpret_cast<u8*>(&value) + index));
}
@ -99,7 +99,7 @@ public:
protected:
std::vector<u8>& vec;
size_t i = 0;
usz i = 0;
bool error = false;
};
@ -207,7 +207,7 @@ protected:
recvn_fatal,
};
recvn_result recvn(u8* buf, std::size_t n);
recvn_result recvn(u8* buf, usz n);
bool get_reply(u32 expected_id, std::vector<u8>& data);

View file

@ -78,7 +78,7 @@ namespace rsx
auto layout = get_subresources_layout(tex);
// todo: dont use this function and just get size somehow
size_t texSize = 0;
usz texSize = 0;
for (const auto& l : layout)
texSize += l.data.size();
@ -104,7 +104,7 @@ namespace rsx
auto layout = get_subresources_layout(tex);
// todo: dont use this function and just get size somehow
size_t texSize = 0;
usz texSize = 0;
for (const auto& l : layout)
texSize += l.data.size();
@ -147,7 +147,7 @@ namespace rsx
{
const auto& range = method_registers.current_draw_clause.get_range();
const u32 vertCount = range.count;
const size_t bufferSize = (vertCount - 1) * vertStride + vertSize;
const usz bufferSize = (vertCount - 1) * vertStride + vertSize;
frame_capture_data::memory_block block;
block.offset = base_address + (range.first * vertStride);
@ -186,7 +186,7 @@ namespace rsx
const u32 idxCount = range.count;
const u32 idxAddr = base_addr + (idxFirst * type_size);
const size_t bufferSize = idxCount * type_size;
const usz bufferSize = idxCount * type_size;
frame_capture_data::memory_block block;
block.offset = base_address + (idxFirst * type_size);

View file

@ -185,7 +185,7 @@ namespace rsx
auto render = get_current_renderer();
auto last_flip = render->int_flip_index;
size_t stopIdx = 0;
usz stopIdx = 0;
for (const auto& replay_cmd : frame->replay_commands)
{
while (Emu.IsPaused())

View file

@ -121,7 +121,7 @@ class CgBinaryDisasm
std::string m_path; // used for FP decompiler thread, delete this later
u8* m_buffer = nullptr;
std::size_t m_buffer_size = 0;
usz m_buffer_size = 0;
std::string m_arb_shader;
std::string m_glsl_shader;
std::string m_dst_reg_name;
@ -138,8 +138,8 @@ class CgBinaryDisasm
// VP members
u32 m_sca_opcode;
u32 m_vec_opcode;
static const size_t m_max_instr_count = 512;
size_t m_instr_count;
static const usz m_max_instr_count = 512;
usz m_instr_count;
std::vector<u32> m_data;
public:
@ -298,7 +298,7 @@ public:
fs::file f(m_path);
if (!f) return;
size_t size = f.size();
usz size = f.size();
vm::init();
ptr = vm::alloc(static_cast<u32>(size), vm::main);
f.read(vm::base(ptr), size);

View file

@ -114,8 +114,8 @@ struct temp_register
/**
* This class is used to translate RSX Fragment program to GLSL/HLSL code
* Backend with text based shader can subclass this class and implement :
* - virtual std::string getFloatTypeName(size_t elementCount) = 0;
* - virtual std::string getHalfTypeName(size_t elementCount) = 0;
* - virtual std::string getFloatTypeName(usz elementCount) = 0;
* - virtual std::string getHalfTypeName(usz elementCount) = 0;
* - virtual std::string getFunction(enum class FUNCTION) = 0;
* - virtual std::string saturate(const std::string &code) = 0;
* - virtual std::string compareFunction(enum class COMPARE, const std::string &, const std::string &) = 0;
@ -214,11 +214,11 @@ protected:
/** returns the type name of float vectors.
*/
virtual std::string getFloatTypeName(size_t elementCount) = 0;
virtual std::string getFloatTypeName(usz elementCount) = 0;
/** returns the type name of half vectors.
*/
virtual std::string getHalfTypeName(size_t elementCount) = 0;
virtual std::string getHalfTypeName(usz elementCount) = 0;
/** returns string calling function where arguments are passed via
* $0 $1 $2 substring.

View file

@ -135,7 +135,7 @@ namespace program_common
namespace glsl
{
static std::string getFloatTypeNameImpl(size_t elementCount)
static std::string getFloatTypeNameImpl(usz elementCount)
{
switch (elementCount)
{
@ -152,7 +152,7 @@ namespace glsl
}
}
static std::string getHalfTypeNameImpl(size_t elementCount)
static std::string getHalfTypeNameImpl(usz elementCount)
{
switch (elementCount)
{

View file

@ -7,12 +7,12 @@
using namespace program_hash_util;
size_t vertex_program_utils::get_vertex_program_ucode_hash(const RSXVertexProgram &program)
usz vertex_program_utils::get_vertex_program_ucode_hash(const RSXVertexProgram &program)
{
// 64-bit Fowler/Noll/Vo FNV-1a hash code
size_t hash = 0xCBF29CE484222325ULL;
usz hash = 0xCBF29CE484222325ULL;
const void* instbuffer = program.data.data();
size_t instIndex = 0;
usz instIndex = 0;
bool end = false;
for (unsigned i = 0; i < program.data.size() / 4; i++)
{
@ -248,9 +248,9 @@ vertex_program_utils::vertex_program_metadata vertex_program_utils::analyse_vert
return result;
}
size_t vertex_program_storage_hash::operator()(const RSXVertexProgram &program) const
usz vertex_program_storage_hash::operator()(const RSXVertexProgram &program) const
{
size_t hash = vertex_program_utils::get_vertex_program_ucode_hash(program);
usz hash = vertex_program_utils::get_vertex_program_ucode_hash(program);
hash ^= program.output_mask;
hash ^= program.texture_dimensions;
return hash;
@ -271,7 +271,7 @@ bool vertex_program_compare::operator()(const RSXVertexProgram &binary1, const R
const void* instBuffer1 = binary1.data.data();
const void* instBuffer2 = binary2.data.data();
size_t instIndex = 0;
usz instIndex = 0;
for (unsigned i = 0; i < binary1.data.size() / 4; i++)
{
const auto active = binary1.instruction_mask[instIndex];
@ -302,10 +302,10 @@ bool fragment_program_utils::is_constant(u32 sourceOperand)
return ((sourceOperand >> 8) & 0x3) == 2;
}
size_t fragment_program_utils::get_fragment_program_ucode_size(const void* ptr)
usz fragment_program_utils::get_fragment_program_ucode_size(const void* ptr)
{
const auto instBuffer = ptr;
size_t instIndex = 0;
usz instIndex = 0;
while (true)
{
const v128 inst = v128::loadu(instBuffer, instIndex);
@ -420,12 +420,12 @@ fragment_program_utils::fragment_program_metadata fragment_program_utils::analys
return result;
}
size_t fragment_program_utils::get_fragment_program_ucode_hash(const RSXFragmentProgram& program)
usz fragment_program_utils::get_fragment_program_ucode_hash(const RSXFragmentProgram& program)
{
// 64-bit Fowler/Noll/Vo FNV-1a hash code
size_t hash = 0xCBF29CE484222325ULL;
usz hash = 0xCBF29CE484222325ULL;
const void* instbuffer = program.get_data();
size_t instIndex = 0;
usz instIndex = 0;
while (true)
{
const auto inst = v128::loadu(instbuffer, instIndex);
@ -447,9 +447,9 @@ size_t fragment_program_utils::get_fragment_program_ucode_hash(const RSXFragment
return 0;
}
size_t fragment_program_storage_hash::operator()(const RSXFragmentProgram& program) const
usz fragment_program_storage_hash::operator()(const RSXFragmentProgram& program) const
{
size_t hash = fragment_program_utils::get_fragment_program_ucode_hash(program);
usz hash = fragment_program_utils::get_fragment_program_ucode_hash(program);
hash ^= program.ctrl;
hash ^= program.texture_dimensions;
hash ^= program.unnormalized_coords;
@ -469,7 +469,7 @@ bool fragment_program_compare::operator()(const RSXFragmentProgram& binary1, con
const void* instBuffer1 = binary1.get_data();
const void* instBuffer2 = binary2.get_data();
size_t instIndex = 0;
usz instIndex = 0;
while (true)
{
const auto inst1 = v128::loadu(instBuffer1, instIndex);

View file

@ -27,14 +27,14 @@ namespace program_hash_util
u32 referenced_textures_mask;
};
static size_t get_vertex_program_ucode_hash(const RSXVertexProgram &program);
static usz get_vertex_program_ucode_hash(const RSXVertexProgram &program);
static vertex_program_metadata analyse_vertex_program(const u32* data, u32 entry, RSXVertexProgram& dst_prog);
};
struct vertex_program_storage_hash
{
size_t operator()(const RSXVertexProgram &program) const;
usz operator()(const RSXVertexProgram &program) const;
};
struct vertex_program_compare
@ -61,16 +61,16 @@ namespace program_hash_util
*/
static bool is_constant(u32 sourceOperand);
static size_t get_fragment_program_ucode_size(const void* ptr);
static usz get_fragment_program_ucode_size(const void* ptr);
static fragment_program_metadata analyse_fragment_program(const void* ptr);
static size_t get_fragment_program_ucode_hash(const RSXFragmentProgram &program);
static usz get_fragment_program_ucode_hash(const RSXFragmentProgram &program);
};
struct fragment_program_storage_hash
{
size_t operator()(const RSXFragmentProgram &program) const;
usz operator()(const RSXFragmentProgram &program) const;
};
struct fragment_program_compare
@ -90,8 +90,8 @@ namespace program_hash_util
* - a typedef PipelineProperties to a type that encapsulate various state info relevant to program compilation (alpha test, primitive type,...)
* - a typedef ExtraData type that will be passed to the buildProgram function.
* It should also contains the following function member :
* - static void recompile_fragment_program(RSXFragmentProgram *RSXFP, FragmentProgramData& fragmentProgramData, size_t ID);
* - static void recompile_vertex_program(RSXVertexProgram *RSXVP, VertexProgramData& vertexProgramData, size_t ID);
* - static void recompile_fragment_program(RSXFragmentProgram *RSXFP, FragmentProgramData& fragmentProgramData, usz ID);
* - static void recompile_vertex_program(RSXVertexProgram *RSXVP, VertexProgramData& vertexProgramData, usz ID);
* - static PipelineData build_program(VertexProgramData &vertexProgramData, FragmentProgramData &fragmentProgramData, const PipelineProperties &pipelineProperties, const ExtraData& extraData);
* - static void validate_pipeline_properties(const VertexProgramData &vertexProgramData, const FragmentProgramData &fragmentProgramData, PipelineProperties& props);
*/
@ -116,9 +116,9 @@ class program_state_cache
struct pipeline_key_hash
{
size_t operator()(const pipeline_key &key) const
usz operator()(const pipeline_key &key) const
{
size_t hashValue = 0;
usz hashValue = 0;
hashValue ^= rpcs3::hash_base<unsigned>(key.vertex_program_id);
hashValue ^= rpcs3::hash_base<unsigned>(key.fragment_program_id);
hashValue ^= rpcs3::hash_struct<pipeline_properties>(key.properties);
@ -142,7 +142,7 @@ protected:
shared_mutex m_pipeline_mutex;
shared_mutex m_decompiler_mutex;
atomic_t<size_t> m_next_id = 0;
atomic_t<usz> m_next_id = 0;
bool m_cache_miss_flag; // Set if last lookup did not find any usable cached programs
binary_to_vertex_program m_vertex_shader_cache;
@ -407,7 +407,7 @@ public:
f32* dst = dst_buffer.data();
alignas(16) f32 tmp[4];
for (size_t offset_in_fragment_program : I->second.FragmentConstantOffsetCache)
for (usz offset_in_fragment_program : I->second.FragmentConstantOffsetCache)
{
char* data = static_cast<char*>(fragment_program.get_data()) + offset_in_fragment_program;
const __m128i vector = _mm_loadu_si128(reinterpret_cast<__m128i*>(data));

View file

@ -218,7 +218,7 @@ public:
}
}
size_t get_vector_size() const
usz get_vector_size() const
{
return swizzles[swizzles.size() - 1].length();
}

View file

@ -176,7 +176,7 @@ private:
const auto glyph_data = font_glyph.substr(7);
if (glyph_data.length() == 32)
{
for (std::size_t n = 0; n < this_glyph.plot.size(); ++n)
for (usz n = 0; n < this_glyph.plot.size(); ++n)
{
const auto line = glyph_data.substr(n * 2, 2);
std::from_chars(line.data(), line.data() + line.size(), this_glyph.plot[n], 16);
@ -215,7 +215,7 @@ public:
{
entry.glyph_point_offset = ::size32(result);
for (std::size_t j = 0; j < entry.plot.size(); ++j)
for (usz j = 0; j < entry.plot.size(); ++j)
{
const auto &line = entry.plot[j];
if (line == 0)

View file

@ -317,7 +317,7 @@ namespace
u8 block_size_in_bytes = sizeof(SRC_TYPE);
std::vector<rsx::subresource_layout> result;
size_t offset_in_src = 0;
usz offset_in_src = 0;
u8 border_size = border ? (padded_row ? 1 : 4) : 0;
u32 src_pitch_in_block;
@ -383,30 +383,30 @@ namespace
}
template<typename T>
u32 get_row_pitch_in_block(u16 width_in_block, size_t alignment)
u32 get_row_pitch_in_block(u16 width_in_block, usz alignment)
{
if (const size_t pitch = width_in_block * sizeof(T);
if (const usz pitch = width_in_block * sizeof(T);
pitch == alignment)
{
return width_in_block;
}
else
{
size_t divided = (pitch + alignment - 1) / alignment;
usz divided = (pitch + alignment - 1) / alignment;
return static_cast<u32>(divided * alignment / sizeof(T));
}
}
u32 get_row_pitch_in_block(u16 block_size_in_bytes, u16 width_in_block, size_t alignment)
u32 get_row_pitch_in_block(u16 block_size_in_bytes, u16 width_in_block, usz alignment)
{
if (const size_t pitch = width_in_block * block_size_in_bytes;
if (const usz pitch = width_in_block * block_size_in_bytes;
pitch == alignment)
{
return width_in_block;
}
else
{
size_t divided = (pitch + alignment - 1) / alignment;
usz divided = (pitch + alignment - 1) / alignment;
return static_cast<u32>(divided * alignment / block_size_in_bytes);
}
}
@ -910,41 +910,41 @@ namespace rsx
return width_in_block * bytes_per_block;
}
size_t get_placed_texture_storage_size(u16 width, u16 height, u32 depth, u8 format, u16 mipmap, bool cubemap, size_t row_pitch_alignment, size_t mipmap_alignment)
usz get_placed_texture_storage_size(u16 width, u16 height, u32 depth, u8 format, u16 mipmap, bool cubemap, usz row_pitch_alignment, usz mipmap_alignment)
{
format &= ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN);
size_t block_edge = get_format_block_size_in_texel(format);
size_t block_size_in_byte = get_format_block_size_in_bytes(format);
usz block_edge = get_format_block_size_in_texel(format);
usz block_size_in_byte = get_format_block_size_in_bytes(format);
size_t height_in_blocks = (height + block_edge - 1) / block_edge;
size_t width_in_blocks = (width + block_edge - 1) / block_edge;
usz height_in_blocks = (height + block_edge - 1) / block_edge;
usz width_in_blocks = (width + block_edge - 1) / block_edge;
size_t result = 0;
usz result = 0;
for (u16 i = 0; i < mipmap; ++i)
{
size_t rowPitch = align(block_size_in_byte * width_in_blocks, row_pitch_alignment);
usz rowPitch = align(block_size_in_byte * width_in_blocks, row_pitch_alignment);
result += align(rowPitch * height_in_blocks * depth, mipmap_alignment);
height_in_blocks = std::max<size_t>(height_in_blocks / 2, 1);
width_in_blocks = std::max<size_t>(width_in_blocks / 2, 1);
height_in_blocks = std::max<usz>(height_in_blocks / 2, 1);
width_in_blocks = std::max<usz>(width_in_blocks / 2, 1);
}
// Mipmap, height and width aren't allowed to be zero
return (ensure(result) * (cubemap ? 6 : 1));
}
size_t get_placed_texture_storage_size(const rsx::fragment_texture& texture, size_t row_pitch_alignment, size_t mipmap_alignment)
usz get_placed_texture_storage_size(const rsx::fragment_texture& texture, usz row_pitch_alignment, usz mipmap_alignment)
{
return get_placed_texture_storage_size(texture.width(), texture.height(), texture.depth(), texture.format(), texture.mipmap(), texture.cubemap(),
row_pitch_alignment, mipmap_alignment);
}
size_t get_placed_texture_storage_size(const rsx::vertex_texture& texture, size_t row_pitch_alignment, size_t mipmap_alignment)
usz get_placed_texture_storage_size(const rsx::vertex_texture& texture, usz row_pitch_alignment, usz mipmap_alignment)
{
return get_placed_texture_storage_size(texture.width(), texture.height(), texture.depth(), texture.format(), texture.mipmap(), texture.cubemap(),
row_pitch_alignment, mipmap_alignment);
}
static size_t get_texture_size(u32 format, u16 width, u16 height, u16 depth, u32 pitch, u16 mipmaps, u16 layers, u8 border)
static usz get_texture_size(u32 format, u16 width, u16 height, u16 depth, u32 pitch, u16 mipmaps, u16 layers, u8 border)
{
const auto gcm_format = format & ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN);
const bool packed = !(format & CELL_GCM_TEXTURE_LN);
@ -1001,14 +1001,14 @@ namespace rsx
return size;
}
size_t get_texture_size(const rsx::fragment_texture& texture)
usz get_texture_size(const rsx::fragment_texture& texture)
{
return get_texture_size(texture.format(), texture.width(), texture.height(), texture.depth(),
texture.pitch(), texture.get_exact_mipmap_count(), texture.cubemap() ? 6 : 1,
texture.border_type() ^ 1);
}
size_t get_texture_size(const rsx::vertex_texture& texture)
usz get_texture_size(const rsx::vertex_texture& texture)
{
return get_texture_size(texture.format(), texture.width(), texture.height(), texture.depth(),
texture.pitch(), texture.get_exact_mipmap_count(), texture.cubemap() ? 6 : 1,

View file

@ -125,16 +125,16 @@ namespace rsx
bool supports_byteswap;
bool supports_vtc_decoding;
bool supports_hw_deswizzle;
size_t alignment;
usz alignment;
};
/**
* Get size to store texture in a linear fashion.
* Storage is assumed to use a rowPitchAlignment boundary for every row of texture.
*/
size_t get_placed_texture_storage_size(u16 width, u16 height, u32 depth, u8 format, u16 mipmap, bool cubemap, size_t row_pitch_alignment, size_t mipmap_alignment);
size_t get_placed_texture_storage_size(const rsx::fragment_texture &texture, size_t row_pitch_alignment, size_t mipmap_alignment = 0x200);
size_t get_placed_texture_storage_size(const rsx::vertex_texture &texture, size_t row_pitch_alignment, size_t mipmap_alignment = 0x200);
usz get_placed_texture_storage_size(u16 width, u16 height, u32 depth, u8 format, u16 mipmap, bool cubemap, usz row_pitch_alignment, usz mipmap_alignment);
usz get_placed_texture_storage_size(const rsx::fragment_texture &texture, usz row_pitch_alignment, usz mipmap_alignment = 0x200);
usz get_placed_texture_storage_size(const rsx::vertex_texture &texture, usz row_pitch_alignment, usz mipmap_alignment = 0x200);
/**
* get all rsx::subresource_layout for texture.
@ -162,8 +162,8 @@ namespace rsx
/**
* Get number of bytes occupied by texture in RSX mem
*/
size_t get_texture_size(const rsx::fragment_texture &texture);
size_t get_texture_size(const rsx::vertex_texture &texture);
usz get_texture_size(const rsx::fragment_texture &texture);
usz get_texture_size(const rsx::vertex_texture &texture);
/**
* Get packed pitch

View file

@ -9,7 +9,7 @@
/**
* This class is used to translate RSX Vertex program to GLSL/HLSL code
* Backend with text based shader can subclass this class and implement :
* - virtual std::string getFloatTypeName(size_t elementCount) = 0;
* - virtual std::string getFloatTypeName(usz elementCount) = 0;
* - virtual std::string getFunction(enum class FUNCTION) = 0;
* - virtual std::string compareFunction(enum class COMPARE, const std::string &, const std::string &) = 0;
* - virtual void insertHeader(std::stringstream &OS) = 0;
@ -55,10 +55,10 @@ struct VertexProgramDecompiler
}
};
static const size_t m_max_instr_count = 512;
static const usz m_max_instr_count = 512;
Instruction m_instructions[m_max_instr_count];
Instruction* m_cur_instr;
size_t m_instr_count;
usz m_instr_count;
std::vector<std::string> m_body;
std::stack<u32> m_call_stack;
@ -91,11 +91,11 @@ struct VertexProgramDecompiler
protected:
/** returns the type name of float vectors.
*/
virtual std::string getFloatTypeName(size_t elementCount) = 0;
virtual std::string getFloatTypeName(usz elementCount) = 0;
/** returns the type name of int vectors.
*/
virtual std::string getIntTypeName(size_t elementCount) = 0;
virtual std::string getIntTypeName(usz elementCount) = 0;
/** returns string calling function where arguments are passed via
* $0 $1 $2 substring.

View file

@ -17,10 +17,10 @@ protected:
* Does alloc cross get position ?
*/
template<int Alignment>
bool can_alloc(size_t size) const
bool can_alloc(usz size) const
{
size_t alloc_size = align(size, Alignment);
size_t aligned_put_pos = align(m_put_pos, Alignment);
usz alloc_size = align(size, Alignment);
usz aligned_put_pos = align(m_put_pos, Alignment);
if (aligned_put_pos + alloc_size < m_size)
{
// range before get
@ -45,17 +45,17 @@ protected:
}
// Grow the buffer to hold at least size bytes
virtual bool grow(size_t /*size*/)
virtual bool grow(usz /*size*/)
{
// Stub
return false;
}
size_t m_size;
size_t m_put_pos; // Start of free space
size_t m_min_guard_size; //If an allocation touches the guard region, reset the heap to avoid going over budget
size_t m_current_allocated_size;
size_t m_largest_allocated_pool;
usz m_size;
usz m_put_pos; // Start of free space
usz m_min_guard_size; //If an allocation touches the guard region, reset the heap to avoid going over budget
usz m_current_allocated_size;
usz m_largest_allocated_pool;
char* m_name;
public:
@ -64,9 +64,9 @@ public:
data_heap(const data_heap&) = delete;
data_heap(data_heap&&) = delete;
size_t m_get_pos; // End of free space
usz m_get_pos; // End of free space
void init(size_t heap_size, const char* buffer_name = "unnamed", size_t min_guard_size=0x10000)
void init(usz heap_size, const char* buffer_name = "unnamed", usz min_guard_size=0x10000)
{
m_name = const_cast<char*>(buffer_name);
@ -81,10 +81,10 @@ public:
}
template<int Alignment>
size_t alloc(size_t size)
usz alloc(usz size)
{
const size_t alloc_size = align(size, Alignment);
const size_t aligned_put_pos = align(m_put_pos, Alignment);
const usz alloc_size = align(size, Alignment);
const usz aligned_put_pos = align(m_put_pos, Alignment);
if (!can_alloc<Alignment>(size) && !grow(aligned_put_pos + alloc_size))
{
@ -92,7 +92,7 @@ public:
m_name, m_size, m_current_allocated_size, size, m_min_guard_size, m_largest_allocated_pool);
}
const size_t block_length = (aligned_put_pos - m_put_pos) + alloc_size;
const usz block_length = (aligned_put_pos - m_put_pos) + alloc_size;
m_current_allocated_size += block_length;
m_largest_allocated_pool = std::max(m_largest_allocated_pool, block_length);
@ -111,14 +111,14 @@ public:
/**
* return current putpos - 1
*/
size_t get_current_put_pos_minus_one() const
usz get_current_put_pos_minus_one() const
{
return (m_put_pos > 0) ? m_put_pos - 1 : m_size - 1;
}
virtual bool is_critical() const
{
const size_t guard_length = std::max(m_min_guard_size, m_largest_allocated_pool);
const usz guard_length = std::max(m_min_guard_size, m_largest_allocated_pool);
return (m_current_allocated_size + guard_length) >= m_size;
}
@ -142,7 +142,7 @@ public:
fmt::throw_exception("m_put_pos == m_get_pos!");
}
size_t size() const
usz size() const
{
return m_size;
}

View file

@ -19,7 +19,7 @@ namespace rsx
fmt::throw_exception("Wrong color_target");
}
size_t get_aligned_pitch(surface_color_format format, u32 width)
usz get_aligned_pitch(surface_color_format format, u32 width)
{
switch (format)
{
@ -41,7 +41,7 @@ namespace rsx
fmt::throw_exception("Unknown color surface format");
}
size_t get_packed_pitch(surface_color_format format, u32 width)
usz get_packed_pitch(surface_color_format format, u32 width)
{
switch (format)
{

View file

@ -10,8 +10,8 @@ namespace rsx
namespace utility
{
std::vector<u8> get_rtt_indexes(surface_target color_target);
size_t get_aligned_pitch(surface_color_format format, u32 width);
size_t get_packed_pitch(surface_color_format format, u32 width);
usz get_aligned_pitch(surface_color_format format, u32 width);
usz get_packed_pitch(surface_color_format format, u32 width);
}
template<typename Traits>
@ -426,7 +426,7 @@ namespace rsx
u32 address,
format_type format,
surface_antialiasing antialias,
size_t width, size_t height, size_t pitch,
usz width, usz height, usz pitch,
u8 bpp,
Args&&... extra_params)
{
@ -638,7 +638,7 @@ namespace rsx
u32 address,
surface_color_format color_format,
surface_antialiasing antialias,
size_t width, size_t height, size_t pitch,
usz width, usz height, usz pitch,
Args&&... extra_params)
{
return bind_surface_address<false>(
@ -653,7 +653,7 @@ namespace rsx
u32 address,
surface_depth_format2 depth_format,
surface_antialiasing antialias,
size_t width, size_t height, size_t pitch,
usz width, usz height, usz pitch,
Args&&... extra_params)
{
return bind_surface_address<true>(

View file

@ -426,7 +426,7 @@ namespace rsx
});
// Try and optimize by omitting possible overlapped transfers
for (size_t i = old_contents.size() - 1; i > 0 /* Intentional */; i--)
for (usz i = old_contents.size() - 1; i > 0 /* Intentional */; i--)
{
old_contents[i].init_transfer(target);

View file

@ -82,8 +82,8 @@ namespace rsx
#ifdef TEXTURE_CACHE_DEBUG
void check_pre_sanity() const
{
size_t flush_and_unprotect_count = sections_to_flush.size() + sections_to_unprotect.size();
size_t exclude_count = sections_to_exclude.size();
usz flush_and_unprotect_count = sections_to_flush.size() + sections_to_unprotect.size();
usz exclude_count = sections_to_exclude.size();
//-------------------------
// It is illegal to have only exclusions except when reading from a range with only RO sections
@ -381,7 +381,7 @@ namespace rsx
m_cache_update_tag = rsx::get_shared_tag();
}
template <typename CharT, std::size_t N, typename... Args>
template <typename CharT, usz N, typename... Args>
void emit_once(bool error, const CharT(&fmt)[N], const Args&... params)
{
const auto result = m_once_only_messages_set.emplace(fmt::format(fmt, params...));
@ -394,13 +394,13 @@ namespace rsx
rsx_log.warning("%s", *result.first);
}
template <typename CharT, std::size_t N, typename... Args>
template <typename CharT, usz N, typename... Args>
void err_once(const CharT(&fmt)[N], const Args&... params)
{
emit_once(true, fmt, params...);
}
template <typename CharT, std::size_t N, typename... Args>
template <typename CharT, usz N, typename... Args>
void warn_once(const CharT(&fmt)[N], const Args&... params)
{
emit_once(false, fmt, params...);
@ -737,7 +737,7 @@ namespace rsx
// naive check that sections are not duplicated in the results
for (auto &section1 : result.sections)
{
size_t count = 0;
usz count = 0;
for (auto &section2 : result.sections)
{
if (section1 == section2) count++;

View file

@ -69,17 +69,17 @@ namespace rsx {
// 4GB memory space / 4096 bytes per page = 1048576 pages
// Initialized to utils::protection::rw
static constexpr size_t num_pages = 0x1'0000'0000 / 4096;
static constexpr usz num_pages = 0x1'0000'0000 / 4096;
per_page_info_t _info[num_pages]{0};
static_assert(static_cast<u32>(utils::protection::rw) == 0, "utils::protection::rw must have value 0 for the above constructor to work");
static constexpr size_t rsx_address_to_index(u32 address)
static constexpr usz rsx_address_to_index(u32 address)
{
return (address / 4096);
}
static constexpr u32 index_to_rsx_address(size_t idx)
static constexpr u32 index_to_rsx_address(usz idx)
{
return static_cast<u32>(idx * 4096);
}
@ -96,7 +96,7 @@ namespace rsx {
constexpr u32 info_pointer_to_address(const per_page_info_t* ptr) const
{
return index_to_rsx_address(static_cast<size_t>(ptr - _info));
return index_to_rsx_address(static_cast<usz>(ptr - _info));
}
std::string prot_to_str(utils::protection prot) const
@ -199,7 +199,7 @@ namespace rsx {
void verify() const
{
for (size_t idx = 0; idx < num_pages; idx++)
for (usz idx = 0; idx < num_pages; idx++)
{
auto &elmnt = _info[idx];
if (!elmnt.verify())

View file

@ -28,7 +28,7 @@ namespace rsx
m_size = 0;
}
size_t size() const
usz size() const
{
return m_size;
}
@ -404,11 +404,11 @@ namespace std
template <typename traits>
struct hash<rsx::texture_cache_predictor_key<traits>>
{
std::size_t operator()(const rsx::texture_cache_predictor_key<traits>& k) const
usz operator()(const rsx::texture_cache_predictor_key<traits>& k) const
{
size_t result = std::hash<utils::address_range>{}(k.cpu_range);
result ^= static_cast<size_t>(k.format);
result ^= (static_cast<size_t>(k.context) << 16);
usz result = std::hash<utils::address_range>{}(k.cpu_range);
result ^= static_cast<usz>(k.format);
result ^= (static_cast<usz>(k.context) << 16);
return result;
}
};

View file

@ -15,7 +15,7 @@ namespace rsx
* List of Arrays
* (avoids reallocation without the significant disadvantages of slow iteration through a list)
*/
template <typename section_storage_type, size_t array_size>
template <typename section_storage_type, usz array_size>
class ranged_storage_block_list
{
static_assert(array_size > 0, "array_elements must be positive non-zero");
@ -497,7 +497,7 @@ namespace rsx
return block_for(section.get_section_base());
}
inline block_type& operator[](size_t pos)
inline block_type& operator[](usz pos)
{
AUDIT(pos < num_blocks);
return blocks[pos];
@ -917,7 +917,7 @@ namespace rsx
address_range_vector flush_exclusions; // Address ranges that will be skipped during flush
predictor_type *m_predictor = nullptr;
size_t m_predictor_key_hash = 0;
usz m_predictor_key_hash = 0;
predictor_entry_type *m_predictor_entry = nullptr;
public:

View file

@ -7,12 +7,12 @@
#include "../GCM.h"
#include "../Common/GLSLCommon.h"
std::string GLFragmentDecompilerThread::getFloatTypeName(size_t elementCount)
std::string GLFragmentDecompilerThread::getFloatTypeName(usz elementCount)
{
return glsl::getFloatTypeNameImpl(elementCount);
}
std::string GLFragmentDecompilerThread::getHalfTypeName(size_t elementCount)
std::string GLFragmentDecompilerThread::getHalfTypeName(usz elementCount)
{
return glsl::getHalfTypeNameImpl(elementCount);
}
@ -369,7 +369,7 @@ void GLFragmentProgram::Decompile(const RSXFragmentProgram& prog)
PT.type == "samplerCube")
continue;
size_t offset = atoi(PI.name.c_str() + 2);
usz offset = atoi(PI.name.c_str() + 2);
FragmentConstantOffsetCache.push_back(offset);
}
}

View file

@ -33,8 +33,8 @@ public:
void Task();
protected:
std::string getFloatTypeName(size_t elementCount) override;
std::string getHalfTypeName(size_t elementCount) override;
std::string getFloatTypeName(usz elementCount) override;
std::string getHalfTypeName(usz elementCount) override;
std::string getFunction(FUNCTION) override;
std::string compareFunction(COMPARE, const std::string&, const std::string&) override;
@ -59,7 +59,7 @@ public:
ParamArray parr;
u32 id;
gl::glsl::shader shader;
std::vector<size_t> FragmentConstantOffsetCache;
std::vector<usz> FragmentConstantOffsetCache;
/**
* Decompile a fragment shader located in the PS3's Memory. This function operates synchronously.

View file

@ -298,13 +298,13 @@ namespace gl
glDrawElements(draw_mode(mode), count, static_cast<GLenum>(type), indices);
}
void fbo::draw_elements(rsx::primitive_type mode, GLsizei count, indices_type type, const buffer& indices, size_t indices_buffer_offset) const
void fbo::draw_elements(rsx::primitive_type mode, GLsizei count, indices_type type, const buffer& indices, usz indices_buffer_offset) const
{
indices.bind(buffer::target::element_array);
glDrawElements(draw_mode(mode), count, static_cast<GLenum>(type), reinterpret_cast<GLvoid*>(indices_buffer_offset));
}
void fbo::draw_elements(const buffer& buffer_, rsx::primitive_type mode, GLsizei count, indices_type type, const buffer& indices, size_t indices_buffer_offset) const
void fbo::draw_elements(const buffer& buffer_, rsx::primitive_type mode, GLsizei count, indices_type type, const buffer& indices, usz indices_buffer_offset) const
{
buffer_.bind(buffer::target::array);
draw_elements(mode, count, type, indices, indices_buffer_offset);

View file

@ -2179,8 +2179,8 @@ public:
void draw_elements(rsx::primitive_type mode, GLsizei count, indices_type type, const GLvoid *indices) const;
void draw_elements(const buffer& buffer, rsx::primitive_type mode, GLsizei count, indices_type type, const GLvoid *indices) const;
void draw_elements(rsx::primitive_type mode, GLsizei count, indices_type type, const buffer& indices, size_t indices_buffer_offset = 0) const;
void draw_elements(const buffer& buffer_, rsx::primitive_type mode, GLsizei count, indices_type type, const buffer& indices, size_t indices_buffer_offset = 0) const;
void draw_elements(rsx::primitive_type mode, GLsizei count, indices_type type, const buffer& indices, usz indices_buffer_offset = 0) const;
void draw_elements(const buffer& buffer_, rsx::primitive_type mode, GLsizei count, indices_type type, const buffer& indices, usz indices_buffer_offset = 0) const;
void draw_elements(rsx::primitive_type mode, GLsizei count, const GLubyte *indices) const;
void draw_elements(const buffer& buffer, rsx::primitive_type mode, GLsizei count, const GLubyte *indices) const;
void draw_elements(rsx::primitive_type mode, GLsizei count, const GLushort *indices) const;

View file

@ -15,13 +15,13 @@ struct GLTraits
using pipeline_properties = void*;
static
void recompile_fragment_program(const RSXFragmentProgram &RSXFP, fragment_program_type& fragmentProgramData, size_t /*ID*/)
void recompile_fragment_program(const RSXFragmentProgram &RSXFP, fragment_program_type& fragmentProgramData, usz /*ID*/)
{
fragmentProgramData.Decompile(RSXFP);
}
static
void recompile_vertex_program(const RSXVertexProgram &RSXVP, vertex_program_type& vertexProgramData, size_t /*ID*/)
void recompile_vertex_program(const RSXVertexProgram &RSXVP, vertex_program_type& vertexProgramData, usz /*ID*/)
{
vertexProgramData.Decompile(RSXVP);
}

View file

@ -140,7 +140,7 @@ struct gl_render_target_traits
std::unique_ptr<gl::render_target> create_new_surface(
u32 address,
rsx::surface_color_format surface_color_format,
size_t width, size_t height, size_t pitch,
usz width, usz height, usz pitch,
rsx::surface_antialiasing antialias
)
{
@ -169,7 +169,7 @@ struct gl_render_target_traits
std::unique_ptr<gl::render_target> create_new_surface(
u32 address,
rsx::surface_depth_format2 surface_depth_format,
size_t width, size_t height, size_t pitch,
usz width, usz height, usz pitch,
rsx::surface_antialiasing antialias
)
{
@ -262,13 +262,13 @@ struct gl_render_target_traits
{}
static
bool surface_is_pitch_compatible(const std::unique_ptr<gl::render_target> &surface, size_t pitch)
bool surface_is_pitch_compatible(const std::unique_ptr<gl::render_target> &surface, usz pitch)
{
return surface->get_rsx_pitch() == pitch;
}
static
void invalidate_surface_contents(gl::command_context&, gl::render_target *surface, u32 address, size_t pitch)
void invalidate_surface_contents(gl::command_context&, gl::render_target *surface, u32 address, usz pitch)
{
surface->set_rsx_pitch(static_cast<u16>(pitch));
surface->queue_tag(address);
@ -305,7 +305,7 @@ struct gl_render_target_traits
bool int_surface_matches_properties(
const std::unique_ptr<gl::render_target> &surface,
gl::texture::internal_format format,
size_t width, size_t height,
usz width, usz height,
rsx::surface_antialiasing antialias,
bool check_refs = false)
{
@ -321,7 +321,7 @@ struct gl_render_target_traits
bool surface_matches_properties(
const std::unique_ptr<gl::render_target> &surface,
rsx::surface_color_format format,
size_t width, size_t height,
usz width, usz height,
rsx::surface_antialiasing antialias,
bool check_refs=false)
{
@ -333,7 +333,7 @@ struct gl_render_target_traits
bool surface_matches_properties(
const std::unique_ptr<gl::render_target> &surface,
rsx::surface_depth_format2 format,
size_t width, size_t height,
usz width, usz height,
rsx::surface_antialiasing antialias,
bool check_refs = false)
{

View file

@ -64,7 +64,7 @@ namespace gl
m_program.link();
}
void load_program(float scale_x, float scale_y, float *offsets, size_t nb_offsets, color4f color)
void load_program(float scale_x, float scale_y, float *offsets, usz nb_offsets, color4f color)
{
float scale[] = { scale_x, scale_y };
@ -88,7 +88,7 @@ namespace gl
GlyphManager glyph_source;
auto points = glyph_source.generate_point_map();
const size_t buffer_size = points.size() * sizeof(GlyphManager::glyph_point);
const usz buffer_size = points.size() * sizeof(GlyphManager::glyph_point);
m_text_buffer.data(buffer_size, points.data());
m_offsets = glyph_source.get_glyph_offsets();

View file

@ -836,7 +836,7 @@ namespace gl
{
// Calculate staging buffer size
const u32 aligned_pitch = align<u32>(dst->pitch(), 4);
size_t texture_data_sz = dst->depth() * dst->height() * aligned_pitch;
usz texture_data_sz = dst->depth() * dst->height() * aligned_pitch;
std::vector<std::byte> data_upload_buf(texture_data_sz);
// TODO: GL drivers support byteswapping and this should be used instead of doing so manually

View file

@ -226,7 +226,7 @@ gl::vertex_upload_info GLGSRender::set_vertex_buffer()
if (!m_persistent_stream_view.in_range(upload_info.persistent_mapping_offset, required.first, upload_info.persistent_mapping_offset))
{
ensure(m_max_texbuffer_size < m_attrib_ring_buffer->size());
const size_t view_size = ((upload_info.persistent_mapping_offset + m_max_texbuffer_size) > m_attrib_ring_buffer->size()) ?
const usz view_size = ((upload_info.persistent_mapping_offset + m_max_texbuffer_size) > m_attrib_ring_buffer->size()) ?
(m_attrib_ring_buffer->size() - upload_info.persistent_mapping_offset) : m_max_texbuffer_size;
m_persistent_stream_view.update(m_attrib_ring_buffer.get(), upload_info.persistent_mapping_offset, static_cast<u32>(view_size));
@ -243,7 +243,7 @@ gl::vertex_upload_info GLGSRender::set_vertex_buffer()
if (!m_volatile_stream_view.in_range(upload_info.volatile_mapping_offset, required.second, upload_info.volatile_mapping_offset))
{
ensure(m_max_texbuffer_size < m_attrib_ring_buffer->size());
const size_t view_size = ((upload_info.volatile_mapping_offset + m_max_texbuffer_size) > m_attrib_ring_buffer->size()) ?
const usz view_size = ((upload_info.volatile_mapping_offset + m_max_texbuffer_size) > m_attrib_ring_buffer->size()) ?
(m_attrib_ring_buffer->size() - upload_info.volatile_mapping_offset) : m_max_texbuffer_size;
m_volatile_stream_view.update(m_attrib_ring_buffer.get(), upload_info.volatile_mapping_offset, static_cast<u32>(view_size));

View file

@ -8,12 +8,12 @@
#include <algorithm>
std::string GLVertexDecompilerThread::getFloatTypeName(size_t elementCount)
std::string GLVertexDecompilerThread::getFloatTypeName(usz elementCount)
{
return glsl::getFloatTypeNameImpl(elementCount);
}
std::string GLVertexDecompilerThread::getIntTypeName(size_t elementCount)
std::string GLVertexDecompilerThread::getIntTypeName(usz elementCount)
{
return "ivec4";
}

View file

@ -23,8 +23,8 @@ struct GLVertexDecompilerThread : public VertexProgramDecompiler
std::string &m_shader;
protected:
std::string getFloatTypeName(size_t elementCount) override;
std::string getIntTypeName(size_t elementCount) override;
std::string getFloatTypeName(usz elementCount) override;
std::string getIntTypeName(usz elementCount) override;
std::string getFunction(FUNCTION) override;
std::string compareFunction(COMPARE, const std::string&, const std::string&, bool scalar) override;

View file

@ -150,7 +150,7 @@ namespace rsx
uint32_t bufsize = PATH_MAX;
bool success = _NSGetExecutablePath( result, &bufsize ) == 0;
#elif defined(KERN_PROC_PATHNAME)
size_t bufsize = PATH_MAX;
usz bufsize = PATH_MAX;
int mib[] = {
CTL_KERN,
#if defined(__NetBSD__)
@ -272,7 +272,7 @@ namespace rsx
draw_commands.resize(old_size + other.draw_commands.size());
std::copy(other.draw_commands.begin(), other.draw_commands.end(), draw_commands.begin() + old_size);
for (size_t n = old_size; n < draw_commands.size(); ++n)
for (usz n = old_size; n < draw_commands.size(); ++n)
{
for (auto &v : draw_commands[n].verts)
{
@ -287,7 +287,7 @@ namespace rsx
draw_commands.resize(old_size + other.draw_commands.size());
std::copy(other.draw_commands.begin(), other.draw_commands.end(), draw_commands.begin() + old_size);
for (size_t n = old_size; n < draw_commands.size(); ++n)
for (usz n = old_size; n < draw_commands.size(); ++n)
{
for (auto &v : draw_commands[n].verts)
{

View file

@ -5,13 +5,13 @@ namespace rsx
{
namespace overlays
{
static size_t get_line_start(const std::u32string& text, size_t pos)
static usz get_line_start(const std::u32string& text, usz pos)
{
if (pos == 0)
{
return 0;
}
const size_t line_start = text.rfind('\n', pos - 1);
const usz line_start = text.rfind('\n', pos - 1);
if (line_start == std::string::npos)
{
return 0;
@ -19,9 +19,9 @@ namespace rsx
return line_start + 1;
}
static size_t get_line_end(const std::u32string& text, size_t pos)
static usz get_line_end(const std::u32string& text, usz pos)
{
const size_t line_end = text.find('\n', pos);
const usz line_end = text.find('\n', pos);
if (line_end == std::string::npos)
{
return text.length();
@ -53,7 +53,7 @@ namespace rsx
}
case direction::up:
{
const size_t current_line_start = get_line_start(text, caret_position);
const usz current_line_start = get_line_start(text, caret_position);
if (current_line_start == 0)
{
// This is the first line, so caret moves to the very beginning
@ -61,9 +61,9 @@ namespace rsx
refresh();
break;
}
const size_t caret_pos_in_line = caret_position - current_line_start;
const size_t prev_line_end = current_line_start - 1;
const size_t prev_line_start = get_line_start(text, prev_line_end);
const usz caret_pos_in_line = caret_position - current_line_start;
const usz prev_line_end = current_line_start - 1;
const usz prev_line_start = get_line_start(text, prev_line_end);
// TODO : Save caret position to some kind of buffer, so after switching back and forward, caret would be on initial position
caret_position = std::min(prev_line_end, prev_line_start + caret_pos_in_line);
@ -72,7 +72,7 @@ namespace rsx
}
case direction::down:
{
const size_t current_line_end = get_line_end(text, caret_position);
const usz current_line_end = get_line_end(text, caret_position);
if (current_line_end == text.length())
{
// This is the last line, so caret moves to the very end
@ -80,10 +80,10 @@ namespace rsx
refresh();
break;
}
const size_t current_line_start = get_line_start(text, caret_position);
const size_t caret_pos_in_line = caret_position - current_line_start;
const size_t next_line_start = current_line_end + 1;
const size_t next_line_end = get_line_end(text, next_line_start);
const usz current_line_start = get_line_start(text, caret_position);
const usz caret_pos_in_line = caret_position - current_line_start;
const usz next_line_start = current_line_end + 1;
const usz next_line_end = get_line_end(text, next_line_start);
// TODO : Save caret position to some kind of buffer, so after switching back and forward, caret would be on initial position
caret_position = std::min(next_line_end, next_line_start + caret_pos_in_line);

View file

@ -345,7 +345,7 @@ namespace rsx
auto first_affected = result.size() - (nb_chars * 4);
f32 base_x = result[first_affected].values[0];
for (size_t n = first_affected; n < result.size(); ++n)
for (usz n = first_affected; n < result.size(); ++n)
{
auto char_index = n / 4;
if (text[char_index] == ' ')

View file

@ -62,7 +62,7 @@ namespace rsx
return; // Ideally unreachable but it should still be possible to recover by user interaction.
}
const size_t current_index = static_cast<size_t>(m_selected_entry) * 2;
const usz current_index = static_cast<usz>(m_selected_entry) * 2;
if (m_items.size() <= current_index)
{

View file

@ -52,7 +52,7 @@ namespace rsx
void osk_dialog::step_panel(bool next_panel)
{
const size_t num_panels = m_panels.size();
const usz num_panels = m_panels.size();
if (num_panels > 0)
{
@ -123,9 +123,9 @@ namespace rsx
continue;
}
size_t cell_shift_layers = 0;
usz cell_shift_layers = 0;
for (size_t i = 0; i < _cell.outputs[layer].size(); ++i)
for (usz i = 0; i < _cell.outputs[layer].size(); ++i)
{
if (_cell.outputs[layer][i].empty() == false)
{
@ -995,7 +995,7 @@ namespace rsx
}
// Get initial panel based on first_view_panel
for (size_t i = 0; i < m_panels.size(); ++i)
for (usz i = 0; i < m_panels.size(); ++i)
{
if (first_view_panel == m_panels[i].osk_panel_mode)
{

View file

@ -73,7 +73,7 @@ namespace rsx
u32 char_limit = UINT32_MAX;
std::vector<osk_panel> m_panels;
size_t m_panel_index = 0;
usz m_panel_index = 0;
osk_dialog() = default;
~osk_dialog() override = default;

View file

@ -5,7 +5,7 @@
namespace vk
{
static constexpr size_t s_dma_block_length = 0x01000000;
static constexpr usz s_dma_block_length = 0x01000000;
static constexpr u32 s_dma_block_mask = 0xFF000000;
static constexpr u32 s_dma_offset_mask = 0x00FFFFFF;
@ -42,7 +42,7 @@ namespace vk
}
}
void dma_block::init(const render_device& dev, u32 addr, size_t size)
void dma_block::init(const render_device& dev, u32 addr, usz size)
{
ensure(size);
ensure(!(size % s_dma_block_length));
@ -55,7 +55,7 @@ namespace vk
page_info.resize(size / s_bytes_per_entry, ~0ull);
}
void dma_block::init(dma_block* parent, u32 addr, size_t size)
void dma_block::init(dma_block* parent, u32 addr, usz size)
{
base_address = addr;
inheritance_info.parent = parent;
@ -201,7 +201,7 @@ namespace vk
}
}
void dma_block::extend(command_buffer& cmd, const render_device &dev, size_t new_size)
void dma_block::extend(command_buffer& cmd, const render_device &dev, usz new_size)
{
ensure(allocated_memory);
if (new_size <= allocated_memory->size())

View file

@ -39,8 +39,8 @@ namespace vk
public:
void init(const render_device& dev, u32 addr, size_t size);
void init(dma_block* parent, u32 addr, size_t size);
void init(const render_device& dev, u32 addr, usz size);
void init(dma_block* parent, u32 addr, usz size);
void flush(const utils::address_range& range);
void load(const utils::address_range& range);
std::pair<u32, buffer*> get(const utils::address_range& range);
@ -52,6 +52,6 @@ namespace vk
dma_block* head();
const dma_block* head() const;
void set_parent(command_buffer& cmd, dma_block* parent);
void extend(command_buffer& cmd, const render_device& dev, size_t new_size);
void extend(command_buffer& cmd, const render_device& dev, usz new_size);
};
}

View file

@ -5,12 +5,12 @@
#include "../Common/GLSLCommon.h"
#include "../GCM.h"
std::string VKFragmentDecompilerThread::getFloatTypeName(size_t elementCount)
std::string VKFragmentDecompilerThread::getFloatTypeName(usz elementCount)
{
return glsl::getFloatTypeNameImpl(elementCount);
}
std::string VKFragmentDecompilerThread::getHalfTypeName(size_t elementCount)
std::string VKFragmentDecompilerThread::getHalfTypeName(usz elementCount)
{
return glsl::getHalfTypeNameImpl(elementCount);
}
@ -411,7 +411,7 @@ void VKFragmentProgram::Decompile(const RSXFragmentProgram& prog)
PT.type == "samplerCube")
continue;
size_t offset = atoi(PI.name.c_str() + 2);
usz offset = atoi(PI.name.c_str() + 2);
FragmentConstantOffsetCache.push_back(offset);
}
}

View file

@ -33,8 +33,8 @@ public:
void Task();
const std::vector<vk::glsl::program_input>& get_inputs() { return inputs; }
protected:
std::string getFloatTypeName(size_t elementCount) override;
std::string getHalfTypeName(size_t elementCount) override;
std::string getFloatTypeName(usz elementCount) override;
std::string getHalfTypeName(usz elementCount) override;
std::string getFunction(FUNCTION) override;
std::string compareFunction(COMPARE, const std::string&, const std::string&) override;
@ -60,7 +60,7 @@ public:
VkShaderModule handle = nullptr;
u32 id;
vk::glsl::shader shader;
std::vector<size_t> FragmentConstantOffsetCache;
std::vector<usz> FragmentConstantOffsetCache;
std::array<u32, 4> output_color_masks{ {} };

View file

@ -197,7 +197,7 @@ namespace
const auto& binding_table = vk::get_current_renderer()->get_pipeline_binding_table();
std::vector<VkDescriptorSetLayoutBinding> bindings(binding_table.total_descriptor_bindings);
size_t idx = 0;
usz idx = 0;
// Vertex stream, one stream for cacheable data, one stream for transient data
for (int i = 0; i < 3; i++)
@ -1872,8 +1872,8 @@ void VKGSRender::update_vertex_env(u32 id, const vk::vertex_upload_info& vertex_
if (m_vertex_layout_storage)
m_current_frame->buffer_views_to_clean.push_back(std::move(m_vertex_layout_storage));
const size_t alloc_addr = m_vertex_layout_stream_info.offset;
const size_t view_size = (alloc_addr + m_texbuffer_view_size) > m_vertex_layout_ring_info.size() ? m_vertex_layout_ring_info.size() - alloc_addr : m_texbuffer_view_size;
const usz alloc_addr = m_vertex_layout_stream_info.offset;
const usz view_size = (alloc_addr + m_texbuffer_view_size) > m_vertex_layout_ring_info.size() ? m_vertex_layout_ring_info.size() - alloc_addr : m_texbuffer_view_size;
m_vertex_layout_storage = std::make_unique<vk::buffer_view>(*m_device, m_vertex_layout_ring_info.heap->value, VK_FORMAT_R32G32_UINT, alloc_addr, view_size);
base_offset = 0;
}
@ -1894,7 +1894,7 @@ void VKGSRender::update_vertex_env(u32 id, const vk::vertex_upload_info& vertex_
vkCmdPushConstants(*m_current_command_buffer, pipeline_layout, VK_SHADER_STAGE_VERTEX_BIT, 0, data_size, draw_info);
const size_t data_offset = (id * 128) + m_vertex_layout_stream_info.offset;
const usz data_offset = (id * 128) + m_vertex_layout_stream_info.offset;
auto dst = m_vertex_layout_ring_info.map(data_offset, 128);
fill_vertex_layout_state(m_vertex_layout, vertex_info.first_vertex, vertex_info.allocated_vertex_count, static_cast<s32*>(dst),
@ -2445,8 +2445,8 @@ void VKGSRender::begin_conditional_rendering(const std::vector<rsx::reports::occ
auto scratch = vk::get_scratch_buffer();
u32 dst_offset = 0;
size_t first = 0;
size_t last;
usz first = 0;
usz last;
if (!partial_eval) [[likely]]
{
@ -2457,7 +2457,7 @@ void VKGSRender::begin_conditional_rendering(const std::vector<rsx::reports::occ
last = 1;
}
for (size_t i = first; i < last; ++i)
for (usz i = first; i < last; ++i)
{
auto& query_info = m_occlusion_map[sources[i]->driver_handle];
for (const auto& index : query_info.indices)

View file

@ -95,7 +95,7 @@ namespace vk
u64 g_num_processed_frames = 0;
u64 g_num_total_frames = 0;
VKAPI_ATTR void* VKAPI_CALL mem_realloc(void* pUserData, void* pOriginal, size_t size, size_t alignment, VkSystemAllocationScope allocationScope)
VKAPI_ATTR void* VKAPI_CALL mem_realloc(void* pUserData, void* pOriginal, usz size, usz alignment, VkSystemAllocationScope allocationScope)
{
#ifdef _MSC_VER
return _aligned_realloc(pOriginal, size, alignment);
@ -106,7 +106,7 @@ namespace vk
#endif
}
VKAPI_ATTR void* VKAPI_CALL mem_alloc(void* pUserData, size_t size, size_t alignment, VkSystemAllocationScope allocationScope)
VKAPI_ATTR void* VKAPI_CALL mem_alloc(void* pUserData, usz size, usz alignment, VkSystemAllocationScope allocationScope)
{
#ifdef _MSC_VER
return _aligned_malloc(size, alignment);
@ -128,11 +128,11 @@ namespace vk
#endif
}
bool data_heap::grow(size_t size)
bool data_heap::grow(usz size)
{
// Create new heap. All sizes are aligned up by 64M, upto 1GiB
const size_t size_limit = 1024 * 0x100000;
const size_t aligned_new_size = align(m_size + size, 64 * 0x100000);
const usz size_limit = 1024 * 0x100000;
const usz aligned_new_size = align(m_size + size, 64 * 0x100000);
if (aligned_new_size >= size_limit)
{
@ -1124,7 +1124,7 @@ namespace vk
}
VKAPI_ATTR VkBool32 VKAPI_CALL dbgFunc(VkFlags msgFlags, VkDebugReportObjectTypeEXT objType,
uint64_t srcObject, size_t location, int32_t msgCode,
uint64_t srcObject, usz location, int32_t msgCode,
const char *pLayerPrefix, const char *pMsg, void *pUserData)
{
if (msgFlags & VK_DEBUG_REPORT_ERROR_BIT_EXT)
@ -1147,7 +1147,7 @@ namespace vk
}
VkBool32 BreakCallback(VkFlags msgFlags, VkDebugReportObjectTypeEXT objType,
uint64_t srcObject, size_t location, int32_t msgCode,
uint64_t srcObject, usz location, int32_t msgCode,
const char *pLayerPrefix, const char *pMsg, void *pUserData)
{
#ifdef _WIN32

View file

@ -48,16 +48,16 @@ namespace vk
{
#define CHECK_RESULT(expr) { VkResult _res = (expr); if (_res != VK_SUCCESS) vk::die_with_error(_res); }
VKAPI_ATTR void *VKAPI_CALL mem_realloc(void *pUserData, void *pOriginal, size_t size, size_t alignment, VkSystemAllocationScope allocationScope);
VKAPI_ATTR void *VKAPI_CALL mem_alloc(void *pUserData, size_t size, size_t alignment, VkSystemAllocationScope allocationScope);
VKAPI_ATTR void *VKAPI_CALL mem_realloc(void *pUserData, void *pOriginal, usz size, usz alignment, VkSystemAllocationScope allocationScope);
VKAPI_ATTR void *VKAPI_CALL mem_alloc(void *pUserData, usz size, usz alignment, VkSystemAllocationScope allocationScope);
VKAPI_ATTR void VKAPI_CALL mem_free(void *pUserData, void *pMemory);
VKAPI_ATTR VkBool32 VKAPI_CALL dbgFunc(VkFlags msgFlags, VkDebugReportObjectTypeEXT objType,
uint64_t srcObject, size_t location, int32_t msgCode,
uint64_t srcObject, usz location, int32_t msgCode,
const char *pLayerPrefix, const char *pMsg, void *pUserData);
VkBool32 BreakCallback(VkFlags msgFlags, VkDebugReportObjectTypeEXT objType,
uint64_t srcObject, size_t location, int32_t msgCode,
uint64_t srcObject, usz location, int32_t msgCode,
const char *pLayerPrefix, const char *pMsg,
void *pUserData);
@ -2054,7 +2054,7 @@ private:
, m_device(dev)
{
std::vector<VkImageView> image_view_array(attachments.size());
size_t i = 0;
usz i = 0;
for (const auto &att : attachments)
{
image_view_array[i++] = att->value;
@ -3675,7 +3675,7 @@ public:
class data_heap : public ::data_heap
{
private:
size_t initial_size = 0;
usz initial_size = 0;
bool mapped = false;
void *_ptr = nullptr;
@ -3685,7 +3685,7 @@ public:
std::vector<VkBufferCopy> dirty_ranges;
protected:
bool grow(size_t size) override;
bool grow(usz size) override;
public:
std::unique_ptr<buffer> heap;
@ -3694,7 +3694,7 @@ public:
// Avoid mapping/unmapping to keep these drivers from stalling
// NOTE2: HOST_CACHED flag does not keep the mapped ptr around in the driver either
void create(VkBufferUsageFlags usage, size_t size, const char *name, size_t guard = 0x10000, VkBool32 notify = VK_FALSE)
void create(VkBufferUsageFlags usage, usz size, const char *name, usz guard = 0x10000, VkBool32 notify = VK_FALSE)
{
::data_heap::init(size, name, guard);
@ -3731,7 +3731,7 @@ public:
shadow.reset();
}
void* map(size_t offset, size_t size)
void* map(usz offset, usz size)
{
if (!_ptr)
{
@ -3793,7 +3793,7 @@ public:
// By default, allow the size to grow upto 8x larger
// This value is arbitrary, theoretically it is possible to allow infinite stretching to improve performance
const size_t soft_limit = initial_size * 8;
const usz soft_limit = initial_size * 8;
if ((m_size + m_min_guard_size) < soft_limit)
return false;

View file

@ -163,9 +163,9 @@ namespace vk
namespace rpcs3
{
template <>
size_t hash_struct<vk::pipeline_props>(const vk::pipeline_props &pipelineProperties)
usz hash_struct<vk::pipeline_props>(const vk::pipeline_props &pipelineProperties)
{
size_t seed = hash_base(pipelineProperties.renderpass_key);
usz seed = hash_base(pipelineProperties.renderpass_key);
seed ^= hash_struct(pipelineProperties.state.ia);
seed ^= hash_struct(pipelineProperties.state.ds);
seed ^= hash_struct(pipelineProperties.state.rs);

View file

@ -649,7 +649,7 @@ void VKGSRender::flip(const rsx::display_flip_info_t& info)
{
m_frame->screenshot_toggle = false;
const size_t sshot_size = buffer_height * buffer_width * 4;
const usz sshot_size = buffer_height * buffer_width * 4;
vk::buffer sshot_vkbuf(*m_device, align(sshot_size, 0x100000), m_device->get_memory_mapping().host_visible_coherent, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
VK_BUFFER_USAGE_TRANSFER_DST_BIT, 0);

View file

@ -18,7 +18,7 @@ namespace vk
using pipeline_properties = vk::pipeline_props;
static
void recompile_fragment_program(const RSXFragmentProgram& RSXFP, fragment_program_type& fragmentProgramData, size_t ID)
void recompile_fragment_program(const RSXFragmentProgram& RSXFP, fragment_program_type& fragmentProgramData, usz ID)
{
fragmentProgramData.Decompile(RSXFP);
fragmentProgramData.id = static_cast<u32>(ID);
@ -26,7 +26,7 @@ namespace vk
}
static
void recompile_vertex_program(const RSXVertexProgram& RSXVP, vertex_program_type& vertexProgramData, size_t ID)
void recompile_vertex_program(const RSXVertexProgram& RSXVP, vertex_program_type& vertexProgramData, usz ID)
{
vertexProgramData.Decompile(RSXVP);
vertexProgramData.id = static_cast<u32>(ID);

View file

@ -615,7 +615,7 @@ namespace rsx
static std::unique_ptr<vk::render_target> create_new_surface(
u32 address,
surface_color_format format,
size_t width, size_t height, size_t pitch,
usz width, usz height, usz pitch,
rsx::surface_antialiasing antialias,
vk::render_device &device, vk::command_buffer& cmd)
{
@ -680,7 +680,7 @@ namespace rsx
static std::unique_ptr<vk::render_target> create_new_surface(
u32 address,
surface_depth_format2 format,
size_t width, size_t height, size_t pitch,
usz width, usz height, usz pitch,
rsx::surface_antialiasing antialias,
vk::render_device &device, vk::command_buffer& cmd)
{
@ -828,12 +828,12 @@ namespace rsx
static void prepare_surface_for_sampling(vk::command_buffer& /*cmd*/, vk::render_target* /*surface*/)
{}
static bool surface_is_pitch_compatible(const std::unique_ptr<vk::render_target> &surface, size_t pitch)
static bool surface_is_pitch_compatible(const std::unique_ptr<vk::render_target> &surface, usz pitch)
{
return surface->rsx_pitch == pitch;
}
static void invalidate_surface_contents(vk::command_buffer& /*cmd*/, vk::render_target *surface, u32 address, size_t pitch)
static void invalidate_surface_contents(vk::command_buffer& /*cmd*/, vk::render_target *surface, u32 address, usz pitch)
{
surface->rsx_pitch = static_cast<u16>(pitch);
surface->queue_tag(address);
@ -869,7 +869,7 @@ namespace rsx
static bool int_surface_matches_properties(
const std::unique_ptr<vk::render_target> &surface,
VkFormat format,
size_t width, size_t height,
usz width, usz height,
rsx::surface_antialiasing antialias,
bool check_refs)
{
@ -887,7 +887,7 @@ namespace rsx
static bool surface_matches_properties(
const std::unique_ptr<vk::render_target> &surface,
surface_color_format format,
size_t width, size_t height,
usz width, usz height,
rsx::surface_antialiasing antialias,
bool check_refs = false)
{
@ -898,7 +898,7 @@ namespace rsx
static bool surface_matches_properties(
const std::unique_ptr<vk::render_target> &surface,
surface_depth_format2 format,
size_t width, size_t height,
usz width, usz height,
rsx::surface_antialiasing antialias,
bool check_refs = false)
{

Some files were not shown because too many files have changed in this diff Show more