2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Merge pull request #6919 from ameerj/vk-int8-capability

vulkan_device: Add a check for int8 support
This commit is contained in:
Fernando S 2021-08-25 23:46:08 +02:00 committed by GitHub
commit 3843995ceb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 9 deletions

View file

@ -281,7 +281,7 @@ PipelineCache::PipelineCache(RasterizerVulkan& rasterizer_, Tegra::Engines::Maxw
.supported_spirv = device.IsKhrSpirv1_4Supported() ? 0x00010400U : 0x00010000U, .supported_spirv = device.IsKhrSpirv1_4Supported() ? 0x00010400U : 0x00010000U,
.unified_descriptor_binding = true, .unified_descriptor_binding = true,
.support_descriptor_aliasing = true, .support_descriptor_aliasing = true,
.support_int8 = true, .support_int8 = device.IsInt8Supported(),
.support_int16 = device.IsShaderInt16Supported(), .support_int16 = device.IsShaderInt16Supported(),
.support_int64 = device.IsShaderInt64Supported(), .support_int64 = device.IsShaderInt64Supported(),
.support_vertex_instance_id = false, .support_vertex_instance_id = false,

View file

@ -368,18 +368,21 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
}; };
SetNext(next, demote); SetNext(next, demote);
VkPhysicalDeviceFloat16Int8FeaturesKHR float16_int8; if (is_int8_supported || is_float16_supported) {
if (is_float16_supported) { VkPhysicalDeviceFloat16Int8FeaturesKHR float16_int8{
float16_int8 = {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT16_INT8_FEATURES_KHR, .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT16_INT8_FEATURES_KHR,
.pNext = nullptr, .pNext = nullptr,
.shaderFloat16 = true, .shaderFloat16 = is_float16_supported,
.shaderInt8 = false, .shaderInt8 = is_int8_supported,
}; };
SetNext(next, float16_int8); SetNext(next, float16_int8);
} else { }
if (!is_float16_supported) {
LOG_INFO(Render_Vulkan, "Device doesn't support float16 natively"); LOG_INFO(Render_Vulkan, "Device doesn't support float16 natively");
} }
if (!is_int8_supported) {
LOG_INFO(Render_Vulkan, "Device doesn't support int8 natively");
}
if (!nv_viewport_swizzle) { if (!nv_viewport_swizzle) {
LOG_INFO(Render_Vulkan, "Device doesn't support viewport swizzles"); LOG_INFO(Render_Vulkan, "Device doesn't support viewport swizzles");
@ -909,6 +912,7 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) {
physical.GetFeatures2KHR(features); physical.GetFeatures2KHR(features);
is_float16_supported = float16_int8_features.shaderFloat16; is_float16_supported = float16_int8_features.shaderFloat16;
is_int8_supported = float16_int8_features.shaderInt8;
extensions.push_back(VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME); extensions.push_back(VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME);
} }
if (has_ext_subgroup_size_control) { if (has_ext_subgroup_size_control) {

View file

@ -139,11 +139,16 @@ public:
return is_optimal_astc_supported; return is_optimal_astc_supported;
} }
/// Returns true if the device supports float16 natively /// Returns true if the device supports float16 natively.
bool IsFloat16Supported() const { bool IsFloat16Supported() const {
return is_float16_supported; return is_float16_supported;
} }
/// Returns true if the device supports int8 natively.
bool IsInt8Supported() const {
return is_int8_supported;
}
/// Returns true if the device warp size can potentially be bigger than guest's warp size. /// Returns true if the device warp size can potentially be bigger than guest's warp size.
bool IsWarpSizePotentiallyBiggerThanGuest() const { bool IsWarpSizePotentiallyBiggerThanGuest() const {
return is_warp_potentially_bigger; return is_warp_potentially_bigger;
@ -367,7 +372,8 @@ private:
u64 device_access_memory{}; ///< Total size of device local memory in bytes. u64 device_access_memory{}; ///< Total size of device local memory in bytes.
u32 max_push_descriptors{}; ///< Maximum number of push descriptors u32 max_push_descriptors{}; ///< Maximum number of push descriptors
bool is_optimal_astc_supported{}; ///< Support for native ASTC. bool is_optimal_astc_supported{}; ///< Support for native ASTC.
bool is_float16_supported{}; ///< Support for float16 arithmetics. bool is_float16_supported{}; ///< Support for float16 arithmetic.
bool is_int8_supported{}; ///< Support for int8 arithmetic.
bool is_warp_potentially_bigger{}; ///< Host warp size can be bigger than guest. bool is_warp_potentially_bigger{}; ///< Host warp size can be bigger than guest.
bool is_formatless_image_load_supported{}; ///< Support for shader image read without format. bool is_formatless_image_load_supported{}; ///< Support for shader image read without format.
bool is_depth_bounds_supported{}; ///< Support for depth bounds. bool is_depth_bounds_supported{}; ///< Support for depth bounds.