/*---------------------------------------------------------------------------* Project: NintendoWare File: dev_CallbackChain.h Copyright (C)2009-2010 Nintendo Co., Ltd./HAL Laboratory, Inc. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. $Revision: 14250 $ *---------------------------------------------------------------------------*/ #ifndef NW_DEV_CALLBACK_CHAIN_H_ #define NW_DEV_CALLBACK_CHAIN_H_ #include #include #if defined(NW_PLATFORM_CTR) #include #endif namespace nw { namespace dev { #if defined(NW_DEV_ENABLED) && defined(NW_PLATFORM_CTR) //--------------------------------------------------------------------------- //! @brief GPUコマンドのコールバックチェインです。 //--------------------------------------------------------------------------- class CallbackChain { public: //! @brief コンストラクタです。 CallbackChain( nw::os::IAllocator* allocator ); //! @brief デストラクタです。 ~CallbackChain(); //! @brief インスタンスを破棄します。 void Destroy(); //! @brief バインドされているコマンドリストにコールバックを設定します。 void SetCallback(); //! @brief コールバックチェイン処理を開始します。 void Begin(); //! @brief コールバックチェイン処理を終了します。 void End(); //! @brief GPU処理コストをmsecで取得します。 f32 GetCostTime() const { return m_Cost; } private: //! @brief コールバックの呼び出しです。 void Invoke(GLint id); //! @brief 登録されるコールバック関数です。 static void CommandListCallback(GLint id); f32 m_Cost; uint m_MaxRequestCount; uint m_StartReqCount; uint m_EndReqCount; uint m_CurrentReqCount; s64* m_MicroSecArray; os::IAllocator* m_Allocator; static CallbackChain* s_CallbackChain; }; #else class CallbackChain { public: //! @brief コンストラクタです。 CallbackChain( nw::os::IAllocator* allocator ){} //! @brief デストラクタです。 ~CallbackChain(){} //! @brief インスタンスを破棄します。 void Destroy(){} //! @brief バインドされているコマンドリストにコールバックを設定します。 void SetCallback(); //! @brief コールバックチェイン処理を開始します。 void Begin(){} //! @brief コールバックチェイン処理を終了します。 void End(){} //! @brief 前フレームのGPU処理コストをmsecで取得します。 f32 GetCostTime() const { return 0.f; } }; #endif // defined(NW_DEV_ENABLED) && defined(NW_PLATFORM_CTR) } // namespace nw::dev } // namespace nw #endif // NW_DEV_CALLBACK_CHAIN_H_