fir-0.1.0.0: test/Tests/Layout/StructPadding.hs
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RebindableSyntax #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeOperators #-}
module Tests.Layout.StructPadding where
-- fir
import FIR
import Math.Linear
------------------------------------------------
-- members following a nested structure are placed after its padding
type T = Struct '[ "v" ':-> V 3 Float ]
type S =
Struct
'[ "s" ':-> T
, "f" ':-> Float
, "d" ':-> Struct '[ "x" ':-> V 4 Double, "y" ':-> Float ]
, "g" ':-> 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" )