Cleanup: GPU: Remove unused shader library guards

Nowadays every shader uses the new include system and
there is no need for these manual double include guards.
This commit is contained in:
Clément Foucault
2025-08-26 15:10:53 +02:00
parent 65e9b99e85
commit 05115b0f88
6 changed files with 22 additions and 58 deletions

View File

@@ -6,24 +6,20 @@
#include "gpu_glsl_cpp_stubs.hh"
/* WORKAROUND: to guard against double include in EEVEE. */
#ifndef GPU_SHADER_MATH_BASE_LIB_GLSL
# define GPU_SHADER_MATH_BASE_LIB_GLSL
# define M_PI 3.14159265358979323846f /* pi */
# define M_TAU 6.28318530717958647692f /* tau = 2*pi */
# define M_PI_2 1.57079632679489661923f /* pi/2 */
# define M_PI_4 0.78539816339744830962f /* pi/4 */
# define M_SQRT2 1.41421356237309504880f /* sqrt(2) */
# define M_SQRT1_2 0.70710678118654752440f /* 1/sqrt(2) */
# define M_SQRT3 1.73205080756887729352f /* sqrt(3) */
# define M_SQRT1_3 0.57735026918962576450f /* 1/sqrt(3) */
# define M_1_PI 0.318309886183790671538f /* 1/pi */
# define M_E 2.7182818284590452354f /* e */
# define M_LOG2E 1.4426950408889634074f /* log_2 e */
# define M_LOG10E 0.43429448190325182765f /* log_10 e */
# define M_LN2 0.69314718055994530942f /* log_e 2 */
# define M_LN10 2.30258509299404568402f /* log_e 10 */
#define M_PI 3.14159265358979323846f /* pi */
#define M_TAU 6.28318530717958647692f /* tau = 2*pi */
#define M_PI_2 1.57079632679489661923f /* pi/2 */
#define M_PI_4 0.78539816339744830962f /* pi/4 */
#define M_SQRT2 1.41421356237309504880f /* sqrt(2) */
#define M_SQRT1_2 0.70710678118654752440f /* 1/sqrt(2) */
#define M_SQRT3 1.73205080756887729352f /* sqrt(3) */
#define M_SQRT1_3 0.57735026918962576450f /* 1/sqrt(3) */
#define M_1_PI 0.318309886183790671538f /* 1/pi */
#define M_E 2.7182818284590452354f /* e */
#define M_LOG2E 1.4426950408889634074f /* log_2 e */
#define M_LOG10E 0.43429448190325182765f /* log_10 e */
#define M_LN2 0.69314718055994530942f /* log_e 2 */
#define M_LN10 2.30258509299404568402f /* log_e 10 */
/* `powf` is really slow for raising to integer powers. */
@@ -106,7 +102,7 @@ float _atan2(float y, float x)
{
return atan(y, x);
}
# define atan2 _atan2
#define atan2 _atan2
/**
* Safe `a` modulo `b`.
@@ -277,5 +273,3 @@ float wrap(float a, float b, float c)
}
/** \} */
#endif /* GPU_SHADER_MATH_BASE_LIB_GLSL */

View File

@@ -6,10 +6,6 @@
#include "gpu_shader_math_base_lib.glsl"
/* WORKAROUND: to guard against double include in EEVEE. */
#ifndef GPU_SHADER_MATH_FAST_LIB_GLSL
# define GPU_SHADER_MATH_FAST_LIB_GLSL
/* [Drobot2014a] Low Level Optimizations for GCN. */
float sqrt_fast(float v)
{
@@ -54,5 +50,3 @@ float atan_fast(float x)
}
return (x < 0.0f) ? -r : r;
}
#endif /* GPU_SHADER_MATH_FAST_LIB_GLSL */

View File

