Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AAA fixes #4973

Merged
merged 21 commits into from
Aug 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
f5f40bd
rsx: Synchronization rewritten
kd-11 Jul 19, 2018
0f1a0b2
zcull synchronization tweaks
kd-11 Jul 19, 2018
8b760b5
ZCULL: lower notice severity to avoid spam
kd-11 Jul 22, 2018
75b4afa
Minor optimizations and fixes
kd-11 Jul 22, 2018
98f105a
rsx: Refactor and fix framebuffer layout checks
kd-11 Jul 23, 2018
32bc2b4
rsx: Optimize hash_struct; vk cleanup
kd-11 Jul 24, 2018
bbd060f
rsx: Timestamp accuracy workaround
kd-11 Jul 24, 2018
95b79c9
vk: Fixups for type b surfaces
kd-11 Jul 25, 2018
6c99e6d
vulkan: Fix blit engine transfer to ARGB8 render target memory
kd-11 Jul 26, 2018
d60d1f4
rsx: Allow linear filtering when reading back GPU-resident memory
kd-11 Jul 26, 2018
504c7fd
rsx: Avoid acquiring the vm lock; deadlock evasion
kd-11 Jul 26, 2018
5f39672
zcull: Improve the delay algorithm to be more consistent
kd-11 Jul 27, 2018
6ab2353
gl: Do not create secondary context if async is disabled
kd-11 Jul 31, 2018
5a860d2
[WIP] rsx: Improve memory inheritance hierachy
kd-11 Aug 1, 2018
29eea93
rsx: Enable swizzled decode for all formats unless proven otherwise
kd-11 Aug 2, 2018
5818f16
gl: Reuse framebuffer resources
kd-11 Aug 8, 2018
9b81c68
gl: Avoid unnecessary scissor state change every draw call.
kd-11 Aug 9, 2018
3b243be
rsx: Followup to the memory inheritance hierachy patch
kd-11 Aug 14, 2018
7cc1f42
fix gcc build
kd-11 Aug 13, 2018
69dbc0b
rsx: Force disable draw reordering when capturing a frame
kd-11 Aug 16, 2018
ebcb3ed
rsx: Do not overflow the program buffer!
kd-11 Aug 17, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 29 additions & 5 deletions Utilities/hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,43 @@ namespace rpcs3
return static_cast<size_t>(value);
}

template<typename T>
static size_t hash_struct(const T& value)
template<typename T, typename U>
static size_t hash_struct_base(const T& value)
{
// FNV 64-bit
size_t result = 14695981039346656037ull;
const unsigned char *bytes = reinterpret_cast<const unsigned char*>(&value);
const U *bits = reinterpret_cast<const U*>(&value);

for (size_t n = 0; n < sizeof(T); ++n)
for (size_t n = 0; n < (sizeof(T) / sizeof(U)); ++n)
{
result ^= bytes[n];
result ^= bits[n];
result *= 1099511628211ull;
}

return result;
}

template<typename T>
static size_t hash_struct(const T& value)
{
// TODO: use c++17 if constexpr
static constexpr auto block_sz = sizeof(T);

if ((block_sz & 0x7) == 0)
{
return hash_struct_base<T, u64>(value);
}

if ((block_sz & 0x3) == 0)
{
return hash_struct_base<T, u32>(value);
}

if ((block_sz & 0x1) == 0)
{
return hash_struct_base<T, u16>(value);
}

return hash_struct_base<T, u8>(value);
}
}
2 changes: 2 additions & 0 deletions rpcs3/Emu/Cell/Modules/cellGcmSys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,7 @@ void cellGcmSetZcull(u8 index, u32 offset, u32 width, u32 height, u32 cullStart,
zcull.sFunc = sFunc;
zcull.sRef = sRef;
zcull.sMask = sMask;
zcull.binded = (zCullFormat > 0);

vm::_ptr<CellGcmZcullInfo>(m_config->zculls_addr)[index] = zcull.pack();
}
Expand Down Expand Up @@ -1261,6 +1262,7 @@ s32 cellGcmSetTile(u8 index, u8 location, u32 offset, u32 size, u32 pitch, u8 co
tile.comp = comp;
tile.base = base;
tile.bank = bank;
tile.binded = (pitch > 0);

vm::_ptr<CellGcmTileInfo>(m_config->tiles_addr)[index] = tile.pack();
return CELL_OK;
Expand Down
4 changes: 3 additions & 1 deletion rpcs3/Emu/RSX/Common/ProgramStateCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ fragment_program_utils::fragment_program_metadata fragment_program_utils::analys
s32 index = 0;
s32 program_offset = -1;
u32 ucode_size = 0;
u32 constants_size = 0;
u16 textures_mask = 0;

while (true)
Expand Down Expand Up @@ -364,6 +365,7 @@ fragment_program_utils::fragment_program_metadata fragment_program_utils::analys
//Instruction references constant, skip one slot occupied by data
index++;
ucode_size += 16;
constants_size += 16;
}
}

Expand All @@ -386,7 +388,7 @@ fragment_program_utils::fragment_program_metadata fragment_program_utils::analys
index++;
}

return{ (u32)program_offset, ucode_size, textures_mask };
return{ (u32)program_offset, ucode_size, constants_size, textures_mask };
}

size_t fragment_program_utils::get_fragment_program_ucode_hash(const RSXFragmentProgram& program)
Expand Down
1 change: 1 addition & 0 deletions rpcs3/Emu/RSX/Common/ProgramStateCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ namespace program_hash_util
{
u32 program_start_offset;
u32 program_ucode_length;
u32 program_constants_buffer_length;
u16 referenced_textures_mask;
};

