Skip to content

Commit

Permalink
Merge branch 'clshortfuse:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
marat569 authored Oct 15, 2024
2 parents 55b5466 + b6f0e9e commit 8ae3f90
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/shaders/math.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ POWSAFE_FUNCTION_GENERATOR(float3);
POWSAFE_FUNCTION_GENERATOR(float4);
#undef POWSAFE_FUNCTION_GENERATOR

#define SQRTSAFE_FUNCTION_GENERATOR(struct) \
struct SqrtSafe(struct x) { \
return Sign(x) * sqrt(abs(x)); \
}

SQRTSAFE_FUNCTION_GENERATOR(float);
SQRTSAFE_FUNCTION_GENERATOR(float2);
SQRTSAFE_FUNCTION_GENERATOR(float3);
SQRTSAFE_FUNCTION_GENERATOR(float4);
#undef SQRTSAFE_FUNCTION_GENERATOR

float Average(float3 color) {
return (color.x + color.y + color.z) / 3.f;
}
Expand Down

0 comments on commit 8ae3f90

Please sign in to comment.