Commit e846d7e6 authored by sheaf's avatar sheaf
Browse files

various documentation updates

parent 48dd1830
......@@ -243,6 +243,13 @@ bk7 = [ ( 1.03961212 , 6.00069867e-3 )
, ( 1.01046945 , 1.03560653e2 )
]
denseFlint :: [ ( Float, Float ) ]
denseFlint =
[ ( 1.72448482 , 0.0134871947 )
, ( 0.390104889, 0.0569318095 )
, ( 1.04572858 , 118.557185 )
]
cu :: Map Float ( V 2 Float )
cu = Map.fromList
[ ( 302.400421, V2 1.380000 1.687000 )
......
......@@ -8,6 +8,7 @@
- [Hot reloading](#hotreloading)
- [Overview of examples](#overview)
- [Kerr space-time](#kerr)
- [Path tracer](#raytracing)
- [Full graphics pipeline](#fullpipeline)
- [FIR logo](#logo)
- [Hopf fibration](#hopf)
......@@ -70,6 +71,9 @@ for the Vulkan SDK on Linux.
<a name="darwin"></a>
### MacOS (via MoltenVK and nix)
**TODO:** these instructions are outdated; see issue [#80](https://gitlab.com/sheaf/fir/-/issues/80).
`default.nix` contains overlays for `vulkan-api` and `fir` as well as a derivation for `fir-examples`. Because `MoltenVK` only supports a subset of the Vulkan spec (and only SPIR-V version 1.0), not all the examples run. `JuliaSet`, `Texture`, and `Logo` run successfuly on MacOS Mojave.
Build the project:
......@@ -135,6 +139,19 @@ Render of a rotating black hole with a tilted accretion disk.
Consists of a compute shader using a Runge–Kutta numerical integrator to solve the geodesic equations of Kerr space-time backwards in time (relativistic ray-tracing).
<a name="raytracing"></a>
### Path tracer
<div align="center">
<a href="../img/raytracing_large.png"><img src="../img/raytracing_small.png" alt="RayTracing"></a> <br>
[Application](examples/apps/FIR/Examples/RayTracing/Application.hs) • [Shaders](examples/shaders/FIR/Examples/RayTracing/Shaders.hs)
</div>
Spectral path tracer that uses Vulkan ray-tracing shaders. Press `L` to lock the camera (which lets the renderer converge).
Uses uni-directional path tracing with explicit light sampling (weighted with multiple importance sampling).
Several scenes are available. Running the example in GHCi, you will be asked to pick a scene. If running the executable directly, the scene name can be passed as a command line argument.
<a name="fullpipeline"></a>
### Full graphics pipeline
<div align="center">
......
......@@ -31,7 +31,7 @@ Refer to the ["getting started" guide (simple shader example)](getting_started.m
Here are some of the library's __features__:
* Support for all native Vulkan execution models (all graphics shaders, as well as compute shaders), and OpenCL compute kernels. See the [examples](#examples) for illustration.
* Support for all native Vulkan execution models (all graphics shaders, as well as compute shaders), ray-tracing shaders, and OpenCL compute kernels. See the [examples](#examples) for illustration.
* Image sampling and load/store, with a convenient functional interface given by specifying image operands. This avoids having many different image sampling functions like in GLSL (e.g. `sampler2DArrayShadow`, `textureProjOffset`, ...).
* Control flow: if-then-else, switch statements and loops, compiled to [SSA form using ϕ-functions](https://en.wikipedia.org/wiki/Static_single_assignment_form). GPU synchronisation with control and memory barriers.
* Functor/applicative operations, compiling to efficient code (vectorised operations, loops).
......@@ -60,7 +60,8 @@ See also the library's [issue tracker](https://gitlab.com/sheaf/fir/issues) for
<div align="center">
<a href="img/kerr_large.png"><img src="img/kerr.png" alt="Kerr space-time"></a> <br>
<a href="fir-examples/readme.md#fullpipeline"><img src="img/full_pipeline_small.png" alt="Full graphics pipeline"></a> <a href="fir-examples/readme.md#logo"><img src="img/logo_small.png" alt="FIR logo (compute shader)"></a> <a href="fir-examples/readme.md#hopf"><img src="img/hopf_small.png" alt="Hopf fibration"></a> <a href="fir-examples/readme.md#texture"><img src="img/texture_small.png" alt="Texture sampling"></a> <a href="fir-examples/readme.md#ising"><img src="img/ising_small.png" alt="Ising model"></a> <a href="fir-examples/readme.md#julia"><img src="img/julia_small.png" alt="Julia set"></a> <a href="fir-examples/readme.md#offscreen"><img src="img/offscreen_small.png" alt="Offscreen rendering"></a> <a href="fir-examples/readme.md#bezier"><img src="img/bezier_small.png" alt="Bézier curves"></a>
<a href="fir-examples/readme.md#fullpipeline"><img src="img/full_pipeline_small.png" alt="Full graphics pipeline"></a> <a href="fir-examples/readme.md#logo"><img src="img/logo_small.png" alt="FIR logo (compute shader)"></a> <a href="fir-examples/readme.md#hopf"><img src="img/hopf_small.png" alt="Hopf fibration"></a> <a href="fir-examples/readme.md#texture"><img src="img/texture_small.png" alt="Texture sampling"></a> <a href="fir-examples/readme.md#ising"><img src="img/ising_small.png" alt="Ising model"></a> <a href="fir-examples/readme.md#julia"><img src="img/julia_small.png" alt="Julia set"></a> <a href="fir-examples/readme.md#offscreen"><img src="img/offscreen_small.png" alt="Offscreen rendering"></a> <a href="fir-examples/readme.md#bezier"><img src="img/bezier_small.png" alt="Bézier curves"></a> <br>
<a href="img/raytracing_large.png"><img src="img/raytracing.png" alt="Spectral path tracer"></a> <br>
</div>
Usage examples are included in the **fir-examples** subdirectory.
......
......@@ -18,7 +18,7 @@ module Data.Type.Map where
import Data.Type.Bool
( If )
import Data.Type.Ord
(Compare)
( Compare )
import GHC.TypeLits
( TypeError, ErrorMessage(..) )
......
......@@ -6,6 +6,19 @@
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
{-|
Module: FIR.Syntax.Complex
Syntax for manipulating complex numbers.
@CodeComplex a@ is a newtype around @Code (V 2 a)@, but with a @ComplexFloat@ instance allowing for complex arithmetic.
Complex numbers can be constructed using using @:+:@, e.g. @0 :+: 1@ represents the imaginary unit @i@.
Note that @Floating@ operations such as trigonometric functions are not provided, as these are not supported by @SPIR-V@.
-}
module FIR.Syntax.Complex
( CodeComplex(..), pattern (:+:) )
where
......@@ -41,6 +54,8 @@ import FIR.Syntax.Synonyms
----------------------------------------------------------------------------
-- | Newtype around @Code (V 2 a)@, but with typeclass instances
-- for complex arithmetic.
newtype CodeComplex a = CodeComplex { codeComplex :: Code ( V 2 a ) }
instance (ScalarTy a) => Syntactic (CodeComplex a) where
......
......@@ -59,6 +59,14 @@ we then give @x'@ the (immutable) value of @1@.
This subtlety is especially important when working with @while@ loops,
as one wants to avoid having a constant conditional in the header.
Note that overloaded labels don't support visible type application in GHC 9.0 [due to a bug](https://gitlab.haskell.org/ghc/ghc/-/issues/19154).
For that version of GHC, you will need to write
> #label #= ( val :: type )
instead of
> #label @type #= val
-}
module FIR.Syntax.Labels
......
......@@ -8,6 +8,12 @@
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-|
Module: FIR.Syntax.RayTracing
Ray-tracing and ray-query operations, such as 'traceRay', 'reportIntersection', 'executeCallable'...
-}
module FIR.Syntax.RayTracing where
-- base
......
......@@ -41,8 +41,11 @@ import GHC.TypeNats
-- fir
import Data.Type.Maybe
( FromMaybe )
import Data.Type.Map
(Map, UnionWithAppend, (:->)((:->)), InsertWithAppend )
( (:->)((:->)), Map
, InsertWithAppend, UnionWithAppend
)
import FIR.Definition
( Definition(..)
, TriagedDefinitions
......
......@@ -4,6 +4,13 @@
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-|
Module: FIR.Validation.RayTracing
Validation of ray-tracing and ray-query operations.
-}
module FIR.Validation.RayTracing
( -- * Ray tracing validation
CanTraceRay, CanExecuteCallable
......
......@@ -118,6 +118,7 @@ type family BitsType (bs :: (Type,Type)) :: Type where
type family ShiftType (bs :: (Type,Type)) :: Type where
ShiftType '(_,b) = b
-- | Bit-shift operations.
class (bs ~ '(BitsType bs, ShiftType bs)) => BitShift (bs :: (Type,Type)) where
-- | Shift the first argument left by the specified number of bits.
--
......@@ -161,6 +162,8 @@ deriving via '(Base CULong ,(s :: Type)) instance (Integral s, Prelude.Integral
deriving via '(Base CLLong ,(s :: Type)) instance (Integral s, Prelude.Integral s) => BitShift '(CLLong ,s)
deriving via '(Base CULLong,(s :: Type)) instance (Integral s, Prelude.Integral s) => BitShift '(CULLong,s)
-- | The 'BitCast' typeclass is used to cast between floating-point numbers and their binary representation,
-- e.g between a 'Float' and its representation as a 'Word32'.
class BitCast a b where
bitcast :: a -> b
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment