diff --git a/Utilities/hash.h b/Utilities/hash.h index bc161ff96f..58b2fd3c8c 100644 --- a/Utilities/hash.h +++ b/Utilities/hash.h @@ -9,19 +9,43 @@ namespace rpcs3 return static_cast(value); } - template - static size_t hash_struct(const T& value) + template + static size_t hash_struct_base(const T& value) { // FNV 64-bit size_t result = 14695981039346656037ull; - const unsigned char *bytes = reinterpret_cast(&value); + const U *bits = reinterpret_cast(&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 + 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(value); + } + + if ((block_sz & 0x3) == 0) + { + return hash_struct_base(value); + } + + if ((block_sz & 0x1) == 0) + { + return hash_struct_base(value); + } + + return hash_struct_base(value); + } } \ No newline at end of file diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index 3bece0580c..e455304208 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -1884,7 +1884,7 @@ namespace rsx block.base_offset = base_address; block.attribute_stride = info.stride(); block.memory_location = info.offset() >> 31; - block.locations.reserve(4); + block.locations.reserve(8); block.locations.push_back(index); block.min_divisor = info.frequency(); block.all_modulus = !!(frequency_divider_mask & (1 << index)); diff --git a/rpcs3/Emu/RSX/VK/VKGSRender.cpp b/rpcs3/Emu/RSX/VK/VKGSRender.cpp index e809294110..7385f1beb4 100644 --- a/rpcs3/Emu/RSX/VK/VKGSRender.cpp +++ b/rpcs3/Emu/RSX/VK/VKGSRender.cpp @@ -2671,7 +2671,7 @@ void VKGSRender::prepare_rtts(rsx::framebuffer_creation_context context) //Search old framebuffers for this same configuration bool framebuffer_found = false; - const auto fbo_width = rsx::apply_resolution_scale(layout.width, true); + const auto fbo_width = rsx::apply_resolution_scale(layout.width, true); const auto fbo_height = rsx::apply_resolution_scale(layout.height, true); for (auto &fbo : m_framebuffers_to_clean) @@ -3140,15 +3140,7 @@ void VKGSRender::end_occlusion_query(rsx::reports::occlusion_query_info* query) m_occlusion_query_active = false; m_active_query_info = nullptr; - //Avoid stalling later if this query is already tied to a report - 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(); - } - } + // NOTE: flushing the queue is very expensive, do not flush just because query stopped } bool VKGSRender::check_occlusion_query_status(rsx::reports::occlusion_query_info* query)