Path: blob/master/libmupen64plus/mupen64plus-video-rice/src/GraphicsContext.h
2 views
/*1Copyright (C) 2003 Rice196423This program is free software; you can redistribute it and/or4modify it under the terms of the GNU General Public License5as published by the Free Software Foundation; either version 26of the License, or (at your option) any later version.78This program is distributed in the hope that it will be useful,9but WITHOUT ANY WARRANTY; without even the implied warranty of10MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11GNU General Public License for more details.1213You should have received a copy of the GNU General Public License14along with this program; if not, write to the Free Software15Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.1617*/1819#ifndef GFXCONTEXT_H20#define GFXCONTEXT_H2122#include "typedefs.h"23#include "CritSect.h"2425enum ClearFlag26{27CLEAR_COLOR_BUFFER=0x01,28CLEAR_DEPTH_BUFFER=0x02,29CLEAR_COLOR_AND_DEPTH_BUFFER=0x03,30};313233typedef struct34{35uint32 addr; //N64 RDRAM address36uint32 size; //N64 buffer size37uint32 format; //N64 format38uint32 width;39uint32 height;40} TextureBufferShortInfo;414243// This class basically provides an extra level of security for our44// multithreaded code. Threads can Grab the CGraphicsContext to prevent45// other threads from changing/releasing any of the pointers while it is46// running.4748// It is based on CCritSect for Lock() and Unlock()4950class CGraphicsContext : public CCritSect51{52friend class CDeviceBuilder;5354public:55bool Ready() { return m_bReady; }56bool IsWindowed() {return m_bWindowed;}5758virtual bool Initialize(uint32 dwWidth, uint32 dwHeight, BOOL bWindowed );59virtual bool ResizeInitialize(uint32 dwWidth, uint32 dwHeight, BOOL bWindowed );60virtual void CleanUp();6162virtual void Clear(ClearFlag flags, uint32 color=0xFF000000, float depth=1.0f) = 0;63virtual void UpdateFrame(bool swaponly=false) = 0;64virtual int ToggleFullscreen()=0; // return 0 as the result is windowed6566static void InitWindowInfo();67static void InitDeviceParameters();6869bool m_supportTextureMirror;7071public:72static int m_maxFSAA;73static int m_maxAnisotropy;7475protected:76static uint32 m_dwWindowStyle; // Saved window style for mode switches77static uint32 m_dwWindowExStyle; // Saved window style for mode switches78static uint32 m_dwStatusWindowStyle; // Saved window style for mode switches7980static bool m_deviceCapsIsInitialized;8182bool m_bReady;83bool m_bActive;8485bool m_bWindowed;86RECT m_rcWindowBounds;8788char m_strDeviceStats[256];8990virtual ~CGraphicsContext();91CGraphicsContext();9293public:94static CGraphicsContext *g_pGraphicsContext;95static CGraphicsContext * Get(void);96inline const char* GetDeviceStr() {return m_strDeviceStats;}97static bool needCleanScene;98};99100#endif101102103104