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 #define HIGHEST_TRANSFORMSTATE 512
130 /* Highest value in D3DTRANSFORMSTATETYPE */
131 #define HIGHEST_RENDER_STATE 209
132 /* Highest D3DRS_ value */
133 #define HIGHEST_TEXTURE_STATE 32
134 /* Highest D3DTSS_ value */
135 #define WINED3D_VSHADER_MAX_CONSTANTS 96
136 /* Maximum number of constants provided to the shaders */
137 #define MAX_CLIPPLANES D3DMAXUSERCLIPPLANES
139 #define MAX_PALETTES 256
141 /* Checking of API calls */
142 /* --------------------- */
143 #define checkGLcall(A) \
145 GLint err = glGetError(); \
146 if (err != GL_NO_ERROR) { \
147 FIXME(">>>>>>>>>>>>>>>>> %x from %s @ %s / %d\n", err, A, __FILE__, __LINE__); \
149 TRACE("%s call ok %s / %d\n", A, __FILE__, __LINE__); \
153 /* Trace routines / diagnostics */
154 /* ---------------------------- */
156 /* Dump out a matrix and copy it */
157 #define conv_mat(mat,gl_mat) \
159 TRACE("%f %f %f %f\n", (mat)->u.s._11, (mat)->u.s._12, (mat)->u.s._13, (mat)->u.s._14); \
160 TRACE("%f %f %f %f\n", (mat)->u.s._21, (mat)->u.s._22, (mat)->u.s._23, (mat)->u.s._24); \
161 TRACE("%f %f %f %f\n", (mat)->u.s._31, (mat)->u.s._32, (mat)->u.s._33, (mat)->u.s._34); \
162 TRACE("%f %f %f %f\n", (mat)->u.s._41, (mat)->u.s._42, (mat)->u.s._43, (mat)->u.s._44); \
163 memcpy(gl_mat, (mat), 16 * sizeof(float)); \
166 /* Macro to dump out the current state of the light chain */
167 #define DUMP_LIGHT_CHAIN() \
169 PLIGHTINFOEL *el = This->stateBlock->lights;\
171 TRACE("Light %p (glIndex %ld, d3dIndex %ld, enabled %d)\n", el, el->glIndex, el->OriginalIndex, el->lightEnabled);\
176 /* Trace vector and strided data information */
177 #define TRACE_VECTOR(name) TRACE( #name "=(%f, %f, %f, %f)\n", name.x, name.y, name.z, name.w);
178 #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);
180 /* Defines used for optimizations */
182 /* Only reapply what is necessary */
183 #define REAPPLY_ALPHAOP 0x0001
184 #define REAPPLY_ALL 0xFFFF
186 /* Advance declaration of structures to satisfy compiler */
187 typedef struct IWineD3DStateBlockImpl IWineD3DStateBlockImpl
;
188 typedef struct IWineD3DSurfaceImpl IWineD3DSurfaceImpl
;
190 /* Global variables */
191 extern const float identity
[16];
193 /*****************************************************************************
194 * Compilable extra diagnostics
197 /* Trace information per-vertex: (extremely high amount of trace) */
198 #if 0 /* NOTE: Must be 0 in cvs */
199 # define VTRACE(A) TRACE A
204 /* Checking of per-vertex related GL calls */
205 #define vcheckGLcall(A) \
207 GLint err = glGetError(); \
208 if (err != GL_NO_ERROR) { \
209 FIXME(">>>>>>>>>>>>>>>>> %x from %s @ %s / %d\n", err, A, __FILE__, __LINE__); \
211 VTRACE(("%s call ok %s / %d\n", A, __FILE__, __LINE__)); \
215 /* TODO: Confirm each of these works when wined3d move completed */
216 #if 0 /* NOTE: Must be 0 in cvs */
217 /* To avoid having to get gigabytes of trace, the following can be compiled in, and at the start
218 of each frame, a check is made for the existence of C:\D3DTRACE, and if if exists d3d trace
219 is enabled, and if it doesn't exists it is disabled. */
220 # define FRAME_DEBUGGING
221 /* Adding in the SINGLE_FRAME_DEBUGGING gives a trace of just what makes up a single frame, before
222 the file is deleted */
223 # if 1 /* NOTE: Must be 1 in cvs, as this is mostly more useful than a trace from program start */
224 # define SINGLE_FRAME_DEBUGGING
226 /* The following, when enabled, lets you see the makeup of the frame, by drawprimitive calls.
227 It can only be enabled when FRAME_DEBUGGING is also enabled
228 The contents of the back buffer are written into /tmp/backbuffer_* after each primitive
230 # if 0 /* NOTE: Must be 0 in cvs, as this give a lot of ppm files when compiled in */
231 # define SHOW_FRAME_MAKEUP 1
233 /* The following, when enabled, lets you see the makeup of the all the textures used during each
234 of the drawprimitive calls. It can only be enabled when SHOW_FRAME_MAKEUP is also enabled.
235 The contents of the textures assigned to each stage are written into
236 /tmp/texture_*_<Stage>.ppm after each primitive array is drawn. */
237 # if 0 /* NOTE: Must be 0 in cvs, as this give a lot of ppm files when compiled in */
238 # define SHOW_TEXTURE_MAKEUP 0
241 extern BOOL isDumpingFrames
;
242 extern LONG primCounter
;
245 /*****************************************************************************
249 /* Routine common to the draw primitive and draw indexed primitive routines */
250 void drawPrimitive(IWineD3DDevice
*iface
,
255 long StartVertexIndex
,
261 /*****************************************************************************
262 * Structures required to draw primitives
265 typedef struct Direct3DStridedData
{
266 BYTE
*lpData
; /* Pointer to start of data */
267 DWORD dwStride
; /* Stride between occurances of this data */
268 DWORD dwType
; /* Type (as in D3DVSDT_TYPE) */
269 } Direct3DStridedData
;
271 typedef struct Direct3DVertexStridedData
{
274 Direct3DStridedData position
;
275 Direct3DStridedData blendWeights
;
276 Direct3DStridedData blendMatrixIndices
;
277 Direct3DStridedData normal
;
278 Direct3DStridedData pSize
;
279 Direct3DStridedData diffuse
;
280 Direct3DStridedData specular
;
281 Direct3DStridedData texCoords
[8];
283 Direct3DStridedData input
[16]; /* Indexed by constants in D3DVSDE_REGISTER */
285 } Direct3DVertexStridedData
;
287 /*****************************************************************************
288 * Internal representation of a light
290 typedef struct PLIGHTINFOEL PLIGHTINFOEL
;
291 struct PLIGHTINFOEL
{
292 WINED3DLIGHT OriginalParms
; /* Note D3D8LIGHT == D3D9LIGHT */
299 /* Converted parms to speed up swapping lights */
309 /*****************************************************************************
310 * IWineD3D implementation structure
312 typedef struct IWineD3DImpl
314 /* IUnknown fields */
315 IWineD3DVtbl
*lpVtbl
;
316 DWORD ref
; /* Note: Ref counting not required */
318 /* WineD3D Information */
324 WineD3D_GL_Info gl_info
;
327 extern IWineD3DVtbl IWineD3D_Vtbl
;
329 /*****************************************************************************
330 * IWineD3DDevice implementation structure
332 typedef struct IWineD3DDeviceImpl
334 /* IUnknown fields */
335 IWineD3DDeviceVtbl
*lpVtbl
;
336 DWORD ref
; /* Note: Ref counting not required */
338 /* WineD3D Information */
342 /* X and GL Information */
347 XVisualInfo
*visInfo
;
348 GLXContext render_ctx
;
350 GLint maxConcurrentLights
;
353 BOOL modelview_valid
;
355 BOOL view_ident
; /* true iff view matrix is identity */
356 BOOL last_was_rhw
; /* true iff last draw_primitive was in xyzrhw mode */
357 GLenum tracking_parm
; /* Which source is tracking current colour */
358 LONG tracking_color
; /* used iff GL_COLOR_MATERIAL was enabled */
359 #define DISABLED_TRACKING 0 /* Disabled */
360 #define IS_TRACKING 1 /* tracking_parm is tracking diffuse color */
361 #define NEEDS_TRACKING 2 /* Tracking needs to be enabled when needed */
362 #define NEEDS_DISABLE 3 /* Tracking needs to be disabled when needed*/
367 BOOL texture_shader_active
; /* TODO: Confirm use is correct */
369 /* State block related */
370 BOOL isRecordingState
;
371 IWineD3DStateBlockImpl
*stateBlock
;
372 IWineD3DStateBlockImpl
*updateStateBlock
;
374 /* Internal use fields */
375 D3DDEVICE_CREATION_PARAMETERS createParms
;
376 D3DPRESENT_PARAMETERS presentParms
;
380 /* Render Target Support */
381 IWineD3DSurfaceImpl
*frontBuffer
;
382 IWineD3DSurfaceImpl
*backBuffer
;
383 IWineD3DSurfaceImpl
*depthStencilBuffer
;
385 IWineD3DSurfaceImpl
*renderTarget
;
386 IWineD3DSurfaceImpl
*stencilBufferTarget
;
388 /* palettes texture management */
389 PALETTEENTRY palettes
[MAX_PALETTES
][256];
392 /* For rendering to a texture using glCopyTexImage */
393 BOOL renderUpsideDown
;
395 /* Textures for when no other textures are mapped */
396 UINT dummyTextureName
[8];
398 } IWineD3DDeviceImpl
;
400 extern IWineD3DDeviceVtbl IWineD3DDevice_Vtbl
;
402 /*****************************************************************************
403 * IWineD3DResource implementation structure
405 typedef struct IWineD3DResourceClass
407 /* IUnknown fields */
408 DWORD ref
; /* Note: Ref counting not required */
410 /* WineD3DResource Information */
412 D3DRESOURCETYPE resourceType
;
413 IWineD3DDeviceImpl
*wineD3DDevice
;
415 } IWineD3DResourceClass
;
417 typedef struct IWineD3DResourceImpl
419 /* IUnknown & WineD3DResource Information */
420 IWineD3DResourceVtbl
*lpVtbl
;
421 IWineD3DResourceClass resource
;
422 } IWineD3DResourceImpl
;
424 extern IWineD3DResourceVtbl IWineD3DResource_Vtbl
;
426 /*****************************************************************************
427 * IWineD3DVertexBuffer implementation structure (extends IWineD3DResourceImpl)
429 typedef struct IWineD3DVertexBufferImpl
431 /* IUnknown & WineD3DResource Information */
432 IWineD3DVertexBufferVtbl
*lpVtbl
;
433 IWineD3DResourceClass resource
;
435 /* WineD3DVertexBuffer specifics */
436 BYTE
*allocatedMemory
;
437 D3DVERTEXBUFFER_DESC currentDesc
;
439 } IWineD3DVertexBufferImpl
;
441 extern IWineD3DVertexBufferVtbl IWineD3DVertexBuffer_Vtbl
;
443 /*****************************************************************************
444 * IWineD3DIndexBuffer implementation structure (extends IWineD3DResourceImpl)
446 typedef struct IWineD3DIndexBufferImpl
448 /* IUnknown & WineD3DResource Information */
449 IWineD3DIndexBufferVtbl
*lpVtbl
;
450 IWineD3DResourceClass resource
;
452 /* WineD3DVertexBuffer specifics */
453 BYTE
*allocatedMemory
;
454 D3DINDEXBUFFER_DESC currentDesc
;
456 } IWineD3DIndexBufferImpl
;
458 extern IWineD3DIndexBufferVtbl IWineD3DIndexBuffer_Vtbl
;
460 /*****************************************************************************
461 * IWineD3DBaseTexture implementation structure (extends IWineD3DResourceImpl)
463 typedef struct IWineD3DBaseTextureClass
469 } IWineD3DBaseTextureClass
;
471 typedef struct IWineD3DBaseTextureImpl
473 /* IUnknown & WineD3DResource Information */
474 IWineD3DBaseTextureVtbl
*lpVtbl
;
475 IWineD3DResourceClass resource
;
476 IWineD3DBaseTextureClass baseTexture
;
478 } IWineD3DBaseTextureImpl
;
480 extern IWineD3DBaseTextureVtbl IWineD3DBaseTexture_Vtbl
;
482 /*****************************************************************************
483 * IWineD3DTexture implementation structure (extends IWineD3DBaseTextureImpl)
485 typedef struct IWineD3DTextureImpl
487 /* IUnknown & WineD3DResource/WineD3DBaseTexture Information */
488 IWineD3DTextureVtbl
*lpVtbl
;
489 IWineD3DResourceClass resource
;
490 IWineD3DBaseTextureClass baseTexture
;
492 /* IWineD3DTexture */
493 IWineD3DSurfaceImpl
*surfaces
[MAX_LEVELS
];
499 } IWineD3DTextureImpl
;
501 extern IWineD3DTextureVtbl IWineD3DTexture_Vtbl
;
503 /*****************************************************************************
504 * IWineD3DCubeTexture implementation structure (extends IWineD3DBaseTextureImpl)
506 typedef struct IWineD3DCubeTextureImpl
508 /* IUnknown & WineD3DResource/WineD3DBaseTexture Information */
509 IWineD3DCubeTextureVtbl
*lpVtbl
;
510 IWineD3DResourceClass resource
;
511 IWineD3DBaseTextureClass baseTexture
;
513 /* IWineD3DCubeTexture */
514 IWineD3DSurfaceImpl
*surfaces
[6][MAX_LEVELS
];
518 } IWineD3DCubeTextureImpl
;
520 extern IWineD3DCubeTextureVtbl IWineD3DCubeTexture_Vtbl
;
522 /*****************************************************************************
523 * IWineD3DVolume implementation structure (extends IUnknown)
525 typedef struct IWineD3DVolumeImpl
527 /* IUnknown fields */
528 IWineD3DVolumeVtbl
*lpVtbl
;
529 DWORD ref
; /* Note: Ref counting not required */
531 /* WineD3DVolume Information */
533 D3DRESOURCETYPE resourceType
;
534 IWineD3DDeviceImpl
*wineD3DDevice
;
536 D3DVOLUME_DESC currentDesc
;
538 BYTE
*allocatedMemory
;
549 } IWineD3DVolumeImpl
;
551 extern IWineD3DVolumeVtbl IWineD3DVolume_Vtbl
;
553 /*****************************************************************************
554 * IWineD3DVolumeTexture implementation structure (extends IWineD3DBaseTextureImpl)
556 typedef struct IWineD3DVolumeTextureImpl
558 /* IUnknown & WineD3DResource/WineD3DBaseTexture Information */
559 IWineD3DVolumeTextureVtbl
*lpVtbl
;
560 IWineD3DResourceClass resource
;
561 IWineD3DBaseTextureClass baseTexture
;
563 /* IWineD3DVolumeTexture */
564 IWineD3DVolumeImpl
*volumes
[MAX_LEVELS
];
570 } IWineD3DVolumeTextureImpl
;
572 extern IWineD3DVolumeTextureVtbl IWineD3DVolumeTexture_Vtbl
;
574 /*****************************************************************************
575 * IWineD3DSurface implementation structure
577 struct IWineD3DSurfaceImpl
579 /* IUnknown & IWineD3DResource Information */
580 IWineD3DSurfaceVtbl
*lpVtbl
;
581 IWineD3DResourceClass resource
;
583 /* IWineD3DSurface fields */
585 D3DSURFACE_DESC currentDesc
;
586 UINT currentDesc_size
;
587 BYTE
*allocatedMemory
;
601 extern IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl
;
603 /*****************************************************************************
604 * IWineD3DVertexDeclaration implementation structure
606 typedef struct IWineD3DVertexDeclarationImpl
{
607 /* IUnknown Information */
608 IWineD3DVertexDeclarationVtbl
*lpVtbl
;
609 DWORD ref
; /* Note: Ref counting not required */
611 /** precomputed fvf if simple declaration */
612 IWineD3DDeviceImpl
*wineD3DDevice
;
613 DWORD fvf
[MAX_STREAMS
];
616 /** dx8 compatible Declaration fields */
617 DWORD
* pDeclaration8
;
618 DWORD declaration8Length
;
621 D3DVERTEXELEMENT9
* pDeclaration9
;
622 UINT declaration9NumElements
;
623 } IWineD3DVertexDeclarationImpl
;
625 extern IWineD3DVertexDeclarationVtbl IWineD3DVertexDeclaration_Vtbl
;
627 /*****************************************************************************
628 * IWineD3DStateBlock implementation structure
631 /* Internal state Block for Begin/End/Capture/Create/Apply info */
632 /* Note: Very long winded but gl Lists are not flexible enough */
633 /* to resolve everything we need, so doing it manually for now */
634 typedef struct SAVEDSTATES
{
638 BOOL stream_source
[MAX_STREAMS
];
640 BOOL transform
[HIGHEST_TRANSFORMSTATE
];
642 BOOL renderState
[HIGHEST_RENDER_STATE
];
643 BOOL textureState
[8][HIGHEST_TEXTURE_STATE
];
644 BOOL clipplane
[MAX_CLIPPLANES
];
648 struct IWineD3DStateBlockImpl
650 /* IUnknown fields */
651 IWineD3DStateBlockVtbl
*lpVtbl
;
652 DWORD ref
; /* Note: Ref counting not required */
654 /* IWineD3DStateBlock information */
656 IWineD3DDeviceImpl
*wineD3DDevice
;
657 D3DSTATEBLOCKTYPE blockType
;
659 /* Array indicating whether things have been set or changed */
663 /* Drawing - Vertex Shader or FVF related */
665 /* Vertex Shader Declaration */
666 IWineD3DVertexDeclaration
* vertexDecl
;
668 void *vertexShader
; /* @TODO: Replace void * with IWineD3DVertexShader * */
672 UINT stream_stride
[MAX_STREAMS
];
673 UINT stream_offset
[MAX_STREAMS
];
674 IWineD3DVertexBuffer
*stream_source
[MAX_STREAMS
];
677 IWineD3DIndexBuffer
* pIndexData
;
678 UINT baseVertexIndex
; /* Note: only used for d3d8 */
681 D3DMATRIX transforms
[HIGHEST_TRANSFORMSTATE
];
684 PLIGHTINFOEL
*lights
; /* NOTE: active GL lights must be front of the chain */
687 double clipplane
[MAX_CLIPPLANES
][4];
688 WINED3DCLIPSTATUS clip_status
;
691 WINED3DVIEWPORT viewport
;
694 WINED3DMATERIAL material
;
696 /* Indexed Vertex Blending */
697 D3DVERTEXBLENDFLAGS vertex_blend
;
701 DWORD renderState
[HIGHEST_RENDER_STATE
];
704 IWineD3DBaseTexture
*textures
[8];
705 int textureDimensions
[8];
707 /* Texture State Stage */
708 DWORD textureState
[8][HIGHEST_TEXTURE_STATE
];
712 extern IWineD3DStateBlockVtbl IWineD3DStateBlock_Vtbl
;
714 /*****************************************************************************
715 * Utility function prototypes
719 const char* debug_d3dformat(D3DFORMAT fmt
);
720 const char* debug_d3ddevicetype(D3DDEVTYPE devtype
);
721 const char* debug_d3dresourcetype(D3DRESOURCETYPE res
);
722 const char* debug_d3dusage(DWORD usage
);
723 const char* debug_d3dprimitivetype(D3DPRIMITIVETYPE PrimitiveType
);
724 const char* debug_d3drenderstate(DWORD state
);
725 const char* debug_d3dtexturestate(DWORD state
);
726 const char* debug_d3dpool(D3DPOOL pool
);
728 /* Routines for GL <-> D3D values */
729 GLenum
StencilOp(DWORD op
);
730 void set_tex_op(IWineD3DDevice
*iface
, BOOL isAlpha
, int Stage
, D3DTEXTUREOP op
, DWORD arg1
, DWORD arg2
, DWORD arg3
);
731 void set_texture_matrix(const float *smat
, DWORD flags
);
732 void GetSrcAndOpFromValue(DWORD iValue
, BOOL isAlphaArg
, GLenum
* source
, GLenum
* operand
);
734 SHORT
D3DFmtGetBpp(IWineD3DDeviceImpl
* This
, D3DFORMAT fmt
);
735 GLenum
D3DFmt2GLFmt(IWineD3DDeviceImpl
* This
, D3DFORMAT fmt
);
736 GLenum
D3DFmt2GLType(IWineD3DDeviceImpl
*This
, D3DFORMAT fmt
);
737 GLint
D3DFmt2GLIntFmt(IWineD3DDeviceImpl
* This
, D3DFORMAT fmt
);
739 /*****************************************************************************
740 * To enable calling of inherited functions, requires prototypes
742 * Note: Only require classes which are subclassed, ie resource, basetexture,
744 /*** IUnknown methods ***/
745 extern HRESULT WINAPI
IWineD3DResourceImpl_QueryInterface(IWineD3DResource
*iface
, REFIID riid
, void** ppvObject
);
746 extern ULONG WINAPI
IWineD3DResourceImpl_AddRef(IWineD3DResource
*iface
);
747 extern ULONG WINAPI
IWineD3DResourceImpl_Release(IWineD3DResource
*iface
);
748 /*** IWineD3DResource methods ***/
749 extern HRESULT WINAPI
IWineD3DResourceImpl_GetParent(IWineD3DResource
*iface
, IUnknown
**pParent
);
750 extern HRESULT WINAPI
IWineD3DResourceImpl_GetDevice(IWineD3DResource
*iface
, IWineD3DDevice
** ppDevice
);
751 extern HRESULT WINAPI
IWineD3DResourceImpl_SetPrivateData(IWineD3DResource
*iface
, REFGUID refguid
, CONST
void * pData
, DWORD SizeOfData
, DWORD Flags
);
752 extern HRESULT WINAPI
IWineD3DResourceImpl_GetPrivateData(IWineD3DResource
*iface
, REFGUID refguid
, void * pData
, DWORD
* pSizeOfData
);
753 extern HRESULT WINAPI
IWineD3DResourceImpl_FreePrivateData(IWineD3DResource
*iface
, REFGUID refguid
);
754 extern DWORD WINAPI
IWineD3DResourceImpl_SetPriority(IWineD3DResource
*iface
, DWORD PriorityNew
);
755 extern DWORD WINAPI
IWineD3DResourceImpl_GetPriority(IWineD3DResource
*iface
);
756 extern void WINAPI
IWineD3DResourceImpl_PreLoad(IWineD3DResource
*iface
);
757 extern D3DRESOURCETYPE WINAPI
IWineD3DResourceImpl_GetType(IWineD3DResource
*iface
);
760 /*** IUnknown methods ***/
761 extern HRESULT WINAPI
IWineD3DBaseTextureImpl_QueryInterface(IWineD3DBaseTexture
*iface
, REFIID riid
, void** ppvObject
);
762 extern ULONG WINAPI
IWineD3DBaseTextureImpl_AddRef(IWineD3DBaseTexture
*iface
);
763 extern ULONG WINAPI
IWineD3DBaseTextureImpl_Release(IWineD3DBaseTexture
*iface
);
764 /*** IWineD3DResource methods ***/
765 extern HRESULT WINAPI
IWineD3DBaseTextureImpl_GetParent(IWineD3DBaseTexture
*iface
, IUnknown
**pParent
);
766 extern HRESULT WINAPI
IWineD3DBaseTextureImpl_GetDevice(IWineD3DBaseTexture
*iface
, IWineD3DDevice
** ppDevice
);
767 extern HRESULT WINAPI
IWineD3DBaseTextureImpl_SetPrivateData(IWineD3DBaseTexture
*iface
, REFGUID refguid
, CONST
void * pData
, DWORD SizeOfData
, DWORD Flags
);
768 extern HRESULT WINAPI
IWineD3DBaseTextureImpl_GetPrivateData(IWineD3DBaseTexture
*iface
, REFGUID refguid
, void * pData
, DWORD
* pSizeOfData
);
769 extern HRESULT WINAPI
IWineD3DBaseTextureImpl_FreePrivateData(IWineD3DBaseTexture
*iface
, REFGUID refguid
);
770 extern DWORD WINAPI
IWineD3DBaseTextureImpl_SetPriority(IWineD3DBaseTexture
*iface
, DWORD PriorityNew
);
771 extern DWORD WINAPI
IWineD3DBaseTextureImpl_GetPriority(IWineD3DBaseTexture
*iface
);
772 extern void WINAPI
IWineD3DBaseTextureImpl_PreLoad(IWineD3DBaseTexture
*iface
);
773 extern D3DRESOURCETYPE WINAPI
IWineD3DBaseTextureImpl_GetType(IWineD3DBaseTexture
*iface
);
774 /*** IWineD3DBaseTexture methods ***/
775 extern DWORD WINAPI
IWineD3DBaseTextureImpl_SetLOD(IWineD3DBaseTexture
*iface
, DWORD LODNew
);
776 extern DWORD WINAPI
IWineD3DBaseTextureImpl_GetLOD(IWineD3DBaseTexture
*iface
);
777 extern DWORD WINAPI
IWineD3DBaseTextureImpl_GetLevelCount(IWineD3DBaseTexture
*iface
);
778 extern HRESULT WINAPI
IWineD3DBaseTextureImpl_SetAutoGenFilterType(IWineD3DBaseTexture
*iface
, D3DTEXTUREFILTERTYPE FilterType
);
779 extern D3DTEXTUREFILTERTYPE WINAPI
IWineD3DBaseTextureImpl_GetAutoGenFilterType(IWineD3DBaseTexture
*iface
);
780 extern void WINAPI
IWineD3DBaseTextureImpl_GenerateMipSubLevels(IWineD3DBaseTexture
*iface
);
781 extern BOOL WINAPI
IWineD3DBaseTextureImpl_SetDirty(IWineD3DBaseTexture
*iface
, BOOL
);
782 extern BOOL WINAPI
IWineD3DBaseTextureImpl_GetDirty(IWineD3DBaseTexture
*iface
);
785 #if 0 /* Needs fixing during rework */
787 /*****************************************************************************
788 * IDirect3DVertexShader implementation structure
790 struct IDirect3DVertexShaderImpl
{
792 /*IDirect3DDeviceImpl* device;*/
800 VSHADERINPUTDATA input
;
801 VSHADEROUTPUTDATA output
;
805 /*****************************************************************************
806 * IDirect3DPixelShader implementation structure
808 struct IDirect3DPixelShaderImpl
{
810 /*IDirect3DDeviceImpl* device;*/
817 PSHADERINPUTDATA input
;
818 PSHADEROUTPUTDATA output
;
821 #endif /* Needs fixing during rework */