GPU: Rename readback and buffer write operations.

Avoid download/upload and pack, which don't have clear directions.
This commit is contained in:
Unknown W. Brackets 2022-10-09 13:49:41 -07:00
parent d83f736b1f
commit 55d5dc3834
19 changed files with 140 additions and 137 deletions

View file

@ -166,7 +166,7 @@ static int Replace_memcpy() {
// It's pretty common that games will copy video data.
if (tag == "ReplaceMemcpy/VideoDecode" || tag == "ReplaceMemcpy/VideoDecodeRange") {
if (bytes == 512 * 272 * 4) {
gpu->NotifyVideoUpload(destPtr, bytes, 512, GE_FORMAT_8888);
gpu->PerformWriteFormattedFromMemory(destPtr, bytes, 512, GE_FORMAT_8888);
}
}
}
@ -218,7 +218,7 @@ static int Replace_memcpy_jak() {
// It's pretty common that games will copy video data.
if (tag == "ReplaceMemcpy/VideoDecode" || tag == "ReplaceMemcpy/VideoDecodeRange") {
if (bytes == 512 * 272 * 4) {
gpu->NotifyVideoUpload(destPtr, bytes, 512, GE_FORMAT_8888);
gpu->PerformWriteFormattedFromMemory(destPtr, bytes, 512, GE_FORMAT_8888);
}
}
}
@ -264,7 +264,7 @@ static int Replace_memcpy_swizzled() {
u32 h = PARAM(4);
if ((skipGPUReplacements & (int)GPUReplacementSkip::MEMCPY) == 0) {
if (Memory::IsVRAMAddress(srcPtr)) {
gpu->PerformMemoryDownload(srcPtr, pitch * h);
gpu->PerformReadbackToMemory(srcPtr, pitch * h);
}
}
u8 *dstp = Memory::GetPointerWrite(destPtr);
@ -685,7 +685,7 @@ static int Hook_godseaterburst_blit_texture() {
const u32 fb_info = Memory::Read_U32(fb_infoaddr);
const u32 fb_address = Memory::Read_U32(fb_info);
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00044000);
gpu->PerformReadbackToMemory(fb_address, 0x00044000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00044000, "godseaterburst_blit_texture");
}
return 0;
@ -714,7 +714,7 @@ static int Hook_godseaterburst_depthmask_5551() {
NotifyMemInfo(MemBlockFlags::WRITE, depthMirror, size, "godseaterburst_depthmask_5551");
}
gpu->PerformMemoryDownload(colorBuffer, size);
gpu->PerformReadbackToMemory(colorBuffer, size);
NotifyMemInfo(MemBlockFlags::WRITE, colorBuffer, size, "godseaterburst_depthmask_5551");
return 0;
@ -728,7 +728,7 @@ static int Hook_hexyzforce_monoclome_thread() {
const u32 fb_address = Memory::Read_U32(fb_info);
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00088000);
gpu->PerformReadbackToMemory(fb_address, 0x00088000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00088000, "hexyzforce_monoclome_thread");
}
return 0;
@ -737,7 +737,7 @@ static int Hook_hexyzforce_monoclome_thread() {
static int Hook_starocean_write_stencil() {
const u32 fb_address = currentMIPS->r[MIPS_REG_T7];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformStencilUpload(fb_address, 0x00088000, StencilUpload::IGNORE_ALPHA);
gpu->PerformWriteStencilFromMemory(fb_address, 0x00088000, WriteStencil::IGNORE_ALPHA);
}
return 0;
}
@ -745,7 +745,7 @@ static int Hook_starocean_write_stencil() {
static int Hook_topx_create_saveicon() {
const u32 fb_address = currentMIPS->r[MIPS_REG_V0];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00044000);
gpu->PerformReadbackToMemory(fb_address, 0x00044000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00044000, "topx_create_saveicon");
}
return 0;
@ -754,7 +754,7 @@ static int Hook_topx_create_saveicon() {
static int Hook_ff1_battle_effect() {
const u32 fb_address = currentMIPS->r[MIPS_REG_A1];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00088000);
gpu->PerformReadbackToMemory(fb_address, 0x00088000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00088000, "ff1_battle_effect");
}
return 0;
@ -764,7 +764,7 @@ static int Hook_dissidia_recordframe_avi() {
// This is called once per frame, and records that frame's data to avi.
const u32 fb_address = currentMIPS->r[MIPS_REG_A1];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00044000);
gpu->PerformReadbackToMemory(fb_address, 0x00044000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00044000, "dissidia_recordframe_avi");
}
return 0;
@ -785,7 +785,7 @@ static int Hook_brandish_download_frame() {
const u32 fb_address = 0x4000000 + (0x44000 * fb_index);
const u32 dest_address = currentMIPS->r[MIPS_REG_A1];
if (Memory::IsRAMAddress(dest_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00044000);
gpu->PerformReadbackToMemory(fb_address, 0x00044000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00044000, "brandish_download_frame");
}
return 0;
@ -796,7 +796,7 @@ static int Hook_growlanser_create_saveicon() {
const u32 fmt = Memory::Read_U32(currentMIPS->r[MIPS_REG_SP]);
const u32 sz = fmt == GE_FORMAT_8888 ? 0x00088000 : 0x00044000;
if (Memory::IsVRAMAddress(fb_address) && fmt <= 3) {
gpu->PerformMemoryDownload(fb_address, sz);
gpu->PerformReadbackToMemory(fb_address, sz);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, sz, "growlanser_create_saveicon");
}
return 0;
@ -807,7 +807,7 @@ static int Hook_sd_gundam_g_generation_download_frame() {
const u32 fmt = Memory::Read_U32(currentMIPS->r[MIPS_REG_SP] + 4);
const u32 sz = fmt == GE_FORMAT_8888 ? 0x00088000 : 0x00044000;
if (Memory::IsVRAMAddress(fb_address) && fmt <= 3) {
gpu->PerformMemoryDownload(fb_address, sz);
gpu->PerformReadbackToMemory(fb_address, sz);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, sz, "sd_gundam_g_generation_download_frame");
}
return 0;
@ -816,7 +816,7 @@ static int Hook_sd_gundam_g_generation_download_frame() {
static int Hook_narisokonai_download_frame() {
const u32 fb_address = currentMIPS->r[MIPS_REG_V0];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00044000);
gpu->PerformReadbackToMemory(fb_address, 0x00044000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00044000, "narisokonai_download_frame");
}
return 0;
@ -825,7 +825,7 @@ static int Hook_narisokonai_download_frame() {
static int Hook_kirameki_school_life_download_frame() {
const u32 fb_address = currentMIPS->r[MIPS_REG_A2];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00088000);
gpu->PerformReadbackToMemory(fb_address, 0x00088000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00088000, "kirameki_school_life_download_frame");
}
return 0;
@ -834,7 +834,7 @@ static int Hook_kirameki_school_life_download_frame() {
static int Hook_orenoimouto_download_frame() {
const u32 fb_address = currentMIPS->r[MIPS_REG_A4];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00088000);
gpu->PerformReadbackToMemory(fb_address, 0x00088000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00088000, "orenoimouto_download_frame");
}
return 0;
@ -843,7 +843,7 @@ static int Hook_orenoimouto_download_frame() {
static int Hook_sakurasou_download_frame() {
const u32 fb_address = currentMIPS->r[MIPS_REG_V0];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00088000);
gpu->PerformReadbackToMemory(fb_address, 0x00088000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00088000, "sakurasou_download_frame");
}
return 0;
@ -852,7 +852,7 @@ static int Hook_sakurasou_download_frame() {
static int Hook_suikoden1_and_2_download_frame_1() {
const u32 fb_address = currentMIPS->r[MIPS_REG_S4];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00088000);
gpu->PerformReadbackToMemory(fb_address, 0x00088000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00088000, "suikoden1_and_2_download_frame_1");
}
return 0;
@ -861,7 +861,7 @@ static int Hook_suikoden1_and_2_download_frame_1() {
static int Hook_suikoden1_and_2_download_frame_2() {
const u32 fb_address = currentMIPS->r[MIPS_REG_S2];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00088000);
gpu->PerformReadbackToMemory(fb_address, 0x00088000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00088000, "suikoden1_and_2_download_frame_2");
}
return 0;
@ -872,7 +872,7 @@ static int Hook_rezel_cross_download_frame() {
const u32 fmt = Memory::Read_U32(currentMIPS->r[MIPS_REG_SP] + 0x14);
const u32 sz = fmt == GE_FORMAT_8888 ? 0x00088000 : 0x00044000;
if (Memory::IsVRAMAddress(fb_address) && fmt <= 3) {
gpu->PerformMemoryDownload(fb_address, sz);
gpu->PerformReadbackToMemory(fb_address, sz);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, sz, "rezel_cross_download_frame");
}
return 0;
@ -881,7 +881,7 @@ static int Hook_rezel_cross_download_frame() {
static int Hook_kagaku_no_ensemble_download_frame() {
const u32 fb_address = currentMIPS->r[MIPS_REG_V0];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00088000);
gpu->PerformReadbackToMemory(fb_address, 0x00088000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00088000, "kagaku_no_ensemble_download_frame");
}
return 0;
@ -890,7 +890,7 @@ static int Hook_kagaku_no_ensemble_download_frame() {
static int Hook_soranokiseki_fc_download_frame() {
const u32 fb_address = currentMIPS->r[MIPS_REG_A2];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00044000);
gpu->PerformReadbackToMemory(fb_address, 0x00044000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00044000, "soranokiseki_fc_download_frame");
}
return 0;
@ -911,7 +911,7 @@ static int Hook_soranokiseki_sc_download_frame() {
const u32 fb_address = 0x4000000 + (0x44000 * fb_index);
const u32 dest_address = currentMIPS->r[MIPS_REG_A1];
if (Memory::IsRAMAddress(dest_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00044000);
gpu->PerformReadbackToMemory(fb_address, 0x00044000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00044000, "soranokiseki_sc_download_frame");
}
return 0;
@ -920,7 +920,7 @@ static int Hook_soranokiseki_sc_download_frame() {
static int Hook_bokunonatsuyasumi4_download_frame() {
const u32 fb_address = currentMIPS->r[MIPS_REG_A3];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00044000);
gpu->PerformReadbackToMemory(fb_address, 0x00044000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00044000, "bokunonatsuyasumi4_download_frame");
}
return 0;
@ -932,7 +932,7 @@ static int Hook_danganronpa2_1_download_frame() {
const u32 fb_offset_fix = fb_offset & 0xFFFFFFFC;
const u32 fb_address = fb_base + fb_offset_fix;
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00088000);
gpu->PerformReadbackToMemory(fb_address, 0x00088000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00088000, "danganronpa2_1_download_frame");
}
return 0;
@ -944,7 +944,7 @@ static int Hook_danganronpa2_2_download_frame() {
const u32 fb_offset_fix = fb_offset & 0xFFFFFFFC;
const u32 fb_address = fb_base + fb_offset_fix;
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00088000);
gpu->PerformReadbackToMemory(fb_address, 0x00088000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00088000, "danganronpa2_2_download_frame");
}
return 0;
@ -956,7 +956,7 @@ static int Hook_danganronpa1_1_download_frame() {
const u32 fb_offset_fix = fb_offset & 0xFFFFFFFC;
const u32 fb_address = fb_base + fb_offset_fix;
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00088000);
gpu->PerformReadbackToMemory(fb_address, 0x00088000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00088000, "danganronpa1_1_download_frame");
}
return 0;
@ -970,7 +970,7 @@ static int Hook_danganronpa1_2_download_frame() {
const u32 fb_offset_fix = fb_offset & 0xFFFFFFFC;
const u32 fb_address = fb_base + fb_offset_fix;
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00088000);
gpu->PerformReadbackToMemory(fb_address, 0x00088000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00088000, "danganronpa1_2_download_frame");
}
return 0;
@ -979,7 +979,7 @@ static int Hook_danganronpa1_2_download_frame() {
static int Hook_kankabanchoutbr_download_frame() {
const u32 fb_address = currentMIPS->r[MIPS_REG_A1];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00044000);
gpu->PerformReadbackToMemory(fb_address, 0x00044000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00044000, "kankabanchoutbr_download_frame");
}
return 0;
@ -988,7 +988,7 @@ static int Hook_kankabanchoutbr_download_frame() {
static int Hook_orenoimouto_download_frame_2() {
const u32 fb_address = currentMIPS->r[MIPS_REG_A4];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00088000);
gpu->PerformReadbackToMemory(fb_address, 0x00088000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00088000, "orenoimouto_download_frame_2");
}
return 0;
@ -997,7 +997,7 @@ static int Hook_orenoimouto_download_frame_2() {
static int Hook_rewrite_download_frame() {
const u32 fb_address = currentMIPS->r[MIPS_REG_A0];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00088000);
gpu->PerformReadbackToMemory(fb_address, 0x00088000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00088000, "rewrite_download_frame");
}
return 0;
@ -1006,7 +1006,7 @@ static int Hook_rewrite_download_frame() {
static int Hook_kudwafter_download_frame() {
const u32 fb_address = currentMIPS->r[MIPS_REG_A0];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00088000);
gpu->PerformReadbackToMemory(fb_address, 0x00088000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00088000, "kudwafter_download_frame");
}
return 0;
@ -1015,7 +1015,7 @@ static int Hook_kudwafter_download_frame() {
static int Hook_kumonohatateni_download_frame() {
const u32 fb_address = currentMIPS->r[MIPS_REG_A0];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00088000);
gpu->PerformReadbackToMemory(fb_address, 0x00088000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00088000, "kumonohatateni_download_frame");
}
return 0;
@ -1024,7 +1024,7 @@ static int Hook_kumonohatateni_download_frame() {
static int Hook_otomenoheihou_download_frame() {
const u32 fb_address = currentMIPS->r[MIPS_REG_A0];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00088000);
gpu->PerformReadbackToMemory(fb_address, 0x00088000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00088000, "otomenoheihou_download_frame");
}
return 0;
@ -1033,7 +1033,7 @@ static int Hook_otomenoheihou_download_frame() {
static int Hook_grisaianokajitsu_download_frame() {
const u32 fb_address = currentMIPS->r[MIPS_REG_A0];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00088000);
gpu->PerformReadbackToMemory(fb_address, 0x00088000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00088000, "grisaianokajitsu_download_frame");
}
return 0;
@ -1042,7 +1042,7 @@ static int Hook_grisaianokajitsu_download_frame() {
static int Hook_kokoroconnect_download_frame() {
const u32 fb_address = currentMIPS->r[MIPS_REG_A3];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00088000);
gpu->PerformReadbackToMemory(fb_address, 0x00088000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00088000, "kokoroconnect_download_frame");
}
return 0;
@ -1051,7 +1051,7 @@ static int Hook_kokoroconnect_download_frame() {
static int Hook_toheart2_download_frame() {
const u32 fb_address = currentMIPS->r[MIPS_REG_A1];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00044000);
gpu->PerformReadbackToMemory(fb_address, 0x00044000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00044000, "toheart2_download_frame");
}
return 0;
@ -1060,7 +1060,7 @@ static int Hook_toheart2_download_frame() {
static int Hook_toheart2_download_frame_2() {
const u32 fb_address = currentMIPS->r[MIPS_REG_A0];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00088000);
gpu->PerformReadbackToMemory(fb_address, 0x00088000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00088000, "toheart2_download_frame_2");
}
return 0;
@ -1069,7 +1069,7 @@ static int Hook_toheart2_download_frame_2() {
static int Hook_flowers_download_frame() {
const u32 fb_address = currentMIPS->r[MIPS_REG_A0];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00088000);
gpu->PerformReadbackToMemory(fb_address, 0x00088000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00088000, "flowers_download_frame");
}
return 0;
@ -1078,7 +1078,7 @@ static int Hook_flowers_download_frame() {
static int Hook_motorstorm_download_frame() {
const u32 fb_address = Memory::Read_U32(currentMIPS->r[MIPS_REG_A1] + 0x18);
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00088000);
gpu->PerformReadbackToMemory(fb_address, 0x00088000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00088000, "motorstorm_download_frame");
}
return 0;
@ -1087,7 +1087,7 @@ static int Hook_motorstorm_download_frame() {
static int Hook_utawarerumono_download_frame() {
const u32 fb_address = currentMIPS->r[MIPS_REG_A0];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00088000);
gpu->PerformReadbackToMemory(fb_address, 0x00088000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00088000, "utawarerumono_download_frame");
}
return 0;
@ -1096,7 +1096,7 @@ static int Hook_utawarerumono_download_frame() {
static int Hook_photokano_download_frame() {
const u32 fb_address = currentMIPS->r[MIPS_REG_A1];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00088000);
gpu->PerformReadbackToMemory(fb_address, 0x00088000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00088000, "photokano_download_frame");
}
return 0;
@ -1105,7 +1105,7 @@ static int Hook_photokano_download_frame() {
static int Hook_photokano_download_frame_2() {
const u32 fb_address = currentMIPS->r[MIPS_REG_A1];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00088000);
gpu->PerformReadbackToMemory(fb_address, 0x00088000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00088000, "photokano_download_frame_2");
}
return 0;
@ -1114,7 +1114,7 @@ static int Hook_photokano_download_frame_2() {
static int Hook_gakuenheaven_download_frame() {
const u32 fb_address = currentMIPS->r[MIPS_REG_A0];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00088000);
gpu->PerformReadbackToMemory(fb_address, 0x00088000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00088000, "gakuenheaven_download_frame");
}
return 0;
@ -1123,7 +1123,7 @@ static int Hook_gakuenheaven_download_frame() {
static int Hook_youkosohitsujimura_download_frame() {
const u32 fb_address = currentMIPS->r[MIPS_REG_V0];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00088000);
gpu->PerformReadbackToMemory(fb_address, 0x00088000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00088000, "youkosohitsujimura_download_frame");
}
return 0;
@ -1146,7 +1146,7 @@ static int Hook_zettai_hero_update_minimap_tex() {
static int Hook_tonyhawkp8_upload_tutorial_frame() {
const u32 fb_address = currentMIPS->r[MIPS_REG_A0];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryUpload(fb_address, 0x00088000);
gpu->PerformWriteColorFromMemory(fb_address, 0x00088000);
}
return 0;
}
@ -1154,7 +1154,7 @@ static int Hook_tonyhawkp8_upload_tutorial_frame() {
static int Hook_sdgundamggenerationportable_download_frame() {
const u32 fb_address = currentMIPS->r[MIPS_REG_A3];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00088000);
gpu->PerformReadbackToMemory(fb_address, 0x00088000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00088000, "sdgundamggenerationportable_download_frame");
}
return 0;
@ -1164,7 +1164,7 @@ static int Hook_atvoffroadfurypro_download_frame() {
const u32 fb_address = currentMIPS->r[MIPS_REG_S2];
const u32 fb_size = (currentMIPS->r[MIPS_REG_S4] >> 3) * currentMIPS->r[MIPS_REG_S3];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, fb_size);
gpu->PerformReadbackToMemory(fb_address, fb_size);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, fb_size, "atvoffroadfurypro_download_frame");
}
return 0;
@ -1174,7 +1174,7 @@ static int Hook_atvoffroadfuryblazintrails_download_frame() {
const u32 fb_address = currentMIPS->r[MIPS_REG_S5];
const u32 fb_size = (currentMIPS->r[MIPS_REG_S3] >> 3) * currentMIPS->r[MIPS_REG_S2];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, fb_size);
gpu->PerformReadbackToMemory(fb_address, fb_size);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, fb_size, "atvoffroadfuryblazintrails_download_frame");
}
return 0;
@ -1183,7 +1183,7 @@ static int Hook_atvoffroadfuryblazintrails_download_frame() {
static int Hook_littlebustersce_download_frame() {
const u32 fb_address = currentMIPS->r[MIPS_REG_A0];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00088000);
gpu->PerformReadbackToMemory(fb_address, 0x00088000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00088000, "littlebustersce_download_frame");
}
return 0;
@ -1192,7 +1192,7 @@ static int Hook_littlebustersce_download_frame() {
static int Hook_shinigamitoshoujo_download_frame() {
const u32 fb_address = currentMIPS->r[MIPS_REG_S2];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00088000);
gpu->PerformReadbackToMemory(fb_address, 0x00088000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00088000, "shinigamitoshoujo_download_frame");
}
return 0;
@ -1202,7 +1202,7 @@ static int Hook_atvoffroadfuryprodemo_download_frame() {
const u32 fb_address = currentMIPS->r[MIPS_REG_S5];
const u32 fb_size = ((currentMIPS->r[MIPS_REG_A0] + currentMIPS->r[MIPS_REG_A1]) >> 3) * currentMIPS->r[MIPS_REG_S2];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, fb_size);
gpu->PerformReadbackToMemory(fb_address, fb_size);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, fb_size, "atvoffroadfuryprodemo_download_frame");
}
return 0;
@ -1211,7 +1211,7 @@ static int Hook_atvoffroadfuryprodemo_download_frame() {
static int Hook_unendingbloodycall_download_frame() {
const u32 fb_address = currentMIPS->r[MIPS_REG_T3];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00088000);
gpu->PerformReadbackToMemory(fb_address, 0x00088000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00088000, "unendingbloodycall_download_frame");
}
return 0;
@ -1220,7 +1220,7 @@ static int Hook_unendingbloodycall_download_frame() {
static int Hook_omertachinmokunookitethelegacy_download_frame() {
const u32 fb_address = Memory::Read_U32(currentMIPS->r[MIPS_REG_SP] + 4);
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryDownload(fb_address, 0x00044000);
gpu->PerformReadbackToMemory(fb_address, 0x00044000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00044000, "omertachinmokunookitethelegacy_download_frame");
}
return 0;
@ -1240,7 +1240,7 @@ static int Hook_katamari_render_check() {
const u32 heightBlockCount = Memory::Read_U8(fbInfoPtr + 0x08) + 1;
const u32 totalBytes = width * heightBlocks * heightBlockCount;
gpu->PerformMemoryDownload(fb_address, totalBytes);
gpu->PerformReadbackToMemory(fb_address, totalBytes);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, totalBytes, "katamari_render_check");
}
return 0;
@ -1249,7 +1249,7 @@ static int Hook_katamari_render_check() {
static int Hook_katamari_screenshot_to_565() {
u32 fb_address;
if (GetMIPSStaticAddress(fb_address, 0x0040, 0x0044)) {
gpu->PerformMemoryDownload(0x04000000 | fb_address, 0x00088000);
gpu->PerformReadbackToMemory(0x04000000 | fb_address, 0x00088000);
NotifyMemInfo(MemBlockFlags::WRITE, 0x04000000 | fb_address, 0x00088000, "katamari_screenshot_to_565");
}
return 0;
@ -1258,7 +1258,7 @@ static int Hook_katamari_screenshot_to_565() {
static int Hook_mytranwars_upload_frame() {
u32 fb_address = currentMIPS->r[MIPS_REG_S0];
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformMemoryUpload(fb_address, 0x00088000);
gpu->PerformWriteColorFromMemory(fb_address, 0x00088000);
}
return 0;
}
@ -1272,7 +1272,7 @@ static int Hook_marvelalliance1_copy_a1_before() {
marvelalliance1_copy_dst = currentMIPS->r[MIPS_REG_V1];
marvelalliance1_copy_size = currentMIPS->r[MIPS_REG_V0] - currentMIPS->r[MIPS_REG_V1];
gpu->PerformMemoryDownload(marvelalliance1_copy_src, marvelalliance1_copy_size);
gpu->PerformReadbackToMemory(marvelalliance1_copy_src, marvelalliance1_copy_size);
NotifyMemInfo(MemBlockFlags::WRITE, marvelalliance1_copy_src, marvelalliance1_copy_size, "marvelalliance1_copy_a1_before");
return 0;
@ -1283,14 +1283,14 @@ static int Hook_marvelalliance1_copy_a2_before() {
marvelalliance1_copy_dst = currentMIPS->r[MIPS_REG_V0];
marvelalliance1_copy_size = currentMIPS->r[MIPS_REG_A1] - currentMIPS->r[MIPS_REG_A2];
gpu->PerformMemoryDownload(marvelalliance1_copy_src, marvelalliance1_copy_size);
gpu->PerformReadbackToMemory(marvelalliance1_copy_src, marvelalliance1_copy_size);
NotifyMemInfo(MemBlockFlags::WRITE, marvelalliance1_copy_src, marvelalliance1_copy_size, "marvelalliance1_copy_a2_before");
return 0;
}
static int Hook_marvelalliance1_copy_after() {
gpu->PerformMemoryUpload(marvelalliance1_copy_dst, marvelalliance1_copy_size);
gpu->PerformWriteColorFromMemory(marvelalliance1_copy_dst, marvelalliance1_copy_size);
NotifyMemInfo(MemBlockFlags::READ, marvelalliance1_copy_dst, marvelalliance1_copy_size, "marvelalliance1_copy_after");
return 0;
@ -1314,7 +1314,7 @@ static int Hook_starocean_clear_framebuf_after() {
DEBUG_LOG(HLE, "starocean_clear_framebuf() - %08x y=%d-%d", framebuf, y, h);
// TODO: This is always clearing to 0, actually, which could be faster than an upload.
gpu->PerformMemoryUpload(framebuf + 512 * y * 4, 512 * h * 4);
gpu->PerformWriteColorFromMemory(framebuf + 512 * y * 4, 512 * h * 4);
}
return 0;
}
@ -1323,7 +1323,7 @@ static int Hook_motorstorm_pixel_read() {
u32 fb_address = Memory::Read_U32(currentMIPS->r[MIPS_REG_A0] + 0x18);
u32 fb_height = Memory::Read_U16(currentMIPS->r[MIPS_REG_A0] + 0x26);
u32 fb_stride = Memory::Read_U16(currentMIPS->r[MIPS_REG_A0] + 0x28);
gpu->PerformMemoryDownload(fb_address, fb_height * fb_stride);
gpu->PerformReadbackToMemory(fb_address, fb_height * fb_stride);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, fb_height * fb_stride, "motorstorm_pixel_read");
return 0;
}
@ -1333,7 +1333,7 @@ static int Hook_worms_copy_normalize_alpha() {
u32 fb_address = currentMIPS->r[MIPS_REG_S1];
u32 fb_size = currentMIPS->r[MIPS_REG_A2];
if (Memory::IsVRAMAddress(fb_address) && Memory::IsValidRange(fb_address, fb_size)) {
gpu->PerformMemoryDownload(fb_address, fb_size);
gpu->PerformReadbackToMemory(fb_address, fb_size);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, fb_size, "worms_copy_normalize_alpha");
}
return 0;
@ -1350,7 +1350,7 @@ static int Hook_openseason_data_decode() {
firstWritePtr = startPtr;
}
if (Memory::IsVRAMAddress(endPtr) && curWritePtr == endPtr) {
gpu->PerformMemoryUpload(firstWritePtr, endPtr - firstWritePtr);
gpu->PerformWriteColorFromMemory(firstWritePtr, endPtr - firstWritePtr);
firstWritePtr = 0;
}
return 0;

View file

@ -250,7 +250,7 @@ static int sceJpegMJpegCsc(u32 imageAddr, u32 yCbCrAddr, int widthHeight, int bu
int width = (widthHeight >> 16) & 0xFFF;
int height = widthHeight & 0xFFF;
if (result >= 0)
gpu->NotifyVideoUpload(imageAddr, width * height * 4, width, GE_FORMAT_8888);
gpu->PerformWriteFormattedFromMemory(imageAddr, width * height * 4, width, GE_FORMAT_8888);
if (usec != 0)
return hleDelayResult(result, "jpeg csc", usec);

View file

@ -1171,7 +1171,7 @@ static u32 sceMpegAvcDecode(u32 mpeg, u32 auAddr, u32 frameWidth, u32 bufferAddr
// playing all pmp_queue frames
ctx->mediaengine->m_pFrameRGB = pmp_queue.front();
int bufferSize = ctx->mediaengine->writeVideoImage(buffer, frameWidth, ctx->videoPixelMode);
gpu->NotifyVideoUpload(buffer, bufferSize, frameWidth, ctx->videoPixelMode);
gpu->PerformWriteFormattedFromMemory(buffer, bufferSize, frameWidth, (GEBufferFormat)ctx->videoPixelMode);
ctx->avc.avcFrameStatus = 1;
ctx->videoFrameCount++;
@ -1183,7 +1183,7 @@ static u32 sceMpegAvcDecode(u32 mpeg, u32 auAddr, u32 frameWidth, u32 bufferAddr
}
else if(ctx->mediaengine->stepVideo(ctx->videoPixelMode)) {
int bufferSize = ctx->mediaengine->writeVideoImage(buffer, frameWidth, ctx->videoPixelMode);
gpu->NotifyVideoUpload(buffer, bufferSize, frameWidth, ctx->videoPixelMode);
gpu->PerformWriteFormattedFromMemory(buffer, bufferSize, frameWidth, (GEBufferFormat)ctx->videoPixelMode);
ctx->avc.avcFrameStatus = 1;
ctx->videoFrameCount++;
} else {
@ -2050,7 +2050,7 @@ static u32 sceMpegAvcCsc(u32 mpeg, u32 sourceAddr, u32 rangeAddr, int frameWidth
}
int destSize = ctx->mediaengine->writeVideoImageWithRange(destAddr, frameWidth, ctx->videoPixelMode, x, y, width, height);
gpu->NotifyVideoUpload(destAddr, destSize, frameWidth, ctx->videoPixelMode);
gpu->PerformWriteFormattedFromMemory(destAddr, destSize, frameWidth, (GEBufferFormat)ctx->videoPixelMode);
// Do not use avcDecodeDelayMs 's value
// Will cause video 's screen dislocation in Bleach heat of soul 6

View file

@ -1633,7 +1633,7 @@ static int scePsmfPlayerGetVideoData(u32 psmfPlayer, u32 videoDataAddr)
int bufw = videoData->frameWidth == 0 ? 512 : videoData->frameWidth & ~1;
// Always write the video frame, even after the video has ended.
int displaybufSize = psmfplayer->mediaengine->writeVideoImage(videoData->displaybuf, bufw, videoPixelMode);
gpu->NotifyVideoUpload(videoData->displaybuf, displaybufSize, bufw, videoPixelMode);
gpu->PerformWriteFormattedFromMemory(videoData->displaybuf, displaybufSize, bufw, (GEBufferFormat)videoPixelMode);
__PsmfUpdatePts(psmfplayer, videoData);
_PsmfPlayerFillRingbuffer(psmfplayer);

View file

@ -514,9 +514,9 @@ VirtualFramebuffer *FramebufferManagerCommon::DoSetRenderFrameBuffer(Framebuffer
// Assume that if we're clearing right when switching to a new framebuffer, we don't need to upload.
if (useBufferedRendering_ && params.isDrawing) {
gpu->PerformMemoryUpload(params.fb_address, colorByteSize);
// Alpha was already done by PerformMemoryUpload.
PerformStencilUpload(params.fb_address, colorByteSize, StencilUpload::STENCIL_IS_ZERO | StencilUpload::IGNORE_ALPHA);
gpu->PerformWriteColorFromMemory(params.fb_address, colorByteSize);
// Alpha was already done by PerformWriteColorFromMemory.
PerformWriteStencilFromMemory(params.fb_address, colorByteSize, WriteStencil::STENCIL_IS_ZERO | WriteStencil::IGNORE_ALPHA);
// TODO: Is it worth trying to upload the depth buffer (only if it wasn't copied above..?)
}
@ -1029,7 +1029,7 @@ void FramebufferManagerCommon::NotifyRenderFramebufferSwitched(VirtualFramebuffe
NotifyRenderFramebufferUpdated(vfb);
}
void FramebufferManagerCommon::NotifyVideoUpload(u32 addr, int size, int stride, GEBufferFormat fmt) {
void FramebufferManagerCommon::PerformWriteFormattedFromMemory(u32 addr, int size, int stride, GEBufferFormat fmt) {
// Note: UpdateFromMemory() is still called later.
// This is a special case where we have extra information prior to the invalidation.
@ -2598,9 +2598,9 @@ bool FramebufferManagerCommon::GetOutputFramebuffer(GPUDebugBuffer &buffer) {
// (Except using the GPU might cause problems because of various implementations'
// dithering behavior and games that expect exact colors like Danganronpa, so we
// can't entirely be rid of the CPU path.) -- unknown
void FramebufferManagerCommon::PackFramebufferSync(VirtualFramebuffer *vfb, int x, int y, int w, int h, RasterChannel channel) {
void FramebufferManagerCommon::ReadbackFramebufferSync(VirtualFramebuffer *vfb, int x, int y, int w, int h, RasterChannel channel) {
if (w <= 0 || h <= 0) {
ERROR_LOG(G3D, "Bad inputs to PackFramebufferSync: %d %d %d %d", x, y, w, h);
ERROR_LOG(G3D, "Bad inputs to ReadbackFramebufferSync: %d %d %d %d", x, y, w, h);
return;
}
@ -2617,7 +2617,7 @@ void FramebufferManagerCommon::PackFramebufferSync(VirtualFramebuffer *vfb, int
const int dstSize = ((h - 1) * stride + w) * dstBpp;
if (!Memory::IsValidRange(fb_address + dstByteOffset, dstSize)) {
ERROR_LOG_REPORT(G3D, "PackFramebufferSync would write outside of memory, ignoring");
ERROR_LOG_REPORT(G3D, "ReadbackFramebufferSync would write outside of memory, ignoring");
return;
}
@ -2629,28 +2629,28 @@ void FramebufferManagerCommon::PackFramebufferSync(VirtualFramebuffer *vfb, int
if (destPtr) {
if (channel == RASTER_DEPTH)
PackDepthbuffer(vfb, x, y, w, h);
ReadbackDepthbufferSync(vfb, x, y, w, h);
else
draw_->CopyFramebufferToMemorySync(vfb->fbo, channel == RASTER_COLOR ? Draw::FB_COLOR_BIT : Draw::FB_DEPTH_BIT, x, y, w, h, destFormat, destPtr, vfb->fb_stride, "PackFramebufferSync");
draw_->CopyFramebufferToMemorySync(vfb->fbo, channel == RASTER_COLOR ? Draw::FB_COLOR_BIT : Draw::FB_DEPTH_BIT, x, y, w, h, destFormat, destPtr, vfb->fb_stride, "ReadbackFramebufferSync");
char tag[128];
size_t len = snprintf(tag, sizeof(tag), "FramebufferPack/%08x_%08x_%dx%d_%s", vfb->fb_address, vfb->z_address, w, h, GeBufferFormatToString(vfb->fb_format));
NotifyMemInfo(MemBlockFlags::WRITE, fb_address + dstByteOffset, dstSize, tag, len);
} else {
ERROR_LOG(G3D, "PackFramebufferSync: Tried to readback to bad address %08x (stride = %d)", fb_address + dstByteOffset, vfb->fb_stride);
ERROR_LOG(G3D, "ReadbackFramebufferSync: Tried to readback to bad address %08x (stride = %d)", fb_address + dstByteOffset, vfb->fb_stride);
}
gpuStats.numReadbacks++;
}
void FramebufferManagerCommon::PackDepthbuffer(VirtualFramebuffer *vfb, int x, int y, int w, int h) {
void FramebufferManagerCommon::ReadbackDepthbufferSync(VirtualFramebuffer *vfb, int x, int y, int w, int h) {
_assert_msg_(vfb && vfb->z_address != 0 && vfb->z_stride != 0, "Depth buffer invalid");
Draw::DataFormat destFormat = GEFormatToThin3D(GE_FORMAT_DEPTH16);
const int dstByteOffset = (y * vfb->z_stride + x) * 2;
u8 *destPtr = Memory::GetPointerWriteUnchecked(vfb->z_address + dstByteOffset);
if (!draw_->CopyFramebufferToMemorySync(vfb->fbo, Draw::FB_DEPTH_BIT, x, y, w, h, destFormat, destPtr, vfb->fb_stride, "PackDepthbuffer")) {
WARN_LOG(G3D, "PackDepthbuffer failed");
if (!draw_->CopyFramebufferToMemorySync(vfb->fbo, Draw::FB_DEPTH_BIT, x, y, w, h, destFormat, destPtr, vfb->fb_stride, "ReadbackDepthbufferSync")) {
WARN_LOG(G3D, "ReadbackDepthbufferSync failed");
}
}
@ -2693,12 +2693,12 @@ void FramebufferManagerCommon::ReadFramebufferToMemory(VirtualFramebuffer *vfb,
if (vfb->renderWidth == vfb->width && vfb->renderHeight == vfb->height) {
// No need to stretch-blit
PackFramebufferSync(vfb, x, y, w, h, channel);
ReadbackFramebufferSync(vfb, x, y, w, h, channel);
} else {
VirtualFramebuffer *nvfb = FindDownloadTempBuffer(vfb, channel);
if (nvfb) {
BlitFramebuffer(nvfb, x, y, vfb, x, y, w, h, 0, channel, "Blit_ReadFramebufferToMemory");
PackFramebufferSync(nvfb, x, y, w, h, channel);
ReadbackFramebufferSync(nvfb, x, y, w, h, channel);
}
}
@ -2755,7 +2755,7 @@ void FramebufferManagerCommon::DownloadFramebufferForClut(u32 fb_address, u32 lo
VirtualFramebuffer *nvfb = FindDownloadTempBuffer(vfb, RASTER_COLOR);
if (nvfb) {
BlitFramebuffer(nvfb, x, y, vfb, x, y, w, h, 0, RASTER_COLOR, "Blit_DownloadFramebufferForClut");
PackFramebufferSync(nvfb, x, y, w, h, RASTER_COLOR);
ReadbackFramebufferSync(nvfb, x, y, w, h, RASTER_COLOR);
}
textureCache_->ForgetLastTexture();

View file

@ -307,10 +307,10 @@ public:
void CopyDisplayToOutput(bool reallyDirty);
bool NotifyFramebufferCopy(u32 src, u32 dest, int size, GPUCopyFlag flags, u32 skipDrawReason);
void NotifyVideoUpload(u32 addr, int size, int width, GEBufferFormat fmt);
void PerformWriteFormattedFromMemory(u32 addr, int size, int width, GEBufferFormat fmt);
void UpdateFromMemory(u32 addr, int size);
void ApplyClearToMemory(int x1, int y1, int x2, int y2, u32 clearColor);
bool PerformStencilUpload(u32 addr, int size, StencilUpload flags);
bool PerformWriteStencilFromMemory(u32 addr, int size, WriteStencil flags);
// Returns true if it's sure this is a direct FBO->FBO transfer and it has already handle it.
// In that case we hardly need to actually copy the bytes in VRAM, they will be wrong anyway (unless
@ -441,9 +441,9 @@ public:
Draw2DPipeline *pipeline, const char *tag);
protected:
virtual void PackFramebufferSync(VirtualFramebuffer *vfb, int x, int y, int w, int h, RasterChannel channel);
virtual void ReadbackFramebufferSync(VirtualFramebuffer *vfb, int x, int y, int w, int h, RasterChannel channel);
// Used for when a shader is required, such as GLES.
virtual void PackDepthbuffer(VirtualFramebuffer *vfb, int x, int y, int w, int h);
virtual void ReadbackDepthbufferSync(VirtualFramebuffer *vfb, int x, int y, int w, int h);
void SetViewport2D(int x, int y, int w, int h);
Draw::Texture *MakePixelTexture(const u8 *srcPixels, GEBufferFormat srcPixelFormat, int srcStride, int width, int height);
void DrawActiveTexture(float x, float y, float w, float h, float destW, float destH, float u0, float v0, float u1, float v1, int uvRotation, int flags);

View file

@ -127,7 +127,7 @@ void GenerateStencilVs(char *buffer, const ShaderLanguageDesc &lang) {
writer.EndVSMain(varyings);
}
bool FramebufferManagerCommon::PerformStencilUpload(u32 addr, int size, StencilUpload flags) {
bool FramebufferManagerCommon::PerformWriteStencilFromMemory(u32 addr, int size, WriteStencil flags) {
using namespace Draw;
addr &= 0x3FFFFFFF;
@ -178,16 +178,16 @@ bool FramebufferManagerCommon::PerformStencilUpload(u32 addr, int size, StencilU
}
if (usedBits == 0) {
if (flags & StencilUpload::STENCIL_IS_ZERO) {
if (flags & WriteStencil::STENCIL_IS_ZERO) {
// Common when creating buffers, it's already 0.
// We're done.
return false;
}
// Otherwise, we can skip alpha in many cases, in which case we don't even use a shader.
if (flags & StencilUpload::IGNORE_ALPHA) {
if (flags & WriteStencil::IGNORE_ALPHA) {
if (dstBuffer->fbo) {
draw_->BindFramebufferAsRenderTarget(dstBuffer->fbo, { Draw::RPAction::KEEP, Draw::RPAction::KEEP, Draw::RPAction::CLEAR }, "PerformStencilUpload_Clear");
draw_->BindFramebufferAsRenderTarget(dstBuffer->fbo, { Draw::RPAction::KEEP, Draw::RPAction::KEEP, Draw::RPAction::CLEAR }, "WriteStencilFromMemory_Clear");
}
return true;
}
@ -271,7 +271,7 @@ bool FramebufferManagerCommon::PerformStencilUpload(u32 addr, int size, StencilU
useBlit = false;
}
// The blit path doesn't set alpha, so we can't use it if that's needed.
if (!(flags & StencilUpload::IGNORE_ALPHA)) {
if (!(flags & WriteStencil::IGNORE_ALPHA)) {
useBlit = false;
}
@ -281,9 +281,9 @@ bool FramebufferManagerCommon::PerformStencilUpload(u32 addr, int size, StencilU
Draw::Framebuffer *blitFBO = nullptr;
if (useBlit) {
blitFBO = GetTempFBO(TempFBO::STENCIL, w, h);
draw_->BindFramebufferAsRenderTarget(blitFBO, { Draw::RPAction::DONT_CARE, Draw::RPAction::DONT_CARE, Draw::RPAction::CLEAR }, "PerformStencilUpload_Blit");
draw_->BindFramebufferAsRenderTarget(blitFBO, { Draw::RPAction::DONT_CARE, Draw::RPAction::DONT_CARE, Draw::RPAction::CLEAR }, "WriteStencilFromMemory_Blit");
} else if (dstBuffer->fbo) {
draw_->BindFramebufferAsRenderTarget(dstBuffer->fbo, { Draw::RPAction::KEEP, Draw::RPAction::KEEP, Draw::RPAction::CLEAR }, "PerformStencilUpload_NoBlit");
draw_->BindFramebufferAsRenderTarget(dstBuffer->fbo, { Draw::RPAction::KEEP, Draw::RPAction::KEEP, Draw::RPAction::CLEAR }, "WriteStencilFromMemory_NoBlit");
}
Draw::Viewport viewport = { 0.0f, 0.0f, (float)w, (float)h, 0.0f, 1.0f };
@ -326,7 +326,7 @@ bool FramebufferManagerCommon::PerformStencilUpload(u32 addr, int size, StencilU
if (useBlit) {
// Note that scissors don't affect blits on other APIs than OpenGL, so might want to try to get rid of this.
draw_->SetScissorRect(0, 0, dstBuffer->renderWidth, dstBuffer->renderHeight);
draw_->BlitFramebuffer(blitFBO, 0, 0, w, h, dstBuffer->fbo, 0, 0, dstBuffer->renderWidth, dstBuffer->renderHeight, Draw::FB_STENCIL_BIT, Draw::FB_BLIT_NEAREST, "PerformStencilUpload_Blit");
draw_->BlitFramebuffer(blitFBO, 0, 0, w, h, dstBuffer->fbo, 0, 0, dstBuffer->renderWidth, dstBuffer->renderHeight, Draw::FB_STENCIL_BIT, Draw::FB_BLIT_NEAREST, "WriteStencilFromMemory_Blit");
RebindFramebuffer("RebindFramebuffer - Stencil");
}
tex->Release();

View file

@ -1183,7 +1183,7 @@ void TextureCacheCommon::NotifyConfigChanged() {
replacer_.NotifyConfigChanged();
}
void TextureCacheCommon::NotifyVideoUpload(u32 addr, int size, int width, GEBufferFormat fmt) {
void TextureCacheCommon::NotifyWriteFormattedFromMemory(u32 addr, int size, int width, GEBufferFormat fmt) {
addr &= 0x3FFFFFFF;
videos_.push_back({ addr, (u32)size, gpuStats.numFlips });
}

View file

@ -336,7 +336,7 @@ public:
// FramebufferManager keeps TextureCache updated about what regions of memory are being rendered to,
// so that it can invalidate TexCacheEntries pointed at those addresses.
void NotifyFramebuffer(VirtualFramebuffer *framebuffer, FramebufferNotification msg);
void NotifyVideoUpload(u32 addr, int size, int width, GEBufferFormat fmt);
void NotifyWriteFormattedFromMemory(u32 addr, int size, int width, GEBufferFormat fmt);
size_t NumLoadedTextures() const {
return cache_.size();

View file

@ -556,7 +556,7 @@ void DumpExecute::Memcpy(u32 ptr, u32 sz) {
SyncStall();
Memory::MemcpyUnchecked(execMemcpyDest, pushbuf_.data() + ptr, sz);
NotifyMemInfo(MemBlockFlags::WRITE, execMemcpyDest, sz, "ReplayMemcpy");
gpu->PerformMemoryUpload(execMemcpyDest, sz);
gpu->PerformWriteColorFromMemory(execMemcpyDest, sz);
}
}

View file

@ -133,9 +133,9 @@
}
}
void FramebufferManagerDX9::PackFramebufferSync(VirtualFramebuffer *vfb, int x, int y, int w, int h, RasterChannel channel) {
void FramebufferManagerDX9::ReadbackFramebufferSync(VirtualFramebuffer *vfb, int x, int y, int w, int h, RasterChannel channel) {
if (channel == RASTER_DEPTH) {
PackDepthbuffer(vfb, x, y, w, h);
ReadbackDepthbufferSync(vfb, x, y, w, h);
return;
} else if (channel != RASTER_COLOR) {
// Unsupported
@ -178,7 +178,7 @@
}
}
void FramebufferManagerDX9::PackDepthbuffer(VirtualFramebuffer *vfb, int x, int y, int w, int h) {
void FramebufferManagerDX9::ReadbackDepthbufferSync(VirtualFramebuffer *vfb, int x, int y, int w, int h) {
// We always read the depth buffer in 24_8 format.
const u32 z_address = vfb->z_address;

View file

@ -49,10 +49,10 @@ public:
protected:
void DecimateFBOs() override;
void PackDepthbuffer(VirtualFramebuffer *vfb, int x, int y, int w, int h) override;
void ReadbackDepthbufferSync(VirtualFramebuffer *vfb, int x, int y, int w, int h) override;
void ReadbackFramebufferSync(VirtualFramebuffer *vfb, int x, int y, int w, int h, RasterChannel channel) override;
private:
void PackFramebufferSync(VirtualFramebuffer *vfb, int x, int y, int w, int h, RasterChannel channel) override;
bool GetRenderTargetFramebuffer(LPDIRECT3DSURFACE9 renderTarget, LPDIRECT3DSURFACE9 offscreen, int w, int h, GPUDebugBuffer &buffer);
LPDIRECT3DDEVICE9 device_;

View file

@ -75,9 +75,9 @@ void main() {
}
)";
void FramebufferManagerGLES::PackDepthbuffer(VirtualFramebuffer *vfb, int x, int y, int w, int h) {
void FramebufferManagerGLES::ReadbackDepthbufferSync(VirtualFramebuffer *vfb, int x, int y, int w, int h) {
if (!vfb->fbo) {
ERROR_LOG_REPORT_ONCE(vfbfbozero, SCEGE, "PackDepthbuffer: vfb->fbo == 0");
ERROR_LOG_REPORT_ONCE(vfbfbozero, SCEGE, "ReadbackDepthbufferSync: vfb->fbo == 0");
return;
}
@ -130,7 +130,7 @@ void FramebufferManagerGLES::PackDepthbuffer(VirtualFramebuffer *vfb, int x, int
shaderManager_->DirtyLastShader();
auto *blitFBO = GetTempFBO(TempFBO::COPY, vfb->renderWidth, vfb->renderHeight);
draw_->BindFramebufferAsRenderTarget(blitFBO, { Draw::RPAction::CLEAR, Draw::RPAction::DONT_CARE, Draw::RPAction::DONT_CARE }, "PackDepthbuffer");
draw_->BindFramebufferAsRenderTarget(blitFBO, { Draw::RPAction::CLEAR, Draw::RPAction::DONT_CARE, Draw::RPAction::DONT_CARE }, "ReadbackDepthbufferSync");
render->SetViewport({ 0, 0, (float)vfb->renderWidth, (float)vfb->renderHeight, 0.0f, 1.0f });
// We must bind the program after starting the render pass, and set the color mask after clearing.
@ -157,13 +157,13 @@ void FramebufferManagerGLES::PackDepthbuffer(VirtualFramebuffer *vfb, int x, int
float v1 = 1.0f;
DrawActiveTexture(x, y, w, h, vfb->renderWidth, vfb->renderHeight, 0.0f, 0.0f, u1, v1, ROTATION_LOCKED_HORIZONTAL, DRAWTEX_NEAREST);
draw_->CopyFramebufferToMemorySync(blitFBO, Draw::FB_COLOR_BIT, 0, y, packWidth, h, Draw::DataFormat::R8G8B8A8_UNORM, convBuf_, vfb->z_stride, "PackDepthbuffer");
draw_->CopyFramebufferToMemorySync(blitFBO, Draw::FB_COLOR_BIT, 0, y, packWidth, h, Draw::DataFormat::R8G8B8A8_UNORM, convBuf_, vfb->z_stride, "ReadbackDepthbufferSync");
textureCache_->ForgetLastTexture();
// TODO: Use 4444 so we can copy lines directly?
format16Bit = true;
} else {
draw_->CopyFramebufferToMemorySync(vfb->fbo, Draw::FB_DEPTH_BIT, 0, y, packWidth, h, Draw::DataFormat::D32F, convBuf_, vfb->z_stride, "PackDepthbuffer");
draw_->CopyFramebufferToMemorySync(vfb->fbo, Draw::FB_DEPTH_BIT, 0, y, packWidth, h, Draw::DataFormat::D32F, convBuf_, vfb->z_stride, "ReadbackDepthbufferSync");
format16Bit = false;
}

View file

@ -38,7 +38,7 @@ public:
protected:
void UpdateDownloadTempBuffer(VirtualFramebuffer *nvfb) override;
void PackDepthbuffer(VirtualFramebuffer *vfb, int x, int y, int w, int h) override;
void ReadbackDepthbufferSync(VirtualFramebuffer *vfb, int x, int y, int w, int h) override;
private:
u8 *convBuf_ = nullptr;

View file

@ -3059,7 +3059,7 @@ bool GPUCommon::PerformMemoryCopy(u32 dest, u32 src, int size, GPUCopyFlag flags
// Track stray copies of a framebuffer in RAM. MotoGP does this.
if (framebufferManager_->MayIntersectFramebuffer(src) || framebufferManager_->MayIntersectFramebuffer(dest)) {
if (!framebufferManager_->NotifyFramebufferCopy(src, dest, size, flags, gstate_c.skipDrawReason)) {
// We use a little hack for PerformMemoryDownload/PerformMemoryUpload using a VRAM mirror.
// We use a little hack for PerformReadbackToMemory/PerformWriteColorFromMemory using a VRAM mirror.
// Since they're identical we don't need to copy.
if (!Memory::IsVRAMAddress(dest) || (dest ^ 0x00400000) != src) {
if (MemBlockInfoDetailed(size)) {
@ -3102,14 +3102,14 @@ bool GPUCommon::PerformMemorySet(u32 dest, u8 v, int size) {
return false;
}
bool GPUCommon::PerformMemoryDownload(u32 dest, int size) {
bool GPUCommon::PerformReadbackToMemory(u32 dest, int size) {
if (Memory::IsVRAMAddress(dest)) {
return PerformMemoryCopy(dest, dest, size, GPUCopyFlag::FORCE_DST_MEM);
}
return false;
}
bool GPUCommon::PerformMemoryUpload(u32 dest, int size) {
bool GPUCommon::PerformWriteColorFromMemory(u32 dest, int size) {
if (Memory::IsVRAMAddress(dest)) {
GPURecord::NotifyUpload(dest, size);
return PerformMemoryCopy(dest, dest, size, GPUCopyFlag::FORCE_SRC_MEM | GPUCopyFlag::DEBUG_NOTIFIED);
@ -3132,17 +3132,17 @@ void GPUCommon::InvalidateCache(u32 addr, int size, GPUInvalidationType type) {
}
}
void GPUCommon::NotifyVideoUpload(u32 addr, int size, int frameWidth, int format) {
void GPUCommon::PerformWriteFormattedFromMemory(u32 addr, int size, int frameWidth, GEBufferFormat format) {
if (Memory::IsVRAMAddress(addr)) {
framebufferManager_->NotifyVideoUpload(addr, size, frameWidth, (GEBufferFormat)format);
framebufferManager_->PerformWriteFormattedFromMemory(addr, size, frameWidth, format);
}
textureCache_->NotifyVideoUpload(addr, size, frameWidth, (GEBufferFormat)format);
textureCache_->NotifyWriteFormattedFromMemory(addr, size, frameWidth, format);
InvalidateCache(addr, size, GPU_INVALIDATE_SAFE);
}
bool GPUCommon::PerformStencilUpload(u32 dest, int size, StencilUpload flags) {
bool GPUCommon::PerformWriteStencilFromMemory(u32 dest, int size, WriteStencil flags) {
if (framebufferManager_->MayIntersectFramebuffer(dest)) {
framebufferManager_->PerformStencilUpload(dest, size, flags);
framebufferManager_->PerformWriteStencilFromMemory(dest, size, flags);
return true;
}
return false;

View file

@ -126,12 +126,12 @@ public:
void InitClear() override = 0;
bool PerformMemoryCopy(u32 dest, u32 src, int size, GPUCopyFlag flags = GPUCopyFlag::NONE) override;
bool PerformMemorySet(u32 dest, u8 v, int size) override;
bool PerformMemoryDownload(u32 dest, int size) override;
bool PerformMemoryUpload(u32 dest, int size) override;
bool PerformReadbackToMemory(u32 dest, int size) override;
bool PerformWriteColorFromMemory(u32 dest, int size) override;
void InvalidateCache(u32 addr, int size, GPUInvalidationType type) override;
void NotifyVideoUpload(u32 addr, int size, int width, int format) override;
bool PerformStencilUpload(u32 dest, int size, StencilUpload flags) override;
void PerformWriteFormattedFromMemory(u32 addr, int size, int width, GEBufferFormat format) override;
bool PerformWriteStencilFromMemory(u32 dest, int size, WriteStencil flags) override;
void Execute_OffsetAddr(u32 op, u32 diff);
void Execute_Vaddr(u32 op, u32 diff);

View file

@ -107,12 +107,12 @@ enum GPUSyncType {
GPU_SYNC_LIST,
};
enum class StencilUpload {
enum class WriteStencil {
NEEDS_CLEAR = 1,
STENCIL_IS_ZERO = 2,
IGNORE_ALPHA = 4,
};
ENUM_CLASS_BITOPS(StencilUpload);
ENUM_CLASS_BITOPS(WriteStencil);
enum class GPUCopyFlag {
NONE = 0,
@ -231,13 +231,16 @@ public:
// Invalidate any cached content sourced from the specified range.
// If size = -1, invalidate everything.
virtual void InvalidateCache(u32 addr, int size, GPUInvalidationType type) = 0;
virtual void NotifyVideoUpload(u32 addr, int size, int width, int format) = 0;
// Clear caches, update hardware framebuffers, or similar based on written pixels of known format (typically video.)
virtual void PerformWriteFormattedFromMemory(u32 addr, int size, int width, GEBufferFormat format) = 0;
// Update either RAM from VRAM, or VRAM from RAM... or even VRAM from VRAM.
virtual bool PerformMemoryCopy(u32 dest, u32 src, int size, GPUCopyFlag flags = GPUCopyFlag::NONE) = 0;
virtual bool PerformMemorySet(u32 dest, u8 v, int size) = 0;
virtual bool PerformMemoryDownload(u32 dest, int size) = 0;
virtual bool PerformMemoryUpload(u32 dest, int size) = 0;
virtual bool PerformStencilUpload(u32 dest, int size, StencilUpload flags = StencilUpload::NEEDS_CLEAR) = 0;
// Update PSP memory with render results.
virtual bool PerformReadbackToMemory(u32 dest, int size) = 0;
// Update rendering data (i.e. hardware framebuffers) with data in PSP memory. Format unspecified.
virtual bool PerformWriteColorFromMemory(u32 dest, int size) = 0;
virtual bool PerformWriteStencilFromMemory(u32 dest, int size, WriteStencil flags = WriteStencil::NEEDS_CLEAR) = 0;
// Will cause the texture cache to be cleared at the start of the next frame.
virtual void ClearCacheNextFrame() = 0;

View file

@ -1260,7 +1260,7 @@ void SoftGPU::InvalidateCache(u32 addr, int size, GPUInvalidationType type)
// Nothing to invalidate.
}
void SoftGPU::NotifyVideoUpload(u32 addr, int size, int width, int format)
void SoftGPU::PerformWriteFormattedFromMemory(u32 addr, int size, int width, GEBufferFormat format)
{
// Ignore.
}
@ -1285,14 +1285,14 @@ bool SoftGPU::PerformMemorySet(u32 dest, u8 v, int size)
return false;
}
bool SoftGPU::PerformMemoryDownload(u32 dest, int size)
bool SoftGPU::PerformReadbackToMemory(u32 dest, int size)
{
// Nothing to update.
InvalidateCache(dest, size, GPU_INVALIDATE_HINT);
return false;
}
bool SoftGPU::PerformMemoryUpload(u32 dest, int size)
bool SoftGPU::PerformWriteColorFromMemory(u32 dest, int size)
{
// Nothing to update.
InvalidateCache(dest, size, GPU_INVALIDATE_HINT);
@ -1300,7 +1300,7 @@ bool SoftGPU::PerformMemoryUpload(u32 dest, int size)
return false;
}
bool SoftGPU::PerformStencilUpload(u32 dest, int size, StencilUpload flags)
bool SoftGPU::PerformWriteStencilFromMemory(u32 dest, int size, WriteStencil flags)
{
return false;
}

View file

@ -138,12 +138,12 @@ public:
void CopyDisplayToOutput(bool reallyDirty) override;
void GetStats(char *buffer, size_t bufsize) override;
void InvalidateCache(u32 addr, int size, GPUInvalidationType type) override;
void NotifyVideoUpload(u32 addr, int size, int width, int format) override;
void PerformWriteFormattedFromMemory(u32 addr, int size, int width, GEBufferFormat format) override;
bool PerformMemoryCopy(u32 dest, u32 src, int size, GPUCopyFlag flags = GPUCopyFlag::NONE) override;
bool PerformMemorySet(u32 dest, u8 v, int size) override;
bool PerformMemoryDownload(u32 dest, int size) override;
bool PerformMemoryUpload(u32 dest, int size) override;
bool PerformStencilUpload(u32 dest, int size, StencilUpload flags) override;
bool PerformReadbackToMemory(u32 dest, int size) override;
bool PerformWriteColorFromMemory(u32 dest, int size) override;
bool PerformWriteStencilFromMemory(u32 dest, int size, WriteStencil flags) override;
void ClearCacheNextFrame() override {}
void DeviceLost() override;