Fixed installation rules for Wine-specific IDL files.
[wine/testsucceed.git] / dlls / wined3d / wined3d_private.h
blob5fbddc63d28caa64ff8667afddfaee66eb631009
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
56 /* Used for CreateStateBlock */
57 #define NUM_SAVEDPIXELSTATES_R 35
58 #define NUM_SAVEDPIXELSTATES_T 18
59 #define NUM_SAVEDPIXELSTATES_S 12
60 #define NUM_SAVEDVERTEXSTATES_R 31
61 #define NUM_SAVEDVERTEXSTATES_T 2
62 #define NUM_SAVEDVERTEXSTATES_S 1
64 extern const DWORD SavedPixelStates_R[NUM_SAVEDPIXELSTATES_R];
65 extern const DWORD SavedPixelStates_T[NUM_SAVEDPIXELSTATES_T];
66 extern const DWORD SavedPixelStates_S[NUM_SAVEDPIXELSTATES_S];
67 extern const DWORD SavedVertexStates_R[NUM_SAVEDVERTEXSTATES_R];
68 extern const DWORD SavedVertexStates_T[NUM_SAVEDVERTEXSTATES_T];
69 extern const DWORD SavedVertexStates_S[NUM_SAVEDVERTEXSTATES_S];
71 typedef enum _WINELOOKUP {
72 WINELOOKUP_WARPPARAM = 0,
73 WINELOOKUP_MAGFILTER = 1,
74 MAX_LOOKUPS = 2
75 } WINELOOKUP;
77 extern int minLookup[MAX_LOOKUPS];
78 extern int maxLookup[MAX_LOOKUPS];
79 extern DWORD *stateLookup[MAX_LOOKUPS];
81 extern DWORD minMipLookup[D3DTEXF_ANISOTROPIC + 1][D3DTEXF_LINEAR + 1];
83 /* NOTE: Make sure these are in the correct numerical order. (see /include/d3d9types.h typedef enum _D3DDECLTYPE) */
84 UINT static const glTypeLookup[D3DDECLTYPE_UNUSED][5] = {
85 {D3DDECLTYPE_FLOAT1, 1, GL_FLOAT , GL_FALSE ,sizeof(float)},
86 {D3DDECLTYPE_FLOAT2, 2, GL_FLOAT , GL_FALSE ,sizeof(float)},
87 {D3DDECLTYPE_FLOAT3, 3, GL_FLOAT , GL_FALSE ,sizeof(float)},
88 {D3DDECLTYPE_FLOAT4, 4, GL_FLOAT , GL_FALSE ,sizeof(float)},
89 {D3DDECLTYPE_D3DCOLOR, 4, GL_UNSIGNED_BYTE , GL_TRUE ,sizeof(BYTE)},
90 {D3DDECLTYPE_UBYTE4, 4, GL_UNSIGNED_BYTE , GL_FALSE ,sizeof(BYTE)},
91 {D3DDECLTYPE_SHORT2, 2, GL_SHORT , GL_FALSE ,sizeof(short int)},
92 {D3DDECLTYPE_SHORT4, 4, GL_SHORT , GL_FALSE ,sizeof(short int)},
93 {D3DDECLTYPE_UBYTE4N, 4, GL_UNSIGNED_BYTE , GL_FALSE ,sizeof(BYTE)},
94 {D3DDECLTYPE_SHORT2N, 2, GL_SHORT , GL_FALSE ,sizeof(short int)},
95 {D3DDECLTYPE_SHORT4N, 4, GL_SHORT , GL_FALSE ,sizeof(short int)},
96 {D3DDECLTYPE_USHORT2N, 2, GL_UNSIGNED_SHORT , GL_FALSE ,sizeof(short int)},
97 {D3DDECLTYPE_USHORT4N, 4, GL_UNSIGNED_SHORT , GL_FALSE ,sizeof(short int)},
98 {D3DDECLTYPE_UDEC3, 3, GL_UNSIGNED_SHORT , GL_FALSE ,sizeof(short int)},
99 {D3DDECLTYPE_DEC3N, 3, GL_SHORT , GL_FALSE ,sizeof(short int)},
100 {D3DDECLTYPE_FLOAT16_2, 2, GL_FLOAT , GL_FALSE ,sizeof(short int)},
101 {D3DDECLTYPE_FLOAT16_4, 4, GL_FLOAT , GL_FALSE ,sizeof(short int)}};
103 #define WINED3D_ATR_TYPE(_attribute) glTypeLookup[sd->u.s._attribute.dwType][0]
104 #define WINED3D_ATR_SIZE(_attribute) glTypeLookup[sd->u.s._attribute.dwType][1]
105 #define WINED3D_ATR_GLTYPE(_attribute) glTypeLookup[sd->u.s._attribute.dwType][2]
106 #define WINED3D_ATR_NORMALIZED(_attribute) glTypeLookup[sd->u.s._attribute.dwType][3]
107 #define WINED3D_ATR_TYPESIZE(_attribute) glTypeLookup[sd->u.s._attribute.dwType][4]
110 * Settings
112 #define VS_NONE 0
113 #define VS_HW 1
114 #define VS_SW 2
116 #define PS_NONE 0
117 #define PS_HW 1
119 #define VBO_NONE 0
120 #define VBO_HW 1
122 typedef struct wined3d_settings_s {
123 /* vertex and pixel shader modes */
124 int vs_mode;
125 int ps_mode;
126 int vbo_mode;
127 } wined3d_settings_t;
129 extern wined3d_settings_t wined3d_settings;
131 /* X11 locking */
133 extern void (*wine_tsx11_lock_ptr)(void);
134 extern void (*wine_tsx11_unlock_ptr)(void);
136 /* As GLX relies on X, this is needed */
137 extern int num_lock;
139 #if 0
140 #define ENTER_GL() ++num_lock; if (num_lock > 1) FIXME("Recursive use of GL lock to: %d\n", num_lock); wine_tsx11_lock_ptr()
141 #define LEAVE_GL() if (num_lock != 1) FIXME("Recursive use of GL lock: %d\n", num_lock); --num_lock; wine_tsx11_unlock_ptr()
142 #else
143 #define ENTER_GL() wine_tsx11_lock_ptr()
144 #define LEAVE_GL() wine_tsx11_unlock_ptr()
145 #endif
147 /*****************************************************************************
148 * Defines
151 /* GL related defines */
152 /* ------------------ */
153 #define GL_SUPPORT(ExtName) (GLINFO_LOCATION.supported[ExtName] != 0)
154 #define GL_LIMITS(ExtName) (GLINFO_LOCATION.max_##ExtName)
155 #define GL_EXTCALL(FuncName) (GLINFO_LOCATION.FuncName)
156 #define GL_VEND(_VendName) (GLINFO_LOCATION.gl_vendor == VENDOR_##_VendName ? TRUE : FALSE)
158 #define D3DCOLOR_R(dw) (((float) (((dw) >> 16) & 0xFF)) / 255.0f)
159 #define D3DCOLOR_G(dw) (((float) (((dw) >> 8) & 0xFF)) / 255.0f)
160 #define D3DCOLOR_B(dw) (((float) (((dw) >> 0) & 0xFF)) / 255.0f)
161 #define D3DCOLOR_A(dw) (((float) (((dw) >> 24) & 0xFF)) / 255.0f)
163 #define D3DCOLORTOGLFLOAT4(dw, vec) \
164 (vec)[0] = D3DCOLOR_R(dw); \
165 (vec)[1] = D3DCOLOR_G(dw); \
166 (vec)[2] = D3DCOLOR_B(dw); \
167 (vec)[3] = D3DCOLOR_A(dw);
169 /* Note: The following is purely to keep the source code as clear from #ifdefs as possible */
170 #if defined(GL_VERSION_1_3)
171 #define GLACTIVETEXTURE(textureNo) \
172 glActiveTexture(GL_TEXTURE0 + textureNo); \
173 checkGLcall("glActiveTexture");
174 #define GLCLIENTACTIVETEXTURE(textureNo) \
175 glClientActiveTexture(GL_TEXTURE0 + textureNo);
176 #define GLMULTITEXCOORD1F(a,b) \
177 glMultiTexCoord1f(GL_TEXTURE0 + a, b);
178 #define GLMULTITEXCOORD2F(a,b,c) \
179 glMultiTexCoord2f(GL_TEXTURE0 + a, b, c);
180 #define GLMULTITEXCOORD3F(a,b,c,d) \
181 glMultiTexCoord3f(GL_TEXTURE0 + a, b, c, d);
182 #define GLMULTITEXCOORD4F(a,b,c,d,e) \
183 glMultiTexCoord4f(GL_TEXTURE0 + a, b, c, d, e);
184 #define GLTEXTURECUBEMAP GL_TEXTURE_CUBE_MAP
185 #else
186 #define GLACTIVETEXTURE(textureNo) \
187 glActiveTextureARB(GL_TEXTURE0_ARB + textureNo); \
188 checkGLcall("glActiveTextureARB");
189 #define GLCLIENTACTIVETEXTURE(textureNo) \
190 glClientActiveTextureARB(GL_TEXTURE0_ARB + textureNo);
191 #define GLMULTITEXCOORD1F(a,b) \
192 glMultiTexCoord1fARB(GL_TEXTURE0_ARB + a, b);
193 #define GLMULTITEXCOORD2F(a,b,c) \
194 glMultiTexCoord2fARB(GL_TEXTURE0_ARB + a, b, c);
195 #define GLMULTITEXCOORD3F(a,b,c,d) \
196 glMultiTexCoord3fARB(GL_TEXTURE0_ARB + a, b, c, d);
197 #define GLMULTITEXCOORD4F(a,b,c,d,e) \
198 glMultiTexCoord4fARB(GL_TEXTURE0_ARB + a, b, c, d, e);
199 #define GLTEXTURECUBEMAP GL_TEXTURE_CUBE_MAP_ARB
200 #endif
202 /* DirectX Device Limits */
203 /* --------------------- */
204 #define MAX_LEVELS 256 /* Maximum number of mipmap levels. Guessed at 256 */
206 #define MAX_STREAMS 16 /* Maximum possible streams - used for fixed size arrays
207 See MaxStreams in MSDN under GetDeviceCaps */
208 /* Maximum number of constants provided to the shaders */
209 #define HIGHEST_TRANSFORMSTATE 512
210 /* Highest value in D3DTRANSFORMSTATETYPE */
211 #define MAX_CLIPPLANES D3DMAXUSERCLIPPLANES
213 #define MAX_PALETTES 256
215 /* Checking of API calls */
216 /* --------------------- */
217 #define checkGLcall(A) \
219 GLint err = glGetError(); \
220 if (err != GL_NO_ERROR) { \
221 FIXME(">>>>>>>>>>>>>>>>> %x from %s @ %s / %d\n", err, A, __FILE__, __LINE__); \
222 } else { \
223 TRACE("%s call ok %s / %d\n", A, __FILE__, __LINE__); \
227 /* Trace routines / diagnostics */
228 /* ---------------------------- */
230 /* Dump out a matrix and copy it */
231 #define conv_mat(mat,gl_mat) \
232 do { \
233 TRACE("%f %f %f %f\n", (mat)->u.s._11, (mat)->u.s._12, (mat)->u.s._13, (mat)->u.s._14); \
234 TRACE("%f %f %f %f\n", (mat)->u.s._21, (mat)->u.s._22, (mat)->u.s._23, (mat)->u.s._24); \
235 TRACE("%f %f %f %f\n", (mat)->u.s._31, (mat)->u.s._32, (mat)->u.s._33, (mat)->u.s._34); \
236 TRACE("%f %f %f %f\n", (mat)->u.s._41, (mat)->u.s._42, (mat)->u.s._43, (mat)->u.s._44); \
237 memcpy(gl_mat, (mat), 16 * sizeof(float)); \
238 } while (0)
240 /* Macro to dump out the current state of the light chain */
241 #define DUMP_LIGHT_CHAIN() \
243 PLIGHTINFOEL *el = This->stateBlock->lights;\
244 while (el) { \
245 TRACE("Light %p (glIndex %ld, d3dIndex %ld, enabled %d)\n", el, el->glIndex, el->OriginalIndex, el->lightEnabled);\
246 el = el->next; \
250 /* Trace vector and strided data information */
251 #define TRACE_VECTOR(name) TRACE( #name "=(%f, %f, %f, %f)\n", name.x, name.y, name.z, name.w);
252 #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);
254 /* Defines used for optimizations */
256 /* Only reapply what is necessary */
257 #define REAPPLY_ALPHAOP 0x0001
258 #define REAPPLY_ALL 0xFFFF
260 /* Advance declaration of structures to satisfy compiler */
261 typedef struct IWineD3DStateBlockImpl IWineD3DStateBlockImpl;
262 typedef struct IWineD3DSurfaceImpl IWineD3DSurfaceImpl;
264 /* Tracking */
266 /* TODO: Move some of this to the device */
267 long globalChangeGlRam(long glram);
269 /* Memory and object tracking */
271 /*Structure for holding information on all direct3d objects
272 useful for making sure tracking is ok and when release is called on a device!
273 and probably quite handy for debugging and dumping states out
275 typedef struct WineD3DGlobalStatistics {
276 int glsurfaceram; /* The aproximate amount of glTexture memory allocated for textures */
277 } WineD3DGlobalStatistics;
279 extern WineD3DGlobalStatistics* wineD3DGlobalStatistics;
281 /* Global variables */
282 extern const float identity[16];
284 /*****************************************************************************
285 * Compilable extra diagnostics
288 /* Trace information per-vertex: (extremely high amount of trace) */
289 #if 0 /* NOTE: Must be 0 in cvs */
290 # define VTRACE(A) TRACE A
291 #else
292 # define VTRACE(A)
293 #endif
295 /* Checking of per-vertex related GL calls */
296 #define vcheckGLcall(A) \
298 GLint err = glGetError(); \
299 if (err != GL_NO_ERROR) { \
300 FIXME(">>>>>>>>>>>>>>>>> %x from %s @ %s / %d\n", err, A, __FILE__, __LINE__); \
301 } else { \
302 VTRACE(("%s call ok %s / %d\n", A, __FILE__, __LINE__)); \
306 /* TODO: Confirm each of these works when wined3d move completed */
307 #if 0 /* NOTE: Must be 0 in cvs */
308 /* To avoid having to get gigabytes of trace, the following can be compiled in, and at the start
309 of each frame, a check is made for the existence of C:\D3DTRACE, and if if exists d3d trace
310 is enabled, and if it doesn't exists it is disabled. */
311 # define FRAME_DEBUGGING
312 /* Adding in the SINGLE_FRAME_DEBUGGING gives a trace of just what makes up a single frame, before
313 the file is deleted */
314 # if 1 /* NOTE: Must be 1 in cvs, as this is mostly more useful than a trace from program start */
315 # define SINGLE_FRAME_DEBUGGING
316 # endif
317 /* The following, when enabled, lets you see the makeup of the frame, by drawprimitive calls.
318 It can only be enabled when FRAME_DEBUGGING is also enabled
319 The contents of the back buffer are written into /tmp/backbuffer_* after each primitive
320 array is drawn. */
321 # if 0 /* NOTE: Must be 0 in cvs, as this give a lot of ppm files when compiled in */
322 # define SHOW_FRAME_MAKEUP 1
323 # endif
324 /* The following, when enabled, lets you see the makeup of the all the textures used during each
325 of the drawprimitive calls. It can only be enabled when SHOW_FRAME_MAKEUP is also enabled.
326 The contents of the textures assigned to each stage are written into
327 /tmp/texture_*_<Stage>.ppm after each primitive array is drawn. */
328 # if 0 /* NOTE: Must be 0 in cvs, as this give a lot of ppm files when compiled in */
329 # define SHOW_TEXTURE_MAKEUP 0
330 # endif
331 extern BOOL isOn;
332 extern BOOL isDumpingFrames;
333 extern LONG primCounter;
334 #endif
336 /*****************************************************************************
337 * Prototypes
340 /* Routine common to the draw primitive and draw indexed primitive routines */
341 void drawPrimitive(IWineD3DDevice *iface,
342 int PrimitiveType,
343 long NumPrimitives,
344 /* for Indexed: */
345 long StartVertexIndex,
346 UINT numberOfVertices,
347 long StartIdx,
348 short idxBytes,
349 const void *idxData,
350 int minIndex);
352 /*****************************************************************************
353 * Structures required to draw primitives
356 typedef struct Direct3DStridedData {
357 BYTE *lpData; /* Pointer to start of data */
358 DWORD dwStride; /* Stride between occurances of this data */
359 DWORD dwType; /* Type (as in D3DVSDT_TYPE) */
360 } Direct3DStridedData;
362 typedef struct Direct3DVertexStridedData {
363 union {
364 struct {
365 Direct3DStridedData position;
366 Direct3DStridedData blendWeights;
367 Direct3DStridedData blendMatrixIndices;
368 Direct3DStridedData normal;
369 Direct3DStridedData pSize;
370 Direct3DStridedData diffuse;
371 Direct3DStridedData specular;
372 Direct3DStridedData texCoords[MAX_TEXTURES];
373 Direct3DStridedData position2; /* tween data */
374 Direct3DStridedData normal2; /* tween data */
375 Direct3DStridedData tangent;
376 Direct3DStridedData binormal;
377 Direct3DStridedData tessFactor;
378 Direct3DStridedData fog;
379 Direct3DStridedData depth;
380 Direct3DStridedData sample;
381 } s;
382 Direct3DStridedData input[16]; /* Indexed by constants in D3DVSDE_REGISTER */
383 } u;
384 } Direct3DVertexStridedData;
386 /*****************************************************************************
387 * Internal representation of a light
389 typedef struct PLIGHTINFOEL PLIGHTINFOEL;
390 struct PLIGHTINFOEL {
391 WINED3DLIGHT OriginalParms; /* Note D3D8LIGHT == D3D9LIGHT */
392 DWORD OriginalIndex;
393 LONG glIndex;
394 BOOL lightEnabled;
395 BOOL changed;
396 BOOL enabledChanged;
398 /* Converted parms to speed up swapping lights */
399 float lightPosn[4];
400 float lightDirn[4];
401 float exponent;
402 float cutoff;
404 PLIGHTINFOEL *next;
405 PLIGHTINFOEL *prev;
408 /*****************************************************************************
409 * IWineD3D implementation structure
411 typedef struct IWineD3DImpl
413 /* IUnknown fields */
414 const IWineD3DVtbl *lpVtbl;
415 LONG ref; /* Note: Ref counting not required */
417 /* WineD3D Information */
418 IUnknown *parent;
419 UINT dxVersion;
421 /* GL Information */
422 BOOL isGLInfoValid;
423 WineD3D_GL_Info gl_info;
424 } IWineD3DImpl;
426 extern const IWineD3DVtbl IWineD3D_Vtbl;
428 typedef struct SwapChainList {
429 IWineD3DSwapChain *swapchain;
430 struct SwapChainList *next;
431 } SwapChainList;
433 /** Hacked out start of a context manager!! **/
434 typedef struct glContext {
435 int Width;
436 int Height;
437 int usedcount;
438 GLXContext context;
440 Drawable drawable;
441 IWineD3DSurface *pSurface;
442 #if 0 /* TODO: someway to represent the state of the context */
443 IWineD3DStateBlock *pStateBlock;
444 #endif
445 /* a few other things like format */
446 } glContext;
448 /* TODO: setup some flags in the regestry to enable, disable pbuffer support
449 (since it will break quite a few things until contexts are managed properly!) */
450 extern BOOL pbuffer_support;
451 /* allocate one pbuffer per surface */
452 extern BOOL pbuffer_per_surface;
454 /* Maximum number of contexts/pbuffers to keep in cache,
455 set to 100 because ATI's drivers don't support deleting pBuffers properly
456 this needs to be migrated to a list and some option availalbe for controle the cache size.
458 #define CONTEXT_CACHE 100
460 typedef struct ResourceList {
461 IWineD3DResource *resource;
462 struct ResourceList *next;
463 } ResourceList;
465 /*****************************************************************************
466 * IWineD3DDevice implementation structure
468 typedef struct IWineD3DDeviceImpl
470 /* IUnknown fields */
471 const IWineD3DDeviceVtbl *lpVtbl;
472 LONG ref; /* Note: Ref counting not required */
474 /* WineD3D Information */
475 IUnknown *parent;
476 IWineD3D *wineD3D;
478 /* X and GL Information */
479 GLint maxConcurrentLights;
481 /* Optimization */
482 BOOL modelview_valid;
483 BOOL proj_valid;
484 BOOL view_ident; /* true iff view matrix is identity */
485 BOOL last_was_rhw; /* true iff last draw_primitive was in xyzrhw mode */
486 GLenum tracking_parm; /* Which source is tracking current colour */
487 LONG tracking_color; /* used iff GL_COLOR_MATERIAL was enabled */
488 #define DISABLED_TRACKING 0 /* Disabled */
489 #define IS_TRACKING 1 /* tracking_parm is tracking diffuse color */
490 #define NEEDS_TRACKING 2 /* Tracking needs to be enabled when needed */
491 #define NEEDS_DISABLE 3 /* Tracking needs to be disabled when needed*/
492 UINT srcBlend;
493 UINT dstBlend;
494 UINT alphafunc;
495 UINT stencilfunc;
496 BOOL texture_shader_active; /* TODO: Confirm use is correct */
498 /* State block related */
499 BOOL isRecordingState;
500 IWineD3DStateBlockImpl *stateBlock;
501 IWineD3DStateBlockImpl *updateStateBlock;
503 /* Internal use fields */
504 D3DDEVICE_CREATION_PARAMETERS createParms;
505 UINT adapterNo;
506 D3DDEVTYPE devType;
508 SwapChainList *swapchains;
510 ResourceList *resources; /* a linked list to track resources created by the device */
512 /* Render Target Support */
513 IWineD3DSurface *depthStencilBuffer;
515 IWineD3DSurface *renderTarget;
516 IWineD3DSurface *stencilBufferTarget;
518 /* palettes texture management */
519 PALETTEENTRY palettes[MAX_PALETTES][256];
520 UINT currentPalette;
522 /* For rendering to a texture using glCopyTexImage */
523 BOOL renderUpsideDown;
525 /* Cursor management */
526 BOOL bCursorVisible;
527 UINT xHotSpot;
528 UINT yHotSpot;
529 UINT xScreenSpace;
530 UINT yScreenSpace;
532 /* Textures for when no other textures are mapped */
533 UINT dummyTextureName[MAX_TEXTURES];
535 /* Debug stream management */
536 BOOL debug;
538 /* Screen buffer resources */
539 glContext contextCache[CONTEXT_CACHE];
541 /* A flag to check if endscene has been called before changing the render tartet */
542 BOOL sceneEnded;
543 } IWineD3DDeviceImpl;
545 extern const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl;
547 /* Support for IWineD3DResource ::Set/Get/FreePrivateData. I don't think
548 * anybody uses it for much so a good implementation is optional. */
549 typedef struct PrivateData
551 struct PrivateData* next;
553 GUID tag;
554 DWORD flags; /* DDSPD_* */
555 DWORD uniqueness_value;
557 union
559 LPVOID data;
560 LPUNKNOWN object;
561 } ptr;
563 DWORD size;
564 } PrivateData;
566 /*****************************************************************************
567 * IWineD3DResource implementation structure
569 typedef struct IWineD3DResourceClass
571 /* IUnknown fields */
572 LONG ref; /* Note: Ref counting not required */
574 /* WineD3DResource Information */
575 IUnknown *parent;
576 D3DRESOURCETYPE resourceType;
577 IWineD3DDeviceImpl *wineD3DDevice;
578 D3DPOOL pool;
579 UINT size;
580 DWORD usage;
581 WINED3DFORMAT format;
582 BYTE *allocatedMemory;
583 PrivateData *privateData;
585 } IWineD3DResourceClass;
587 typedef struct IWineD3DResourceImpl
589 /* IUnknown & WineD3DResource Information */
590 const IWineD3DResourceVtbl *lpVtbl;
591 IWineD3DResourceClass resource;
592 } IWineD3DResourceImpl;
595 /*****************************************************************************
596 * IWineD3DVertexBuffer implementation structure (extends IWineD3DResourceImpl)
598 typedef struct IWineD3DVertexBufferImpl
600 /* IUnknown & WineD3DResource Information */
601 const IWineD3DVertexBufferVtbl *lpVtbl;
602 IWineD3DResourceClass resource;
604 /* WineD3DVertexBuffer specifics */
605 DWORD fvf;
607 } IWineD3DVertexBufferImpl;
609 extern const IWineD3DVertexBufferVtbl IWineD3DVertexBuffer_Vtbl;
612 /*****************************************************************************
613 * IWineD3DIndexBuffer implementation structure (extends IWineD3DResourceImpl)
615 typedef struct IWineD3DIndexBufferImpl
617 /* IUnknown & WineD3DResource Information */
618 const IWineD3DIndexBufferVtbl *lpVtbl;
619 IWineD3DResourceClass resource;
621 /* WineD3DVertexBuffer specifics */
622 } IWineD3DIndexBufferImpl;
624 extern const IWineD3DIndexBufferVtbl IWineD3DIndexBuffer_Vtbl;
626 /*****************************************************************************
627 * IWineD3DBaseTexture D3D- > openGL state map lookups
629 #define WINED3DFUNC_NOTSUPPORTED -2
630 #define WINED3DFUNC_UNIMPLEMENTED -1
632 typedef enum winetexturestates {
633 WINED3DTEXSTA_ADDRESSU = 0,
634 WINED3DTEXSTA_ADDRESSV = 1,
635 WINED3DTEXSTA_ADDRESSW = 2,
636 WINED3DTEXSTA_BORDERCOLOR = 3,
637 WINED3DTEXSTA_MAGFILTER = 4,
638 WINED3DTEXSTA_MINFILTER = 5,
639 WINED3DTEXSTA_MIPFILTER = 6,
640 WINED3DTEXSTA_MAXMIPLEVEL = 7,
641 WINED3DTEXSTA_MAXANISOTROPY = 8,
642 WINED3DTEXSTA_SRGBTEXTURE = 9,
643 WINED3DTEXSTA_ELEMENTINDEX = 10,
644 WINED3DTEXSTA_DMAPOFFSET = 11,
645 WINED3DTEXSTA_TSSADDRESSW = 12,
646 MAX_WINETEXTURESTATES = 13,
647 } winetexturestates;
649 typedef struct Wined3dTextureStateMap {
650 CONST int state;
651 int function;
652 } Wined3dTextureStateMap;
654 /*****************************************************************************
655 * IWineD3DBaseTexture implementation structure (extends IWineD3DResourceImpl)
657 typedef struct IWineD3DBaseTextureClass
659 UINT levels;
660 BOOL dirty;
661 D3DFORMAT format;
662 DWORD usage;
663 UINT textureName;
664 UINT LOD;
665 D3DTEXTUREFILTERTYPE filterType;
666 DWORD states[MAX_WINETEXTURESTATES];
668 } IWineD3DBaseTextureClass;
670 typedef struct IWineD3DBaseTextureImpl
672 /* IUnknown & WineD3DResource Information */
673 const IWineD3DBaseTextureVtbl *lpVtbl;
674 IWineD3DResourceClass resource;
675 IWineD3DBaseTextureClass baseTexture;
677 } IWineD3DBaseTextureImpl;
679 /*****************************************************************************
680 * IWineD3DTexture implementation structure (extends IWineD3DBaseTextureImpl)
682 typedef struct IWineD3DTextureImpl
684 /* IUnknown & WineD3DResource/WineD3DBaseTexture Information */
685 const IWineD3DTextureVtbl *lpVtbl;
686 IWineD3DResourceClass resource;
687 IWineD3DBaseTextureClass baseTexture;
689 /* IWineD3DTexture */
690 IWineD3DSurface *surfaces[MAX_LEVELS];
692 UINT width;
693 UINT height;
694 float pow2scalingFactorX;
695 float pow2scalingFactorY;
697 } IWineD3DTextureImpl;
699 extern const IWineD3DTextureVtbl IWineD3DTexture_Vtbl;
701 /*****************************************************************************
702 * IWineD3DCubeTexture implementation structure (extends IWineD3DBaseTextureImpl)
704 typedef struct IWineD3DCubeTextureImpl
706 /* IUnknown & WineD3DResource/WineD3DBaseTexture Information */
707 const IWineD3DCubeTextureVtbl *lpVtbl;
708 IWineD3DResourceClass resource;
709 IWineD3DBaseTextureClass baseTexture;
711 /* IWineD3DCubeTexture */
712 IWineD3DSurface *surfaces[6][MAX_LEVELS];
714 UINT edgeLength;
715 float pow2scalingFactor;
717 } IWineD3DCubeTextureImpl;
719 extern const IWineD3DCubeTextureVtbl IWineD3DCubeTexture_Vtbl;
721 /*****************************************************************************
722 * IWineD3DVolume implementation structure (extends IUnknown)
724 typedef struct IWineD3DVolumeImpl
726 /* IUnknown & WineD3DResource fields */
727 const IWineD3DVolumeVtbl *lpVtbl;
728 IWineD3DResourceClass resource;
730 /* WineD3DVolume Information */
731 D3DVOLUME_DESC currentDesc;
732 IUnknown *container;
733 UINT bytesPerPixel;
735 BOOL lockable;
736 BOOL locked;
737 D3DBOX lockedBox;
738 D3DBOX dirtyBox;
739 BOOL dirty;
742 } IWineD3DVolumeImpl;
744 extern const IWineD3DVolumeVtbl IWineD3DVolume_Vtbl;
746 /*****************************************************************************
747 * IWineD3DVolumeTexture implementation structure (extends IWineD3DBaseTextureImpl)
749 typedef struct IWineD3DVolumeTextureImpl
751 /* IUnknown & WineD3DResource/WineD3DBaseTexture Information */
752 const IWineD3DVolumeTextureVtbl *lpVtbl;
753 IWineD3DResourceClass resource;
754 IWineD3DBaseTextureClass baseTexture;
756 /* IWineD3DVolumeTexture */
757 IWineD3DVolume *volumes[MAX_LEVELS];
759 UINT width;
760 UINT height;
761 UINT depth;
762 } IWineD3DVolumeTextureImpl;
764 extern const IWineD3DVolumeTextureVtbl IWineD3DVolumeTexture_Vtbl;
766 typedef struct _WINED3DSURFACET_DESC
768 D3DMULTISAMPLE_TYPE MultiSampleType;
769 DWORD MultiSampleQuality;
770 UINT Width;
771 UINT Height;
772 } WINED3DSURFACET_DESC;
774 /*****************************************************************************
775 * IWineD3DSurface implementation structure
777 struct IWineD3DSurfaceImpl
779 /* IUnknown & IWineD3DResource Information */
780 const IWineD3DSurfaceVtbl *lpVtbl;
781 IWineD3DResourceClass resource;
783 /* IWineD3DSurface fields */
784 IUnknown *container;
785 WINED3DSURFACET_DESC currentDesc;
787 UINT textureName;
788 UINT bytesPerPixel;
790 /* TODO: move this off into a management class(maybe!) */
791 BOOL nonpow2;
793 UINT pow2Width;
794 UINT pow2Height;
795 UINT pow2Size;
797 #if 0
798 /* precalculated x and y scalings for texture coords */
799 float pow2scalingFactorX; /* = (Width / pow2Width ) */
800 float pow2scalingFactorY; /* = (Height / pow2Height) */
801 #endif
803 BOOL lockable;
804 BOOL discard;
805 BOOL locked;
806 BOOL activeLock;
808 RECT lockedRect;
809 RECT dirtyRect;
810 BOOL Dirty;
812 BOOL inTexture;
813 BOOL inPBuffer;
815 glDescriptor glDescription;
818 extern const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl;
820 /*****************************************************************************
821 * IWineD3DVertexDeclaration implementation structure
823 typedef struct IWineD3DVertexDeclarationImpl {
824 /* IUnknown Information */
825 const IWineD3DVertexDeclarationVtbl *lpVtbl;
826 LONG ref; /* Note: Ref counting not required */
828 IUnknown *parent;
829 /** precomputed fvf if simple declaration */
830 IWineD3DDeviceImpl *wineD3DDevice;
831 DWORD fvf[MAX_STREAMS];
832 DWORD allFVF;
834 /** dx8 compatible Declaration fields */
835 DWORD* pDeclaration8;
836 DWORD declaration8Length;
838 /** dx9+ */
839 D3DVERTEXELEMENT9* pDeclaration9;
840 UINT declaration9NumElements;
841 } IWineD3DVertexDeclarationImpl;
843 extern const IWineD3DVertexDeclarationVtbl IWineD3DVertexDeclaration_Vtbl;
845 /*****************************************************************************
846 * IWineD3DStateBlock implementation structure
849 /* Internal state Block for Begin/End/Capture/Create/Apply info */
850 /* Note: Very long winded but gl Lists are not flexible enough */
851 /* to resolve everything we need, so doing it manually for now */
852 typedef struct SAVEDSTATES {
853 BOOL indices;
854 BOOL material;
855 BOOL fvf;
856 BOOL streamSource[MAX_STREAMS];
857 BOOL streamFreq[MAX_STREAMS];
858 BOOL textures[MAX_TEXTURES];
859 BOOL transform[HIGHEST_TRANSFORMSTATE + 1];
860 BOOL viewport;
861 BOOL renderState[WINEHIGHEST_RENDER_STATE + 1];
862 BOOL textureState[MAX_TEXTURES][WINED3D_HIGHEST_TEXTURE_STATE + 1];
863 BOOL samplerState[MAX_SAMPLERS][WINED3D_HIGHEST_SAMPLER_STATE + 1];
864 BOOL clipplane[MAX_CLIPPLANES];
865 BOOL vertexDecl;
866 BOOL pixelShader;
867 BOOL vertexShader;
868 } SAVEDSTATES;
870 struct IWineD3DStateBlockImpl
872 /* IUnknown fields */
873 const IWineD3DStateBlockVtbl *lpVtbl;
874 LONG ref; /* Note: Ref counting not required */
876 /* IWineD3DStateBlock information */
877 IUnknown *parent;
878 IWineD3DDeviceImpl *wineD3DDevice;
879 WINED3DSTATEBLOCKTYPE blockType;
881 /* Array indicating whether things have been set or changed */
882 SAVEDSTATES changed;
883 SAVEDSTATES set;
885 /* Drawing - Vertex Shader or FVF related */
886 DWORD fvf;
887 /* Vertex Shader Declaration */
888 IWineD3DVertexDeclaration *vertexDecl;
890 IWineD3DVertexShader *vertexShader; /* @TODO: Replace void * with IWineD3DVertexShader * */
892 /* Vertex Shader Constants */
893 BOOL vertexShaderConstantB[MAX_VSHADER_CONSTANTS];
894 UINT vertexShaderConstantI[MAX_VSHADER_CONSTANTS * 4];
895 float vertexShaderConstantF[MAX_VSHADER_CONSTANTS * 4];
897 BOOL softwareVertexProcessing;
899 /* Stream Source */
900 BOOL streamIsUP;
901 UINT streamStride[MAX_STREAMS];
902 UINT streamOffset[MAX_STREAMS];
903 IWineD3DVertexBuffer *streamSource[MAX_STREAMS];
904 UINT streamFreq[MAX_STREAMS];
905 UINT streamFlags[MAX_STREAMS]; /*0 | D3DSTREAMSOURCE_INSTANCEDATA | D3DSTREAMSOURCE_INDEXEDDATA */
907 /* Indices */
908 IWineD3DIndexBuffer* pIndexData;
909 UINT baseVertexIndex; /* Note: only used for d3d8 */
911 /* Transform */
912 D3DMATRIX transforms[HIGHEST_TRANSFORMSTATE + 1];
914 /* Lights */
915 PLIGHTINFOEL *lights; /* NOTE: active GL lights must be front of the chain */
917 /* Clipping */
918 double clipplane[MAX_CLIPPLANES][4];
919 WINED3DCLIPSTATUS clip_status;
921 /* ViewPort */
922 WINED3DVIEWPORT viewport;
924 /* Material */
925 WINED3DMATERIAL material;
927 /* Pixel Shader */
928 void *pixelShader; /* TODO: Replace void * with IWineD3DPixelShader * */
930 /* Indexed Vertex Blending */
931 D3DVERTEXBLENDFLAGS vertex_blend;
932 FLOAT tween_factor;
934 /* RenderState */
935 DWORD renderState[WINEHIGHEST_RENDER_STATE + 1];
937 /* Texture */
938 IWineD3DBaseTexture *textures[MAX_TEXTURES];
939 int textureDimensions[MAX_SAMPLERS];
941 /* Texture State Stage */
942 DWORD textureState[MAX_TEXTURES][WINED3D_HIGHEST_TEXTURE_STATE + 1];
943 /* Sampler States */
944 DWORD samplerState[MAX_SAMPLERS][WINED3D_HIGHEST_SAMPLER_STATE + 1];
948 extern const IWineD3DStateBlockVtbl IWineD3DStateBlock_Vtbl;
950 /*****************************************************************************
951 * IWineD3DQueryImpl implementation structure (extends IUnknown)
953 typedef struct IWineD3DQueryImpl
955 const IWineD3DQueryVtbl *lpVtbl;
956 LONG ref; /* Note: Ref counting not required */
958 IUnknown *parent;
959 /*TODO: replace with iface usage */
960 #if 0
961 IWineD3DDevice *wineD3DDevice;
962 #else
963 IWineD3DDeviceImpl *wineD3DDevice;
964 #endif
965 /* IWineD3DQuery fields */
967 D3DQUERYTYPE type;
968 void *extendedData;
971 } IWineD3DQueryImpl;
973 extern const IWineD3DQueryVtbl IWineD3DQuery_Vtbl;
975 /*****************************************************************************
976 * IWineD3DSwapChainImpl implementation structure (extends IUnknown)
979 typedef struct IWineD3DSwapChainImpl
981 /*IUnknown part*/
982 IWineD3DSwapChainVtbl *lpVtbl;
983 LONG ref; /* Note: Ref counting not required */
985 IUnknown *parent;
986 IWineD3DDeviceImpl *wineD3DDevice;
988 /* IWineD3DSwapChain fields */
989 IWineD3DSurface *backBuffer;
990 IWineD3DSurface *frontBuffer;
991 BOOL wantsDepthStencilBuffer;
992 D3DPRESENT_PARAMETERS presentParms;
994 /* TODO: move everything upto drawable off into a context manager
995 and store the 'data' in the contextManagerData interface.
996 IUnknown *contextManagerData;
999 HWND win_handle;
1000 Window win;
1001 Display *display;
1003 GLXContext glCtx;
1004 XVisualInfo *visInfo;
1005 GLXContext render_ctx;
1006 /* This has been left in device for now, but needs moving off into a rendertarget management class and separated out from swapchains and devices. */
1007 Drawable drawable;
1008 } IWineD3DSwapChainImpl;
1010 extern IWineD3DSwapChainVtbl IWineD3DSwapChain_Vtbl;
1012 /*****************************************************************************
1013 * Utility function prototypes
1016 /* Trace routines */
1017 const char* debug_d3dformat(WINED3DFORMAT fmt);
1018 const char* debug_d3ddevicetype(D3DDEVTYPE devtype);
1019 const char* debug_d3dresourcetype(D3DRESOURCETYPE res);
1020 const char* debug_d3dusage(DWORD usage);
1021 const char* debug_d3dprimitivetype(D3DPRIMITIVETYPE PrimitiveType);
1022 const char* debug_d3drenderstate(DWORD state);
1023 const char* debug_d3dtexturestate(DWORD state);
1024 const char* debug_d3dpool(D3DPOOL pool);
1026 /* Routines for GL <-> D3D values */
1027 GLenum StencilOp(DWORD op);
1028 void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, D3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3);
1029 void set_texture_matrix(const float *smat, DWORD flags, BOOL calculatedCoords);
1030 void GetSrcAndOpFromValue(DWORD iValue, BOOL isAlphaArg, GLenum* source, GLenum* operand);
1032 SHORT D3DFmtGetBpp(IWineD3DDeviceImpl* This, D3DFORMAT fmt);
1033 GLenum D3DFmt2GLFmt(IWineD3DDeviceImpl* This, D3DFORMAT fmt);
1034 GLenum D3DFmt2GLType(IWineD3DDeviceImpl *This, D3DFORMAT fmt);
1035 GLint D3DFmt2GLIntFmt(IWineD3DDeviceImpl* This, D3DFORMAT fmt);
1037 int D3DFmtMakeGlCfg(D3DFORMAT BackBufferFormat, D3DFORMAT StencilBufferFormat, int *attribs, int* nAttribs, BOOL alternate);
1040 /*****************************************************************************
1041 * To enable calling of inherited functions, requires prototypes
1043 * Note: Only require classes which are subclassed, ie resource, basetexture,
1045 /*** IUnknown methods ***/
1046 extern HRESULT WINAPI IWineD3DResourceImpl_QueryInterface(IWineD3DResource *iface, REFIID riid, void** ppvObject);
1047 extern ULONG WINAPI IWineD3DResourceImpl_AddRef(IWineD3DResource *iface);
1048 extern ULONG WINAPI IWineD3DResourceImpl_Release(IWineD3DResource *iface);
1049 /*** IWineD3DResource methods ***/
1050 extern HRESULT WINAPI IWineD3DResourceImpl_GetParent(IWineD3DResource *iface, IUnknown **pParent);
1051 extern HRESULT WINAPI IWineD3DResourceImpl_GetDevice(IWineD3DResource *iface, IWineD3DDevice ** ppDevice);
1052 extern HRESULT WINAPI IWineD3DResourceImpl_SetPrivateData(IWineD3DResource *iface, REFGUID refguid, CONST void * pData, DWORD SizeOfData, DWORD Flags);
1053 extern HRESULT WINAPI IWineD3DResourceImpl_GetPrivateData(IWineD3DResource *iface, REFGUID refguid, void * pData, DWORD * pSizeOfData);
1054 extern HRESULT WINAPI IWineD3DResourceImpl_FreePrivateData(IWineD3DResource *iface, REFGUID refguid);
1055 extern DWORD WINAPI IWineD3DResourceImpl_SetPriority(IWineD3DResource *iface, DWORD PriorityNew);
1056 extern DWORD WINAPI IWineD3DResourceImpl_GetPriority(IWineD3DResource *iface);
1057 extern void WINAPI IWineD3DResourceImpl_PreLoad(IWineD3DResource *iface);
1058 extern D3DRESOURCETYPE WINAPI IWineD3DResourceImpl_GetType(IWineD3DResource *iface);
1059 /*** class static members ***/
1060 void IWineD3DResourceImpl_CleanUp(IWineD3DResource *iface);
1062 /*** IUnknown methods ***/
1063 extern HRESULT WINAPI IWineD3DBaseTextureImpl_QueryInterface(IWineD3DBaseTexture *iface, REFIID riid, void** ppvObject);
1064 extern ULONG WINAPI IWineD3DBaseTextureImpl_AddRef(IWineD3DBaseTexture *iface);
1065 extern ULONG WINAPI IWineD3DBaseTextureImpl_Release(IWineD3DBaseTexture *iface);
1066 /*** IWineD3DResource methods ***/
1067 extern HRESULT WINAPI IWineD3DBaseTextureImpl_GetParent(IWineD3DBaseTexture *iface, IUnknown **pParent);
1068 extern HRESULT WINAPI IWineD3DBaseTextureImpl_GetDevice(IWineD3DBaseTexture *iface, IWineD3DDevice ** ppDevice);
1069 extern HRESULT WINAPI IWineD3DBaseTextureImpl_SetPrivateData(IWineD3DBaseTexture *iface, REFGUID refguid, CONST void * pData, DWORD SizeOfData, DWORD Flags);
1070 extern HRESULT WINAPI IWineD3DBaseTextureImpl_GetPrivateData(IWineD3DBaseTexture *iface, REFGUID refguid, void * pData, DWORD * pSizeOfData);
1071 extern HRESULT WINAPI IWineD3DBaseTextureImpl_FreePrivateData(IWineD3DBaseTexture *iface, REFGUID refguid);
1072 extern DWORD WINAPI IWineD3DBaseTextureImpl_SetPriority(IWineD3DBaseTexture *iface, DWORD PriorityNew);
1073 extern DWORD WINAPI IWineD3DBaseTextureImpl_GetPriority(IWineD3DBaseTexture *iface);
1074 extern void WINAPI IWineD3DBaseTextureImpl_PreLoad(IWineD3DBaseTexture *iface);
1075 extern D3DRESOURCETYPE WINAPI IWineD3DBaseTextureImpl_GetType(IWineD3DBaseTexture *iface);
1076 /*** IWineD3DBaseTexture methods ***/
1077 extern DWORD WINAPI IWineD3DBaseTextureImpl_SetLOD(IWineD3DBaseTexture *iface, DWORD LODNew);
1078 extern DWORD WINAPI IWineD3DBaseTextureImpl_GetLOD(IWineD3DBaseTexture *iface);
1079 extern DWORD WINAPI IWineD3DBaseTextureImpl_GetLevelCount(IWineD3DBaseTexture *iface);
1080 extern HRESULT WINAPI IWineD3DBaseTextureImpl_SetAutoGenFilterType(IWineD3DBaseTexture *iface, D3DTEXTUREFILTERTYPE FilterType);
1081 extern D3DTEXTUREFILTERTYPE WINAPI IWineD3DBaseTextureImpl_GetAutoGenFilterType(IWineD3DBaseTexture *iface);
1082 extern void WINAPI IWineD3DBaseTextureImpl_GenerateMipSubLevels(IWineD3DBaseTexture *iface);
1083 extern BOOL WINAPI IWineD3DBaseTextureImpl_SetDirty(IWineD3DBaseTexture *iface, BOOL);
1084 extern BOOL WINAPI IWineD3DBaseTextureImpl_GetDirty(IWineD3DBaseTexture *iface);
1086 extern BYTE* WINAPI IWineD3DVertexBufferImpl_GetMemory(IWineD3DVertexBuffer* iface, DWORD iOffset);
1087 extern HRESULT WINAPI IWineD3DVertexBufferImpl_ReleaseMemory(IWineD3DVertexBuffer* iface);
1088 extern HRESULT WINAPI IWineD3DBaseTextureImpl_BindTexture(IWineD3DBaseTexture *iface);
1089 extern HRESULT WINAPI IWineD3DBaseTextureImpl_UnBindTexture(IWineD3DBaseTexture *iface);
1090 extern void WINAPI IWineD3DBaseTextureImpl_ApplyStateChanges(IWineD3DBaseTexture *iface, const DWORD textureStates[WINED3D_HIGHEST_TEXTURE_STATE + 1], const DWORD samplerStates[WINED3D_HIGHEST_SAMPLER_STATE + 1]);
1091 /*** class static members ***/
1092 void IWineD3DBaseTextureImpl_CleanUp(IWineD3DBaseTexture *iface);
1094 /* 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? */
1095 enum vsConstantsEnum {
1096 VS_CONSTANT_NOT_USED = 0,
1097 VS_CONSTANT_CONSTANT,
1098 VS_CONSTANT_INTEGER,
1099 VS_CONSTANT_BOOLEAN,
1100 VS_CONSTANT_FLOAT
1103 /*****************************************************************************
1104 * IDirect3DVertexShader implementation structure
1106 typedef struct IWineD3DVertexShaderImpl {
1107 /* IUnknown parts*/
1108 const IWineD3DVertexShaderVtbl *lpVtbl;
1109 LONG ref; /* Note: Ref counting not required */
1111 IUnknown *parent;
1112 IWineD3DDeviceImpl *wineD3DDevice;
1114 /* IWineD3DVertexShaderImpl */
1115 CONST DWORD *function;
1116 UINT functionLength;
1118 DWORD usage;
1119 DWORD version;
1121 /* vertex declaration array mapping */
1122 BOOL namedArrays; /* don't map use named functions */
1123 BOOL declaredArrays; /* mapping requires */
1124 INT arrayUsageMap[WINED3DSHADERDECLUSAGE_MAX_USAGE]; /* lookup table for the maps */
1125 INT highestConstant;
1126 CHAR constantsUsedBitmap[256];
1127 /* 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 */
1128 /* run time datas... */
1129 VSHADERDATA* data;
1130 GLint prgId;
1131 #if 0 /* needs reworking */
1132 /* run time datas */
1133 VSHADERINPUTDATA input;
1134 VSHADEROUTPUTDATA output;
1135 #endif
1136 } IWineD3DVertexShaderImpl;
1137 extern const IWineD3DVertexShaderVtbl IWineD3DVertexShader_Vtbl;
1139 /*****************************************************************************
1140 * IDirect3DPixelShader implementation structure
1142 typedef struct IWineD3DPixelShaderImpl {
1143 /* IUnknown parts*/
1144 const IWineD3DPixelShaderVtbl *lpVtbl;
1145 LONG ref; /* Note: Ref counting not required */
1147 IUnknown *parent;
1148 IWineD3DDeviceImpl *wineD3DDevice;
1151 /* IWineD3DPixelShaderImpl */
1152 CONST DWORD *function;
1153 UINT functionLength;
1155 #if 0 /* needs reworking */
1156 /* run time datas */
1157 PSHADERDATA* data;
1158 PSHADERINPUTDATA input;
1159 PSHADEROUTPUTDATA output;
1160 #endif
1161 } IWineD3DPixelShaderImpl;
1163 extern const IWineD3DPixelShaderVtbl IWineD3DPixelShader_Vtbl;
1164 #endif