summaryrefslogtreecommitdiff
path: root/Shaders.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Shaders.hs')
-rw-r--r--Shaders.hs23
1 files changed, 23 insertions, 0 deletions
diff --git a/Shaders.hs b/Shaders.hs
new file mode 100644
index 0000000..f94bc43
--- /dev/null
+++ b/Shaders.hs
@@ -0,0 +1,23 @@
+{-# LANGUAGE BlockArguments #-}
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE RebindableSyntax #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeOperators #-}
+
+-- from the FIR docs
+module Shaders where
+
+import FIR
+import Math.Linear
+
+type FragmentDefs = '[ "in_pos" ':-> Input '[ Location 0 ] (V 2 Float)
+ , "out_col" ':-> Output '[ Location 0 ] (V 4 Float)
+ , "image" ':-> Texture2D '[ DescriptorSet 0, Binding 0 ] (RGBA8 UNorm)
+ , "main" ':-> EntryPoint '[ OriginLowerLeft ] Fragment
+ ]
+
+fragment :: Module FragmentDefs
+fragment = Module $ entryPoint @"main" @Fragment do
+ pos <- get @"in_pos"
+ col <- use @(ImageTexel "image") NilOps pos
+ put @"out_col" col \ No newline at end of file