Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/ddraw/tests/ddraw7.c | 6 ------ dlls/wined3d/device.c | 12 ++++++++---- dlls/wined3d/wined3d_private.h | 6 ++++-- include/wine/wined3d.h | 1 - 4 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 17abdf4d44a2..5e176c77205c 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -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]); diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index de6f1c5ffab6..7340488d7c89 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -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; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 0daa8612841f..bb5ed786a3fb 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -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]; diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index a0ac7ba02f03..ad9fd1362b6a 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -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)