Make reverse z define dynamic

This commit is contained in:
ExMatics HydrogenC
2024-06-05 21:51:07 +08:00
parent 1b6a31b6e5
commit 5d050ca020
2 changed files with 12 additions and 8 deletions
@@ -264,6 +264,9 @@ bool ShaderCompiler::OnCompileBegin()
const auto profile = GetProfile();
const auto featureLevel = RenderTools::GetFeatureLevel(profile);
_globalMacros.Add({ "FEATURE_LEVEL", Numbers[(int32)featureLevel] });
#if FLAX_REVERSE_Z
_globalMacros.Add({ "FLAX_REVERSE_Z", "1"});
#endif
return false;
}
+9 -8
View File
@@ -4,22 +4,26 @@
#define __COMMON__
// Platform macros
#if !defined(DIRECTX)
#ifndef DIRECTX
#define DIRECTX 0
#endif
#if !defined(OPENGL)
#ifndef OPENGL
#define OPENGL 0
#endif
#if !defined(VULKAN)
#ifndef VULKAN
#define VULKAN 0
#endif
#if defined(PLATFORM_PS4)
#ifdef PLATFORM_PS4
#include "./FlaxPlatforms/PS4/Shaders/PS4Common.hlsl"
#endif
#if defined(PLATFORM_PS5)
#ifdef PLATFORM_PS5
#include "./FlaxPlatforms/PS5/Shaders/PS5Common.hlsl"
#endif
#ifndef FLAX_REVERSE_Z
#define FLAX_REVERSE_Z 0
#endif
// Feature levels
#define FEATURE_LEVEL_ES2 0
#define FEATURE_LEVEL_ES3 1
@@ -53,9 +57,6 @@
#define SHADING_MODEL_SUBSURFACE 2
#define SHADING_MODEL_FOLIAGE 3
// Didn't figure out how to pass compilation flags via C++, so hardcode it temporarily
#define FLAX_REVERSE_Z 1
// Detect feature level support
#if FEATURE_LEVEL >= FEATURE_LEVEL_SM5
#define CAN_USE_GATHER 1