Expand Down
31 changes: 28 additions & 3 deletions rpcs3/Emu/RSX/Common/TextureUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,14 @@ void upload_texture_subresource(gsl::span<gsl::byte> dst_buffer, const rsx_subre

case ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN) & CELL_GCM_TEXTURE_COMPRESSED_B8R8_G8R8:
case ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN) & CELL_GCM_TEXTURE_COMPRESSED_R8B8_R8G8:
{
copy_unmodified_block::copy_mipmap_level(as_span_workaround<u32>(dst_buffer), gsl::as_span<const be_t<u32>>(src_layout.data), w, h, depth, get_row_pitch_in_block<u32>(w, dst_row_pitch_multiple_of), src_layout.pitch_in_block);
break;
}

case CELL_GCM_TEXTURE_COMPRESSED_HILO8:
case CELL_GCM_TEXTURE_COMPRESSED_HILO_S8:
// TODO: Test if the HILO compressed formats support swizzling (other compressed_* formats ignore this option)
case CELL_GCM_TEXTURE_DEPTH16:
case CELL_GCM_TEXTURE_DEPTH16_FLOAT: // Untested
case CELL_GCM_TEXTURE_D1R5G5B5:
Expand Down Expand Up @@ -339,18 +345,34 @@ void upload_texture_subresource(gsl::span<gsl::byte> dst_buffer, const rsx_subre
case CELL_GCM_TEXTURE_Y16_X16:
case CELL_GCM_TEXTURE_Y16_X16_FLOAT:
case CELL_GCM_TEXTURE_X32_FLOAT:
copy_unmodified_block::copy_mipmap_level(as_span_workaround<u32>(dst_buffer), gsl::as_span<const be_t<u32>>(src_layout.data), w, h, depth, get_row_pitch_in_block<u32>(w, dst_row_pitch_multiple_of), src_layout.pitch_in_block);
{
if (is_swizzled)
copy_unmodified_block_swizzled::copy_mipmap_level(as_span_workaround<u32>(dst_buffer), gsl::as_span<const be_t<u32>>(src_layout.data), w, h, depth, get_row_pitch_in_block<u32>(w, dst_row_pitch_multiple_of));
else
copy_unmodified_block::copy_mipmap_level(as_span_workaround<u32>(dst_buffer), gsl::as_span<const be_t<u32>>(src_layout.data), w, h, depth, get_row_pitch_in_block<u32>(w, dst_row_pitch_multiple_of), src_layout.pitch_in_block);
break;
}

case CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT:
copy_unmodified_block::copy_mipmap_level(as_span_workaround<u64>(dst_buffer), gsl::as_span<const be_t<u64>>(src_layout.data), w, h, depth, get_row_pitch_in_block<u64>(w, dst_row_pitch_multiple_of), src_layout.pitch_in_block);
{
if (is_swizzled)
copy_unmodified_block_swizzled::copy_mipmap_level(as_span_workaround<u64>(dst_buffer), gsl::as_span<const be_t<u64>>(src_layout.data), w, h, depth, get_row_pitch_in_block<u64>(w, dst_row_pitch_multiple_of));
else
copy_unmodified_block::copy_mipmap_level(as_span_workaround<u64>(dst_buffer), gsl::as_span<const be_t<u64>>(src_layout.data), w, h, depth, get_row_pitch_in_block<u64>(w, dst_row_pitch_multiple_of), src_layout.pitch_in_block);
break;
}

case CELL_GCM_TEXTURE_W32_Z32_Y32_X32_FLOAT:
copy_unmodified_block::copy_mipmap_level(as_span_workaround<u128>(dst_buffer), gsl::as_span<const be_t<u128>>(src_layout.data), w, h, depth, get_row_pitch_in_block<u128>(w, dst_row_pitch_multiple_of), src_layout.pitch_in_block);
{
if (is_swizzled)
copy_unmodified_block_swizzled::copy_mipmap_level(as_span_workaround<u128>(dst_buffer), gsl::as_span<const be_t<u128>>(src_layout.data), w, h, depth, get_row_pitch_in_block<u128>(w, dst_row_pitch_multiple_of));
else
copy_unmodified_block::copy_mipmap_level(as_span_workaround<u128>(dst_buffer), gsl::as_span<const be_t<u128>>(src_layout.data), w, h, depth, get_row_pitch_in_block<u128>(w, dst_row_pitch_multiple_of), src_layout.pitch_in_block);
break;
}

case CELL_GCM_TEXTURE_COMPRESSED_DXT1:
{
if (depth > 1 && !vtc_support)
{
// PS3 uses the Nvidia VTC memory layout for compressed 3D textures.
Expand All @@ -363,9 +385,11 @@ void upload_texture_subresource(gsl::span<gsl::byte> dst_buffer, const rsx_subre
copy_unmodified_block::copy_mipmap_level(as_span_workaround<u64>(dst_buffer), gsl::as_span<const u64>(src_layout.data), w, h, depth, get_row_pitch_in_block<u64>(w, dst_row_pitch_multiple_of), src_layout.pitch_in_block);
}
break;
}

case CELL_GCM_TEXTURE_COMPRESSED_DXT23:
case CELL_GCM_TEXTURE_COMPRESSED_DXT45:
{
if (depth > 1 && !vtc_support)
{
// PS3 uses the Nvidia VTC memory layout for compressed 3D textures.
Expand All @@ -378,6 +402,7 @@ void upload_texture_subresource(gsl::span<gsl::byte> dst_buffer, const rsx_subre
copy_unmodified_block::copy_mipmap_level(as_span_workaround<u128>(dst_buffer), gsl::as_span<const u128>(src_layout.data), w, h, depth, get_row_pitch_in_block<u128>(w, dst_row_pitch_multiple_of), src_layout.pitch_in_block);
}
break;
}

default:
fmt::throw_exception("Wrong format 0x%x" HERE, format);
Expand Down
Loading