1 /* Direct3D ExecuteBuffer
4 This files contains the implementation of Direct3DExecuteBuffer. */
11 #include "wine/obj_base.h"
15 #include "debugtools.h"
17 #include "mesa_private.h"
19 #define D3DDPRIVATE(x) mesa_d3dd_private *odev=((mesa_d3dd_private*)(x)->private)
21 DEFAULT_DEBUG_CHANNEL(ddraw)
23 /* Structure to store the 'semi transformed' vertices */
51 static ICOM_VTABLE(IDirect3DExecuteBuffer) executebuffer_vtable;
53 /*******************************************************************************
54 * ExecuteBuffer static functions
56 void _dump_d3dstatus(LPD3DSTATUS lpStatus) {
60 void _dump_executedata(LPD3DEXECUTEDATA lpData) {
61 DPRINTF("dwSize : %ld\n", lpData->dwSize);
62 DPRINTF("Vertex Offset : %ld Count : %ld\n", lpData->dwVertexOffset, lpData->dwVertexCount);
63 DPRINTF("Instruction Offset : %ld Length : %ld\n", lpData->dwInstructionOffset, lpData->dwInstructionLength);
64 DPRINTF("HVertex Offset : %ld\n", lpData->dwHVertexOffset);
65 _dump_d3dstatus(&(lpData->dsStatus));
68 #define DO_VERTEX(index) \
70 glTexCoord2f(vx[index].u, \
72 glNormal3f(vx[index].nx, \
75 glVertex4f(vx[index].x, \
80 TRACE(" V: %f %f %f %f (%f %f %f) (%f %f)\n", \
81 vx[index].x, vx[index].y, vx[index].z, vx[index].w, \
82 vx[index].nx, vx[index].ny, vx[index].nz, \
83 vx[index].u, vx[index].v); \
86 #define DO_LVERTEX(index) \
88 DWORD col = l_vx[index].c; \
90 glColor3f(((col >> 16) & 0xFF) / 255.0, \
91 ((col >> 8) & 0xFF) / 255.0, \
92 ((col >> 0) & 0xFF) / 255.0); \
93 glTexCoord2f(l_vx[index].u, \
95 glVertex4f(l_vx[index].x, \
100 TRACE(" LV: %f %f %f %f (%02lx %02lx %02lx) (%f %f)\n", \
101 l_vx[index].x, l_vx[index].y, l_vx[index].z, l_vx[index].w, \
102 ((col >> 16) & 0xFF), ((col >> 8) & 0xFF), ((col >> 0) & 0xFF), \
103 l_vx[index].u, l_vx[index].v); \
106 #define DO_TLVERTEX(index) \
108 D3DTLVERTEX *vx = &(tl_vx[index]); \
109 DWORD col = vx->c.color; \
111 glColor3f(((col >> 16) & 0xFF) / 255.0, \
112 ((col >> 8) & 0xFF) / 255.0, \
113 ((col >> 0) & 0xFF) / 255.0); \
114 glTexCoord2f(vx->u.tu, vx->v.tv); \
115 if (vx->r.rhw < 0.01) \
116 glVertex3f(vx->x.sx, \
120 glVertex4f(vx->x.sx / vx->r.rhw, \
121 vx->y.sy / vx->r.rhw, \
122 vx->z.sz / vx->r.rhw, \
124 TRACE(" TLV: %f %f %f (%02lx %02lx %02lx) (%f %f) (%f)\n", \
125 vx->x.sx, vx->y.sy, vx->z.sz, \
126 ((col >> 16) & 0xFF), ((col >> 8) & 0xFF), ((col >> 0) & 0xFF), \
127 vx->u.tu, vx->v.tv, vx->r.rhw); \
130 #define TRIANGLE_LOOP(macro) \
132 glBegin(GL_TRIANGLES); { \
133 for (i = 0; i < count; i++) { \
134 LPD3DTRIANGLE ci = (LPD3DTRIANGLE) instr; \
136 TRACE(" v1: %d v2: %d v3: %d\n", \
137 ci->v1.v1, ci->v2.v2, ci->v3.v3); \
138 TRACE(" Flags : "); \
139 if (TRACE_ON(ddraw)) { \
141 if (ci->wFlags & D3DTRIFLAG_EDGEENABLE1) \
142 DPRINTF("EDGEENABLE1 "); \
143 if (ci->wFlags & D3DTRIFLAG_EDGEENABLE2) \
144 DPRINTF("EDGEENABLE2 "); \
145 if (ci->wFlags & D3DTRIFLAG_EDGEENABLE1) \
146 DPRINTF("EDGEENABLE3 "); \
148 /* Strips / Fans */ \
149 if (ci->wFlags == D3DTRIFLAG_EVEN) \
151 if (ci->wFlags == D3DTRIFLAG_ODD) \
153 if (ci->wFlags == D3DTRIFLAG_START) \
155 if ((ci->wFlags > 0) && (ci->wFlags < 30)) \
156 DPRINTF("STARTFLAT(%d) ", ci->wFlags); \
160 /* Draw the triangle */ \
171 static void execute(LPDIRECT3DEXECUTEBUFFER lpBuff,
172 LPDIRECT3DDEVICE dev,
173 LPDIRECT3DVIEWPORT vp) {
174 IDirect3DExecuteBufferImpl* ilpBuff=(IDirect3DExecuteBufferImpl*)lpBuff;
175 IDirect3DViewport2Impl* ivp=(IDirect3DViewport2Impl*)vp;
176 /* DWORD bs = ilpBuff->desc.dwBufferSize; */
177 DWORD vs = ilpBuff->data.dwVertexOffset;
178 /* DWORD vc = ilpBuff->data.dwVertexCount; */
179 DWORD is = ilpBuff->data.dwInstructionOffset;
180 /* DWORD il = ilpBuff->data.dwInstructionLength; */
182 void *instr = ilpBuff->desc.lpData + is;
183 D3DDPRIVATE((IDirect3DDeviceImpl*)dev);
185 TRACE("ExecuteData : \n");
187 _dump_executedata(&(ilpBuff->data));
192 LPD3DINSTRUCTION current = (LPD3DINSTRUCTION) instr;
196 count = current->wCount;
197 size = current->bSize;
198 instr += sizeof(D3DINSTRUCTION);
200 switch (current->bOpcode) {
202 TRACE("POINT-s (%d)\n", count);
204 instr += count * size;
208 TRACE("LINE-s (%d)\n", count);
210 instr += count * size;
213 case D3DOP_TRIANGLE: {
215 float z_inv_matrix[16] = {
222 OGL_Vertex *vx = (OGL_Vertex *) ilpBuff->vertex_data;
223 OGL_LVertex *l_vx = (OGL_LVertex *) ilpBuff->vertex_data;
224 D3DTLVERTEX *tl_vx = (D3DTLVERTEX *) ilpBuff->vertex_data;
226 TRACE("TRIANGLE (%d)\n", count);
228 switch (ilpBuff->vertex_type) {
230 /* This time, there is lighting */
231 glEnable(GL_LIGHTING);
233 /* Use given matrixes */
234 glMatrixMode(GL_MODELVIEW);
235 glLoadIdentity(); /* The model transformation was done during the
236 transformation phase */
237 glMatrixMode(GL_PROJECTION);
238 TRACE(" Projection Matrix : (%p)\n", odev->proj_mat);
239 dump_mat(odev->proj_mat);
240 TRACE(" View Matrix : (%p)\n", odev->view_mat);
241 dump_mat(odev->view_mat);
243 glLoadMatrixf((float *) z_inv_matrix);
244 glMultMatrixf((float *) odev->proj_mat);
245 glMultMatrixf((float *) odev->view_mat);
250 glDisable(GL_LIGHTING);
252 /* Use given matrixes */
253 glMatrixMode(GL_MODELVIEW);
254 glLoadIdentity(); /* The model transformation was done during the
255 transformation phase */
256 glMatrixMode(GL_PROJECTION);
258 TRACE(" Projection Matrix : (%p)\n", odev->proj_mat);
259 dump_mat(odev->proj_mat);
260 TRACE(" View Matrix : (%p)\n", odev->view_mat);
261 dump_mat(odev->view_mat);
263 glLoadMatrixf((float *) z_inv_matrix);
264 glMultMatrixf((float *) odev->proj_mat);
265 glMultMatrixf((float *) odev->view_mat);
268 case D3DVT_TLVERTEX: {
269 GLdouble height, width, minZ, maxZ;
271 /* First, disable lighting */
272 glDisable(GL_LIGHTING);
274 /* Then do not put any transformation matrixes */
275 glMatrixMode(GL_MODELVIEW);
277 glMatrixMode(GL_PROJECTION);
281 ERR("No current viewport !\n");
282 /* Using standard values */
288 height = (GLdouble) ivp->viewport.vp1.dwHeight;
289 width = (GLdouble) ivp->viewport.vp1.dwWidth;
290 minZ = (GLdouble) ivp->viewport.vp1.dvMinZ;
291 maxZ = (GLdouble) ivp->viewport.vp1.dvMaxZ;
294 /* I do not know why, but many Dx 3.0 games have minZ = maxZ = 0.0 */
300 glOrtho(0.0, width, height, 0.0, -minZ, -maxZ);
304 ERR("Unhandled vertex type !\n");
308 switch (ilpBuff->vertex_type) {
310 TRIANGLE_LOOP(DO_VERTEX);
314 TRIANGLE_LOOP(DO_LVERTEX);
318 TRIANGLE_LOOP(DO_TLVERTEX);
322 ERR("Unhandled vertex type !\n");
327 case D3DOP_MATRIXLOAD: {
328 TRACE("MATRIXLOAD-s (%d)\n", count);
330 instr += count * size;
333 case D3DOP_MATRIXMULTIPLY: {
335 TRACE("MATRIXMULTIPLY (%d)\n", count);
337 for (i = 0; i < count; i++) {
338 LPD3DMATRIXMULTIPLY ci = (LPD3DMATRIXMULTIPLY) instr;
339 LPD3DMATRIX a = (LPD3DMATRIX) ci->hDestMatrix;
340 LPD3DMATRIX b = (LPD3DMATRIX) ci->hSrcMatrix1;
341 LPD3DMATRIX c = (LPD3DMATRIX) ci->hSrcMatrix2;
343 TRACE(" Dest : %08lx Src1 : %08lx Src2 : %08lx\n",
344 ci->hDestMatrix, ci->hSrcMatrix1, ci->hSrcMatrix2);
346 /* Do the multiplication..
347 As I am VERY lazy, I let OpenGL do the multiplication for me */
348 glMatrixMode(GL_PROJECTION);
349 /* Save the current matrix */
351 /* Load Matrix one and do the multiplication */
352 glLoadMatrixf((float *) c);
353 glMultMatrixf((float *) b);
354 glGetFloatv(GL_PROJECTION_MATRIX, (float *) a);
355 /* Restore the current matrix */
362 case D3DOP_STATETRANSFORM: {
364 TRACE("STATETRANSFORM (%d)\n", count);
366 for (i = 0; i < count; i++) {
367 LPD3DSTATE ci = (LPD3DSTATE) instr;
369 /* Handle the state transform */
370 switch (ci->t.dtstTransformStateType) {
371 case D3DTRANSFORMSTATE_WORLD: {
372 TRACE(" WORLD (%p)\n", (D3DMATRIX*) ci->v.dwArg[0]);
373 odev->world_mat = (D3DMATRIX*) ci->v.dwArg[0];
376 case D3DTRANSFORMSTATE_VIEW: {
377 TRACE(" VIEW (%p)\n", (D3DMATRIX*) ci->v.dwArg[0]);
378 odev->view_mat = (D3DMATRIX*) ci->v.dwArg[0];
381 case D3DTRANSFORMSTATE_PROJECTION: {
382 TRACE(" PROJECTION (%p)\n", (D3DMATRIX*) ci->v.dwArg[0]);
383 odev->proj_mat = (D3DMATRIX*) ci->v.dwArg[0];
387 ERR(" Unhandled state transformation !! (%d)\n", (int) ci->t.dtstTransformStateType);
396 case D3DOP_STATELIGHT: {
398 TRACE("STATELIGHT (%d)\n", count);
400 for (i = 0; i < count; i++) {
401 LPD3DSTATE ci = (LPD3DSTATE) instr;
403 /* Handle the state transform */
404 switch (ci->t.dlstLightStateType) {
405 case D3DLIGHTSTATE_MATERIAL: {
406 IDirect3DMaterial2Impl* mat = (IDirect3DMaterial2Impl*) ci->v.dwArg[0];
407 TRACE(" MATERIAL\n");
412 TRACE(" bad Material Handle\n");
416 case D3DLIGHTSTATE_AMBIENT: {
418 DWORD dwLightState = ci->v.dwArg[0];
421 light[0] = ((dwLightState >> 16) & 0xFF) / 255.0;
422 light[1] = ((dwLightState >> 8) & 0xFF) / 255.0;
423 light[2] = ((dwLightState >> 0) & 0xFF) / 255.0;
425 glLightModelfv(GL_LIGHT_MODEL_AMBIENT, (float *) light);
427 TRACE(" R:%02lx G:%02lx B:%02lx A:%02lx\n",
428 ((dwLightState >> 16) & 0xFF),
429 ((dwLightState >> 8) & 0xFF),
430 ((dwLightState >> 0) & 0xFF),
431 ((dwLightState >> 24) & 0xFF));
434 case D3DLIGHTSTATE_COLORMODEL: {
435 TRACE(" COLORMODEL\n");
438 case D3DLIGHTSTATE_FOGMODE: {
442 case D3DLIGHTSTATE_FOGSTART: {
443 TRACE(" FOGSTART\n");
446 case D3DLIGHTSTATE_FOGEND: {
450 case D3DLIGHTSTATE_FOGDENSITY: {
451 TRACE(" FOGDENSITY\n");
455 ERR(" Unhandled light state !! (%d)\n", (int) ci->t.dlstLightStateType);
462 case D3DOP_STATERENDER: {
464 TRACE("STATERENDER (%d)\n", count);
466 for (i = 0; i < count; i++) {
467 LPD3DSTATE ci = (LPD3DSTATE) instr;
469 /* Handle the state transform */
470 set_render_state(ci->t.drstRenderStateType, ci->v.dwArg[0], &(odev->rs));
476 case D3DOP_PROCESSVERTICES: {
478 TRACE("PROCESSVERTICES (%d)\n", count);
480 for (i = 0; i < count; i++) {
481 LPD3DPROCESSVERTICES ci = (LPD3DPROCESSVERTICES) instr;
483 TRACE(" Start : %d Dest : %d Count : %ld\n",
484 ci->wStart, ci->wDest, ci->dwCount);
486 if (TRACE_ON(ddraw)) {
487 if (ci->dwFlags & D3DPROCESSVERTICES_COPY)
489 if (ci->dwFlags & D3DPROCESSVERTICES_NOCOLOR)
491 if (ci->dwFlags == D3DPROCESSVERTICES_OPMASK)
493 if (ci->dwFlags & D3DPROCESSVERTICES_TRANSFORM)
494 DPRINTF("TRANSFORM ");
495 if (ci->dwFlags == D3DPROCESSVERTICES_TRANSFORMLIGHT)
496 DPRINTF("TRANSFORMLIGHT ");
497 if (ci->dwFlags & D3DPROCESSVERTICES_UPDATEEXTENTS)
498 DPRINTF("UPDATEEXTENTS ");
502 /* This is where doing Direct3D on top on OpenGL is quite difficult.
503 This method transforms a set of vertices using the CURRENT state
504 (lighting, projection, ...) but does not rasterize them.
505 They will oinly be put on screen later (with the POINT / LINE and
506 TRIANGLE op-codes). The problem is that you can have a triangle
507 with each point having been transformed using another state...
509 In this implementation, I will emulate only ONE thing : each
510 vertex can have its own "WORLD" transformation (this is used in the
511 TWIST.EXE demo of the 5.2 SDK). I suppose that all vertices of the
512 execute buffer use the same state.
514 If I find applications that change other states, I will try to do a
515 more 'fine-tuned' state emulation (but I may become quite tricky if
516 it changes a light position in the middle of a triangle).
518 In this case, a 'direct' approach (i.e. without using OpenGL, but
519 writing our own 3D rasterizer) would be easier. */
521 /* The current method (with the hypothesis that only the WORLD matrix
522 will change between two points) is like this :
523 - I transform 'manually' all the vertices with the current WORLD
524 matrix and store them in the vertex buffer
525 - during the rasterization phase, the WORLD matrix will be set to
526 the Identity matrix */
528 /* Enough for the moment */
529 if (ci->dwFlags == D3DPROCESSVERTICES_TRANSFORMLIGHT) {
531 D3DVERTEX *src = ((LPD3DVERTEX) (ilpBuff->desc.lpData + vs)) + ci->wStart;
532 OGL_Vertex *dst = ((OGL_Vertex *) (ilpBuff->vertex_data)) + ci->wDest;
533 D3DMATRIX *mat = odev->world_mat;
535 TRACE(" World Matrix : (%p)\n", mat);
538 ilpBuff->vertex_type = D3DVT_VERTEX;
540 for (nb = 0; nb < ci->dwCount; nb++) {
541 /* For the moment, no normal transformation... */
542 dst->nx = src->nx.nx;
543 dst->ny = src->ny.ny;
544 dst->nz = src->nz.nz;
549 /* Now, the matrix multiplication */
550 dst->x = (src->x.x * mat->_11) + (src->y.y * mat->_21) + (src->z.z * mat->_31) + (1.0 * mat->_41);
551 dst->y = (src->x.x * mat->_12) + (src->y.y * mat->_22) + (src->z.z * mat->_32) + (1.0 * mat->_42);
552 dst->z = (src->x.x * mat->_13) + (src->y.y * mat->_23) + (src->z.z * mat->_33) + (1.0 * mat->_43);
553 dst->w = (src->x.x * mat->_14) + (src->y.y * mat->_24) + (src->z.z * mat->_34) + (1.0 * mat->_44);
558 } else if (ci->dwFlags == D3DPROCESSVERTICES_TRANSFORM) {
560 D3DLVERTEX *src = ((LPD3DLVERTEX) (ilpBuff->desc.lpData + vs)) + ci->wStart;
561 OGL_LVertex *dst = ((OGL_LVertex *) (ilpBuff->vertex_data)) + ci->wDest;
562 D3DMATRIX *mat = odev->world_mat;
564 TRACE(" World Matrix : (%p)\n", mat);
567 ilpBuff->vertex_type = D3DVT_LVERTEX;
569 for (nb = 0; nb < ci->dwCount; nb++) {
570 dst->c = src->c.color;
571 dst->sc = src->s.specular;
575 /* Now, the matrix multiplication */
576 dst->x = (src->x.x * mat->_11) + (src->y.y * mat->_21) + (src->z.z * mat->_31) + (1.0 * mat->_41);
577 dst->y = (src->x.x * mat->_12) + (src->y.y * mat->_22) + (src->z.z * mat->_32) + (1.0 * mat->_42);
578 dst->z = (src->x.x * mat->_13) + (src->y.y * mat->_23) + (src->z.z * mat->_33) + (1.0 * mat->_43);
579 dst->w = (src->x.x * mat->_14) + (src->y.y * mat->_24) + (src->z.z * mat->_34) + (1.0 * mat->_44);
584 } else if (ci->dwFlags == D3DPROCESSVERTICES_COPY) {
585 D3DTLVERTEX *src = ((LPD3DTLVERTEX) (ilpBuff->desc.lpData + vs)) + ci->wStart;
586 D3DTLVERTEX *dst = ((LPD3DTLVERTEX) (ilpBuff->vertex_data)) + ci->wDest;
588 ilpBuff->vertex_type = D3DVT_TLVERTEX;
590 memcpy(dst, src, ci->dwCount * sizeof(D3DTLVERTEX));
592 ERR("Unhandled vertex processing !\n");
599 case D3DOP_TEXTURELOAD: {
600 TRACE("TEXTURELOAD-s (%d)\n", count);
602 instr += count * size;
606 TRACE("EXIT (%d)\n", count);
607 /* We did this instruction */
613 case D3DOP_BRANCHFORWARD: {
615 TRACE("BRANCHFORWARD (%d)\n", count);
617 for (i = 0; i < count; i++) {
618 LPD3DBRANCH ci = (LPD3DBRANCH) instr;
620 if ((ilpBuff->data.dsStatus.dwStatus & ci->dwMask) == ci->dwValue) {
622 TRACE(" Should branch to %ld\n", ci->dwOffset);
626 TRACE(" Should branch to %ld\n", ci->dwOffset);
635 TRACE("SPAN-s (%d)\n", count);
637 instr += count * size;
640 case D3DOP_SETSTATUS: {
642 TRACE("SETSTATUS (%d)\n", count);
644 for (i = 0; i < count; i++) {
645 LPD3DSTATUS ci = (LPD3DSTATUS) instr;
647 ilpBuff->data.dsStatus = *ci;
654 ERR("Unhandled OpCode !!!\n");
655 /* Try to save ... */
656 instr += count * size;
665 /*******************************************************************************
666 * ExecuteBuffer Creation functions
668 LPDIRECT3DEXECUTEBUFFER d3dexecutebuffer_create(IDirect3DDeviceImpl* d3ddev, LPD3DEXECUTEBUFFERDESC lpDesc)
670 IDirect3DExecuteBufferImpl* eb;
672 eb = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DExecuteBufferImpl));
674 ICOM_VTBL(eb) = &executebuffer_vtable;
677 /* Initializes memory */
680 /* No buffer given */
681 if (!(eb->desc.dwFlags & D3DDEB_LPDATA))
682 eb->desc.lpData = NULL;
684 /* No buffer size given */
685 if (!(lpDesc->dwFlags & D3DDEB_BUFSIZE))
686 eb->desc.dwBufferSize = 0;
688 /* Create buffer if asked */
689 if ((eb->desc.lpData == NULL) && (eb->desc.dwBufferSize > 0)) {
690 eb->need_free = TRUE;
691 eb->desc.lpData = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,eb->desc.dwBufferSize);
693 eb->need_free = FALSE;
696 /* No vertices for the moment */
697 eb->vertex_data = NULL;
699 eb->desc.dwFlags |= D3DDEB_LPDATA;
701 eb->execute = execute;
703 return (LPDIRECT3DEXECUTEBUFFER)eb;
706 /*******************************************************************************
707 * IDirect3ExecuteBuffer methods
710 static HRESULT WINAPI IDirect3DExecuteBufferImpl_QueryInterface(LPDIRECT3DEXECUTEBUFFER iface,
714 ICOM_THIS(IDirect3DExecuteBufferImpl,iface);
716 FIXME("(%p)->(%s,%p): stub\n", This, debugstr_guid(riid),ppvObj);
723 static ULONG WINAPI IDirect3DExecuteBufferImpl_AddRef(LPDIRECT3DEXECUTEBUFFER iface)
725 ICOM_THIS(IDirect3DExecuteBufferImpl,iface);
726 TRACE("(%p)->()incrementing from %lu.\n", This, This->ref );
728 return ++(This->ref);
733 static ULONG WINAPI IDirect3DExecuteBufferImpl_Release(LPDIRECT3DEXECUTEBUFFER iface)
735 ICOM_THIS(IDirect3DExecuteBufferImpl,iface);
736 FIXME("(%p)->() decrementing from %lu.\n", This, This->ref );
738 if (!--(This->ref)) {
739 if ((This->desc.lpData != NULL) && This->need_free)
740 HeapFree(GetProcessHeap(),0,This->desc.lpData);
742 if (This->vertex_data != NULL)
743 HeapFree(GetProcessHeap(),0,This->vertex_data);
745 HeapFree(GetProcessHeap(),0,This);
752 static HRESULT WINAPI IDirect3DExecuteBufferImpl_Initialize(LPDIRECT3DEXECUTEBUFFER iface,
753 LPDIRECT3DDEVICE lpDirect3DDevice,
754 LPD3DEXECUTEBUFFERDESC lpDesc)
756 ICOM_THIS(IDirect3DExecuteBufferImpl,iface);
757 FIXME("(%p)->(%p,%p): stub\n", This, lpDirect3DDevice, lpDesc);
762 static HRESULT WINAPI IDirect3DExecuteBufferImpl_Lock(LPDIRECT3DEXECUTEBUFFER iface,
763 LPD3DEXECUTEBUFFERDESC lpDesc)
765 ICOM_THIS(IDirect3DExecuteBufferImpl,iface);
766 TRACE("(%p)->(%p)\n", This, lpDesc);
768 /* Copies the buffer description */
769 *lpDesc = This->desc;
774 static HRESULT WINAPI IDirect3DExecuteBufferImpl_Unlock(LPDIRECT3DEXECUTEBUFFER iface)
776 ICOM_THIS(IDirect3DExecuteBufferImpl,iface);
777 TRACE("(%p)->()\n", This);
782 static HRESULT WINAPI IDirect3DExecuteBufferImpl_SetExecuteData(LPDIRECT3DEXECUTEBUFFER iface,
783 LPD3DEXECUTEDATA lpData)
785 ICOM_THIS(IDirect3DExecuteBufferImpl,iface);
788 TRACE("(%p)->(%p)\n", This, lpData);
790 This->data = *lpData;
792 /* Get the number of vertices in the execute buffer */
793 nbvert = This->data.dwVertexCount;
795 /* Prepares the transformed vertex buffer */
796 if (This->vertex_data != NULL)
797 HeapFree(GetProcessHeap(), 0, This->vertex_data);
798 This->vertex_data = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,nbvert * sizeof(OGL_Vertex));
801 if (TRACE_ON(ddraw)) {
802 _dump_executedata(lpData);
808 static HRESULT WINAPI IDirect3DExecuteBufferImpl_GetExecuteData(LPDIRECT3DEXECUTEBUFFER iface,
809 LPD3DEXECUTEDATA lpData)
811 ICOM_THIS(IDirect3DExecuteBufferImpl,iface);
812 TRACE("(%p)->(%p): stub\n", This, lpData);
814 *lpData = This->data;
819 static HRESULT WINAPI IDirect3DExecuteBufferImpl_Validate(LPDIRECT3DEXECUTEBUFFER iface,
821 LPD3DVALIDATECALLBACK lpFunc,
825 ICOM_THIS(IDirect3DExecuteBufferImpl,iface);
826 TRACE("(%p)->(%p,%p,%p,%lu)\n", This, lpdwOffset, lpFunc, lpUserArg, dwReserved);
831 static HRESULT WINAPI IDirect3DExecuteBufferImpl_Optimize(LPDIRECT3DEXECUTEBUFFER iface,
834 ICOM_THIS(IDirect3DExecuteBufferImpl,iface);
835 TRACE("(%p)->(%lu)\n", This, dwReserved);
841 /*******************************************************************************
842 * IDirect3DLight VTable
844 static ICOM_VTABLE(IDirect3DExecuteBuffer) executebuffer_vtable =
846 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
847 /*** IUnknown methods ***/
848 IDirect3DExecuteBufferImpl_QueryInterface,
849 IDirect3DExecuteBufferImpl_AddRef,
850 IDirect3DExecuteBufferImpl_Release,
851 /*** IDirect3DExecuteBuffer methods ***/
852 IDirect3DExecuteBufferImpl_Initialize,
853 IDirect3DExecuteBufferImpl_Lock,
854 IDirect3DExecuteBufferImpl_Unlock,
855 IDirect3DExecuteBufferImpl_SetExecuteData,
856 IDirect3DExecuteBufferImpl_GetExecuteData,
857 IDirect3DExecuteBufferImpl_Validate,
858 IDirect3DExecuteBufferImpl_Optimize