diff options
| author | 2021-08-24 21:22:41 -0400 | |
|---|---|---|
| committer | 2021-08-24 21:22:41 -0400 | |
| commit | 4d535799eb8ae2b4c0f6acd13e84f914e55769a0 (patch) | |
| tree | 779be2e39890eabd2f667b6d0107c5daebb6f95f /src | |
| parent | Merge pull request #6878 from BreadFish64/optimize-GetHostThreadID (diff) | |
| download | yuzu-4d535799eb8ae2b4c0f6acd13e84f914e55769a0.tar.gz yuzu-4d535799eb8ae2b4c0f6acd13e84f914e55769a0.tar.xz yuzu-4d535799eb8ae2b4c0f6acd13e84f914e55769a0.zip | |
vulkan_device: Add a check for int8 support
Silences validation errors when shaders use int8 without specifying its support to the API
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_pipeline_cache.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_device.cpp | 16 | ||||
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_device.h | 10 |
3 files changed, 19 insertions, 9 deletions
diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp index a37ca1fdf..f316c4f92 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp | |||
| @@ -281,7 +281,7 @@ PipelineCache::PipelineCache(RasterizerVulkan& rasterizer_, Tegra::Engines::Maxw | |||
| 281 | .supported_spirv = device.IsKhrSpirv1_4Supported() ? 0x00010400U : 0x00010000U, | 281 | .supported_spirv = device.IsKhrSpirv1_4Supported() ? 0x00010400U : 0x00010000U, |
| 282 | .unified_descriptor_binding = true, | 282 | .unified_descriptor_binding = true, |
| 283 | .support_descriptor_aliasing = true, | 283 | .support_descriptor_aliasing = true, |
| 284 | .support_int8 = true, | 284 | .support_int8 = device.IsInt8Supported(), |
| 285 | .support_int16 = device.IsShaderInt16Supported(), | 285 | .support_int16 = device.IsShaderInt16Supported(), |
| 286 | .support_int64 = device.IsShaderInt64Supported(), | 286 | .support_int64 = device.IsShaderInt64Supported(), |
| 287 | .support_vertex_instance_id = false, | 287 | .support_vertex_instance_id = false, |
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp index 8e56a89e1..86ca4be54 100644 --- a/src/video_core/vulkan_common/vulkan_device.cpp +++ b/src/video_core/vulkan_common/vulkan_device.cpp | |||
| @@ -368,18 +368,21 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR | |||
| 368 | }; | 368 | }; |
| 369 | SetNext(next, demote); | 369 | SetNext(next, demote); |
| 370 | 370 | ||
| 371 | VkPhysicalDeviceFloat16Int8FeaturesKHR float16_int8; | 371 | if (is_int8_supported || is_float16_supported) { |
| 372 | if (is_float16_supported) { | 372 | VkPhysicalDeviceFloat16Int8FeaturesKHR float16_int8{ |
| 373 | float16_int8 = { | ||
| 374 | .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT16_INT8_FEATURES_KHR, | 373 | .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT16_INT8_FEATURES_KHR, |
| 375 | .pNext = nullptr, | 374 | .pNext = nullptr, |
| 376 | .shaderFloat16 = true, | 375 | .shaderFloat16 = is_float16_supported, |
| 377 | .shaderInt8 = false, | 376 | .shaderInt8 = is_int8_supported, |
| 378 | }; | 377 | }; |
| 379 | SetNext(next, float16_int8); | 378 | SetNext(next, float16_int8); |
| 380 | } else { | 379 | } |
| 380 | if (!is_float16_supported) { | ||
| 381 | LOG_INFO(Render_Vulkan, "Device doesn't support float16 natively"); | 381 | LOG_INFO(Render_Vulkan, "Device doesn't support float16 natively"); |
| 382 | } | 382 | } |
| 383 | if (!is_int8_supported) { | ||
| 384 | LOG_INFO(Render_Vulkan, "Device doesn't support int8 natively"); | ||
| 385 | } | ||
| 383 | 386 | ||
| 384 | if (!nv_viewport_swizzle) { | 387 | if (!nv_viewport_swizzle) { |
| 385 | LOG_INFO(Render_Vulkan, "Device doesn't support viewport swizzles"); | 388 | LOG_INFO(Render_Vulkan, "Device doesn't support viewport swizzles"); |
| @@ -909,6 +912,7 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) { | |||
| 909 | 912 | ||
| 910 | physical.GetFeatures2KHR(features); | 913 | physical.GetFeatures2KHR(features); |
| 911 | is_float16_supported = float16_int8_features.shaderFloat16; | 914 | is_float16_supported = float16_int8_features.shaderFloat16; |
| 915 | is_int8_supported = float16_int8_features.shaderInt8; | ||
| 912 | extensions.push_back(VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME); | 916 | extensions.push_back(VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME); |
| 913 | } | 917 | } |
| 914 | if (has_ext_subgroup_size_control) { | 918 | if (has_ext_subgroup_size_control) { |
diff --git a/src/video_core/vulkan_common/vulkan_device.h b/src/video_core/vulkan_common/vulkan_device.h index c19f40746..234d74129 100644 --- a/src/video_core/vulkan_common/vulkan_device.h +++ b/src/video_core/vulkan_common/vulkan_device.h | |||
| @@ -139,11 +139,16 @@ public: | |||
| 139 | return is_optimal_astc_supported; | 139 | return is_optimal_astc_supported; |
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | /// Returns true if the device supports float16 natively | 142 | /// Returns true if the device supports float16 natively. |
| 143 | bool IsFloat16Supported() const { | 143 | bool IsFloat16Supported() const { |
| 144 | return is_float16_supported; | 144 | return is_float16_supported; |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | /// Returns true if the device supports int8 natively. | ||
| 148 | bool IsInt8Supported() const { | ||
| 149 | return is_int8_supported; | ||
| 150 | } | ||
| 151 | |||
| 147 | /// Returns true if the device warp size can potentially be bigger than guest's warp size. | 152 | /// Returns true if the device warp size can potentially be bigger than guest's warp size. |
| 148 | bool IsWarpSizePotentiallyBiggerThanGuest() const { | 153 | bool IsWarpSizePotentiallyBiggerThanGuest() const { |
| 149 | return is_warp_potentially_bigger; | 154 | return is_warp_potentially_bigger; |
| @@ -367,7 +372,8 @@ private: | |||
| 367 | u64 device_access_memory{}; ///< Total size of device local memory in bytes. | 372 | u64 device_access_memory{}; ///< Total size of device local memory in bytes. |
| 368 | u32 max_push_descriptors{}; ///< Maximum number of push descriptors | 373 | u32 max_push_descriptors{}; ///< Maximum number of push descriptors |
| 369 | bool is_optimal_astc_supported{}; ///< Support for native ASTC. | 374 | bool is_optimal_astc_supported{}; ///< Support for native ASTC. |
| 370 | bool is_float16_supported{}; ///< Support for float16 arithmetics. | 375 | bool is_float16_supported{}; ///< Support for float16 arithmetic. |
| 376 | bool is_int8_supported{}; ///< Support for int8 arithmetic. | ||
| 371 | bool is_warp_potentially_bigger{}; ///< Host warp size can be bigger than guest. | 377 | bool is_warp_potentially_bigger{}; ///< Host warp size can be bigger than guest. |
| 372 | bool is_formatless_image_load_supported{}; ///< Support for shader image read without format. | 378 | bool is_formatless_image_load_supported{}; ///< Support for shader image read without format. |
| 373 | bool is_depth_bounds_supported{}; ///< Support for depth bounds. | 379 | bool is_depth_bounds_supported{}; ///< Support for depth bounds. |