Tizen 2.0 Release
[profile/ivi/osmesa.git] / src / mesa / drivers / windows / gldirect / dglglobals.h
1 /****************************************************************************
2 *
3 *                        Mesa 3-D graphics library
4 *                        Direct3D Driver Interface
5 *
6 *  ========================================================================
7 *
8 *   Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
9 *
10 *   Permission is hereby granted, free of charge, to any person obtaining a
11 *   copy of this software and associated documentation files (the "Software"),
12 *   to deal in the Software without restriction, including without limitation
13 *   the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 *   and/or sell copies of the Software, and to permit persons to whom the
15 *   Software is furnished to do so, subject to the following conditions:
16 *
17 *   The above copyright notice and this permission notice shall be included
18 *   in all copies or substantial portions of the Software.
19 *
20 *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 *   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 *   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
23 *   SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
24 *   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
25 *   OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26 *   SOFTWARE.
27 *
28 *  ======================================================================
29 *
30 * Language:     ANSI C
31 * Environment:  Windows 9x (Win32)
32 *
33 * Description:  Globals.
34 *
35 ****************************************************************************/
36
37 #ifndef __DGLGLOBALS_H
38 #define __DGLGLOBALS_H
39
40 #include "dglcontext.h"
41 #include "dglpf.h"              // Pixel format
42 #ifndef _USE_GLD3_WGL
43 #include "d3dtexture.h"
44 #endif
45
46 /*---------------------- Macros and type definitions ----------------------*/
47
48 typedef enum {
49         DGL_RENDER_MESASW               = 0,
50         DGL_RENDER_D3D                  = 1,
51         DGL_RENDER_FORCE_DWORD  = 0x7ffffff,
52 } DGL_renderType;
53
54 #ifdef _USE_GLD3_WGL
55
56 // Same as DGL_renderType? KeithH
57 typedef enum {
58         GLDS_DRIVER_MESA_SW                     = 0,    // Mesa SW rendering
59         GLDS_DRIVER_REF                         = 1,    // Direct3D Reference Rasteriser
60         GLDS_DRIVER_HAL                         = 2,    // Direct3D HW rendering
61 } GLDS_DRIVER;
62
63 typedef enum {
64         GLDS_TNL_DEFAULT                        = 0,    // Choose best TnL method
65         GLDS_TNL_MESA                           = 1,    // Mesa TnL
66         GLDS_TNL_D3DSW                          = 2,    // D3D Software TnL
67         GLDS_TNL_D3DHW                          = 3,    // D3D Hardware TnL
68 } GLDS_TNL;
69
70 typedef enum {
71         GLDS_MULTISAMPLE_NONE           = 0,
72         GLDS_MULTISAMPLE_FASTEST        = 1,
73         GLDS_MULTISAMPLE_NICEST         = 2,
74 } GLDS_MULTISAMPLE;
75 #endif
76
77 typedef struct {
78         // Registry settings
79         char                            szDDName[MAX_DDDEVICEID_STRING]; // DirectDraw device name
80         char                            szD3DName[MAX_DDDEVICEID_STRING]; // Direct3D driver name
81         BOOL                            bPrimary; // Is ddraw device the Primary device?
82         BOOL                            bHardware; // Is the d3d driver a Hardware driver?
83 #ifndef _USE_GLD3_WGL
84         GUID                            ddGuid; // GUID of the ddraw device 
85         GUID                            d3dGuid; // GUID of the direct3d driver
86 #endif // _USE_GLD3_WGL
87 //      BOOL                            bFullscreen; // Force fullscreen - only useful for primary adaptors.
88         BOOL                            bSquareTextures; // Does this driver require square textures?
89         DWORD               dwRendering; // Type of rendering required
90
91         BOOL                            bWaitForRetrace; // Sync to vertical retrace
92         BOOL                            bFullscreenBlit; // Use Blt instead of Flip in fullscreen modes
93
94         // Multitexture
95         BOOL                            bMultitexture;
96
97         BOOL                            bUseMipmaps;
98
99         DWORD                           dwMemoryType; // Sysmem or Vidmem
100
101         // Global palette
102         BOOL                            bPAL8;
103         DDPIXELFORMAT           ddpfPAL8;
104
105         // Multitexture
106         WORD                            wMaxSimultaneousTextures;
107
108         // Win32 internals
109         BOOL                            bAppActive; // Keep track of Alt-Tab
110         LONG                            lpfnWndProc; // WndProc of calling app
111
112         // Pixel Format Descriptior list.
113         int                                     nPixelFormatCount;
114         DGL_pixelFormat         *lpPF;
115 #ifndef _USE_GLD3_WGL
116         // ZBuffer pixel formats
117         int                                     nZBufferPFCount; // Count of Zbuffer pixel formats
118         DDPIXELFORMAT           *lpZBufferPF; // ZBuffer pixel formats
119
120         // Display modes (for secondary devices)
121         int                                     nDisplayModeCount;
122         DDSURFACEDESC2          *lpDisplayModes;
123
124         // Texture pixel formats
125         int                                     nTextureFormatCount;
126         DGL_textureFormat       *lpTextureFormat;
127 #endif // _USE_GLD3_WGL
128         // Alpha emulation via chroma key
129         BOOL                            bEmulateAlphaTest;
130
131         // Geom pipeline override.
132         // If this is set TRUE then the D3D pipeline will never be used,
133         // and the Mesa pipline will always be used.
134         BOOL                            bForceMesaPipeline;
135
136 #ifdef _USE_GLD3_WGL
137         BOOL                            bPixelformatsDirty;     // Signal a list rebuild
138 #endif
139
140         // Additional globals to support multiple GL rendering contexts, GLRCs
141         BOOL                            bDirectDraw;                    // DirectDraw interface exists ?
142         BOOL                            bDirectDrawPrimary;             // DirectDraw primary surface exists ?
143         BOOL                            bDirect3D;                              // Direct3D interface exists ?
144         BOOL                            bDirect3DDevice;                // Direct3D device exists ?
145
146         BOOL                            bDirectDrawStereo;              // DirectDraw Stereo driver started ?
147         int                             iDirectDrawStereo;              // DirectDraw Stereo driver reference count
148         HWND                            hWndActive;                             // copy of active window
149
150     // Copies of DirectX COM interfaces for re-referencing across multiple GLRCs
151 //      IDirectDraw4                    *lpDD4;                         // copy of DirectDraw interface
152 //      IDirectDrawSurface4             *lpPrimary4;            // copy of DirectDraw primary surface
153 //      IDirectDrawSurface4             *lpBack4;
154 //      IDirectDrawSurface4             *lpDepth4;
155 //      IDirectDrawPalette              *lpGlobalPalette;
156
157         // Aids for heavy-duty MFC-windowed OGL apps, like AutoCAD
158         BOOL                            bMessageBoxWarnings;    // popup message box warning
159         BOOL                            bDirectDrawPersistant;  // DirectDraw is persisitant
160         BOOL                            bPersistantBuffers;     // DirectDraw buffers persisitant
161
162         // FPU setup option for CAD precision (AutoCAD) vs GAME speed (Quake)
163         BOOL                            bFastFPU;                               // single-precision-only FPU ?
164
165         // Hot-Key support, like for real-time stereo parallax adjustments
166         BOOL                            bHotKeySupport;                 // hot-key support ?
167
168         // Multi-threaded support, for apps like 3DStudio
169         BOOL                            bMultiThreaded;                 // multi-threaded ?
170
171         // Detect and use app-specific customizations for apps like 3DStudio
172         BOOL                            bAppCustomizations;             // app customizations ?
173
174 #ifdef _USE_GLD3_WGL
175         DWORD                           dwAdapter;                              // Primary DX8 adapter
176         DWORD                           dwTnL;                                  // MesaSW TnL
177         DWORD                           dwMultisample;                  // Multisample Off
178         DWORD                           dwDriver;                               // Direct3D HW
179         void                            *pDrvPrivate;                   // Driver-specific data
180 #endif
181
182 } DGL_globals;
183
184 /*------------------------- Function Prototypes ---------------------------*/
185
186 #ifdef  __cplusplus
187 extern "C" {
188 #endif
189
190 DGL_globals     glb;
191
192 void            dglInitGlobals();
193
194 #ifdef  __cplusplus
195 }
196 #endif
197
198 #endif