module Render.Unlit.Colored.Pipeline ( Pipeline , allocate , allocateWireframe , Config , config , configWireframe , stageCode , stageSpirv ) where import RIO import Control.Monad.Trans.Resource (ResourceT) import Data.Tagged (Tagged(..)) import Vulkan.Core10 qualified as Vk import Engine.Vulkan.Pipeline.Graphics qualified as Graphics import Engine.Vulkan.Types (DsLayoutBindings, HasVulkan, HasRenderPass(..)) import Render.Code (compileVert, compileFrag) import Render.DescSets.Set0 (Scene) import Render.Unlit.Colored.Code qualified as Code import Render.Unlit.Colored.Model qualified as Model type Pipeline = Graphics.Pipeline '[Scene] Model.Vertex Model.InstanceAttrs type Config = Graphics.Configure Pipeline type instance Graphics.Specialization Pipeline = () allocate :: ( HasVulkan env , HasRenderPass renderpass ) => Bool -> Vk.SampleCountFlagBits -> Tagged Scene DsLayoutBindings -> renderpass -> ResourceT (RIO env) Pipeline allocate :: forall env renderpass. (HasVulkan env, HasRenderPass renderpass) => Bool -> SampleCountFlagBits -> Tagged Scene DsLayoutBindings -> renderpass -> ResourceT (RIO env) Pipeline allocate Bool useDepth SampleCountFlagBits multisample Tagged Scene DsLayoutBindings tset0 renderpass rp = do (ReleaseKey _, Pipeline p) <- Maybe Extent2D -> SampleCountFlagBits -> Config '[Scene] (Vertex Packed VertexAttrs) Transform () -> renderpass -> ResourceT (RIO env) (ReleaseKey, Pipeline) forall {k1} {k2} config pipeline (dsl :: [*]) (vertices :: k1) (instances :: k2) spec env (m :: * -> *) renderpass. (config ~ Configure pipeline, pipeline ~ Pipeline dsl vertices instances, spec ~ Specialization pipeline, Specialization spec, HasCallStack, MonadVulkan env m, MonadResource m, HasRenderPass renderpass) => Maybe Extent2D -> SampleCountFlagBits -> Config dsl vertices instances spec -> renderpass -> m (ReleaseKey, pipeline) Graphics.allocate Maybe Extent2D forall a. Maybe a Nothing SampleCountFlagBits multisample (Bool -> Tagged Scene DsLayoutBindings -> Configure Pipeline config Bool useDepth Tagged Scene DsLayoutBindings tset0) renderpass rp Pipeline -> ResourceT (RIO env) Pipeline forall a. a -> ResourceT (RIO env) a forall (f :: * -> *) a. Applicative f => a -> f a pure Pipeline p allocateWireframe :: ( HasVulkan env , HasRenderPass renderpass ) => Bool -> Vk.SampleCountFlagBits -> Tagged Scene DsLayoutBindings -> renderpass -> ResourceT (RIO env) Pipeline allocateWireframe :: forall env renderpass. (HasVulkan env, HasRenderPass renderpass) => Bool -> SampleCountFlagBits -> Tagged Scene DsLayoutBindings -> renderpass -> ResourceT (RIO env) Pipeline allocateWireframe Bool useDepth SampleCountFlagBits multisample Tagged Scene DsLayoutBindings tset0 renderpass rp = do (ReleaseKey _, Pipeline p) <- Maybe Extent2D -> SampleCountFlagBits -> Config '[Scene] (Vertex Packed VertexAttrs) Transform () -> renderpass -> ResourceT (RIO env) (ReleaseKey, Pipeline) forall {k1} {k2} config pipeline (dsl :: [*]) (vertices :: k1) (instances :: k2) spec env (m :: * -> *) renderpass. (config ~ Configure pipeline, pipeline ~ Pipeline dsl vertices instances, spec ~ Specialization pipeline, Specialization spec, HasCallStack, MonadVulkan env m, MonadResource m, HasRenderPass renderpass) => Maybe Extent2D -> SampleCountFlagBits -> Config dsl vertices instances spec -> renderpass -> m (ReleaseKey, pipeline) Graphics.allocate Maybe Extent2D forall a. Maybe a Nothing SampleCountFlagBits multisample (Bool -> Tagged Scene DsLayoutBindings -> Configure Pipeline configWireframe Bool useDepth Tagged Scene DsLayoutBindings tset0) renderpass rp Pipeline -> ResourceT (RIO env) Pipeline forall a. a -> ResourceT (RIO env) a forall (f :: * -> *) a. Applicative f => a -> f a pure Pipeline p config :: Bool -> Tagged Scene DsLayoutBindings -> Config config :: Bool -> Tagged Scene DsLayoutBindings -> Configure Pipeline config Bool useDepth (Tagged DsLayoutBindings set0) = Config '[] Any Any () forall {k1} {k2} (vertices :: k1) (instances :: k2). Config '[] vertices instances () Graphics.baseConfig { $sel:cDescLayouts:Config :: Tagged '[Scene] [DsLayoutBindings] Graphics.cDescLayouts = forall (s :: [*]) b. b -> Tagged s b forall {k} (s :: k) b. b -> Tagged s b Tagged @'[Scene] [DsLayoutBindings set0] , $sel:cStages:Config :: StageSpirv Graphics.cStages = StageSpirv stageSpirv , $sel:cVertexInput:Config :: SomeStruct PipelineVertexInputStateCreateInfo Graphics.cVertexInput = forall a (pipeLayout :: [*]) vertices instances. (a ~ Pipeline pipeLayout vertices instances, HasVertexInputBindings vertices, HasVertexInputBindings instances) => SomeStruct PipelineVertexInputStateCreateInfo forall {k1} {k2} a (pipeLayout :: [*]) (vertices :: k1) (instances :: k2). (a ~ Pipeline pipeLayout vertices instances, HasVertexInputBindings vertices, HasVertexInputBindings instances) => SomeStruct PipelineVertexInputStateCreateInfo Graphics.vertexInput @Pipeline , $sel:cBlend:Config :: Bool Graphics.cBlend = Bool True , $sel:cDepthTest:Config :: Bool Graphics.cDepthTest = Bool useDepth , $sel:cDepthWrite:Config :: Bool Graphics.cDepthWrite = Bool useDepth } stageCode :: Graphics.StageCode stageCode :: StageCode stageCode = ("vert" ::: Code) -> ("vert" ::: Code) -> StageCode forall a. ("vert" ::: a) -> ("vert" ::: a) -> Stages (Maybe ("vert" ::: a)) Graphics.basicStages "vert" ::: Code Code.vert "vert" ::: Code Code.frag stageSpirv :: Graphics.StageSpirv stageSpirv :: StageSpirv stageSpirv = ("vert" ::: ByteString) -> ("vert" ::: ByteString) -> StageSpirv forall a. ("vert" ::: a) -> ("vert" ::: a) -> Stages (Maybe ("vert" ::: a)) Graphics.basicStages "vert" ::: ByteString vertSpirv "vert" ::: ByteString fragSpirv vertSpirv :: ByteString vertSpirv :: "vert" ::: ByteString vertSpirv = $(compileVert Code.vert) fragSpirv :: ByteString fragSpirv :: "vert" ::: ByteString fragSpirv = $(compileFrag Code.frag) configWireframe :: Bool -> Tagged Scene DsLayoutBindings -> Config configWireframe :: Bool -> Tagged Scene DsLayoutBindings -> Configure Pipeline configWireframe Bool useDepth Tagged Scene DsLayoutBindings tset0 = (Bool -> Tagged Scene DsLayoutBindings -> Configure Pipeline config Bool useDepth Tagged Scene DsLayoutBindings tset0) { $sel:cTopology:Config :: PrimitiveTopology Graphics.cTopology = PrimitiveTopology Vk.PRIMITIVE_TOPOLOGY_LINE_LIST }