Commit 4aec7f0c authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Pass the primitive type to wined3d_cs_emit_draw().

parent e8e4fac9
......@@ -97,6 +97,7 @@ struct wined3d_cs_dispatch
struct wined3d_cs_draw
{
enum wined3d_cs_op opcode;
GLenum primitive_type;
int base_vertex_idx;
unsigned int start_idx;
unsigned int index_count;
......@@ -592,6 +593,13 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
device_invalidate_state(cs->device, STATE_BASEVERTEXINDEX);
}
if (cs->state.gl_primitive_type != op->primitive_type)
{
if (cs->state.gl_primitive_type == GL_POINTS || op->primitive_type == GL_POINTS)
device_invalidate_state(cs->device, STATE_POINT_ENABLE);
cs->state.gl_primitive_type = op->primitive_type;
}
draw_primitive(cs->device, state, op->base_vertex_idx, op->start_idx,
op->index_count, op->start_instance, op->instance_count, op->indexed);
......@@ -619,7 +627,7 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
state->unordered_access_view[WINED3D_PIPELINE_GRAPHICS]);
}
void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned int start_idx,
void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, int base_vertex_idx, unsigned int start_idx,
unsigned int index_count, unsigned int start_instance, unsigned int instance_count, BOOL indexed)
{
const struct wined3d_state *state = &cs->device->state;
......@@ -628,6 +636,7 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i
op = cs->ops->require_space(cs, sizeof(*op));
op->opcode = WINED3D_CS_OP_DRAW;
op->primitive_type = primitive_type;
op->base_vertex_idx = base_vertex_idx;
op->start_idx = start_idx;
op->index_count = index_count;
......
......@@ -3444,15 +3444,9 @@ void CDECL wined3d_device_dispatch_compute(struct wined3d_device *device,
void CDECL wined3d_device_set_primitive_type(struct wined3d_device *device,
enum wined3d_primitive_type primitive_type)
{
GLenum gl_primitive_type, prev;
TRACE("device %p, primitive_type %s\n", device, debug_d3dprimitivetype(primitive_type));
gl_primitive_type = gl_primitive_type_from_d3d(primitive_type);
prev = device->state.gl_primitive_type;
device->state.gl_primitive_type = gl_primitive_type;
if (gl_primitive_type != prev && (gl_primitive_type == GL_POINTS || prev == GL_POINTS))
device_invalidate_state(device, STATE_POINT_ENABLE);
device->state.gl_primitive_type = gl_primitive_type_from_d3d(primitive_type);
}
void CDECL wined3d_device_get_primitive_type(const struct wined3d_device *device,
......@@ -3469,7 +3463,8 @@ HRESULT CDECL wined3d_device_draw_primitive(struct wined3d_device *device, UINT
{
TRACE("device %p, start_vertex %u, vertex_count %u.\n", device, start_vertex, vertex_count);
wined3d_cs_emit_draw(device->cs, 0, start_vertex, vertex_count, 0, 0, FALSE);
wined3d_cs_emit_draw(device->cs, device->state.gl_primitive_type, 0,
start_vertex, vertex_count, 0, 0, FALSE);
return WINED3D_OK;
}
......@@ -3480,7 +3475,8 @@ void CDECL wined3d_device_draw_primitive_instanced(struct wined3d_device *device
TRACE("device %p, start_vertex %u, vertex_count %u, start_instance %u, instance_count %u.\n",
device, start_vertex, vertex_count, start_instance, instance_count);
wined3d_cs_emit_draw(device->cs, 0, start_vertex, vertex_count, start_instance, instance_count, FALSE);
wined3d_cs_emit_draw(device->cs, device->state.gl_primitive_type, 0,
start_vertex, vertex_count, start_instance, instance_count, FALSE);
}
HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *device, UINT start_idx, UINT index_count)
......@@ -3497,7 +3493,8 @@ HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *devic
return WINED3DERR_INVALIDCALL;
}
wined3d_cs_emit_draw(device->cs, device->state.base_vertex_index, start_idx, index_count, 0, 0, TRUE);
wined3d_cs_emit_draw(device->cs, device->state.gl_primitive_type,
device->state.base_vertex_index, start_idx, index_count, 0, 0, TRUE);
return WINED3D_OK;
}
......@@ -3508,7 +3505,7 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device
TRACE("device %p, start_idx %u, index_count %u, start_instance %u, instance_count %u.\n",
device, start_idx, index_count, start_instance, instance_count);
wined3d_cs_emit_draw(device->cs, device->state.base_vertex_index,
wined3d_cs_emit_draw(device->cs, device->state.gl_primitive_type, device->state.base_vertex_index,
start_idx, index_count, start_instance, instance_count, TRUE);
}
......
......@@ -3197,8 +3197,9 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil) DECLSPEC_HIDDEN;
void wined3d_cs_emit_dispatch(struct wined3d_cs *cs,
unsigned int group_count_x, unsigned int group_count_y, unsigned int group_count_z) DECLSPEC_HIDDEN;
void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned int start_idx, unsigned int index_count,
unsigned int start_instance, unsigned int instance_count, BOOL indexed) DECLSPEC_HIDDEN;
void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, int base_vertex_idx,
unsigned int start_idx, unsigned int index_count, unsigned int start_instance,
unsigned int instance_count, BOOL indexed) DECLSPEC_HIDDEN;
void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
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, DWORD flags) DECLSPEC_HIDDEN;
......
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