Skip to content

Commit

Permalink
Answering #4
Browse files Browse the repository at this point in the history
  • Loading branch information
Artem M. Chirkin committed Jul 29, 2018
1 parent f605018 commit 74a9e9c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion vulkan-triangles/src/Lib.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,18 @@ import Lib.Vulkan.Vertex
import Lib.Vulkan.VertexBuffer


-- | Interleaved array of vertices containing at least 3 entries
-- | Interleaved array of vertices containing at least 3 entries.
--
-- Obviously, in real world vertices come from a separate file and not known at compile time.
-- The shader pipeline requires at least 3 unique vertices (for a triangle)
-- to render something on a screen. Setting `XN 3` here is just a handy way
-- to statically ensure the program satisfies this requirement.
-- This way, not-enough-vertices error occures at the moment of DataFrame initialization
-- instead of silently failing to render something onto a screen.
--
-- Note: in this program, `n >= 3` requirement is also forced in `Lib/Vulkan/VertexBuffer.h`,
-- where it is not strictly necessary but allows to avoid specifying DataFrame constraints
-- in function signatures (such as, e.g. `KnownDim n`).
vertices :: DataFrame Vertex '[XN 3]
vertices = fromJust $ fromList (D @3)
[ -- rectangle
Expand Down

1 comment on commit 74a9e9c

@achirkin
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, reference to an issue in a wrong project. This is meant to answer a comment in achirkin/easytensor#4

Please sign in to comment.