Skip to content

Latest commit

 

History

History
148 lines (92 loc) · 2.78 KB

Guide.md

File metadata and controls

148 lines (92 loc) · 2.78 KB

liblava docs   Version

Home   Features   Tutorial   Guide   Reference   Modules   Third-Party   Demo   Tests   Install


Guide

Lifetime of an Object / Command-Line Arguments



Lifetime of an Object

Before you create new objects or use existing ones, you should get familiar with the lifetime of objects

It is basically possible to create all objects in liblava on the stack or on the heap

But be careful. You have to take care of the lifetime yourself

make ➜ create ➜ destroy

This is the general pattern that is used in this library:

  1. make - Use constructor or factory method (static function to get a shared pointer)
  2. create - Build the respective object
  3. destroy - Discard it after your use

The destructor calls the destroy method if it was not called before

For example: buffer object

void use_buffer_on_stack() {

    buffer buf; // make

    auto created = buf.create(device, data, size, usage);
    if (created) {
        // ...

        buf.destroy();
    }
}

Or look at this method where it is returned as a shared pointer:

buffer::ptr use_buffer_on_heap() {

    auto buf = make_buffer();

    if (buf->create(device, data, size, usage))
        return buf;

    return nullptr;
}

Command-Line Arguments

lava app

--clean, -c
  • clean preferences folder

--v_sync, -vs {0|1}
  • 0 ➜ vertical sync off
  • 1 ➜ vertical sync on

--physical_device, -pd {n}
  • n ➜ physical device index

lava frame

--debug, -d

--utils, -u

--renderdoc, -r
  • RenderDoc capture layer (VK_LAYER_RENDERDOC_Capture)

--verbose, -v
  • verbose debugging

--log, -l {0|1|2|3|4|5|6}
  • 0 ➜ trace level
  • 1 ➜ debug level
  • 2 ➜ info level
  • 3 ➜ warn level
  • 4 ➜ error level
  • 5 ➜ critical level
  • 6 ➜ logging off

WIP