wined3d: Send clip plane updates through the command stream.

This commit is contained in:
Henri Verbeet 2013-10-09 10:39:36 +02:00 committed by Alexandre Julliard
parent 183f00cb6c
commit db68c43678
3 changed files with 33 additions and 8 deletions

View File

@ -45,6 +45,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_SET_TEXTURE_STATE,
WINED3D_CS_OP_SET_SAMPLER_STATE,
WINED3D_CS_OP_SET_TRANSFORM,
WINED3D_CS_OP_SET_CLIP_PLANE,
};
struct wined3d_cs_present
@ -177,6 +178,13 @@ struct wined3d_cs_set_transform
const struct wined3d_matrix *matrix;
};
struct wined3d_cs_set_clip_plane
{
enum wined3d_cs_op opcode;
UINT plane_idx;
const struct wined3d_vec4 *plane;
};
static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_present *op = data;
@ -691,6 +699,26 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform
cs->ops->submit(cs);
}
static void wined3d_cs_exec_set_clip_plane(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_set_clip_plane *op = data;
cs->state.clip_planes[op->plane_idx] = *op->plane;
device_invalidate_state(cs->device, STATE_CLIPPLANE(op->plane_idx));
}
void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const struct wined3d_vec4 *plane)
{
struct wined3d_cs_set_clip_plane *op;
op = cs->ops->require_space(cs, sizeof(*op));
op->opcode = WINED3D_CS_OP_SET_CLIP_PLANE;
op->plane_idx = plane_idx;
op->plane = plane;
cs->ops->submit(cs);
}
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present,
@ -712,6 +740,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_SET_TEXTURE_STATE */ wined3d_cs_exec_set_texture_state,
/* WINED3D_CS_OP_SET_SAMPLER_STATE */ wined3d_cs_exec_set_sampler_state,
/* WINED3D_CS_OP_SET_TRANSFORM */ wined3d_cs_exec_set_transform,
/* WINED3D_CS_OP_SET_CLIP_PLANE */ wined3d_cs_exec_set_clip_plane,
};
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)

View File

@ -1734,14 +1734,8 @@ HRESULT CDECL wined3d_device_set_clip_plane(struct wined3d_device *device,
device->update_state->clip_planes[plane_idx] = *plane;
/* Handle recording of state blocks. */
if (device->recording)
{
TRACE("Recording... not performing anything.\n");
return WINED3D_OK;
}
device_invalidate_state(device, STATE_CLIPPLANE(plane_idx));
if (!device->recording)
wined3d_cs_emit_set_clip_plane(device->cs, plane_idx, plane);
return WINED3D_OK;
}

View File

@ -2485,6 +2485,8 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, UINT start_idx, UINT index_coun
void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain,
const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override,
const RGNDATA *dirty_region, DWORD flags) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx,
const struct wined3d_vec4 *plane) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_depth_stencil(struct wined3d_cs *cs, struct wined3d_surface *depth_stencil) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_geometry_shader(struct wined3d_cs *cs, struct wined3d_shader *shader) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer,