vk: Properly initialize float64 support for SPIRV

This commit is contained in:
kd-11 2020-09-23 20:11:23 +03:00 committed by kd-11
parent 20f1eb865b
commit 9ea478008c
2 changed files with 11 additions and 1 deletions

View file

@ -276,6 +276,7 @@ namespace vk
struct gpu_shader_types_support
{
bool allow_float64;
bool allow_float16;
bool allow_int8;
};
@ -634,6 +635,7 @@ namespace vk
std::unordered_map<VkFormat, VkFormatProperties> format_properties;
gpu_shader_types_support shader_types_support{};
VkPhysicalDeviceDriverPropertiesKHR driver_properties{};
bool stencil_export_support = false;
bool conditional_render_support = false;
bool unrestricted_depth_range_support = false;
@ -680,6 +682,7 @@ private:
verify("vkGetInstanceProcAddress failed to find entry point!" HERE), getPhysicalDeviceFeatures2KHR;
getPhysicalDeviceFeatures2KHR(dev, &features2);
shader_types_support.allow_float64 = !!features2.features.shaderFloat64;
shader_types_support.allow_float16 = !!shader_support_info.shaderFloat16;
shader_types_support.allow_int8 = !!shader_support_info.shaderInt8;
features = features2.features;
@ -915,6 +918,7 @@ private:
enabled_features.depthBounds = VK_TRUE;
enabled_features.wideLines = VK_TRUE;
enabled_features.largePoints = VK_TRUE;
enabled_features.shaderFloat64 = VK_TRUE;
if (g_cfg.video.antialiasing_level != msaa_level::none)
{
@ -943,6 +947,12 @@ private:
enabled_features.shaderStorageBufferArrayDynamicIndexing = VK_TRUE;
// Optionally disable unsupported stuff
if (!pgpu->features.shaderFloat64)
{
rsx_log.error("Your GPU does not support double precision floats in shaders. Graphics may not work correctly.");
enabled_features.shaderFloat64 = VK_FALSE;
}
if (!pgpu->features.depthBounds)
{
rsx_log.error("Your GPU does not support depth bounds testing. Graphics may not work correctly.");

View file

@ -186,7 +186,7 @@ void VKVertexDecompilerThread::insertMainStart(std::stringstream & OS)
properties2.domain = glsl::glsl_vertex_program;
properties2.require_lit_emulation = properties.has_lit_op;
properties2.emulate_zclip_transform = true;
properties2.emulate_depth_clip_only = true;
properties2.emulate_depth_clip_only = vk::get_current_renderer()->get_shader_types_support().allow_float64;
glsl::insert_glsl_legacy_function(OS, properties2);
glsl::insert_vertex_input_fetch(OS, glsl::glsl_rules_spirv);