Compiling this shader (using Swizzle) fails without error message
Running this program does nothing, i.e. does not produce a file called compute.spv
:
{-# LANGUAGE RebindableSyntax #-}
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE PartialTypeSignatures #-}
{-# OPTIONS_GHC -Wno-partial-type-signatures #-}
{-# OPTIONS_GHC -Wno-unused-do-bind #-}
module Main (main) where
import FIR
import Math.Linear
import Control.Monad (void)
main :: IO ()
main = void $ compileTo "compute.spv" [] compute
type ComputeDefs =
'[ "positions" ':-> StorageBuffer [DescriptorSet 1, Binding 0 ]
(Struct '["posArray" ':-> RuntimeArray (Struct '[ "pos" ':-> V 2 Float ])])
, "main" ':-> EntryPoint '[LocalSize 256 1 1] Compute
]
compute :: Module ComputeDefs
compute = Module $ entryPoint @"main" @Compute do
positions <- use @(Name "positions" :.: Name "posArray" :.: AnIndex Word32) 0
pos' <- let' $ over @(Name "pos" :.: Swizzle "x") (+ 0.01) positions
assign @(Name "positions" :.: Name "posArray" :.: AnIndex Word32) 0 position
Removing the line containing pos'
makes it produce the file compute.spv
successfully, as does replacing Swizzle "x"
with Index 0
.
Edited by Jakob Brünker