Panda3D
wdxGraphicsPipe9.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file wdxGraphicsPipe9.h
10  * @author drose
11  * @date 2002-12-20
12  */
13 
14 #ifndef WDXGRAPHICSPIPE9_H
15 #define WDXGRAPHICSPIPE9_H
16 
17 #include "pandabase.h"
18 #include "winGraphicsPipe.h"
19 #include "pvector.h"
20 #include "dxgsg9base.h"
21 #include <ddraw.h>
22 
23 /**
24  * This graphics pipe represents the interface for creating DirectX9 graphics
25  * windows.
26  */
27 class EXPCL_PANDADX wdxGraphicsPipe9 : public WinGraphicsPipe {
28 public:
30  virtual ~wdxGraphicsPipe9();
31 
32  virtual std::string get_interface_name() const;
33  static PT(GraphicsPipe) pipe_constructor();
34 
35  virtual PT(GraphicsDevice) make_device(void *scrn);
36 
37  bool find_best_depth_format(DXScreenData &Display, D3DDISPLAYMODE &Test_display_mode,
38  D3DFORMAT *pBestFmt, bool bWantStencil,
39  bool bForce16bpp, bool bVerboseMode = false) const;
40 
41  void search_for_valid_displaymode(DXScreenData &scrn,
42  UINT RequestedX_Size, UINT RequestedY_Size,
43  bool bWantZBuffer, bool bWantStencil,
44  UINT *p_supported_screen_depths_mask,
45  bool *pCouldntFindAnyValidZBuf,
46  D3DFORMAT *pSuggestedPixFmt,
47  bool bForce16bppZBuffer,
48  bool bVerboseMode = false);
49 
50  bool special_check_fullscreen_resolution(DXScreenData &scrn, UINT x_size,UINT y_size);
51 
52 protected:
53  virtual PT(GraphicsOutput) make_output(const std::string &name,
54  const FrameBufferProperties &fb_prop,
55  const WindowProperties &win_prop,
56  int flags,
57  GraphicsEngine *engine,
59  GraphicsOutput *host,
60  int retry,
61  bool &precertify);
62 
63 private:
64  bool init();
65  bool find_all_card_memavails();
66 
67  static BOOL WINAPI
68  dx7_driver_enum_callback(GUID *pGUID, TCHAR *strDesc, TCHAR *strName,
69  VOID *argptr, HMONITOR hm);
70 
71 private:
72  HINSTANCE _hDDrawDLL;
73  HINSTANCE _hD3D9_DLL;
74  LPDIRECT3D9 __d3d9;
75 
76 
77  typedef LPDIRECT3D9 (WINAPI *Direct3DCreate9_ProcPtr)(UINT SDKVersion);
78  typedef HRESULT (WINAPI * LPDIRECTDRAWCREATEEX)(GUID FAR * lpGuid, LPVOID *lplpDD, REFIID iid, IUnknown FAR *pUnkOuter);
79 
80  LPDIRECTDRAWCREATEEX _DirectDrawCreateEx;
81  LPDIRECTDRAWENUMERATEEX _DirectDrawEnumerateExA;
82  Direct3DCreate9_ProcPtr _Direct3DCreate9;
83 
84  // CardID is used in DX7 lowmem card-classification pass so DX8 can
85  // establish correspondence bw DX7 mem info & DX8 device
86  struct CardID {
87  HMONITOR _monitor;
88  DWORD _max_available_video_memory;
89  bool _is_low_memory_card;
90  GUID DX7_DeviceGUID;
91  DWORD VendorID, DeviceID;
92  };
93 
94  typedef pvector<CardID> CardIDs;
95  CardIDs _card_ids;
96 
97 public:
98  static TypeHandle get_class_type() {
99  return _type_handle;
100  }
101  static void init_type() {
102  WinGraphicsPipe::init_type();
103  register_type(_type_handle, "wdxGraphicsPipe9",
104  WinGraphicsPipe::get_class_type());
105  }
106  virtual TypeHandle get_type() const {
107  return get_class_type();
108  }
109  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
110 
111 private:
112  static TypeHandle _type_handle;
113 
114  friend class wdxGraphicsWindow9;
115 };
116 
117 #include "wdxGraphicsPipe9.I"
118 
119 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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:52
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...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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:81
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.