Commit fdf60e51 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d3d10core: Implement d3d10_device_SetPredication().

parent 686546b6
......@@ -171,6 +171,14 @@ static const struct ID3D10QueryVtbl d3d10_query_vtbl =
d3d10_query_GetDesc,
};
struct d3d10_query *unsafe_impl_from_ID3D10Query(ID3D10Query *iface)
{
if (!iface)
return NULL;
assert(iface->lpVtbl == &d3d10_query_vtbl);
return CONTAINING_RECORD(iface, struct d3d10_query, ID3D10Query_iface);
}
HRESULT d3d10_query_init(struct d3d10_query *query, struct d3d10_device *device,
const D3D10_QUERY_DESC *desc, BOOL predicate)
{
......
......@@ -304,6 +304,7 @@ struct d3d10_query
HRESULT d3d10_query_init(struct d3d10_query *query, struct d3d10_device *device,
const D3D10_QUERY_DESC *desc, BOOL predicate) DECLSPEC_HIDDEN;
struct d3d10_query *unsafe_impl_from_ID3D10Query(ID3D10Query *iface) DECLSPEC_HIDDEN;
/* IDirect3D10Device1 */
struct d3d10_device
......
......@@ -385,7 +385,13 @@ static void STDMETHODCALLTYPE d3d10_device_VSSetSamplers(ID3D10Device1 *iface,
static void STDMETHODCALLTYPE d3d10_device_SetPredication(ID3D10Device1 *iface, ID3D10Predicate *predicate, BOOL value)
{
FIXME("iface %p, predicate %p, value %d stub!\n", iface, predicate, value);
struct d3d10_device *device = impl_from_ID3D10Device(iface);
struct d3d10_query *query;
TRACE("iface %p, predicate %p, value %#x.\n", iface, predicate, value);
query = unsafe_impl_from_ID3D10Query((ID3D10Query *)predicate);
wined3d_device_set_predication(device->wined3d_device, query ? query->wined3d_query : NULL, value);
}
static void STDMETHODCALLTYPE d3d10_device_GSSetShaderResources(ID3D10Device1 *iface,
......
......@@ -29,6 +29,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_PRESENT,
WINED3D_CS_OP_CLEAR,
WINED3D_CS_OP_DRAW,
WINED3D_CS_OP_SET_PREDICATION,
WINED3D_CS_OP_SET_VIEWPORT,
WINED3D_CS_OP_SET_SCISSOR_RECT,
WINED3D_CS_OP_SET_RENDERTARGET_VIEW,
......@@ -84,6 +85,13 @@ struct wined3d_cs_draw
BOOL indexed;
};
struct wined3d_cs_set_predication
{
enum wined3d_cs_op opcode;
struct wined3d_query *predicate;
BOOL value;
};
struct wined3d_cs_set_viewport
{
enum wined3d_cs_op opcode;
......@@ -317,6 +325,26 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, UINT start_idx, UINT index_coun
cs->ops->submit(cs);
}
static void wined3d_cs_exec_set_predication(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_set_predication *op = data;
cs->state.predicate = op->predicate;
cs->state.predicate_value = op->value;
}
void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query *predicate, BOOL value)
{
struct wined3d_cs_set_predication *op;
op = cs->ops->require_space(cs, sizeof(*op));
op->opcode = WINED3D_CS_OP_SET_PREDICATION;
op->predicate = predicate;
op->value = value;
cs->ops->submit(cs);
}
static void wined3d_cs_exec_set_viewport(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_set_viewport *op = data;
......@@ -880,6 +908,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present,
/* WINED3D_CS_OP_CLEAR */ wined3d_cs_exec_clear,
/* WINED3D_CS_OP_DRAW */ wined3d_cs_exec_draw,
/* WINED3D_CS_OP_SET_PREDICATION */ wined3d_cs_exec_set_predication,
/* WINED3D_CS_OP_SET_VIEWPORT */ wined3d_cs_exec_set_viewport,
/* WINED3D_CS_OP_SET_SCISSOR_RECT */ wined3d_cs_exec_set_scissor_rect,
/* WINED3D_CS_OP_SET_RENDERTARGET_VIEW */ wined3d_cs_exec_set_rendertarget_view,
......
......@@ -3333,6 +3333,27 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou
return WINED3D_OK;
}
void CDECL wined3d_device_set_predication(struct wined3d_device *device,
struct wined3d_query *predicate, BOOL value)
{
struct wined3d_query *prev;
TRACE("device %p, predicate %p, value %#x.\n", device, predicate, value);
prev = device->update_state->predicate;
if (predicate)
{
FIXME("Predicated rendering not implemented.\n");
wined3d_query_incref(predicate);
}
device->update_state->predicate = predicate;
device->update_state->predicate_value = value;
if (!device->recording)
wined3d_cs_emit_set_predication(device->cs, predicate, value);
if (prev)
wined3d_query_decref(prev);
}
void CDECL wined3d_device_set_primitive_type(struct wined3d_device *device,
enum wined3d_primitive_type primitive_type)
{
......
......@@ -126,6 +126,7 @@
@ cdecl wined3d_device_set_multithreaded(ptr)
@ cdecl wined3d_device_set_npatch_mode(ptr float)
@ cdecl wined3d_device_set_pixel_shader(ptr ptr)
@ cdecl wined3d_device_set_predication(ptr ptr long)
@ cdecl wined3d_device_set_primitive_type(ptr long)
@ cdecl wined3d_device_set_ps_cb(ptr long ptr)
@ cdecl wined3d_device_set_ps_consts_b(ptr long ptr long)
......
......@@ -1862,6 +1862,8 @@ struct wined3d_state
INT base_vertex_index;
INT load_base_vertex_index; /* Non-indexed drawing needs 0 here, indexed needs base_vertex_index. */
GLenum gl_primitive_type;
struct wined3d_query *predicate;
BOOL predicate_value;
struct wined3d_shader *shader[WINED3D_SHADER_TYPE_COUNT];
struct wined3d_buffer *cb[WINED3D_SHADER_TYPE_COUNT][MAX_CONSTANT_BUFFERS];
......@@ -2508,6 +2510,8 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs,
void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer,
enum wined3d_format_id format_id) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_material *material) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_predication(struct wined3d_cs *cs,
struct wined3d_query *predicate, BOOL value) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs,
enum wined3d_render_state state, DWORD value) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int view_idx,
......
......@@ -2237,6 +2237,8 @@ void __cdecl wined3d_device_set_material(struct wined3d_device *device, const st
void __cdecl wined3d_device_set_multithreaded(struct wined3d_device *device);
HRESULT __cdecl wined3d_device_set_npatch_mode(struct wined3d_device *device, float segments);
void __cdecl wined3d_device_set_pixel_shader(struct wined3d_device *device, struct wined3d_shader *shader);
void __cdecl wined3d_device_set_predication(struct wined3d_device *device,
struct wined3d_query *predicate, BOOL value);
void __cdecl wined3d_device_set_primitive_type(struct wined3d_device *device,
enum wined3d_primitive_type primitive_topology);
void __cdecl wined3d_device_set_ps_cb(struct wined3d_device *device, UINT idx, struct wined3d_buffer *buffer);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment