summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/shader_recompiler/backend/spirv/emit_spirv.cpp13
-rw-r--r--src/shader_recompiler/profile.h2
-rw-r--r--src/video_core/renderer_opengl/gl_shader_cache.cpp1
-rw-r--r--src/video_core/renderer_vulkan/vk_pipeline_cache.cpp1
4 files changed, 12 insertions, 5 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv.cpp b/src/shader_recompiler/backend/spirv/emit_spirv.cpp
index ddb86d070..d7a86e270 100644
--- a/src/shader_recompiler/backend/spirv/emit_spirv.cpp
+++ b/src/shader_recompiler/backend/spirv/emit_spirv.cpp
@@ -319,7 +319,7 @@ void SetupDenormControl(const Profile& profile, const IR::Program& program, Emit
319 Id main_func) { 319 Id main_func) {
320 const Info& info{program.info}; 320 const Info& info{program.info};
321 if (info.uses_fp32_denorms_flush && info.uses_fp32_denorms_preserve) { 321 if (info.uses_fp32_denorms_flush && info.uses_fp32_denorms_preserve) {
322 LOG_WARNING(Shader_SPIRV, "Fp32 denorm flush and preserve on the same shader"); 322 LOG_DEBUG(Shader_SPIRV, "Fp32 denorm flush and preserve on the same shader");
323 } else if (info.uses_fp32_denorms_flush) { 323 } else if (info.uses_fp32_denorms_flush) {
324 if (profile.support_fp32_denorm_flush) { 324 if (profile.support_fp32_denorm_flush) {
325 ctx.AddCapability(spv::Capability::DenormFlushToZero); 325 ctx.AddCapability(spv::Capability::DenormFlushToZero);
@@ -332,15 +332,15 @@ void SetupDenormControl(const Profile& profile, const IR::Program& program, Emit
332 ctx.AddCapability(spv::Capability::DenormPreserve); 332 ctx.AddCapability(spv::Capability::DenormPreserve);
333 ctx.AddExecutionMode(main_func, spv::ExecutionMode::DenormPreserve, 32U); 333 ctx.AddExecutionMode(main_func, spv::ExecutionMode::DenormPreserve, 32U);
334 } else { 334 } else {
335 LOG_WARNING(Shader_SPIRV, "Fp32 denorm preserve used in shader without host support"); 335 LOG_DEBUG(Shader_SPIRV, "Fp32 denorm preserve used in shader without host support");
336 } 336 }
337 } 337 }
338 if (!profile.support_separate_denorm_behavior) { 338 if (!profile.support_separate_denorm_behavior || profile.has_broken_fp16_float_controls) {
339 // No separate denorm behavior 339 // No separate denorm behavior
340 return; 340 return;
341 } 341 }
342 if (info.uses_fp16_denorms_flush && info.uses_fp16_denorms_preserve) { 342 if (info.uses_fp16_denorms_flush && info.uses_fp16_denorms_preserve) {
343 LOG_WARNING(Shader_SPIRV, "Fp16 denorm flush and preserve on the same shader"); 343 LOG_DEBUG(Shader_SPIRV, "Fp16 denorm flush and preserve on the same shader");
344 } else if (info.uses_fp16_denorms_flush) { 344 } else if (info.uses_fp16_denorms_flush) {
345 if (profile.support_fp16_denorm_flush) { 345 if (profile.support_fp16_denorm_flush) {
346 ctx.AddCapability(spv::Capability::DenormFlushToZero); 346 ctx.AddCapability(spv::Capability::DenormFlushToZero);
@@ -353,13 +353,16 @@ void SetupDenormControl(const Profile& profile, const IR::Program& program, Emit
353 ctx.AddCapability(spv::Capability::DenormPreserve); 353 ctx.AddCapability(spv::Capability::DenormPreserve);
354 ctx.AddExecutionMode(main_func, spv::ExecutionMode::DenormPreserve, 16U); 354 ctx.AddExecutionMode(main_func, spv::ExecutionMode::DenormPreserve, 16U);
355 } else { 355 } else {
356 LOG_WARNING(Shader_SPIRV, "Fp16 denorm preserve used in shader without host support"); 356 LOG_DEBUG(Shader_SPIRV, "Fp16 denorm preserve used in shader without host support");
357 } 357 }
358 } 358 }
359} 359}
360 360
361void SetupSignedNanCapabilities(const Profile& profile, const IR::Program& program, 361void SetupSignedNanCapabilities(const Profile& profile, const IR::Program& program,
362 EmitContext& ctx, Id main_func) { 362 EmitContext& ctx, Id main_func) {
363 if (profile.has_broken_fp16_float_controls && program.info.uses_fp16) {
364 return;
365 }
363 if (program.info.uses_fp16 && profile.support_fp16_signed_zero_nan_preserve) { 366 if (program.info.uses_fp16 && profile.support_fp16_signed_zero_nan_preserve) {
364 ctx.AddCapability(spv::Capability::SignedZeroInfNanPreserve); 367 ctx.AddCapability(spv::Capability::SignedZeroInfNanPreserve);
365 ctx.AddExecutionMode(main_func, spv::ExecutionMode::SignedZeroInfNanPreserve, 16U); 368 ctx.AddExecutionMode(main_func, spv::ExecutionMode::SignedZeroInfNanPreserve, 16U);
diff --git a/src/shader_recompiler/profile.h b/src/shader_recompiler/profile.h
index ee1887b56..6ff12387b 100644
--- a/src/shader_recompiler/profile.h
+++ b/src/shader_recompiler/profile.h
@@ -58,6 +58,8 @@ struct Profile {
58 bool has_broken_unsigned_image_offsets{}; 58 bool has_broken_unsigned_image_offsets{};
59 /// Signed instructions with unsigned data types are misinterpreted 59 /// Signed instructions with unsigned data types are misinterpreted
60 bool has_broken_signed_operations{}; 60 bool has_broken_signed_operations{};
61 /// Float controls break when fp16 is enabled
62 bool has_broken_fp16_float_controls{};
61 /// Dynamic vec4 indexing is broken on some OpenGL drivers 63 /// Dynamic vec4 indexing is broken on some OpenGL drivers
62 bool has_gl_component_indexing_bug{}; 64 bool has_gl_component_indexing_bug{};
63 /// The precise type qualifier is broken in the fragment stage of some drivers 65 /// The precise type qualifier is broken in the fragment stage of some drivers
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp
index cde0f54c9..2ea9c9f07 100644
--- a/src/video_core/renderer_opengl/gl_shader_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp
@@ -206,6 +206,7 @@ ShaderCache::ShaderCache(RasterizerOpenGL& rasterizer_, Core::Frontend::EmuWindo
206 .has_broken_spirv_clamp = true, 206 .has_broken_spirv_clamp = true,
207 .has_broken_unsigned_image_offsets = true, 207 .has_broken_unsigned_image_offsets = true,
208 .has_broken_signed_operations = true, 208 .has_broken_signed_operations = true,
209 .has_broken_fp16_float_controls = false,
209 .has_gl_component_indexing_bug = device.HasComponentIndexingBug(), 210 .has_gl_component_indexing_bug = device.HasComponentIndexingBug(),
210 .has_gl_precise_bug = device.HasPreciseBug(), 211 .has_gl_precise_bug = device.HasPreciseBug(),
211 .ignore_nan_fp_comparisons = true, 212 .ignore_nan_fp_comparisons = true,
diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
index 7aaa40ef2..87b843e3d 100644
--- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
+++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
@@ -315,6 +315,7 @@ PipelineCache::PipelineCache(RasterizerVulkan& rasterizer_, Tegra::Engines::Maxw
315 .has_broken_spirv_clamp = driver_id == VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS_KHR, 315 .has_broken_spirv_clamp = driver_id == VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS_KHR,
316 .has_broken_unsigned_image_offsets = false, 316 .has_broken_unsigned_image_offsets = false,
317 .has_broken_signed_operations = false, 317 .has_broken_signed_operations = false,
318 .has_broken_fp16_float_controls = driver_id == VK_DRIVER_ID_NVIDIA_PROPRIETARY_KHR,
318 .ignore_nan_fp_comparisons = false, 319 .ignore_nan_fp_comparisons = false,
319 }; 320 };
320 host_info = Shader::HostTranslateInfo{ 321 host_info = Shader::HostTranslateInfo{