wined3d: Allow setting all 32 user clip planes.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Józef Kucia 2017-12-02 10:24:39 +01:00 committed by Alexandre Julliard
parent 93d45c04c4
commit 98e63e469e
4 changed files with 12 additions and 13 deletions

View File

@ -13326,13 +13326,10 @@ static void test_clip_planes_limits(void)
{
memset(plane, 0xff, sizeof(plane));
hr = IDirect3DDevice7_GetClipPlane(device, i, plane);
todo_wine_if(i >= caps.wMaxUserClipPlanes)
{
ok(hr == D3D_OK, "Failed to get clip plane %u, hr %#x.\n", i, hr);
ok(!plane[0] && !plane[1] && !plane[2] && !plane[3],
"Got unexpected plane %u: %.8e, %.8e, %.8e, %.8e.\n",
i, plane[0], plane[1], plane[2], plane[3]);
}
}
plane[0] = 2.0f;
@ -13342,16 +13339,13 @@ static void test_clip_planes_limits(void)
{
plane[3] = i;
hr = IDirect3DDevice7_SetClipPlane(device, i, plane);
todo_wine_if(i >= caps.wMaxUserClipPlanes)
ok(hr == D3D_OK, "Failed to set clip plane %u, hr %#x.\n", i, hr);
}
for (i = 0; i < D3DMAXUSERCLIPPLANES; ++i)
{
memset(plane, 0xff, sizeof(plane));
hr = IDirect3DDevice7_GetClipPlane(device, i, plane);
todo_wine_if(i >= caps.wMaxUserClipPlanes)
ok(hr == D3D_OK, "Failed to get clip plane %u, hr %#x.\n", i, hr);
todo_wine_if(i >= caps.wMaxUserClipPlanes)
ok(plane[0] == 2.0f && plane[1] == 8.0f && plane[2] == 5.0f && plane[3] == i,
"Got unexpected plane %u: %.8e, %.8e, %.8e, %.8e.\n",
i, plane[0], plane[1], plane[2], plane[3]);

View File

@ -1757,8 +1757,7 @@ HRESULT CDECL wined3d_device_set_clip_plane(struct wined3d_device *device,
{
TRACE("device %p, plane_idx %u, plane %p.\n", device, plane_idx, plane);
/* Validate plane_idx. */
if (plane_idx >= device->adapter->gl_info.limits.user_clip_distances)
if (plane_idx >= WINED3D_MAX_USER_CLIP_PLANES)
{
TRACE("Application has requested clipplane this device doesn't support.\n");
return WINED3DERR_INVALIDCALL;
@ -1775,6 +1774,12 @@ HRESULT CDECL wined3d_device_set_clip_plane(struct wined3d_device *device,
device->update_state->clip_planes[plane_idx] = *plane;
if (plane_idx >= device->adapter->gl_info.limits.user_clip_distances)
{
WARN("Clip plane %u is not supported.\n", plane_idx);
return WINED3D_OK;
}
if (!device->recording)
wined3d_cs_emit_set_clip_plane(device->cs, plane_idx, plane);
@ -1786,8 +1791,7 @@ HRESULT CDECL wined3d_device_get_clip_plane(const struct wined3d_device *device,
{
TRACE("device %p, plane_idx %u, plane %p.\n", device, plane_idx, plane);
/* Validate plane_idx. */
if (plane_idx >= device->adapter->gl_info.limits.user_clip_distances)
if (plane_idx >= WINED3D_MAX_USER_CLIP_PLANES)
{
TRACE("Application has requested clipplane this device doesn't support.\n");
return WINED3DERR_INVALIDCALL;

View File

@ -259,6 +259,8 @@ static inline enum complex_fixup get_complex_fixup(struct color_fixup_desc fixup
return complex_fixup;
}
#define WINED3D_MAX_USER_CLIP_PLANES 32
/* Device caps */
#define MAX_STREAMS 16
#define MAX_TEXTURES 8
@ -266,7 +268,7 @@ static inline enum complex_fixup get_complex_fixup(struct color_fixup_desc fixup
#define MAX_VERTEX_SAMPLERS 4
#define MAX_COMBINED_SAMPLERS (MAX_FRAGMENT_SAMPLERS + MAX_VERTEX_SAMPLERS)
#define MAX_ACTIVE_LIGHTS 8
#define MAX_CLIP_DISTANCES WINED3DMAXUSERCLIPPLANES
#define MAX_CLIP_DISTANCES WINED3D_MAX_USER_CLIP_PLANES
#define MAX_CONSTANT_BUFFERS 15
#define MAX_SAMPLER_OBJECTS 16
#define MAX_SHADER_RESOURCE_VIEWS 128
@ -3352,7 +3354,7 @@ struct wined3d_saved_states
DWORD renderState[(WINEHIGHEST_RENDER_STATE >> 5) + 1];
DWORD textureState[MAX_TEXTURES]; /* WINED3D_HIGHEST_TEXTURE_STATE + 1, 18 */
WORD samplerState[MAX_COMBINED_SAMPLERS]; /* WINED3D_HIGHEST_SAMPLER_STATE + 1, 14 */
DWORD clipplane; /* WINED3DMAXUSERCLIPPLANES, 32 */
DWORD clipplane; /* WINED3D_MAX_USER_CLIP_PLANES, 32 */
WORD pixelShaderConstantsB; /* WINED3D_MAX_CONSTS_B, 16 */
WORD pixelShaderConstantsI; /* WINED3D_MAX_CONSTS_I, 16 */
BOOL ps_consts_f[WINED3D_MAX_PS_CONSTS_F];

View File

@ -928,7 +928,6 @@ enum wined3d_shader_byte_code_format
#define WINED3DPRESENT_INTERVAL_FOUR 0x00000008
#define WINED3DPRESENT_INTERVAL_IMMEDIATE 0x80000000
#define WINED3DMAXUSERCLIPPLANES 32
#define WINED3DCLIPPLANE0 (1u << 0)
#define WINED3DCLIPPLANE1 (1u << 1)
#define WINED3DCLIPPLANE2 (1u << 2)