OROCHI
 
Loading...
Searching...
No Matches
GxRenderResource.h
Go to the documentation of this file.
1//===========================================================================
10//===========================================================================
11#pragma once
12
13GX_CORE_NAMESPACE_BEGIN()
14
15//===========================================================================
18//===========================================================================
20{
21 //-------------------------------------------------------------
23 //-------------------------------------------------------------
25public:
26 // RTTI定義
27 GX_RTTI_ABSTRACT_CLASS(GxRenderResource, GxClassBaseReference)
28 // GxClassBaseReference継承クラス用禁止宣言
30 // new, delete定義
31 GX_OPERATOR_NEW_DELETE(GxAllocatorList::ALLOCATOR_TYPE::RENDER)
32
33
34 //-------------------------------------------------------------
36 //-------------------------------------------------------------
38public:
40 void cleanup(void) override;
41
43 static b32 initializeThreadLocalStorage(void);
44
45protected:
47 GxRenderResource(void);
48
50 //-------------------------------------------------------------
52 //-------------------------------------------------------------
54public:
56 GX_FORCE_INLINE void onLostDevice(void) override {}
57
59 GX_FORCE_INLINE b32 onResetDevice(void) override { return true; }
60
62 GX_FORCE_INLINE virtual void onRender(void){}
63
65 constexpr void forceDelayRelease(void) { _delayReleaseCount = 2; }
66#if defined(GX_THREAD_LOCAL_STORAGE)
68 GX_FORCE_INLINE static void disableDelayRelease(void) { _disableDelayRelease++; }
70 GX_FORCE_INLINE static void enableDelayRelease(void) { _disableDelayRelease--; GX_ASSERT(_disableDelayRelease >= 0, "遅延解放無効化フラグが不正です"); }
71#else //GX_THREAD_LOCAL_STORAGE
73 GX_FORCE_INLINE static void disableDelayRelease(void) { _disableDelayRelease[GxThread::getCurrentThread()->getIndex()]++; }
75 GX_FORCE_INLINE static void enableDelayRelease(void)
76 {
77 _disableDelayRelease[GxThread::getCurrentThread()->getIndex()]--;
78 GX_ASSERT(_disableDelayRelease[GxThread::getCurrentThread()->getIndex()] >= 0, "遅延解放無効化フラグが不正です");
79 }
80#endif // !GX_THREAD_LOCAL_STORAGE
81
83 //-----------------------------------------------------------
85 //-----------------------------------------------------------
87private:
88#if GX_DEVELOP
90 GX_FORCE_INLINE void getPropertyRttiName(void* const pValue) { *static_cast<GX_CSTR*>(pValue) = getRtti().getName(); }
91
93 GX_FORCE_INLINE GxString getRenderNotifierName(void) const override { GxString string; return string.format("ClassName:%s", getRtti().getClassName()); }
94#endif // GX_DEVELOP
95
97 //-------------------------------------------------------------
99 //-------------------------------------------------------------
101protected:
102#if defined(GX_THREAD_LOCAL_STORAGE)
103 static GX_THREAD_LOCAL_STORAGE s32 _disableDelayRelease;
104#else //GX_THREAD_LOCAL_STORAGE
105 static s32 _disableDelayRelease[GxThread::THREAD_MAX];
106#endif // !GX_THREAD_LOCAL_STORAGE
107
109};
110
111GX_CORE_NAMESPACE_END()
#define GX_PROHIBIT_CLASS_BASE_REFERENCE(__CLASS__)
GxClassBaseReference継承の禁止宣言(new以外の生成禁止 + コピー禁止)
Definition GxBase.h:244
@ RENDER
レンダリング
参照オブジェクト基底クラス
Definition GxBase.h:122
描画関連のイベントを通知します
Definition GxRenderNotifier.h:22
GPUリソースを管理する
Definition GxRenderResource.h:20
virtual GX_FORCE_INLINE void onRender(void)
描画通知
Definition GxRenderResource.h:62
GX_FORCE_INLINE b32 onResetDevice(void) override
デバイスのリセット後に通知
Definition GxRenderResource.h:59
GX_FORCE_INLINE void onLostDevice(void) override
デバイスが消失した時点で通知
Definition GxRenderResource.h:56
constexpr void forceDelayRelease(void)
強制遅延解放
Definition GxRenderResource.h:65
static GX_FORCE_INLINE void enableDelayRelease(void)
遅延解放を有効化
Definition GxRenderResource.h:75
static GxThread * getCurrentThread(void)
カレントスレッドを取得
Definition GxThread.cpp:505
constexpr u32 getIndex(void) const
インデックスを取得
Definition GxThread.h:251
static constexpr u32 THREAD_MAX
スレッドの最大数
Definition GxThread.h:188
文字列型クラス
Definition GxString.h:18
const GxString & format(GX_CSTR format,...)
フォーマット出力
Definition GxString.cpp:1913
32bitブーリアン
Definition GxDefine.h:173