-
Lava Block authoredLava Block authored
Guide.md 2.78 KiB
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:
- make - Use constructor or factory method (static function to get a shared pointer)
- create - Build the respective object
- 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
- validation layer (VK_LAYER_KHRONOS_validation)
--utils, -u
- debug utils extension (VK_EXT_debug_utils)
--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