|
Unravel Engine C++ Reference
|
#include <evictable.h>
Public Member Functions | |
| ievictable ()=default | |
| ievictable (const ievictable &)=delete | |
| auto | operator= (const ievictable &) -> ievictable &=delete |
| ievictable (ievictable &&)=delete | |
| auto | operator= (ievictable &&) -> ievictable &=delete |
| virtual | ~ievictable ()=default |
| virtual auto | on_evict () -> std::uint64_t=0 |
| Release the GPU handle. Returns the number of GPU bytes freed. Must be idempotent. | |
| virtual auto | on_restore () -> bool=0 |
| Recreate the GPU handle from the CPU backing. Returns true on success. | |
| virtual auto | gpu_size () const -> std::uint64_t=0 |
| Approximate GPU footprint of the resource in bytes. | |
| auto | get_evict_class () const -> evict_class |
| auto | get_evict_state () const -> evict_state |
| auto | get_last_use_frame () const -> std::uint64_t |
| auto | get_use_count () const -> std::uint64_t |
| void | touch () const noexcept |
Protected Attributes | |
| std::uint64_t | last_use_frame_ {0} |
| Frame the resource was last used on (heuristic, written from touch). | |
| std::uint64_t | use_count_ {0} |
| Number of times the resource was used (heuristic, written from touch). | |
| evict_state | evict_state_ {evict_state::resident} |
| Current residency state. Written by the owning resource during evict/restore. | |
| evict_class | evict_class_ {evict_class::non_evictable} |
| Eligibility class. Set once when the resource opts into eviction. | |
Friends | |
| class | eviction_registry |
Abstract contract for a GPU resource that can release its GPU memory (evict) and later recreate it from a retained CPU-side backing (restore).
Threading contract: touch, eviction and restore all run on the graphics API (render) thread, so the per-resource bookkeeping below needs no synchronization. The only cross-thread access is registration/unregistration during resource create/destroy on worker threads, which the eviction_registry serializes with its own mutex.
Definition at line 38 of file evictable.h.
|
default |
|
delete |
|
delete |
|
virtualdefault |
|
inlinenodiscard |
Definition at line 57 of file evictable.h.
|
inlinenodiscard |
Definition at line 62 of file evictable.h.
|
inlinenodiscard |
Definition at line 67 of file evictable.h.
|
inlinenodiscard |
Definition at line 72 of file evictable.h.
|
nodiscardpure virtual |
Approximate GPU footprint of the resource in bytes.
Implemented in gfx::handle_impl< Base, T >, gfx::handle_impl< frame_buffer, frame_buffer_handle >, gfx::handle_impl< index_buffer, index_buffer_handle >, gfx::handle_impl< program, program_handle >, gfx::handle_impl< shader, shader_handle >, gfx::handle_impl< texture, texture_handle >, gfx::handle_impl< uniform, uniform_handle >, and gfx::handle_impl< vertex_buffer, vertex_buffer_handle >.
|
pure virtual |
Release the GPU handle. Returns the number of GPU bytes freed. Must be idempotent.
Implemented in gfx::handle_impl< Base, T >, gfx::handle_impl< frame_buffer, frame_buffer_handle >, gfx::handle_impl< index_buffer, index_buffer_handle >, gfx::handle_impl< program, program_handle >, gfx::handle_impl< shader, shader_handle >, gfx::handle_impl< texture, texture_handle >, gfx::handle_impl< uniform, uniform_handle >, and gfx::handle_impl< vertex_buffer, vertex_buffer_handle >.
|
pure virtual |
Recreate the GPU handle from the CPU backing. Returns true on success.
Implemented in gfx::handle_impl< Base, T >, gfx::handle_impl< frame_buffer, frame_buffer_handle >, gfx::handle_impl< index_buffer, index_buffer_handle >, gfx::handle_impl< program, program_handle >, gfx::handle_impl< shader, shader_handle >, gfx::handle_impl< texture, texture_handle >, gfx::handle_impl< uniform, uniform_handle >, and gfx::handle_impl< vertex_buffer, vertex_buffer_handle >.
|
delete |
|
delete |
|
inlinenoexcept |
Hot path: mark the resource as used on the current frame. Must be called on the render thread (it is reached only through native_handle during submission). Strategies read these counters during a sweep, also on the render thread.
Definition at line 80 of file evictable.h.
|
friend |
Definition at line 102 of file evictable.h.
|
protected |
Eligibility class. Set once when the resource opts into eviction.
Definition at line 94 of file evictable.h.
|
protected |
Current residency state. Written by the owning resource during evict/restore.
Definition at line 92 of file evictable.h.
|
mutableprotected |
Frame the resource was last used on (heuristic, written from touch).
Definition at line 88 of file evictable.h.
|
mutableprotected |
Number of times the resource was used (heuristic, written from touch).
Definition at line 90 of file evictable.h.