using ComputeSharp.Core.Intrinsics.Attributes; #pragma warning disable IDE0022 namespace ComputeSharp; /// /// A that maps the supported HLSL intrinsic functions that can be used in compute shaders. /// public static partial class Hlsl { /// /// Blocks execution of all threads in a group until all memory accesses have been completed. /// /// /// A memory barrier guarantees that outstanding memory operations have completed. /// Threads are synchronized at GroupSync barriers. /// This may stall a thread or threads if memory operations are in progress. /// For more info, see . /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// public static void AllMemoryBarrier() => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(AllMemoryBarrier)}()"); /// /// Blocks execution of all threads in a group until all memory accesses have been completed and all threads in the group have reached this call. /// /// /// A memory barrier guarantees that outstanding memory operations have completed. /// Threads are synchronized at GroupSync barriers. /// This may stall a thread or threads if memory operations are in progress. /// For more info, see . /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// public static void AllMemoryBarrierWithGroupSync() => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(AllMemoryBarrierWithGroupSync)}()"); /// /// Blocks execution of all threads in a group until all device memory accesses have been completed. /// /// /// For more info, see . /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// public static void DeviceMemoryBarrier() => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(DeviceMemoryBarrier)}()"); /// /// Blocks execution of all threads in a group until all device memory accesses have been completed and all threads in the group have reached this call. /// /// /// For more info, see . /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// public static void DeviceMemoryBarrierWithGroupSync() => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(DeviceMemoryBarrierWithGroupSync)}()"); /// /// Blocks execution of all threads in a group until all group shared accesses have been completed. /// /// /// For more info, see . /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// public static void GroupMemoryBarrier() => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(GroupMemoryBarrier)}()"); /// /// Blocks execution of all threads in a group until all group shared accesses have been completed and all threads in the group have reached this call. /// /// /// For more info, see . /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// public static void GroupMemoryBarrierWithGroupSync() => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(GroupMemoryBarrierWithGroupSync)}()"); /// /// Returns a lighting coefficient vector. /// /// The dot product of the normalized surface normal and the light vector. /// The dot product of the half-angle vector and the surface normal. /// A specular exponent. /// The lighting coefficient vector. /// /// This function returns a lighting coefficient vector (ambient, diffuse, specular, 1) where: /// /// Ambient: 1. /// Diffuse: n * l < 0 ? 0 : n * l. /// Specular: n * l < 0 || n * h < 0 ? 0 : (n * h) ^ m. /// /// Where the vector n is the normal vector, l is the direction to light and h is the half vector. /// For more info, see . /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [HlslIntrinsicName("lit")] public static float Lit(float nDotL, float nDotH, float m) => default; }