enabled fp16 and fma cpu support

This commit is contained in:
Turánszki János
2025-04-18 14:00:20 +02:00
parent 3dd1c10a99
commit 248e571ecd
5 changed files with 60 additions and 18 deletions
+17 -11
View File
@@ -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 <unsigned capacity = 256>
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;
}
+38 -5
View File
@@ -1,7 +1,6 @@
#include "wiInitializer.h"
#include "WickedEngine.h"
#include <string>
#include <thread>
#include <atomic>
@@ -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("");
+3
View File
@@ -5,6 +5,9 @@
#include <algorithm>
#include <limits>
#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
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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);