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
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #ifndef __WINE_WINED3D_PRIVATE_H
24 #define __WINE_WINED3D_PRIVATE_H
28 #define NONAMELESSUNION
29 #define NONAMELESSSTRUCT
36 #include "wine/debug.h"
37 #include "wine/unicode.h"
40 #include "d3d9types.h"
41 #include "wine/wined3d_interface.h"
42 #include "wine/wined3d_gl.h"
55 extern void (*wine_tsx11_lock_ptr)(void);
56 extern void (*wine_tsx11_unlock_ptr)(void);
58 /* As GLX relies on X, this is needed */
62 #define ENTER_GL() ++num_lock; if (num_lock > 1) FIXME("Recursive use of GL lock to: %d\n", num_lock); wine_tsx11_lock_ptr()
63 #define LEAVE_GL() if (num_lock != 1) FIXME("Recursive use of GL lock: %d\n", num_lock); --num_lock; wine_tsx11_unlock_ptr()
65 #define ENTER_GL() wine_tsx11_lock_ptr()
66 #define LEAVE_GL() wine_tsx11_unlock_ptr()
69 /*****************************************************************************
73 /* GL related defines */
74 /* ------------------ */
75 #define GL_SUPPORT(ExtName) (GLINFO_LOCATION.supported[ExtName] != 0)
76 #define GL_LIMITS(ExtName) (GLINFO_LOCATION.max_##ExtName)
77 #define GL_EXTCALL(FuncName) (GLINFO_LOCATION.FuncName)
79 #define D3DCOLOR_R(dw) (((float) (((dw) >> 16) & 0xFF)) / 255.0f)
80 #define D3DCOLOR_G(dw) (((float) (((dw) >> 8) & 0xFF)) / 255.0f)
81 #define D3DCOLOR_B(dw) (((float) (((dw) >> 0) & 0xFF)) / 255.0f)
82 #define D3DCOLOR_A(dw) (((float) (((dw) >> 24) & 0xFF)) / 255.0f)
84 #define D3DCOLORTOGLFLOAT4(dw, vec) \
85 (vec)[0] = D3DCOLOR_R(dw); \
86 (vec)[1] = D3DCOLOR_G(dw); \
87 (vec)[2] = D3DCOLOR_B(dw); \
88 (vec)[3] = D3DCOLOR_A(dw);
90 /* Note: The following is purely to keep the source code as clear from #ifdefs as possible */
91 #if defined(GL_VERSION_1_3)
92 #define GLACTIVETEXTURE(textureNo) \
93 glActiveTexture(GL_TEXTURE0 + textureNo); \
94 checkGLcall("glActiveTexture");
95 #define GLCLIENTACTIVETEXTURE(textureNo) \
96 glClientActiveTexture(GL_TEXTURE0 + textureNo);
97 #define GLMULTITEXCOORD1F(a,b) \
98 glMultiTexCoord1f(GL_TEXTURE0 + a, b);
99 #define GLMULTITEXCOORD2F(a,b,c) \
100 glMultiTexCoord2f(GL_TEXTURE0 + a, b, c);
101 #define GLMULTITEXCOORD3F(a,b,c,d) \
102 glMultiTexCoord3f(GL_TEXTURE0 + a, b, c, d);
103 #define GLMULTITEXCOORD4F(a,b,c,d,e) \
104 glMultiTexCoord4f(GL_TEXTURE0 + a, b, c, d, e);
105 #define GLTEXTURECUBEMAP GL_TEXTURE_CUBE_MAP
107 #define GLACTIVETEXTURE(textureNo) \
108 glActiveTextureARB(GL_TEXTURE0_ARB + textureNo); \
109 checkGLcall("glActiveTextureARB");
110 #define GLCLIENTACTIVETEXTURE(textureNo) \
111 glClientActiveTextureARB(GL_TEXTURE0_ARB + textureNo);
112 #define GLMULTITEXCOORD1F(a,b) \
113 glMultiTexCoord1fARB(GL_TEXTURE0_ARB + a, b);
114 #define GLMULTITEXCOORD2F(a,b,c) \
115 glMultiTexCoord2fARB(GL_TEXTURE0_ARB + a, b, c);
116 #define GLMULTITEXCOORD3F(a,b,c,d) \
117 glMultiTexCoord3fARB(GL_TEXTURE0_ARB + a, b, c, d);
118 #define GLMULTITEXCOORD4F(a,b,c,d,e) \
119 glMultiTexCoord4fARB(GL_TEXTURE0_ARB + a, b, c, d, e);
120 #define GLTEXTURECUBEMAP GL_TEXTURE_CUBE_MAP_ARB
123 /* DirectX Device Limits */
124 /* --------------------- */
125 #define MAX_LEVELS 256 /* Maximum number of mipmap levels. Guessed at 256 */
127 #define MAX_STREAMS 16 /* Maximum possible streams - used for fixed size arrays
128 See MaxStreams in MSDN under GetDeviceCaps */
129 /* Maximum number of constants provided to the shaders */
130 #define HIGHEST_TRANSFORMSTATE 512
131 /* Highest value in D3DTRANSFORMSTATETYPE */
132 #define HIGHEST_TEXTURE_STATE D3DTSS_CONSTANT
133 /* Highest D3DTSS_ value */
134 #define HIGHEST_SAMPLER_STATE D3DSAMP_DMAPOFFSET
135 /* Maximum number of constants provided to the shaders */
136 #define MAX_CLIPPLANES D3DMAXUSERCLIPPLANES
138 #define MAX_PALETTES 256
140 /* Checking of API calls */
141 /* --------------------- */
142 #define checkGLcall(A) \
144 GLint err = glGetError(); \
145 if (err != GL_NO_ERROR) { \
146 FIXME(">>>>>>>>>>>>>>>>> %x from %s @ %s / %d\n", err, A, __FILE__, __LINE__); \
148 TRACE("%s call ok %s / %d\n", A, __FILE__, __LINE__); \
152 /* Trace routines / diagnostics */
153 /* ---------------------------- */
155 /* Dump out a matrix and copy it */
156 #define conv_mat(mat,gl_mat) \
158 TRACE("%f %f %f %f\n", (mat)->u.s._11, (mat)->u.s._12, (mat)->u.s._13, (mat)->u.s._14); \
159 TRACE("%f %f %f %f\n", (mat)->u.s._21, (mat)->u.s._22, (mat)->u.s._23, (mat)->u.s._24); \
160 TRACE("%f %f %f %f\n", (mat)->u.s._31, (mat)->u.s._32, (mat)->u.s._33, (mat)->u.s._34); \
161 TRACE("%f %f %f %f\n", (mat)->u.s._41, (mat)->u.s._42, (mat)->u.s._43, (mat)->u.s._44); \
162 memcpy(gl_mat, (mat), 16 * sizeof(float)); \
165 /* Macro to dump out the current state of the light chain */
166 #define DUMP_LIGHT_CHAIN() \
168 PLIGHTINFOEL *el = This->stateBlock->lights;\
170 TRACE("Light %p (glIndex %ld, d3dIndex %ld, enabled %d)\n", el, el->glIndex, el->OriginalIndex, el->lightEnabled);\
175 /* Trace vector and strided data information */
176 #define TRACE_VECTOR(name) TRACE( #name "=(%f, %f, %f, %f)\n", name.x, name.y, name.z, name.w);
177 #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);
179 /* Defines used for optimizations */
181 /* Only reapply what is necessary */
182 #define REAPPLY_ALPHAOP 0x0001
183 #define REAPPLY_ALL 0xFFFF
185 /* Advance declaration of structures to satisfy compiler */
186 typedef struct IWineD3DStateBlockImpl IWineD3DStateBlockImpl;
187 typedef struct IWineD3DSurfaceImpl IWineD3DSurfaceImpl;
189 /* Global variables */
190 extern const float identity[16];
192 /*****************************************************************************
193 * Compilable extra diagnostics
196 /* Trace information per-vertex: (extremely high amount of trace) */
197 #if 0 /* NOTE: Must be 0 in cvs */
198 # define VTRACE(A) TRACE A
203 /* Checking of per-vertex related GL calls */
204 #define vcheckGLcall(A) \
206 GLint err = glGetError(); \
207 if (err != GL_NO_ERROR) { \
208 FIXME(">>>>>>>>>>>>>>>>> %x from %s @ %s / %d\n", err, A, __FILE__, __LINE__); \
210 VTRACE(("%s call ok %s / %d\n", A, __FILE__, __LINE__)); \
214 /* TODO: Confirm each of these works when wined3d move completed */
215 #if 0 /* NOTE: Must be 0 in cvs */
216 /* To avoid having to get gigabytes of trace, the following can be compiled in, and at the start
217 of each frame, a check is made for the existence of C:\D3DTRACE, and if if exists d3d trace
218 is enabled, and if it doesn't exists it is disabled. */
219 # define FRAME_DEBUGGING
220 /* Adding in the SINGLE_FRAME_DEBUGGING gives a trace of just what makes up a single frame, before
221 the file is deleted */
222 # if 1 /* NOTE: Must be 1 in cvs, as this is mostly more useful than a trace from program start */
223 # define SINGLE_FRAME_DEBUGGING
225 /* The following, when enabled, lets you see the makeup of the frame, by drawprimitive calls.
226 It can only be enabled when FRAME_DEBUGGING is also enabled
227 The contents of the back buffer are written into /tmp/backbuffer_* after each primitive
229 # if 0 /* NOTE: Must be 0 in cvs, as this give a lot of ppm files when compiled in */
230 # define SHOW_FRAME_MAKEUP 1
232 /* The following, when enabled, lets you see the makeup of the all the textures used during each
233 of the drawprimitive calls. It can only be enabled when SHOW_FRAME_MAKEUP is also enabled.
234 The contents of the textures assigned to each stage are written into
235 /tmp/texture_*_<Stage>.ppm after each primitive array is drawn. */
236 # if 0 /* NOTE: Must be 0 in cvs, as this give a lot of ppm files when compiled in */
237 # define SHOW_TEXTURE_MAKEUP 0
240 extern BOOL isDumpingFrames;
241 extern LONG primCounter;
244 /*****************************************************************************
248 /* Routine common to the draw primitive and draw indexed primitive routines */
249 void drawPrimitive(IWineD3DDevice *iface,
254 long StartVertexIndex,
260 /*****************************************************************************
261 * Structures required to draw primitives
264 typedef struct Direct3DStridedData {
265 BYTE *lpData; /* Pointer to start of data */
266 DWORD dwStride; /* Stride between occurances of this data */
267 DWORD dwType; /* Type (as in D3DVSDT_TYPE) */
268 } Direct3DStridedData;
270 typedef struct Direct3DVertexStridedData {
273 Direct3DStridedData position;
274 Direct3DStridedData blendWeights;
275 Direct3DStridedData blendMatrixIndices;
276 Direct3DStridedData normal;
277 Direct3DStridedData pSize;
278 Direct3DStridedData diffuse;
279 Direct3DStridedData specular;
280 Direct3DStridedData texCoords[8];
282 Direct3DStridedData input[16]; /* Indexed by constants in D3DVSDE_REGISTER */
284 } Direct3DVertexStridedData;
286 /*****************************************************************************
287 * Internal representation of a light
289 typedef struct PLIGHTINFOEL PLIGHTINFOEL;
290 struct PLIGHTINFOEL {
291 WINED3DLIGHT OriginalParms; /* Note D3D8LIGHT == D3D9LIGHT */
298 /* Converted parms to speed up swapping lights */
308 /*****************************************************************************
309 * IWineD3D implementation structure
311 typedef struct IWineD3DImpl
313 /* IUnknown fields */
314 IWineD3DVtbl *lpVtbl;
315 DWORD ref; /* Note: Ref counting not required */
317 /* WineD3D Information */
323 WineD3D_GL_Info gl_info;
326 extern IWineD3DVtbl IWineD3D_Vtbl;
328 /*****************************************************************************
329 * IWineD3DDevice implementation structure
331 typedef struct IWineD3DDeviceImpl
333 /* IUnknown fields */
334 IWineD3DDeviceVtbl *lpVtbl;
335 DWORD ref; /* Note: Ref counting not required */
337 /* WineD3D Information */
341 /* X and GL Information */
346 XVisualInfo *visInfo;
347 GLXContext render_ctx;
349 GLint maxConcurrentLights;
352 BOOL modelview_valid;
354 BOOL view_ident; /* true iff view matrix is identity */
355 BOOL last_was_rhw; /* true iff last draw_primitive was in xyzrhw mode */
356 GLenum tracking_parm; /* Which source is tracking current colour */
357 LONG tracking_color; /* used iff GL_COLOR_MATERIAL was enabled */
358 #define DISABLED_TRACKING 0 /* Disabled */
359 #define IS_TRACKING 1 /* tracking_parm is tracking diffuse color */
360 #define NEEDS_TRACKING 2 /* Tracking needs to be enabled when needed */
361 #define NEEDS_DISABLE 3 /* Tracking needs to be disabled when needed*/
366 BOOL texture_shader_active; /* TODO: Confirm use is correct */
368 /* State block related */
369 BOOL isRecordingState;
370 IWineD3DStateBlockImpl *stateBlock;
371 IWineD3DStateBlockImpl *updateStateBlock;
373 /* Internal use fields */
374 D3DDEVICE_CREATION_PARAMETERS createParms;
375 D3DPRESENT_PARAMETERS presentParms;
379 /* Render Target Support */
380 IWineD3DSurface *frontBuffer;
381 IWineD3DSurface *backBuffer;
382 IWineD3DSurface *depthStencilBuffer;
384 IWineD3DSurface *renderTarget;
385 IWineD3DSurface *stencilBufferTarget;
387 /* palettes texture management */
388 PALETTEENTRY palettes[MAX_PALETTES][256];
391 /* For rendering to a texture using glCopyTexImage */
392 BOOL renderUpsideDown;
394 /* Cursor management */
401 /* Textures for when no other textures are mapped */
402 UINT dummyTextureName[8];
404 /* Debug stream management */
407 } IWineD3DDeviceImpl;
409 extern IWineD3DDeviceVtbl IWineD3DDevice_Vtbl;
411 /*****************************************************************************
412 * IWineD3DResource implementation structure
414 typedef struct IWineD3DResourceClass
416 /* IUnknown fields */
417 DWORD ref; /* Note: Ref counting not required */
419 /* WineD3DResource Information */
421 D3DRESOURCETYPE resourceType;
422 IWineD3DDeviceImpl *wineD3DDevice;
426 WINED3DFORMAT format;
427 BYTE *allocatedMemory;
429 } IWineD3DResourceClass;
431 typedef struct IWineD3DResourceImpl
433 /* IUnknown & WineD3DResource Information */
434 IWineD3DResourceVtbl *lpVtbl;
435 IWineD3DResourceClass resource;
436 } IWineD3DResourceImpl;
438 extern IWineD3DResourceVtbl IWineD3DResource_Vtbl;
440 /*****************************************************************************
441 * IWineD3DVertexBuffer implementation structure (extends IWineD3DResourceImpl)
443 typedef struct IWineD3DVertexBufferImpl
445 /* IUnknown & WineD3DResource Information */
446 IWineD3DVertexBufferVtbl *lpVtbl;
447 IWineD3DResourceClass resource;
449 /* WineD3DVertexBuffer specifics */
452 } IWineD3DVertexBufferImpl;
454 extern IWineD3DVertexBufferVtbl IWineD3DVertexBuffer_Vtbl;
457 /*****************************************************************************
458 * IWineD3DIndexBuffer implementation structure (extends IWineD3DResourceImpl)
460 typedef struct IWineD3DIndexBufferImpl
462 /* IUnknown & WineD3DResource Information */
463 IWineD3DIndexBufferVtbl *lpVtbl;
464 IWineD3DResourceClass resource;
466 /* WineD3DVertexBuffer specifics */
467 } IWineD3DIndexBufferImpl;
469 extern IWineD3DIndexBufferVtbl IWineD3DIndexBuffer_Vtbl;
471 /*****************************************************************************
472 * IWineD3DBaseTexture implementation structure (extends IWineD3DResourceImpl)
474 typedef struct IWineD3DBaseTextureClass
482 D3DTEXTUREFILTERTYPE filterType;
484 } IWineD3DBaseTextureClass;
486 typedef struct IWineD3DBaseTextureImpl
488 /* IUnknown & WineD3DResource Information */
489 IWineD3DBaseTextureVtbl *lpVtbl;
490 IWineD3DResourceClass resource;
491 IWineD3DBaseTextureClass baseTexture;
493 } IWineD3DBaseTextureImpl;
495 extern IWineD3DBaseTextureVtbl IWineD3DBaseTexture_Vtbl;
497 /*****************************************************************************
498 * IWineD3DTexture implementation structure (extends IWineD3DBaseTextureImpl)
500 typedef struct IWineD3DTextureImpl
502 /* IUnknown & WineD3DResource/WineD3DBaseTexture Information */
503 IWineD3DTextureVtbl *lpVtbl;
504 IWineD3DResourceClass resource;
505 IWineD3DBaseTextureClass baseTexture;
507 /* IWineD3DTexture */
508 IWineD3DSurface *surfaces[MAX_LEVELS];
513 } IWineD3DTextureImpl;
515 extern IWineD3DTextureVtbl IWineD3DTexture_Vtbl;
517 /*****************************************************************************
518 * IWineD3DCubeTexture implementation structure (extends IWineD3DBaseTextureImpl)
520 typedef struct IWineD3DCubeTextureImpl
522 /* IUnknown & WineD3DResource/WineD3DBaseTexture Information */
523 IWineD3DCubeTextureVtbl *lpVtbl;
524 IWineD3DResourceClass resource;
525 IWineD3DBaseTextureClass baseTexture;
527 /* IWineD3DCubeTexture */
528 IWineD3DSurface *surfaces[6][MAX_LEVELS];
532 } IWineD3DCubeTextureImpl;
534 extern IWineD3DCubeTextureVtbl IWineD3DCubeTexture_Vtbl;
536 /*****************************************************************************
537 * IWineD3DVolume implementation structure (extends IUnknown)
539 typedef struct IWineD3DVolumeImpl
541 /* IUnknown & WineD3DResource fields */
542 IWineD3DVolumeVtbl *lpVtbl;
543 IWineD3DResourceClass resource;
545 /* WineD3DVolume Information */
546 D3DVOLUME_DESC currentDesc;
557 } IWineD3DVolumeImpl;
559 extern IWineD3DVolumeVtbl IWineD3DVolume_Vtbl;
561 /*****************************************************************************
562 * IWineD3DVolumeTexture implementation structure (extends IWineD3DBaseTextureImpl)
564 typedef struct IWineD3DVolumeTextureImpl
566 /* IUnknown & WineD3DResource/WineD3DBaseTexture Information */
567 IWineD3DVolumeTextureVtbl *lpVtbl;
568 IWineD3DResourceClass resource;
569 IWineD3DBaseTextureClass baseTexture;
571 /* IWineD3DVolumeTexture */
572 IWineD3DVolume *volumes[MAX_LEVELS];
577 } IWineD3DVolumeTextureImpl;
579 extern IWineD3DVolumeTextureVtbl IWineD3DVolumeTexture_Vtbl;
581 typedef struct _WINED3DSURFACET_DESC
584 D3DMULTISAMPLE_TYPE MultiSampleType;
585 DWORD MultiSampleQuality;
588 } WINED3DSURFACET_DESC;
590 /*****************************************************************************
591 * IWineD3DSurface implementation structure
593 struct IWineD3DSurfaceImpl
595 /* IUnknown & IWineD3DResource Information */
596 IWineD3DSurfaceVtbl *lpVtbl;
597 IWineD3DResourceClass resource;
599 /* IWineD3DSurface fields */
601 WINED3DSURFACET_DESC currentDesc;
618 extern IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl;
620 /*****************************************************************************
621 * IWineD3DVertexDeclaration implementation structure
623 typedef struct IWineD3DVertexDeclarationImpl {
624 /* IUnknown Information */
625 IWineD3DVertexDeclarationVtbl *lpVtbl;
626 DWORD ref; /* Note: Ref counting not required */
629 /** precomputed fvf if simple declaration */
630 IWineD3DDeviceImpl *wineD3DDevice;
631 DWORD fvf[MAX_STREAMS];
634 /** dx8 compatible Declaration fields */
635 DWORD* pDeclaration8;
636 DWORD declaration8Length;
639 D3DVERTEXELEMENT9* pDeclaration9;
640 UINT declaration9NumElements;
641 } IWineD3DVertexDeclarationImpl;
643 extern IWineD3DVertexDeclarationVtbl IWineD3DVertexDeclaration_Vtbl;
645 /*****************************************************************************
646 * IWineD3DStateBlock implementation structure
649 /* Internal state Block for Begin/End/Capture/Create/Apply info */
650 /* Note: Very long winded but gl Lists are not flexible enough */
651 /* to resolve everything we need, so doing it manually for now */
652 typedef struct SAVEDSTATES {
656 BOOL stream_source[MAX_STREAMS];
658 BOOL transform[HIGHEST_TRANSFORMSTATE];
660 BOOL renderState[WINEHIGHEST_RENDER_STATE];
661 BOOL textureState[8][HIGHEST_TEXTURE_STATE];
662 BOOL clipplane[MAX_CLIPPLANES];
668 struct IWineD3DStateBlockImpl
670 /* IUnknown fields */
671 IWineD3DStateBlockVtbl *lpVtbl;
672 DWORD ref; /* Note: Ref counting not required */
674 /* IWineD3DStateBlock information */
676 IWineD3DDeviceImpl *wineD3DDevice;
677 D3DSTATEBLOCKTYPE blockType;
679 /* Array indicating whether things have been set or changed */
683 /* Drawing - Vertex Shader or FVF related */
685 /* Vertex Shader Declaration */
686 IWineD3DVertexDeclaration* vertexDecl;
688 void *vertexShader; /* @TODO: Replace void * with IWineD3DVertexShader * */
692 UINT stream_stride[MAX_STREAMS];
693 UINT stream_offset[MAX_STREAMS];
694 IWineD3DVertexBuffer *stream_source[MAX_STREAMS];
697 IWineD3DIndexBuffer* pIndexData;
698 UINT baseVertexIndex; /* Note: only used for d3d8 */
701 D3DMATRIX transforms[HIGHEST_TRANSFORMSTATE];
704 PLIGHTINFOEL *lights; /* NOTE: active GL lights must be front of the chain */
707 double clipplane[MAX_CLIPPLANES][4];
708 WINED3DCLIPSTATUS clip_status;
711 WINED3DVIEWPORT viewport;
714 WINED3DMATERIAL material;
716 /* Indexed Vertex Blending */
717 D3DVERTEXBLENDFLAGS vertex_blend;
721 DWORD renderState[WINEHIGHEST_RENDER_STATE];
724 IWineD3DBaseTexture *textures[8];
725 int textureDimensions[8];
727 /* Texture State Stage */
728 DWORD textureState[8][HIGHEST_TEXTURE_STATE];
732 extern IWineD3DStateBlockVtbl IWineD3DStateBlock_Vtbl;
734 /*****************************************************************************
735 * IWineD3DQueryImpl implementation structure (extends IUnknown)
737 typedef struct IWineD3DQueryImpl
739 IWineD3DQueryVtbl *lpVtbl;
740 DWORD ref; /* Note: Ref counting not required */
743 /*TODO: replace with iface usage */
745 IWineD3DDevice *wineD3DDevice;
747 IWineD3DDeviceImpl *wineD3DDevice;
749 /* IWineD3DQuery fields */
757 extern IWineD3DQueryVtbl IWineD3DQuery_Vtbl;
759 /*****************************************************************************
760 * Utility function prototypes
764 const char* debug_d3dformat(D3DFORMAT fmt);
765 const char* debug_d3ddevicetype(D3DDEVTYPE devtype);
766 const char* debug_d3dresourcetype(D3DRESOURCETYPE res);
767 const char* debug_d3dusage(DWORD usage);
768 const char* debug_d3dprimitivetype(D3DPRIMITIVETYPE PrimitiveType);
769 const char* debug_d3drenderstate(DWORD state);
770 const char* debug_d3dtexturestate(DWORD state);
771 const char* debug_d3dpool(D3DPOOL pool);
773 /* Routines for GL <-> D3D values */
774 GLenum StencilOp(DWORD op);
775 void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, D3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3);
776 void set_texture_matrix(const float *smat, DWORD flags);
777 void GetSrcAndOpFromValue(DWORD iValue, BOOL isAlphaArg, GLenum* source, GLenum* operand);
779 SHORT D3DFmtGetBpp(IWineD3DDeviceImpl* This, D3DFORMAT fmt);
780 GLenum D3DFmt2GLFmt(IWineD3DDeviceImpl* This, D3DFORMAT fmt);
781 GLenum D3DFmt2GLType(IWineD3DDeviceImpl *This, D3DFORMAT fmt);
782 GLint D3DFmt2GLIntFmt(IWineD3DDeviceImpl* This, D3DFORMAT fmt);
784 /*****************************************************************************
785 * To enable calling of inherited functions, requires prototypes
787 * Note: Only require classes which are subclassed, ie resource, basetexture,
789 /*** IUnknown methods ***/
790 extern HRESULT WINAPI IWineD3DResourceImpl_QueryInterface(IWineD3DResource *iface, REFIID riid, void** ppvObject);
791 extern ULONG WINAPI IWineD3DResourceImpl_AddRef(IWineD3DResource *iface);
792 extern ULONG WINAPI IWineD3DResourceImpl_Release(IWineD3DResource *iface);
793 /*** IWineD3DResource methods ***/
794 extern HRESULT WINAPI IWineD3DResourceImpl_GetParent(IWineD3DResource *iface, IUnknown **pParent);
795 extern HRESULT WINAPI IWineD3DResourceImpl_GetDevice(IWineD3DResource *iface, IWineD3DDevice ** ppDevice);
796 extern HRESULT WINAPI IWineD3DResourceImpl_SetPrivateData(IWineD3DResource *iface, REFGUID refguid, CONST void * pData, DWORD SizeOfData, DWORD Flags);
797 extern HRESULT WINAPI IWineD3DResourceImpl_GetPrivateData(IWineD3DResource *iface, REFGUID refguid, void * pData, DWORD * pSizeOfData);
798 extern HRESULT WINAPI IWineD3DResourceImpl_FreePrivateData(IWineD3DResource *iface, REFGUID refguid);
799 extern DWORD WINAPI IWineD3DResourceImpl_SetPriority(IWineD3DResource *iface, DWORD PriorityNew);
800 extern DWORD WINAPI IWineD3DResourceImpl_GetPriority(IWineD3DResource *iface);
801 extern void WINAPI IWineD3DResourceImpl_PreLoad(IWineD3DResource *iface);
802 extern D3DRESOURCETYPE WINAPI IWineD3DResourceImpl_GetType(IWineD3DResource *iface);
803 /*** class static members ***/
804 void IWineD3DResourceImpl_CleanUp(IWineD3DResource *iface);
806 /*** IUnknown methods ***/
807 extern HRESULT WINAPI IWineD3DBaseTextureImpl_QueryInterface(IWineD3DBaseTexture *iface, REFIID riid, void** ppvObject);
808 extern ULONG WINAPI IWineD3DBaseTextureImpl_AddRef(IWineD3DBaseTexture *iface);
809 extern ULONG WINAPI IWineD3DBaseTextureImpl_Release(IWineD3DBaseTexture *iface);
810 /*** IWineD3DResource methods ***/
811 extern HRESULT WINAPI IWineD3DBaseTextureImpl_GetParent(IWineD3DBaseTexture *iface, IUnknown **pParent);
812 extern HRESULT WINAPI IWineD3DBaseTextureImpl_GetDevice(IWineD3DBaseTexture *iface, IWineD3DDevice ** ppDevice);
813 extern HRESULT WINAPI IWineD3DBaseTextureImpl_SetPrivateData(IWineD3DBaseTexture *iface, REFGUID refguid, CONST void * pData, DWORD SizeOfData, DWORD Flags);
814 extern HRESULT WINAPI IWineD3DBaseTextureImpl_GetPrivateData(IWineD3DBaseTexture *iface, REFGUID refguid, void * pData, DWORD * pSizeOfData);
815 extern HRESULT WINAPI IWineD3DBaseTextureImpl_FreePrivateData(IWineD3DBaseTexture *iface, REFGUID refguid);
816 extern DWORD WINAPI IWineD3DBaseTextureImpl_SetPriority(IWineD3DBaseTexture *iface, DWORD PriorityNew);
817 extern DWORD WINAPI IWineD3DBaseTextureImpl_GetPriority(IWineD3DBaseTexture *iface);
818 extern void WINAPI IWineD3DBaseTextureImpl_PreLoad(IWineD3DBaseTexture *iface);
819 extern D3DRESOURCETYPE WINAPI IWineD3DBaseTextureImpl_GetType(IWineD3DBaseTexture *iface);
820 /*** IWineD3DBaseTexture methods ***/
821 extern DWORD WINAPI IWineD3DBaseTextureImpl_SetLOD(IWineD3DBaseTexture *iface, DWORD LODNew);
822 extern DWORD WINAPI IWineD3DBaseTextureImpl_GetLOD(IWineD3DBaseTexture *iface);
823 extern DWORD WINAPI IWineD3DBaseTextureImpl_GetLevelCount(IWineD3DBaseTexture *iface);
824 extern HRESULT WINAPI IWineD3DBaseTextureImpl_SetAutoGenFilterType(IWineD3DBaseTexture *iface, D3DTEXTUREFILTERTYPE FilterType);
825 extern D3DTEXTUREFILTERTYPE WINAPI IWineD3DBaseTextureImpl_GetAutoGenFilterType(IWineD3DBaseTexture *iface);
826 extern void WINAPI IWineD3DBaseTextureImpl_GenerateMipSubLevels(IWineD3DBaseTexture *iface);
827 extern BOOL WINAPI IWineD3DBaseTextureImpl_SetDirty(IWineD3DBaseTexture *iface, BOOL);
828 extern BOOL WINAPI IWineD3DBaseTextureImpl_GetDirty(IWineD3DBaseTexture *iface);
829 extern HRESULT WINAPI IWineD3DBaseTextureImpl_BindTexture(IWineD3DBaseTexture *iface);
830 extern HRESULT WINAPI IWineD3DBaseTextureImpl_UnBindTexture(IWineD3DBaseTexture *iface);
831 /*** class static members ***/
832 void IWineD3DBaseTextureImpl_CleanUp(IWineD3DBaseTexture *iface);
834 /*****************************************************************************
835 * IDirect3DVertexShader implementation structure
837 typedef struct IWineD3DVertexShaderImpl {
839 IWineD3DVertexShaderVtbl *lpVtbl;
840 DWORD ref; /* Note: Ref counting not required */
843 IWineD3DDeviceImpl *wineD3DDevice;
845 /* IWineD3DVertexShaderImpl*/
846 CONST DWORD *function;
849 #if 0 /* needs reworking */
854 VSHADERINPUTDATA input;
855 VSHADEROUTPUTDATA output;
857 } IWineD3DVertexShaderImpl;
858 extern IWineD3DVertexShaderVtbl IWineD3DVertexShader_Vtbl;
860 /*****************************************************************************
861 * IDirect3DPixelShader implementation structure
863 typedef struct IWineD3DPixelShaderImpl {
865 IWineD3DPixelShaderVtbl *lpVtbl;
866 DWORD ref; /* Note: Ref counting not required */
869 IWineD3DDeviceImpl *wineD3DDevice;
872 /* IWineD3DPixelShaderImpl*/
873 CONST DWORD *function;
876 #if 0 /* needs reworking */
881 PSHADERINPUTDATA input;
882 PSHADEROUTPUTDATA output;
884 } IWineD3DPixelShaderImpl;
886 extern IWineD3DPixelShaderVtbl IWineD3DPixelShader_Vtbl;