rsx: Minor fixes

- Abort nv406e semaphore acquire if the rsx thread stalls/crashes
- Fix texture size approximation to take mipmaps into account. Fixes some games hanging with WCB
This commit is contained in:
kd-11 2017-12-08 00:37:48 +03:00
parent 3338fdb936
commit ff0f1510e5
2 changed files with 12 additions and 2 deletions

View file

@ -1297,7 +1297,7 @@ namespace rsx
sampled_image_descriptor upload_texture(commandbuffer_type& cmd, RsxTextureType& tex, surface_store_type& m_rtts, Args&&... extras)
{
const u32 texaddr = rsx::get_address(tex.offset(), tex.location());
const u32 tex_size = (u32)get_texture_size(tex);
const u32 tex_size = (u32)get_placed_texture_storage_size(tex, 1, 256);
const u32 format = tex.format() & ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN);
const bool is_compressed_format = (format == CELL_GCM_TEXTURE_COMPRESSED_DXT1 || format == CELL_GCM_TEXTURE_COMPRESSED_DXT23 || format == CELL_GCM_TEXTURE_COMPRESSED_DXT45);
@ -1361,7 +1361,7 @@ namespace rsx
}
}
tex_pitch = is_compressed_format? (tex_size / tex_height) : tex_pitch; //NOTE: Compressed textures dont have a real pitch (tex_size = (w*h)/6)
tex_pitch = is_compressed_format? (u16)(get_texture_size(tex) / tex_height) : tex_pitch; //NOTE: Compressed textures dont have a real pitch (tex_size = (w*h)/6)
if (tex_pitch == 0) tex_pitch = tex_width * get_format_block_size_in_bytes(format);
const bool unnormalized = (tex.format() & CELL_GCM_TEXTURE_UN) != 0;

View file

@ -63,6 +63,9 @@ namespace rsx
void semaphore_acquire(thread* rsx, u32 _reg, u32 arg)
{
const u32 addr = get_address(method_registers.semaphore_offset_406e(), method_registers.semaphore_context_dma_406e());
if (vm::ps3::read32(addr) == arg) return;
const u64 start = get_system_time();
while (vm::ps3::read32(addr) != arg)
{
// todo: LLE: why does this one keep hanging? is it vsh system semaphore? whats actually pushing this to the command buffer?!
@ -72,6 +75,13 @@ namespace rsx
if (Emu.IsStopped())
break;
if ((get_system_time() - start) > 33000)
{
//If longer than 33ms force exit (1 frame)
LOG_ERROR(RSX, "nv406e::semaphore_acquire has timed out. semaphore_address=0x%X", addr);
break;
}
std::this_thread::yield();
}
}