view: Turkish translation.
[wine/testsucceed.git] / dlls / wined3d / wined3d_private.h
blob9ba687c2d67716a8a03ceb448e0c2ef5ca3a10a7
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 #define NP2_NONE 0
124 #define NP2_REPACK 1
126 typedef struct wined3d_settings_s {
127 /* vertex and pixel shader modes */
128 int vs_mode;
129 int ps_mode;
130 int vbo_mode;
131 /* nonpower 2 function */
132 int nonpower2_mode;
133 } wined3d_settings_t;
135 extern wined3d_settings_t wined3d_settings;
137 /* X11 locking */
139 extern void (*wine_tsx11_lock_ptr)(void);
140 extern void (*wine_tsx11_unlock_ptr)(void);
142 /* As GLX relies on X, this is needed */
143 extern int num_lock;
145 #if 0
146 #define ENTER_GL() ++num_lock; if (num_lock > 1) FIXME("Recursive use of GL lock to: %d\n", num_lock); wine_tsx11_lock_ptr()
147 #define LEAVE_GL() if (num_lock != 1) FIXME("Recursive use of GL lock: %d\n", num_lock); --num_lock; wine_tsx11_unlock_ptr()
148 #else
149 #define ENTER_GL() wine_tsx11_lock_ptr()
150 #define LEAVE_GL() wine_tsx11_unlock_ptr()
151 #endif
153 /*****************************************************************************
154 * Defines
157 /* GL related defines */
158 /* ------------------ */
159 #define GL_SUPPORT(ExtName) (GLINFO_LOCATION.supported[ExtName] != 0)
160 #define GL_LIMITS(ExtName) (GLINFO_LOCATION.max_##ExtName)
161 #define GL_EXTCALL(FuncName) (GLINFO_LOCATION.FuncName)
162 #define GL_VEND(_VendName) (GLINFO_LOCATION.gl_vendor == VENDOR_##_VendName ? TRUE : FALSE)
164 #define D3DCOLOR_B_R(dw) (((dw) >> 16) & 0xFF)
165 #define D3DCOLOR_B_G(dw) (((dw) >> 8) & 0xFF)
166 #define D3DCOLOR_B_B(dw) (((dw) >> 0) & 0xFF)
167 #define D3DCOLOR_B_A(dw) (((dw) >> 24) & 0xFF)
169 #define D3DCOLOR_R(dw) (((float) (((dw) >> 16) & 0xFF)) / 255.0f)
170 #define D3DCOLOR_G(dw) (((float) (((dw) >> 8) & 0xFF)) / 255.0f)
171 #define D3DCOLOR_B(dw) (((float) (((dw) >> 0) & 0xFF)) / 255.0f)
172 #define D3DCOLOR_A(dw) (((float) (((dw) >> 24) & 0xFF)) / 255.0f)
174 #define D3DCOLORTOGLFLOAT4(dw, vec) \
175 (vec)[0] = D3DCOLOR_R(dw); \
176 (vec)[1] = D3DCOLOR_G(dw); \
177 (vec)[2] = D3DCOLOR_B(dw); \
178 (vec)[3] = D3DCOLOR_A(dw);
180 /* Note: The following is purely to keep the source code as clear from #ifdefs as possible */
181 #if defined(GL_VERSION_1_3)
182 #define GLACTIVETEXTURE(textureNo) \
183 glActiveTexture(GL_TEXTURE0 + textureNo); \
184 checkGLcall("glActiveTexture");
185 #define GLCLIENTACTIVETEXTURE(textureNo) \
186 glClientActiveTexture(GL_TEXTURE0 + textureNo);
187 #define GLMULTITEXCOORD1F(a,b) \
188 glMultiTexCoord1f(GL_TEXTURE0 + a, b);
189 #define GLMULTITEXCOORD2F(a,b,c) \
190 glMultiTexCoord2f(GL_TEXTURE0 + a, b, c);
191 #define GLMULTITEXCOORD3F(a,b,c,d) \
192 glMultiTexCoord3f(GL_TEXTURE0 + a, b, c, d);
193 #define GLMULTITEXCOORD4F(a,b,c,d,e) \
194 glMultiTexCoord4f(GL_TEXTURE0 + a, b, c, d, e);
195 #define GLTEXTURECUBEMAP GL_TEXTURE_CUBE_MAP
196 #else
197 #define GLACTIVETEXTURE(textureNo) \
198 glActiveTextureARB(GL_TEXTURE0_ARB + textureNo); \
199 checkGLcall("glActiveTextureARB");
200 #define GLCLIENTACTIVETEXTURE(textureNo) \
201 glClientActiveTextureARB(GL_TEXTURE0_ARB + textureNo);
202 #define GLMULTITEXCOORD1F(a,b) \
203 glMultiTexCoord1fARB(GL_TEXTURE0_ARB + a, b);
204 #define GLMULTITEXCOORD2F(a,b,c) \
205 glMultiTexCoord2fARB(GL_TEXTURE0_ARB + a, b, c);
206 #define GLMULTITEXCOORD3F(a,b,c,d) \
207 glMultiTexCoord3fARB(GL_TEXTURE0_ARB + a, b, c, d);
208 #define GLMULTITEXCOORD4F(a,b,c,d,e) \
209 glMultiTexCoord4fARB(GL_TEXTURE0_ARB + a, b, c, d, e);
210 #define GLTEXTURECUBEMAP GL_TEXTURE_CUBE_MAP_ARB
211 #endif
213 /* DirectX Device Limits */
214 /* --------------------- */
215 #define MAX_LEVELS 256 /* Maximum number of mipmap levels. Guessed at 256 */
217 #define MAX_STREAMS 16 /* Maximum possible streams - used for fixed size arrays
218 See MaxStreams in MSDN under GetDeviceCaps */
219 /* Maximum number of constants provided to the shaders */
220 #define HIGHEST_TRANSFORMSTATE 512
221 /* Highest value in D3DTRANSFORMSTATETYPE */
222 #define MAX_CLIPPLANES D3DMAXUSERCLIPPLANES
224 #define MAX_PALETTES 256
226 /* Checking of API calls */
227 /* --------------------- */
228 #define checkGLcall(A) \
230 GLint err = glGetError(); \
231 if (err != GL_NO_ERROR) { \
232 FIXME(">>>>>>>>>>>>>>>>> %x from %s @ %s / %d\n", err, A, __FILE__, __LINE__); \
233 } else { \
234 TRACE("%s call ok %s / %d\n", A, __FILE__, __LINE__); \
238 /* Trace routines / diagnostics */
239 /* ---------------------------- */
241 /* Dump out a matrix and copy it */
242 #define conv_mat(mat,gl_mat) \
243 do { \
244 TRACE("%f %f %f %f\n", (mat)->u.s._11, (mat)->u.s._12, (mat)->u.s._13, (mat)->u.s._14); \
245 TRACE("%f %f %f %f\n", (mat)->u.s._21, (mat)->u.s._22, (mat)->u.s._23, (mat)->u.s._24); \
246 TRACE("%f %f %f %f\n", (mat)->u.s._31, (mat)->u.s._32, (mat)->u.s._33, (mat)->u.s._34); \
247 TRACE("%f %f %f %f\n", (mat)->u.s._41, (mat)->u.s._42, (mat)->u.s._43, (mat)->u.s._44); \
248 memcpy(gl_mat, (mat), 16 * sizeof(float)); \
249 } while (0)
251 /* Macro to dump out the current state of the light chain */
252 #define DUMP_LIGHT_CHAIN() \
254 PLIGHTINFOEL *el = This->stateBlock->lights;\
255 while (el) { \
256 TRACE("Light %p (glIndex %ld, d3dIndex %ld, enabled %d)\n", el, el->glIndex, el->OriginalIndex, el->lightEnabled);\
257 el = el->next; \
261 /* Trace vector and strided data information */
262 #define TRACE_VECTOR(name) TRACE( #name "=(%f, %f, %f, %f)\n", name.x, name.y, name.z, name.w);
263 #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);
265 /* Defines used for optimizations */
267 /* Only reapply what is necessary */
268 #define REAPPLY_ALPHAOP 0x0001
269 #define REAPPLY_ALL 0xFFFF
271 /* Advance declaration of structures to satisfy compiler */
272 typedef struct IWineD3DStateBlockImpl IWineD3DStateBlockImpl;
273 typedef struct IWineD3DSurfaceImpl IWineD3DSurfaceImpl;
275 /* Tracking */
277 /* TODO: Move some of this to the device */
278 long globalChangeGlRam(long glram);
280 /* Memory and object tracking */
282 /*Structure for holding information on all direct3d objects
283 useful for making sure tracking is ok and when release is called on a device!
284 and probably quite handy for debugging and dumping states out
286 typedef struct WineD3DGlobalStatistics {
287 int glsurfaceram; /* The aproximate amount of glTexture memory allocated for textures */
288 } WineD3DGlobalStatistics;
290 extern WineD3DGlobalStatistics* wineD3DGlobalStatistics;
292 /* Global variables */
293 extern const float identity[16];
295 /*****************************************************************************
296 * Compilable extra diagnostics
299 /* Trace information per-vertex: (extremely high amount of trace) */
300 #if 0 /* NOTE: Must be 0 in cvs */
301 # define VTRACE(A) TRACE A
302 #else
303 # define VTRACE(A)
304 #endif
306 /* Checking of per-vertex related GL calls */
307 #define vcheckGLcall(A) \
309 GLint err = glGetError(); \
310 if (err != GL_NO_ERROR) { \
311 FIXME(">>>>>>>>>>>>>>>>> %x from %s @ %s / %d\n", err, A, __FILE__, __LINE__); \
312 } else { \
313 VTRACE(("%s call ok %s / %d\n", A, __FILE__, __LINE__)); \
317 /* TODO: Confirm each of these works when wined3d move completed */
318 #if 0 /* NOTE: Must be 0 in cvs */
319 /* To avoid having to get gigabytes of trace, the following can be compiled in, and at the start
320 of each frame, a check is made for the existence of C:\D3DTRACE, and if if exists d3d trace
321 is enabled, and if it doesn't exists it is disabled. */
322 # define FRAME_DEBUGGING
323 /* Adding in the SINGLE_FRAME_DEBUGGING gives a trace of just what makes up a single frame, before
324 the file is deleted */
325 # if 1 /* NOTE: Must be 1 in cvs, as this is mostly more useful than a trace from program start */
326 # define SINGLE_FRAME_DEBUGGING
327 # endif
328 /* The following, when enabled, lets you see the makeup of the frame, by drawprimitive calls.
329 It can only be enabled when FRAME_DEBUGGING is also enabled
330 The contents of the back buffer are written into /tmp/backbuffer_* after each primitive
331 array is drawn. */
332 # if 0 /* NOTE: Must be 0 in cvs, as this give a lot of ppm files when compiled in */
333 # define SHOW_FRAME_MAKEUP 1
334 # endif
335 /* The following, when enabled, lets you see the makeup of the all the textures used during each
336 of the drawprimitive calls. It can only be enabled when SHOW_FRAME_MAKEUP is also enabled.
337 The contents of the textures assigned to each stage are written into
338 /tmp/texture_*_<Stage>.ppm after each primitive array is drawn. */
339 # if 0 /* NOTE: Must be 0 in cvs, as this give a lot of ppm files when compiled in */
340 # define SHOW_TEXTURE_MAKEUP 0
341 # endif
342 extern BOOL isOn;
343 extern BOOL isDumpingFrames;
344 extern LONG primCounter;
345 #endif
347 /*****************************************************************************
348 * Prototypes
351 /* Routine common to the draw primitive and draw indexed primitive routines */
352 void drawPrimitive(IWineD3DDevice *iface,
353 int PrimitiveType,
354 long NumPrimitives,
355 /* for Indexed: */
356 long StartVertexIndex,
357 UINT numberOfVertices,
358 long StartIdx,
359 short idxBytes,
360 const void *idxData,
361 int minIndex);
363 /*****************************************************************************
364 * Structures required to draw primitives
367 typedef struct Direct3DStridedData {
368 BYTE *lpData; /* Pointer to start of data */
369 DWORD dwStride; /* Stride between occurances of this data */
370 DWORD dwType; /* Type (as in D3DVSDT_TYPE) */
371 } Direct3DStridedData;
373 typedef struct Direct3DVertexStridedData {
374 union {
375 struct {
376 Direct3DStridedData position;
377 Direct3DStridedData blendWeights;
378 Direct3DStridedData blendMatrixIndices;
379 Direct3DStridedData normal;
380 Direct3DStridedData pSize;
381 Direct3DStridedData diffuse;
382 Direct3DStridedData specular;
383 Direct3DStridedData texCoords[MAX_TEXTURES];
384 Direct3DStridedData position2; /* tween data */
385 Direct3DStridedData normal2; /* tween data */
386 Direct3DStridedData tangent;
387 Direct3DStridedData binormal;
388 Direct3DStridedData tessFactor;
389 Direct3DStridedData fog;
390 Direct3DStridedData depth;
391 Direct3DStridedData sample;
392 } s;
393 Direct3DStridedData input[16]; /* Indexed by constants in D3DVSDE_REGISTER */
394 } u;
395 } Direct3DVertexStridedData;
397 /*****************************************************************************
398 * Internal representation of a light
400 typedef struct PLIGHTINFOEL PLIGHTINFOEL;
401 struct PLIGHTINFOEL {
402 WINED3DLIGHT OriginalParms; /* Note D3D8LIGHT == D3D9LIGHT */
403 DWORD OriginalIndex;
404 LONG glIndex;
405 BOOL lightEnabled;
406 BOOL changed;
407 BOOL enabledChanged;
409 /* Converted parms to speed up swapping lights */
410 float lightPosn[4];
411 float lightDirn[4];
412 float exponent;
413 float cutoff;
415 PLIGHTINFOEL *next;
416 PLIGHTINFOEL *prev;
419 /*****************************************************************************
420 * IWineD3D implementation structure
422 typedef struct IWineD3DImpl
424 /* IUnknown fields */
425 const IWineD3DVtbl *lpVtbl;
426 LONG ref; /* Note: Ref counting not required */
428 /* WineD3D Information */
429 IUnknown *parent;
430 UINT dxVersion;
432 /* GL Information */
433 BOOL isGLInfoValid;
434 WineD3D_GL_Info gl_info;
435 } IWineD3DImpl;
437 extern const IWineD3DVtbl IWineD3D_Vtbl;
439 typedef struct SwapChainList {
440 IWineD3DSwapChain *swapchain;
441 struct SwapChainList *next;
442 } SwapChainList;
444 /** Hacked out start of a context manager!! **/
445 typedef struct glContext {
446 int Width;
447 int Height;
448 int usedcount;
449 GLXContext context;
451 Drawable drawable;
452 IWineD3DSurface *pSurface;
453 #if 0 /* TODO: someway to represent the state of the context */
454 IWineD3DStateBlock *pStateBlock;
455 #endif
456 /* a few other things like format */
457 } glContext;
459 /* TODO: setup some flags in the regestry to enable, disable pbuffer support
460 (since it will break quite a few things until contexts are managed properly!) */
461 extern BOOL pbuffer_support;
462 /* allocate one pbuffer per surface */
463 extern BOOL pbuffer_per_surface;
465 /* Maximum number of contexts/pbuffers to keep in cache,
466 set to 100 because ATI's drivers don't support deleting pBuffers properly
467 this needs to be migrated to a list and some option availalbe for controle the cache size.
469 #define CONTEXT_CACHE 100
471 typedef struct ResourceList {
472 IWineD3DResource *resource;
473 struct ResourceList *next;
474 } ResourceList;
476 /*****************************************************************************
477 * IWineD3DDevice implementation structure
479 typedef struct IWineD3DDeviceImpl
481 /* IUnknown fields */
482 const IWineD3DDeviceVtbl *lpVtbl;
483 LONG ref; /* Note: Ref counting not required */
485 /* WineD3D Information */
486 IUnknown *parent;
487 IWineD3D *wineD3D;
489 /* X and GL Information */
490 GLint maxConcurrentLights;
492 /* Optimization */
493 BOOL modelview_valid;
494 BOOL proj_valid;
495 BOOL view_ident; /* true iff view matrix is identity */
496 BOOL last_was_rhw; /* true iff last draw_primitive was in xyzrhw mode */
497 GLenum tracking_parm; /* Which source is tracking current colour */
498 LONG tracking_color; /* used iff GL_COLOR_MATERIAL was enabled */
499 #define DISABLED_TRACKING 0 /* Disabled */
500 #define IS_TRACKING 1 /* tracking_parm is tracking diffuse color */
501 #define NEEDS_TRACKING 2 /* Tracking needs to be enabled when needed */
502 #define NEEDS_DISABLE 3 /* Tracking needs to be disabled when needed*/
503 UINT srcBlend;
504 UINT dstBlend;
505 UINT alphafunc;
506 UINT stencilfunc;
507 BOOL texture_shader_active; /* TODO: Confirm use is correct */
509 /* State block related */
510 BOOL isRecordingState;
511 IWineD3DStateBlockImpl *stateBlock;
512 IWineD3DStateBlockImpl *updateStateBlock;
514 /* Internal use fields */
515 D3DDEVICE_CREATION_PARAMETERS createParms;
516 UINT adapterNo;
517 D3DDEVTYPE devType;
519 SwapChainList *swapchains;
521 ResourceList *resources; /* a linked list to track resources created by the device */
523 /* Render Target Support */
524 IWineD3DSurface *depthStencilBuffer;
526 IWineD3DSurface *renderTarget;
527 IWineD3DSurface *stencilBufferTarget;
529 /* palettes texture management */
530 PALETTEENTRY palettes[MAX_PALETTES][256];
531 UINT currentPalette;
533 /* For rendering to a texture using glCopyTexImage */
534 BOOL renderUpsideDown;
536 /* Cursor management */
537 BOOL bCursorVisible;
538 UINT xHotSpot;
539 UINT yHotSpot;
540 UINT xScreenSpace;
541 UINT yScreenSpace;
543 /* Textures for when no other textures are mapped */
544 UINT dummyTextureName[MAX_TEXTURES];
546 /* Debug stream management */
547 BOOL debug;
549 /* Device state management */
550 HRESULT state;
552 /* Screen buffer resources */
553 glContext contextCache[CONTEXT_CACHE];
555 /* A flag to check if endscene has been called before changing the render tartet */
556 BOOL sceneEnded;
558 /* process vertex shaders using software or hardware */
559 BOOL softwareVertexProcessing;
561 } IWineD3DDeviceImpl;
563 extern const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl;
565 /* Support for IWineD3DResource ::Set/Get/FreePrivateData. I don't think
566 * anybody uses it for much so a good implementation is optional. */
567 typedef struct PrivateData
569 struct PrivateData* next;
571 GUID tag;
572 DWORD flags; /* DDSPD_* */
573 DWORD uniqueness_value;
575 union
577 LPVOID data;
578 LPUNKNOWN object;
579 } ptr;
581 DWORD size;
582 } PrivateData;
584 /*****************************************************************************
585 * IWineD3DResource implementation structure
587 typedef struct IWineD3DResourceClass
589 /* IUnknown fields */
590 LONG ref; /* Note: Ref counting not required */
592 /* WineD3DResource Information */
593 IUnknown *parent;
594 D3DRESOURCETYPE resourceType;
595 IWineD3DDeviceImpl *wineD3DDevice;
596 D3DPOOL pool;
597 UINT size;
598 DWORD usage;
599 WINED3DFORMAT format;
600 BYTE *allocatedMemory;
601 PrivateData *privateData;
603 } IWineD3DResourceClass;
605 typedef struct IWineD3DResourceImpl
607 /* IUnknown & WineD3DResource Information */
608 const IWineD3DResourceVtbl *lpVtbl;
609 IWineD3DResourceClass resource;
610 } IWineD3DResourceImpl;
613 /*****************************************************************************
614 * IWineD3DVertexBuffer implementation structure (extends IWineD3DResourceImpl)
616 typedef struct IWineD3DVertexBufferImpl
618 /* IUnknown & WineD3DResource Information */
619 const IWineD3DVertexBufferVtbl *lpVtbl;
620 IWineD3DResourceClass resource;
622 /* WineD3DVertexBuffer specifics */
623 DWORD fvf;
625 } IWineD3DVertexBufferImpl;
627 extern const IWineD3DVertexBufferVtbl IWineD3DVertexBuffer_Vtbl;
630 /*****************************************************************************
631 * IWineD3DIndexBuffer implementation structure (extends IWineD3DResourceImpl)
633 typedef struct IWineD3DIndexBufferImpl
635 /* IUnknown & WineD3DResource Information */
636 const IWineD3DIndexBufferVtbl *lpVtbl;
637 IWineD3DResourceClass resource;
639 /* WineD3DVertexBuffer specifics */
640 } IWineD3DIndexBufferImpl;
642 extern const IWineD3DIndexBufferVtbl IWineD3DIndexBuffer_Vtbl;
644 /*****************************************************************************
645 * IWineD3DBaseTexture D3D- > openGL state map lookups
647 #define WINED3DFUNC_NOTSUPPORTED -2
648 #define WINED3DFUNC_UNIMPLEMENTED -1
650 typedef enum winetexturestates {
651 WINED3DTEXSTA_ADDRESSU = 0,
652 WINED3DTEXSTA_ADDRESSV = 1,
653 WINED3DTEXSTA_ADDRESSW = 2,
654 WINED3DTEXSTA_BORDERCOLOR = 3,
655 WINED3DTEXSTA_MAGFILTER = 4,
656 WINED3DTEXSTA_MINFILTER = 5,
657 WINED3DTEXSTA_MIPFILTER = 6,
658 WINED3DTEXSTA_MAXMIPLEVEL = 7,
659 WINED3DTEXSTA_MAXANISOTROPY = 8,
660 WINED3DTEXSTA_SRGBTEXTURE = 9,
661 WINED3DTEXSTA_ELEMENTINDEX = 10,
662 WINED3DTEXSTA_DMAPOFFSET = 11,
663 WINED3DTEXSTA_TSSADDRESSW = 12,
664 MAX_WINETEXTURESTATES = 13,
665 } winetexturestates;
667 typedef struct Wined3dTextureStateMap {
668 CONST int state;
669 int function;
670 } Wined3dTextureStateMap;
672 /*****************************************************************************
673 * IWineD3DBaseTexture implementation structure (extends IWineD3DResourceImpl)
675 typedef struct IWineD3DBaseTextureClass
677 UINT levels;
678 BOOL dirty;
679 D3DFORMAT format;
680 DWORD usage;
681 UINT textureName;
682 UINT LOD;
683 D3DTEXTUREFILTERTYPE filterType;
684 DWORD states[MAX_WINETEXTURESTATES];
686 } IWineD3DBaseTextureClass;
688 typedef struct IWineD3DBaseTextureImpl
690 /* IUnknown & WineD3DResource Information */
691 const IWineD3DBaseTextureVtbl *lpVtbl;
692 IWineD3DResourceClass resource;
693 IWineD3DBaseTextureClass baseTexture;
695 } IWineD3DBaseTextureImpl;
697 /*****************************************************************************
698 * IWineD3DTexture implementation structure (extends IWineD3DBaseTextureImpl)
700 typedef struct IWineD3DTextureImpl
702 /* IUnknown & WineD3DResource/WineD3DBaseTexture Information */
703 const IWineD3DTextureVtbl *lpVtbl;
704 IWineD3DResourceClass resource;
705 IWineD3DBaseTextureClass baseTexture;
707 /* IWineD3DTexture */
708 IWineD3DSurface *surfaces[MAX_LEVELS];
710 UINT width;
711 UINT height;
712 float pow2scalingFactorX;
713 float pow2scalingFactorY;
715 } IWineD3DTextureImpl;
717 extern const IWineD3DTextureVtbl IWineD3DTexture_Vtbl;
719 /*****************************************************************************
720 * IWineD3DCubeTexture implementation structure (extends IWineD3DBaseTextureImpl)
722 typedef struct IWineD3DCubeTextureImpl
724 /* IUnknown & WineD3DResource/WineD3DBaseTexture Information */
725 const IWineD3DCubeTextureVtbl *lpVtbl;
726 IWineD3DResourceClass resource;
727 IWineD3DBaseTextureClass baseTexture;
729 /* IWineD3DCubeTexture */
730 IWineD3DSurface *surfaces[6][MAX_LEVELS];
732 UINT edgeLength;
733 float pow2scalingFactor;
735 } IWineD3DCubeTextureImpl;
737 extern const IWineD3DCubeTextureVtbl IWineD3DCubeTexture_Vtbl;
739 /*****************************************************************************
740 * IWineD3DVolume implementation structure (extends IUnknown)
742 typedef struct IWineD3DVolumeImpl
744 /* IUnknown & WineD3DResource fields */
745 const IWineD3DVolumeVtbl *lpVtbl;
746 IWineD3DResourceClass resource;
748 /* WineD3DVolume Information */
749 D3DVOLUME_DESC currentDesc;
750 IWineD3DBase *container;
751 UINT bytesPerPixel;
753 BOOL lockable;
754 BOOL locked;
755 D3DBOX lockedBox;
756 D3DBOX dirtyBox;
757 BOOL dirty;
760 } IWineD3DVolumeImpl;
762 extern const IWineD3DVolumeVtbl IWineD3DVolume_Vtbl;
764 /*****************************************************************************
765 * IWineD3DVolumeTexture implementation structure (extends IWineD3DBaseTextureImpl)
767 typedef struct IWineD3DVolumeTextureImpl
769 /* IUnknown & WineD3DResource/WineD3DBaseTexture Information */
770 const IWineD3DVolumeTextureVtbl *lpVtbl;
771 IWineD3DResourceClass resource;
772 IWineD3DBaseTextureClass baseTexture;
774 /* IWineD3DVolumeTexture */
775 IWineD3DVolume *volumes[MAX_LEVELS];
777 UINT width;
778 UINT height;
779 UINT depth;
780 } IWineD3DVolumeTextureImpl;
782 extern const IWineD3DVolumeTextureVtbl IWineD3DVolumeTexture_Vtbl;
784 typedef struct _WINED3DSURFACET_DESC
786 D3DMULTISAMPLE_TYPE MultiSampleType;
787 DWORD MultiSampleQuality;
788 UINT Width;
789 UINT Height;
790 } WINED3DSURFACET_DESC;
792 /*****************************************************************************
793 * IWineD3DSurface implementation structure
795 struct IWineD3DSurfaceImpl
797 /* IUnknown & IWineD3DResource Information */
798 const IWineD3DSurfaceVtbl *lpVtbl;
799 IWineD3DResourceClass resource;
801 /* IWineD3DSurface fields */
802 IWineD3DBase *container;
803 WINED3DSURFACET_DESC currentDesc;
805 UINT textureName;
806 UINT bytesPerPixel;
808 /* TODO: move this off into a management class(maybe!) */
809 BOOL nonpow2;
811 UINT pow2Width;
812 UINT pow2Height;
813 UINT pow2Size;
815 #if 0
816 /* precalculated x and y scalings for texture coords */
817 float pow2scalingFactorX; /* = (Width / pow2Width ) */
818 float pow2scalingFactorY; /* = (Height / pow2Height) */
819 #endif
821 BOOL lockable;
822 BOOL discard;
823 BOOL locked;
824 BOOL activeLock;
826 RECT lockedRect;
827 RECT dirtyRect;
828 BOOL Dirty;
830 BOOL inTexture;
831 BOOL inPBuffer;
833 glDescriptor glDescription;
836 extern const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl;
838 /*****************************************************************************
839 * IWineD3DVertexDeclaration implementation structure
841 typedef struct IWineD3DVertexDeclarationImpl {
842 /* IUnknown Information */
843 const IWineD3DVertexDeclarationVtbl *lpVtbl;
844 LONG ref; /* Note: Ref counting not required */
846 IUnknown *parent;
847 /** precomputed fvf if simple declaration */
848 IWineD3DDeviceImpl *wineD3DDevice;
849 DWORD fvf[MAX_STREAMS];
850 DWORD allFVF;
852 /** dx8 compatible Declaration fields */
853 DWORD* pDeclaration8;
854 DWORD declaration8Length;
856 /** dx9+ */
857 D3DVERTEXELEMENT9 *pDeclaration9;
858 UINT declaration9NumElements;
860 WINED3DVERTEXELEMENT *pDeclarationWine;
861 UINT declarationWNumElements;
863 float *constants;
865 } IWineD3DVertexDeclarationImpl;
867 extern const IWineD3DVertexDeclarationVtbl IWineD3DVertexDeclaration_Vtbl;
869 /*****************************************************************************
870 * IWineD3DStateBlock implementation structure
873 /* Internal state Block for Begin/End/Capture/Create/Apply info */
874 /* Note: Very long winded but gl Lists are not flexible enough */
875 /* to resolve everything we need, so doing it manually for now */
876 typedef struct SAVEDSTATES {
877 BOOL indices;
878 BOOL material;
879 BOOL fvf;
880 BOOL streamSource[MAX_STREAMS];
881 BOOL streamFreq[MAX_STREAMS];
882 BOOL textures[MAX_TEXTURES];
883 BOOL transform[HIGHEST_TRANSFORMSTATE + 1];
884 BOOL viewport;
885 BOOL renderState[WINEHIGHEST_RENDER_STATE + 1];
886 BOOL textureState[MAX_TEXTURES][WINED3D_HIGHEST_TEXTURE_STATE + 1];
887 BOOL samplerState[MAX_SAMPLERS][WINED3D_HIGHEST_SAMPLER_STATE + 1];
888 BOOL clipplane[MAX_CLIPPLANES];
889 BOOL vertexDecl;
890 BOOL pixelShader;
891 BOOL pixelShaderConstants[MAX_PSHADER_CONSTANTS];
892 BOOL vertexShader;
893 BOOL vertexShaderConstants[MAX_VSHADER_CONSTANTS];
894 } SAVEDSTATES;
896 typedef enum {
897 WINESHADERCNST_NONE = 0,
898 WINESHADERCNST_FLOAT = 1,
899 WINESHADERCNST_INTEGER = 2,
900 WINESHADERCNST_BOOL = 3
901 } WINESHADERCNST;
903 struct IWineD3DStateBlockImpl
905 /* IUnknown fields */
906 const IWineD3DStateBlockVtbl *lpVtbl;
907 LONG ref; /* Note: Ref counting not required */
909 /* IWineD3DStateBlock information */
910 IUnknown *parent;
911 IWineD3DDeviceImpl *wineD3DDevice;
912 WINED3DSTATEBLOCKTYPE blockType;
914 /* Array indicating whether things have been set or changed */
915 SAVEDSTATES changed;
916 SAVEDSTATES set;
918 /* Drawing - Vertex Shader or FVF related */
919 DWORD fvf;
920 /* Vertex Shader Declaration */
921 IWineD3DVertexDeclaration *vertexDecl;
923 IWineD3DVertexShader *vertexShader;
925 /* Vertex Shader Constants */
926 BOOL vertexShaderConstantB[MAX_VSHADER_CONSTANTS];
927 INT vertexShaderConstantI[MAX_VSHADER_CONSTANTS * 4];
928 float vertexShaderConstantF[MAX_VSHADER_CONSTANTS * 4];
929 WINESHADERCNST vertexShaderConstantT[MAX_VSHADER_CONSTANTS]; /* TODO: Think about changing this to a char to possibly save a little memory */
931 /* Stream Source */
932 BOOL streamIsUP;
933 UINT streamStride[MAX_STREAMS];
934 UINT streamOffset[MAX_STREAMS];
935 IWineD3DVertexBuffer *streamSource[MAX_STREAMS];
936 UINT streamFreq[MAX_STREAMS];
937 UINT streamFlags[MAX_STREAMS]; /*0 | D3DSTREAMSOURCE_INSTANCEDATA | D3DSTREAMSOURCE_INDEXEDDATA */
939 /* Indices */
940 IWineD3DIndexBuffer* pIndexData;
941 UINT baseVertexIndex; /* Note: only used for d3d8 */
943 /* Transform */
944 D3DMATRIX transforms[HIGHEST_TRANSFORMSTATE + 1];
946 /* Lights */
947 PLIGHTINFOEL *lights; /* NOTE: active GL lights must be front of the chain */
949 /* Clipping */
950 double clipplane[MAX_CLIPPLANES][4];
951 WINED3DCLIPSTATUS clip_status;
953 /* ViewPort */
954 WINED3DVIEWPORT viewport;
956 /* Material */
957 WINED3DMATERIAL material;
959 /* Pixel Shader */
960 IWineD3DPixelShader *pixelShader;
962 /* Pixel Shader Constants */
963 BOOL pixelShaderConstantB[MAX_PSHADER_CONSTANTS];
964 INT pixelShaderConstantI[MAX_PSHADER_CONSTANTS * 4];
965 float pixelShaderConstantF[MAX_PSHADER_CONSTANTS * 4];
966 WINESHADERCNST pixelShaderConstantT[MAX_PSHADER_CONSTANTS]; /* TODO: Think about changing this to a char to possibly save a little memory */
968 /* Indexed Vertex Blending */
969 D3DVERTEXBLENDFLAGS vertex_blend;
970 FLOAT tween_factor;
972 /* RenderState */
973 DWORD renderState[WINEHIGHEST_RENDER_STATE + 1];
975 /* Texture */
976 IWineD3DBaseTexture *textures[MAX_TEXTURES];
977 int textureDimensions[MAX_SAMPLERS];
979 /* Texture State Stage */
980 DWORD textureState[MAX_TEXTURES][WINED3D_HIGHEST_TEXTURE_STATE + 1];
981 /* Sampler States */
982 DWORD samplerState[MAX_SAMPLERS][WINED3D_HIGHEST_SAMPLER_STATE + 1];
986 extern const IWineD3DStateBlockVtbl IWineD3DStateBlock_Vtbl;
988 /*****************************************************************************
989 * IWineD3DQueryImpl implementation structure (extends IUnknown)
991 typedef struct IWineD3DQueryImpl
993 const IWineD3DQueryVtbl *lpVtbl;
994 LONG ref; /* Note: Ref counting not required */
996 IUnknown *parent;
997 /*TODO: replace with iface usage */
998 #if 0
999 IWineD3DDevice *wineD3DDevice;
1000 #else
1001 IWineD3DDeviceImpl *wineD3DDevice;
1002 #endif
1003 /* IWineD3DQuery fields */
1005 D3DQUERYTYPE type;
1006 /* TODO: Think about using a IUnknown instead of a void* */
1007 void *extendedData;
1010 } IWineD3DQueryImpl;
1012 extern const IWineD3DQueryVtbl IWineD3DQuery_Vtbl;
1014 /* Datastructures for IWineD3DQueryImpl.extendedData */
1015 typedef struct WineQueryOcclusionData {
1016 unsigned int queryId;
1017 } WineQueryOcclusionData;
1020 /*****************************************************************************
1021 * IWineD3DSwapChainImpl implementation structure (extends IUnknown)
1024 typedef struct IWineD3DSwapChainImpl
1026 /*IUnknown part*/
1027 IWineD3DSwapChainVtbl *lpVtbl;
1028 LONG ref; /* Note: Ref counting not required */
1030 IUnknown *parent;
1031 IWineD3DDeviceImpl *wineD3DDevice;
1033 /* IWineD3DSwapChain fields */
1034 IWineD3DSurface *backBuffer;
1035 IWineD3DSurface *frontBuffer;
1036 BOOL wantsDepthStencilBuffer;
1037 D3DPRESENT_PARAMETERS presentParms;
1039 /* TODO: move everything up to drawable off into a context manager
1040 and store the 'data' in the contextManagerData interface.
1041 IUnknown *contextManagerData;
1044 HWND win_handle;
1045 Window win;
1046 Display *display;
1048 GLXContext glCtx;
1049 XVisualInfo *visInfo;
1050 GLXContext render_ctx;
1051 /* This has been left in device for now, but needs moving off into a rendertarget management class and separated out from swapchains and devices. */
1052 Drawable drawable;
1053 } IWineD3DSwapChainImpl;
1055 extern IWineD3DSwapChainVtbl IWineD3DSwapChain_Vtbl;
1057 /*****************************************************************************
1058 * Utility function prototypes
1061 /* Trace routines */
1062 const char* debug_d3dformat(WINED3DFORMAT fmt);
1063 const char* debug_d3ddevicetype(D3DDEVTYPE devtype);
1064 const char* debug_d3dresourcetype(D3DRESOURCETYPE res);
1065 const char* debug_d3dusage(DWORD usage);
1066 const char* debug_d3dprimitivetype(D3DPRIMITIVETYPE PrimitiveType);
1067 const char* debug_d3drenderstate(DWORD state);
1068 const char* debug_d3dtexturestate(DWORD state);
1069 const char* debug_d3dpool(D3DPOOL pool);
1071 /* Routines for GL <-> D3D values */
1072 GLenum StencilOp(DWORD op);
1073 void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, D3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3);
1074 void set_texture_matrix(const float *smat, DWORD flags, BOOL calculatedCoords);
1075 void GetSrcAndOpFromValue(DWORD iValue, BOOL isAlphaArg, GLenum* source, GLenum* operand);
1077 SHORT D3DFmtGetBpp(IWineD3DDeviceImpl* This, D3DFORMAT fmt);
1078 GLenum D3DFmt2GLFmt(IWineD3DDeviceImpl* This, D3DFORMAT fmt);
1079 GLenum D3DFmt2GLType(IWineD3DDeviceImpl *This, D3DFORMAT fmt);
1080 GLint D3DFmt2GLIntFmt(IWineD3DDeviceImpl* This, D3DFORMAT fmt);
1082 int D3DFmtMakeGlCfg(D3DFORMAT BackBufferFormat, D3DFORMAT StencilBufferFormat, int *attribs, int* nAttribs, BOOL alternate);
1085 /*****************************************************************************
1086 * To enable calling of inherited functions, requires prototypes
1088 * Note: Only require classes which are subclassed, ie resource, basetexture,
1090 /*** IUnknown methods ***/
1091 extern HRESULT WINAPI IWineD3DResourceImpl_QueryInterface(IWineD3DResource *iface, REFIID riid, void** ppvObject);
1092 extern ULONG WINAPI IWineD3DResourceImpl_AddRef(IWineD3DResource *iface);
1093 extern ULONG WINAPI IWineD3DResourceImpl_Release(IWineD3DResource *iface);
1094 /*** IWineD3DResource methods ***/
1095 extern HRESULT WINAPI IWineD3DResourceImpl_GetParent(IWineD3DResource *iface, IUnknown **pParent);
1096 extern HRESULT WINAPI IWineD3DResourceImpl_GetDevice(IWineD3DResource *iface, IWineD3DDevice ** ppDevice);
1097 extern HRESULT WINAPI IWineD3DResourceImpl_SetPrivateData(IWineD3DResource *iface, REFGUID refguid, CONST void * pData, DWORD SizeOfData, DWORD Flags);
1098 extern HRESULT WINAPI IWineD3DResourceImpl_GetPrivateData(IWineD3DResource *iface, REFGUID refguid, void * pData, DWORD * pSizeOfData);
1099 extern HRESULT WINAPI IWineD3DResourceImpl_FreePrivateData(IWineD3DResource *iface, REFGUID refguid);
1100 extern DWORD WINAPI IWineD3DResourceImpl_SetPriority(IWineD3DResource *iface, DWORD PriorityNew);
1101 extern DWORD WINAPI IWineD3DResourceImpl_GetPriority(IWineD3DResource *iface);
1102 extern void WINAPI IWineD3DResourceImpl_PreLoad(IWineD3DResource *iface);
1103 extern D3DRESOURCETYPE WINAPI IWineD3DResourceImpl_GetType(IWineD3DResource *iface);
1104 /*** class static members ***/
1105 void IWineD3DResourceImpl_CleanUp(IWineD3DResource *iface);
1107 /*** IUnknown methods ***/
1108 extern HRESULT WINAPI IWineD3DBaseTextureImpl_QueryInterface(IWineD3DBaseTexture *iface, REFIID riid, void** ppvObject);
1109 extern ULONG WINAPI IWineD3DBaseTextureImpl_AddRef(IWineD3DBaseTexture *iface);
1110 extern ULONG WINAPI IWineD3DBaseTextureImpl_Release(IWineD3DBaseTexture *iface);
1111 /*** IWineD3DResource methods ***/
1112 extern HRESULT WINAPI IWineD3DBaseTextureImpl_GetParent(IWineD3DBaseTexture *iface, IUnknown **pParent);
1113 extern HRESULT WINAPI IWineD3DBaseTextureImpl_GetDevice(IWineD3DBaseTexture *iface, IWineD3DDevice ** ppDevice);
1114 extern HRESULT WINAPI IWineD3DBaseTextureImpl_SetPrivateData(IWineD3DBaseTexture *iface, REFGUID refguid, CONST void * pData, DWORD SizeOfData, DWORD Flags);
1115 extern HRESULT WINAPI IWineD3DBaseTextureImpl_GetPrivateData(IWineD3DBaseTexture *iface, REFGUID refguid, void * pData, DWORD * pSizeOfData);
1116 extern HRESULT WINAPI IWineD3DBaseTextureImpl_FreePrivateData(IWineD3DBaseTexture *iface, REFGUID refguid);
1117 extern DWORD WINAPI IWineD3DBaseTextureImpl_SetPriority(IWineD3DBaseTexture *iface, DWORD PriorityNew);
1118 extern DWORD WINAPI IWineD3DBaseTextureImpl_GetPriority(IWineD3DBaseTexture *iface);
1119 extern void WINAPI IWineD3DBaseTextureImpl_PreLoad(IWineD3DBaseTexture *iface);
1120 extern D3DRESOURCETYPE WINAPI IWineD3DBaseTextureImpl_GetType(IWineD3DBaseTexture *iface);
1121 /*** IWineD3DBaseTexture methods ***/
1122 extern DWORD WINAPI IWineD3DBaseTextureImpl_SetLOD(IWineD3DBaseTexture *iface, DWORD LODNew);
1123 extern DWORD WINAPI IWineD3DBaseTextureImpl_GetLOD(IWineD3DBaseTexture *iface);
1124 extern DWORD WINAPI IWineD3DBaseTextureImpl_GetLevelCount(IWineD3DBaseTexture *iface);
1125 extern HRESULT WINAPI IWineD3DBaseTextureImpl_SetAutoGenFilterType(IWineD3DBaseTexture *iface, D3DTEXTUREFILTERTYPE FilterType);
1126 extern D3DTEXTUREFILTERTYPE WINAPI IWineD3DBaseTextureImpl_GetAutoGenFilterType(IWineD3DBaseTexture *iface);
1127 extern void WINAPI IWineD3DBaseTextureImpl_GenerateMipSubLevels(IWineD3DBaseTexture *iface);
1128 extern BOOL WINAPI IWineD3DBaseTextureImpl_SetDirty(IWineD3DBaseTexture *iface, BOOL);
1129 extern BOOL WINAPI IWineD3DBaseTextureImpl_GetDirty(IWineD3DBaseTexture *iface);
1131 extern BYTE* WINAPI IWineD3DVertexBufferImpl_GetMemory(IWineD3DVertexBuffer* iface, DWORD iOffset);
1132 extern HRESULT WINAPI IWineD3DVertexBufferImpl_ReleaseMemory(IWineD3DVertexBuffer* iface);
1133 extern HRESULT WINAPI IWineD3DBaseTextureImpl_BindTexture(IWineD3DBaseTexture *iface);
1134 extern HRESULT WINAPI IWineD3DBaseTextureImpl_UnBindTexture(IWineD3DBaseTexture *iface);
1135 extern void WINAPI IWineD3DBaseTextureImpl_ApplyStateChanges(IWineD3DBaseTexture *iface, const DWORD textureStates[WINED3D_HIGHEST_TEXTURE_STATE + 1], const DWORD samplerStates[WINED3D_HIGHEST_SAMPLER_STATE + 1]);
1136 /*** class static members ***/
1137 void IWineD3DBaseTextureImpl_CleanUp(IWineD3DBaseTexture *iface);
1139 /* An enum for the type of constants that are used... addressing causes
1140 * problems with being able to work out what's used and what's not.. so
1141 * maybe we'll have to rely on the server vertex shader const functions?
1143 enum vsConstantsEnum {
1144 VS_CONSTANT_NOT_USED = 0,
1145 VS_CONSTANT_CONSTANT,
1146 VS_CONSTANT_INTEGER,
1147 VS_CONSTANT_BOOLEAN,
1148 VS_CONSTANT_FLOAT
1151 /*****************************************************************************
1152 * IDirect3DVertexShader implementation structure
1154 typedef struct IWineD3DVertexShaderImpl {
1155 /* IUnknown parts*/
1156 const IWineD3DVertexShaderVtbl *lpVtbl;
1157 LONG ref; /* Note: Ref counting not required */
1159 IUnknown *parent;
1160 IWineD3DDeviceImpl *wineD3DDevice;
1162 /* IWineD3DVertexShaderImpl */
1163 CONST DWORD *function;
1164 UINT functionLength;
1166 DWORD usage;
1167 DWORD version;
1169 /* vertex declaration array mapping */
1170 BOOL namedArrays; /* don't map use named functions */
1171 BOOL declaredArrays; /* mapping requires */
1172 INT arrayUsageMap[WINED3DSHADERDECLUSAGE_MAX_USAGE]; /* lookup table for the maps */
1173 INT highestConstant;
1174 CHAR constantsUsedBitmap[256];
1175 /* 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 */
1176 /* run time datas... */
1177 VSHADERDATA *data;
1178 GLuint prgId;
1179 IWineD3DVertexDeclaration *vertexDeclaration;
1180 #if 0 /* needs reworking */
1181 /* run time datas */
1182 VSHADERINPUTDATA input;
1183 VSHADEROUTPUTDATA output;
1184 #endif
1185 } IWineD3DVertexShaderImpl;
1186 extern const IWineD3DVertexShaderVtbl IWineD3DVertexShader_Vtbl;
1188 /*****************************************************************************
1189 * IDirect3DPixelShader implementation structure
1191 typedef struct IWineD3DPixelShaderImpl {
1192 /* IUnknown parts */
1193 const IWineD3DPixelShaderVtbl *lpVtbl;
1194 LONG ref; /* Note: Ref counting not required */
1196 IUnknown *parent;
1197 IWineD3DDeviceImpl *wineD3DDevice;
1199 /* IWineD3DPixelShaderImpl */
1200 CONST DWORD *function;
1201 UINT functionLength;
1202 DWORD version;
1203 CHAR constants[WINED3D_PSHADER_MAX_CONSTANTS];
1205 /* run time data */
1206 PSHADERDATA *data;
1207 GLuint prgId;
1209 #if 0 /* needs reworking */
1210 PSHADERINPUTDATA input;
1211 PSHADEROUTPUTDATA output;
1212 #endif
1213 } IWineD3DPixelShaderImpl;
1215 extern const IWineD3DPixelShaderVtbl IWineD3DPixelShader_Vtbl;
1216 #endif