• Stars
    star
    490
  • Rank 89,527 (Top 2 %)
  • Language
    C++
  • License
    MIT License
  • Created over 6 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Rendering abstraction which describes a frame as a directed acyclic graph of render tasks and resources.

What is a framegraph?

A rendering abstraction which describes a frame as a directed acyclic graph of render tasks and resources. Based on the Game Developers Conference (GDC) presentation by Yuriy O’Donnell.

What is a render task?

A compute or graphics task to be performed as part of a rendering pipeline.

What is a resource?

Data created, read or written by a render task. Alternates between two states; virtual and real. While virtual, the resource is not instantiated but contains the necessary information to do so. While real, the resource is instantiated and ready for use. A transient resource is owned, realized and virtualized by the framegraph. A retained resource is always real and is imported into the framegraph.

Usage

First, create descriptions for your rendering resources (e.g. buffers, textures) and declare them as framegraph resources.

struct buffer_description
{
  std::size_t size;
};
struct texture_description
{
  std::size_t                levels;
  GLenum                     format;
  std::array<std::size_t, 3> size  ;
};

using buffer_resource     = fg::resource<buffer_description , gl::buffer    >;
using texture_1d_resource = fg::resource<texture_description, gl::texture_1d>;
using texture_2d_resource = fg::resource<texture_description, gl::texture_2d>;
using texture_3d_resource = fg::resource<texture_description, gl::texture_3d>;

Then, specialize fg::realize<description_type, actual_type> for each declared resource. This function takes in a resource description and returns an actual resource.

namespace fg
{
template<>
std::unique_ptr<gl::buffer>     realize(const buffer_description&  description)
{
  auto actual = std::make_unique<gl::buffer>(); 
  actual->set_size(static_cast<GLsizeiptr>(description.size));
  return actual;
}
template<>
std::unique_ptr<gl::texture_2d> realize(const texture_description& description)
{
  auto actual = std::make_unique<gl::texture_2d>();
  actual->set_storage(
    description.levels , 
    description.format , 
    description.size[0], 
    description.size[1]);
  return actual;
}
}

You are now ready to create a framegraph and add your render tasks / retained resources to it.

fg::framegraph framegraph;

gl::texture_2d backbuffer;
auto retained_resource = framegraph.add_retained_resource(
  "Backbuffer", 
  texture_description(), 
  &backbuffer);

struct render_task_data
{
  texture_2d_resource* input1;
  texture_2d_resource* input2;
  texture_2d_resource* input3;
  texture_2d_resource* output;
};
auto render_task = framegraph.add_render_task<render_task_data>(
  "Render Task",
  [&] (render_task_data& data, fg::render_task_builder& builder)
  {
    data.input1 = builder.create<texture_2d_resource>("Texture 1", texture_description());
    data.input2 = builder.create<texture_2d_resource>("Texture 2", texture_description());
    data.input3 = builder.create<texture_2d_resource>("Texture 3", texture_description());
    data.output = builder.write <texture_2d_resource>(retained_resource);
  },
  [=] (const render_task_data& data)
  {
    auto actual1 = data.input1->actual();
    auto actual2 = data.input2->actual();
    auto actual3 = data.input3->actual();
    auto actual4 = data.output->actual();
    // Perform actual rendering. You may load resources from CPU by capturing them.
  });

auto& data = render_task->data();

Once all render tasks and resources are added, call framegraph.compile(). Then, framegraph.execute() in each update. It is also possible to export to GraphViz for debugging / visualization via framegraph.export_graphviz(filename):

alt text

alt text

Next Steps

  • Asynchronous render tasks (+ resource / aliasing barriers).

More Repositories

1

gl

Header-only C++17 wrapper for OpenGL 4.6 Core Profile.
C++
156
star
2

cmake_templates

Concise CMake templates for creating C++ libraries or executables.
C++
123
star
3

mpi

Header-only C++20 wrapper for MPI 4.0.
C++
39
star
4

acd

Single file utilities for C++.
C++
30
star
5

rational

Implementation of the std::experimental::rational proposal.
C++
9
star
6

ode

Header-only ordinary differential equation solvers in C++20.
C++
8
star
7

uci

Single header implementation of the Universal Chess Interface (UCI) protocol.
C++
7
star
8

vcv_plugin_template

A concise template for creating VCV rack plugins.
Shell
6
star
9

ec

Data-driven entity-component-system built on top of boost mp11.
C++
5
star
10

monte_carlo

Single header Monte Carlo simulator.
C++
4
star
11

hdf

Header-only C++20 wrapper for HDF5. [WIP]
C++
4
star
12

vulkan_sdl

Create a Vulkan surface from an SDL window. Deprecated: SDL now provides identical functionality natively.
C++
4
star
13