@@ -7,10 +7,6 @@
#include "gpu_shader_math_rotation_lib.glsl"
#include "gpu_shader_math_vector_lib.glsl"
/* WORKAROUND: to guard against double include in EEVEE. */
#ifndef GPU_SHADER_MATH_MATRIX_LIB_GLSL
# define GPU_SHADER_MATH_MATRIX_LIB_GLSL
/* -------------------------------------------------------------------- */
/** \name Static constructors
* \{ */
@@ -73,7 +69,7 @@ float4x4 mat4x4_identity()
/** \} */
/* Metal does not need prototypes. */
# ifndef GPU_METAL
#ifndef GPU_METAL
/* -------------------------------------------------------------------- */
/** \name Matrix Operations
@@ -461,7 +457,7 @@ bool is_uniformly_scaled(float3x3 mat);
/** \} */
# endif /* GPU_METAL */
#endif /* GPU_METAL */
/* ---------------------------------------------------------------------- */
/** \name Implementation
@@ -496,7 +492,7 @@ float4x4 invert(float4x4 mat, out bool r_success)
return r_success ? inverse(mat) : float4x4(0.0f);
}
# if defined(GPU_OPENGL) || defined(GPU_METAL)
#if defined(GPU_OPENGL) || defined(GPU_METAL)
float2 normalize(float2 a)
{
return a * inversesqrt(length_squared(a));
@@ -509,7 +505,7 @@ float4 normalize(float4 a)
{
return a * inversesqrt(length_squared(a));
}
# endif
#endif
float2x2 normalize(float2x2 mat)
{
@@ -1577,5 +1573,3 @@ bool is_unit_scale(float2x2 m)
}
/** \} */
#endif /* GPU_SHADER_MATH_MATRIX_LIB_GLSL */

View File

@@ -7,10 +7,6 @@
#include "gpu_shader_math_vector_lib.glsl"
#include "gpu_shader_utildefines_lib.glsl"
/* WORKAROUND: to guard against double include in EEVEE. */
#ifndef GPU_SHADER_MATH_ROTATION_LIB_GLSL
# define GPU_SHADER_MATH_ROTATION_LIB_GLSL
/* -------------------------------------------------------------------- */
/** \name Rotation Types
* \{ */
@@ -181,5 +177,3 @@ AxisAngle to_axis_angle(EulerXYZ eul)
}
/** \} */
#endif /* GPU_SHADER_MATH_ROTATION_LIB_GLSL */

View File

@@ -6,12 +6,8 @@
#include "gpu_shader_math_base_lib.glsl"
/* WORKAROUND: to guard against double include in EEVEE. */
#ifndef GPU_SHADER_MATH_VECTOR_LIB_GLSL
# define GPU_SHADER_MATH_VECTOR_LIB_GLSL
/* Metal does not need prototypes. */
# ifndef GPU_METAL
#ifndef GPU_METAL
/**
* Return true if all components is equal to zero.
@@ -260,7 +256,7 @@ float average(float2 a);
float average(float3 a);
float average(float4 a);
# endif /* !GPU_METAL */
#endif /* !GPU_METAL */
/* ---------------------------------------------------------------------- */
/** \name Implementation
@@ -714,7 +710,7 @@ float average(float4 a)
return reduce_add(a) * (1.0f / 4.0f);
}
# define ASSERT_UNIT_EPSILON 0.0002f
#define ASSERT_UNIT_EPSILON 0.0002f
/* Checks are flipped so NAN doesn't assert because we're making sure the value was
* normalized and in the case we don't want NAN to be raising asserts since there
@@ -739,5 +735,3 @@ bool is_unit_scale(float4 v)
}
/** \} */
#endif /* GPU_SHADER_MATH_VECTOR_LIB_GLSL */

View File

@@ -6,10 +6,6 @@
#include "gpu_glsl_cpp_stubs.hh"
/* WORKAROUND: to guard against double include in EEVEE. */
#ifndef GPU_SHADER_UTILDEFINES_GLSL
# define GPU_SHADER_UTILDEFINES_GLSL
# ifndef FLT_MAX
# define FLT_MAX uintBitsToFloat(0x7F7FFFFFu)
# define FLT_MIN uintBitsToFloat(0x00800000u)
@@ -162,5 +158,3 @@ float3 offset_ray(float3 P, float3 Ng)
(abs(P.y) < origin) ? uf.y : P_i.y,
(abs(P.z) < origin) ? uf.z : P_i.z);
}
#endif /* GPU_SHADER_UTILDEFINES_GLSL */