From 5612363097db9d8f56b612e2d0713bcae20a8fd0 Mon Sep 17 00:00:00 2001 From: Przemog1 Date: Mon, 1 Dec 2025 13:57:18 +0100 Subject: [PATCH 1/9] Created `nbl::system::to_string` utility function --- examples_tests | 2 +- include/nbl/system/to_string.h | 84 ++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 include/nbl/system/to_string.h diff --git a/examples_tests b/examples_tests index 2b4db21239..158e58891d 160000 --- a/examples_tests +++ b/examples_tests @@ -1 +1 @@ -Subproject commit 2b4db2123918f380cc0a35f6889315a02f84ea73 +Subproject commit 158e58891d6395df2566013b3590fdfe475aae8d diff --git a/include/nbl/system/to_string.h b/include/nbl/system/to_string.h new file mode 100644 index 0000000000..70ecfba211 --- /dev/null +++ b/include/nbl/system/to_string.h @@ -0,0 +1,84 @@ +#ifndef _NBL_SYSTEM_TO_STRING_INCLUDED_ +#define _NBL_SYSTEM_TO_STRING_INCLUDED_ + +#include +#include +#include + +namespace nbl +{ +namespace system +{ +namespace impl +{ + +template +struct to_string_helper +{ + static std::string __call(const T& value) + { + return std::to_string(value); + } +}; + +template<> +struct to_string_helper +{ + static std::string __call(const hlsl::emulated_uint64_t& value) + { + return std::to_string(static_cast(value)); + } +}; + +template<> +struct to_string_helper +{ + static std::string __call(const hlsl::emulated_int64_t& value) + { + return std::to_string(static_cast(value)); + } +}; + +template +struct to_string_helper> +{ + static std::string __call(const hlsl::vector& value) + { + std::stringstream output; + output << "{ "; + for (int i = 0; i < N; ++i) + { + output << to_string_helper::__call(value[i]); + + if (i < N - 1) + output << ", "; + } + output << " }"; + + return output.str(); + } +}; + +template +struct to_string_helper> +{ + using value_t = hlsl::morton::code; + static std::string __call(value_t value) + { + TestValueToTextConverter mortonCodeDataToTextConverter; + return mortonCodeDataToTextConverter(value.value); + } +}; + + +} + +template +std::string to_string(T value) +{ + return impl::to_string_helper::__call(value); +} +} +} + +#endif \ No newline at end of file From 2a43ae8981e0c984631176b0fb7caada4d39cd40 Mon Sep 17 00:00:00 2001 From: Przemog1 Date: Mon, 1 Dec 2025 15:37:21 +0100 Subject: [PATCH 2/9] Removed from the `to_string` function specialization of types not present yet in the master branch --- include/nbl/system/to_string.h | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/include/nbl/system/to_string.h b/include/nbl/system/to_string.h index 70ecfba211..92888704c0 100644 --- a/include/nbl/system/to_string.h +++ b/include/nbl/system/to_string.h @@ -2,8 +2,6 @@ #define _NBL_SYSTEM_TO_STRING_INCLUDED_ #include -#include -#include namespace nbl { @@ -21,24 +19,6 @@ struct to_string_helper } }; -template<> -struct to_string_helper -{ - static std::string __call(const hlsl::emulated_uint64_t& value) - { - return std::to_string(static_cast(value)); - } -}; - -template<> -struct to_string_helper -{ - static std::string __call(const hlsl::emulated_int64_t& value) - { - return std::to_string(static_cast(value)); - } -}; - template struct to_string_helper> { @@ -59,18 +39,6 @@ struct to_string_helper> } }; -template -struct to_string_helper> -{ - using value_t = hlsl::morton::code; - static std::string __call(value_t value) - { - TestValueToTextConverter mortonCodeDataToTextConverter; - return mortonCodeDataToTextConverter(value.value); - } -}; - - } template From b7f71690d99cd931d17e56b324e82547b8f1e3c2 Mon Sep 17 00:00:00 2001 From: Przemog1 Date: Mon, 1 Dec 2025 16:04:55 +0100 Subject: [PATCH 3/9] Restored the removed `system::to_string` specializations --- include/nbl/system/to_string.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/include/nbl/system/to_string.h b/include/nbl/system/to_string.h index 92888704c0..70ecfba211 100644 --- a/include/nbl/system/to_string.h +++ b/include/nbl/system/to_string.h @@ -2,6 +2,8 @@ #define _NBL_SYSTEM_TO_STRING_INCLUDED_ #include +#include +#include namespace nbl { @@ -19,6 +21,24 @@ struct to_string_helper } }; +template<> +struct to_string_helper +{ + static std::string __call(const hlsl::emulated_uint64_t& value) + { + return std::to_string(static_cast(value)); + } +}; + +template<> +struct to_string_helper +{ + static std::string __call(const hlsl::emulated_int64_t& value) + { + return std::to_string(static_cast(value)); + } +}; + template struct to_string_helper> { @@ -39,6 +59,18 @@ struct to_string_helper> } }; +template +struct to_string_helper> +{ + using value_t = hlsl::morton::code; + static std::string __call(value_t value) + { + TestValueToTextConverter mortonCodeDataToTextConverter; + return mortonCodeDataToTextConverter(value.value); + } +}; + + } template From 486af6d3698534557809065b3fbf491c5078a47c Mon Sep 17 00:00:00 2001 From: Przemog1 Date: Mon, 1 Dec 2025 16:14:26 +0100 Subject: [PATCH 4/9] Fixes --- examples_tests | 2 +- include/nbl/system/to_string.h | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/examples_tests b/examples_tests index 158e58891d..8842299b81 160000 --- a/examples_tests +++ b/examples_tests @@ -1 +1 @@ -Subproject commit 158e58891d6395df2566013b3590fdfe475aae8d +Subproject commit 8842299b81c2ab0a8951d042b1945372a930b863 diff --git a/include/nbl/system/to_string.h b/include/nbl/system/to_string.h index 70ecfba211..3169503a06 100644 --- a/include/nbl/system/to_string.h +++ b/include/nbl/system/to_string.h @@ -65,8 +65,7 @@ struct to_string_helper> using value_t = hlsl::morton::code; static std::string __call(value_t value) { - TestValueToTextConverter mortonCodeDataToTextConverter; - return mortonCodeDataToTextConverter(value.value); + return to_string_helper::__call(value.value); } }; From 256420229e8a3b65bb5f09fc0933e70e894338f0 Mon Sep 17 00:00:00 2001 From: Przemog1 Date: Mon, 1 Dec 2025 17:05:34 +0100 Subject: [PATCH 5/9] Updated examples --- examples_tests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples_tests b/examples_tests index 8842299b81..44fdbe8d35 160000 --- a/examples_tests +++ b/examples_tests @@ -1 +1 @@ -Subproject commit 8842299b81c2ab0a8951d042b1945372a930b863 +Subproject commit 44fdbe8d35a9505ac3474b708200cc7e039aae31 From bacdacffc71945732bbf8bc8d4b25daaede489ba Mon Sep 17 00:00:00 2001 From: Przemog1 Date: Mon, 15 Dec 2025 16:09:17 +0100 Subject: [PATCH 6/9] Updated examples_tests --- examples_tests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples_tests b/examples_tests index 0995b6797a..cc4f871dce 160000 --- a/examples_tests +++ b/examples_tests @@ -1 +1 @@ -Subproject commit 0995b6797adc8c7bd1af9fded71098a035a04ffc +Subproject commit cc4f871dce0ccf56b54118c4e90ecf2b3107d19e From 2e820cbd145aae0b1d7306c793456ab0bd108feb Mon Sep 17 00:00:00 2001 From: Przemog1 Date: Mon, 15 Dec 2025 17:08:31 +0100 Subject: [PATCH 7/9] Updated examples --- examples_tests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples_tests b/examples_tests index cc4f871dce..ab5e466db4 160000 --- a/examples_tests +++ b/examples_tests @@ -1 +1 @@ -Subproject commit cc4f871dce0ccf56b54118c4e90ecf2b3107d19e +Subproject commit ab5e466db43ff94e748bae478d0c0e28a492dfc8 From 7a0c325eea7575c76d81c1cec23ddfaa47e22755 Mon Sep 17 00:00:00 2001 From: Przemog1 Date: Mon, 15 Dec 2025 17:19:21 +0100 Subject: [PATCH 8/9] Updated examples --- examples_tests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples_tests b/examples_tests index ab5e466db4..c593979c42 160000 --- a/examples_tests +++ b/examples_tests @@ -1 +1 @@ -Subproject commit ab5e466db43ff94e748bae478d0c0e28a492dfc8 +Subproject commit c593979c42627b49524690ea7a7717a2d7ca5fdf From 41466f7cfada59e4c0536568b7319f6d709d211e Mon Sep 17 00:00:00 2001 From: Przemog1 Date: Mon, 15 Dec 2025 19:44:12 +0100 Subject: [PATCH 9/9] Updated examples --- examples_tests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples_tests b/examples_tests index c593979c42..8114cb0740 160000 --- a/examples_tests +++ b/examples_tests @@ -1 +1 @@ -Subproject commit c593979c42627b49524690ea7a7717a2d7ca5fdf +Subproject commit 8114cb0740323bbde03375c731bce34d6eeeb8d9