diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_texture_cache.cpp | 39 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_texture_cache.h | 2 | ||||
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_device.cpp | 9 | ||||
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_device.h | 5 |
4 files changed, 35 insertions, 20 deletions
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index c3050887c..0ba56ff1e 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp | |||
| @@ -1344,7 +1344,6 @@ bool Image::ScaleUp(bool ignore) { | |||
| 1344 | return false; | 1344 | return false; |
| 1345 | } | 1345 | } |
| 1346 | has_scaled = true; | 1346 | has_scaled = true; |
| 1347 | const auto& device = runtime->device; | ||
| 1348 | if (!scaled_image) { | 1347 | if (!scaled_image) { |
| 1349 | const bool is_2d = info.type == ImageType::e2D; | 1348 | const bool is_2d = info.type == ImageType::e2D; |
| 1350 | const u32 scaled_width = resolution.ScaleUp(info.size.width); | 1349 | const u32 scaled_width = resolution.ScaleUp(info.size.width); |
| @@ -1352,7 +1351,7 @@ bool Image::ScaleUp(bool ignore) { | |||
| 1352 | auto scaled_info = info; | 1351 | auto scaled_info = info; |
| 1353 | scaled_info.size.width = scaled_width; | 1352 | scaled_info.size.width = scaled_width; |
| 1354 | scaled_info.size.height = scaled_height; | 1353 | scaled_info.size.height = scaled_height; |
| 1355 | scaled_image = MakeImage(device, scaled_info); | 1354 | scaled_image = MakeImage(runtime->device, scaled_info); |
| 1356 | auto& allocator = runtime->memory_allocator; | 1355 | auto& allocator = runtime->memory_allocator; |
| 1357 | scaled_commit = MemoryCommit(allocator.Commit(scaled_image, MemoryUsage::DeviceLocal)); | 1356 | scaled_commit = MemoryCommit(allocator.Commit(scaled_image, MemoryUsage::DeviceLocal)); |
| 1358 | ignore = false; | 1357 | ignore = false; |
| @@ -1361,18 +1360,13 @@ bool Image::ScaleUp(bool ignore) { | |||
| 1361 | if (ignore) { | 1360 | if (ignore) { |
| 1362 | return true; | 1361 | return true; |
| 1363 | } | 1362 | } |
| 1364 | |||
| 1365 | if (aspect_mask == 0) { | 1363 | if (aspect_mask == 0) { |
| 1366 | aspect_mask = ImageAspectMask(info.format); | 1364 | aspect_mask = ImageAspectMask(info.format); |
| 1367 | } | 1365 | } |
| 1368 | static constexpr auto OPTIMAL_FORMAT = FormatType::Optimal; | 1366 | if (NeedsScaleHelper()) { |
| 1369 | const PixelFormat format = StorageFormat(info.format); | ||
| 1370 | const auto vk_format = MaxwellToVK::SurfaceFormat(device, OPTIMAL_FORMAT, false, format).format; | ||
| 1371 | const auto blit_usage = VK_FORMAT_FEATURE_BLIT_SRC_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT; | ||
| 1372 | if (device.IsFormatSupported(vk_format, blit_usage, OPTIMAL_FORMAT)) { | ||
| 1373 | BlitScale(*scheduler, *original_image, *scaled_image, info, aspect_mask, resolution); | ||
| 1374 | } else { | ||
| 1375 | return BlitScaleHelper(true); | 1367 | return BlitScaleHelper(true); |
| 1368 | } else { | ||
| 1369 | BlitScale(*scheduler, *original_image, *scaled_image, info, aspect_mask, resolution); | ||
| 1376 | } | 1370 | } |
| 1377 | return true; | 1371 | return true; |
| 1378 | } | 1372 | } |
| @@ -1394,15 +1388,10 @@ bool Image::ScaleDown(bool ignore) { | |||
| 1394 | if (aspect_mask == 0) { | 1388 | if (aspect_mask == 0) { |
| 1395 | aspect_mask = ImageAspectMask(info.format); | 1389 | aspect_mask = ImageAspectMask(info.format); |
| 1396 | } | 1390 | } |
| 1397 | static constexpr auto OPTIMAL_FORMAT = FormatType::Optimal; | 1391 | if (NeedsScaleHelper()) { |
| 1398 | const PixelFormat format = StorageFormat(info.format); | ||
| 1399 | const auto& device = runtime->device; | ||
| 1400 | const auto vk_format = MaxwellToVK::SurfaceFormat(device, OPTIMAL_FORMAT, false, format).format; | ||
| 1401 | const auto blit_usage = VK_FORMAT_FEATURE_BLIT_SRC_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT; | ||
| 1402 | if (device.IsFormatSupported(vk_format, blit_usage, OPTIMAL_FORMAT)) { | ||
| 1403 | BlitScale(*scheduler, *scaled_image, *original_image, info, aspect_mask, resolution, false); | ||
| 1404 | } else { | ||
| 1405 | return BlitScaleHelper(false); | 1392 | return BlitScaleHelper(false); |
| 1393 | } else { | ||
| 1394 | BlitScale(*scheduler, *scaled_image, *original_image, info, aspect_mask, resolution, false); | ||
| 1406 | } | 1395 | } |
| 1407 | return true; | 1396 | return true; |
| 1408 | } | 1397 | } |
| @@ -1470,6 +1459,20 @@ bool Image::BlitScaleHelper(bool scale_up) { | |||
| 1470 | return true; | 1459 | return true; |
| 1471 | } | 1460 | } |
| 1472 | 1461 | ||
| 1462 | bool Image::NeedsScaleHelper() const { | ||
| 1463 | const auto& device = runtime->device; | ||
| 1464 | const bool needs_msaa_helper = info.num_samples > 1 && device.CantBlitMSAA(); | ||
| 1465 | if (needs_msaa_helper) { | ||
| 1466 | return true; | ||
| 1467 | } | ||
| 1468 | static constexpr auto OPTIMAL_FORMAT = FormatType::Optimal; | ||
| 1469 | const PixelFormat format = StorageFormat(info.format); | ||
| 1470 | const auto vk_format = MaxwellToVK::SurfaceFormat(device, OPTIMAL_FORMAT, false, format).format; | ||
| 1471 | const auto blit_usage = VK_FORMAT_FEATURE_BLIT_SRC_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT; | ||
| 1472 | const bool needs_blit_helper = !device.IsFormatSupported(vk_format, blit_usage, OPTIMAL_FORMAT); | ||
| 1473 | return needs_blit_helper; | ||
| 1474 | } | ||
| 1475 | |||
| 1473 | ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewInfo& info, | 1476 | ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewInfo& info, |
| 1474 | ImageId image_id_, Image& image) | 1477 | ImageId image_id_, Image& image) |
| 1475 | : VideoCommon::ImageViewBase{info, image.info, image_id_}, device{&runtime.device}, | 1478 | : VideoCommon::ImageViewBase{info, image.info, image_id_}, device{&runtime.device}, |
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.h b/src/video_core/renderer_vulkan/vk_texture_cache.h index 2f12be78b..c81130dd2 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.h +++ b/src/video_core/renderer_vulkan/vk_texture_cache.h | |||
| @@ -149,6 +149,8 @@ public: | |||
| 149 | private: | 149 | private: |
| 150 | bool BlitScaleHelper(bool scale_up); | 150 | bool BlitScaleHelper(bool scale_up); |
| 151 | 151 | ||
| 152 | bool NeedsScaleHelper() const; | ||
| 153 | |||
| 152 | VKScheduler* scheduler{}; | 154 | VKScheduler* scheduler{}; |
| 153 | TextureCacheRuntime* runtime{}; | 155 | TextureCacheRuntime* runtime{}; |
| 154 | 156 | ||
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp index 9862b815b..3d78efddc 100644 --- a/src/video_core/vulkan_common/vulkan_device.cpp +++ b/src/video_core/vulkan_common/vulkan_device.cpp | |||
| @@ -638,15 +638,20 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR | |||
| 638 | } | 638 | } |
| 639 | } | 639 | } |
| 640 | 640 | ||
| 641 | if (ext_vertex_input_dynamic_state && driver_id == VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS) { | 641 | const bool is_intel_windows = driver_id == VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS; |
| 642 | if (ext_vertex_input_dynamic_state && is_intel_windows) { | ||
| 642 | LOG_WARNING(Render_Vulkan, "Blacklisting Intel for VK_EXT_vertex_input_dynamic_state"); | 643 | LOG_WARNING(Render_Vulkan, "Blacklisting Intel for VK_EXT_vertex_input_dynamic_state"); |
| 643 | ext_vertex_input_dynamic_state = false; | 644 | ext_vertex_input_dynamic_state = false; |
| 644 | } | 645 | } |
| 645 | if (is_float16_supported && driver_id == VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS) { | 646 | if (is_float16_supported && is_intel_windows) { |
| 646 | // Intel's compiler crashes when using fp16 on Astral Chain, disable it for the time being. | 647 | // Intel's compiler crashes when using fp16 on Astral Chain, disable it for the time being. |
| 647 | LOG_WARNING(Render_Vulkan, "Blacklisting Intel proprietary from float16 math"); | 648 | LOG_WARNING(Render_Vulkan, "Blacklisting Intel proprietary from float16 math"); |
| 648 | is_float16_supported = false; | 649 | is_float16_supported = false; |
| 649 | } | 650 | } |
| 651 | if (is_intel_windows) { | ||
| 652 | LOG_WARNING(Render_Vulkan, "Intel proprietary drivers do not support MSAA image blits"); | ||
| 653 | cant_blit_msaa = true; | ||
| 654 | } | ||
| 650 | 655 | ||
| 651 | supports_d24_depth = | 656 | supports_d24_depth = |
| 652 | IsFormatSupported(VK_FORMAT_D24_UNORM_S8_UINT, | 657 | IsFormatSupported(VK_FORMAT_D24_UNORM_S8_UINT, |
diff --git a/src/video_core/vulkan_common/vulkan_device.h b/src/video_core/vulkan_common/vulkan_device.h index 4c9d86aad..37d140ebd 100644 --- a/src/video_core/vulkan_common/vulkan_device.h +++ b/src/video_core/vulkan_common/vulkan_device.h | |||
| @@ -350,6 +350,10 @@ public: | |||
| 350 | return supports_d24_depth; | 350 | return supports_d24_depth; |
| 351 | } | 351 | } |
| 352 | 352 | ||
| 353 | bool CantBlitMSAA() const { | ||
| 354 | return cant_blit_msaa; | ||
| 355 | } | ||
| 356 | |||
| 353 | private: | 357 | private: |
| 354 | /// Checks if the physical device is suitable. | 358 | /// Checks if the physical device is suitable. |
| 355 | void CheckSuitability(bool requires_swapchain) const; | 359 | void CheckSuitability(bool requires_swapchain) const; |
| @@ -443,6 +447,7 @@ private: | |||
| 443 | bool has_renderdoc{}; ///< Has RenderDoc attached | 447 | bool has_renderdoc{}; ///< Has RenderDoc attached |
| 444 | bool has_nsight_graphics{}; ///< Has Nsight Graphics attached | 448 | bool has_nsight_graphics{}; ///< Has Nsight Graphics attached |
| 445 | bool supports_d24_depth{}; ///< Supports D24 depth buffers. | 449 | bool supports_d24_depth{}; ///< Supports D24 depth buffers. |
| 450 | bool cant_blit_msaa{}; ///< Does not support MSAA<->MSAA blitting. | ||
| 446 | 451 | ||
| 447 | // Telemetry parameters | 452 | // Telemetry parameters |
| 448 | std::string vendor_name; ///< Device's driver name. | 453 | std::string vendor_name; ///< Device's driver name. |