diff options
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 1 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/maxwell_to_gl.h | 38 | ||||
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_device.cpp | 50 | ||||
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_device.h | 1 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 5 |
5 files changed, 22 insertions, 73 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index ecffc6abf..418644108 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -38,6 +38,7 @@ | |||
| 38 | namespace OpenGL { | 38 | namespace OpenGL { |
| 39 | 39 | ||
| 40 | using Maxwell = Tegra::Engines::Maxwell3D::Regs; | 40 | using Maxwell = Tegra::Engines::Maxwell3D::Regs; |
| 41 | using GLvec4 = std::array<GLfloat, 4>; | ||
| 41 | 42 | ||
| 42 | using Tegra::Engines::ShaderType; | 43 | using Tegra::Engines::ShaderType; |
| 43 | using VideoCore::Surface::PixelFormat; | 44 | using VideoCore::Surface::PixelFormat; |
diff --git a/src/video_core/renderer_opengl/maxwell_to_gl.h b/src/video_core/renderer_opengl/maxwell_to_gl.h index cbccfdeb4..f7ad8f370 100644 --- a/src/video_core/renderer_opengl/maxwell_to_gl.h +++ b/src/video_core/renderer_opengl/maxwell_to_gl.h | |||
| @@ -4,23 +4,10 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <array> | ||
| 8 | #include <glad/glad.h> | 7 | #include <glad/glad.h> |
| 9 | #include "common/common_types.h" | ||
| 10 | #include "common/logging/log.h" | ||
| 11 | #include "video_core/engines/maxwell_3d.h" | 8 | #include "video_core/engines/maxwell_3d.h" |
| 12 | 9 | ||
| 13 | namespace OpenGL { | 10 | namespace OpenGL::MaxwellToGL { |
| 14 | |||
| 15 | using GLvec2 = std::array<GLfloat, 2>; | ||
| 16 | using GLvec3 = std::array<GLfloat, 3>; | ||
| 17 | using GLvec4 = std::array<GLfloat, 4>; | ||
| 18 | |||
| 19 | using GLuvec2 = std::array<GLuint, 2>; | ||
| 20 | using GLuvec3 = std::array<GLuint, 3>; | ||
| 21 | using GLuvec4 = std::array<GLuint, 4>; | ||
| 22 | |||
| 23 | namespace MaxwellToGL { | ||
| 24 | 11 | ||
| 25 | using Maxwell = Tegra::Engines::Maxwell3D::Regs; | 12 | using Maxwell = Tegra::Engines::Maxwell3D::Regs; |
| 26 | 13 | ||
| @@ -317,26 +304,6 @@ inline GLenum BlendFunc(Maxwell::Blend::Factor factor) { | |||
| 317 | return GL_ZERO; | 304 | return GL_ZERO; |
| 318 | } | 305 | } |
| 319 | 306 | ||
| 320 | inline GLenum SwizzleSource(Tegra::Texture::SwizzleSource source) { | ||
| 321 | switch (source) { | ||
| 322 | case Tegra::Texture::SwizzleSource::Zero: | ||
| 323 | return GL_ZERO; | ||
| 324 | case Tegra::Texture::SwizzleSource::R: | ||
| 325 | return GL_RED; | ||
| 326 | case Tegra::Texture::SwizzleSource::G: | ||
| 327 | return GL_GREEN; | ||
| 328 | case Tegra::Texture::SwizzleSource::B: | ||
| 329 | return GL_BLUE; | ||
| 330 | case Tegra::Texture::SwizzleSource::A: | ||
| 331 | return GL_ALPHA; | ||
| 332 | case Tegra::Texture::SwizzleSource::OneInt: | ||
| 333 | case Tegra::Texture::SwizzleSource::OneFloat: | ||
| 334 | return GL_ONE; | ||
| 335 | } | ||
| 336 | UNIMPLEMENTED_MSG("Unimplemented swizzle source={}", source); | ||
| 337 | return GL_ZERO; | ||
| 338 | } | ||
| 339 | |||
| 340 | inline GLenum ComparisonOp(Maxwell::ComparisonOp comparison) { | 307 | inline GLenum ComparisonOp(Maxwell::ComparisonOp comparison) { |
| 341 | switch (comparison) { | 308 | switch (comparison) { |
| 342 | case Maxwell::ComparisonOp::Never: | 309 | case Maxwell::ComparisonOp::Never: |
| @@ -493,5 +460,4 @@ inline GLenum ViewportSwizzle(Maxwell::ViewportSwizzle swizzle) { | |||
| 493 | return GL_VIEWPORT_SWIZZLE_POSITIVE_X_NV + static_cast<GLenum>(swizzle); | 460 | return GL_VIEWPORT_SWIZZLE_POSITIVE_X_NV + static_cast<GLenum>(swizzle); |
| 494 | } | 461 | } |
| 495 | 462 | ||
| 496 | } // namespace MaxwellToGL | 463 | } // namespace OpenGL::MaxwellToGL |
| 497 | } // namespace OpenGL | ||
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp index f9bc73f84..34d396434 100644 --- a/src/video_core/vulkan_common/vulkan_device.cpp +++ b/src/video_core/vulkan_common/vulkan_device.cpp | |||
| @@ -46,6 +46,7 @@ constexpr std::array REQUIRED_EXTENSIONS{ | |||
| 46 | VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME, | 46 | VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME, |
| 47 | VK_EXT_SHADER_SUBGROUP_BALLOT_EXTENSION_NAME, | 47 | VK_EXT_SHADER_SUBGROUP_BALLOT_EXTENSION_NAME, |
| 48 | VK_EXT_SHADER_SUBGROUP_VOTE_EXTENSION_NAME, | 48 | VK_EXT_SHADER_SUBGROUP_VOTE_EXTENSION_NAME, |
| 49 | VK_EXT_ROBUSTNESS_2_EXTENSION_NAME, | ||
| 49 | VK_EXT_HOST_QUERY_RESET_EXTENSION_NAME, | 50 | VK_EXT_HOST_QUERY_RESET_EXTENSION_NAME, |
| 50 | #ifdef _WIN32 | 51 | #ifdef _WIN32 |
| 51 | VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME, | 52 | VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME, |
| @@ -379,20 +380,6 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR | |||
| 379 | LOG_INFO(Render_Vulkan, "Device doesn't support extended dynamic state"); | 380 | LOG_INFO(Render_Vulkan, "Device doesn't support extended dynamic state"); |
| 380 | } | 381 | } |
| 381 | 382 | ||
| 382 | VkPhysicalDeviceRobustness2FeaturesEXT robustness2; | ||
| 383 | if (ext_robustness2) { | ||
| 384 | robustness2 = { | ||
| 385 | .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT, | ||
| 386 | .pNext = nullptr, | ||
| 387 | .robustBufferAccess2 = true, | ||
| 388 | .robustImageAccess2 = true, | ||
| 389 | .nullDescriptor = true, | ||
| 390 | }; | ||
| 391 | SetNext(next, robustness2); | ||
| 392 | } else { | ||
| 393 | LOG_INFO(Render_Vulkan, "Device doesn't support robustness2"); | ||
| 394 | } | ||
| 395 | |||
| 396 | if (!ext_depth_range_unrestricted) { | 383 | if (!ext_depth_range_unrestricted) { |
| 397 | LOG_INFO(Render_Vulkan, "Device doesn't support depth range unrestricted"); | 384 | LOG_INFO(Render_Vulkan, "Device doesn't support depth range unrestricted"); |
| 398 | } | 385 | } |
| @@ -579,7 +566,16 @@ void Device::CheckSuitability(bool requires_swapchain) const { | |||
| 579 | throw vk::Exception(VK_ERROR_FEATURE_NOT_PRESENT); | 566 | throw vk::Exception(VK_ERROR_FEATURE_NOT_PRESENT); |
| 580 | } | 567 | } |
| 581 | } | 568 | } |
| 582 | const VkPhysicalDeviceFeatures features{physical.GetFeatures()}; | 569 | VkPhysicalDeviceRobustness2FeaturesEXT robustness2{}; |
| 570 | robustness2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT; | ||
| 571 | |||
| 572 | VkPhysicalDeviceFeatures2 features2{}; | ||
| 573 | features2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2; | ||
| 574 | features2.pNext = &robustness2; | ||
| 575 | |||
| 576 | physical.GetFeatures2KHR(features2); | ||
| 577 | |||
| 578 | const VkPhysicalDeviceFeatures& features{features2.features}; | ||
| 583 | const std::array feature_report{ | 579 | const std::array feature_report{ |
| 584 | std::make_pair(features.robustBufferAccess, "robustBufferAccess"), | 580 | std::make_pair(features.robustBufferAccess, "robustBufferAccess"), |
| 585 | std::make_pair(features.vertexPipelineStoresAndAtomics, "vertexPipelineStoresAndAtomics"), | 581 | std::make_pair(features.vertexPipelineStoresAndAtomics, "vertexPipelineStoresAndAtomics"), |
| @@ -598,6 +594,9 @@ void Device::CheckSuitability(bool requires_swapchain) const { | |||
| 598 | std::make_pair(features.shaderImageGatherExtended, "shaderImageGatherExtended"), | 594 | std::make_pair(features.shaderImageGatherExtended, "shaderImageGatherExtended"), |
| 599 | std::make_pair(features.shaderStorageImageWriteWithoutFormat, | 595 | std::make_pair(features.shaderStorageImageWriteWithoutFormat, |
| 600 | "shaderStorageImageWriteWithoutFormat"), | 596 | "shaderStorageImageWriteWithoutFormat"), |
| 597 | std::make_pair(robustness2.robustBufferAccess2, "robustBufferAccess2"), | ||
| 598 | std::make_pair(robustness2.robustImageAccess2, "robustImageAccess2"), | ||
| 599 | std::make_pair(robustness2.nullDescriptor, "nullDescriptor"), | ||
| 601 | }; | 600 | }; |
| 602 | for (const auto& [is_supported, name] : feature_report) { | 601 | for (const auto& [is_supported, name] : feature_report) { |
| 603 | if (is_supported) { | 602 | if (is_supported) { |
| @@ -621,7 +620,6 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) { | |||
| 621 | bool has_ext_transform_feedback{}; | 620 | bool has_ext_transform_feedback{}; |
| 622 | bool has_ext_custom_border_color{}; | 621 | bool has_ext_custom_border_color{}; |
| 623 | bool has_ext_extended_dynamic_state{}; | 622 | bool has_ext_extended_dynamic_state{}; |
| 624 | bool has_ext_robustness2{}; | ||
| 625 | for (const VkExtensionProperties& extension : physical.EnumerateDeviceExtensionProperties()) { | 623 | for (const VkExtensionProperties& extension : physical.EnumerateDeviceExtensionProperties()) { |
| 626 | const auto test = [&](std::optional<std::reference_wrapper<bool>> status, const char* name, | 624 | const auto test = [&](std::optional<std::reference_wrapper<bool>> status, const char* name, |
| 627 | bool push) { | 625 | bool push) { |
| @@ -649,14 +647,12 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) { | |||
| 649 | test(has_ext_transform_feedback, VK_EXT_TRANSFORM_FEEDBACK_EXTENSION_NAME, false); | 647 | test(has_ext_transform_feedback, VK_EXT_TRANSFORM_FEEDBACK_EXTENSION_NAME, false); |
| 650 | test(has_ext_custom_border_color, VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME, false); | 648 | test(has_ext_custom_border_color, VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME, false); |
| 651 | test(has_ext_extended_dynamic_state, VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME, false); | 649 | test(has_ext_extended_dynamic_state, VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME, false); |
| 652 | test(has_ext_robustness2, VK_EXT_ROBUSTNESS_2_EXTENSION_NAME, false); | ||
| 653 | test(has_ext_subgroup_size_control, VK_EXT_SUBGROUP_SIZE_CONTROL_EXTENSION_NAME, false); | 650 | test(has_ext_subgroup_size_control, VK_EXT_SUBGROUP_SIZE_CONTROL_EXTENSION_NAME, false); |
| 654 | if (Settings::values.renderer_debug) { | 651 | if (Settings::values.renderer_debug) { |
| 655 | test(nv_device_diagnostics_config, VK_NV_DEVICE_DIAGNOSTICS_CONFIG_EXTENSION_NAME, | 652 | test(nv_device_diagnostics_config, VK_NV_DEVICE_DIAGNOSTICS_CONFIG_EXTENSION_NAME, |
| 656 | true); | 653 | true); |
| 657 | } | 654 | } |
| 658 | } | 655 | } |
| 659 | |||
| 660 | VkPhysicalDeviceFeatures2KHR features; | 656 | VkPhysicalDeviceFeatures2KHR features; |
| 661 | features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR; | 657 | features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR; |
| 662 | 658 | ||
| @@ -673,7 +669,6 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) { | |||
| 673 | is_float16_supported = float16_int8_features.shaderFloat16; | 669 | is_float16_supported = float16_int8_features.shaderFloat16; |
| 674 | extensions.push_back(VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME); | 670 | extensions.push_back(VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME); |
| 675 | } | 671 | } |
| 676 | |||
| 677 | if (has_ext_subgroup_size_control) { | 672 | if (has_ext_subgroup_size_control) { |
| 678 | VkPhysicalDeviceSubgroupSizeControlFeaturesEXT subgroup_features; | 673 | VkPhysicalDeviceSubgroupSizeControlFeaturesEXT subgroup_features; |
| 679 | subgroup_features.sType = | 674 | subgroup_features.sType = |
| @@ -700,7 +695,6 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) { | |||
| 700 | } else { | 695 | } else { |
| 701 | is_warp_potentially_bigger = true; | 696 | is_warp_potentially_bigger = true; |
| 702 | } | 697 | } |
| 703 | |||
| 704 | if (has_ext_transform_feedback) { | 698 | if (has_ext_transform_feedback) { |
| 705 | VkPhysicalDeviceTransformFeedbackFeaturesEXT tfb_features; | 699 | VkPhysicalDeviceTransformFeedbackFeaturesEXT tfb_features; |
| 706 | tfb_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT; | 700 | tfb_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT; |
| @@ -722,7 +716,6 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) { | |||
| 722 | ext_transform_feedback = true; | 716 | ext_transform_feedback = true; |
| 723 | } | 717 | } |
| 724 | } | 718 | } |
| 725 | |||
| 726 | if (has_ext_custom_border_color) { | 719 | if (has_ext_custom_border_color) { |
| 727 | VkPhysicalDeviceCustomBorderColorFeaturesEXT border_features; | 720 | VkPhysicalDeviceCustomBorderColorFeaturesEXT border_features; |
| 728 | border_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_FEATURES_EXT; | 721 | border_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_FEATURES_EXT; |
| @@ -735,7 +728,6 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) { | |||
| 735 | ext_custom_border_color = true; | 728 | ext_custom_border_color = true; |
| 736 | } | 729 | } |
| 737 | } | 730 | } |
| 738 | |||
| 739 | if (has_ext_extended_dynamic_state) { | 731 | if (has_ext_extended_dynamic_state) { |
| 740 | VkPhysicalDeviceExtendedDynamicStateFeaturesEXT dynamic_state; | 732 | VkPhysicalDeviceExtendedDynamicStateFeaturesEXT dynamic_state; |
| 741 | dynamic_state.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT; | 733 | dynamic_state.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT; |
| @@ -748,20 +740,6 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) { | |||
| 748 | ext_extended_dynamic_state = true; | 740 | ext_extended_dynamic_state = true; |
| 749 | } | 741 | } |
| 750 | } | 742 | } |
| 751 | |||
| 752 | if (has_ext_robustness2) { | ||
| 753 | VkPhysicalDeviceRobustness2FeaturesEXT robustness2; | ||
| 754 | robustness2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT; | ||
| 755 | robustness2.pNext = nullptr; | ||
| 756 | features.pNext = &robustness2; | ||
| 757 | physical.GetFeatures2KHR(features); | ||
| 758 | if (robustness2.nullDescriptor && robustness2.robustBufferAccess2 && | ||
| 759 | robustness2.robustImageAccess2) { | ||
| 760 | extensions.push_back(VK_EXT_ROBUSTNESS_2_EXTENSION_NAME); | ||
| 761 | ext_robustness2 = true; | ||
| 762 | } | ||
| 763 | } | ||
| 764 | |||
| 765 | return extensions; | 743 | return extensions; |
| 766 | } | 744 | } |
| 767 | 745 | ||
diff --git a/src/video_core/vulkan_common/vulkan_device.h b/src/video_core/vulkan_common/vulkan_device.h index e0711f733..67d70cd22 100644 --- a/src/video_core/vulkan_common/vulkan_device.h +++ b/src/video_core/vulkan_common/vulkan_device.h | |||
| @@ -285,7 +285,6 @@ private: | |||
| 285 | bool ext_transform_feedback{}; ///< Support for VK_EXT_transform_feedback. | 285 | bool ext_transform_feedback{}; ///< Support for VK_EXT_transform_feedback. |
| 286 | bool ext_custom_border_color{}; ///< Support for VK_EXT_custom_border_color. | 286 | bool ext_custom_border_color{}; ///< Support for VK_EXT_custom_border_color. |
| 287 | bool ext_extended_dynamic_state{}; ///< Support for VK_EXT_extended_dynamic_state. | 287 | bool ext_extended_dynamic_state{}; ///< Support for VK_EXT_extended_dynamic_state. |
| 288 | bool ext_robustness2{}; ///< Support for VK_EXT_robustness2. | ||
| 289 | bool ext_shader_stencil_export{}; ///< Support for VK_EXT_shader_stencil_export. | 288 | bool ext_shader_stencil_export{}; ///< Support for VK_EXT_shader_stencil_export. |
| 290 | bool nv_device_diagnostics_config{}; ///< Support for VK_NV_device_diagnostics_config. | 289 | bool nv_device_diagnostics_config{}; ///< Support for VK_NV_device_diagnostics_config. |
| 291 | bool has_renderdoc{}; ///< Has RenderDoc attached | 290 | bool has_renderdoc{}; ///< Has RenderDoc attached |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 52218eb70..28a52a56c 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -2490,6 +2490,11 @@ void GMainWindow::OnCaptureScreenshot() { | |||
| 2490 | .arg(title_id, 16, 16, QLatin1Char{'0'}) | 2490 | .arg(title_id, 16, 16, QLatin1Char{'0'}) |
| 2491 | .arg(date); | 2491 | .arg(date); |
| 2492 | 2492 | ||
| 2493 | if (!Common::FS::CreateDir(screenshot_path.toStdString())) { | ||
| 2494 | OnStartGame(); | ||
| 2495 | return; | ||
| 2496 | } | ||
| 2497 | |||
| 2493 | #ifdef _WIN32 | 2498 | #ifdef _WIN32 |
| 2494 | if (UISettings::values.enable_screenshot_save_as) { | 2499 | if (UISettings::values.enable_screenshot_save_as) { |
| 2495 | filename = QFileDialog::getSaveFileName(this, tr("Capture Screenshot"), filename, | 2500 | filename = QFileDialog::getSaveFileName(this, tr("Capture Screenshot"), filename, |