1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-25 04:02:42 +01:00

Initial support for Apple GPUs

This commit is contained in:
nastys 2022-01-18 00:25:59 +01:00 committed by Megamouse
parent 6b5f0957ce
commit c7140df5f8
8 changed files with 35 additions and 8 deletions

View File

@ -79,8 +79,8 @@ namespace vk
case vk::driver_vendor::NVIDIA: case vk::driver_vendor::NVIDIA:
// Warps are multiples of 32. Increasing kernel depth seems to hurt performance (Nier, Big Duck sample) // Warps are multiples of 32. Increasing kernel depth seems to hurt performance (Nier, Big Duck sample)
unroll_loops = true; unroll_loops = true;
optimal_group_size = 32;
optimal_kernel_size = 1; optimal_kernel_size = 1;
optimal_group_size = 32;
break; break;
case vk::driver_vendor::AMD: case vk::driver_vendor::AMD:
case vk::driver_vendor::RADV: case vk::driver_vendor::RADV:
@ -89,6 +89,11 @@ namespace vk
optimal_kernel_size = 1; optimal_kernel_size = 1;
optimal_group_size = 64; optimal_group_size = 64;
break; break;
case vk::driver_vendor::MVK:
unroll_loops = true;
optimal_kernel_size = 1;
optimal_group_size = 256;
break;
} }
const auto& gpu = vk::g_render_device->gpu(); const auto& gpu = vk::g_render_device->gpu();

View File

@ -603,6 +603,11 @@ VKGSRender::VKGSRender() : GSRender()
} }
break; break;
#endif #endif
case vk::driver_vendor::MVK:
// Async compute crashes immediately on Apple GPUs
rsx_log.error("Apple GPUs are incompatible with the current implementation of asynchronous texture decoding.");
backend_config.supports_asynchronous_compute = false;
break;
default: break; default: break;
} }

View File

@ -124,6 +124,9 @@ namespace vk
case driver_vendor::ANV: case driver_vendor::ANV:
// INTEL vulkan drivers are mostly OK, workarounds are applied when creating the device // INTEL vulkan drivers are mostly OK, workarounds are applied when creating the device
break; break;
case driver_vendor::MVK:
// Apple GPUs / moltenVK need more testing
break;
default: default:
rsx_log.warning("Unsupported device: %s", gpu_name); rsx_log.warning("Unsupported device: %s", gpu_name);
} }

View File

@ -115,6 +115,7 @@ namespace vk
[[ fallthrough ]]; [[ fallthrough ]];
case driver_vendor::NVIDIA: case driver_vendor::NVIDIA:
case driver_vendor::INTEL: case driver_vendor::INTEL:
case driver_vendor::MVK:
break; break;
} }
@ -453,4 +454,4 @@ namespace vk
void free_invalidated(vk::command_buffer& cmd, rsx::problem_severity memory_pressure); void free_invalidated(vk::command_buffer& cmd, rsx::problem_severity memory_pressure);
}; };
} }
//h //h

View File

@ -20,7 +20,8 @@ namespace vk
NV_pascal, NV_pascal,
NV_volta, NV_volta,
NV_turing, NV_turing,
NV_ampere NV_ampere,
MVK_apple
}; };
enum class driver_vendor enum class driver_vendor
@ -30,7 +31,8 @@ namespace vk
NVIDIA, NVIDIA,
RADV, RADV,
INTEL, INTEL,
ANV ANV,
MVK
}; };
driver_vendor get_driver_vendor(); driver_vendor get_driver_vendor();

View File

@ -183,9 +183,16 @@ namespace vk
driver_vendor physical_device::get_driver_vendor() const driver_vendor physical_device::get_driver_vendor() const
{ {
#ifdef __APPLE__
// moltenVK currently returns DRIVER_ID_MOLTENVK (0).
// For now, assume the vendor is moltenVK on Apple devices.
return driver_vendor::MVK;
#endif
if (!driver_properties.driverID) if (!driver_properties.driverID)
{ {
const auto gpu_name = get_name(); const auto gpu_name = get_name();
if (gpu_name.find("Radeon") != umax) if (gpu_name.find("Radeon") != umax)
{ {
return driver_vendor::AMD; return driver_vendor::AMD;

View File

@ -522,6 +522,7 @@ namespace vk
case driver_vendor::AMD: case driver_vendor::AMD:
case driver_vendor::INTEL: case driver_vendor::INTEL:
case driver_vendor::RADV: case driver_vendor::RADV:
case driver_vendor::MVK:
break; break;
case driver_vendor::ANV: case driver_vendor::ANV:
case driver_vendor::NVIDIA: case driver_vendor::NVIDIA:

View File

@ -73,11 +73,10 @@ struct cfg_root : cfg::node
cfg::uint64 tx_limit2_ns{this, "TSX Transaction Second Limit", 2000}; // In nanoseconds cfg::uint64 tx_limit2_ns{this, "TSX Transaction Second Limit", 2000}; // In nanoseconds
cfg::_int<10, 3000> clocks_scale{ this, "Clocks scale", 100 }; // Changing this from 100 (percentage) may affect game speed in unexpected ways cfg::_int<10, 3000> clocks_scale{ this, "Clocks scale", 100 }; // Changing this from 100 (percentage) may affect game speed in unexpected ways
cfg::_enum<sleep_timers_accuracy_level> sleep_timers_accuracy{ this, "Sleep Timers Accuracy", #if defined (__linux__) || defined (__APPLE__)
#ifdef __linux__ cfg::_enum<sleep_timers_accuracy_level> sleep_timers_accuracy{ this, "Sleep Timers Accuracy", sleep_timers_accuracy_level::_as_host, true };
sleep_timers_accuracy_level::_as_host, true };
#else #else
sleep_timers_accuracy_level::_usleep, true }; cfg::_enum<sleep_timers_accuracy_level> sleep_timers_accuracy{ this, "Sleep Timers Accuracy", sleep_timers_accuracy_level::_usleep, true };
#endif #endif
cfg::uint64 perf_report_threshold{this, "Performance Report Threshold", 500, true}; // In µs, 0.5ms = default, 0 = everything cfg::uint64 perf_report_threshold{this, "Performance Report Threshold", 500, true}; // In µs, 0.5ms = default, 0 = everything
@ -134,7 +133,11 @@ struct cfg_root : cfg::node
cfg::_bool disable_vulkan_mem_allocator{ this, "Disable Vulkan Memory Allocator", false }; cfg::_bool disable_vulkan_mem_allocator{ this, "Disable Vulkan Memory Allocator", false };
cfg::_bool full_rgb_range_output{ this, "Use full RGB output range", true, true }; // Video out dynamic range cfg::_bool full_rgb_range_output{ this, "Use full RGB output range", true, true }; // Video out dynamic range
cfg::_bool strict_texture_flushing{ this, "Strict Texture Flushing", false }; cfg::_bool strict_texture_flushing{ this, "Strict Texture Flushing", false };
#ifdef __APPLE__
cfg::_bool disable_native_float16{ this, "Disable native float16 support", true };
#else
cfg::_bool disable_native_float16{ this, "Disable native float16 support", false }; cfg::_bool disable_native_float16{ this, "Disable native float16 support", false };
#endif
cfg::_bool multithreaded_rsx{ this, "Multithreaded RSX", false }; cfg::_bool multithreaded_rsx{ this, "Multithreaded RSX", false };
cfg::_bool relaxed_zcull_sync{ this, "Relaxed ZCULL Sync", false }; cfg::_bool relaxed_zcull_sync{ this, "Relaxed ZCULL Sync", false };
cfg::_bool enable_3d{ this, "Enable 3D", false }; cfg::_bool enable_3d{ this, "Enable 3D", false };