mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-03 21:41:26 +12:00
rsx: Optimize hash_struct; vk cleanup
This commit is contained in:
parent
d0165290b6
commit
1200ca8172
3 changed files with 32 additions and 16 deletions
|
@ -9,19 +9,43 @@ namespace rpcs3
|
||||||
return static_cast<size_t>(value);
|
return static_cast<size_t>(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T, typename U>
|
||||||
static size_t hash_struct(const T& value)
|
static size_t hash_struct_base(const T& value)
|
||||||
{
|
{
|
||||||
// FNV 64-bit
|
// FNV 64-bit
|
||||||
size_t result = 14695981039346656037ull;
|
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;
|
result *= 1099511628211ull;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1884,7 +1884,7 @@ namespace rsx
|
||||||
block.base_offset = base_address;
|
block.base_offset = base_address;
|
||||||
block.attribute_stride = info.stride();
|
block.attribute_stride = info.stride();
|
||||||
block.memory_location = info.offset() >> 31;
|
block.memory_location = info.offset() >> 31;
|
||||||
block.locations.reserve(4);
|
block.locations.reserve(8);
|
||||||
block.locations.push_back(index);
|
block.locations.push_back(index);
|
||||||
block.min_divisor = info.frequency();
|
block.min_divisor = info.frequency();
|
||||||
block.all_modulus = !!(frequency_divider_mask & (1 << index));
|
block.all_modulus = !!(frequency_divider_mask & (1 << index));
|
||||||
|
|
|
@ -3140,15 +3140,7 @@ void VKGSRender::end_occlusion_query(rsx::reports::occlusion_query_info* query)
|
||||||
m_occlusion_query_active = false;
|
m_occlusion_query_active = false;
|
||||||
m_active_query_info = nullptr;
|
m_active_query_info = nullptr;
|
||||||
|
|
||||||
//Avoid stalling later if this query is already tied to a report
|
// NOTE: flushing the queue is very expensive, do not flush just because query stopped
|
||||||
if (query->num_draws && query->owned && !m_flush_requests.pending())
|
|
||||||
{
|
|
||||||
if (0)//m_current_command_buffer->flags & cb_has_occlusion_task)
|
|
||||||
{
|
|
||||||
m_flush_requests.post(false);
|
|
||||||
m_flush_requests.remove_one();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VKGSRender::check_occlusion_query_status(rsx::reports::occlusion_query_info* query)
|
bool VKGSRender::check_occlusion_query_status(rsx::reports::occlusion_query_info* query)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue