Panda3D
wdxGraphicsPipe9.h
1 // Filename: wdxGraphicsPipe9.h
2 // Created by: drose (20Dec02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef WDXGRAPHICSPIPE9_H
16 #define WDXGRAPHICSPIPE9_H
17 
18 #include "pandabase.h"
19 #include "winGraphicsPipe.h"
20 #include "pvector.h"
21 #include "dxgsg9base.h"
22 #include <ddraw.h>
23 
24 ////////////////////////////////////////////////////////////////////
25 // Class : wdxGraphicsPipe9
26 // Description : This graphics pipe represents the interface for
27 // creating DirectX9 graphics windows.
28 ////////////////////////////////////////////////////////////////////
29 class EXPCL_PANDADX wdxGraphicsPipe9 : public WinGraphicsPipe {
30 public:
32  virtual ~wdxGraphicsPipe9();
33 
34  virtual string get_interface_name() const;
35  static PT(GraphicsPipe) pipe_constructor();
36 
37  virtual PT(GraphicsDevice) make_device(void *scrn);
38 
39  bool find_best_depth_format(DXScreenData &Display, D3DDISPLAYMODE &Test_display_mode,
40  D3DFORMAT *pBestFmt, bool bWantStencil,
41  bool bForce16bpp, bool bVerboseMode = false) const;
42 
43  void search_for_valid_displaymode(DXScreenData &scrn,
44  UINT RequestedX_Size, UINT RequestedY_Size,
45  bool bWantZBuffer, bool bWantStencil,
46  UINT *p_supported_screen_depths_mask,
47  bool *pCouldntFindAnyValidZBuf,
48  D3DFORMAT *pSuggestedPixFmt,
49  bool bForce16bppZBuffer,
50  bool bVerboseMode = false);
51 
52  bool special_check_fullscreen_resolution(DXScreenData &scrn, UINT x_size,UINT y_size);
53 
54 protected:
55  virtual PT(GraphicsOutput) make_output(const string &name,
56  const FrameBufferProperties &fb_prop,
57  const WindowProperties &win_prop,
58  int flags,
59  GraphicsEngine *engine,
61  GraphicsOutput *host,
62  int retry,
63  bool &precertify);
64 
65 private:
66  bool init();
67  bool find_all_card_memavails();
68 
69  static BOOL WINAPI
70  dx7_driver_enum_callback(GUID *pGUID, TCHAR *strDesc, TCHAR *strName,
71  VOID *argptr, HMONITOR hm);
72 
73 private:
74  HINSTANCE _hDDrawDLL;
75  HINSTANCE _hD3D9_DLL;
76  LPDIRECT3D9 __d3d9;
77 
78 
79  typedef LPDIRECT3D9 (WINAPI *Direct3DCreate9_ProcPtr)(UINT SDKVersion);
80  typedef HRESULT (WINAPI * LPDIRECTDRAWCREATEEX)(GUID FAR * lpGuid, LPVOID *lplpDD, REFIID iid, IUnknown FAR *pUnkOuter);
81 
82  LPDIRECTDRAWCREATEEX _DirectDrawCreateEx;
83  LPDIRECTDRAWENUMERATEEX _DirectDrawEnumerateExA;
84  Direct3DCreate9_ProcPtr _Direct3DCreate9;
85 
86  // CardID is used in DX7 lowmem card-classification pass so DX8 can
87  // establish correspondence b/w DX7 mem info & DX8 device
88  struct CardID {
89  HMONITOR _monitor;
90  DWORD _max_available_video_memory;
91  bool _is_low_memory_card;
92  GUID DX7_DeviceGUID;
93  DWORD VendorID, DeviceID;
94  };
95 
96  typedef pvector<CardID> CardIDs;
97  CardIDs _card_ids;
98  bool __is_dx9_1;
99 
100 public:
101  static TypeHandle get_class_type() {
102  return _type_handle;
103  }
104  static void init_type() {
105  WinGraphicsPipe::init_type();
106  register_type(_type_handle, "wdxGraphicsPipe9",
107  WinGraphicsPipe::get_class_type());
108  }
109  virtual TypeHandle get_type() const {
110  return get_class_type();
111  }
112  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
113 
114 private:
115  static TypeHandle _type_handle;
116 
117  friend class wdxGraphicsWindow9;
118 };
119 
120 #include "wdxGraphicsPipe9.I"
121 
122 #endif
A container for the various kinds of properties we might ask to have on a graphics window before we o...
An object to create GraphicsOutputs that share a particular 3-D API.
Definition: graphicsPipe.h:58
This is a base class for the various different classes that represent the result of a frame of render...
A single graphics window for rendering DirectX under Microsoft Windows.
An abstract device object that is part of Graphics Pipe.
This is an abstract base class for wglGraphicsPipe and wdxGraphicsPipe; that is, those graphics pipes...
Encapsulates all the communication with a particular instance of a given rendering backend...
This graphics pipe represents the interface for creating DirectX9 graphics windows.
This class is the main interface to controlling the render process.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...