diff options
Diffstat (limited to 'thirdparty/astcenc/astcenc_diagnostic_trace.cpp')
-rw-r--r-- | thirdparty/astcenc/astcenc_diagnostic_trace.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/thirdparty/astcenc/astcenc_diagnostic_trace.cpp b/thirdparty/astcenc/astcenc_diagnostic_trace.cpp index 7fa7ab1a8b..bcd6fa72a5 100644 --- a/thirdparty/astcenc/astcenc_diagnostic_trace.cpp +++ b/thirdparty/astcenc/astcenc_diagnostic_trace.cpp @@ -1,6 +1,6 @@ // SPDX-License-Identifier: Apache-2.0 // ---------------------------------------------------------------------------- -// Copyright 2021-2022 Arm Limited +// Copyright 2021-2023 Arm Limited // // Licensed under the Apache License, Version 2.0 (the "License"); you may not // use this file except in compliance with the License. You may obtain a copy @@ -24,6 +24,8 @@ #include <cassert> #include <cstdarg> #include <cstdio> +#include <cmath> +#include <limits> #include <string> #include "astcenc_diagnostic_trace.h" @@ -203,7 +205,20 @@ void trace_add_data( const char* key, float value ) { - char buffer[256]; + // Turn infinities into parseable values + if (std::isinf(value)) + { + if (value > 0.0f) + { + value = std::numeric_limits<float>::max(); + } + else + { + value = -std::numeric_limits<float>::max(); + } + } + + char buffer[256]; sprintf(buffer, "%.20g", (double)value); TraceNode* node = g_TraceLog->get_current_leaf(); node->add_attrib("float", key, buffer); |