Commit c1663c55 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

ddraw: Device2 and Device3 do not have a lighting render state.

parent 669611b4
/*
* Copyright (c) 1998-2004 Lionel Ulmer
* Copyright (c) 2002-2005 Christian Costa
* Copyright (c) 2006-2009, 2011-2012 Stefan Dösinger
* Copyright (c) 2006-2009, 2011-2013 Stefan Dösinger
* Copyright (c) 2008 Alexander Dorofeyev
*
* This library is free software; you can redistribute it and/or
......@@ -2445,6 +2445,10 @@ static HRESULT WINAPI d3d_device3_GetRenderState(IDirect3DDevice3 *iface,
return D3D_OK;
}
case D3DRENDERSTATE_LIGHTING:
*value = 0xffffffff;
return D3D_OK;
default:
return IDirect3DDevice7_GetRenderState(&device->IDirect3DDevice7_iface, state, value);
}
......@@ -2800,6 +2804,10 @@ static HRESULT WINAPI d3d_device3_SetRenderState(IDirect3DDevice3 *iface,
break;
}
case D3DRENDERSTATE_LIGHTING:
hr = D3D_OK;
break;
default:
hr = IDirect3DDevice7_SetRenderState(&device->IDirect3DDevice7_iface, state, value);
break;
......@@ -3475,6 +3483,22 @@ static HRESULT WINAPI d3d_device7_DrawPrimitive_FPUPreserve(IDirect3DDevice7 *if
return hr;
}
static void setup_lighting(const struct d3d_device *device, DWORD fvf, DWORD flags)
{
BOOL enable;
/* Ignore the D3DFVF_XYZRHW case here, wined3d takes care of that */
if (flags & D3DDP_DONOTLIGHT)
enable = FALSE;
else if (!(fvf & D3DFVF_NORMAL))
enable = FALSE;
else
enable = TRUE;
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_LIGHTING, enable);
}
static HRESULT WINAPI d3d_device3_DrawPrimitive(IDirect3DDevice3 *iface,
D3DPRIMITIVETYPE primitive_type, DWORD fvf, void *vertices, DWORD vertex_count,
DWORD flags)
......@@ -3484,6 +3508,8 @@ static HRESULT WINAPI d3d_device3_DrawPrimitive(IDirect3DDevice3 *iface,
TRACE("iface %p, primitive_type %#x, fvf %#x, vertices %p, vertex_count %u, flags %#x.\n",
iface, primitive_type, fvf, vertices, vertex_count, flags);
setup_lighting(device, fvf, flags);
return IDirect3DDevice7_DrawPrimitive(&device->IDirect3DDevice7_iface,
primitive_type, fvf, vertices, vertex_count, flags);
}
......@@ -3666,6 +3692,8 @@ static HRESULT WINAPI d3d_device3_DrawIndexedPrimitive(IDirect3DDevice3 *iface,
"indices %p, index_count %u, flags %#x.\n",
iface, primitive_type, fvf, vertices, vertex_count, indices, index_count, flags);
setup_lighting(device, fvf, flags);
return IDirect3DDevice7_DrawIndexedPrimitive(&device->IDirect3DDevice7_iface,
primitive_type, fvf, vertices, vertex_count, indices, index_count, flags);
}
......@@ -3972,6 +4000,8 @@ static HRESULT WINAPI d3d_device3_DrawPrimitiveStrided(IDirect3DDevice3 *iface,
TRACE("iface %p, primitive_type %#x, FVF %#x, strided_data %p, vertex_count %u, flags %#x.\n",
iface, PrimitiveType, VertexType, D3DDrawPrimStrideData, VertexCount, Flags);
setup_lighting(device, VertexType, Flags);
return IDirect3DDevice7_DrawPrimitiveStrided(&device->IDirect3DDevice7_iface,
PrimitiveType, VertexType, D3DDrawPrimStrideData, VertexCount, Flags);
}
......@@ -4097,6 +4127,8 @@ static HRESULT WINAPI d3d_device3_DrawIndexedPrimitiveStrided(IDirect3DDevice3 *
TRACE("iface %p, primitive_type %#x, FVF %#x, strided_data %p, vertex_count %u, indices %p, index_count %u, flags %#x.\n",
iface, PrimitiveType, VertexType, D3DDrawPrimStrideData, VertexCount, Indices, IndexCount, Flags);
setup_lighting(device, VertexType, Flags);
return IDirect3DDevice7_DrawIndexedPrimitiveStrided(&device->IDirect3DDevice7_iface,
PrimitiveType, VertexType, D3DDrawPrimStrideData, VertexCount, Indices, IndexCount, Flags);
}
......@@ -4189,6 +4221,8 @@ static HRESULT WINAPI d3d_device3_DrawPrimitiveVB(IDirect3DDevice3 *iface, D3DPR
TRACE("iface %p, primitive_type %#x, vb %p, start_vertex %u, vertex_count %u, flags %#x.\n",
iface, PrimitiveType, D3DVertexBuf, StartVertex, NumVertices, Flags);
setup_lighting(device, vb->fvf, Flags);
return IDirect3DDevice7_DrawPrimitiveVB(&device->IDirect3DDevice7_iface,
PrimitiveType, &vb->IDirect3DVertexBuffer7_iface, StartVertex, NumVertices, Flags);
}
......@@ -4320,6 +4354,8 @@ static HRESULT WINAPI d3d_device3_DrawIndexedPrimitiveVB(IDirect3DDevice3 *iface
TRACE("iface %p, primitive_type %#x, vb %p, indices %p, index_count %u, flags %#x.\n",
iface, PrimitiveType, D3DVertexBuf, Indices, IndexCount, Flags);
setup_lighting(device, vb->fvf, Flags);
return IDirect3DDevice7_DrawIndexedPrimitiveVB(&device->IDirect3DDevice7_iface, PrimitiveType,
&vb->IDirect3DVertexBuffer7_iface, 0, IndexCount, Indices, IndexCount, Flags);
}
......
......@@ -902,13 +902,6 @@ static void test_depth_blit(void)
{0x0000ff00, 0x0000ff00, 0x0000ff00, 0x0000ff00},
{0x0000ff00, 0x0000ff00, 0x0000ff00, 0x0000ff00},
};
static const BOOL todo[4][4] =
{
{FALSE, FALSE, TRUE, TRUE},
{FALSE, FALSE, TRUE, TRUE},
{TRUE, TRUE, TRUE, TRUE},
{TRUE, TRUE, TRUE, TRUE},
};
DDSURFACEDESC ddsd_new, ddsd_existing;
IDirect3DDevice2 *device;
......@@ -1056,12 +1049,8 @@ static void test_depth_blit(void)
unsigned int x = 80 * ((2 * j) + 1);
unsigned int y = 60 * ((2 * i) + 1);
color = get_surface_color(rt, x, y);
if (todo[i][j])
todo_wine ok(compare_color(color, expected_colors[i][j], 1),
"Expected color 0x%08x at %u,%u, got 0x%08x.\n", expected_colors[i][j], x, y, color);
else
ok(compare_color(color, expected_colors[i][j], 1),
"Expected color 0x%08x at %u,%u, got 0x%08x.\n", expected_colors[i][j], x, y, color);
ok(compare_color(color, expected_colors[i][j], 1),
"Expected color 0x%08x at %u,%u, got 0x%08x.\n", expected_colors[i][j], x, y, color);
}
}
IDirectDrawSurface_Release(rt);
......
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