Panda3D
|
00001 // Filename: wdxGraphicsPipe9.h 00002 // Created by: drose (20Dec02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef WDXGRAPHICSPIPE9_H 00016 #define WDXGRAPHICSPIPE9_H 00017 00018 #include "pandabase.h" 00019 #include "winGraphicsPipe.h" 00020 #include "pvector.h" 00021 #include "dxgsg9base.h" 00022 #include <ddraw.h> 00023 00024 //////////////////////////////////////////////////////////////////// 00025 // Class : wdxGraphicsPipe9 00026 // Description : This graphics pipe represents the interface for 00027 // creating DirectX9 graphics windows. 00028 //////////////////////////////////////////////////////////////////// 00029 class EXPCL_PANDADX wdxGraphicsPipe9 : public WinGraphicsPipe { 00030 public: 00031 wdxGraphicsPipe9(); 00032 virtual ~wdxGraphicsPipe9(); 00033 00034 virtual string get_interface_name() const; 00035 static PT(GraphicsPipe) pipe_constructor(); 00036 00037 virtual PT(GraphicsDevice) make_device(void *scrn); 00038 00039 bool find_best_depth_format(DXScreenData &Display, D3DDISPLAYMODE &Test_display_mode, 00040 D3DFORMAT *pBestFmt, bool bWantStencil, 00041 bool bForce16bpp, bool bVerboseMode = false) const; 00042 00043 void search_for_valid_displaymode(DXScreenData &scrn, 00044 UINT RequestedX_Size, UINT RequestedY_Size, 00045 bool bWantZBuffer, bool bWantStencil, 00046 UINT *p_supported_screen_depths_mask, 00047 bool *pCouldntFindAnyValidZBuf, 00048 D3DFORMAT *pSuggestedPixFmt, 00049 bool bForce16bppZBuffer, 00050 bool bVerboseMode = false); 00051 00052 bool special_check_fullscreen_resolution(DXScreenData &scrn, UINT x_size,UINT y_size); 00053 00054 protected: 00055 virtual PT(GraphicsOutput) make_output(const string &name, 00056 const FrameBufferProperties &fb_prop, 00057 const WindowProperties &win_prop, 00058 int flags, 00059 GraphicsEngine *engine, 00060 GraphicsStateGuardian *gsg, 00061 GraphicsOutput *host, 00062 int retry, 00063 bool &precertify); 00064 00065 private: 00066 bool init(); 00067 bool find_all_card_memavails(); 00068 00069 static BOOL WINAPI 00070 dx7_driver_enum_callback(GUID *pGUID, TCHAR *strDesc, TCHAR *strName, 00071 VOID *argptr, HMONITOR hm); 00072 00073 private: 00074 HINSTANCE _hDDrawDLL; 00075 HINSTANCE _hD3D9_DLL; 00076 LPDIRECT3D9 __d3d9; 00077 00078 00079 typedef LPDIRECT3D9 (WINAPI *Direct3DCreate9_ProcPtr)(UINT SDKVersion); 00080 typedef HRESULT (WINAPI * LPDIRECTDRAWCREATEEX)(GUID FAR * lpGuid, LPVOID *lplpDD, REFIID iid, IUnknown FAR *pUnkOuter); 00081 00082 LPDIRECTDRAWCREATEEX _DirectDrawCreateEx; 00083 LPDIRECTDRAWENUMERATEEX _DirectDrawEnumerateExA; 00084 Direct3DCreate9_ProcPtr _Direct3DCreate9; 00085 00086 // CardID is used in DX7 lowmem card-classification pass so DX8 can 00087 // establish correspondence b/w DX7 mem info & DX8 device 00088 struct CardID { 00089 HMONITOR _monitor; 00090 DWORD _max_available_video_memory; 00091 bool _is_low_memory_card; 00092 GUID DX7_DeviceGUID; 00093 DWORD VendorID, DeviceID; 00094 }; 00095 00096 typedef pvector<CardID> CardIDs; 00097 CardIDs _card_ids; 00098 bool __is_dx9_1; 00099 00100 public: 00101 static TypeHandle get_class_type() { 00102 return _type_handle; 00103 } 00104 static void init_type() { 00105 WinGraphicsPipe::init_type(); 00106 register_type(_type_handle, "wdxGraphicsPipe9", 00107 WinGraphicsPipe::get_class_type()); 00108 } 00109 virtual TypeHandle get_type() const { 00110 return get_class_type(); 00111 } 00112 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00113 00114 private: 00115 static TypeHandle _type_handle; 00116 00117 friend class wdxGraphicsWindow9; 00118 }; 00119 00120 #include "wdxGraphicsPipe9.I" 00121 00122 #endif