nano-ui
Safe HaskellNone
LanguageGHC2024

NanoUI.SIMD

Description

Vertex and index writers for the draw buffers. Each vertex is written with two 128-bit GHC SIMD stores (FloatX4#) instead of eight scalar stores.

Synopsis

Documentation

pokeVertexSIMD :: Ptr Word8 -> Int -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> IO () Source #

Writes one 32-byte Vertex (8 floats) into memory using two 128-bit SIMD stores instead of 8 scalar stores.

pokeQuadSIMD :: Ptr Word8 -> Int -> Ptr Word8 -> Int -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Word32 -> IO () Source #

Vectorized Quad Poking: writes 4 vertices (128 bytes total) and 6 indices (24 bytes total) with SIMD vector stores.

pokeQuadGradientSIMD :: Ptr Word8 -> Int -> Ptr Word8 -> Int -> Float -> Float -> Float -> Float -> Float -> Float -> (Float, Float, Float, Float) -> (Float, Float, Float, Float) -> (Float, Float, Float, Float) -> (Float, Float, Float, Float) -> Word32 -> IO () Source #

Vectorized Quad with 4 distinct corner colors (top-left, top-right, bottom-right, bottom-left)

concentricOffsetsSIMD :: Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> ((Float, Float), (Float, Float), (Float, Float), (Float, Float)) Source #

Evaluates 4 concentric arc positions: xs = cx + radii * ct ys = cy + radii * st

Scalar on purpose: GHC 9.14.1 miscompiles the broadcastpackunpack FloatX4# version at -O2 once it is inlined into a loop (liberate-case computed the y lane from cx), corrupting anti-aliased border vertices. The results are bit-identical to the vector version, which also multiplied and added separately.