Fix gcc 4.0 warnings.
[wine/testsucceed.git] / dlls / wined3d / wined3d_private.h
blobd7ba6c3ace782ee356596dc68b9592f845c30cfe
1 /*
2 * Direct3D wine internal private include file
4 * Copyright 2002-2003 The wine-d3d team
5 * Copyright 2002-2003 Raphael Junqueira
6 * Copyright 2004 Jason Edmeades
7 * Copyright 2005 Oliver Stieber
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #ifndef __WINE_WINED3D_PRIVATE_H
25 #define __WINE_WINED3D_PRIVATE_H
27 #include <stdarg.h>
28 #include <math.h>
29 #define NONAMELESSUNION
30 #define NONAMELESSSTRUCT
31 #define COBJMACROS
32 #include "windef.h"
33 #include "winbase.h"
34 #include "winreg.h"
35 #include "wingdi.h"
36 #include "winuser.h"
37 #include "wine/debug.h"
38 #include "wine/unicode.h"
40 #include "d3d9.h"
41 #include "d3d9types.h"
42 #include "wine/wined3d_interface.h"
43 #include "wine/wined3d_gl.h"
45 /* Device caps */
46 #define MAX_PALETTES 256
47 #define MAX_STREAMS 16
48 #define MAX_TEXTURES 8
49 #define MAX_SAMPLERS 16
50 #define MAX_ACTIVE_LIGHTS 8
51 #define MAX_CLIPPLANES D3DMAXUSERCLIPPLANES
52 #define MAX_LEVELS 256
54 #define MAX_VSHADER_CONSTANTS 96
55 #define MAX_PSHADER_CONSTANTS 32
57 /* Used for CreateStateBlock */
58 #define NUM_SAVEDPIXELSTATES_R 35
59 #define NUM_SAVEDPIXELSTATES_T 18
60 #define NUM_SAVEDPIXELSTATES_S 12
61 #define NUM_SAVEDVERTEXSTATES_R 31
62 #define NUM_SAVEDVERTEXSTATES_T 2
63 #define NUM_SAVEDVERTEXSTATES_S 1
65 extern const DWORD SavedPixelStates_R[NUM_SAVEDPIXELSTATES_R];
66 extern const DWORD SavedPixelStates_T[NUM_SAVEDPIXELSTATES_T];
67 extern const DWORD SavedPixelStates_S[NUM_SAVEDPIXELSTATES_S];
68 extern const DWORD SavedVertexStates_R[NUM_SAVEDVERTEXSTATES_R];
69 extern const DWORD SavedVertexStates_T[NUM_SAVEDVERTEXSTATES_T];
70 extern const DWORD SavedVertexStates_S[NUM_SAVEDVERTEXSTATES_S];
72 typedef enum _WINELOOKUP {
73 WINELOOKUP_WARPPARAM = 0,
74 WINELOOKUP_MAGFILTER = 1,
75 MAX_LOOKUPS = 2
76 } WINELOOKUP;
78 extern int minLookup[MAX_LOOKUPS];
79 extern int maxLookup[MAX_LOOKUPS];
80 extern DWORD *stateLookup[MAX_LOOKUPS];
82 extern DWORD minMipLookup[D3DTEXF_ANISOTROPIC + 1][D3DTEXF_LINEAR + 1];
84 /* NOTE: Make sure these are in the correct numerical order. (see /include/d3d9types.h typedef enum _D3DDECLTYPE) */
85 UINT static const glTypeLookup[D3DDECLTYPE_UNUSED][5] = {
86 {D3DDECLTYPE_FLOAT1, 1, GL_FLOAT , GL_FALSE ,sizeof(float)},
87 {D3DDECLTYPE_FLOAT2, 2, GL_FLOAT , GL_FALSE ,sizeof(float)},
88 {D3DDECLTYPE_FLOAT3, 3, GL_FLOAT , GL_FALSE ,sizeof(float)},
89 {D3DDECLTYPE_FLOAT4, 4, GL_FLOAT , GL_FALSE ,sizeof(float)},
90 {D3DDECLTYPE_D3DCOLOR, 4, GL_UNSIGNED_BYTE , GL_TRUE ,sizeof(BYTE)},
91 {D3DDECLTYPE_UBYTE4, 4, GL_UNSIGNED_BYTE , GL_FALSE ,sizeof(BYTE)},
92 {D3DDECLTYPE_SHORT2, 2, GL_SHORT , GL_FALSE ,sizeof(short int)},
93 {D3DDECLTYPE_SHORT4, 4, GL_SHORT , GL_FALSE ,sizeof(short int)},
94 {D3DDECLTYPE_UBYTE4N, 4, GL_UNSIGNED_BYTE , GL_FALSE ,sizeof(BYTE)},
95 {D3DDECLTYPE_SHORT2N, 2, GL_SHORT , GL_FALSE ,sizeof(short int)},
96 {D3DDECLTYPE_SHORT4N, 4, GL_SHORT , GL_FALSE ,sizeof(short int)},
97 {D3DDECLTYPE_USHORT2N, 2, GL_UNSIGNED_SHORT , GL_FALSE ,sizeof(short int)},
98 {D3DDECLTYPE_USHORT4N, 4, GL_UNSIGNED_SHORT , GL_FALSE ,sizeof(short int)},
99 {D3DDECLTYPE_UDEC3, 3, GL_UNSIGNED_SHORT , GL_FALSE ,sizeof(short int)},
100 {D3DDECLTYPE_DEC3N, 3, GL_SHORT , GL_FALSE ,sizeof(short int)},
101 {D3DDECLTYPE_FLOAT16_2, 2, GL_FLOAT , GL_FALSE ,sizeof(short int)},
102 {D3DDECLTYPE_FLOAT16_4, 4, GL_FLOAT , GL_FALSE ,sizeof(short int)}};
104 #define WINED3D_ATR_TYPE(_attribute) glTypeLookup[sd->u.s._attribute.dwType][0]
105 #define WINED3D_ATR_SIZE(_attribute) glTypeLookup[sd->u.s._attribute.dwType][1]
106 #define WINED3D_ATR_GLTYPE(_attribute) glTypeLookup[sd->u.s._attribute.dwType][2]
107 #define WINED3D_ATR_NORMALIZED(_attribute) glTypeLookup[sd->u.s._attribute.dwType][3]
108 #define WINED3D_ATR_TYPESIZE(_attribute) glTypeLookup[sd->u.s._attribute.dwType][4]
111 * Settings
113 #define VS_NONE 0
114 #define VS_HW 1
115 #define VS_SW 2
117 #define PS_NONE 0
118 #define PS_HW 1
120 #define VBO_NONE 0
121 #define VBO_HW 1
123 typedef struct wined3d_settings_s {
124 /* vertex and pixel shader modes */
125 int vs_mode;
126 int ps_mode;
127 int vbo_mode;
128 } wined3d_settings_t;
130 extern wined3d_settings_t wined3d_settings;
132 /* X11 locking */
134 extern void (*wine_tsx11_lock_ptr)(void);
135 extern void (*wine_tsx11_unlock_ptr)(void);
137 /* As GLX relies on X, this is needed */
138 extern int num_lock;
140 #if 0
141 #define ENTER_GL() ++num_lock; if (num_lock > 1) FIXME("Recursive use of GL lock to: %d\n", num_lock); wine_tsx11_lock_ptr()
142 #define LEAVE_GL() if (num_lock != 1) FIXME("Recursive use of GL lock: %d\n", num_lock); --num_lock; wine_tsx11_unlock_ptr()
143 #else
144 #define ENTER_GL() wine_tsx11_lock_ptr()
145 #define LEAVE_GL() wine_tsx11_unlock_ptr()
146 #endif
148 /*****************************************************************************
149 * Defines
152 /* GL related defines */
153 /* ------------------ */
154 #define GL_SUPPORT(ExtName) (GLINFO_LOCATION.supported[ExtName] != 0)
155 #define GL_LIMITS(ExtName) (GLINFO_LOCATION.max_##ExtName)
156 #define GL_EXTCALL(FuncName) (GLINFO_LOCATION.FuncName)
157 #define GL_VEND(_VendName) (GLINFO_LOCATION.gl_vendor == VENDOR_##_VendName ? TRUE : FALSE)
159 #define D3DCOLOR_R(dw) (((float) (((dw) >> 16) & 0xFF)) / 255.0f)
160 #define D3DCOLOR_G(dw) (((float) (((dw) >> 8) & 0xFF)) / 255.0f)
161 #define D3DCOLOR_B(dw) (((float) (((dw) >> 0) & 0xFF)) / 255.0f)
162 #define D3DCOLOR_A(dw) (((float) (((dw) >> 24) & 0xFF)) / 255.0f)
164 #define D3DCOLORTOGLFLOAT4(dw, vec) \
165 (vec)[0] = D3DCOLOR_R(dw); \
166 (vec)[1] = D3DCOLOR_G(dw); \
167 (vec)[2] = D3DCOLOR_B(dw); \
168 (vec)[3] = D3DCOLOR_A(dw);
170 /* Note: The following is purely to keep the source code as clear from #ifdefs as possible */
171 #if defined(GL_VERSION_1_3)
172 #define GLACTIVETEXTURE(textureNo) \
173 glActiveTexture(GL_TEXTURE0 + textureNo); \
174 checkGLcall("glActiveTexture");
175 #define GLCLIENTACTIVETEXTURE(textureNo) \
176 glClientActiveTexture(GL_TEXTURE0 + textureNo);
177 #define GLMULTITEXCOORD1F(a,b) \
178 glMultiTexCoord1f(GL_TEXTURE0 + a, b);
179 #define GLMULTITEXCOORD2F(a,b,c) \
180 glMultiTexCoord2f(GL_TEXTURE0 + a, b, c);
181 #define GLMULTITEXCOORD3F(a,b,c,d) \
182 glMultiTexCoord3f(GL_TEXTURE0 + a, b, c, d);
183 #define GLMULTITEXCOORD4F(a,b,c,d,e) \
184 glMultiTexCoord4f(GL_TEXTURE0 + a, b, c, d, e);
185 #define GLTEXTURECUBEMAP GL_TEXTURE_CUBE_MAP
186 #else
187 #define GLACTIVETEXTURE(textureNo) \
188 glActiveTextureARB(GL_TEXTURE0_ARB + textureNo); \
189 checkGLcall("glActiveTextureARB");
190 #define GLCLIENTACTIVETEXTURE(textureNo) \
191 glClientActiveTextureARB(GL_TEXTURE0_ARB + textureNo);
192 #define GLMULTITEXCOORD1F(a,b) \
193 glMultiTexCoord1fARB(GL_TEXTURE0_ARB + a, b);
194 #define GLMULTITEXCOORD2F(a,b,c) \
195 glMultiTexCoord2fARB(GL_TEXTURE0_ARB + a, b, c);
196 #define GLMULTITEXCOORD3F(a,b,c,d) \
197 glMultiTexCoord3fARB(GL_TEXTURE0_ARB + a, b, c, d);
198 #define GLMULTITEXCOORD4F(a,b,c,d,e) \
199 glMultiTexCoord4fARB(GL_TEXTURE0_ARB + a, b, c, d, e);
200 #define GLTEXTURECUBEMAP GL_TEXTURE_CUBE_MAP_ARB
201 #endif
203 /* DirectX Device Limits */
204 /* --------------------- */
205 #define MAX_LEVELS 256 /* Maximum number of mipmap levels. Guessed at 256 */
207 #define MAX_STREAMS 16 /* Maximum possible streams - used for fixed size arrays
208 See MaxStreams in MSDN under GetDeviceCaps */
209 /* Maximum number of constants provided to the shaders */
210 #define HIGHEST_TRANSFORMSTATE 512
211 /* Highest value in D3DTRANSFORMSTATETYPE */
212 #define MAX_CLIPPLANES D3DMAXUSERCLIPPLANES
214 #define MAX_PALETTES 256
216 /* Checking of API calls */
217 /* --------------------- */
218 #define checkGLcall(A) \
220 GLint err = glGetError(); \
221 if (err != GL_NO_ERROR) { \
222 FIXME(">>>>>>>>>>>>>>>>> %x from %s @ %s / %d\n", err, A, __FILE__, __LINE__); \
223 } else { \
224 TRACE("%s call ok %s / %d\n", A, __FILE__, __LINE__); \
228 /* Trace routines / diagnostics */
229 /* ---------------------------- */
231 /* Dump out a matrix and copy it */
232 #define conv_mat(mat,gl_mat) \
233 do { \
234 TRACE("%f %f %f %f\n", (mat)->u.s._11, (mat)->u.s._12, (mat)->u.s._13, (mat)->u.s._14); \
235 TRACE("%f %f %f %f\n", (mat)->u.s._21, (mat)->u.s._22, (mat)->u.s._23, (mat)->u.s._24); \
236 TRACE("%f %f %f %f\n", (mat)->u.s._31, (mat)->u.s._32, (mat)->u.s._33, (mat)->u.s._34); \
237 TRACE("%f %f %f %f\n", (mat)->u.s._41, (mat)->u.s._42, (mat)->u.s._43, (mat)->u.s._44); \
238 memcpy(gl_mat, (mat), 16 * sizeof(float)); \
239 } while (0)
241 /* Macro to dump out the current state of the light chain */
242 #define DUMP_LIGHT_CHAIN() \
244 PLIGHTINFOEL *el = This->stateBlock->lights;\
245 while (el) { \
246 TRACE("Light %p (glIndex %ld, d3dIndex %ld, enabled %d)\n", el, el->glIndex, el->OriginalIndex, el->lightEnabled);\
247 el = el->next; \
251 /* Trace vector and strided data information */
252 #define TRACE_VECTOR(name) TRACE( #name "=(%f, %f, %f, %f)\n", name.x, name.y, name.z, name.w);
253 #define TRACE_STRIDED(sd,name) TRACE( #name "=(data:%p, stride:%ld, type:%ld)\n", sd->u.s.name.lpData, sd->u.s.name.dwStride, sd->u.s.name.dwType);
255 /* Defines used for optimizations */
257 /* Only reapply what is necessary */
258 #define REAPPLY_ALPHAOP 0x0001
259 #define REAPPLY_ALL 0xFFFF
261 /* Advance declaration of structures to satisfy compiler */
262 typedef struct IWineD3DStateBlockImpl IWineD3DStateBlockImpl;
263 typedef struct IWineD3DSurfaceImpl IWineD3DSurfaceImpl;
265 /* Tracking */
267 /* TODO: Move some of this to the device */
268 long globalChangeGlRam(long glram);
270 /* Memory and object tracking */
272 /*Structure for holding information on all direct3d objects
273 useful for making sure tracking is ok and when release is called on a device!
274 and probably quite handy for debugging and dumping states out
276 typedef struct WineD3DGlobalStatistics {
277 int glsurfaceram; /* The aproximate amount of glTexture memory allocated for textures */
278 } WineD3DGlobalStatistics;
280 extern WineD3DGlobalStatistics* wineD3DGlobalStatistics;
282 /* Global variables */
283 extern const float identity[16];
285 /*****************************************************************************
286 * Compilable extra diagnostics
289 /* Trace information per-vertex: (extremely high amount of trace) */
290 #if 0 /* NOTE: Must be 0 in cvs */
291 # define VTRACE(A) TRACE A
292 #else
293 # define VTRACE(A)
294 #endif
296 /* Checking of per-vertex related GL calls */
297 #define vcheckGLcall(A) \
299 GLint err = glGetError(); \
300 if (err != GL_NO_ERROR) { \
301 FIXME(">>>>>>>>>>>>>>>>> %x from %s @ %s / %d\n", err, A, __FILE__, __LINE__); \
302 } else { \
303 VTRACE(("%s call ok %s / %d\n", A, __FILE__, __LINE__)); \
307 /* TODO: Confirm each of these works when wined3d move completed */
308 #if 0 /* NOTE: Must be 0 in cvs */
309 /* To avoid having to get gigabytes of trace, the following can be compiled in, and at the start
310 of each frame, a check is made for the existence of C:\D3DTRACE, and if if exists d3d trace
311 is enabled, and if it doesn't exists it is disabled. */
312 # define FRAME_DEBUGGING
313 /* Adding in the SINGLE_FRAME_DEBUGGING gives a trace of just what makes up a single frame, before
314 the file is deleted */
315 # if 1 /* NOTE: Must be 1 in cvs, as this is mostly more useful than a trace from program start */
316 # define SINGLE_FRAME_DEBUGGING
317 # endif
318 /* The following, when enabled, lets you see the makeup of the frame, by drawprimitive calls.
319 It can only be enabled when FRAME_DEBUGGING is also enabled
320 The contents of the back buffer are written into /tmp/backbuffer_* after each primitive
321 array is drawn. */
322 # if 0 /* NOTE: Must be 0 in cvs, as this give a lot of ppm files when compiled in */
323 # define SHOW_FRAME_MAKEUP 1
324 # endif
325 /* The following, when enabled, lets you see the makeup of the all the textures used during each
326 of the drawprimitive calls. It can only be enabled when SHOW_FRAME_MAKEUP is also enabled.
327 The contents of the textures assigned to each stage are written into
328 /tmp/texture_*_<Stage>.ppm after each primitive array is drawn. */
329 # if 0 /* NOTE: Must be 0 in cvs, as this give a lot of ppm files when compiled in */
330 # define SHOW_TEXTURE_MAKEUP 0
331 # endif
332 extern BOOL isOn;
333 extern BOOL isDumpingFrames;
334 extern LONG primCounter;
335 #endif
337 /*****************************************************************************
338 * Prototypes
341 /* Routine common to the draw primitive and draw indexed primitive routines */
342 void drawPrimitive(IWineD3DDevice *iface,
343 int PrimitiveType,
344 long NumPrimitives,
345 /* for Indexed: */
346 long StartVertexIndex,
347 UINT numberOfVertices,
348 long StartIdx,
349 short idxBytes,
350 const void *idxData,
351 int minIndex);
353 /*****************************************************************************
354 * Structures required to draw primitives
357 typedef struct Direct3DStridedData {
358 BYTE *lpData; /* Pointer to start of data */
359 DWORD dwStride; /* Stride between occurances of this data */
360 DWORD dwType; /* Type (as in D3DVSDT_TYPE) */
361 } Direct3DStridedData;
363 typedef struct Direct3DVertexStridedData {
364 union {
365 struct {
366 Direct3DStridedData position;
367 Direct3DStridedData blendWeights;
368 Direct3DStridedData blendMatrixIndices;
369 Direct3DStridedData normal;
370 Direct3DStridedData pSize;
371 Direct3DStridedData diffuse;
372 Direct3DStridedData specular;
373 Direct3DStridedData texCoords[MAX_TEXTURES];
374 Direct3DStridedData position2; /* tween data */
375 Direct3DStridedData normal2; /* tween data */
376 Direct3DStridedData tangent;
377 Direct3DStridedData binormal;
378 Direct3DStridedData tessFactor;
379 Direct3DStridedData fog;
380 Direct3DStridedData depth;
381 Direct3DStridedData sample;
382 } s;
383 Direct3DStridedData input[16]; /* Indexed by constants in D3DVSDE_REGISTER */
384 } u;
385 } Direct3DVertexStridedData;
387 /*****************************************************************************
388 * Internal representation of a light
390 typedef struct PLIGHTINFOEL PLIGHTINFOEL;
391 struct PLIGHTINFOEL {
392 WINED3DLIGHT OriginalParms; /* Note D3D8LIGHT == D3D9LIGHT */
393 DWORD OriginalIndex;
394 LONG glIndex;
395 BOOL lightEnabled;
396 BOOL changed;
397 BOOL enabledChanged;
399 /* Converted parms to speed up swapping lights */
400 float lightPosn[4];
401 float lightDirn[4];
402 float exponent;
403 float cutoff;
405 PLIGHTINFOEL *next;
406 PLIGHTINFOEL *prev;
409 /*****************************************************************************
410 * IWineD3D implementation structure
412 typedef struct IWineD3DImpl
414 /* IUnknown fields */
415 const IWineD3DVtbl *lpVtbl;
416 LONG ref; /* Note: Ref counting not required */
418 /* WineD3D Information */
419 IUnknown *parent;
420 UINT dxVersion;
422 /* GL Information */
423 BOOL isGLInfoValid;
424 WineD3D_GL_Info gl_info;
425 } IWineD3DImpl;
427 extern const IWineD3DVtbl IWineD3D_Vtbl;
429 typedef struct SwapChainList {
430 IWineD3DSwapChain *swapchain;
431 struct SwapChainList *next;
432 } SwapChainList;
434 /** Hacked out start of a context manager!! **/
435 typedef struct glContext {
436 int Width;
437 int Height;
438 int usedcount;
439 GLXContext context;
441 Drawable drawable;
442 IWineD3DSurface *pSurface;
443 #if 0 /* TODO: someway to represent the state of the context */
444 IWineD3DStateBlock *pStateBlock;
445 #endif
446 /* a few other things like format */
447 } glContext;
449 /* TODO: setup some flags in the regestry to enable, disable pbuffer support
450 (since it will break quite a few things until contexts are managed properly!) */
451 extern BOOL pbuffer_support;
452 /* allocate one pbuffer per surface */
453 extern BOOL pbuffer_per_surface;
455 /* Maximum number of contexts/pbuffers to keep in cache,
456 set to 100 because ATI's drivers don't support deleting pBuffers properly
457 this needs to be migrated to a list and some option availalbe for controle the cache size.
459 #define CONTEXT_CACHE 100
461 typedef struct ResourceList {
462 IWineD3DResource *resource;
463 struct ResourceList *next;
464 } ResourceList;
466 /*****************************************************************************
467 * IWineD3DDevice implementation structure
469 typedef struct IWineD3DDeviceImpl
471 /* IUnknown fields */
472 const IWineD3DDeviceVtbl *lpVtbl;
473 LONG ref; /* Note: Ref counting not required */
475 /* WineD3D Information */
476 IUnknown *parent;
477 IWineD3D *wineD3D;
479 /* X and GL Information */
480 GLint maxConcurrentLights;
482 /* Optimization */
483 BOOL modelview_valid;
484 BOOL proj_valid;
485 BOOL view_ident; /* true iff view matrix is identity */
486 BOOL last_was_rhw; /* true iff last draw_primitive was in xyzrhw mode */
487 GLenum tracking_parm; /* Which source is tracking current colour */
488 LONG tracking_color; /* used iff GL_COLOR_MATERIAL was enabled */
489 #define DISABLED_TRACKING 0 /* Disabled */
490 #define IS_TRACKING 1 /* tracking_parm is tracking diffuse color */
491 #define NEEDS_TRACKING 2 /* Tracking needs to be enabled when needed */
492 #define NEEDS_DISABLE 3 /* Tracking needs to be disabled when needed*/
493 UINT srcBlend;
494 UINT dstBlend;
495 UINT alphafunc;
496 UINT stencilfunc;
497 BOOL texture_shader_active; /* TODO: Confirm use is correct */
499 /* State block related */
500 BOOL isRecordingState;
501 IWineD3DStateBlockImpl *stateBlock;
502 IWineD3DStateBlockImpl *updateStateBlock;
504 /* Internal use fields */
505 D3DDEVICE_CREATION_PARAMETERS createParms;
506 UINT adapterNo;
507 D3DDEVTYPE devType;
509 SwapChainList *swapchains;
511 ResourceList *resources; /* a linked list to track resources created by the device */
513 /* Render Target Support */
514 IWineD3DSurface *depthStencilBuffer;
516 IWineD3DSurface *renderTarget;
517 IWineD3DSurface *stencilBufferTarget;
519 /* palettes texture management */
520 PALETTEENTRY palettes[MAX_PALETTES][256];
521 UINT currentPalette;
523 /* For rendering to a texture using glCopyTexImage */
524 BOOL renderUpsideDown;
526 /* Cursor management */
527 BOOL bCursorVisible;
528 UINT xHotSpot;
529 UINT yHotSpot;
530 UINT xScreenSpace;
531 UINT yScreenSpace;
533 /* Textures for when no other textures are mapped */
534 UINT dummyTextureName[MAX_TEXTURES];
536 /* Debug stream management */
537 BOOL debug;
539 /* Screen buffer resources */
540 glContext contextCache[CONTEXT_CACHE];
542 /* A flag to check if endscene has been called before changing the render tartet */
543 BOOL sceneEnded;
544 } IWineD3DDeviceImpl;
546 extern const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl;
548 /* Support for IWineD3DResource ::Set/Get/FreePrivateData. I don't think
549 * anybody uses it for much so a good implementation is optional. */
550 typedef struct PrivateData
552 struct PrivateData* next;
554 GUID tag;
555 DWORD flags; /* DDSPD_* */
556 DWORD uniqueness_value;
558 union
560 LPVOID data;
561 LPUNKNOWN object;
562 } ptr;
564 DWORD size;
565 } PrivateData;
567 /*****************************************************************************
568 * IWineD3DResource implementation structure
570 typedef struct IWineD3DResourceClass
572 /* IUnknown fields */
573 LONG ref; /* Note: Ref counting not required */
575 /* WineD3DResource Information */
576 IUnknown *parent;
577 D3DRESOURCETYPE resourceType;
578 IWineD3DDeviceImpl *wineD3DDevice;
579 D3DPOOL pool;
580 UINT size;
581 DWORD usage;
582 WINED3DFORMAT format;
583 BYTE *allocatedMemory;
584 PrivateData *privateData;
586 } IWineD3DResourceClass;
588 typedef struct IWineD3DResourceImpl
590 /* IUnknown & WineD3DResource Information */
591 const IWineD3DResourceVtbl *lpVtbl;
592 IWineD3DResourceClass resource;
593 } IWineD3DResourceImpl;
596 /*****************************************************************************
597 * IWineD3DVertexBuffer implementation structure (extends IWineD3DResourceImpl)
599 typedef struct IWineD3DVertexBufferImpl
601 /* IUnknown & WineD3DResource Information */
602 const IWineD3DVertexBufferVtbl *lpVtbl;
603 IWineD3DResourceClass resource;
605 /* WineD3DVertexBuffer specifics */
606 DWORD fvf;
608 } IWineD3DVertexBufferImpl;
610 extern const IWineD3DVertexBufferVtbl IWineD3DVertexBuffer_Vtbl;
613 /*****************************************************************************
614 * IWineD3DIndexBuffer implementation structure (extends IWineD3DResourceImpl)
616 typedef struct IWineD3DIndexBufferImpl
618 /* IUnknown & WineD3DResource Information */
619 const IWineD3DIndexBufferVtbl *lpVtbl;
620 IWineD3DResourceClass resource;
622 /* WineD3DVertexBuffer specifics */
623 } IWineD3DIndexBufferImpl;
625 extern const IWineD3DIndexBufferVtbl IWineD3DIndexBuffer_Vtbl;
627 /*****************************************************************************
628 * IWineD3DBaseTexture D3D- > openGL state map lookups
630 #define WINED3DFUNC_NOTSUPPORTED -2
631 #define WINED3DFUNC_UNIMPLEMENTED -1
633 typedef enum winetexturestates {
634 WINED3DTEXSTA_ADDRESSU = 0,
635 WINED3DTEXSTA_ADDRESSV = 1,
636 WINED3DTEXSTA_ADDRESSW = 2,
637 WINED3DTEXSTA_BORDERCOLOR = 3,
638 WINED3DTEXSTA_MAGFILTER = 4,
639 WINED3DTEXSTA_MINFILTER = 5,
640 WINED3DTEXSTA_MIPFILTER = 6,
641 WINED3DTEXSTA_MAXMIPLEVEL = 7,
642 WINED3DTEXSTA_MAXANISOTROPY = 8,
643 WINED3DTEXSTA_SRGBTEXTURE = 9,
644 WINED3DTEXSTA_ELEMENTINDEX = 10,
645 WINED3DTEXSTA_DMAPOFFSET = 11,
646 WINED3DTEXSTA_TSSADDRESSW = 12,
647 MAX_WINETEXTURESTATES = 13,
648 } winetexturestates;
650 typedef struct Wined3dTextureStateMap {
651 CONST int state;
652 int function;
653 } Wined3dTextureStateMap;
655 /*****************************************************************************
656 * IWineD3DBaseTexture implementation structure (extends IWineD3DResourceImpl)
658 typedef struct IWineD3DBaseTextureClass
660 UINT levels;
661 BOOL dirty;
662 D3DFORMAT format;
663 DWORD usage;
664 UINT textureName;
665 UINT LOD;
666 D3DTEXTUREFILTERTYPE filterType;
667 DWORD states[MAX_WINETEXTURESTATES];
669 } IWineD3DBaseTextureClass;
671 typedef struct IWineD3DBaseTextureImpl
673 /* IUnknown & WineD3DResource Information */
674 const IWineD3DBaseTextureVtbl *lpVtbl;
675 IWineD3DResourceClass resource;
676 IWineD3DBaseTextureClass baseTexture;
678 } IWineD3DBaseTextureImpl;
680 /*****************************************************************************
681 * IWineD3DTexture implementation structure (extends IWineD3DBaseTextureImpl)
683 typedef struct IWineD3DTextureImpl
685 /* IUnknown & WineD3DResource/WineD3DBaseTexture Information */
686 const IWineD3DTextureVtbl *lpVtbl;
687 IWineD3DResourceClass resource;
688 IWineD3DBaseTextureClass baseTexture;
690 /* IWineD3DTexture */
691 IWineD3DSurface *surfaces[MAX_LEVELS];
693 UINT width;
694 UINT height;
695 float pow2scalingFactorX;
696 float pow2scalingFactorY;
698 } IWineD3DTextureImpl;
700 extern const IWineD3DTextureVtbl IWineD3DTexture_Vtbl;
702 /*****************************************************************************
703 * IWineD3DCubeTexture implementation structure (extends IWineD3DBaseTextureImpl)
705 typedef struct IWineD3DCubeTextureImpl
707 /* IUnknown & WineD3DResource/WineD3DBaseTexture Information */
708 const IWineD3DCubeTextureVtbl *lpVtbl;
709 IWineD3DResourceClass resource;
710 IWineD3DBaseTextureClass baseTexture;
712 /* IWineD3DCubeTexture */
713 IWineD3DSurface *surfaces[6][MAX_LEVELS];
715 UINT edgeLength;
716 float pow2scalingFactor;
718 } IWineD3DCubeTextureImpl;
720 extern const IWineD3DCubeTextureVtbl IWineD3DCubeTexture_Vtbl;
722 /*****************************************************************************
723 * IWineD3DVolume implementation structure (extends IUnknown)
725 typedef struct IWineD3DVolumeImpl
727 /* IUnknown & WineD3DResource fields */
728 const IWineD3DVolumeVtbl *lpVtbl;
729 IWineD3DResourceClass resource;
731 /* WineD3DVolume Information */
732 D3DVOLUME_DESC currentDesc;
733 IUnknown *container;
734 UINT bytesPerPixel;
736 BOOL lockable;
737 BOOL locked;
738 D3DBOX lockedBox;
739 D3DBOX dirtyBox;
740 BOOL dirty;
743 } IWineD3DVolumeImpl;
745 extern const IWineD3DVolumeVtbl IWineD3DVolume_Vtbl;
747 /*****************************************************************************
748 * IWineD3DVolumeTexture implementation structure (extends IWineD3DBaseTextureImpl)
750 typedef struct IWineD3DVolumeTextureImpl
752 /* IUnknown & WineD3DResource/WineD3DBaseTexture Information */
753 const IWineD3DVolumeTextureVtbl *lpVtbl;
754 IWineD3DResourceClass resource;
755 IWineD3DBaseTextureClass baseTexture;
757 /* IWineD3DVolumeTexture */
758 IWineD3DVolume *volumes[MAX_LEVELS];
760 UINT width;
761 UINT height;
762 UINT depth;
763 } IWineD3DVolumeTextureImpl;
765 extern const IWineD3DVolumeTextureVtbl IWineD3DVolumeTexture_Vtbl;
767 typedef struct _WINED3DSURFACET_DESC
769 D3DMULTISAMPLE_TYPE MultiSampleType;
770 DWORD MultiSampleQuality;
771 UINT Width;
772 UINT Height;
773 } WINED3DSURFACET_DESC;
775 /*****************************************************************************
776 * IWineD3DSurface implementation structure
778 struct IWineD3DSurfaceImpl
780 /* IUnknown & IWineD3DResource Information */
781 const IWineD3DSurfaceVtbl *lpVtbl;
782 IWineD3DResourceClass resource;
784 /* IWineD3DSurface fields */
785 IUnknown *container;
786 WINED3DSURFACET_DESC currentDesc;
788 UINT textureName;
789 UINT bytesPerPixel;
791 /* TODO: move this off into a management class(maybe!) */
792 BOOL nonpow2;
794 UINT pow2Width;
795 UINT pow2Height;
796 UINT pow2Size;
798 #if 0
799 /* precalculated x and y scalings for texture coords */
800 float pow2scalingFactorX; /* = (Width / pow2Width ) */
801 float pow2scalingFactorY; /* = (Height / pow2Height) */
802 #endif
804 BOOL lockable;
805 BOOL discard;
806 BOOL locked;
807 BOOL activeLock;
809 RECT lockedRect;
810 RECT dirtyRect;
811 BOOL Dirty;
813 BOOL inTexture;
814 BOOL inPBuffer;
816 glDescriptor glDescription;
819 extern const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl;
821 /*****************************************************************************
822 * IWineD3DVertexDeclaration implementation structure
824 typedef struct IWineD3DVertexDeclarationImpl {
825 /* IUnknown Information */
826 const IWineD3DVertexDeclarationVtbl *lpVtbl;
827 LONG ref; /* Note: Ref counting not required */
829 IUnknown *parent;
830 /** precomputed fvf if simple declaration */
831 IWineD3DDeviceImpl *wineD3DDevice;
832 DWORD fvf[MAX_STREAMS];
833 DWORD allFVF;
835 /** dx8 compatible Declaration fields */
836 DWORD* pDeclaration8;
837 DWORD declaration8Length;
839 /** dx9+ */
840 D3DVERTEXELEMENT9* pDeclaration9;
841 UINT declaration9NumElements;
842 } IWineD3DVertexDeclarationImpl;
844 extern const IWineD3DVertexDeclarationVtbl IWineD3DVertexDeclaration_Vtbl;
846 /*****************************************************************************
847 * IWineD3DStateBlock implementation structure
850 /* Internal state Block for Begin/End/Capture/Create/Apply info */
851 /* Note: Very long winded but gl Lists are not flexible enough */
852 /* to resolve everything we need, so doing it manually for now */
853 typedef struct SAVEDSTATES {
854 BOOL indices;
855 BOOL material;
856 BOOL fvf;
857 BOOL streamSource[MAX_STREAMS];
858 BOOL streamFreq[MAX_STREAMS];
859 BOOL textures[MAX_TEXTURES];
860 BOOL transform[HIGHEST_TRANSFORMSTATE + 1];
861 BOOL viewport;
862 BOOL renderState[WINEHIGHEST_RENDER_STATE + 1];
863 BOOL textureState[MAX_TEXTURES][WINED3D_HIGHEST_TEXTURE_STATE + 1];
864 BOOL samplerState[MAX_SAMPLERS][WINED3D_HIGHEST_SAMPLER_STATE + 1];
865 BOOL clipplane[MAX_CLIPPLANES];
866 BOOL vertexDecl;
867 BOOL pixelShader;
868 BOOL vertexShader;
869 } SAVEDSTATES;
871 struct IWineD3DStateBlockImpl
873 /* IUnknown fields */
874 const IWineD3DStateBlockVtbl *lpVtbl;
875 LONG ref; /* Note: Ref counting not required */
877 /* IWineD3DStateBlock information */
878 IUnknown *parent;
879 IWineD3DDeviceImpl *wineD3DDevice;
880 WINED3DSTATEBLOCKTYPE blockType;
882 /* Array indicating whether things have been set or changed */
883 SAVEDSTATES changed;
884 SAVEDSTATES set;
886 /* Drawing - Vertex Shader or FVF related */
887 DWORD fvf;
888 /* Vertex Shader Declaration */
889 IWineD3DVertexDeclaration *vertexDecl;
891 IWineD3DVertexShader *vertexShader; /* @TODO: Replace void * with IWineD3DVertexShader * */
893 /* Vertex Shader Constants */
894 BOOL vertexShaderConstantB[MAX_VSHADER_CONSTANTS];
895 INT vertexShaderConstantI[MAX_VSHADER_CONSTANTS * 4];
896 float vertexShaderConstantF[MAX_VSHADER_CONSTANTS * 4];
898 BOOL softwareVertexProcessing;
900 /* Stream Source */
901 BOOL streamIsUP;
902 UINT streamStride[MAX_STREAMS];
903 UINT streamOffset[MAX_STREAMS];
904 IWineD3DVertexBuffer *streamSource[MAX_STREAMS];
905 UINT streamFreq[MAX_STREAMS];
906 UINT streamFlags[MAX_STREAMS]; /*0 | D3DSTREAMSOURCE_INSTANCEDATA | D3DSTREAMSOURCE_INDEXEDDATA */
908 /* Indices */
909 IWineD3DIndexBuffer* pIndexData;
910 UINT baseVertexIndex; /* Note: only used for d3d8 */
912 /* Transform */
913 D3DMATRIX transforms[HIGHEST_TRANSFORMSTATE + 1];
915 /* Lights */
916 PLIGHTINFOEL *lights; /* NOTE: active GL lights must be front of the chain */
918 /* Clipping */
919 double clipplane[MAX_CLIPPLANES][4];
920 WINED3DCLIPSTATUS clip_status;
922 /* ViewPort */
923 WINED3DVIEWPORT viewport;
925 /* Material */
926 WINED3DMATERIAL material;
928 /* Pixel Shader */
929 IWineD3DPixelShader *pixelShader; /* TODO: Replace void * with IWineD3DPixelShader */
931 /* Pixel Shader Constants */
932 BOOL pixelShaderConstantB[MAX_PSHADER_CONSTANTS];
933 UINT pixelShaderConstantI[MAX_PSHADER_CONSTANTS * 4];
934 float pixelShaderConstantF[MAX_PSHADER_CONSTANTS * 4];
936 /* Indexed Vertex Blending */
937 D3DVERTEXBLENDFLAGS vertex_blend;
938 FLOAT tween_factor;
940 /* RenderState */
941 DWORD renderState[WINEHIGHEST_RENDER_STATE + 1];
943 /* Texture */
944 IWineD3DBaseTexture *textures[MAX_TEXTURES];
945 int textureDimensions[MAX_SAMPLERS];
947 /* Texture State Stage */
948 DWORD textureState[MAX_TEXTURES][WINED3D_HIGHEST_TEXTURE_STATE + 1];
949 /* Sampler States */
950 DWORD samplerState[MAX_SAMPLERS][WINED3D_HIGHEST_SAMPLER_STATE + 1];
954 extern const IWineD3DStateBlockVtbl IWineD3DStateBlock_Vtbl;
956 /*****************************************************************************
957 * IWineD3DQueryImpl implementation structure (extends IUnknown)
959 typedef struct IWineD3DQueryImpl
961 const IWineD3DQueryVtbl *lpVtbl;
962 LONG ref; /* Note: Ref counting not required */
964 IUnknown *parent;
965 /*TODO: replace with iface usage */
966 #if 0
967 IWineD3DDevice *wineD3DDevice;
968 #else
969 IWineD3DDeviceImpl *wineD3DDevice;
970 #endif
971 /* IWineD3DQuery fields */
973 D3DQUERYTYPE type;
974 void *extendedData;
977 } IWineD3DQueryImpl;
979 extern const IWineD3DQueryVtbl IWineD3DQuery_Vtbl;
981 /*****************************************************************************
982 * IWineD3DSwapChainImpl implementation structure (extends IUnknown)
985 typedef struct IWineD3DSwapChainImpl
987 /*IUnknown part*/
988 IWineD3DSwapChainVtbl *lpVtbl;
989 LONG ref; /* Note: Ref counting not required */
991 IUnknown *parent;
992 IWineD3DDeviceImpl *wineD3DDevice;
994 /* IWineD3DSwapChain fields */
995 IWineD3DSurface *backBuffer;
996 IWineD3DSurface *frontBuffer;
997 BOOL wantsDepthStencilBuffer;
998 D3DPRESENT_PARAMETERS presentParms;
1000 /* TODO: move everything upto drawable off into a context manager
1001 and store the 'data' in the contextManagerData interface.
1002 IUnknown *contextManagerData;
1005 HWND win_handle;
1006 Window win;
1007 Display *display;
1009 GLXContext glCtx;
1010 XVisualInfo *visInfo;
1011 GLXContext render_ctx;
1012 /* This has been left in device for now, but needs moving off into a rendertarget management class and separated out from swapchains and devices. */
1013 Drawable drawable;
1014 } IWineD3DSwapChainImpl;
1016 extern IWineD3DSwapChainVtbl IWineD3DSwapChain_Vtbl;
1018 /*****************************************************************************
1019 * Utility function prototypes
1022 /* Trace routines */
1023 const char* debug_d3dformat(WINED3DFORMAT fmt);
1024 const char* debug_d3ddevicetype(D3DDEVTYPE devtype);
1025 const char* debug_d3dresourcetype(D3DRESOURCETYPE res);
1026 const char* debug_d3dusage(DWORD usage);
1027 const char* debug_d3dprimitivetype(D3DPRIMITIVETYPE PrimitiveType);
1028 const char* debug_d3drenderstate(DWORD state);
1029 const char* debug_d3dtexturestate(DWORD state);
1030 const char* debug_d3dpool(D3DPOOL pool);
1032 /* Routines for GL <-> D3D values */
1033 GLenum StencilOp(DWORD op);
1034 void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, D3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3);
1035 void set_texture_matrix(const float *smat, DWORD flags, BOOL calculatedCoords);
1036 void GetSrcAndOpFromValue(DWORD iValue, BOOL isAlphaArg, GLenum* source, GLenum* operand);
1038 SHORT D3DFmtGetBpp(IWineD3DDeviceImpl* This, D3DFORMAT fmt);
1039 GLenum D3DFmt2GLFmt(IWineD3DDeviceImpl* This, D3DFORMAT fmt);
1040 GLenum D3DFmt2GLType(IWineD3DDeviceImpl *This, D3DFORMAT fmt);
1041 GLint D3DFmt2GLIntFmt(IWineD3DDeviceImpl* This, D3DFORMAT fmt);
1043 int D3DFmtMakeGlCfg(D3DFORMAT BackBufferFormat, D3DFORMAT StencilBufferFormat, int *attribs, int* nAttribs, BOOL alternate);
1046 /*****************************************************************************
1047 * To enable calling of inherited functions, requires prototypes
1049 * Note: Only require classes which are subclassed, ie resource, basetexture,
1051 /*** IUnknown methods ***/
1052 extern HRESULT WINAPI IWineD3DResourceImpl_QueryInterface(IWineD3DResource *iface, REFIID riid, void** ppvObject);
1053 extern ULONG WINAPI IWineD3DResourceImpl_AddRef(IWineD3DResource *iface);
1054 extern ULONG WINAPI IWineD3DResourceImpl_Release(IWineD3DResource *iface);
1055 /*** IWineD3DResource methods ***/
1056 extern HRESULT WINAPI IWineD3DResourceImpl_GetParent(IWineD3DResource *iface, IUnknown **pParent);
1057 extern HRESULT WINAPI IWineD3DResourceImpl_GetDevice(IWineD3DResource *iface, IWineD3DDevice ** ppDevice);
1058 extern HRESULT WINAPI IWineD3DResourceImpl_SetPrivateData(IWineD3DResource *iface, REFGUID refguid, CONST void * pData, DWORD SizeOfData, DWORD Flags);
1059 extern HRESULT WINAPI IWineD3DResourceImpl_GetPrivateData(IWineD3DResource *iface, REFGUID refguid, void * pData, DWORD * pSizeOfData);
1060 extern HRESULT WINAPI IWineD3DResourceImpl_FreePrivateData(IWineD3DResource *iface, REFGUID refguid);
1061 extern DWORD WINAPI IWineD3DResourceImpl_SetPriority(IWineD3DResource *iface, DWORD PriorityNew);
1062 extern DWORD WINAPI IWineD3DResourceImpl_GetPriority(IWineD3DResource *iface);
1063 extern void WINAPI IWineD3DResourceImpl_PreLoad(IWineD3DResource *iface);
1064 extern D3DRESOURCETYPE WINAPI IWineD3DResourceImpl_GetType(IWineD3DResource *iface);
1065 /*** class static members ***/
1066 void IWineD3DResourceImpl_CleanUp(IWineD3DResource *iface);
1068 /*** IUnknown methods ***/
1069 extern HRESULT WINAPI IWineD3DBaseTextureImpl_QueryInterface(IWineD3DBaseTexture *iface, REFIID riid, void** ppvObject);
1070 extern ULONG WINAPI IWineD3DBaseTextureImpl_AddRef(IWineD3DBaseTexture *iface);
1071 extern ULONG WINAPI IWineD3DBaseTextureImpl_Release(IWineD3DBaseTexture *iface);
1072 /*** IWineD3DResource methods ***/
1073 extern HRESULT WINAPI IWineD3DBaseTextureImpl_GetParent(IWineD3DBaseTexture *iface, IUnknown **pParent);
1074 extern HRESULT WINAPI IWineD3DBaseTextureImpl_GetDevice(IWineD3DBaseTexture *iface, IWineD3DDevice ** ppDevice);
1075 extern HRESULT WINAPI IWineD3DBaseTextureImpl_SetPrivateData(IWineD3DBaseTexture *iface, REFGUID refguid, CONST void * pData, DWORD SizeOfData, DWORD Flags);
1076 extern HRESULT WINAPI IWineD3DBaseTextureImpl_GetPrivateData(IWineD3DBaseTexture *iface, REFGUID refguid, void * pData, DWORD * pSizeOfData);
1077 extern HRESULT WINAPI IWineD3DBaseTextureImpl_FreePrivateData(IWineD3DBaseTexture *iface, REFGUID refguid);
1078 extern DWORD WINAPI IWineD3DBaseTextureImpl_SetPriority(IWineD3DBaseTexture *iface, DWORD PriorityNew);
1079 extern DWORD WINAPI IWineD3DBaseTextureImpl_GetPriority(IWineD3DBaseTexture *iface);
1080 extern void WINAPI IWineD3DBaseTextureImpl_PreLoad(IWineD3DBaseTexture *iface);
1081 extern D3DRESOURCETYPE WINAPI IWineD3DBaseTextureImpl_GetType(IWineD3DBaseTexture *iface);
1082 /*** IWineD3DBaseTexture methods ***/
1083 extern DWORD WINAPI IWineD3DBaseTextureImpl_SetLOD(IWineD3DBaseTexture *iface, DWORD LODNew);
1084 extern DWORD WINAPI IWineD3DBaseTextureImpl_GetLOD(IWineD3DBaseTexture *iface);
1085 extern DWORD WINAPI IWineD3DBaseTextureImpl_GetLevelCount(IWineD3DBaseTexture *iface);
1086 extern HRESULT WINAPI IWineD3DBaseTextureImpl_SetAutoGenFilterType(IWineD3DBaseTexture *iface, D3DTEXTUREFILTERTYPE FilterType);
1087 extern D3DTEXTUREFILTERTYPE WINAPI IWineD3DBaseTextureImpl_GetAutoGenFilterType(IWineD3DBaseTexture *iface);
1088 extern void WINAPI IWineD3DBaseTextureImpl_GenerateMipSubLevels(IWineD3DBaseTexture *iface);
1089 extern BOOL WINAPI IWineD3DBaseTextureImpl_SetDirty(IWineD3DBaseTexture *iface, BOOL);
1090 extern BOOL WINAPI IWineD3DBaseTextureImpl_GetDirty(IWineD3DBaseTexture *iface);
1092 extern BYTE* WINAPI IWineD3DVertexBufferImpl_GetMemory(IWineD3DVertexBuffer* iface, DWORD iOffset);
1093 extern HRESULT WINAPI IWineD3DVertexBufferImpl_ReleaseMemory(IWineD3DVertexBuffer* iface);
1094 extern HRESULT WINAPI IWineD3DBaseTextureImpl_BindTexture(IWineD3DBaseTexture *iface);
1095 extern HRESULT WINAPI IWineD3DBaseTextureImpl_UnBindTexture(IWineD3DBaseTexture *iface);
1096 extern void WINAPI IWineD3DBaseTextureImpl_ApplyStateChanges(IWineD3DBaseTexture *iface, const DWORD textureStates[WINED3D_HIGHEST_TEXTURE_STATE + 1], const DWORD samplerStates[WINED3D_HIGHEST_SAMPLER_STATE + 1]);
1097 /*** class static members ***/
1098 void IWineD3DBaseTextureImpl_CleanUp(IWineD3DBaseTexture *iface);
1100 /* an emul for the type of constants that are used... adressing causes problems with being able to work out what's used and what's not.. so maybe we'll have to rely on the server vertex shader const functions? */
1101 enum vsConstantsEnum {
1102 VS_CONSTANT_NOT_USED = 0,
1103 VS_CONSTANT_CONSTANT,
1104 VS_CONSTANT_INTEGER,
1105 VS_CONSTANT_BOOLEAN,
1106 VS_CONSTANT_FLOAT
1109 /*****************************************************************************
1110 * IDirect3DVertexShader implementation structure
1112 typedef struct IWineD3DVertexShaderImpl {
1113 /* IUnknown parts*/
1114 const IWineD3DVertexShaderVtbl *lpVtbl;
1115 LONG ref; /* Note: Ref counting not required */
1117 IUnknown *parent;
1118 IWineD3DDeviceImpl *wineD3DDevice;
1120 /* IWineD3DVertexShaderImpl */
1121 CONST DWORD *function;
1122 UINT functionLength;
1124 DWORD usage;
1125 DWORD version;
1127 /* vertex declaration array mapping */
1128 BOOL namedArrays; /* don't map use named functions */
1129 BOOL declaredArrays; /* mapping requires */
1130 INT arrayUsageMap[WINED3DSHADERDECLUSAGE_MAX_USAGE]; /* lookup table for the maps */
1131 INT highestConstant;
1132 CHAR constantsUsedBitmap[256];
1133 /* FIXME: This needs to be populated with some flags of VS_CONSTANT_NOT_USED, VS_CONSTANT_CONSTANT, VS_CONSTANT_INTEGER, VS_CONSTANT_BOOLEAN, VS_CONSTANT_FLOAT, a half byte bitmap will be the best option, but I'll keep it as chards for siplicity */
1134 /* run time datas... */
1135 VSHADERDATA* data;
1136 GLuint prgId;
1137 #if 0 /* needs reworking */
1138 /* run time datas */
1139 VSHADERINPUTDATA input;
1140 VSHADEROUTPUTDATA output;
1141 #endif
1142 } IWineD3DVertexShaderImpl;
1143 extern const IWineD3DVertexShaderVtbl IWineD3DVertexShader_Vtbl;
1145 /*****************************************************************************
1146 * IDirect3DPixelShader implementation structure
1148 typedef struct IWineD3DPixelShaderImpl {
1149 /* IUnknown parts*/
1150 const IWineD3DPixelShaderVtbl *lpVtbl;
1151 LONG ref; /* Note: Ref counting not required */
1153 IUnknown *parent;
1154 IWineD3DDeviceImpl *wineD3DDevice;
1157 /* IWineD3DPixelShaderImpl */
1158 CONST DWORD *function;
1159 UINT functionLength;
1161 #if 0 /* needs reworking */
1162 /* run time datas */
1163 PSHADERDATA* data;
1164 PSHADERINPUTDATA input;
1165 PSHADEROUTPUTDATA output;
1166 #endif
1167 } IWineD3DPixelShaderImpl;
1169 extern const IWineD3DPixelShaderVtbl IWineD3DPixelShader_Vtbl;
1170 #endif