// Generated API outline. Implementation bodies omitted. #nullable enable using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Net.Http; using System.Threading.Tasks; using System.Threading; using System; using nfloat = System.Runtime.InteropServices.NFloat; using static Xui.Core.Math2D.Constants; namespace Xui.GPU.Shaders.Intrinsics { using Xui.GPU.Shaders.Types; /// /// 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 { /// /// Clamps a value between a minimum and maximum value. /// public static F32 Clamp(F32 value, F32 min, F32 max); /// /// Saturates a value to the range [0, 1]. /// public static F32 Saturate(F32 value); /// /// Linearly interpolates between two values. /// /// The start value. /// The end value. /// The interpolation factor (typically 0-1). public static F32 Lerp(F32 a, F32 b, F32 t); /// /// Returns the minimum of two values. /// public static F32 Min(F32 a, F32 b); /// /// Returns the maximum of two values. /// public static F32 Max(F32 a, F32 b); /// /// Returns the absolute value. /// public static F32 Abs(F32 value); /// /// Returns the sine of the specified angle in radians. /// public static F32 Sin(F32 angle); /// /// Returns the cosine of the specified angle in radians. /// public static F32 Cos(F32 angle); /// /// Returns the tangent of the specified angle in radians. /// public static F32 Tan(F32 angle); /// /// Returns the arc sine (inverse sine) in radians. /// public static F32 Asin(F32 value); /// /// Returns the arc cosine (inverse cosine) in radians. /// public static F32 Acos(F32 value); /// /// Returns the arc tangent (inverse tangent) in radians. /// public static F32 Atan(F32 value); /// /// Returns the arc tangent of y/x in radians. /// public static F32 Atan2(F32 y, F32 x); /// /// Returns the value raised to the specified power. /// public static F32 Pow(F32 value, F32 exponent); /// /// Returns the exponential (e^x). /// public static F32 Exp(F32 value); /// /// Returns the natural logarithm. /// public static F32 Log(F32 value); /// /// Returns the base-2 logarithm. /// public static F32 Log2(F32 value); /// /// Returns the square root. /// public static F32 Sqrt(F32 value); /// /// Returns the reciprocal square root (1 / sqrt(x)). /// public static F32 Rsqrt(F32 value); /// /// Returns the largest integer less than or equal to the value. /// public static F32 Floor(F32 value); /// /// Returns the smallest integer greater than or equal to the value. /// public static F32 Ceil(F32 value); /// /// Returns the fractional part of the value. /// public static F32 Fract(F32 value); /// /// Returns the value rounded to the nearest integer. /// public static F32 Round(F32 value); /// /// Returns the dot product of two 2D vectors. /// public static F32 Dot(Float2 a, Float2 b); /// /// Returns the dot product of two 3D vectors. /// public static F32 Dot(Float3 a, Float3 b); /// /// Returns the dot product of two 4D vectors. /// public static F32 Dot(Float4 a, Float4 b); /// /// Returns the length (magnitude) of a 2D vector. /// public static F32 Length(Float2 v); /// /// Returns the length (magnitude) of a 3D vector. /// public static F32 Length(Float3 v); /// /// Returns the length (magnitude) of a 4D vector. /// public static F32 Length(Float4 v); /// /// Returns the distance between two 2D points. /// public static F32 Distance(Float2 a, Float2 b); /// /// Returns the distance between two 3D points. /// public static F32 Distance(Float3 a, Float3 b); /// /// Returns the distance between two 4D points. /// public static F32 Distance(Float4 a, Float4 b); /// /// Returns the normalized 2D vector (length = 1). /// public static Float2 Normalize(Float2 v); /// /// Returns the normalized 3D vector (length = 1). /// public static Float3 Normalize(Float3 v); /// /// Returns the normalized 4D vector (length = 1). /// public static Float4 Normalize(Float4 v); /// /// Returns the cross product of two 3D vectors. /// public static Float3 Cross(Float3 a, Float3 b); /// /// Linearly interpolates between two 2D vectors. /// public static Float2 Lerp(Float2 a, Float2 b, F32 t); /// /// Linearly interpolates between two 3D vectors. /// public static Float3 Lerp(Float3 a, Float3 b, F32 t); /// /// Linearly interpolates between two 4D vectors. /// public static Float4 Lerp(Float4 a, Float4 b, F32 t); /// /// Component-wise minimum of two 2D vectors. /// public static Float2 Min(Float2 a, Float2 b); /// /// Component-wise minimum of two 3D vectors. /// public static Float3 Min(Float3 a, Float3 b); /// /// Component-wise minimum of two 4D vectors. /// public static Float4 Min(Float4 a, Float4 b); /// /// Component-wise maximum of two 2D vectors. /// public static Float2 Max(Float2 a, Float2 b); /// /// Component-wise maximum of two 3D vectors. /// public static Float3 Max(Float3 a, Float3 b); /// /// Component-wise maximum of two 4D vectors. /// public static Float4 Max(Float4 a, Float4 b); /// /// Component-wise clamp of a 2D vector. /// public static Float2 Clamp(Float2 value, Float2 min, Float2 max); /// /// Component-wise clamp of a 3D vector. /// public static Float3 Clamp(Float3 value, Float3 min, Float3 max); /// /// Component-wise clamp of a 4D vector. /// public static Float4 Clamp(Float4 value, Float4 min, Float4 max); /// /// Saturates a 2D vector to the range [0, 1] component-wise. /// public static Float2 Saturate(Float2 value); /// /// Saturates a 3D vector to the range [0, 1] component-wise. /// public static Float3 Saturate(Float3 value); /// /// Saturates a 4D vector to the range [0, 1] component-wise. /// public static Float4 Saturate(Float4 value); /// /// Returns the partial derivative of the value with respect to screen-space X. /// Only available in fragment shaders. /// /// /// This intrinsic requires fragment execution in 2x2 quads to compute derivatives. /// In the software renderer, this will be implemented by comparing adjacent fragment values. /// public static F32 Ddx(F32 value); /// /// Returns the partial derivative of the value with respect to screen-space Y. /// Only available in fragment shaders. /// /// /// This intrinsic requires fragment execution in 2x2 quads to compute derivatives. /// In the software renderer, this will be implemented by comparing adjacent fragment values. /// public static F32 Ddy(F32 value); /// /// Returns the sum of absolute values of ddx and ddy. /// Only available in fragment shaders. /// public static F32 Fwidth(F32 value); /// /// Samples a 2D texture at the specified UV coordinates using a sampler. /// /// The texture to sample from. /// The sampler defining filtering and addressing modes. /// The UV texture coordinates. /// The sampled color value. /// /// This is a placeholder implementation. Actual texture sampling will be /// implemented by the software renderer or hardware backend. /// public static Color4 Sample(Texture2D texture, Sampler sampler, Float2 uv); /// Samples a texture at an explicit mip level, interpolating adjacent levels. public static Color4 SampleLevel(Texture2D texture, Sampler sampler, Float2 uv, F32 level); /// /// Loads a texel from a 2D texture at the specified integer coordinates. /// /// The texture to load from. /// The integer texel coordinates. /// The texel color value. /// /// Unlike Sample(), Load() does not perform filtering and uses integer coordinates. /// This is a placeholder implementation that will be implemented by the renderer backend. /// public static Color4 Load(Texture2D texture, Int2 location); } }