Class Shader
- Namespace
- Xui.GPU.Shaders.Intrinsics
- Assembly
- Xui.Core.dll
Provides shader intrinsic functions for mathematical operations. These functions mirror GPU shader intrinsics and will be translated to appropriate backend-specific implementations.
public static class Shader
- Inheritance
-
Shader
- Inherited Members
Methods
Abs(F32)
Returns the absolute value.
public static F32 Abs(F32 value)
Parameters
valueF32
Returns
Acos(F32)
Returns the arc cosine (inverse cosine) in radians.
public static F32 Acos(F32 value)
Parameters
valueF32
Returns
Asin(F32)
Returns the arc sine (inverse sine) in radians.
public static F32 Asin(F32 value)
Parameters
valueF32
Returns
Atan(F32)
Returns the arc tangent (inverse tangent) in radians.
public static F32 Atan(F32 value)
Parameters
valueF32
Returns
Atan2(F32, F32)
Returns the arc tangent of y/x in radians.
public static F32 Atan2(F32 y, F32 x)
Parameters
Returns
Ceil(F32)
Returns the smallest integer greater than or equal to the value.
public static F32 Ceil(F32 value)
Parameters
valueF32
Returns
Clamp(F32, F32, F32)
Clamps a value between a minimum and maximum value.
public static F32 Clamp(F32 value, F32 min, F32 max)
Parameters
Returns
Clamp(Float2, Float2, Float2)
Component-wise clamp of a 2D vector.
public static Float2 Clamp(Float2 value, Float2 min, Float2 max)
Parameters
Returns
Clamp(Float3, Float3, Float3)
Component-wise clamp of a 3D vector.
public static Float3 Clamp(Float3 value, Float3 min, Float3 max)
Parameters
Returns
Clamp(Float4, Float4, Float4)
Component-wise clamp of a 4D vector.
public static Float4 Clamp(Float4 value, Float4 min, Float4 max)
Parameters
Returns
Cos(F32)
Returns the cosine of the specified angle in radians.
public static F32 Cos(F32 angle)
Parameters
angleF32
Returns
Cross(Float3, Float3)
Returns the cross product of two 3D vectors.
public static Float3 Cross(Float3 a, Float3 b)
Parameters
Returns
Ddx(F32)
Returns the partial derivative of the value with respect to screen-space X. Only available in fragment shaders.
public static F32 Ddx(F32 value)
Parameters
valueF32
Returns
Remarks
This intrinsic requires fragment execution in 2x2 quads to compute derivatives. In the software renderer, this will be implemented by comparing adjacent fragment values.
Ddy(F32)
Returns the partial derivative of the value with respect to screen-space Y. Only available in fragment shaders.
public static F32 Ddy(F32 value)
Parameters
valueF32
Returns
Remarks
This intrinsic requires fragment execution in 2x2 quads to compute derivatives. In the software renderer, this will be implemented by comparing adjacent fragment values.
Distance(Float2, Float2)
Returns the distance between two 2D points.
public static F32 Distance(Float2 a, Float2 b)
Parameters
Returns
Distance(Float3, Float3)
Returns the distance between two 3D points.
public static F32 Distance(Float3 a, Float3 b)
Parameters
Returns
Distance(Float4, Float4)
Returns the distance between two 4D points.
public static F32 Distance(Float4 a, Float4 b)
Parameters
Returns
Dot(Float2, Float2)
Returns the dot product of two 2D vectors.
public static F32 Dot(Float2 a, Float2 b)
Parameters
Returns
Dot(Float3, Float3)
Returns the dot product of two 3D vectors.
public static F32 Dot(Float3 a, Float3 b)
Parameters
Returns
Dot(Float4, Float4)
Returns the dot product of two 4D vectors.
public static F32 Dot(Float4 a, Float4 b)
Parameters
Returns
Exp(F32)
Returns the exponential (e^x).
public static F32 Exp(F32 value)
Parameters
valueF32
Returns
Floor(F32)
Returns the largest integer less than or equal to the value.
public static F32 Floor(F32 value)
Parameters
valueF32
Returns
Fract(F32)
Returns the fractional part of the value.
public static F32 Fract(F32 value)
Parameters
valueF32
Returns
Fwidth(F32)
Returns the sum of absolute values of ddx and ddy. Only available in fragment shaders.
public static F32 Fwidth(F32 value)
Parameters
valueF32
Returns
Length(Float2)
Returns the length (magnitude) of a 2D vector.
public static F32 Length(Float2 v)
Parameters
vFloat2
Returns
Length(Float3)
Returns the length (magnitude) of a 3D vector.
public static F32 Length(Float3 v)
Parameters
vFloat3
Returns
Length(Float4)
Returns the length (magnitude) of a 4D vector.
public static F32 Length(Float4 v)
Parameters
vFloat4
Returns
Lerp(F32, F32, F32)
Linearly interpolates between two values.
public static F32 Lerp(F32 a, F32 b, F32 t)
Parameters
Returns
Lerp(Float2, Float2, F32)
Linearly interpolates between two 2D vectors.
public static Float2 Lerp(Float2 a, Float2 b, F32 t)
Parameters
Returns
Lerp(Float3, Float3, F32)
Linearly interpolates between two 3D vectors.
public static Float3 Lerp(Float3 a, Float3 b, F32 t)
Parameters
Returns
Lerp(Float4, Float4, F32)
Linearly interpolates between two 4D vectors.
public static Float4 Lerp(Float4 a, Float4 b, F32 t)
Parameters
Returns
Load(Texture2D<Color4>, Int2)
Loads a texel from a 2D texture at the specified integer coordinates.
public static Color4 Load(Texture2D<Color4> texture, Int2 location)
Parameters
Returns
- Color4
The texel color value.
Remarks
Unlike Sample(), Load() does not perform filtering and uses integer coordinates. This is a placeholder implementation that will be implemented by the renderer backend.
Log(F32)
Returns the natural logarithm.
public static F32 Log(F32 value)
Parameters
valueF32
Returns
Log2(F32)
Returns the base-2 logarithm.
public static F32 Log2(F32 value)
Parameters
valueF32
Returns
Max(F32, F32)
Returns the maximum of two values.
public static F32 Max(F32 a, F32 b)
Parameters
Returns
Max(Float2, Float2)
Component-wise maximum of two 2D vectors.
public static Float2 Max(Float2 a, Float2 b)
Parameters
Returns
Max(Float3, Float3)
Component-wise maximum of two 3D vectors.
public static Float3 Max(Float3 a, Float3 b)
Parameters
Returns
Max(Float4, Float4)
Component-wise maximum of two 4D vectors.
public static Float4 Max(Float4 a, Float4 b)
Parameters
Returns
Min(F32, F32)
Returns the minimum of two values.
public static F32 Min(F32 a, F32 b)
Parameters
Returns
Min(Float2, Float2)
Component-wise minimum of two 2D vectors.
public static Float2 Min(Float2 a, Float2 b)
Parameters
Returns
Min(Float3, Float3)
Component-wise minimum of two 3D vectors.
public static Float3 Min(Float3 a, Float3 b)
Parameters
Returns
Min(Float4, Float4)
Component-wise minimum of two 4D vectors.
public static Float4 Min(Float4 a, Float4 b)
Parameters
Returns
Normalize(Float2)
Returns the normalized 2D vector (length = 1).
public static Float2 Normalize(Float2 v)
Parameters
vFloat2
Returns
Normalize(Float3)
Returns the normalized 3D vector (length = 1).
public static Float3 Normalize(Float3 v)
Parameters
vFloat3
Returns
Normalize(Float4)
Returns the normalized 4D vector (length = 1).
public static Float4 Normalize(Float4 v)
Parameters
vFloat4
Returns
Pow(F32, F32)
Returns the value raised to the specified power.
public static F32 Pow(F32 value, F32 exponent)
Parameters
Returns
Round(F32)
Returns the value rounded to the nearest integer.
public static F32 Round(F32 value)
Parameters
valueF32
Returns
Rsqrt(F32)
Returns the reciprocal square root (1 / sqrt(x)).
public static F32 Rsqrt(F32 value)
Parameters
valueF32
Returns
Sample(Texture2D<Color4>, Sampler, Float2)
Samples a 2D texture at the specified UV coordinates using a sampler.
public static Color4 Sample(Texture2D<Color4> texture, Sampler sampler, Float2 uv)
Parameters
textureTexture2D<Color4>The texture to sample from.
samplerSamplerThe sampler defining filtering and addressing modes.
uvFloat2The UV texture coordinates.
Returns
- Color4
The sampled color value.
Remarks
This is a placeholder implementation. Actual texture sampling will be implemented by the software renderer or hardware backend.
Saturate(F32)
Saturates a value to the range [0, 1].
public static F32 Saturate(F32 value)
Parameters
valueF32
Returns
Saturate(Float2)
Saturates a 2D vector to the range [0, 1] component-wise.
public static Float2 Saturate(Float2 value)
Parameters
valueFloat2
Returns
Saturate(Float3)
Saturates a 3D vector to the range [0, 1] component-wise.
public static Float3 Saturate(Float3 value)
Parameters
valueFloat3
Returns
Saturate(Float4)
Saturates a 4D vector to the range [0, 1] component-wise.
public static Float4 Saturate(Float4 value)
Parameters
valueFloat4
Returns
Sin(F32)
Returns the sine of the specified angle in radians.
public static F32 Sin(F32 angle)
Parameters
angleF32
Returns
Sqrt(F32)
Returns the square root.
public static F32 Sqrt(F32 value)
Parameters
valueF32
Returns
Tan(F32)
Returns the tangent of the specified angle in radians.
public static F32 Tan(F32 angle)
Parameters
angleF32