|
Unravel Engine C++ Reference
|
#include <handle_impl.h>
Public Types | |
| using | ptr = std::shared_ptr<Base> |
| using | uptr = std::unique_ptr<Base> |
| using | weak_ptr = std::weak_ptr<Base> |
| using | handle_type_t = T |
| using | base_type = Base |
Public Member Functions | |
| handle_impl ()=default | |
| handle_impl (const handle_impl &)=delete | |
| auto | operator= (const handle_impl &) -> handle_impl &=delete |
| handle_impl (handle_impl &&)=delete | |
| auto | operator= (handle_impl &&) -> handle_impl &=delete |
| ~handle_impl () override | |
| void | dispose () |
| auto | is_valid () const -> bool |
| auto | native_handle () const -> T |
| void | set_name (const hpp::string_view &_name) |
| auto | on_evict () -> std::uint64_t override |
| Release the GPU handle. Returns the number of GPU bytes freed. Must be idempotent. | |
| auto | on_restore () -> bool override |
| Recreate the GPU handle from the CPU backing. Returns true on success. | |
| auto | gpu_size () const -> std::uint64_t override |
| Approximate GPU footprint of the resource in bytes. | |
Public Member Functions inherited from gfx::ievictable | |
| ievictable ()=default | |
| ievictable (const ievictable &)=delete | |
| auto | operator= (const ievictable &) -> ievictable &=delete |
| ievictable (ievictable &&)=delete | |
| auto | operator= (ievictable &&) -> ievictable &=delete |
| virtual | ~ievictable ()=default |
| 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 |
Static Public Member Functions | |
| static auto | invalid_handle () -> T |
Protected Member Functions | |
| auto | fallback_handle () const -> T |
| auto | get_fallback_handle () const -> T |
| void | make_evictable (std::uint64_t gpu_bytes, std::function< bool(Base &)> restore_fn, evict_class cls=evict_class::evictable) |
| void | make_evictable_deferred (std::uint64_t gpu_bytes, std::function< bool(Base &)> restore_fn, evict_class cls=evict_class::evictable) |
Protected Attributes | |
| T | handle_ = invalid_handle() |
| std::function< bool(Base &)> | restore_fn_ |
| std::uint64_t | gpu_size_ = 0 |
Protected Attributes inherited from gfx::ievictable | |
| 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. | |
Definition at line 13 of file handle_impl.h.
| using gfx::handle_impl< Base, T >::base_type = Base |
Definition at line 21 of file handle_impl.h.
| using gfx::handle_impl< Base, T >::handle_type_t = T |
Definition at line 20 of file handle_impl.h.
| using gfx::handle_impl< Base, T >::ptr = std::shared_ptr<Base> |
Definition at line 16 of file handle_impl.h.
| using gfx::handle_impl< Base, T >::uptr = std::unique_ptr<Base> |
Definition at line 17 of file handle_impl.h.
| using gfx::handle_impl< Base, T >::weak_ptr = std::weak_ptr<Base> |
Definition at line 18 of file handle_impl.h.
|
default |
|
delete |
|
delete |
|
inlineoverride |
Definition at line 29 of file handle_impl.h.
|
inline |
Definition at line 38 of file handle_impl.h.
|
inlineprotected |
Definition at line 112 of file handle_impl.h.
|
inlineprotected |
Definition at line 117 of file handle_impl.h.
|
inlinenodiscardoverridevirtual |
Approximate GPU footprint of the resource in bytes.
Implements gfx::ievictable.
Definition at line 106 of file handle_impl.h.
|
inlinestatic |
Definition at line 68 of file handle_impl.h.
|
inlinenodiscard |
Definition at line 48 of file handle_impl.h.
|
inlineprotected |
Opt the resource into the eviction system. Call once, after the GPU handle is created and a CPU-side backing exists. restore_fn recreates the handle from that backing and returns true on success. Resources that never call this stay evict_class::non_evictable and incur no tracking cost.
Definition at line 125 of file handle_impl.h.
|
inlineprotected |
Opt in with CPU backing but no GPU handle yet (create skipped or deferred). Restored on the next native_handle access via the same path as post-eviction restore.
Definition at line 142 of file handle_impl.h.
|
inline |
Definition at line 53 of file handle_impl.h.
|
inlineoverridevirtual |
Release the GPU handle. Returns the number of GPU bytes freed. Must be idempotent.
Implements gfx::ievictable.
Definition at line 79 of file handle_impl.h.
|
inlineoverridevirtual |
Recreate the GPU handle from the CPU backing. Returns true on success.
Implements gfx::ievictable.
Definition at line 95 of file handle_impl.h.
|
delete |
|
delete |
|
inline |
Definition at line 74 of file handle_impl.h.
|
protected |
Definition at line 159 of file handle_impl.h.
|
protected |
Definition at line 157 of file handle_impl.h.
|
protected |
Definition at line 158 of file handle_impl.h.