wined3d: Store only supported 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>
This commit is contained in:
Józef Kucia 2017-12-05 00:26:35 +01:00 committed by Alexandre Julliard
parent a7186d79d9
commit 7225e60108
3 changed files with 4 additions and 12 deletions

View File

@ -1757,7 +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);
if (plane_idx >= WINED3D_MAX_USER_CLIP_PLANES)
if (plane_idx >= device->adapter->gl_info.limits.user_clip_distances)
{
TRACE("Application has requested clipplane this device doesn't support.\n");
return WINED3DERR_INVALIDCALL;
@ -1774,12 +1774,6 @@ 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);
@ -1791,7 +1785,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);
if (plane_idx >= WINED3D_MAX_USER_CLIP_PLANES)
if (plane_idx >= device->adapter->gl_info.limits.user_clip_distances)
{
TRACE("Application has requested clipplane this device doesn't support.\n");
return WINED3DERR_INVALIDCALL;

View File

@ -218,7 +218,7 @@ static void stateblock_savedstates_set_all(struct wined3d_saved_states *states,
stateblock_set_bits(states->renderState, WINEHIGHEST_RENDER_STATE + 1);
for (i = 0; i < MAX_TEXTURES; ++i) states->textureState[i] = 0x3ffff;
for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i) states->samplerState[i] = 0x3ffe;
states->clipplane = 0xffffffff;
states->clipplane = (1u << MAX_CLIP_DISTANCES) - 1;
states->pixelShaderConstantsB = 0xffff;
states->pixelShaderConstantsI = 0xffff;
states->vertexShaderConstantsB = 0xffff;

View File

@ -259,8 +259,6 @@ 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
@ -2829,7 +2827,7 @@ struct wined3d_state
DWORD texture_states[MAX_TEXTURES][WINED3D_HIGHEST_TEXTURE_STATE + 1];
struct wined3d_matrix transforms[HIGHEST_TRANSFORMSTATE + 1];
struct wined3d_vec4 clip_planes[WINED3D_MAX_USER_CLIP_PLANES];
struct wined3d_vec4 clip_planes[MAX_CLIP_DISTANCES];
struct wined3d_material material;
struct wined3d_viewport viewport;
RECT scissor_rect;