mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
wined3d: Store user clip planes as 4-component float vectors.
This commit is contained in:
parent
481514eab2
commit
e3ecfa5974
8 changed files with 41 additions and 43 deletions
|
@ -1413,7 +1413,7 @@ static HRESULT WINAPI d3d8_device_SetClipPlane(IDirect3DDevice8 *iface, DWORD in
|
|||
TRACE("iface %p, index %u, plane %p.\n", iface, index, plane);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
hr = wined3d_device_set_clip_plane(device->wined3d_device, index, plane);
|
||||
hr = wined3d_device_set_clip_plane(device->wined3d_device, index, (const struct wined3d_vec4 *)plane);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
return hr;
|
||||
|
@ -1427,7 +1427,7 @@ static HRESULT WINAPI d3d8_device_GetClipPlane(IDirect3DDevice8 *iface, DWORD in
|
|||
TRACE("iface %p, index %u, plane %p.\n", iface, index, plane);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
hr = wined3d_device_get_clip_plane(device->wined3d_device, index, plane);
|
||||
hr = wined3d_device_get_clip_plane(device->wined3d_device, index, (struct wined3d_vec4 *)plane);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
return hr;
|
||||
|
|
|
@ -1500,31 +1500,29 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetLightEnable(IDirect3DDevice9Ex *if
|
|||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirect3DDevice9Impl_SetClipPlane(IDirect3DDevice9Ex *iface, DWORD Index,
|
||||
const float *pPlane)
|
||||
static HRESULT WINAPI IDirect3DDevice9Impl_SetClipPlane(IDirect3DDevice9Ex *iface, DWORD index, const float *plane)
|
||||
{
|
||||
IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface);
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, index %u, plane %p.\n", iface, Index, pPlane);
|
||||
TRACE("iface %p, index %u, plane %p.\n", iface, index, plane);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
hr = wined3d_device_set_clip_plane(This->wined3d_device, Index, pPlane);
|
||||
hr = wined3d_device_set_clip_plane(This->wined3d_device, index, (const struct wined3d_vec4 *)plane);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirect3DDevice9Impl_GetClipPlane(IDirect3DDevice9Ex *iface, DWORD Index,
|
||||
float *pPlane)
|
||||
static HRESULT WINAPI IDirect3DDevice9Impl_GetClipPlane(IDirect3DDevice9Ex *iface, DWORD index, float *plane)
|
||||
{
|
||||
IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface);
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, index %u, plane %p.\n", iface, Index, pPlane);
|
||||
TRACE("iface %p, index %u, plane %p.\n", iface, index, plane);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
hr = wined3d_device_get_clip_plane(This->wined3d_device, Index, pPlane);
|
||||
hr = wined3d_device_get_clip_plane(This->wined3d_device, index, (struct wined3d_vec4 *)plane);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
return hr;
|
||||
|
|
|
@ -6162,7 +6162,7 @@ static HRESULT d3d_device7_SetClipPlane(IDirect3DDevice7 *iface, DWORD idx, D3DV
|
|||
return DDERR_INVALIDPARAMS;
|
||||
|
||||
wined3d_mutex_lock();
|
||||
hr = wined3d_device_set_clip_plane(device->wined3d_device, idx, plane);
|
||||
hr = wined3d_device_set_clip_plane(device->wined3d_device, idx, (struct wined3d_vec4 *)plane);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
return hr;
|
||||
|
@ -6211,7 +6211,7 @@ static HRESULT d3d_device7_GetClipPlane(IDirect3DDevice7 *iface, DWORD idx, D3DV
|
|||
return DDERR_INVALIDPARAMS;
|
||||
|
||||
wined3d_mutex_lock();
|
||||
hr = wined3d_device_get_clip_plane(device->wined3d_device, idx, plane);
|
||||
hr = wined3d_device_get_clip_plane(device->wined3d_device, idx, (struct wined3d_vec4 *)plane);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
return hr;
|
||||
|
|
|
@ -2180,7 +2180,8 @@ HRESULT CDECL wined3d_device_get_light_enable(const struct wined3d_device *devic
|
|||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
HRESULT CDECL wined3d_device_set_clip_plane(struct wined3d_device *device, UINT plane_idx, const float *plane)
|
||||
HRESULT CDECL wined3d_device_set_clip_plane(struct wined3d_device *device,
|
||||
UINT plane_idx, const struct wined3d_vec4 *plane)
|
||||
{
|
||||
TRACE("device %p, plane_idx %u, plane %p.\n", device, plane_idx, plane);
|
||||
|
||||
|
@ -2193,19 +2194,13 @@ HRESULT CDECL wined3d_device_set_clip_plane(struct wined3d_device *device, UINT
|
|||
|
||||
device->updateStateBlock->changed.clipplane |= 1 << plane_idx;
|
||||
|
||||
if (device->updateStateBlock->state.clip_planes[plane_idx][0] == plane[0]
|
||||
&& device->updateStateBlock->state.clip_planes[plane_idx][1] == plane[1]
|
||||
&& device->updateStateBlock->state.clip_planes[plane_idx][2] == plane[2]
|
||||
&& device->updateStateBlock->state.clip_planes[plane_idx][3] == plane[3])
|
||||
if (!memcmp(&device->updateStateBlock->state.clip_planes[plane_idx], plane, sizeof(*plane)))
|
||||
{
|
||||
TRACE("Application is setting old values over, nothing to do.\n");
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
device->updateStateBlock->state.clip_planes[plane_idx][0] = plane[0];
|
||||
device->updateStateBlock->state.clip_planes[plane_idx][1] = plane[1];
|
||||
device->updateStateBlock->state.clip_planes[plane_idx][2] = plane[2];
|
||||
device->updateStateBlock->state.clip_planes[plane_idx][3] = plane[3];
|
||||
device->updateStateBlock->state.clip_planes[plane_idx] = *plane;
|
||||
|
||||
/* Handle recording of state blocks. */
|
||||
if (device->isRecordingState)
|
||||
|
@ -2219,7 +2214,8 @@ HRESULT CDECL wined3d_device_set_clip_plane(struct wined3d_device *device, UINT
|
|||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
HRESULT CDECL wined3d_device_get_clip_plane(const struct wined3d_device *device, UINT plane_idx, float *plane)
|
||||
HRESULT CDECL wined3d_device_get_clip_plane(const struct wined3d_device *device,
|
||||
UINT plane_idx, struct wined3d_vec4 *plane)
|
||||
{
|
||||
TRACE("device %p, plane_idx %u, plane %p.\n", device, plane_idx, plane);
|
||||
|
||||
|
@ -2230,10 +2226,7 @@ HRESULT CDECL wined3d_device_get_clip_plane(const struct wined3d_device *device,
|
|||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
plane[0] = (float)device->stateBlock->state.clip_planes[plane_idx][0];
|
||||
plane[1] = (float)device->stateBlock->state.clip_planes[plane_idx][1];
|
||||
plane[2] = (float)device->stateBlock->state.clip_planes[plane_idx][2];
|
||||
plane[3] = (float)device->stateBlock->state.clip_planes[plane_idx][3];
|
||||
*plane = device->stateBlock->state.clip_planes[plane_idx];
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
|
|
@ -3766,6 +3766,7 @@ static void transform_world(struct wined3d_context *context, const struct wined3
|
|||
static void clipplane(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
||||
{
|
||||
UINT index = state_id - STATE_CLIPPLANE(0);
|
||||
GLdouble plane[4];
|
||||
|
||||
if (isStateDirty(context, STATE_TRANSFORM(WINED3D_TS_VIEW)) || index >= context->gl_info->limits.clipplanes)
|
||||
return;
|
||||
|
@ -3782,12 +3783,14 @@ static void clipplane(struct wined3d_context *context, const struct wined3d_stat
|
|||
*/
|
||||
glLoadIdentity();
|
||||
|
||||
plane[0] = state->clip_planes[index].x;
|
||||
plane[1] = state->clip_planes[index].y;
|
||||
plane[2] = state->clip_planes[index].z;
|
||||
plane[3] = state->clip_planes[index].w;
|
||||
|
||||
TRACE("Clipplane [%.8e, %.8e, %.8e, %.8e]\n",
|
||||
state->clip_planes[index][0],
|
||||
state->clip_planes[index][1],
|
||||
state->clip_planes[index][2],
|
||||
state->clip_planes[index][3]);
|
||||
glClipPlane(GL_CLIP_PLANE0 + index, state->clip_planes[index]);
|
||||
plane[0], plane[1], plane[2], plane[3]);
|
||||
glClipPlane(GL_CLIP_PLANE0 + index, plane);
|
||||
checkGLcall("glClipPlane");
|
||||
|
||||
glPopMatrix();
|
||||
|
|
|
@ -828,10 +828,10 @@ HRESULT CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock)
|
|||
{
|
||||
if (!(map & 1)) continue;
|
||||
|
||||
if (memcmp(src_state->clip_planes[i], stateblock->state.clip_planes[i], sizeof(*stateblock->state.clip_planes)))
|
||||
if (memcmp(&stateblock->state.clip_planes[i], &src_state->clip_planes[i], sizeof(src_state->clip_planes[i])))
|
||||
{
|
||||
TRACE("Updating clipplane %u.\n", i);
|
||||
memcpy(stateblock->state.clip_planes[i], src_state->clip_planes[i], sizeof(*stateblock->state.clip_planes));
|
||||
stateblock->state.clip_planes[i] = src_state->clip_planes[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1057,15 +1057,9 @@ HRESULT CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblo
|
|||
map = stateblock->changed.clipplane;
|
||||
for (i = 0; map; map >>= 1, ++i)
|
||||
{
|
||||
float clip[4];
|
||||
|
||||
if (!(map & 1)) continue;
|
||||
|
||||
clip[0] = (float) stateblock->state.clip_planes[i][0];
|
||||
clip[1] = (float) stateblock->state.clip_planes[i][1];
|
||||
clip[2] = (float) stateblock->state.clip_planes[i][2];
|
||||
clip[3] = (float) stateblock->state.clip_planes[i][3];
|
||||
wined3d_device_set_clip_plane(device, i, clip);
|
||||
wined3d_device_set_clip_plane(device, i, &stateblock->state.clip_planes[i]);
|
||||
}
|
||||
|
||||
stateblock->device->stateBlock->state.lowest_disabled_stage = MAX_TEXTURES - 1;
|
||||
|
|
|
@ -2282,7 +2282,7 @@ struct wined3d_state
|
|||
DWORD lowest_disabled_stage;
|
||||
|
||||
struct wined3d_matrix transforms[HIGHEST_TRANSFORMSTATE + 1];
|
||||
double clip_planes[MAX_CLIPPLANES][4];
|
||||
struct wined3d_vec4 clip_planes[MAX_CLIPPLANES];
|
||||
struct wined3d_material material;
|
||||
struct wined3d_viewport viewport;
|
||||
RECT scissor_rect;
|
||||
|
|
|
@ -1505,6 +1505,14 @@ struct wined3d_vec3
|
|||
float z;
|
||||
};
|
||||
|
||||
struct wined3d_vec4
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float w;
|
||||
};
|
||||
|
||||
struct wined3d_matrix
|
||||
{
|
||||
union
|
||||
|
@ -2081,7 +2089,8 @@ UINT __cdecl wined3d_device_get_available_texture_mem(const struct wined3d_devic
|
|||
HRESULT __cdecl wined3d_device_get_back_buffer(const struct wined3d_device *device, UINT swapchain_idx,
|
||||
UINT backbuffer_idx, enum wined3d_backbuffer_type backbuffer_type, struct wined3d_surface **backbuffer);
|
||||
INT __cdecl wined3d_device_get_base_vertex_index(const struct wined3d_device *device);
|
||||
HRESULT __cdecl wined3d_device_get_clip_plane(const struct wined3d_device *device, UINT plane_idx, float *plane);
|
||||
HRESULT __cdecl wined3d_device_get_clip_plane(const struct wined3d_device *device,
|
||||
UINT plane_idx, struct wined3d_vec4 *plane);
|
||||
HRESULT __cdecl wined3d_device_get_clip_status(const struct wined3d_device *device,
|
||||
struct wined3d_clip_status *clip_status);
|
||||
HRESULT __cdecl wined3d_device_get_creation_parameters(const struct wined3d_device *device,
|
||||
|
@ -2162,7 +2171,8 @@ HRESULT __cdecl wined3d_device_reset(struct wined3d_device *device,
|
|||
const struct wined3d_swapchain_desc *swapchain_desc, wined3d_device_reset_cb callback);
|
||||
void __cdecl wined3d_device_restore_fullscreen_window(struct wined3d_device *device, HWND window);
|
||||
HRESULT __cdecl wined3d_device_set_base_vertex_index(struct wined3d_device *device, INT base_index);
|
||||
HRESULT __cdecl wined3d_device_set_clip_plane(struct wined3d_device *device, UINT plane_idx, const float *plane);
|
||||
HRESULT __cdecl wined3d_device_set_clip_plane(struct wined3d_device *device,
|
||||
UINT plane_idx, const struct wined3d_vec4 *plane);
|
||||
HRESULT __cdecl wined3d_device_set_clip_status(struct wined3d_device *device,
|
||||
const struct wined3d_clip_status *clip_status);
|
||||
void __cdecl wined3d_device_set_cursor_position(struct wined3d_device *device,
|
||||
|
|
Loading…
Reference in a new issue