mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-12-30 04:10:57 +01:00
Merge pull request #12081 from FernandoS27/check-out-on-your-broke-crypto-friends
Vulkan: Be more generous with pipeline workers for Android
This commit is contained in:
commit
787552f832
3 changed files with 31 additions and 5 deletions
|
@ -263,6 +263,22 @@ Shader::RuntimeInfo MakeRuntimeInfo(std::span<const Shader::IR::Program> program
|
||||||
info.y_negate = key.state.y_negate != 0;
|
info.y_negate = key.state.y_negate != 0;
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t GetTotalPipelineWorkers() {
|
||||||
|
const size_t max_core_threads =
|
||||||
|
std::max<size_t>(static_cast<size_t>(std::thread::hardware_concurrency()), 2ULL) - 1ULL;
|
||||||
|
#ifdef ANDROID
|
||||||
|
// Leave at least a few cores free in android
|
||||||
|
constexpr size_t free_cores = 3ULL;
|
||||||
|
if (max_core_threads <= free_cores) {
|
||||||
|
return 1ULL;
|
||||||
|
}
|
||||||
|
return max_core_threads - free_cores;
|
||||||
|
#else
|
||||||
|
return max_core_threads;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
} // Anonymous namespace
|
} // Anonymous namespace
|
||||||
|
|
||||||
size_t ComputePipelineCacheKey::Hash() const noexcept {
|
size_t ComputePipelineCacheKey::Hash() const noexcept {
|
||||||
|
@ -294,11 +310,8 @@ PipelineCache::PipelineCache(RasterizerVulkan& rasterizer_, const Device& device
|
||||||
texture_cache{texture_cache_}, shader_notify{shader_notify_},
|
texture_cache{texture_cache_}, shader_notify{shader_notify_},
|
||||||
use_asynchronous_shaders{Settings::values.use_asynchronous_shaders.GetValue()},
|
use_asynchronous_shaders{Settings::values.use_asynchronous_shaders.GetValue()},
|
||||||
use_vulkan_pipeline_cache{Settings::values.use_vulkan_driver_pipeline_cache.GetValue()},
|
use_vulkan_pipeline_cache{Settings::values.use_vulkan_driver_pipeline_cache.GetValue()},
|
||||||
#ifdef ANDROID
|
workers(device.HasBrokenParallelShaderCompiling() ? 1ULL : GetTotalPipelineWorkers(),
|
||||||
workers(1, "VkPipelineBuilder"),
|
"VkPipelineBuilder"),
|
||||||
#else
|
|
||||||
workers(std::max(std::thread::hardware_concurrency(), 2U) - 1, "VkPipelineBuilder"),
|
|
||||||
#endif
|
|
||||||
serialization_thread(1, "VkPipelineSerialization") {
|
serialization_thread(1, "VkPipelineSerialization") {
|
||||||
const auto& float_control{device.FloatControlProperties()};
|
const auto& float_control{device.FloatControlProperties()};
|
||||||
const VkDriverId driver_id{device.GetDriverID()};
|
const VkDriverId driver_id{device.GetDriverID()};
|
||||||
|
|
|
@ -635,6 +635,12 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
|
||||||
has_broken_cube_compatibility = true;
|
has_broken_cube_compatibility = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (is_qualcomm) {
|
||||||
|
const u32 version = (properties.properties.driverVersion << 3) >> 3;
|
||||||
|
if (version < VK_MAKE_API_VERSION(0, 255, 615, 512)) {
|
||||||
|
has_broken_parallel_compiling = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (extensions.sampler_filter_minmax && is_amd) {
|
if (extensions.sampler_filter_minmax && is_amd) {
|
||||||
// Disable ext_sampler_filter_minmax on AMD GCN4 and lower as it is broken.
|
// Disable ext_sampler_filter_minmax on AMD GCN4 and lower as it is broken.
|
||||||
if (!features.shader_float16_int8.shaderFloat16) {
|
if (!features.shader_float16_int8.shaderFloat16) {
|
||||||
|
|
|
@ -102,6 +102,7 @@ VK_DEFINE_HANDLE(VmaAllocator)
|
||||||
EXTENSION_NAME(VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME) \
|
EXTENSION_NAME(VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME) \
|
||||||
EXTENSION_NAME(VK_EXT_EXTENDED_DYNAMIC_STATE_2_EXTENSION_NAME) \
|
EXTENSION_NAME(VK_EXT_EXTENDED_DYNAMIC_STATE_2_EXTENSION_NAME) \
|
||||||
EXTENSION_NAME(VK_EXT_EXTENDED_DYNAMIC_STATE_3_EXTENSION_NAME) \
|
EXTENSION_NAME(VK_EXT_EXTENDED_DYNAMIC_STATE_3_EXTENSION_NAME) \
|
||||||
|
EXTENSION_NAME(VK_EXT_EXTERNAL_MEMORY_HOST_EXTENSION_NAME) \
|
||||||
EXTENSION_NAME(VK_EXT_4444_FORMATS_EXTENSION_NAME) \
|
EXTENSION_NAME(VK_EXT_4444_FORMATS_EXTENSION_NAME) \
|
||||||
EXTENSION_NAME(VK_EXT_LINE_RASTERIZATION_EXTENSION_NAME) \
|
EXTENSION_NAME(VK_EXT_LINE_RASTERIZATION_EXTENSION_NAME) \
|
||||||
EXTENSION_NAME(VK_EXT_ROBUSTNESS_2_EXTENSION_NAME) \
|
EXTENSION_NAME(VK_EXT_ROBUSTNESS_2_EXTENSION_NAME) \
|
||||||
|
@ -599,6 +600,11 @@ public:
|
||||||
return has_broken_cube_compatibility;
|
return has_broken_cube_compatibility;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns true if parallel shader compiling has issues with the current driver.
|
||||||
|
bool HasBrokenParallelShaderCompiling() const {
|
||||||
|
return has_broken_parallel_compiling;
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns the vendor name reported from Vulkan.
|
/// Returns the vendor name reported from Vulkan.
|
||||||
std::string_view GetVendorName() const {
|
std::string_view GetVendorName() const {
|
||||||
return properties.driver.driverName;
|
return properties.driver.driverName;
|
||||||
|
@ -794,6 +800,7 @@ private:
|
||||||
bool is_non_gpu{}; ///< Is SoftwareRasterizer, FPGA, non-GPU device.
|
bool is_non_gpu{}; ///< Is SoftwareRasterizer, FPGA, non-GPU device.
|
||||||
bool has_broken_compute{}; ///< Compute shaders can cause crashes
|
bool has_broken_compute{}; ///< Compute shaders can cause crashes
|
||||||
bool has_broken_cube_compatibility{}; ///< Has broken cube compatibility bit
|
bool has_broken_cube_compatibility{}; ///< Has broken cube compatibility bit
|
||||||
|
bool has_broken_parallel_compiling{}; ///< Has broken parallel shader compiling.
|
||||||
bool has_renderdoc{}; ///< Has RenderDoc attached
|
bool has_renderdoc{}; ///< Has RenderDoc attached
|
||||||
bool has_nsight_graphics{}; ///< Has Nsight Graphics attached
|
bool has_nsight_graphics{}; ///< Has Nsight Graphics attached
|
||||||
bool supports_d24_depth{}; ///< Supports D24 depth buffers.
|
bool supports_d24_depth{}; ///< Supports D24 depth buffers.
|
||||||
|
|
Loading…
Reference in a new issue