Browse Source

[texture_cache, pipeline_cache] Maintenance for some clamps + promoting to general purpose

vk-experiments5
CamilleLaVey 1 month ago
parent
commit
148586d2f6
  1. 6
      src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
  2. 5
      src/video_core/texture_cache/texture_cache.h
  3. 3
      src/video_core/vulkan_common/vulkan_device.cpp

6
src/video_core/renderer_vulkan/vk_pipeline_cache.cpp

@ -929,12 +929,8 @@ std::unique_ptr<ComputePipeline> PipelineCache::CreateComputePipeline(
} }
auto program{TranslateProgram(pools.inst, pools.block, env, cfg, host_info)}; auto program{TranslateProgram(pools.inst, pools.block, env, cfg, host_info)};
const VkDriverIdKHR driver_id = device.GetDriverID();
const bool needs_shared_mem_clamp =
driver_id == VK_DRIVER_ID_QUALCOMM_PROPRIETARY ||
driver_id == VK_DRIVER_ID_ARM_PROPRIETARY;
const u32 max_shared_memory = device.GetMaxComputeSharedMemorySize(); const u32 max_shared_memory = device.GetMaxComputeSharedMemorySize();
if (needs_shared_mem_clamp && program.shared_memory_size > max_shared_memory) {
if (program.shared_memory_size > max_shared_memory) {
LOG_WARNING(Render_Vulkan, LOG_WARNING(Render_Vulkan,
"Compute shader 0x{:016x} requests {}KB shared memory but device max is {}KB - clamping", "Compute shader 0x{:016x} requests {}KB shared memory but device max is {}KB - clamping",
key.unique_hash, key.unique_hash,

5
src/video_core/texture_cache/texture_cache.h

@ -1915,13 +1915,16 @@ void TextureCache<P>::TrimInactiveSamplers(size_t budget) {
ankerl::unordered_dense::set<SamplerId> active_sampler_ids; ankerl::unordered_dense::set<SamplerId> active_sampler_ids;
for (auto const& e : channel_state->sampler_ids) for (auto const& e : channel_state->sampler_ids)
active_sampler_ids.insert(e.second); active_sampler_ids.insert(e.second);
if constexpr (requires { runtime.Finish(); }) {
runtime.Finish();
}
// Elements in the map must be necesarily valid // Elements in the map must be necesarily valid
size_t removed = 0; size_t removed = 0;
for (auto it = channel_state->samplers.begin(); it != channel_state->samplers.end();) { for (auto it = channel_state->samplers.begin(); it != channel_state->samplers.end();) {
const SamplerId sampler_id = it->second; const SamplerId sampler_id = it->second;
if (!sampler_id || sampler_id == CORRUPT_ID) { if (!sampler_id || sampler_id == CORRUPT_ID) {
it = channel_state->samplers.erase(it); it = channel_state->samplers.erase(it);
} else if (std::ranges::find(active_sampler_ids, sampler_id) != active_sampler_ids.end()) {
} else if (active_sampler_ids.contains(sampler_id)) {
++it; ++it;
} else { } else {
slot_samplers.erase(sampler_id); slot_samplers.erase(sampler_id);

3
src/video_core/vulkan_common/vulkan_device.cpp

@ -644,7 +644,8 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
if (is_turnip || is_qualcomm) { if (is_turnip || is_qualcomm) {
LOG_WARNING(Render_Vulkan, "Driver requires higher-than-reported binding limits"); LOG_WARNING(Render_Vulkan, "Driver requires higher-than-reported binding limits");
properties.properties.limits.maxVertexInputBindings = 32;
properties.properties.limits.maxVertexInputBindings =
(std::max)(properties.properties.limits.maxVertexInputBindings, 32U);
} }
const auto dyna_state = Settings::values.dyna_state.GetValue(); const auto dyna_state = Settings::values.dyna_state.GetValue();

Loading…
Cancel
Save