magpie

A minimalistic rendering engine based on ImGui and Im3d.
C++
4
star
14

fd

Generic finite differences in C++20.
C++
3
star
15

bm

Single header micro- and macro-benchmarking library.
C++
3
star
16

multi

Standard-like multidimensional arrays and vectors built on top of mdspan.
C++
3
star
17

hid.hpp

Single header C++23 wrapper for libusb/hidapi.
C++
3
star
18

map_reduce

Single header Map-Reduce built on top of Intel TBB.
CMake
3
star
19

ra

Generic resource abstraction for game/rendering engines.
C++
3
star
20

dpa

Distributed particle advector based on TBB and MPI.
C++
2
star
21

mcmc

Header-only library containing generic implementations of common Markov Chain Monte Carlo methods.
C++
2
star
22

ecs

A naive implementation of the entity-component-system model.
C++
2
star
23

di

Display and input abstraction built on top of SDL2 and OpenVR.
C++
2
star
24

pars

Source code of the paper Parallel Particle Advection and Lagrangian Analysis for 3D-PLI Fiber Orientation Maps.
C++
2
star
25

optix_cmake

An unofficial CMakeLists.txt for OptiX that exports the OptiX::OptiX target.
CMake
1
star
26

croupier

A generic poker engine capable of evaluating any variant of poker. Includes default rulesets for Texas and Omaha Hold'em, 5-Card, 7-Card and more. Intended for training poker bots.
C++
1
star
27

dayz_mod_template

A template for creating DayZ Standalone mods.
C++
1
star
28

type_trait_concepts

Concept equivalents of <type_traits>.
C++
1
star
29

csgo_map_templates

Collection of CS:GO map templates.
1
star
30

cs_server

A minimal CS 1.6 server with Metamod, AMX Mod X and Yet Another POD Bot (YAPB).
Batchfile
1
star
31

gh_bf4

Wallhack + aimbot for Battlefield 4.
C++
1
star
32

cs_removed_maps

This repository brings all maps that have been removed from beta 1.0 up until release 1.5 back into 1.6.
1
star
33

astray

A performance-portable geodesic ray tracer. Archived. See https://github.com/vrgrouprwth/astray instead.
C++
1
star
34

concepts.hpp

Concept equivalents of every boolean in <type_traits>.
C++
1
star
35

makina-old

Makina is a research engine focusing on computer graphics and virtual reality. [ARCHIVED]
C++
1
star
36

lorenz

Numerical integration of the Lorenz system in Three.js.
JavaScript
1
star
37

cush

Cuda Spherical Harmonics library.
C++
1
star
38

vcpkg_overlay_ports

Unofficial, useful vcpkg ports.
CMake
1
star
39

d3_template

Template for creating D3.js charts.
HTML
1
star
40

unity_data_binding

A general data and event binding plugin to compensate for the lack of these features in Unity 4.6.
C#
1
star
41

solidity_template

A concise solidity smart contract template.
JavaScript
1
star
42

dayz_server_template

A template for creating DayZ servers which automatically update the app and mods at each restart.
Batchfile
1
star
43

dayz_vanilla_server

A minimal server configuration for DayZ.
Batchfile
1
star
44

eigen

Personal fork of Eigen 3.
C++
1
star
45

tbtivh

Turkiye Bedelsiz Tasit Ithalati Vergi Hesaplayicisi (TBTIVH) / Turkish Private Vehicle Import Tax Calculator (TPVITC).
Python
1
star
46

cs_community_maps

This repository archives community-made maps that are important to the history of Counter-Strike.
1
star
47

r_portable

Portable version of R 4.2.1 for 64-bit Windows systems.
R
1
star
48

csgo_server

A minimalist CS:GO server.
Batchfile
1
star
49

makina-old-example

Makina example project.
C++
1
star
50

continuum_vst3

VST3 plugin simulating the Continuum Fingerboard through split channel pitch bends. Outputs MIDI Polyphonic Expression (MPE) data.
C++
1
star
51

hexagonal_keyboard_vst3

VST3 plugin for visualizing and outputting MIDI from various hexagonal keyboards, including the harmonic table and the Wicki-Hayden layout.
C++
1
star
52

fi

C++11 wrapper for FreeImage 3.17.0.
C++
1
star
53

astrid

A relativistic ray tracing server and end-user application built on Astray. Archived. See https://github.com/vrgrouprwth/astrid instead.
Cuda
1
star
54

makina

Makina C++ libraries.
1
star
55

jupyter_server

A minimal Jupyter notebook installation with Julia, Python and R.
Shell
1
star
56

arp

An arpeggiator VST3 plugin.
C++
1
star