Commit 4d1a659c authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

ddraw: Get rid of IDirect3DExecuteBufferImpl.

parent 53b3f9d4
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
extern const struct wined3d_parent_ops ddraw_null_wined3d_parent_ops DECLSPEC_HIDDEN; extern const struct wined3d_parent_ops ddraw_null_wined3d_parent_ops DECLSPEC_HIDDEN;
/* Typdef the interfaces */ /* Typdef the interfaces */
typedef struct IDirect3DExecuteBufferImpl IDirect3DExecuteBufferImpl;
typedef struct IDirect3DVertexBufferImpl IDirect3DVertexBufferImpl; typedef struct IDirect3DVertexBufferImpl IDirect3DVertexBufferImpl;
extern DWORD force_refresh_rate DECLSPEC_HIDDEN; extern DWORD force_refresh_rate DECLSPEC_HIDDEN;
...@@ -488,7 +487,7 @@ void d3d_viewport_init(struct d3d_viewport *viewport, struct ddraw *ddraw) DECLS ...@@ -488,7 +487,7 @@ void d3d_viewport_init(struct d3d_viewport *viewport, struct ddraw *ddraw) DECLS
/***************************************************************************** /*****************************************************************************
* IDirect3DExecuteBuffer - Wraps to D3D7 * IDirect3DExecuteBuffer - Wraps to D3D7
*****************************************************************************/ *****************************************************************************/
struct IDirect3DExecuteBufferImpl struct d3d_execute_buffer
{ {
IDirect3DExecuteBuffer IDirect3DExecuteBuffer_iface; IDirect3DExecuteBuffer IDirect3DExecuteBuffer_iface;
LONG ref; LONG ref;
...@@ -510,12 +509,12 @@ struct IDirect3DExecuteBufferImpl ...@@ -510,12 +509,12 @@ struct IDirect3DExecuteBufferImpl
BOOL need_free; BOOL need_free;
}; };
HRESULT d3d_execute_buffer_init(IDirect3DExecuteBufferImpl *execute_buffer, HRESULT d3d_execute_buffer_init(struct d3d_execute_buffer *execute_buffer,
struct d3d_device *device, D3DEXECUTEBUFFERDESC *desc) DECLSPEC_HIDDEN; struct d3d_device *device, D3DEXECUTEBUFFERDESC *desc) DECLSPEC_HIDDEN;
IDirect3DExecuteBufferImpl *unsafe_impl_from_IDirect3DExecuteBuffer(IDirect3DExecuteBuffer *iface) DECLSPEC_HIDDEN; struct d3d_execute_buffer *unsafe_impl_from_IDirect3DExecuteBuffer(IDirect3DExecuteBuffer *iface) DECLSPEC_HIDDEN;
/* The execute function */ /* The execute function */
HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *execute_buffer, HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *execute_buffer,
struct d3d_device *device, struct d3d_viewport *viewport) DECLSPEC_HIDDEN; struct d3d_device *device, struct d3d_viewport *viewport) DECLSPEC_HIDDEN;
/***************************************************************************** /*****************************************************************************
......
...@@ -659,7 +659,7 @@ static HRESULT WINAPI d3d_device1_CreateExecuteBuffer(IDirect3DDevice *iface, ...@@ -659,7 +659,7 @@ static HRESULT WINAPI d3d_device1_CreateExecuteBuffer(IDirect3DDevice *iface,
D3DEXECUTEBUFFERDESC *buffer_desc, IDirect3DExecuteBuffer **ExecuteBuffer, IUnknown *outer_unknown) D3DEXECUTEBUFFERDESC *buffer_desc, IDirect3DExecuteBuffer **ExecuteBuffer, IUnknown *outer_unknown)
{ {
struct d3d_device *device = impl_from_IDirect3DDevice(iface); struct d3d_device *device = impl_from_IDirect3DDevice(iface);
IDirect3DExecuteBufferImpl* object; struct d3d_execute_buffer *object;
HRESULT hr; HRESULT hr;
TRACE("iface %p, buffer_desc %p, buffer %p, outer_unknown %p.\n", TRACE("iface %p, buffer_desc %p, buffer %p, outer_unknown %p.\n",
...@@ -669,10 +669,10 @@ static HRESULT WINAPI d3d_device1_CreateExecuteBuffer(IDirect3DDevice *iface, ...@@ -669,10 +669,10 @@ static HRESULT WINAPI d3d_device1_CreateExecuteBuffer(IDirect3DDevice *iface,
return CLASS_E_NOAGGREGATION; return CLASS_E_NOAGGREGATION;
/* Allocate the new Execute Buffer */ /* Allocate the new Execute Buffer */
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DExecuteBufferImpl)); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if(!object) if(!object)
{ {
ERR("Out of memory when allocating a IDirect3DExecuteBufferImpl structure\n"); ERR("Failed to allocate execute buffer memory.\n");
return DDERR_OUTOFMEMORY; return DDERR_OUTOFMEMORY;
} }
...@@ -710,7 +710,7 @@ static HRESULT WINAPI d3d_device1_Execute(IDirect3DDevice *iface, ...@@ -710,7 +710,7 @@ static HRESULT WINAPI d3d_device1_Execute(IDirect3DDevice *iface,
IDirect3DExecuteBuffer *ExecuteBuffer, IDirect3DViewport *viewport, DWORD flags) IDirect3DExecuteBuffer *ExecuteBuffer, IDirect3DViewport *viewport, DWORD flags)
{ {
struct d3d_device *device = impl_from_IDirect3DDevice(iface); struct d3d_device *device = impl_from_IDirect3DDevice(iface);
IDirect3DExecuteBufferImpl *buffer = unsafe_impl_from_IDirect3DExecuteBuffer(ExecuteBuffer); struct d3d_execute_buffer *buffer = unsafe_impl_from_IDirect3DExecuteBuffer(ExecuteBuffer);
struct d3d_viewport *viewport_impl = unsafe_impl_from_IDirect3DViewport(viewport); struct d3d_viewport *viewport_impl = unsafe_impl_from_IDirect3DViewport(viewport);
HRESULT hr; HRESULT hr;
......
...@@ -50,34 +50,12 @@ static void _dump_D3DEXECUTEBUFFERDESC(const D3DEXECUTEBUFFERDESC *lpDesc) { ...@@ -50,34 +50,12 @@ static void _dump_D3DEXECUTEBUFFERDESC(const D3DEXECUTEBUFFERDESC *lpDesc) {
TRACE("lpData : %p\n", lpDesc->lpData); TRACE("lpData : %p\n", lpDesc->lpData);
} }
/***************************************************************************** HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer,
* IDirect3DExecuteBufferImpl_Execute
*
* The main functionality of the execute buffer
* It transforms the vertices if necessary, and calls IDirect3DDevice7
* for drawing the vertices. It is called from
* IDirect3DDevice::Execute
*
* TODO: Perhaps some comments about the various opcodes wouldn't hurt
*
* Don't declare this static, as it's called from device.c,
* IDirect3DDevice::Execute
*
* Params:
* Device: 3D Device associated to use for drawing
* Viewport: Viewport for this operation
*
*****************************************************************************/
HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This,
struct d3d_device *device, struct d3d_viewport *viewport) struct d3d_device *device, struct d3d_viewport *viewport)
{ {
/* DWORD bs = This->desc.dwBufferSize; */ DWORD vs = buffer->data.dwVertexOffset;
DWORD vs = This->data.dwVertexOffset; DWORD is = buffer->data.dwInstructionOffset;
/* DWORD vc = This->data.dwVertexCount; */ char *instr = (char *)buffer->desc.lpData + is;
DWORD is = This->data.dwInstructionOffset;
/* DWORD il = This->data.dwInstructionLength; */
char *instr = (char *)This->desc.lpData + is;
if (viewport->active_device != device) if (viewport->active_device != device)
{ {
...@@ -91,7 +69,7 @@ HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This, ...@@ -91,7 +69,7 @@ HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This,
TRACE("ExecuteData :\n"); TRACE("ExecuteData :\n");
if (TRACE_ON(ddraw)) if (TRACE_ON(ddraw))
_dump_executedata(&(This->data)); _dump_executedata(&(buffer->data));
while (1) { while (1) {
LPD3DINSTRUCTION current = (LPD3DINSTRUCTION) instr; LPD3DINSTRUCTION current = (LPD3DINSTRUCTION) instr;
...@@ -115,13 +93,14 @@ HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This, ...@@ -115,13 +93,14 @@ HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This,
case D3DOP_TRIANGLE: { case D3DOP_TRIANGLE: {
int i; int i;
D3DTLVERTEX *tl_vx = This->vertex_data; D3DTLVERTEX *tl_vx = buffer->vertex_data;
TRACE("TRIANGLE (%d)\n", count); TRACE("TRIANGLE (%d)\n", count);
if (count*3>This->nb_indices) { if (buffer->nb_indices < count * 3)
This->nb_indices = count * 3; {
HeapFree(GetProcessHeap(),0,This->indices); buffer->nb_indices = count * 3;
This->indices = HeapAlloc(GetProcessHeap(),0,sizeof(WORD)*This->nb_indices); HeapFree(GetProcessHeap(), 0, buffer->indices);
buffer->indices = HeapAlloc(GetProcessHeap(), 0, sizeof(*buffer->indices) * buffer->nb_indices);
} }
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
...@@ -148,9 +127,9 @@ HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This, ...@@ -148,9 +127,9 @@ HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This,
TRACE("STARTFLAT(%u) ", ci->wFlags); TRACE("STARTFLAT(%u) ", ci->wFlags);
TRACE("\n"); TRACE("\n");
} }
This->indices[(i * 3) ] = ci->u1.v1; buffer->indices[(i * 3) ] = ci->u1.v1;
This->indices[(i * 3) + 1] = ci->u2.v2; buffer->indices[(i * 3) + 1] = ci->u2.v2;
This->indices[(i * 3) + 2] = ci->u3.v3; buffer->indices[(i * 3) + 2] = ci->u3.v3;
instr += size; instr += size;
} }
/* IDirect3DDevices have color keying always enabled - /* IDirect3DDevices have color keying always enabled -
...@@ -158,7 +137,7 @@ HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This, ...@@ -158,7 +137,7 @@ HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This,
* render state. */ * render state. */
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_COLORKEYENABLE, 1); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_COLORKEYENABLE, 1);
IDirect3DDevice7_DrawIndexedPrimitive(&device->IDirect3DDevice7_iface, IDirect3DDevice7_DrawIndexedPrimitive(&device->IDirect3DDevice7_iface,
D3DPT_TRIANGLELIST, D3DFVF_TLVERTEX, tl_vx, 0, This->indices, count * 3, 0); D3DPT_TRIANGLELIST, D3DFVF_TLVERTEX, tl_vx, 0, buffer->indices, count * 3, 0);
} break; } break;
case D3DOP_MATRIXLOAD: case D3DOP_MATRIXLOAD:
...@@ -374,8 +353,8 @@ HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This, ...@@ -374,8 +353,8 @@ HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This,
/* Enough for the moment */ /* Enough for the moment */
if (ci->dwFlags == D3DPROCESSVERTICES_TRANSFORMLIGHT) { if (ci->dwFlags == D3DPROCESSVERTICES_TRANSFORMLIGHT) {
unsigned int nb; unsigned int nb;
D3DVERTEX *src = ((LPD3DVERTEX) ((char *)This->desc.lpData + vs)) + ci->wStart; D3DVERTEX *src = ((D3DVERTEX *)((char *)buffer->desc.lpData + vs)) + ci->wStart;
D3DTLVERTEX *dst = ((LPD3DTLVERTEX) (This->vertex_data)) + ci->wDest; D3DTLVERTEX *dst = ((D3DTLVERTEX *)buffer->vertex_data) + ci->wDest;
D3DVIEWPORT *Viewport = &viewport->viewports.vp1; D3DVIEWPORT *Viewport = &viewport->viewports.vp1;
D3DMATRIX mat; D3DMATRIX mat;
...@@ -419,8 +398,8 @@ HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This, ...@@ -419,8 +398,8 @@ HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This,
} }
} else if (ci->dwFlags == D3DPROCESSVERTICES_TRANSFORM) { } else if (ci->dwFlags == D3DPROCESSVERTICES_TRANSFORM) {
unsigned int nb; unsigned int nb;
D3DLVERTEX *src = ((LPD3DLVERTEX) ((char *)This->desc.lpData + vs)) + ci->wStart; D3DLVERTEX *src = ((D3DLVERTEX *)((char *)buffer->desc.lpData + vs)) + ci->wStart;
D3DTLVERTEX *dst = ((LPD3DTLVERTEX) (This->vertex_data)) + ci->wDest; D3DTLVERTEX *dst = ((D3DTLVERTEX *)buffer->vertex_data) + ci->wDest;
D3DVIEWPORT *Viewport = &viewport->viewports.vp1; D3DVIEWPORT *Viewport = &viewport->viewports.vp1;
D3DMATRIX mat; D3DMATRIX mat;
...@@ -460,9 +439,11 @@ HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This, ...@@ -460,9 +439,11 @@ HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This,
src++; src++;
dst++; dst++;
} }
} else if (ci->dwFlags == D3DPROCESSVERTICES_COPY) { }
D3DTLVERTEX *src = ((LPD3DTLVERTEX) ((char *)This->desc.lpData + vs)) + ci->wStart; else if (ci->dwFlags == D3DPROCESSVERTICES_COPY)
D3DTLVERTEX *dst = ((LPD3DTLVERTEX) (This->vertex_data)) + ci->wDest; {
D3DTLVERTEX *src = ((D3DTLVERTEX *)((char *)buffer->desc.lpData + vs)) + ci->wStart;
D3DTLVERTEX *dst = ((D3DTLVERTEX *)buffer->vertex_data) + ci->wDest;
memcpy(dst, src, ci->dwCount * sizeof(D3DTLVERTEX)); memcpy(dst, src, ci->dwCount * sizeof(D3DTLVERTEX));
} else { } else {
...@@ -494,8 +475,10 @@ HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This, ...@@ -494,8 +475,10 @@ HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This,
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
LPD3DBRANCH ci = (LPD3DBRANCH) instr; LPD3DBRANCH ci = (LPD3DBRANCH) instr;
if ((This->data.dsStatus.dwStatus & ci->dwMask) == ci->dwValue) { if ((buffer->data.dsStatus.dwStatus & ci->dwMask) == ci->dwValue)
if (!ci->bNegate) { {
if (!ci->bNegate)
{
TRACE(" Branch to %d\n", ci->dwOffset); TRACE(" Branch to %d\n", ci->dwOffset);
if (ci->dwOffset) { if (ci->dwOffset) {
instr = (char*)current + ci->dwOffset; instr = (char*)current + ci->dwOffset;
...@@ -529,7 +512,7 @@ HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This, ...@@ -529,7 +512,7 @@ HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This,
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
LPD3DSTATUS ci = (LPD3DSTATUS) instr; LPD3DSTATUS ci = (LPD3DSTATUS) instr;
This->data.dsStatus = *ci; buffer->data.dsStatus = *ci;
instr += size; instr += size;
} }
...@@ -547,9 +530,9 @@ end_of_buffer: ...@@ -547,9 +530,9 @@ end_of_buffer:
return D3D_OK; return D3D_OK;
} }
static inline IDirect3DExecuteBufferImpl *impl_from_IDirect3DExecuteBuffer(IDirect3DExecuteBuffer *iface) static inline struct d3d_execute_buffer *impl_from_IDirect3DExecuteBuffer(IDirect3DExecuteBuffer *iface)
{ {
return CONTAINING_RECORD(iface, IDirect3DExecuteBufferImpl, IDirect3DExecuteBuffer_iface); return CONTAINING_RECORD(iface, struct d3d_execute_buffer, IDirect3DExecuteBuffer_iface);
} }
/***************************************************************************** /*****************************************************************************
...@@ -568,10 +551,7 @@ static inline IDirect3DExecuteBufferImpl *impl_from_IDirect3DExecuteBuffer(IDire ...@@ -568,10 +551,7 @@ static inline IDirect3DExecuteBufferImpl *impl_from_IDirect3DExecuteBuffer(IDire
* (E_NOINTERFACE?? Don't know what I really need) * (E_NOINTERFACE?? Don't know what I really need)
* *
*****************************************************************************/ *****************************************************************************/
static HRESULT WINAPI static HRESULT WINAPI d3d_execute_buffer_QueryInterface(IDirect3DExecuteBuffer *iface, REFIID riid, void **obj)
IDirect3DExecuteBufferImpl_QueryInterface(IDirect3DExecuteBuffer *iface,
REFIID riid,
void **obj)
{ {
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), obj); TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), obj);
...@@ -603,12 +583,12 @@ IDirect3DExecuteBufferImpl_QueryInterface(IDirect3DExecuteBuffer *iface, ...@@ -603,12 +583,12 @@ IDirect3DExecuteBufferImpl_QueryInterface(IDirect3DExecuteBuffer *iface,
* The new refcount * The new refcount
* *
*****************************************************************************/ *****************************************************************************/
static ULONG WINAPI IDirect3DExecuteBufferImpl_AddRef(IDirect3DExecuteBuffer *iface) static ULONG WINAPI d3d_execute_buffer_AddRef(IDirect3DExecuteBuffer *iface)
{ {
IDirect3DExecuteBufferImpl *This = impl_from_IDirect3DExecuteBuffer(iface); struct d3d_execute_buffer *buffer = impl_from_IDirect3DExecuteBuffer(iface);
ULONG ref = InterlockedIncrement(&This->ref); ULONG ref = InterlockedIncrement(&buffer->ref);
TRACE("%p increasing refcount to %u.\n", This, ref); TRACE("%p increasing refcount to %u.\n", buffer, ref);
return ref; return ref;
} }
...@@ -622,20 +602,20 @@ static ULONG WINAPI IDirect3DExecuteBufferImpl_AddRef(IDirect3DExecuteBuffer *if ...@@ -622,20 +602,20 @@ static ULONG WINAPI IDirect3DExecuteBufferImpl_AddRef(IDirect3DExecuteBuffer *if
* The new refcount * The new refcount
* *
*****************************************************************************/ *****************************************************************************/
static ULONG WINAPI IDirect3DExecuteBufferImpl_Release(IDirect3DExecuteBuffer *iface) static ULONG WINAPI d3d_execute_buffer_Release(IDirect3DExecuteBuffer *iface)
{ {
IDirect3DExecuteBufferImpl *This = impl_from_IDirect3DExecuteBuffer(iface); struct d3d_execute_buffer *buffer = impl_from_IDirect3DExecuteBuffer(iface);
ULONG ref = InterlockedDecrement(&This->ref); ULONG ref = InterlockedDecrement(&buffer->ref);
TRACE("%p decreasing refcount to %u.\n", This, ref); TRACE("%p decreasing refcount to %u.\n", buffer, ref);
if (!ref) { if (!ref)
if (This->need_free) {
HeapFree(GetProcessHeap(),0,This->desc.lpData); if (buffer->need_free)
HeapFree(GetProcessHeap(),0,This->vertex_data); HeapFree(GetProcessHeap(), 0, buffer->desc.lpData);
HeapFree(GetProcessHeap(),0,This->indices); HeapFree(GetProcessHeap(), 0, buffer->vertex_data);
HeapFree(GetProcessHeap(),0,This); HeapFree(GetProcessHeap(), 0, buffer->indices);
return 0; HeapFree(GetProcessHeap(), 0, buffer);
} }
return ref; return ref;
...@@ -651,7 +631,7 @@ static ULONG WINAPI IDirect3DExecuteBufferImpl_Release(IDirect3DExecuteBuffer *i ...@@ -651,7 +631,7 @@ static ULONG WINAPI IDirect3DExecuteBufferImpl_Release(IDirect3DExecuteBuffer *i
* D3D_OK * D3D_OK
* *
*****************************************************************************/ *****************************************************************************/
static HRESULT WINAPI IDirect3DExecuteBufferImpl_Initialize(IDirect3DExecuteBuffer *iface, static HRESULT WINAPI d3d_execute_buffer_Initialize(IDirect3DExecuteBuffer *iface,
IDirect3DDevice *device, D3DEXECUTEBUFFERDESC *desc) IDirect3DDevice *device, D3DEXECUTEBUFFERDESC *desc)
{ {
TRACE("iface %p, device %p, desc %p.\n", iface, device, desc); TRACE("iface %p, device %p, desc %p.\n", iface, device, desc);
...@@ -672,21 +652,20 @@ static HRESULT WINAPI IDirect3DExecuteBufferImpl_Initialize(IDirect3DExecuteBuff ...@@ -672,21 +652,20 @@ static HRESULT WINAPI IDirect3DExecuteBufferImpl_Initialize(IDirect3DExecuteBuff
* This implementation always returns D3D_OK * This implementation always returns D3D_OK
* *
*****************************************************************************/ *****************************************************************************/
static HRESULT WINAPI IDirect3DExecuteBufferImpl_Lock(IDirect3DExecuteBuffer *iface, static HRESULT WINAPI d3d_execute_buffer_Lock(IDirect3DExecuteBuffer *iface, D3DEXECUTEBUFFERDESC *desc)
D3DEXECUTEBUFFERDESC *lpDesc)
{ {
IDirect3DExecuteBufferImpl *This = impl_from_IDirect3DExecuteBuffer(iface); struct d3d_execute_buffer *buffer = impl_from_IDirect3DExecuteBuffer(iface);
DWORD dwSize; DWORD dwSize;
TRACE("iface %p, desc %p.\n", iface, lpDesc); TRACE("iface %p, desc %p.\n", iface, desc);
dwSize = lpDesc->dwSize; dwSize = desc->dwSize;
memcpy(lpDesc, &This->desc, dwSize); memcpy(desc, &buffer->desc, dwSize);
if (TRACE_ON(ddraw)) if (TRACE_ON(ddraw))
{ {
TRACE(" Returning description :\n"); TRACE(" Returning description :\n");
_dump_D3DEXECUTEBUFFERDESC(lpDesc); _dump_D3DEXECUTEBUFFERDESC(desc);
} }
return D3D_OK; return D3D_OK;
} }
...@@ -700,7 +679,7 @@ static HRESULT WINAPI IDirect3DExecuteBufferImpl_Lock(IDirect3DExecuteBuffer *if ...@@ -700,7 +679,7 @@ static HRESULT WINAPI IDirect3DExecuteBufferImpl_Lock(IDirect3DExecuteBuffer *if
* This implementation always returns D3D_OK * This implementation always returns D3D_OK
* *
*****************************************************************************/ *****************************************************************************/
static HRESULT WINAPI IDirect3DExecuteBufferImpl_Unlock(IDirect3DExecuteBuffer *iface) static HRESULT WINAPI d3d_execute_buffer_Unlock(IDirect3DExecuteBuffer *iface)
{ {
TRACE("iface %p.\n", iface); TRACE("iface %p.\n", iface);
...@@ -721,25 +700,24 @@ static HRESULT WINAPI IDirect3DExecuteBufferImpl_Unlock(IDirect3DExecuteBuffer * ...@@ -721,25 +700,24 @@ static HRESULT WINAPI IDirect3DExecuteBufferImpl_Unlock(IDirect3DExecuteBuffer *
* DDERR_OUTOFMEMORY if the vertex buffer allocation failed * DDERR_OUTOFMEMORY if the vertex buffer allocation failed
* *
*****************************************************************************/ *****************************************************************************/
static HRESULT WINAPI IDirect3DExecuteBufferImpl_SetExecuteData(IDirect3DExecuteBuffer *iface, static HRESULT WINAPI d3d_execute_buffer_SetExecuteData(IDirect3DExecuteBuffer *iface, D3DEXECUTEDATA *data)
D3DEXECUTEDATA *lpData)
{ {
IDirect3DExecuteBufferImpl *This = impl_from_IDirect3DExecuteBuffer(iface); struct d3d_execute_buffer *buffer = impl_from_IDirect3DExecuteBuffer(iface);
DWORD nbvert; DWORD nbvert;
TRACE("iface %p, data %p.\n", iface, lpData); TRACE("iface %p, data %p.\n", iface, data);
memcpy(&This->data, lpData, lpData->dwSize); memcpy(&buffer->data, data, data->dwSize);
/* Get the number of vertices in the execute buffer */ /* Get the number of vertices in the execute buffer */
nbvert = This->data.dwVertexCount; nbvert = buffer->data.dwVertexCount;
/* Prepares the transformed vertex buffer */ /* Prepares the transformed vertex buffer */
HeapFree(GetProcessHeap(), 0, This->vertex_data); HeapFree(GetProcessHeap(), 0, buffer->vertex_data);
This->vertex_data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nbvert * sizeof(D3DTLVERTEX)); buffer->vertex_data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nbvert * sizeof(D3DTLVERTEX));
if (TRACE_ON(ddraw)) if (TRACE_ON(ddraw))
_dump_executedata(lpData); _dump_executedata(data);
return D3D_OK; return D3D_OK;
} }
...@@ -756,21 +734,20 @@ static HRESULT WINAPI IDirect3DExecuteBufferImpl_SetExecuteData(IDirect3DExecute ...@@ -756,21 +734,20 @@ static HRESULT WINAPI IDirect3DExecuteBufferImpl_SetExecuteData(IDirect3DExecute
* D3D_OK on success * D3D_OK on success
* *
*****************************************************************************/ *****************************************************************************/
static HRESULT WINAPI IDirect3DExecuteBufferImpl_GetExecuteData(IDirect3DExecuteBuffer *iface, static HRESULT WINAPI d3d_execute_buffer_GetExecuteData(IDirect3DExecuteBuffer *iface, D3DEXECUTEDATA *data)
D3DEXECUTEDATA *lpData)
{ {
IDirect3DExecuteBufferImpl *This = impl_from_IDirect3DExecuteBuffer(iface); struct d3d_execute_buffer *buffer = impl_from_IDirect3DExecuteBuffer(iface);
DWORD dwSize; DWORD dwSize;
TRACE("iface %p, data %p.\n", iface, lpData); TRACE("iface %p, data %p.\n", iface, data);
dwSize = lpData->dwSize; dwSize = data->dwSize;
memcpy(lpData, &This->data, dwSize); memcpy(data, &buffer->data, dwSize);
if (TRACE_ON(ddraw)) if (TRACE_ON(ddraw))
{ {
TRACE("Returning data :\n"); TRACE("Returning data :\n");
_dump_executedata(lpData); _dump_executedata(data);
} }
return DD_OK; return DD_OK;
...@@ -789,7 +766,7 @@ static HRESULT WINAPI IDirect3DExecuteBufferImpl_GetExecuteData(IDirect3DExecute ...@@ -789,7 +766,7 @@ static HRESULT WINAPI IDirect3DExecuteBufferImpl_GetExecuteData(IDirect3DExecute
* DDERR_UNSUPPORTED, because it's not implemented in Windows. * DDERR_UNSUPPORTED, because it's not implemented in Windows.
* *
*****************************************************************************/ *****************************************************************************/
static HRESULT WINAPI IDirect3DExecuteBufferImpl_Validate(IDirect3DExecuteBuffer *iface, static HRESULT WINAPI d3d_execute_buffer_Validate(IDirect3DExecuteBuffer *iface,
DWORD *offset, LPD3DVALIDATECALLBACK callback, void *context, DWORD reserved) DWORD *offset, LPD3DVALIDATECALLBACK callback, void *context, DWORD reserved)
{ {
TRACE("iface %p, offset %p, callback %p, context %p, reserved %#x.\n", TRACE("iface %p, offset %p, callback %p, context %p, reserved %#x.\n",
...@@ -813,7 +790,7 @@ static HRESULT WINAPI IDirect3DExecuteBufferImpl_Validate(IDirect3DExecuteBuffer ...@@ -813,7 +790,7 @@ static HRESULT WINAPI IDirect3DExecuteBufferImpl_Validate(IDirect3DExecuteBuffer
* DDERR_UNSUPPORTED, because it's not implemented in Windows. * DDERR_UNSUPPORTED, because it's not implemented in Windows.
* *
*****************************************************************************/ *****************************************************************************/
static HRESULT WINAPI IDirect3DExecuteBufferImpl_Optimize(IDirect3DExecuteBuffer *iface, DWORD reserved) static HRESULT WINAPI d3d_execute_buffer_Optimize(IDirect3DExecuteBuffer *iface, DWORD reserved)
{ {
TRACE("iface %p, reserved %#x.\n", iface, reserved); TRACE("iface %p, reserved %#x.\n", iface, reserved);
...@@ -824,19 +801,19 @@ static HRESULT WINAPI IDirect3DExecuteBufferImpl_Optimize(IDirect3DExecuteBuffer ...@@ -824,19 +801,19 @@ static HRESULT WINAPI IDirect3DExecuteBufferImpl_Optimize(IDirect3DExecuteBuffer
static const struct IDirect3DExecuteBufferVtbl d3d_execute_buffer_vtbl = static const struct IDirect3DExecuteBufferVtbl d3d_execute_buffer_vtbl =
{ {
IDirect3DExecuteBufferImpl_QueryInterface, d3d_execute_buffer_QueryInterface,
IDirect3DExecuteBufferImpl_AddRef, d3d_execute_buffer_AddRef,
IDirect3DExecuteBufferImpl_Release, d3d_execute_buffer_Release,
IDirect3DExecuteBufferImpl_Initialize, d3d_execute_buffer_Initialize,
IDirect3DExecuteBufferImpl_Lock, d3d_execute_buffer_Lock,
IDirect3DExecuteBufferImpl_Unlock, d3d_execute_buffer_Unlock,
IDirect3DExecuteBufferImpl_SetExecuteData, d3d_execute_buffer_SetExecuteData,
IDirect3DExecuteBufferImpl_GetExecuteData, d3d_execute_buffer_GetExecuteData,
IDirect3DExecuteBufferImpl_Validate, d3d_execute_buffer_Validate,
IDirect3DExecuteBufferImpl_Optimize, d3d_execute_buffer_Optimize,
}; };
HRESULT d3d_execute_buffer_init(IDirect3DExecuteBufferImpl *execute_buffer, HRESULT d3d_execute_buffer_init(struct d3d_execute_buffer *execute_buffer,
struct d3d_device *device, D3DEXECUTEBUFFERDESC *desc) struct d3d_device *device, D3DEXECUTEBUFFERDESC *desc)
{ {
execute_buffer->IDirect3DExecuteBuffer_iface.lpVtbl = &d3d_execute_buffer_vtbl; execute_buffer->IDirect3DExecuteBuffer_iface.lpVtbl = &d3d_execute_buffer_vtbl;
...@@ -871,7 +848,7 @@ HRESULT d3d_execute_buffer_init(IDirect3DExecuteBufferImpl *execute_buffer, ...@@ -871,7 +848,7 @@ HRESULT d3d_execute_buffer_init(IDirect3DExecuteBufferImpl *execute_buffer,
return D3D_OK; return D3D_OK;
} }
IDirect3DExecuteBufferImpl *unsafe_impl_from_IDirect3DExecuteBuffer(IDirect3DExecuteBuffer *iface) struct d3d_execute_buffer *unsafe_impl_from_IDirect3DExecuteBuffer(IDirect3DExecuteBuffer *iface)
{ {
if (!iface) if (!iface)
return NULL; return NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment