Browse Source
[vk, rasterizer] Reduce FlushWork constant drawcalls
true-eds
CamilleLaVey
4 weeks ago
committed by
Caio Oliveira
No known key found for this signature in database
GPG Key ID: AAAE6C7FD4186B0C
1 changed files with
5 additions and
7 deletions
-
src/video_core/renderer_vulkan/vk_rasterizer.cpp
|
|
@ -857,23 +857,21 @@ void RasterizerVulkan::LoadDiskResources(u64 title_id, std::stop_token stop_load |
|
|
|
|
|
|
|
|
void RasterizerVulkan::FlushWork() { |
|
|
void RasterizerVulkan::FlushWork() { |
|
|
#ifdef ANDROID
|
|
|
#ifdef ANDROID
|
|
|
static constexpr u32 DRAWS_TO_DISPATCH = 1024; |
|
|
|
|
|
|
|
|
static constexpr u32 DRAWS_TO_DISPATCH = 512; |
|
|
|
|
|
static constexpr u32 CHECK_MASK = 3; |
|
|
#else
|
|
|
#else
|
|
|
static constexpr u32 DRAWS_TO_DISPATCH = 4096; |
|
|
static constexpr u32 DRAWS_TO_DISPATCH = 4096; |
|
|
|
|
|
static constexpr u32 CHECK_MASK = 7; |
|
|
#endif // ANDROID
|
|
|
#endif // ANDROID
|
|
|
|
|
|
|
|
|
// Only check multiples of 8 draws
|
|
|
|
|
|
static_assert(DRAWS_TO_DISPATCH % 8 == 0); |
|
|
|
|
|
if ((++draw_counter & 7) != 7) { |
|
|
|
|
|
|
|
|
static_assert(DRAWS_TO_DISPATCH % (CHECK_MASK + 1) == 0); |
|
|
|
|
|
if ((++draw_counter & CHECK_MASK) != CHECK_MASK) { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
if (draw_counter < DRAWS_TO_DISPATCH) { |
|
|
if (draw_counter < DRAWS_TO_DISPATCH) { |
|
|
// Send recorded tasks to the worker thread
|
|
|
|
|
|
scheduler.DispatchWork(); |
|
|
scheduler.DispatchWork(); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
// Otherwise (every certain number of draws) flush execution.
|
|
|
|
|
|
// This submits commands to the Vulkan driver.
|
|
|
|
|
|
scheduler.Flush(); |
|
|
scheduler.Flush(); |
|
|
draw_counter = 0; |
|
|
draw_counter = 0; |
|
|
} |
|
|
} |
|
|
|