Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Typedefs | Functions
GpuRefCnt.h File Reference
#include "include/core/SkRefCnt.h"
#include "include/private/base/SkAssert.h"
#include "include/private/base/SkDebug.h"
#include <cstddef>
#include <type_traits>

Go to the source code of this file.

Classes

class  gr_sp< T, Ref, Unref >
 

Typedefs

template<typename T >
using gr_cb = gr_sp< T, &T::refCommandBuffer, &T::unrefCommandBuffer >
 
template<typename T >
using gr_rp = gr_sp< T, &T::ref, &T::recycle >
 

Functions

template<typename T >
gr_rp< Tgr_ref_rp (T *obj)
 
template<typename T >
gr_rp< Tgr_ref_rp (const T *obj)
 

Typedef Documentation

◆ gr_cb

template<typename T >
using gr_cb = gr_sp<T, &T::refCommandBuffer, &T::unrefCommandBuffer>

Shared pointer class to wrap classes that support a refCommandBuffer() and unrefCommandBuffer() interface.

This class supports copying, moving, and assigning an sk_sp into it. In general these commands do not modify the sk_sp at all but just call refCommandBuffer() on the underlying object.

This class is designed to be used by GrGpuResources/graphite::Resources that need to track when they are in use on gpu (usually via a command buffer) separately from tracking if there are any current logical usages in Skia. This allows for a scratch resources to be reused for new draw calls even if it is in use on the GPU.

Definition at line 178 of file GpuRefCnt.h.

◆ gr_rp

template<typename T >
using gr_rp = gr_sp<T, &T::ref, &T::recycle>

This class mimics sk_sp but instead of calling unref it calls recycle instead.

Definition at line 185 of file GpuRefCnt.h.

Function Documentation

◆ gr_ref_rp() [1/2]

template<typename T >
gr_rp< T > gr_ref_rp ( const T obj)

Definition at line 195 of file GpuRefCnt.h.

195 {
196 return gr_rp<T>(const_cast<T*>(SkSafeRef(obj)));
197}
static T * SkSafeRef(T *obj)
Definition SkRefCnt.h:140
#define T

◆ gr_ref_rp() [2/2]

template<typename T >
gr_rp< T > gr_ref_rp ( T obj)

Returns a gr_rp wrapping the provided ptr AND calls ref on it (if not null).

This is different than the semantics of the constructor for gr_rp, which just wraps the ptr, effectively "adopting" it.

Definition at line 193 of file GpuRefCnt.h.

193{ return gr_rp<T>(SkSafeRef(obj)); }