summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2018-01-15 14:51:44 +0100
committerSamuel Pitoiset <[email protected]>2018-01-16 21:39:55 +0100
commit4f5318df2cba4f4a455cf3a5aaa020908806987d (patch)
treee3a525c286d201e4e3f9701fb46b3049bea3d433
parent2091206ad3764c94317bd700cc551f9c31a2847d (diff)
ac: set fast math flags when RADV_DEBUG="unsafemath" is used
When that debug option is not used, we use the default float mode because the no signed zeros optimisation is not Vulkan compatible. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
-rw-r--r--src/amd/common/ac_nir_to_llvm.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index aca9a0a2601..635a74d2430 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -6683,7 +6683,11 @@ LLVMModuleRef ac_translate_nir_to_llvm(LLVMTargetMachineRef tm,
LLVMDisposeTargetData(data_layout);
LLVMDisposeMessage(data_layout_str);
- ctx.builder = LLVMCreateBuilderInContext(ctx.context);
+ enum ac_float_mode float_mode =
+ options->unsafe_math ? AC_FLOAT_MODE_UNSAFE_FP_MATH :
+ AC_FLOAT_MODE_DEFAULT;
+
+ ctx.builder = ac_create_builder(ctx.context, float_mode);
ctx.ac.builder = ctx.builder;
memset(shader_info, 0, sizeof(*shader_info));
@@ -7095,7 +7099,11 @@ void ac_create_gs_copy_shader(LLVMTargetMachineRef tm,
ctx.is_gs_copy_shader = true;
LLVMSetTarget(ctx.module, "amdgcn--");
- ctx.builder = LLVMCreateBuilderInContext(ctx.context);
+ enum ac_float_mode float_mode =
+ options->unsafe_math ? AC_FLOAT_MODE_UNSAFE_FP_MATH :
+ AC_FLOAT_MODE_DEFAULT;
+
+ ctx.builder = ac_create_builder(ctx.context, float_mode);
ctx.ac.builder = ctx.builder;
ctx.stage = MESA_SHADER_VERTEX;