1 /* Direct3D ExecuteBuffer
4 This files contains the implementation of Direct3DExecuteBuffer. */
13 #include "wine/obj_base.h"
16 #include "debugtools.h"
18 #include "mesa_private.h"
20 #define D3DDPRIVATE(x) mesa_d3dd_private *odev=((mesa_d3dd_private*)(x)->private)
22 DEFAULT_DEBUG_CHANNEL(ddraw);
24 /* Structure to store the 'semi transformed' vertices */
52 static ICOM_VTABLE(IDirect3DExecuteBuffer) executebuffer_vtable;
54 /*******************************************************************************
55 * ExecuteBuffer static functions
57 void _dump_d3dstatus(LPD3DSTATUS lpStatus) {
61 void _dump_executedata(LPD3DEXECUTEDATA lpData) {
62 DPRINTF("dwSize : %ld\n", lpData->dwSize);
63 DPRINTF("Vertex Offset : %ld Count : %ld\n", lpData->dwVertexOffset, lpData->dwVertexCount);
64 DPRINTF("Instruction Offset : %ld Length : %ld\n", lpData->dwInstructionOffset, lpData->dwInstructionLength);
65 DPRINTF("HVertex Offset : %ld\n", lpData->dwHVertexOffset);
66 _dump_d3dstatus(&(lpData->dsStatus));
69 #define DO_VERTEX(index) \
71 glTexCoord2f(vx[index].u, \
73 glNormal3f(vx[index].nx, \
76 glVertex4f(vx[index].x, \
81 TRACE(" V: %f %f %f %f (%f %f %f) (%f %f)\n", \
82 vx[index].x, vx[index].y, vx[index].z, vx[index].w, \
83 vx[index].nx, vx[index].ny, vx[index].nz, \
84 vx[index].u, vx[index].v); \
87 #define DO_LVERTEX(index) \
89 DWORD col = l_vx[index].c; \
91 glColor3f(((col >> 16) & 0xFF) / 255.0, \
92 ((col >> 8) & 0xFF) / 255.0, \
93 ((col >> 0) & 0xFF) / 255.0); \
94 glTexCoord2f(l_vx[index].u, \
96 glVertex4f(l_vx[index].x, \
101 TRACE(" LV: %f %f %f %f (%02lx %02lx %02lx) (%f %f)\n", \
102 l_vx[index].x, l_vx[index].y, l_vx[index].z, l_vx[index].w, \
103 ((col >> 16) & 0xFF), ((col >> 8) & 0xFF), ((col >> 0) & 0xFF), \
104 l_vx[index].u, l_vx[index].v); \
107 #define DO_TLVERTEX(index) \
109 D3DTLVERTEX *vx = &(tl_vx[index]); \
110 DWORD col = vx->u5.color; \
112 glColor3f(((col >> 16) & 0xFF) / 255.0, \
113 ((col >> 8) & 0xFF) / 255.0, \
114 ((col >> 0) & 0xFF) / 255.0); \
115 glTexCoord2f(vx->u7.tu, vx->u8.tv); \
116 if (vx->u4.rhw < 0.01) \
117 glVertex3f(vx->u1.sx, \
121 glVertex4f(vx->u1.sx / vx->u4.rhw, \
122 vx->u2.sy / vx->u4.rhw, \
123 vx->u3.sz / vx->u4.rhw, \
125 TRACE(" TLV: %f %f %f (%02lx %02lx %02lx) (%f %f) (%f)\n", \
126 vx->u1.sx, vx->u2.sy, vx->u3.sz, \
127 ((col >> 16) & 0xFF), ((col >> 8) & 0xFF), ((col >> 0) & 0xFF), \
128 vx->u7.tu, vx->u8.tv, vx->u4.rhw); \
131 #define TRIANGLE_LOOP(macro) \
133 glBegin(GL_TRIANGLES); { \
134 for (i = 0; i < count; i++) { \
135 LPD3DTRIANGLE ci = (LPD3DTRIANGLE) instr; \
137 TRACE(" v1: %d v2: %d v3: %d\n", \
138 ci->u1.v1, ci->u2.v2, ci->u3.v3); \
139 TRACE(" Flags : "); \
140 if (TRACE_ON(ddraw)) { \
142 if (ci->wFlags & D3DTRIFLAG_EDGEENABLE1) \
143 DPRINTF("EDGEENABLE1 "); \
144 if (ci->wFlags & D3DTRIFLAG_EDGEENABLE2) \
145 DPRINTF("EDGEENABLE2 "); \
146 if (ci->wFlags & D3DTRIFLAG_EDGEENABLE1) \
147 DPRINTF("EDGEENABLE3 "); \
149 /* Strips / Fans */ \
150 if (ci->wFlags == D3DTRIFLAG_EVEN) \
152 if (ci->wFlags == D3DTRIFLAG_ODD) \
154 if (ci->wFlags == D3DTRIFLAG_START) \
156 if ((ci->wFlags > 0) && (ci->wFlags < 30)) \
157 DPRINTF("STARTFLAT(%d) ", ci->wFlags); \
161 /* Draw the triangle */ \
172 static void execute(LPDIRECT3DEXECUTEBUFFER lpBuff,
173 LPDIRECT3DDEVICE dev,
174 LPDIRECT3DVIEWPORT vp) {
175 IDirect3DExecuteBufferImpl* ilpBuff=(IDirect3DExecuteBufferImpl*)lpBuff;
176 IDirect3DViewport2Impl* ivp=(IDirect3DViewport2Impl*)vp;
177 /* DWORD bs = ilpBuff->desc.dwBufferSize; */
178 DWORD vs = ilpBuff->data.dwVertexOffset;
179 /* DWORD vc = ilpBuff->data.dwVertexCount; */
180 DWORD is = ilpBuff->data.dwInstructionOffset;
181 /* DWORD il = ilpBuff->data.dwInstructionLength; */
183 void *instr = ilpBuff->desc.lpData + is;
184 D3DDPRIVATE((IDirect3DDeviceImpl*)dev);
186 TRACE("ExecuteData : \n");
188 _dump_executedata(&(ilpBuff->data));
193 LPD3DINSTRUCTION current = (LPD3DINSTRUCTION) instr;
197 count = current->wCount;
198 size = current->bSize;
199 instr += sizeof(D3DINSTRUCTION);
201 switch (current->bOpcode) {
203 TRACE("POINT-s (%d)\n", count);
205 instr += count * size;
209 TRACE("LINE-s (%d)\n", count);
211 instr += count * size;
214 case D3DOP_TRIANGLE: {
216 float z_inv_matrix[16] = {
223 OGL_Vertex *vx = (OGL_Vertex *) ilpBuff->vertex_data;
224 OGL_LVertex *l_vx = (OGL_LVertex *) ilpBuff->vertex_data;
225 D3DTLVERTEX *tl_vx = (D3DTLVERTEX *) ilpBuff->vertex_data;
227 TRACE("TRIANGLE (%d)\n", count);
229 switch (ilpBuff->vertex_type) {
231 /* This time, there is lighting */
232 glEnable(GL_LIGHTING);
234 /* Use given matrixes */
235 glMatrixMode(GL_MODELVIEW);
236 glLoadIdentity(); /* The model transformation was done during the
237 transformation phase */
238 glMatrixMode(GL_PROJECTION);
239 TRACE(" Projection Matrix : (%p)\n", odev->proj_mat);
240 dump_mat(odev->proj_mat);
241 TRACE(" View Matrix : (%p)\n", odev->view_mat);
242 dump_mat(odev->view_mat);
244 glLoadMatrixf((float *) z_inv_matrix);
245 glMultMatrixf((float *) odev->proj_mat);
246 glMultMatrixf((float *) odev->view_mat);
251 glDisable(GL_LIGHTING);
253 /* Use given matrixes */
254 glMatrixMode(GL_MODELVIEW);
255 glLoadIdentity(); /* The model transformation was done during the
256 transformation phase */
257 glMatrixMode(GL_PROJECTION);
259 TRACE(" Projection Matrix : (%p)\n", odev->proj_mat);
260 dump_mat(odev->proj_mat);
261 TRACE(" View Matrix : (%p)\n", odev->view_mat);
262 dump_mat(odev->view_mat);
264 glLoadMatrixf((float *) z_inv_matrix);
265 glMultMatrixf((float *) odev->proj_mat);
266 glMultMatrixf((float *) odev->view_mat);
269 case D3DVT_TLVERTEX: {
270 GLdouble height, width, minZ, maxZ;
272 /* First, disable lighting */
273 glDisable(GL_LIGHTING);
275 /* Then do not put any transformation matrixes */
276 glMatrixMode(GL_MODELVIEW);
278 glMatrixMode(GL_PROJECTION);
282 ERR("No current viewport !\n");
283 /* Using standard values */
289 height = (GLdouble) ivp->viewport.vp1.dwHeight;
290 width = (GLdouble) ivp->viewport.vp1.dwWidth;
291 minZ = (GLdouble) ivp->viewport.vp1.dvMinZ;
292 maxZ = (GLdouble) ivp->viewport.vp1.dvMaxZ;
295 /* I do not know why, but many Dx 3.0 games have minZ = maxZ = 0.0 */
301 glOrtho(0.0, width, height, 0.0, -minZ, -maxZ);
305 ERR("Unhandled vertex type !\n");
309 switch (ilpBuff->vertex_type) {
311 TRIANGLE_LOOP(DO_VERTEX);
315 TRIANGLE_LOOP(DO_LVERTEX);
319 TRIANGLE_LOOP(DO_TLVERTEX);
323 ERR("Unhandled vertex type !\n");
328 case D3DOP_MATRIXLOAD: {
329 TRACE("MATRIXLOAD-s (%d)\n", count);
331 instr += count * size;
334 case D3DOP_MATRIXMULTIPLY: {
336 TRACE("MATRIXMULTIPLY (%d)\n", count);
338 for (i = 0; i < count; i++) {
339 LPD3DMATRIXMULTIPLY ci = (LPD3DMATRIXMULTIPLY) instr;
340 LPD3DMATRIX a = (LPD3DMATRIX) ci->hDestMatrix;
341 LPD3DMATRIX b = (LPD3DMATRIX) ci->hSrcMatrix1;
342 LPD3DMATRIX c = (LPD3DMATRIX) ci->hSrcMatrix2;
344 TRACE(" Dest : %08lx Src1 : %08lx Src2 : %08lx\n",
345 ci->hDestMatrix, ci->hSrcMatrix1, ci->hSrcMatrix2);
347 /* Do the multiplication..
348 As I am VERY lazy, I let OpenGL do the multiplication for me */
349 glMatrixMode(GL_PROJECTION);
350 /* Save the current matrix */
352 /* Load Matrix one and do the multiplication */
353 glLoadMatrixf((float *) c);
354 glMultMatrixf((float *) b);
355 glGetFloatv(GL_PROJECTION_MATRIX, (float *) a);
356 /* Restore the current matrix */
363 case D3DOP_STATETRANSFORM: {
365 TRACE("STATETRANSFORM (%d)\n", count);
367 for (i = 0; i < count; i++) {
368 LPD3DSTATE ci = (LPD3DSTATE) instr;
370 /* Handle the state transform */
371 switch (ci->u1.dtstTransformStateType) {
372 case D3DTRANSFORMSTATE_WORLD: {
373 TRACE(" WORLD (%p)\n", (D3DMATRIX*) ci->u2.dwArg[0]);
374 odev->world_mat = (D3DMATRIX*) ci->u2.dwArg[0];
377 case D3DTRANSFORMSTATE_VIEW: {
378 TRACE(" VIEW (%p)\n", (D3DMATRIX*) ci->u2.dwArg[0]);
379 odev->view_mat = (D3DMATRIX*) ci->u2.dwArg[0];
382 case D3DTRANSFORMSTATE_PROJECTION: {
383 TRACE(" PROJECTION (%p)\n", (D3DMATRIX*) ci->u2.dwArg[0]);
384 odev->proj_mat = (D3DMATRIX*) ci->u2.dwArg[0];
388 ERR(" Unhandled state transformation !! (%d)\n", (int) ci->u1.dtstTransformStateType);
397 case D3DOP_STATELIGHT: {
399 TRACE("STATELIGHT (%d)\n", count);
401 for (i = 0; i < count; i++) {
402 LPD3DSTATE ci = (LPD3DSTATE) instr;
404 /* Handle the state transform */
405 switch (ci->u1.dlstLightStateType) {
406 case D3DLIGHTSTATE_MATERIAL: {
407 IDirect3DMaterial2Impl* mat = (IDirect3DMaterial2Impl*) ci->u2.dwArg[0];
408 TRACE(" MATERIAL\n");
413 TRACE(" bad Material Handle\n");
417 case D3DLIGHTSTATE_AMBIENT: {
419 DWORD dwLightState = ci->u2.dwArg[0];
422 light[0] = ((dwLightState >> 16) & 0xFF) / 255.0;
423 light[1] = ((dwLightState >> 8) & 0xFF) / 255.0;
424 light[2] = ((dwLightState >> 0) & 0xFF) / 255.0;
426 glLightModelfv(GL_LIGHT_MODEL_AMBIENT, (float *) light);
428 TRACE(" R:%02lx G:%02lx B:%02lx A:%02lx\n",
429 ((dwLightState >> 16) & 0xFF),
430 ((dwLightState >> 8) & 0xFF),
431 ((dwLightState >> 0) & 0xFF),
432 ((dwLightState >> 24) & 0xFF));
435 case D3DLIGHTSTATE_COLORMODEL: {
436 TRACE(" COLORMODEL\n");
439 case D3DLIGHTSTATE_FOGMODE: {
443 case D3DLIGHTSTATE_FOGSTART: {
444 TRACE(" FOGSTART\n");
447 case D3DLIGHTSTATE_FOGEND: {
451 case D3DLIGHTSTATE_FOGDENSITY: {
452 TRACE(" FOGDENSITY\n");
456 ERR(" Unhandled light state !! (%d)\n", (int) ci->u1.dlstLightStateType);
463 case D3DOP_STATERENDER: {
465 TRACE("STATERENDER (%d)\n", count);
467 for (i = 0; i < count; i++) {
468 LPD3DSTATE ci = (LPD3DSTATE) instr;
470 /* Handle the state transform */
471 set_render_state(ci->u1.drstRenderStateType, ci->u2.dwArg[0], &(odev->rs));
477 case D3DOP_PROCESSVERTICES: {
479 TRACE("PROCESSVERTICES (%d)\n", count);
481 for (i = 0; i < count; i++) {
482 LPD3DPROCESSVERTICES ci = (LPD3DPROCESSVERTICES) instr;
484 TRACE(" Start : %d Dest : %d Count : %ld\n",
485 ci->wStart, ci->wDest, ci->dwCount);
487 if (TRACE_ON(ddraw)) {
488 if (ci->dwFlags & D3DPROCESSVERTICES_COPY)
490 if (ci->dwFlags & D3DPROCESSVERTICES_NOCOLOR)
492 if (ci->dwFlags == D3DPROCESSVERTICES_OPMASK)
494 if (ci->dwFlags & D3DPROCESSVERTICES_TRANSFORM)
495 DPRINTF("TRANSFORM ");
496 if (ci->dwFlags == D3DPROCESSVERTICES_TRANSFORMLIGHT)
497 DPRINTF("TRANSFORMLIGHT ");
498 if (ci->dwFlags & D3DPROCESSVERTICES_UPDATEEXTENTS)
499 DPRINTF("UPDATEEXTENTS ");
503 /* This is where doing Direct3D on top on OpenGL is quite difficult.
504 This method transforms a set of vertices using the CURRENT state
505 (lighting, projection, ...) but does not rasterize them.
506 They will oinly be put on screen later (with the POINT / LINE and
507 TRIANGLE op-codes). The problem is that you can have a triangle
508 with each point having been transformed using another state...
510 In this implementation, I will emulate only ONE thing : each
511 vertex can have its own "WORLD" transformation (this is used in the
512 TWIST.EXE demo of the 5.2 SDK). I suppose that all vertices of the
513 execute buffer use the same state.
515 If I find applications that change other states, I will try to do a
516 more 'fine-tuned' state emulation (but I may become quite tricky if
517 it changes a light position in the middle of a triangle).
519 In this case, a 'direct' approach (i.e. without using OpenGL, but
520 writing our own 3D rasterizer) would be easier. */
522 /* The current method (with the hypothesis that only the WORLD matrix
523 will change between two points) is like this :
524 - I transform 'manually' all the vertices with the current WORLD
525 matrix and store them in the vertex buffer
526 - during the rasterization phase, the WORLD matrix will be set to
527 the Identity matrix */
529 /* Enough for the moment */
530 if (ci->dwFlags == D3DPROCESSVERTICES_TRANSFORMLIGHT) {
532 D3DVERTEX *src = ((LPD3DVERTEX) (ilpBuff->desc.lpData + vs)) + ci->wStart;
533 OGL_Vertex *dst = ((OGL_Vertex *) (ilpBuff->vertex_data)) + ci->wDest;
534 D3DMATRIX *mat = odev->world_mat;
536 TRACE(" World Matrix : (%p)\n", mat);
539 ilpBuff->vertex_type = D3DVT_VERTEX;
541 for (nb = 0; nb < ci->dwCount; nb++) {
542 /* For the moment, no normal transformation... */
543 dst->nx = src->u4.nx;
544 dst->ny = src->u5.ny;
545 dst->nz = src->u6.nz;
550 /* Now, the matrix multiplication */
551 dst->x = (src->u1.x * mat->_11) + (src->u2.y * mat->_21) + (src->u3.z * mat->_31) + (1.0 * mat->_41);
552 dst->y = (src->u1.x * mat->_12) + (src->u2.y * mat->_22) + (src->u3.z * mat->_32) + (1.0 * mat->_42);
553 dst->z = (src->u1.x * mat->_13) + (src->u2.y * mat->_23) + (src->u3.z * mat->_33) + (1.0 * mat->_43);
554 dst->w = (src->u1.x * mat->_14) + (src->u2.y * mat->_24) + (src->u3.z * mat->_34) + (1.0 * mat->_44);
559 } else if (ci->dwFlags == D3DPROCESSVERTICES_TRANSFORM) {
561 D3DLVERTEX *src = ((LPD3DLVERTEX) (ilpBuff->desc.lpData + vs)) + ci->wStart;
562 OGL_LVertex *dst = ((OGL_LVertex *) (ilpBuff->vertex_data)) + ci->wDest;
563 D3DMATRIX *mat = odev->world_mat;
565 TRACE(" World Matrix : (%p)\n", mat);
568 ilpBuff->vertex_type = D3DVT_LVERTEX;
570 for (nb = 0; nb < ci->dwCount; nb++) {
571 dst->c = src->u4.color;
572 dst->sc = src->u5.specular;
576 /* Now, the matrix multiplication */
577 dst->x = (src->u1.x * mat->_11) + (src->u2.y * mat->_21) + (src->u3.z * mat->_31) + (1.0 * mat->_41);
578 dst->y = (src->u1.x * mat->_12) + (src->u2.y * mat->_22) + (src->u3.z * mat->_32) + (1.0 * mat->_42);
579 dst->z = (src->u1.x * mat->_13) + (src->u2.y * mat->_23) + (src->u3.z * mat->_33) + (1.0 * mat->_43);
580 dst->w = (src->u1.x * mat->_14) + (src->u2.y * mat->_24) + (src->u3.z * mat->_34) + (1.0 * mat->_44);
585 } else if (ci->dwFlags == D3DPROCESSVERTICES_COPY) {
586 D3DTLVERTEX *src = ((LPD3DTLVERTEX) (ilpBuff->desc.lpData + vs)) + ci->wStart;
587 D3DTLVERTEX *dst = ((LPD3DTLVERTEX) (ilpBuff->vertex_data)) + ci->wDest;
589 ilpBuff->vertex_type = D3DVT_TLVERTEX;
591 memcpy(dst, src, ci->dwCount * sizeof(D3DTLVERTEX));
593 ERR("Unhandled vertex processing !\n");
600 case D3DOP_TEXTURELOAD: {
601 TRACE("TEXTURELOAD-s (%d)\n", count);
603 instr += count * size;
607 TRACE("EXIT (%d)\n", count);
608 /* We did this instruction */
614 case D3DOP_BRANCHFORWARD: {
616 TRACE("BRANCHFORWARD (%d)\n", count);
618 for (i = 0; i < count; i++) {
619 LPD3DBRANCH ci = (LPD3DBRANCH) instr;
621 if ((ilpBuff->data.dsStatus.dwStatus & ci->dwMask) == ci->dwValue) {
623 TRACE(" Should branch to %ld\n", ci->dwOffset);
627 TRACE(" Should branch to %ld\n", ci->dwOffset);
636 TRACE("SPAN-s (%d)\n", count);
638 instr += count * size;
641 case D3DOP_SETSTATUS: {
643 TRACE("SETSTATUS (%d)\n", count);
645 for (i = 0; i < count; i++) {
646 LPD3DSTATUS ci = (LPD3DSTATUS) instr;
648 ilpBuff->data.dsStatus = *ci;
655 ERR("Unhandled OpCode !!!\n");
656 /* Try to save ... */
657 instr += count * size;
666 /*******************************************************************************
667 * ExecuteBuffer Creation functions
669 LPDIRECT3DEXECUTEBUFFER d3dexecutebuffer_create(IDirect3DDeviceImpl* d3ddev, LPD3DEXECUTEBUFFERDESC lpDesc)
671 IDirect3DExecuteBufferImpl* eb;
673 eb = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DExecuteBufferImpl));
675 ICOM_VTBL(eb) = &executebuffer_vtable;
678 /* Initializes memory */
681 /* No buffer given */
682 if (!(eb->desc.dwFlags & D3DDEB_LPDATA))
683 eb->desc.lpData = NULL;
685 /* No buffer size given */
686 if (!(lpDesc->dwFlags & D3DDEB_BUFSIZE))
687 eb->desc.dwBufferSize = 0;
689 /* Create buffer if asked */
690 if ((eb->desc.lpData == NULL) && (eb->desc.dwBufferSize > 0)) {
691 eb->need_free = TRUE;
692 eb->desc.lpData = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,eb->desc.dwBufferSize);
694 eb->need_free = FALSE;
697 /* No vertices for the moment */
698 eb->vertex_data = NULL;
700 eb->desc.dwFlags |= D3DDEB_LPDATA;
702 eb->execute = execute;
704 return (LPDIRECT3DEXECUTEBUFFER)eb;
707 /*******************************************************************************
708 * IDirect3ExecuteBuffer methods
711 static HRESULT WINAPI IDirect3DExecuteBufferImpl_QueryInterface(LPDIRECT3DEXECUTEBUFFER iface,
715 ICOM_THIS(IDirect3DExecuteBufferImpl,iface);
717 FIXME("(%p)->(%s,%p): stub\n", This, debugstr_guid(riid),ppvObj);
724 static ULONG WINAPI IDirect3DExecuteBufferImpl_AddRef(LPDIRECT3DEXECUTEBUFFER iface)
726 ICOM_THIS(IDirect3DExecuteBufferImpl,iface);
727 TRACE("(%p)->()incrementing from %lu.\n", This, This->ref );
729 return ++(This->ref);
734 static ULONG WINAPI IDirect3DExecuteBufferImpl_Release(LPDIRECT3DEXECUTEBUFFER iface)
736 ICOM_THIS(IDirect3DExecuteBufferImpl,iface);
737 FIXME("(%p)->() decrementing from %lu.\n", This, This->ref );
739 if (!--(This->ref)) {
740 if ((This->desc.lpData != NULL) && This->need_free)
741 HeapFree(GetProcessHeap(),0,This->desc.lpData);
743 if (This->vertex_data != NULL)
744 HeapFree(GetProcessHeap(),0,This->vertex_data);
746 HeapFree(GetProcessHeap(),0,This);
753 static HRESULT WINAPI IDirect3DExecuteBufferImpl_Initialize(LPDIRECT3DEXECUTEBUFFER iface,
754 LPDIRECT3DDEVICE lpDirect3DDevice,
755 LPD3DEXECUTEBUFFERDESC lpDesc)
757 ICOM_THIS(IDirect3DExecuteBufferImpl,iface);
758 FIXME("(%p)->(%p,%p): stub\n", This, lpDirect3DDevice, lpDesc);
763 static HRESULT WINAPI IDirect3DExecuteBufferImpl_Lock(LPDIRECT3DEXECUTEBUFFER iface,
764 LPD3DEXECUTEBUFFERDESC lpDesc)
766 ICOM_THIS(IDirect3DExecuteBufferImpl,iface);
767 TRACE("(%p)->(%p)\n", This, lpDesc);
769 /* Copies the buffer description */
770 *lpDesc = This->desc;
775 static HRESULT WINAPI IDirect3DExecuteBufferImpl_Unlock(LPDIRECT3DEXECUTEBUFFER iface)
777 ICOM_THIS(IDirect3DExecuteBufferImpl,iface);
778 TRACE("(%p)->()\n", This);
783 static HRESULT WINAPI IDirect3DExecuteBufferImpl_SetExecuteData(LPDIRECT3DEXECUTEBUFFER iface,
784 LPD3DEXECUTEDATA lpData)
786 ICOM_THIS(IDirect3DExecuteBufferImpl,iface);
789 TRACE("(%p)->(%p)\n", This, lpData);
791 This->data = *lpData;
793 /* Get the number of vertices in the execute buffer */
794 nbvert = This->data.dwVertexCount;
796 /* Prepares the transformed vertex buffer */
797 if (This->vertex_data != NULL)
798 HeapFree(GetProcessHeap(), 0, This->vertex_data);
799 This->vertex_data = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,nbvert * sizeof(OGL_Vertex));
802 if (TRACE_ON(ddraw)) {
803 _dump_executedata(lpData);
809 static HRESULT WINAPI IDirect3DExecuteBufferImpl_GetExecuteData(LPDIRECT3DEXECUTEBUFFER iface,
810 LPD3DEXECUTEDATA lpData)
812 ICOM_THIS(IDirect3DExecuteBufferImpl,iface);
813 TRACE("(%p)->(%p): stub\n", This, lpData);
815 *lpData = This->data;
820 static HRESULT WINAPI IDirect3DExecuteBufferImpl_Validate(LPDIRECT3DEXECUTEBUFFER iface,
822 LPD3DVALIDATECALLBACK lpFunc,
826 ICOM_THIS(IDirect3DExecuteBufferImpl,iface);
827 TRACE("(%p)->(%p,%p,%p,%lu)\n", This, lpdwOffset, lpFunc, lpUserArg, dwReserved);
832 static HRESULT WINAPI IDirect3DExecuteBufferImpl_Optimize(LPDIRECT3DEXECUTEBUFFER iface,
835 ICOM_THIS(IDirect3DExecuteBufferImpl,iface);
836 TRACE("(%p)->(%lu)\n", This, dwReserved);
842 /*******************************************************************************
843 * IDirect3DLight VTable
845 static ICOM_VTABLE(IDirect3DExecuteBuffer) executebuffer_vtable =
847 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
848 /*** IUnknown methods ***/
849 IDirect3DExecuteBufferImpl_QueryInterface,
850 IDirect3DExecuteBufferImpl_AddRef,
851 IDirect3DExecuteBufferImpl_Release,
852 /*** IDirect3DExecuteBuffer methods ***/
853 IDirect3DExecuteBufferImpl_Initialize,
854 IDirect3DExecuteBufferImpl_Lock,
855 IDirect3DExecuteBufferImpl_Unlock,
856 IDirect3DExecuteBufferImpl_SetExecuteData,
857 IDirect3DExecuteBufferImpl_GetExecuteData,
858 IDirect3DExecuteBufferImpl_Validate,
859 IDirect3DExecuteBufferImpl_Optimize