packages feed

fir-0.1.0.0: test/Tests/Layout/PerVertexBlocks.hs

{-# LANGUAGE BlockArguments   #-}
{-# LANGUAGE DataKinds        #-}
{-# LANGUAGE PolyKinds        #-}
{-# LANGUAGE RebindableSyntax #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeOperators    #-}

module Tests.Layout.PerVertexBlocks where

-- fir
import FIR

------------------------------------------------
-- loading and storing whole per-vertex built-in blocks

type Defs =
  '[ "main" ':-> EntryPoint '[ SpacingEqual, VertexOrderCw, OutputVertices 3 ] TessellationControl ]

program :: Module Defs
program = Module do
  entryPoint @"main" @TessellationControl do
    i     <- get @"gl_InvocationID"
    v     <- use @( Name "gl_in" :.: AnIndex Word32 ) i
    allIn <- get @"gl_in"
    assign @( Name "gl_out" :.: AnIndex Word32 ) i v
    assign @( Name "gl_out" :.: AnIndex Word32 :.: Name "gl_PointSize" ) i
      ( view @( Index 1 :.: Name "gl_PointSize" ) allIn )
    assign @( Name "gl_TessLevelOuter" :.: Index 0 ) 16