Skip to content

Commit

Permalink
Drop Aliasable instances (deleted upstream)
Browse files Browse the repository at this point in the history
  • Loading branch information
alt-romes committed Jun 7, 2024
1 parent edebd10 commit 0b06a00
Show file tree
Hide file tree
Showing 12 changed files with 5 additions and 44 deletions.
8 changes: 4 additions & 4 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 --
-----------------------------
Expand Down
2 changes: 1 addition & 1 deletion ghengin-core/ghengin-core-indep/Ghengin/Core/Prelude.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module Ghengin.Core.Prelude
, V.Vector

-- reference-counting
, Aliasable, Forgettable, Shareable, SomeAlias(..)
, Forgettable, Shareable, SomeAlias(..)

-- gl-block
, Block(..)
Expand Down
3 changes: 0 additions & 3 deletions ghengin-core/ghengin-core/Ghengin/Core/Renderer/Buffer.hsig
Original file line number Diff line number Diff line change
Expand Up @@ -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]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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 ()

Expand Down
2 changes: 0 additions & 2 deletions ghengin-core/ghengin-core/Ghengin/Core/Renderer/Sampler.hsig
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
Expand Down
2 changes: 0 additions & 2 deletions ghengin-core/ghengin-core/Ghengin/Core/Renderer/Texture.hsig
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
3 changes: 0 additions & 3 deletions ghengin-core/ghengin-vulkan/Ghengin/Vulkan/Renderer/Buffer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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].
Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0b06a00

Please sign in to comment.