diff --git a/WickedEngine/CommonInclude.h b/WickedEngine/CommonInclude.h index 7abc7df22..6df060a88 100644 --- a/WickedEngine/CommonInclude.h +++ b/WickedEngine/CommonInclude.h @@ -69,6 +69,21 @@ constexpr float bilinear(float4 gather, float2 pixel_frac) return lerp(top_row, bottom_row, pixel_frac.y); } +// Stack allocated string utility: +template +struct StackString +{ + char chars[capacity] = {}; + unsigned cnt = 0; + static_assert(capacity > 1); + constexpr operator const char* () const { return chars; } + constexpr const char* const c_str() const { return chars; } + constexpr void push_back(const char* str) { while (*str != 0 && (cnt < (capacity - 1))) { chars[cnt++] = *str; str++; } } + constexpr unsigned size() const { return capacity; } + constexpr unsigned length() const { return cnt; } + constexpr bool empty() const { return cnt == 0; } +}; + // CPU intrinsics: #if defined(_WIN32) // Windows, Xbox: @@ -349,17 +364,8 @@ constexpr const char* relative_path(const char* path) // Extract function name from a string at compile-time constexpr auto extract_function_name(const char* str) { - struct ReturnString - { - char chars[256] = {}; - constexpr operator const char* () const { return chars; } - constexpr const char* const c_str() const { return chars; } - } ret; - int i = 0; - for (const char* currentCharacter = str; *currentCharacter != '\0' && *currentCharacter != '(' && (i < sizeof(ret.chars) - 1); ++currentCharacter) - { - ret.chars[i++] = *currentCharacter; - } + StackString ret; + ret.push_back(str); return ret; } diff --git a/WickedEngine/wiInitializer.cpp b/WickedEngine/wiInitializer.cpp index 3628a1e97..13801d067 100644 --- a/WickedEngine/wiInitializer.cpp +++ b/WickedEngine/wiInitializer.cpp @@ -1,7 +1,6 @@ #include "wiInitializer.h" #include "WickedEngine.h" -#include #include #include @@ -40,16 +39,50 @@ namespace wi::initializer static constexpr const char* platform_string = "Xbox"; #endif // PLATFORM - wilog("\n[wi::initializer] Initializing Wicked Engine, please wait...\nVersion: %s\nPlatform: %s", wi::version::GetVersionString(), platform_string) - + wilog("\n[wi::initializer] Initializing Wicked Engine, please wait...\nVersion: %s\nPlatform: %s", wi::version::GetVersionString(), platform_string); + + StackString cpustring; + cpustring.push_back("\nCPU features used by this build: "); +#ifdef _XM_SSE_INTRINSICS_ + cpustring.push_back("SSE 2; "); +#endif // _XM_SSE_INTRINSICS_ +#ifdef _XM_SSE3_INTRINSICS_ + cpustring.push_back("SSE 3; "); +#endif // _XM_SSE3_INTRINSICS_ +#ifdef _XM_SSE4_INTRINSICS_ + cpustring.push_back("SSE 4; "); +#endif // _XM_SSE4_INTRINSICS_ +#ifdef _XM_AVX_INTRINSICS_ + cpustring.push_back("AVX; "); +#endif // _XM_AVX_INTRINSICS_ +#ifdef _XM_AVX2_INTRINSICS_ + cpustring.push_back("AVX 2; "); +#endif // _XM_AVX2_INTRINSICS_ +#ifdef _XM_ARM_NEON_INTRINSICS_ + cpustring.push_back("NEON; "); +#endif // _XM_ARM_NEON_INTRINSICS_ +#ifdef _XM_F16C_INTRINSICS_ + cpustring.push_back("F16C; "); +#endif // _XM_F16C_INTRINSICS_ +#ifdef _XM_FMA3_INTRINSICS_ + cpustring.push_back("FMA3; "); +#endif // _XM_FMA3_INTRINSICS_ + + wilog(cpustring); + + if (!XMVerifyCPUSupport()) + { + wilog_messagebox("XMVerifyCPUSupport() failed! This means that your CPU doesn't support a required feature! %s", cpustring.c_str()); + } + size_t shaderdump_count = wi::renderer::GetShaderDumpCount(); if (shaderdump_count > 0) { - wi::backlog::post("\nEmbedded shaders found: " + std::to_string(shaderdump_count)); + wilog("\nEmbedded shaders found: %d", (int)shaderdump_count); } else { - wi::backlog::post("\nNo embedded shaders found, shaders will be compiled at runtime if needed.\n\tShader source path: " + wi::renderer::GetShaderSourcePath() + "\n\tShader binary path: " + wi::renderer::GetShaderPath()); + wilog("\nNo embedded shaders found, shaders will be compiled at runtime if needed.\n\tShader source path: %s\n\tShader binary path: %s", wi::renderer::GetShaderSourcePath().c_str(), wi::renderer::GetShaderPath().c_str()); } wi::backlog::post(""); diff --git a/WickedEngine/wiMath.h b/WickedEngine/wiMath.h index 260ab963a..dcee086ce 100644 --- a/WickedEngine/wiMath.h +++ b/WickedEngine/wiMath.h @@ -5,6 +5,9 @@ #include #include +#define _XM_F16C_INTRINSICS_ +#define _XM_FMA3_INTRINSICS_ + #if __has_include("DirectXMath.h") // In this case, DirectXMath is coming from Windows SDK. // It is better to use this on Windows as some Windows libraries could depend on the same diff --git a/WickedEngine/wiRenderer.cpp b/WickedEngine/wiRenderer.cpp index e537246ce..b4b01f99a 100644 --- a/WickedEngine/wiRenderer.cpp +++ b/WickedEngine/wiRenderer.cpp @@ -194,7 +194,7 @@ Texture texture_curlNoise; Texture texture_weatherMap; // Direct reference to a renderable instance: -struct RenderBatch +struct alignas(16) RenderBatch { uint32_t meshIndex; uint32_t instanceIndex; diff --git a/WickedEngine/wiVersion.cpp b/WickedEngine/wiVersion.cpp index c0e21503c..2be7a777e 100644 --- a/WickedEngine/wiVersion.cpp +++ b/WickedEngine/wiVersion.cpp @@ -9,7 +9,7 @@ namespace wi::version // minor features, major updates, breaking compatibility changes const int minor = 71; // minor bug fixes, alterations, refactors, updates - const int revision = 743; + const int revision = 744; const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);