Commit af65f0c9 authored by Illia Polishchuk's avatar Illia Polishchuk Committed by Alexandre Julliard

d3d9: Always draw only a single instance for non-indexed draws.

Windows d3d9 always draws only a single instance for non-indexed draws. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54570
parent 6df6c7fe
......@@ -3052,7 +3052,10 @@ static HRESULT WINAPI d3d9_device_DrawPrimitive(IDirect3DDevice9Ex *iface,
d3d9_generate_auto_mipmaps(device);
wined3d_device_context_set_primitive_type(device->immediate_context,
wined3d_primitive_type_from_d3d(primitive_type), 0);
wined3d_device_context_draw(device->immediate_context, start_vertex, vertex_count, 0, 0);
/* Instancing is ignored for non-indexed draws. */
wined3d_device_context_draw(device->immediate_context, start_vertex, vertex_count, 0, 1);
d3d9_rts_flag_auto_gen_mipmap(device);
wined3d_mutex_unlock();
......@@ -3092,7 +3095,8 @@ static HRESULT WINAPI d3d9_device_DrawIndexedPrimitive(IDirect3DDevice9Ex *iface
wined3d_primitive_type_from_d3d(primitive_type), 0);
wined3d_device_apply_stateblock(device->wined3d_device, device->state);
d3d9_device_upload_sysmem_index_buffer(device, &start_idx, index_count);
wined3d_device_context_draw_indexed(device->immediate_context, base_vertex_idx, start_idx, index_count, 0, 0);
wined3d_device_context_draw_indexed(device->immediate_context, base_vertex_idx, start_idx, index_count, 0,
device->stateblock_state->streams[0].frequency);
d3d9_rts_flag_auto_gen_mipmap(device);
wined3d_mutex_unlock();
......@@ -3144,7 +3148,10 @@ static HRESULT WINAPI d3d9_device_DrawPrimitiveUP(IDirect3DDevice9Ex *iface,
wined3d_device_context_set_primitive_type(device->immediate_context,
wined3d_primitive_type_from_d3d(primitive_type), 0);
wined3d_device_apply_stateblock(device->wined3d_device, device->state);
wined3d_device_context_draw(device->immediate_context, vb_pos / stride, vtx_count, 0, 0);
/* Instancing is ignored for non-indexed draws. */
wined3d_device_context_draw(device->immediate_context, vb_pos / stride, vtx_count, 0, 1);
wined3d_stateblock_set_stream_source(device->state, 0, NULL, 0, 0);
d3d9_rts_flag_auto_gen_mipmap(device);
......@@ -3211,7 +3218,8 @@ static HRESULT WINAPI d3d9_device_DrawIndexedPrimitiveUP(IDirect3DDevice9Ex *ifa
wined3d_device_context_set_primitive_type(device->immediate_context,
wined3d_primitive_type_from_d3d(primitive_type), 0);
wined3d_device_context_draw_indexed(device->immediate_context,
vb_pos / vertex_stride - min_vertex_idx, ib_pos / idx_fmt_size, idx_count, 0, 0);
vb_pos / vertex_stride - min_vertex_idx, ib_pos / idx_fmt_size, idx_count, 0,
device->stateblock_state->streams[0].frequency);
wined3d_stateblock_set_stream_source(device->state, 0, NULL, 0, 0);
wined3d_stateblock_set_index_buffer(device->state, NULL, WINED3DFMT_UNKNOWN);
......
......@@ -13101,14 +13101,11 @@ static void stream_test(void)
color = getPixelColor(device, 200, 340);
ok(color == act.color1, "has color 0x%08x, expected 0x%08x (case %i)\n", color, act.color1, i);
color = getPixelColor(device, 400, 340);
todo_wine_if(color != 0x00ffffff)
ok(color == 0x00ffffff, "has color 0x%08x, expected 0x%08x (case %i)\n", color, 0x00ffffff, i);
ok(color == 0x00ffffff, "has color 0x%08x, expected 0x%08x (case %i)\n", color, 0x00ffffff, i);
color = getPixelColor(device, 400, 180);
todo_wine_if(color != 0x00ffffff)
ok(color == 0x00ffffff, "has color 0x%08x, expected 0x%08x (case %i)\n", color, 0x00ffffff, i);
ok(color == 0x00ffffff, "has color 0x%08x, expected 0x%08x (case %i)\n", color, 0x00ffffff, i);
color = getPixelColor(device, 200, 180);
todo_wine_if(color != 0x00ffffff)
ok(color == 0x00ffffff, "has color 0x%08x, expected 0x%08x (case %i)\n", color, 0x00ffffff, i);
ok(color == 0x00ffffff, "has color 0x%08x, expected 0x%08x (case %i)\n", color, 0x00ffffff, i);
hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
ok(hr == S_OK, "Got hr %#lx.\n", hr);
......@@ -1808,8 +1808,6 @@ static void adapter_vk_draw_primitive(struct wined3d_device *device,
else
{
instance_count = parameters->u.direct.instance_count;
if (context_vk->c.instance_count)
instance_count = context_vk->c.instance_count;
if (!instance_count)
instance_count = 1;
......
......@@ -5321,8 +5321,6 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s
else
{
unsigned int instance_count = parameters->u.direct.instance_count;
if (context->instance_count)
instance_count = context->instance_count;
if (context->use_immediate_mode_draw || emulation)
draw_primitive_immediate_mode(wined3d_context_gl(context), state, stream_info, idx_data,
......@@ -5466,7 +5464,6 @@ static void wined3d_context_gl_load_vertex_data(struct wined3d_context_gl *conte
/* This is used for the fixed-function pipeline only, and the
* fixed-function pipeline doesn't do instancing. */
context_gl->c.instance_count = 0;
current_bo = gl_info->supported[ARB_VERTEX_BUFFER_OBJECT] ? ~0u : 0;
/* Blend data */
......@@ -5680,7 +5677,6 @@ static void wined3d_context_gl_load_numbered_arrays(struct wined3d_context_gl *c
unsigned int i;
/* Default to no instancing. */
context->instance_count = 0;
current_bo = gl_info->supported[ARB_VERTEX_BUFFER_OBJECT] ? ~0u : 0;
if (stream_info->use_map & ~wined3d_mask_from_size(gl_info->limits.vertex_attribs))
......@@ -5726,8 +5722,6 @@ static void wined3d_context_gl_load_numbered_arrays(struct wined3d_context_gl *c
stream = &state->streams[element->stream_idx];
stream->buffer->bo_user.valid = true;
if ((stream->flags & WINED3DSTREAMSOURCE_INSTANCEDATA) && !context->instance_count)
context->instance_count = state->streams[0].frequency;
if (gl_info->supported[ARB_INSTANCED_ARRAYS])
{
......
......@@ -2307,7 +2307,6 @@ struct wined3d_context
DWORD numbered_array_mask;
enum fogsource fog_source;
UINT instance_count;
void *shader_backend_data;
void *fragment_pipe_data;
......
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