packages feed

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

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

module Tests.Layout.Matrices where

-- fir
import FIR
import Math.Linear

------------------------------------------------
-- matrices whose columns are smaller than their alignment

type S =
  Struct
    '[ "m2"  ':-> M 2 2 Float
     , "m3"  ':-> M 3 3 Float
     , "m23" ':-> M 2 3 Float
     , "ms"  ':-> Array 2 ( M 3 3 Float )
     , "f"   ':-> Float
     ]

type Defs =
  '[ "ubo"  ':-> Uniform '[ DescriptorSet 0, Binding 0 ] ( Struct '[ "s" ':-> S ] )
   , "ssbo" ':-> StorageBuffer '[ DescriptorSet 0, Binding 1 ] ( Struct '[ "s" ':-> S ] )
   , "main" ':-> EntryPoint '[ LocalSize 1 1 1 ] Compute
   ]

program :: Module Defs
program = Module do
  entryPoint @"main" @Compute do
    assign @( Name "ssbo" :.: Name "s" ) =<< use @( Name "ubo" :.: Name "s" )