Yet another Vulkan based rendering engine.
Clone or download
omni-viral Merge pull request #42 from StarArawn/push-constants
Added push_graphics_constants to the render pass encoder.
Latest commit 82d82c8 Jan 29, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
chain Explicitly add only warnings that are not warnings by default. Jan 29, 2019
command Merge pull request #42 from StarArawn/push-constants Jan 29, 2019
docs Add logo Jan 12, 2019
factory Explicitly add only warnings that are not warnings by default. Jan 29, 2019
frame Explicitly add only warnings that are not warnings by default. Jan 29, 2019
graph Explicitly add only warnings that are not warnings by default. Jan 29, 2019
license Add license info Oct 4, 2018
memory Explicitly add only warnings that are not warnings by default. Jan 29, 2019
mesh Explicitly add only warnings that are not warnings by default. Jan 29, 2019
rendy Explicitly add only warnings that are not warnings by default. Jan 29, 2019
resource Explicitly add only warnings that are not warnings by default. Jan 29, 2019
shader Explicitly add only warnings that are not warnings by default. Jan 29, 2019
texture Explicitly add only warnings that are not warnings by default. Jan 29, 2019
util Explicitly add only warnings that are not warnings by default. Jan 29, 2019
wsi Explicitly add only warnings that are not warnings by default. Jan 29, 2019
.gitignore ignore .DS_Store Dec 21, 2018
.travis.yml Explicitly add only warnings that are not warnings by default. Jan 29, 2019
COPYING Update readme Oct 4, 2018
Cargo.toml Cleanup Dec 21, 2018
Makefile Cleanup Dec 21, 2018
README.md Add logo Jan 12, 2019
bors.toml Create bors.toml Oct 5, 2018
rustfmt.toml Add fmt conifg Oct 4, 2018

README.md

Build Status Crates.io docs page MIT/Apache Lines of Code

A rendering engine based on gfx-hal, which mimics the Vulkan API.

Features

Most importantly rendy features safer API by checking important states and invariants. It checks invariants statically using marker types and dynamically with stored values.

Capability

Queue family capability defines what operation queues of the family supports. rendy provides simple mechanism to prevent recording unsupported commands. Capability level can be stored statically by marking Family type with one of capability types: Transfer, Graphics, Compute or General (Graphics and Compute combined). Alternatively Capability type can be used instead of marker type, this way actual capability level can be checked dynamically.

Command buffer

rendy provides handy wrapper named CommandBuffer. In contrast to raw counterpart this wrapper encodes crutial information about its state directly into type level. This means user can't accidentially:

  • record command unsupported by queue family it belongs to.
  • record command when command buffer is not in recording state.
  • record render pass command outside renderpass.
  • forget to finish recording buffer before submitting.
  • resubmit command buffer which was created for one time use.
  • record execution of primary buffer into secondary buffer.
  • etc

Memory manager

rendy's memory manager is called Heaps. Heaps provides convenient methods to sub-allocate device-visible memory based on usage and visibility requirements. It also handles mapping for specific usage types. It is possible for gfx-hal to adopt VMA. In which case rendy will use it

Framegraph

rendy's framegraph allow writing rendering code in simple modular style. Making it much easier to composite complex frame from simple parts. User defines nodes which declare buffers and images it reads and writes. Framegraph takes responsibility for resource allocation and execution synchronization. User is responsible only for intra-node synchronization.

Cirques

This hybrid of circus and queue simplifies synchronizing host access to resources. Cirque allocates copies of the resource from resource spicific allocator (e.g. CommandPool for CommandBuffers, Factory for Buffers) and gives access to the unused copy.

CPU-GPU data flow - Not yet implemented

Rendy can help to send data between device and host. Factory can upload data to the device local memory choosing most appropriate technique for that.

  • Memory mapping will be used if device local memory happens to be cpu-visible.
  • Relatively small data will be uploaded directly to buffers.
  • Staging buffer will be used for bigger uploads or any image uploads. Factoy will automatically insert synchronization commands according to user request.

Layouts - Not yet implemented. More experiments required

Pipelines and descriptor sets has declarative nature and it is much easier to define them declaratively. rendy provides DescriptorSet trait. Deriving it will automatically generate code necessary for set creation, writing and binding. Deriving GraphicsPipeline trait will generate code for graphics pipeline creation and usage. Similar ComputePipeline trait exists for compute pipelines.

Example

#[derive(DescritorSet)]
struct Example {
    /// This field will be associated with binding 1 of type `VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER`.
    /// Actual `Buffer` will be allocated and kept updated by `Set<Example>`.
    #[descriptor(UniformBlock)]
    transform: mat4,

    /// This field will be associated with binding 2 of type `VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE`.
    /// `ImageView` will be fetched from `Texture` which implements `Borrow<ImageView>`.
    #[descriptor(SampledImage)]
    texture: Texture,

    /// Raw Vulkan objects can be used as well.
    /// But this field will make binding of `Set<Example>` to command buffer to require unsafe operation
    /// since it is user job to ensure that this raw image view is valid during command buffer execution.
    #[descriptor(unsafe, SampledImage)]
    foo: RawImageView,
}

Shader reflection - Not yet implemented

rendy will use spirv-relfect or similiar crate to read layout information directly from shaders and use it to automatically populate descriptors and set index/vertex buffers based on registered data sources.

Modularity

Most of the features provided by rendy can be used independently from others. This helps to keep API clean and hopefuly sound. Top-level umbrela crate rendy has feature for each subcrates so that they could be enabled separately (subcrate will also enable its depenencies).

Who is using it?

The first project to use rendy is expected to be the Amethyst project. Kindly open a PR or issue if you're aware of other projects using rendy.

License

Licensed under either of

at your option.