#ifndef RENDER_TARGET_POOL_H #define RENDER_TARGET_POOL_H #include "Prerequisites.h" #include struct RenderTargetInfo { public: RenderTargetInfo() {Modifier = 0; Width = 0; Height = 0; Format = D3DFMT_UNKNOWN;} ~RenderTargetInfo() {} D3DFORMAT Format; int Width; int Height; int Modifier; bool operator==(const RenderTargetInfo& rhs) const { return (Format == rhs.Format && Width == rhs.Width && Height == rhs.Height && Modifier == rhs.Modifier); } bool operator<(const RenderTargetInfo& rhs) const { return Format < rhs.Format; } bool operator>(const RenderTargetInfo& rhs) const { return Format > rhs.Format; } }; struct RTObject { public: RTObject(); ~RTObject(); RenderTargetPtr RT; int RefCount; }; class RenderTargetPool { public: static RenderTargetPtr GetRenderTarget(RenderTargetInfo& info); static RenderTargetPtr GetRenderTarget(RenderTargetInfo& info, bool createNew); static void OnLostDevice(); static void OnResetDevice(); static void DestroyRenderTargets(); static void Initialize(IDirect3DDevice9Ptr& device, D3DVIEWPORT9& viewport); static bool IsFormatSupported(const IDirect3D9Ptr& device, D3DFORMAT format, D3DFORMAT adapterFormat); public: static IDirect3DDevice9Ptr GDevice; static D3DVIEWPORT9 Viewport; private: RenderTargetPool(); ~RenderTargetPool(); private: static std::map mRTPool; }; #endif