brutal/Brutal.Slang/EntryPointLayoutExtensions.cs
BRUTAL release 4ac91e105e Update Slang, Vulkan, Gltf and ImGui. Offload natives to sub-packages.
Public-PR: https://github.com/ahwootech/BRUTAL/pull/9
Public-PR: https://github.com/ahwootech/BRUTAL/pull/15
Public-PR: https://github.com/ahwootech/BRUTAL/pull/21
Fixes: ahwootech/BRUTAL#8
Fixes: ahwootech/BRUTAL#22
Co-authored-by: Laurens de Voogd <laurens@devoogd.be>
Co-authored-by: sGo7-Dev <goulax16@gmail.com>
Co-authored-by: Capsup <capsup@live.dk>
2026-10-23 15:07:17 +13:00

20 lines
869 B
C#

namespace Brutal.SlangApi;
/// <summary>
/// Hand-written helpers on entry-point reflection handles for flat-C getters that fill
/// output arrays, which the generated signatures expose as raw pointers.
/// </summary>
public static unsafe class EntryPointLayoutExtensions
{
/// <summary>
/// Returns a compute entry point's thread-group size, its <c>[numthreads]</c>, along
/// X, Y and Z. The handle borrows from its program layout, so call this only while the
/// component that produced the layout is alive.
/// </summary>
public static (ulong X, ulong Y, ulong Z) GetComputeThreadGroupSize(this EntryPointLayout entryPoint)
{
var sizes = stackalloc ulong[3];
Slang.PInvoke.spReflectionEntryPoint_getComputeThreadGroupSize(entryPoint, 3, sizes);
return (sizes[0], sizes[1], sizes[2]);
}
}