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 const IWineD3DVtbl *lpVtbl;
315 DWORD ref; /* Note: Ref counting not required */
317 /* WineD3D Information */
323 WineD3D_GL_Info gl_info;
326 extern const IWineD3DVtbl IWineD3D_Vtbl;
328 /*****************************************************************************
329 * IWineD3DDevice implementation structure
331 typedef struct IWineD3DDeviceImpl
333 /* IUnknown fields */
334 const 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 const 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 const IWineD3DResourceVtbl *lpVtbl;
435 IWineD3DResourceClass resource;
436 } IWineD3DResourceImpl;
439 /*****************************************************************************
440 * IWineD3DVertexBuffer implementation structure (extends IWineD3DResourceImpl)
442 typedef struct IWineD3DVertexBufferImpl
444 /* IUnknown & WineD3DResource Information */
445 const IWineD3DVertexBufferVtbl *lpVtbl;
446 IWineD3DResourceClass resource;
448 /* WineD3DVertexBuffer specifics */
451 } IWineD3DVertexBufferImpl;
453 extern const IWineD3DVertexBufferVtbl IWineD3DVertexBuffer_Vtbl;
456 /*****************************************************************************
457 * IWineD3DIndexBuffer implementation structure (extends IWineD3DResourceImpl)
459 typedef struct IWineD3DIndexBufferImpl
461 /* IUnknown & WineD3DResource Information */
462 const IWineD3DIndexBufferVtbl *lpVtbl;
463 IWineD3DResourceClass resource;
465 /* WineD3DVertexBuffer specifics */
466 } IWineD3DIndexBufferImpl;
468 extern const IWineD3DIndexBufferVtbl IWineD3DIndexBuffer_Vtbl;
470 /*****************************************************************************
471 * IWineD3DBaseTexture implementation structure (extends IWineD3DResourceImpl)
473 typedef struct IWineD3DBaseTextureClass
481 D3DTEXTUREFILTERTYPE filterType;
483 } IWineD3DBaseTextureClass;
485 typedef struct IWineD3DBaseTextureImpl
487 /* IUnknown & WineD3DResource Information */
488 const IWineD3DBaseTextureVtbl *lpVtbl;
489 IWineD3DResourceClass resource;
490 IWineD3DBaseTextureClass baseTexture;
492 } IWineD3DBaseTextureImpl;
494 /*****************************************************************************
495 * IWineD3DTexture implementation structure (extends IWineD3DBaseTextureImpl)
497 typedef struct IWineD3DTextureImpl
499 /* IUnknown & WineD3DResource/WineD3DBaseTexture Information */
500 const IWineD3DTextureVtbl *lpVtbl;
501 IWineD3DResourceClass resource;
502 IWineD3DBaseTextureClass baseTexture;
504 /* IWineD3DTexture */
505 IWineD3DSurface *surfaces[MAX_LEVELS];
510 } IWineD3DTextureImpl;
512 extern const IWineD3DTextureVtbl IWineD3DTexture_Vtbl;
514 /*****************************************************************************
515 * IWineD3DCubeTexture implementation structure (extends IWineD3DBaseTextureImpl)
517 typedef struct IWineD3DCubeTextureImpl
519 /* IUnknown & WineD3DResource/WineD3DBaseTexture Information */
520 const IWineD3DCubeTextureVtbl *lpVtbl;
521 IWineD3DResourceClass resource;
522 IWineD3DBaseTextureClass baseTexture;
524 /* IWineD3DCubeTexture */
525 IWineD3DSurface *surfaces[6][MAX_LEVELS];
529 } IWineD3DCubeTextureImpl;
531 extern const IWineD3DCubeTextureVtbl IWineD3DCubeTexture_Vtbl;
533 /*****************************************************************************
534 * IWineD3DVolume implementation structure (extends IUnknown)
536 typedef struct IWineD3DVolumeImpl
538 /* IUnknown & WineD3DResource fields */
539 const IWineD3DVolumeVtbl *lpVtbl;
540 IWineD3DResourceClass resource;
542 /* WineD3DVolume Information */
543 D3DVOLUME_DESC currentDesc;
554 } IWineD3DVolumeImpl;
556 extern const IWineD3DVolumeVtbl IWineD3DVolume_Vtbl;
558 /*****************************************************************************
559 * IWineD3DVolumeTexture implementation structure (extends IWineD3DBaseTextureImpl)
561 typedef struct IWineD3DVolumeTextureImpl
563 /* IUnknown & WineD3DResource/WineD3DBaseTexture Information */
564 const IWineD3DVolumeTextureVtbl *lpVtbl;
565 IWineD3DResourceClass resource;
566 IWineD3DBaseTextureClass baseTexture;
568 /* IWineD3DVolumeTexture */
569 IWineD3DVolume *volumes[MAX_LEVELS];
574 } IWineD3DVolumeTextureImpl;
576 extern const IWineD3DVolumeTextureVtbl IWineD3DVolumeTexture_Vtbl;
578 typedef struct _WINED3DSURFACET_DESC
581 D3DMULTISAMPLE_TYPE MultiSampleType;
582 DWORD MultiSampleQuality;
585 } WINED3DSURFACET_DESC;
587 /*****************************************************************************
588 * IWineD3DSurface implementation structure
590 struct IWineD3DSurfaceImpl
592 /* IUnknown & IWineD3DResource Information */
593 const IWineD3DSurfaceVtbl *lpVtbl;
594 IWineD3DResourceClass resource;
596 /* IWineD3DSurface fields */
598 WINED3DSURFACET_DESC currentDesc;
615 extern const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl;
617 /*****************************************************************************
618 * IWineD3DVertexDeclaration implementation structure
620 typedef struct IWineD3DVertexDeclarationImpl {
621 /* IUnknown Information */
622 const IWineD3DVertexDeclarationVtbl *lpVtbl;
623 DWORD ref; /* Note: Ref counting not required */
626 /** precomputed fvf if simple declaration */
627 IWineD3DDeviceImpl *wineD3DDevice;
628 DWORD fvf[MAX_STREAMS];
631 /** dx8 compatible Declaration fields */
632 DWORD* pDeclaration8;
633 DWORD declaration8Length;
636 D3DVERTEXELEMENT9* pDeclaration9;
637 UINT declaration9NumElements;
638 } IWineD3DVertexDeclarationImpl;
640 extern const IWineD3DVertexDeclarationVtbl IWineD3DVertexDeclaration_Vtbl;
642 /*****************************************************************************
643 * IWineD3DStateBlock implementation structure
646 /* Internal state Block for Begin/End/Capture/Create/Apply info */
647 /* Note: Very long winded but gl Lists are not flexible enough */
648 /* to resolve everything we need, so doing it manually for now */
649 typedef struct SAVEDSTATES {
653 BOOL stream_source[MAX_STREAMS];
655 BOOL transform[HIGHEST_TRANSFORMSTATE];
657 BOOL renderState[WINEHIGHEST_RENDER_STATE];
658 BOOL textureState[8][HIGHEST_TEXTURE_STATE];
659 BOOL clipplane[MAX_CLIPPLANES];
665 struct IWineD3DStateBlockImpl
667 /* IUnknown fields */
668 const IWineD3DStateBlockVtbl *lpVtbl;
669 DWORD ref; /* Note: Ref counting not required */
671 /* IWineD3DStateBlock information */
673 IWineD3DDeviceImpl *wineD3DDevice;
674 D3DSTATEBLOCKTYPE blockType;
676 /* Array indicating whether things have been set or changed */
680 /* Drawing - Vertex Shader or FVF related */
682 /* Vertex Shader Declaration */
683 IWineD3DVertexDeclaration* vertexDecl;
685 void *vertexShader; /* @TODO: Replace void * with IWineD3DVertexShader * */
689 UINT stream_stride[MAX_STREAMS];
690 UINT stream_offset[MAX_STREAMS];
691 IWineD3DVertexBuffer *stream_source[MAX_STREAMS];
694 IWineD3DIndexBuffer* pIndexData;
695 UINT baseVertexIndex; /* Note: only used for d3d8 */
698 D3DMATRIX transforms[HIGHEST_TRANSFORMSTATE];
701 PLIGHTINFOEL *lights; /* NOTE: active GL lights must be front of the chain */
704 double clipplane[MAX_CLIPPLANES][4];
705 WINED3DCLIPSTATUS clip_status;
708 WINED3DVIEWPORT viewport;
711 WINED3DMATERIAL material;
713 /* Indexed Vertex Blending */
714 D3DVERTEXBLENDFLAGS vertex_blend;
718 DWORD renderState[WINEHIGHEST_RENDER_STATE];
721 IWineD3DBaseTexture *textures[8];
722 int textureDimensions[8];
724 /* Texture State Stage */
725 DWORD textureState[8][HIGHEST_TEXTURE_STATE];
729 extern const IWineD3DStateBlockVtbl IWineD3DStateBlock_Vtbl;
731 /*****************************************************************************
732 * IWineD3DQueryImpl implementation structure (extends IUnknown)
734 typedef struct IWineD3DQueryImpl
736 const IWineD3DQueryVtbl *lpVtbl;
737 DWORD ref; /* Note: Ref counting not required */
740 /*TODO: replace with iface usage */
742 IWineD3DDevice *wineD3DDevice;
744 IWineD3DDeviceImpl *wineD3DDevice;
746 /* IWineD3DQuery fields */
754 extern const IWineD3DQueryVtbl IWineD3DQuery_Vtbl;
756 /*****************************************************************************
757 * Utility function prototypes
761 const char* debug_d3dformat(D3DFORMAT fmt);
762 const char* debug_d3ddevicetype(D3DDEVTYPE devtype);
763 const char* debug_d3dresourcetype(D3DRESOURCETYPE res);
764 const char* debug_d3dusage(DWORD usage);
765 const char* debug_d3dprimitivetype(D3DPRIMITIVETYPE PrimitiveType);
766 const char* debug_d3drenderstate(DWORD state);
767 const char* debug_d3dtexturestate(DWORD state);
768 const char* debug_d3dpool(D3DPOOL pool);
770 /* Routines for GL <-> D3D values */
771 GLenum StencilOp(DWORD op);
772 void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, D3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3);
773 void set_texture_matrix(const float *smat, DWORD flags);
774 void GetSrcAndOpFromValue(DWORD iValue, BOOL isAlphaArg, GLenum* source, GLenum* operand);
776 SHORT D3DFmtGetBpp(IWineD3DDeviceImpl* This, D3DFORMAT fmt);
777 GLenum D3DFmt2GLFmt(IWineD3DDeviceImpl* This, D3DFORMAT fmt);
778 GLenum D3DFmt2GLType(IWineD3DDeviceImpl *This, D3DFORMAT fmt);
779 GLint D3DFmt2GLIntFmt(IWineD3DDeviceImpl* This, D3DFORMAT fmt);
781 /*****************************************************************************
782 * To enable calling of inherited functions, requires prototypes
784 * Note: Only require classes which are subclassed, ie resource, basetexture,
786 /*** IUnknown methods ***/
787 extern HRESULT WINAPI IWineD3DResourceImpl_QueryInterface(IWineD3DResource *iface, REFIID riid, void** ppvObject);
788 extern ULONG WINAPI IWineD3DResourceImpl_AddRef(IWineD3DResource *iface);
789 extern ULONG WINAPI IWineD3DResourceImpl_Release(IWineD3DResource *iface);
790 /*** IWineD3DResource methods ***/
791 extern HRESULT WINAPI IWineD3DResourceImpl_GetParent(IWineD3DResource *iface, IUnknown **pParent);
792 extern HRESULT WINAPI IWineD3DResourceImpl_GetDevice(IWineD3DResource *iface, IWineD3DDevice ** ppDevice);
793 extern HRESULT WINAPI IWineD3DResourceImpl_SetPrivateData(IWineD3DResource *iface, REFGUID refguid, CONST void * pData, DWORD SizeOfData, DWORD Flags);
794 extern HRESULT WINAPI IWineD3DResourceImpl_GetPrivateData(IWineD3DResource *iface, REFGUID refguid, void * pData, DWORD * pSizeOfData);
795 extern HRESULT WINAPI IWineD3DResourceImpl_FreePrivateData(IWineD3DResource *iface, REFGUID refguid);
796 extern DWORD WINAPI IWineD3DResourceImpl_SetPriority(IWineD3DResource *iface, DWORD PriorityNew);
797 extern DWORD WINAPI IWineD3DResourceImpl_GetPriority(IWineD3DResource *iface);
798 extern void WINAPI IWineD3DResourceImpl_PreLoad(IWineD3DResource *iface);
799 extern D3DRESOURCETYPE WINAPI IWineD3DResourceImpl_GetType(IWineD3DResource *iface);
800 /*** class static members ***/
801 void IWineD3DResourceImpl_CleanUp(IWineD3DResource *iface);
803 /*** IUnknown methods ***/
804 extern HRESULT WINAPI IWineD3DBaseTextureImpl_QueryInterface(IWineD3DBaseTexture *iface, REFIID riid, void** ppvObject);
805 extern ULONG WINAPI IWineD3DBaseTextureImpl_AddRef(IWineD3DBaseTexture *iface);
806 extern ULONG WINAPI IWineD3DBaseTextureImpl_Release(IWineD3DBaseTexture *iface);
807 /*** IWineD3DResource methods ***/
808 extern HRESULT WINAPI IWineD3DBaseTextureImpl_GetParent(IWineD3DBaseTexture *iface, IUnknown **pParent);
809 extern HRESULT WINAPI IWineD3DBaseTextureImpl_GetDevice(IWineD3DBaseTexture *iface, IWineD3DDevice ** ppDevice);
810 extern HRESULT WINAPI IWineD3DBaseTextureImpl_SetPrivateData(IWineD3DBaseTexture *iface, REFGUID refguid, CONST void * pData, DWORD SizeOfData, DWORD Flags);
811 extern HRESULT WINAPI IWineD3DBaseTextureImpl_GetPrivateData(IWineD3DBaseTexture *iface, REFGUID refguid, void * pData, DWORD * pSizeOfData);
812 extern HRESULT WINAPI IWineD3DBaseTextureImpl_FreePrivateData(IWineD3DBaseTexture *iface, REFGUID refguid);
813 extern DWORD WINAPI IWineD3DBaseTextureImpl_SetPriority(IWineD3DBaseTexture *iface, DWORD PriorityNew);
814 extern DWORD WINAPI IWineD3DBaseTextureImpl_GetPriority(IWineD3DBaseTexture *iface);
815 extern void WINAPI IWineD3DBaseTextureImpl_PreLoad(IWineD3DBaseTexture *iface);
816 extern D3DRESOURCETYPE WINAPI IWineD3DBaseTextureImpl_GetType(IWineD3DBaseTexture *iface);
817 /*** IWineD3DBaseTexture methods ***/
818 extern DWORD WINAPI IWineD3DBaseTextureImpl_SetLOD(IWineD3DBaseTexture *iface, DWORD LODNew);
819 extern DWORD WINAPI IWineD3DBaseTextureImpl_GetLOD(IWineD3DBaseTexture *iface);
820 extern DWORD WINAPI IWineD3DBaseTextureImpl_GetLevelCount(IWineD3DBaseTexture *iface);
821 extern HRESULT WINAPI IWineD3DBaseTextureImpl_SetAutoGenFilterType(IWineD3DBaseTexture *iface, D3DTEXTUREFILTERTYPE FilterType);
822 extern D3DTEXTUREFILTERTYPE WINAPI IWineD3DBaseTextureImpl_GetAutoGenFilterType(IWineD3DBaseTexture *iface);
823 extern void WINAPI IWineD3DBaseTextureImpl_GenerateMipSubLevels(IWineD3DBaseTexture *iface);
824 extern BOOL WINAPI IWineD3DBaseTextureImpl_SetDirty(IWineD3DBaseTexture *iface, BOOL);
825 extern BOOL WINAPI IWineD3DBaseTextureImpl_GetDirty(IWineD3DBaseTexture *iface);
826 extern HRESULT WINAPI IWineD3DBaseTextureImpl_BindTexture(IWineD3DBaseTexture *iface);
827 extern HRESULT WINAPI IWineD3DBaseTextureImpl_UnBindTexture(IWineD3DBaseTexture *iface);
828 /*** class static members ***/
829 void IWineD3DBaseTextureImpl_CleanUp(IWineD3DBaseTexture *iface);
831 /*****************************************************************************
832 * IDirect3DVertexShader implementation structure
834 typedef struct IWineD3DVertexShaderImpl {
836 const IWineD3DVertexShaderVtbl *lpVtbl;
837 DWORD ref; /* Note: Ref counting not required */
840 IWineD3DDeviceImpl *wineD3DDevice;
842 /* IWineD3DVertexShaderImpl*/
843 CONST DWORD *function;
846 #if 0 /* needs reworking */
851 VSHADERINPUTDATA input;
852 VSHADEROUTPUTDATA output;
854 } IWineD3DVertexShaderImpl;
855 extern const IWineD3DVertexShaderVtbl IWineD3DVertexShader_Vtbl;
857 /*****************************************************************************
858 * IDirect3DPixelShader implementation structure
860 typedef struct IWineD3DPixelShaderImpl {
862 const IWineD3DPixelShaderVtbl *lpVtbl;
863 DWORD ref; /* Note: Ref counting not required */
866 IWineD3DDeviceImpl *wineD3DDevice;
869 /* IWineD3DPixelShaderImpl*/
870 CONST DWORD *function;
873 #if 0 /* needs reworking */
878 PSHADERINPUTDATA input;
879 PSHADEROUTPUTDATA output;
881 } IWineD3DPixelShaderImpl;
883 extern const IWineD3DPixelShaderVtbl IWineD3DPixelShader_Vtbl;