esp::gfx_batch::RendererStandalone class

Standalone batch renderer.

Wraps Renderer with a corresponding GPU context and a framebuffer for a standalone use (i.e., in cases where it's not needed to share the framebuffer with a GUI application).

Usage

The renderer gets constructed using a RendererStandaloneConfiguration with desired CUDA device specified (if needed) and a RendererConfiguration with desired tile size and count. From there onwards, the usage is the same as with the base class alone, see its documentation for more information.

After draw(), in order to retrieve the framebuffer data, you have two options:

Base classes

class Renderer
Batch renderer.

Constructors, destructors, conversion operators

RendererStandalone(const RendererConfiguration& configuration, const RendererStandaloneConfiguration& standaloneConfiguration) explicit
Constructor.
~RendererStandalone() override

Public functions

auto standaloneFlags() const -> RendererStandaloneFlags
Global standalone renderer flags.
auto colorFramebufferFormat() const -> Magnum::PixelFormat
Color framebuffer format.
auto depthFramebufferFormat() const -> Magnum::PixelFormat
Depth framebuffer format.
void draw()
Draw all scenes.
auto colorImage() -> Magnum::Image2D
Retrieve the rendered color output.
void colorImageInto(const Magnum::Range2Di& rectangle, const Magnum::MutableImageView2D& image)
Retrieve the rendered color output into a pre-allocated location.
auto depthImage() -> Magnum::Image2D
Retrieve the raw rendered depth output.
void depthImageInto(const Magnum::Range2Di& rectangle, const Magnum::MutableImageView2D& image)
Retrieve the raw rendered depth output into a pre-allocated location.
auto colorCudaBufferDevicePointer() -> const void*
Retrieve the rendered color output as a CUDA device pointer.
auto depthCudaBufferDevicePointer() -> const void*
Retrieve the rendered depth output as a CUDA device pointer.

Function documentation

esp::gfx_batch::RendererStandalone::RendererStandalone(const RendererConfiguration& configuration, const RendererStandaloneConfiguration& standaloneConfiguration) explicit

Constructor.

Parameters
configuration Renderer configuration
standaloneConfiguration Standalone renderer configuration

RendererStandaloneFlags esp::gfx_batch::RendererStandalone::standaloneFlags() const

Global standalone renderer flags.

By default, no flags are set.

Magnum::PixelFormat esp::gfx_batch::RendererStandalone::colorFramebufferFormat() const

Color framebuffer format.

Format in which colorImage() and colorCudaBufferDevicePointer() is returned. At the moment Magnum::PixelFormat::RGBA8Unorm. Framebuffer size is tileSize() multiplied by tileCount().

Magnum::PixelFormat esp::gfx_batch::RendererStandalone::depthFramebufferFormat() const

Depth framebuffer format.

Format in which depthImage() and colorCudaBufferDevicePointer() is returned. At the moment Magnum::PixelFormat::Depth32F. Framebuffer size is tileSize() multiplied by tileCount().

void esp::gfx_batch::RendererStandalone::draw()

Draw all scenes.

Compared to Renderer::draw(Magnum::GL::AbstractFramebuffer&), the scene is drawn to an internal framebuffer. Use colorImage() / depthImage() or colorCudaBufferDevicePointer() / depthCudaBufferDevicePointer() to retrieve the output.

Magnum::Image2D esp::gfx_batch::RendererStandalone::colorImage()

Retrieve the rendered color output.

Stalls the CPU until the GPU finishes the last draw() and then returns an image in colorFramebufferFormat() and with size being tileSize() multiplied by tileCount().

void esp::gfx_batch::RendererStandalone::colorImageInto(const Magnum::Range2Di& rectangle, const Magnum::MutableImageView2D& image)

Retrieve the rendered color output into a pre-allocated location.

Expects that rectangle is contained in a size defined by tileSize() multiplied by tileCount(), that image size corresponds to rectangle size and that its format is compatible with colorFramebufferFormat().

Magnum::Image2D esp::gfx_batch::RendererStandalone::depthImage()

Retrieve the raw rendered depth output.

This returns the depth buffer as-is. To unproject, use unprojectDepth().

Stalls the CPU until the GPU finishes the last draw() and then returns an image in depthFramebufferFormat() and with size being tileSize() multiplied by tileCount().

void esp::gfx_batch::RendererStandalone::depthImageInto(const Magnum::Range2Di& rectangle, const Magnum::MutableImageView2D& image)

Retrieve the raw rendered depth output into a pre-allocated location.

This returns the depth buffer as-is. To unproject, use unprojectDepth().

Expects that rectangle is contained in a size defined by tileSize() multiplied by tileCount(), that image size corresponds to rectangle size and that its format is compatible with depthFramebufferFormat().

const void* esp::gfx_batch::RendererStandalone::colorCudaBufferDevicePointer()

Retrieve the rendered color output as a CUDA device pointer.

Copies the internal framebuffer into a linearized and tightly-packed CUDA buffer of colorFramebufferFormat() and with size given by the product() of tileSize() and tileCount(), and returns its device pointer.

const void* esp::gfx_batch::RendererStandalone::depthCudaBufferDevicePointer()

Retrieve the rendered depth output as a CUDA device pointer.

Copies the internal framebuffer into a linearized and tightly-packed CUDA buffer of depthFramebufferFormat() and with size given by the product() of tileSize() and tileCount(), and returns its device pointer.