From b09f28c0bac78e8b070296a64f638d3d194e7855 Mon Sep 17 00:00:00 2001 From: PixelyIon Date: Sun, 5 Dec 2021 22:05:03 +0530 Subject: [PATCH] Implement Missing Shader Compiler Quirks Introduces the `supportsShaderViewportIndexLayer` quirk and sets `Shader::Profile::support_int64_atomics` depending on if the `supportsAtomicInt64` quirk is available. --- app/src/main/cpp/skyline/gpu/quirk_manager.cpp | 3 ++- app/src/main/cpp/skyline/gpu/quirk_manager.h | 1 + app/src/main/cpp/skyline/gpu/shader_manager.cpp | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/cpp/skyline/gpu/quirk_manager.cpp b/app/src/main/cpp/skyline/gpu/quirk_manager.cpp index 5f084f0f..5d291a2d 100644 --- a/app/src/main/cpp/skyline/gpu/quirk_manager.cpp +++ b/app/src/main/cpp/skyline/gpu/quirk_manager.cpp @@ -29,6 +29,7 @@ namespace skyline::gpu { switch (util::Hash(extensionName)) { EXT_SET("VK_EXT_provoking_vertex", supportsLastProvokingVertex); EXT_SET("VK_EXT_vertex_attribute_divisor", supportsVertexAttributeDivisor); + EXT_SET("VK_EXT_shader_viewport_index_layer", supportsShaderViewportIndexLayer); EXT_SET("VK_KHR_spirv_1_4", supportsSpirv14); EXT_SET("VK_KHR_shader_atomic_int64", hasShaderAtomicInt64); EXT_SET("VK_KHR_shader_float16_int8", hasShaderFloat16Int8Ext); @@ -83,6 +84,6 @@ namespace skyline::gpu { } std::string QuirkManager::Summary() { - return fmt::format("\n* Supports Last Provoking Vertex: {}\n* Supports Logical Operations: {}\n* Supports Vertex Attribute Divisor: {}\n* Supports Vertex Attribute Zero Divisor: {}\n* Supports Multiple Viewports: {}\n* Supports SPIR-V 1.4: {}\n* Supports 16-bit FP: {}\n* Supports 8-bit Integers: {}\n* Supports 16-bit Integers: {}\n* Supports 64-bit Integers: {}\n* Supports Atomic 64-bit Integers: {}\n* Supports Floating Point Behavior Control: {}\n* Supports Image Read Without Format: {}\n* Supports Subgroup Vote: {}\n* Subgroup Size: {}", supportsLastProvokingVertex, supportsLogicOp, supportsVertexAttributeDivisor, supportsVertexAttributeZeroDivisor, supportsMultipleViewports, supportsSpirv14, supportsFloat16, supportsInt8, supportsInt16, supportsInt64, supportsAtomicInt64, supportsFloatControls, supportsImageReadWithoutFormat, supportsSubgroupVote, subgroupSize); + return fmt::format("\n* Supports Last Provoking Vertex: {}\n* Supports Logical Operations: {}\n* Supports Vertex Attribute Divisor: {}\n* Supports Vertex Attribute Zero Divisor: {}\n* Supports Multiple Viewports: {}\n* Supports Shader Viewport Index: {}\n* Supports SPIR-V 1.4: {}\n* Supports 16-bit FP: {}\n* Supports 8-bit Integers: {}\n* Supports 16-bit Integers: {}\n* Supports 64-bit Integers: {}\n* Supports Atomic 64-bit Integers: {}\n* Supports Floating Point Behavior Control: {}\n* Supports Image Read Without Format: {}\n* Supports Subgroup Vote: {}\n* Subgroup Size: {}", supportsLastProvokingVertex, supportsLogicOp, supportsVertexAttributeDivisor, supportsVertexAttributeZeroDivisor, supportsMultipleViewports, supportsShaderViewportIndexLayer, supportsSpirv14, supportsFloat16, supportsInt8, supportsInt16, supportsInt64, supportsAtomicInt64, supportsFloatControls, supportsImageReadWithoutFormat, supportsSubgroupVote, subgroupSize); } } diff --git a/app/src/main/cpp/skyline/gpu/quirk_manager.h b/app/src/main/cpp/skyline/gpu/quirk_manager.h index 30c88c5f..58cc1ec1 100644 --- a/app/src/main/cpp/skyline/gpu/quirk_manager.h +++ b/app/src/main/cpp/skyline/gpu/quirk_manager.h @@ -17,6 +17,7 @@ namespace skyline::gpu { bool supportsVertexAttributeDivisor{}; //!< If the device supports a divisor for instance-rate vertex attributes (with VK_EXT_vertex_attribute_divisor) bool supportsVertexAttributeZeroDivisor{}; //!< If the device supports a zero divisor for instance-rate vertex attributes (with VK_EXT_vertex_attribute_divisor) bool supportsMultipleViewports{}; //!< If the device supports more than one viewport + bool supportsShaderViewportIndexLayer{}; //!< If the device supports retrieving the viewport index in shaders (with VK_EXT_shader_viewport_index_layer) bool supportsSpirv14{}; //!< If SPIR-V 1.4 is supported (with VK_KHR_spirv_1_4) bool supportsFloat16{}; //!< If 16-bit floating point integers are supported in shaders bool supportsInt8{}; //!< If 8-bit integers are supported in shaders diff --git a/app/src/main/cpp/skyline/gpu/shader_manager.cpp b/app/src/main/cpp/skyline/gpu/shader_manager.cpp index 504ef9d8..b46183be 100644 --- a/app/src/main/cpp/skyline/gpu/shader_manager.cpp +++ b/app/src/main/cpp/skyline/gpu/shader_manager.cpp @@ -50,11 +50,11 @@ namespace skyline::gpu { .support_fp64_signed_zero_nan_preserve = static_cast(quirks.floatControls.shaderSignedZeroInfNanPreserveFloat64), .support_explicit_workgroup_layout = false, .support_vote = quirks.supportsSubgroupVote, - .support_viewport_index_layer_non_geometry = false, + .support_viewport_index_layer_non_geometry = quirks.supportsShaderViewportIndexLayer, .support_viewport_mask = false, .support_typeless_image_loads = quirks.supportsImageReadWithoutFormat, .support_demote_to_helper_invocation = true, - .support_int64_atomics = false, + .support_int64_atomics = quirks.supportsAtomicInt64, .support_derivative_control = true, .support_geometry_shader_passthrough = false, .warp_size_potentially_larger_than_guest = TegraX1WarpSize < quirks.subgroupSize,