diff --git a/cabal.project b/cabal.project index 0caccd3..28a9868 100644 --- a/cabal.project +++ b/cabal.project @@ -38,6 +38,10 @@ allow-newer: linear-apecs:*, typelits-witnesses:* +source-repository-package + type: git + location: https://github.com/alt-romes/reference-counting.git + source-repository-package type: git location: https://gitlab.com/sheaf/fir.git @@ -63,10 +67,6 @@ source-repository-package -- type: git -- location: https://github.com/haskell-game/dear-imgui.hs.git -source-repository-package - type: git - location: https://github.com/alt-romes/reference-counting.git - ----------------------------- -- GHC 9.8 support patches -- ----------------------------- diff --git a/ghengin-core/ghengin-core-indep/Ghengin/Core/Prelude.hs b/ghengin-core/ghengin-core-indep/Ghengin/Core/Prelude.hs index c4a01ce..b596867 100644 --- a/ghengin-core/ghengin-core-indep/Ghengin/Core/Prelude.hs +++ b/ghengin-core/ghengin-core-indep/Ghengin/Core/Prelude.hs @@ -29,7 +29,7 @@ module Ghengin.Core.Prelude , V.Vector -- reference-counting - , Aliasable, Forgettable, Shareable, SomeAlias(..) + , Forgettable, Shareable, SomeAlias(..) -- gl-block , Block(..) diff --git a/ghengin-core/ghengin-core/Ghengin/Core/Renderer/Buffer.hsig b/ghengin-core/ghengin-core/Ghengin/Core/Renderer/Buffer.hsig index 8520221..e444717 100644 --- a/ghengin-core/ghengin-core/Ghengin/Core/Renderer/Buffer.hsig +++ b/ghengin-core/ghengin-core/Ghengin/Core/Renderer/Buffer.hsig @@ -10,8 +10,6 @@ import Ghengin.Core.Mesh.Vertex import Ghengin.Core.Renderer.Kernel import Graphics.Gl.Block -import Data.Linear.Alias (Aliasable) - {- Note [Mapped vs Device-local Buffers] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -79,7 +77,6 @@ destroyDeviceLocalBuffer :: DeviceLocalBuffer ⊸ Renderer () -- | A mapped (uniform) buffer. See Note [Mapped vs Device-local Buffers] data MappedBuffer -instance Aliasable MappedBuffer -- | TODO: Drop dependency on Vulkan and make DescriptorType a data type renderer agnostic createMappedBuffer :: Word -> Vk.DescriptorType -> Renderer (Alias MappedBuffer) diff --git a/ghengin-core/ghengin-core/Ghengin/Core/Renderer/DescriptorSet.hsig b/ghengin-core/ghengin-core/Ghengin/Core/Renderer/DescriptorSet.hsig index 896c163..ea3491b 100644 --- a/ghengin-core/ghengin-core/Ghengin/Core/Renderer/DescriptorSet.hsig +++ b/ghengin-core/ghengin-core/Ghengin/Core/Renderer/DescriptorSet.hsig @@ -21,7 +21,6 @@ type ResourceMap = IntMap DescriptorResource data DescriptorResource where UniformResource :: Alias MappedBuffer ⊸ DescriptorResource Texture2DResource :: Alias Texture2D ⊸ DescriptorResource -instance Aliasable DescriptorResource instance Forgettable Renderer DescriptorResource instance Shareable m DescriptorResource @@ -38,14 +37,12 @@ instance Shareable m DescriptorResource -- ResourceMap ) data DescriptorPool -instance Aliasable DescriptorPool createDescriptorPool :: ShaderPipeline info -> Renderer DescriptorPool data DescriptorSet -instance Aliasable DescriptorSet -- | Allocates a descriptor set whose layout is defined according to the shader -- pipeline information stored in the descriptor pool. diff --git a/ghengin-core/ghengin-core/Ghengin/Core/Renderer/RenderPass.hsig b/ghengin-core/ghengin-core/Ghengin/Core/Renderer/RenderPass.hsig index 201296e..6d1c710 100644 --- a/ghengin-core/ghengin-core/Ghengin/Core/Renderer/RenderPass.hsig +++ b/ghengin-core/ghengin-core/Ghengin/Core/Renderer/RenderPass.hsig @@ -1,7 +1,6 @@ signature Ghengin.Core.Renderer.RenderPass where import Ghengin.Core.Renderer.Kernel -import Data.Linear.Alias (Aliasable) -- import Ghengin.Vulkan.RenderPass -- ( createSimpleRenderPass, @@ -10,8 +9,6 @@ import Data.Linear.Alias (Aliasable) data RenderPass -instance Aliasable RenderPass - createSimpleRenderPass :: Renderer RenderPass -- If we always need this as a reference, it's easier to just return it as such here (avoids exposing a free function) destroyRenderPass :: RenderPass ⊸ Renderer () diff --git a/ghengin-core/ghengin-core/Ghengin/Core/Renderer/Sampler.hsig b/ghengin-core/ghengin-core/Ghengin/Core/Renderer/Sampler.hsig index 481bfef..35a88f3 100644 --- a/ghengin-core/ghengin-core/Ghengin/Core/Renderer/Sampler.hsig +++ b/ghengin-core/ghengin-core/Ghengin/Core/Renderer/Sampler.hsig @@ -2,12 +2,10 @@ signature Ghengin.Core.Renderer.Sampler where -- TODO: Define isomporphic types and remove vulkan dependency import qualified Vulkan as Vk -import Data.Linear.Alias (Aliasable) import Ghengin.Core.Renderer.Kernel data Sampler -instance Aliasable Sampler createSampler :: Vk.Filter -> Vk.SamplerAddressMode -> Renderer (Alias Sampler) destroySampler :: Sampler ⊸ Renderer () diff --git a/ghengin-core/ghengin-core/Ghengin/Core/Renderer/Texture.hsig b/ghengin-core/ghengin-core/Ghengin/Core/Renderer/Texture.hsig index dd2afed..b712cb6 100644 --- a/ghengin-core/ghengin-core/Ghengin/Core/Renderer/Texture.hsig +++ b/ghengin-core/ghengin-core/Ghengin/Core/Renderer/Texture.hsig @@ -1,13 +1,11 @@ signature Ghengin.Core.Renderer.Texture where import Prelude (FilePath) -import Data.Linear.Alias (Aliasable) import Ghengin.Core.Renderer.Sampler import Ghengin.Core.Renderer.Kernel data Texture2D -instance Aliasable Texture2D texture :: FilePath -> Alias Sampler ⊸ Renderer (Alias Texture2D) diff --git a/ghengin-core/ghengin-vulkan/Ghengin/Vulkan/Renderer/Buffer.hs b/ghengin-core/ghengin-vulkan/Ghengin/Vulkan/Renderer/Buffer.hs index 062f9bc..76badec 100644 --- a/ghengin-core/ghengin-vulkan/Ghengin/Vulkan/Renderer/Buffer.hs +++ b/ghengin-core/ghengin-vulkan/Ghengin/Vulkan/Renderer/Buffer.hs @@ -107,9 +107,6 @@ data MappedBuffer = UniformBuffer { buffer :: {-# UNPACK #-} !Vk.Buffer -- ^ When `DeviceMemory` is mapped, we get a `hostMem` pointer to it. , bufSize :: {-# UNPACK #-} !(Ur Word) } -instance Aliasable MappedBuffer where - countedFields _ = [] - {-# INLINE countedFields #-} -- | Create a uniform buffer with a given size, but don't copy memory to it -- yet. See 'writeUniformBuffer' for that. diff --git a/ghengin-core/ghengin-vulkan/Ghengin/Vulkan/Renderer/DescriptorSet.hs b/ghengin-core/ghengin-vulkan/Ghengin/Vulkan/Renderer/DescriptorSet.hs index ac83b02..9162334 100644 --- a/ghengin-core/ghengin-vulkan/Ghengin/Vulkan/Renderer/DescriptorSet.hs +++ b/ghengin-core/ghengin-vulkan/Ghengin/Vulkan/Renderer/DescriptorSet.hs @@ -83,11 +83,6 @@ data DescriptorResource where Texture2DResource :: Alias Texture2D ⊸ DescriptorResource deriving Generic -instance Aliasable DescriptorResource where - -- Reliable automatic instance through generic still not working (TODO) - countedFields (UniformResource x) = [SomeAlias x] - countedFields (Texture2DResource x) = [SomeAlias x] - instance Forgettable Renderer DescriptorResource where forget = \case UniformResource u -> Alias.forget u @@ -222,10 +217,6 @@ data DescriptorPool = , set_bindings :: IntMap (Vk.DescriptorSetLayout, BindingsMap) } -instance Aliasable DescriptorPool where - countedFields _ = [] - {-# INLINE countedFields #-} - -- | Todo: Linear Types. The created pool must be freed. -- -- Creates a pool as described in Note [Pools]. @@ -291,10 +282,6 @@ data DescriptorSet , _descriptorSet :: Vk.DescriptorSet } -instance Aliasable DescriptorSet where - countedFields _ = [] - {-# INLINE countedFields #-} - -- | Allocate a descriptor set from a descriptor pool. This descriptor pool has -- the information required to allocate a descriptor set based on its index in -- the shader. diff --git a/ghengin-core/ghengin-vulkan/Ghengin/Vulkan/Renderer/RenderPass.hs b/ghengin-core/ghengin-vulkan/Ghengin/Vulkan/Renderer/RenderPass.hs index 31e908f..c20d1d4 100644 --- a/ghengin-core/ghengin-vulkan/Ghengin/Vulkan/Renderer/RenderPass.hs +++ b/ghengin-core/ghengin-vulkan/Ghengin/Vulkan/Renderer/RenderPass.hs @@ -54,10 +54,6 @@ data RenderPass = VulkanRenderPass { _renderPass :: Vk.RenderPass , _framebuffers :: Vector.Vector Vk.Framebuffer } -instance Aliasable RenderPass where - countedFields _ = [] - {-# INLINE countedFields #-} - -- withSimpleRenderPass :: (RenderPass -> Renderer a) -> Renderer a -- withSimpleRenderPass f = rendererBracket createSimpleRenderPass destroyRenderPass f diff --git a/ghengin-core/ghengin-vulkan/Ghengin/Vulkan/Renderer/Sampler.hs b/ghengin-core/ghengin-vulkan/Ghengin/Vulkan/Renderer/Sampler.hs index c2eab39..9e44c97 100644 --- a/ghengin-core/ghengin-vulkan/Ghengin/Vulkan/Renderer/Sampler.hs +++ b/ghengin-core/ghengin-vulkan/Ghengin/Vulkan/Renderer/Sampler.hs @@ -35,9 +35,6 @@ import Ghengin.Vulkan.Renderer.Kernel import qualified Data.Linear.Alias as Alias newtype Sampler = Sampler { sampler :: Vk.Sampler } -instance Aliasable Sampler where - countedFields _ = [] - {-# INLINE countedFields #-} -- | Create a sampler with the given filter and sampler address mode -- diff --git a/ghengin-core/ghengin-vulkan/Ghengin/Vulkan/Renderer/Texture.hs b/ghengin-core/ghengin-vulkan/Ghengin/Vulkan/Renderer/Texture.hs index 175fc61..561d52c 100644 --- a/ghengin-core/ghengin-vulkan/Ghengin/Vulkan/Renderer/Texture.hs +++ b/ghengin-core/ghengin-vulkan/Ghengin/Vulkan/Renderer/Texture.hs @@ -39,9 +39,6 @@ data Texture2D = Texture2D { image :: VulkanImage , sampler :: Alias Sampler } deriving Generic -instance Aliasable Texture2D where - countedFields (Texture2D _ s) = [SomeAlias s] - texture :: FilePath -> Alias Sampler ⊸ Renderer (Alias Texture2D) texture fp sampler = enterD "Creating a texture" Linear.do liftSystemIOU (readImage fp) >>= \case