Commit 5f87d778 authored by Lionel Ulmer's avatar Lionel Ulmer Committed by Alexandre Julliard

- some additionnal flags logged

- fixes in the vertex buffer thunking + optimized flag support
parent f947a580
......@@ -226,6 +226,7 @@ extern const char *_get_renderstate(D3DRENDERSTATETYPE type);
extern void dump_D3DMATERIAL7(LPD3DMATERIAL7 lpMat);
extern void dump_D3DCOLORVALUE(D3DCOLORVALUE *lpCol);
extern void dump_D3DLIGHT7(LPD3DLIGHT7 lpLight);
extern void dump_DPFLAGS(DWORD dwFlags);
#define dump_mat(mat) \
TRACE("%f %f %f %f\n", (mat)->_11, (mat)->_12, (mat)->_13, (mat)->_14); \
......
......@@ -204,3 +204,18 @@ dump_D3DLIGHT7(LPD3DLIGHT7 lpLight)
DPRINTF(" - dvTheta : %f\n", lpLight->dvTheta);
DPRINTF(" - dvPhi : %f\n", lpLight->dvPhi);
}
void
dump_DPFLAGS(DWORD dwFlags)
{
static const flag_info flags[] =
{
FE(D3DDP_WAIT),
FE(D3DDP_OUTOFORDER),
FE(D3DDP_DONOTCLIP),
FE(D3DDP_DONOTUPDATEEXTENTS),
FE(D3DDP_DONOTLIGHT)
};
DDRAW_dump_flags(dwFlags, flags, sizeof(flags)/sizeof(flags[0]));
}
......@@ -831,11 +831,13 @@ GL_IDirect3DDeviceImpl_2_DrawPrimitive(LPDIRECT3DDEVICE2 iface,
DWORD dwFlags)
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
TRACE("(%p/%p)->(%08x,%08x,%p,%08lx,%08lx)\n", This, iface, d3dptPrimitiveType, d3dvtVertexType, lpvVertices, dwVertexCount, dwFlags);
if (TRACE_ON(ddraw)) {
TRACE(" - flags : "); dump_DPFLAGS(dwFlags);
}
ENTER_GL();
draw_primitive(This, dwVertexCount, NULL, d3dvtVertexType, d3dptPrimitiveType, lpvVertices);
LEAVE_GL();
return DD_OK;
}
......@@ -852,10 +854,11 @@ GL_IDirect3DDeviceImpl_2_DrawIndexedPrimitive(LPDIRECT3DDEVICE2 iface,
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
TRACE("(%p/%p)->(%08x,%08x,%p,%08lx,%p,%08lx,%08lx)\n", This, iface, d3dptPrimitiveType, d3dvtVertexType, lpvVertices, dwVertexCount, dwIndices, dwIndexCount, dwFlags);
if (TRACE_ON(ddraw)) {
TRACE(" - flags : "); dump_DPFLAGS(dwFlags);
}
ENTER_GL();
draw_primitive(This, dwIndexCount, dwIndices, d3dvtVertexType, d3dptPrimitiveType, lpvVertices);
LEAVE_GL();
return DD_OK;
}
......@@ -1291,7 +1294,11 @@ GL_IDirect3DDeviceImpl_7_3T_DrawPrimitive(LPDIRECT3DDEVICE7 iface,
DWORD dwFlags)
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
TRACE("(%p/%p)->(%08x,%08lx,%p,%08lx,%08lx)\n", This, iface, d3dptPrimitiveType, d3dvtVertexType, lpvVertices, dwVertexCount, dwFlags);
if (TRACE_ON(ddraw)) {
TRACE(" - flags : "); dump_DPFLAGS(dwFlags);
}
draw_primitive_7(This, d3dptPrimitiveType, d3dvtVertexType, lpvVertices, 0, dwVertexCount, NULL, dwVertexCount, dwFlags);
......@@ -1309,7 +1316,11 @@ GL_IDirect3DDeviceImpl_7_3T_DrawIndexedPrimitive(LPDIRECT3DDEVICE7 iface,
DWORD dwFlags)
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
TRACE("(%p/%p)->(%08x,%08lx,%p,%08lx,%p,%08lx,%08lx)\n", This, iface, d3dptPrimitiveType, d3dvtVertexType, lpvVertices, dwVertexCount, dwIndices, dwIndexCount, dwFlags);
if (TRACE_ON(ddraw)) {
TRACE(" - flags : "); dump_DPFLAGS(dwFlags);
}
draw_primitive_7(This, d3dptPrimitiveType, d3dvtVertexType, lpvVertices, 0, dwVertexCount, dwIndices, dwIndexCount, dwFlags);
......@@ -1325,8 +1336,13 @@ GL_IDirect3DDeviceImpl_7_3T_DrawPrimitiveStrided(LPDIRECT3DDEVICE7 iface,
DWORD dwFlags)
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
TRACE("(%p/%p)->(%08x,%08lx,%p,%08lx,%08lx)\n", This, iface, d3dptPrimitiveType, dwVertexType, lpD3DDrawPrimStrideData, dwVertexCount, dwFlags);
if (TRACE_ON(ddraw)) {
TRACE(" - flags : "); dump_DPFLAGS(dwFlags);
}
draw_primitive_strided_7(This, d3dptPrimitiveType, dwVertexType, lpD3DDrawPrimStrideData, 0, dwVertexCount, NULL, dwVertexCount, dwFlags);
return DD_OK;
}
......@@ -1341,8 +1357,14 @@ GL_IDirect3DDeviceImpl_7_3T_DrawIndexedPrimitiveStrided(LPDIRECT3DDEVICE7 iface,
DWORD dwFlags)
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
TRACE("(%p/%p)->(%08x,%08lx,%p,%08lx,%p,%08lx,%08lx)\n", This, iface, d3dptPrimitiveType, dwVertexType, lpD3DDrawPrimStrideData, dwVertexCount, lpIndex, dwIndexCount, dwFlags);
if (TRACE_ON(ddraw)) {
TRACE(" - flags : "); dump_DPFLAGS(dwFlags);
}
draw_primitive_strided_7(This, d3dptPrimitiveType, dwVertexType, lpD3DDrawPrimStrideData, 0, dwVertexCount, lpIndex, dwIndexCount, dwFlags);
return DD_OK;
}
......@@ -1358,6 +1380,9 @@ GL_IDirect3DDeviceImpl_7_3T_DrawPrimitiveVB(LPDIRECT3DDEVICE7 iface,
IDirect3DVertexBufferImpl *vb_impl = ICOM_OBJECT(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, lpD3DVertexBuf);
TRACE("(%p/%p)->(%08x,%p,%08lx,%08lx,%08lx)\n", This, iface, d3dptPrimitiveType, lpD3DVertexBuf, dwStartVertex, dwNumVertices, dwFlags);
if (TRACE_ON(ddraw)) {
TRACE(" - flags : "); dump_DPFLAGS(dwFlags);
}
draw_primitive_7(This, d3dptPrimitiveType, vb_impl->desc.dwFVF, vb_impl->vertices, dwStartVertex, dwNumVertices, NULL, dwNumVertices, dwFlags);
......@@ -1378,6 +1403,9 @@ GL_IDirect3DDeviceImpl_7_3T_DrawIndexedPrimitiveVB(LPDIRECT3DDEVICE7 iface,
IDirect3DVertexBufferImpl *vb_impl = ICOM_OBJECT(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, lpD3DVertexBuf);
TRACE("(%p/%p)->(%08x,%p,%08lx,%08lx,%p,%08lx,%08lx)\n", This, iface, d3dptPrimitiveType, lpD3DVertexBuf, dwStartVertex, dwNumVertices, lpwIndices, dwIndexCount, dwFlags);
if (TRACE_ON(ddraw)) {
TRACE(" - flags : "); dump_DPFLAGS(dwFlags);
}
draw_primitive_7(This, d3dptPrimitiveType, vb_impl->desc.dwFVF, vb_impl->vertices, dwStartVertex, dwNumVertices, lpwIndices, dwIndexCount, dwFlags);
......
......@@ -99,6 +99,8 @@ Main_IDirect3DVertexBufferImpl_7_1T_Lock(LPDIRECT3DVERTEXBUFFER7 iface,
DDRAW_dump_lockflag(dwFlags);
}
if (This->desc.dwCaps & D3DVBCAPS_OPTIMIZED) return D3DERR_VERTEXBUFFEROPTIMIZED;
if (lpdwSize != NULL) *lpdwSize = This->vertex_buffer_size;
*lplpData = This->vertices;
......@@ -135,9 +137,14 @@ Main_IDirect3DVertexBufferImpl_7_1T_GetVertexBufferDesc(LPDIRECT3DVERTEXBUFFER7
{
DWORD size;
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
TRACE("(%p/%p)->(%p)\n", This, iface, lpD3DVertexBufferDesc);
size = (lpD3DVertexBufferDesc->dwSize < This->desc.dwSize) ? lpD3DVertexBufferDesc->dwSize : This->desc.dwSize;
memcpy(lpD3DVertexBufferDesc,&This->desc,size);
size = lpD3DVertexBufferDesc->dwSize;
memset(lpD3DVertexBufferDesc, 0, size);
memcpy(lpD3DVertexBufferDesc, &This->desc,
(size < This->desc.dwSize) ? size : This->desc.dwSize);
return DD_OK;
}
......@@ -148,6 +155,9 @@ Main_IDirect3DVertexBufferImpl_7_Optimize(LPDIRECT3DVERTEXBUFFER7 iface,
{
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
FIXME("(%p/%p)->(%p,%08lx): stub!\n", This, iface, lpD3DDevice, dwFlags);
This->desc.dwCaps |= D3DVBCAPS_OPTIMIZED;
return DD_OK;
}
......@@ -297,6 +307,7 @@ HRESULT d3dvertexbuffer_create(IDirect3DVertexBufferImpl **obj, IDirect3DImpl *d
{
IDirect3DVertexBufferImpl *object;
static const flag_info flags[] = {
FE(D3DVBCAPS_DONOTCLIP),
FE(D3DVBCAPS_OPTIMIZED),
FE(D3DVBCAPS_SYSTEMMEMORY),
FE(D3DVBCAPS_WRITEONLY)
......
......@@ -466,6 +466,10 @@ Thunk_IDirect3DImpl_3_CreateVertexBuffer(LPDIRECT3D3 iface,
LPDIRECT3DVERTEXBUFFER7 ret_val;
TRACE("(%p)->(%p,%p,%08lx,%p) thunking to IDirect3D7 interface.\n", iface, lpD3DVertBufDesc, lplpD3DVertBuf, dwFlags, lpUnk);
/* dwFlags is not used in the D3D7 interface, use the vertex buffer description instead */
if (dwFlags & D3DDP_DONOTCLIP) lpD3DVertBufDesc->dwCaps |= D3DVBCAPS_DONOTCLIP;
ret = IDirect3D7_CreateVertexBuffer(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D3, IDirect3D7, iface),
lpD3DVertBufDesc,
&ret_val,
......
......@@ -40,8 +40,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
#define MAX_LIGHTS 8
HRESULT WINAPI
GL_IDirect3DImpl_3_2T_1T_EnumDevices(LPDIRECT3D3 iface,
LPD3DENUMDEVICESCALLBACK lpEnumDevicesCallback,
......
......@@ -464,9 +464,12 @@ void set_render_state(D3DRENDERSTATETYPE dwRenderStateType,
glStencilMask(dwRenderState);
break;
case D3DRENDERSTATE_CLIPPING: /* 136 */
/* Nothing to do here... Even if what we receive is already clipped by the application,
we cannot tell OpenGL to not re-clip it. */
break;
case D3DRENDERSTATE_LIGHTING: /* 137 */
/* There will be more to do here once we really support D3D7 Lighting.
Should be enough for now to prevent warnings :-) */
if (dwRenderState)
glEnable(GL_LIGHTING);
else
......
......@@ -91,7 +91,7 @@ void set_render_state(D3DRENDERSTATETYPE dwRenderStateType,
typedef struct IDirect3DGLImpl
{
struct IDirect3DImpl parent;
int free_lights;
DWORD free_lights;
void (*light_released)(IDirect3DImpl *, GLenum light_num);
} IDirect3DGLImpl;
......
......@@ -183,6 +183,12 @@ typedef struct IDirect3DVertexBuffer7 IDirect3DVertexBuffer7, *LPDIRECT3DVERTEXB
#define D3DNEXT_HEAD 0x02l
#define D3DNEXT_TAIL 0x04l
#define D3DDP_WAIT 0x00000001l
#define D3DDP_OUTOFORDER 0x00000002l
#define D3DDP_DONOTCLIP 0x00000004l
#define D3DDP_DONOTUPDATEEXTENTS 0x00000008l
#define D3DDP_DONOTLIGHT 0x00000010l
/* ********************************************************************
Types and structures
******************************************************************** */
......@@ -1015,5 +1021,4 @@ ICOM_DEFINE(IDirect3DVertexBuffer7,IUnknown)
#define IDirect3DVertexBuffer7_Optimize(p,a,b) ICOM_CALL2(Optimize,p,a,b)
#define IDirect3DVertexBuffer7_ProcessVerticesStrided(p,a,b,c,d,e,f,g) ICOM_CALL7(ProcessVerticesStrided,p,a,b,c,d,e,f,g)
#endif /* __WINE_D3D_H */
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