Rebase against 31ef99245ae8cd08b2bb611a2a8803c6206f4d54.

This commit is contained in:
Sebastian Lackner 2017-11-08 04:00:15 +01:00
parent 9e01cd7628
commit b3199000fe
13 changed files with 30 additions and 917 deletions

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "039d267b0925273197a9edcf7664c4a42dca932d"
echo "31ef99245ae8cd08b2bb611a2a8803c6206f4d54"
}
# Show version information
@ -456,7 +456,6 @@ patch_enable_all ()
enable_wined3d_Copy_Resource_Typeless="$1"
enable_wined3d_Core_Context="$1"
enable_wined3d_DXTn="$1"
enable_wined3d_DrawIndirect="$1"
enable_wined3d_Dual_Source_Blending="$1"
enable_wined3d_GTX_560M="$1"
enable_wined3d_GenerateMips="$1"
@ -471,7 +470,6 @@ patch_enable_all ()
enable_wined3d_WINED3DFMT_R32G32_UINT="$1"
enable_wined3d_WINED3D_RS_COLORWRITEENABLE="$1"
enable_wined3d_buffer_create="$1"
enable_wined3d_draw_primitive_arrays="$1"
enable_wined3d_dxgi_swapchain_Present="$1"
enable_wined3d_sample_c_lz="$1"
enable_wined3d_wined3d_guess_gl_vendor="$1"
@ -1650,9 +1648,6 @@ patch_enable ()
wined3d-DXTn)
enable_wined3d_DXTn="$2"
;;
wined3d-DrawIndirect)
enable_wined3d_DrawIndirect="$2"
;;
wined3d-Dual_Source_Blending)
enable_wined3d_Dual_Source_Blending="$2"
;;
@ -1695,9 +1690,6 @@ patch_enable ()
wined3d-buffer_create)
enable_wined3d_buffer_create="$2"
;;
wined3d-draw_primitive_arrays)
enable_wined3d_draw_primitive_arrays="$2"
;;
wined3d-dxgi_swapchain_Present)
enable_wined3d_dxgi_swapchain_Present="$2"
;;
@ -2249,25 +2241,17 @@ if test "$enable_wined3d_dxgi_swapchain_Present" -eq 1; then
if test "$enable_dxgi_DXGI_PRESENT_TEST" -gt 1; then
abort "Patchset dxgi-DXGI_PRESENT_TEST disabled, but wined3d-dxgi_swapchain_Present depends on that."
fi
if test "$enable_wined3d_DrawIndirect" -gt 1; then
abort "Patchset wined3d-DrawIndirect disabled, but wined3d-dxgi_swapchain_Present depends on that."
fi
if test "$enable_wined3d_Silence_FIXMEs" -gt 1; then
abort "Patchset wined3d-Silence_FIXMEs disabled, but wined3d-dxgi_swapchain_Present depends on that."
fi
enable_dxgi_DXGI_PRESENT_TEST=1
enable_wined3d_DrawIndirect=1
enable_wined3d_Silence_FIXMEs=1
fi
if test "$enable_wined3d_Indexed_Vertex_Blending" -eq 1; then
if test "$enable_wined3d_DrawIndirect" -gt 1; then
abort "Patchset wined3d-DrawIndirect disabled, but wined3d-Indexed_Vertex_Blending depends on that."
fi
if test "$enable_wined3d_WINED3D_RS_COLORWRITEENABLE" -gt 1; then
abort "Patchset wined3d-WINED3D_RS_COLORWRITEENABLE disabled, but wined3d-Indexed_Vertex_Blending depends on that."
fi
enable_wined3d_DrawIndirect=1
enable_wined3d_WINED3D_RS_COLORWRITEENABLE=1
fi
@ -2278,13 +2262,6 @@ if test "$enable_wined3d_WINED3D_RS_COLORWRITEENABLE" -eq 1; then
enable_d3d11_Depth_Bias=1
fi
if test "$enable_wined3d_DrawIndirect" -eq 1; then
if test "$enable_wined3d_draw_primitive_arrays" -gt 1; then
abort "Patchset wined3d-draw_primitive_arrays disabled, but wined3d-DrawIndirect depends on that."
fi
enable_wined3d_draw_primitive_arrays=1
fi
if test "$enable_wined3d_CSMT_Helper" -eq 1; then
if test "$enable_d3d11_Deferred_Context" -gt 1; then
abort "Patchset d3d11-Deferred_Context disabled, but wined3d-CSMT_Helper depends on that."
@ -9904,46 +9881,6 @@ if test "$enable_wined3d_CSMT_Helper" -eq 1; then
) >> "$patchlist"
fi
# Patchset wined3d-draw_primitive_arrays
# |
# | Modified files:
# | * dlls/d3d11/tests/d3d11.c, dlls/wined3d/directx.c, dlls/wined3d/drawprim.c, dlls/wined3d/wined3d_gl.h
# |
if test "$enable_wined3d_draw_primitive_arrays" -eq 1; then
patch_apply wined3d-draw_primitive_arrays/0001-d3d11-tests-Add-basic-instance-offset-drawing-test.patch
patch_apply wined3d-draw_primitive_arrays/0002-wined3d-Add-support-for-start-instance-in-draw_primi.patch
(
printf '%s\n' '+ { "Michael Müller", "d3d11/tests: Add basic instance offset drawing test.", 1 },';
printf '%s\n' '+ { "Michael Müller", "wined3d: Add support for start instance in draw_primitive_arrays.", 1 },';
) >> "$patchlist"
fi
# Patchset wined3d-DrawIndirect
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * wined3d-draw_primitive_arrays
# |
# | This patchset fixes the following Wine bugs:
# | * [#43405] Implement support for indirect drawing / compute shader dispatching
# |
# | Modified files:
# | * dlls/d3d11/device.c, dlls/d3d11/tests/d3d11.c, dlls/wined3d/cs.c, dlls/wined3d/device.c, dlls/wined3d/directx.c,
# | dlls/wined3d/drawprim.c, dlls/wined3d/wined3d.spec, dlls/wined3d/wined3d_gl.h, dlls/wined3d/wined3d_private.h,
# | include/wine/wined3d.h
# |
if test "$enable_wined3d_DrawIndirect" -eq 1; then
patch_apply wined3d-DrawIndirect/0002-d3d11-tests-Add-a-basic-test-for-DispatchIndirect.patch
patch_apply wined3d-DrawIndirect/0003-wined3d-Implement-indirect-drawing.patch
patch_apply wined3d-DrawIndirect/0004-wined3d-Implement-DrawInstancedIndirect.patch
patch_apply wined3d-DrawIndirect/0005-d3d11-tests-Add-a-basic-test-for-DrawInstancedIndire.patch
(
printf '%s\n' '+ { "Sebastian Lackner", "d3d11/tests: Add a basic test for DispatchIndirect.", 1 },';
printf '%s\n' '+ { "Józef Kucia", "wined3d: Implement indirect drawing.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Implement DrawInstancedIndirect.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "d3d11/tests: Add a basic test for DrawInstancedIndirect.", 1 },';
) >> "$patchlist"
fi
# Patchset wined3d-GTX_560M
# |
# | Modified files:
@ -9976,7 +9913,7 @@ fi
# Patchset wined3d-Indexed_Vertex_Blending
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * wined3d-draw_primitive_arrays, wined3d-DrawIndirect, d3d11-Depth_Bias, wined3d-WINED3D_RS_COLORWRITEENABLE
# | * d3d11-Depth_Bias, wined3d-WINED3D_RS_COLORWRITEENABLE
# |
# | This patchset fixes the following Wine bugs:
# | * [#39057] Support for indexed vertex blending
@ -10062,7 +9999,7 @@ fi
# Patchset wined3d-dxgi_swapchain_Present
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * dxgi-DXGI_PRESENT_TEST, wined3d-draw_primitive_arrays, wined3d-DrawIndirect, wined3d-Silence_FIXMEs
# | * dxgi-DXGI_PRESENT_TEST, wined3d-Silence_FIXMEs
# |
# | Modified files:
# | * dlls/d3d8/swapchain.c, dlls/d3d9/device.c, dlls/d3d9/swapchain.c, dlls/dxgi/swapchain.c, dlls/wined3d/cs.c,

View File

@ -47,7 +47,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
};
struct wined3d_cs_add_dirty_texture_region
@@ -2264,6 +2267,53 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
@@ -2247,6 +2250,53 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
unsigned int slice_pitch)
{
struct wined3d_cs_update_sub_resource *op;
@ -101,7 +101,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
op = cs->ops->require_space(cs, sizeof(*op), WINED3D_CS_QUEUE_MAP);
op->opcode = WINED3D_CS_OP_UPDATE_SUB_RESOURCE;
@@ -2277,8 +2327,10 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
@@ -2260,8 +2310,10 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
wined3d_resource_acquire(resource);
cs->ops->submit(cs, WINED3D_CS_QUEUE_MAP);
@ -112,7 +112,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
cs->ops->finish(cs, WINED3D_CS_QUEUE_MAP);
}
@@ -2657,6 +2709,13 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
@@ -2640,6 +2692,13 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_GENERATE_MIPS */ wined3d_cs_exec_generate_mips,
};
@ -126,7 +126,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size, enum wined3d_cs_queue_id queue_id)
{
if (size > (cs->data_size - cs->end))
@@ -2710,6 +2769,9 @@ static void wined3d_cs_st_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id
@@ -2693,6 +2752,9 @@ static void wined3d_cs_st_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id
static const struct wined3d_cs_ops wined3d_cs_st_ops =
{
@ -136,7 +136,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
wined3d_cs_st_require_space,
wined3d_cs_st_submit,
wined3d_cs_st_finish,
@@ -2743,6 +2805,21 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs, enum wined3d_cs_queue_id
@@ -2726,6 +2788,21 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs, enum wined3d_cs_queue_id
wined3d_cs_queue_submit(&cs->queue[queue_id], cs);
}
@ -158,7 +158,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
static void *wined3d_cs_queue_require_space(struct wined3d_cs_queue *queue, size_t size, struct wined3d_cs *cs)
{
size_t queue_size = ARRAY_SIZE(queue->data);
@@ -2804,6 +2881,16 @@ static void *wined3d_cs_queue_require_space(struct wined3d_cs_queue *queue, size
@@ -2787,6 +2864,16 @@ static void *wined3d_cs_queue_require_space(struct wined3d_cs_queue *queue, size
return packet->data;
}
@ -175,7 +175,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, enum wined3d_cs_queue_id queue_id)
{
if (cs->thread_id == GetCurrentThreadId())
@@ -2823,6 +2910,9 @@ static void wined3d_cs_mt_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id
@@ -2806,6 +2893,9 @@ static void wined3d_cs_mt_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id
static const struct wined3d_cs_ops wined3d_cs_mt_ops =
{

View File

@ -1,69 +0,0 @@
From 92202c3bca8682b20eac8dd896e1a38e8123fb66 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Mon, 24 Jul 2017 19:38:41 +0200
Subject: d3d11/tests: Add a basic test for DispatchIndirect.
---
dlls/d3d11/tests/d3d11.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 8c1e5809533..c1b7dfff839 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -668,9 +668,10 @@ static void check_uav_desc_(unsigned int line, const D3D11_UNORDERED_ACCESS_VIEW
}
}
-#define create_buffer(a, b, c, d) create_buffer_(__LINE__, a, b, c, d)
+#define create_buffer(a, b, c, d) create_buffer_(__LINE__, a, b, 0, c, d)
+#define create_buffer_misc(a, b, c, d, e) create_buffer_(__LINE__, a, b, c, d, e)
static ID3D11Buffer *create_buffer_(unsigned int line, ID3D11Device *device,
- unsigned int bind_flags, unsigned int size, const void *data)
+ unsigned int bind_flags, unsigned int misc_flags, unsigned int size, const void *data)
{
D3D11_SUBRESOURCE_DATA resource_data;
D3D11_BUFFER_DESC buffer_desc;
@@ -681,7 +682,7 @@ static ID3D11Buffer *create_buffer_(unsigned int line, ID3D11Device *device,
buffer_desc.Usage = D3D11_USAGE_DEFAULT;
buffer_desc.BindFlags = bind_flags;
buffer_desc.CPUAccessFlags = 0;
- buffer_desc.MiscFlags = 0;
+ buffer_desc.MiscFlags = misc_flags;
buffer_desc.StructureByteStride = 0;
resource_data.pSysMem = data;
@@ -16567,6 +16568,7 @@ static void test_uav_load(void)
static void test_cs_uav_store(void)
{
+ static const unsigned int params[4] = {16, 16, 16, 0};
static const D3D_FEATURE_LEVEL feature_level = D3D_FEATURE_LEVEL_11_0;
D3D11_UNORDERED_ACCESS_VIEW_DESC uav_desc;
static const float zero[4] = {0.0f};
@@ -16578,6 +16580,7 @@ static void test_cs_uav_store(void)
ID3D11Texture2D *texture;
ID3D11ComputeShader *cs;
ID3D11Device *device;
+ ID3D11Buffer *buffer;
ID3D11Buffer *cb;
ULONG refcount;
HRESULT hr;
@@ -16844,6 +16847,14 @@ static void test_cs_uav_store(void)
ID3D11DeviceContext_Dispatch(context, 16, 16, 1);
check_texture_float(texture, 0.7f, 2);
+ input.x = 0.8f;
+ buffer = create_buffer_misc(device, D3D11_BIND_UNORDERED_ACCESS,
+ D3D11_RESOURCE_MISC_DRAWINDIRECT_ARGS, sizeof(params), params);
+ ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)cb, 0, NULL, &input, 0, 0);
+ ID3D11DeviceContext_DispatchIndirect(context, buffer, 0);
+ check_texture_float(texture, 0.8f, 2);
+ ID3D11Buffer_Release(buffer);
+
ID3D11ComputeShader_Release(cs);
hr = ID3D11Device_CreateComputeShader(device, cs_group_index_code, sizeof(cs_group_index_code), NULL, &cs);
--
2.13.1

View File

@ -1,427 +0,0 @@
From 016f75697806c91b84dd0099396f13fce147e066 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B3zef=20Kucia?= <jkucia@codeweavers.com>
Date: Sun, 23 Jul 2017 23:59:28 +0200
Subject: wined3d: Implement indirect drawing.
---
dlls/d3d11/device.c | 12 ++++-
dlls/wined3d/cs.c | 99 ++++++++++++++++++++++++++++++++----------
dlls/wined3d/device.c | 9 ++++
dlls/wined3d/directx.c | 5 +++
dlls/wined3d/drawprim.c | 68 ++++++++++++++++++++++++-----
dlls/wined3d/wined3d.spec | 1 +
dlls/wined3d/wined3d_gl.h | 1 +
dlls/wined3d/wined3d_private.h | 31 ++++++++++++-
include/wine/wined3d.h | 2 +
9 files changed, 192 insertions(+), 36 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index 9cffa8a9961..2ecce826042 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -1786,7 +1786,17 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_DrawAuto(ID3D11DeviceConte
static void STDMETHODCALLTYPE d3d11_immediate_context_DrawIndexedInstancedIndirect(ID3D11DeviceContext *iface,
ID3D11Buffer *buffer, UINT offset)
{
- FIXME("iface %p, buffer %p, offset %u stub!\n", iface, buffer, offset);
+ struct d3d_device *device = device_from_immediate_ID3D11DeviceContext(iface);
+ struct d3d_buffer *d3d_buffer;
+
+ TRACE("iface %p, buffer %p, offset %u.\n", iface, buffer, offset);
+
+ d3d_buffer = unsafe_impl_from_ID3D11Buffer(buffer);
+
+ wined3d_mutex_lock();
+ wined3d_device_draw_indexed_primitive_instanced_indirect(device->wined3d_device,
+ d3d_buffer->wined3d_buffer, offset);
+ wined3d_mutex_unlock();
}
static void STDMETHODCALLTYPE d3d11_immediate_context_DrawInstancedIndirect(ID3D11DeviceContext *iface,
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 171287dc99c..805867a3e20 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -121,12 +121,7 @@ struct wined3d_cs_draw
enum wined3d_cs_op opcode;
GLenum primitive_type;
GLint patch_vertex_count;
- int base_vertex_idx;
- unsigned int start_idx;
- unsigned int index_count;
- unsigned int start_instance;
- unsigned int instance_count;
- BOOL indexed;
+ struct wined3d_draw_parameters parameters;
};
struct wined3d_cs_flush
@@ -772,13 +767,6 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
const struct wined3d_cs_draw *op = data;
unsigned int i;
- if (!cs->device->adapter->gl_info.supported[ARB_DRAW_ELEMENTS_BASE_VERTEX]
- && state->load_base_vertex_index != op->base_vertex_idx)
- {
- state->load_base_vertex_index = op->base_vertex_idx;
- device_invalidate_state(cs->device, STATE_BASEVERTEXINDEX);
- }
-
if (state->gl_primitive_type != op->primitive_type)
{
if (state->gl_primitive_type == GL_POINTS || op->primitive_type == GL_POINTS)
@@ -787,10 +775,27 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
}
state->gl_patch_vertices = op->patch_vertex_count;
- draw_primitive(cs->device, state, op->base_vertex_idx, op->start_idx,
- op->index_count, op->start_instance, op->instance_count, op->indexed);
+ if (!op->parameters.indirect)
+ {
+ const struct wined3d_direct_draw_parameters *p = &op->parameters.u.direct;
+
+ if (!cs->device->adapter->gl_info.supported[ARB_DRAW_ELEMENTS_BASE_VERTEX]
+ && state->load_base_vertex_index != p->base_vertex_idx)
+ {
+ state->load_base_vertex_index = p->base_vertex_idx;
+ device_invalidate_state(cs->device, STATE_BASEVERTEXINDEX);
+ }
+ }
+
+ draw_primitive(cs->device, state, &op->parameters);
+
+ if (op->parameters.indirect)
+ {
+ const struct wined3d_indirect_draw_parameters *p = &op->parameters.u.indirect;
- if (op->indexed)
+ wined3d_resource_release(&p->buffer->resource);
+ }
+ if (op->parameters.indexed)
wined3d_resource_release(&state->index_buffer->resource);
for (i = 0; i < ARRAY_SIZE(state->streams); ++i)
{
@@ -831,12 +836,62 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, unsigned
op->opcode = WINED3D_CS_OP_DRAW;
op->primitive_type = primitive_type;
op->patch_vertex_count = patch_vertex_count;
- op->base_vertex_idx = base_vertex_idx;
- op->start_idx = start_idx;
- op->index_count = index_count;
- op->start_instance = start_instance;
- op->instance_count = instance_count;
- op->indexed = indexed;
+ op->parameters.indirect = FALSE;
+ op->parameters.u.direct.base_vertex_idx = base_vertex_idx;
+ op->parameters.u.direct.start_idx = start_idx;
+ op->parameters.u.direct.index_count = index_count;
+ op->parameters.u.direct.start_instance = start_instance;
+ op->parameters.u.direct.instance_count = instance_count;
+ op->parameters.indexed = indexed;
+
+ if (indexed)
+ wined3d_resource_acquire(&state->index_buffer->resource);
+ for (i = 0; i < ARRAY_SIZE(state->streams); ++i)
+ {
+ if (state->streams[i].buffer)
+ wined3d_resource_acquire(&state->streams[i].buffer->resource);
+ }
+ for (i = 0; i < ARRAY_SIZE(state->stream_output); ++i)
+ {
+ if (state->stream_output[i].buffer)
+ wined3d_resource_acquire(&state->stream_output[i].buffer->resource);
+ }
+ for (i = 0; i < ARRAY_SIZE(state->textures); ++i)
+ {
+ if (state->textures[i])
+ wined3d_resource_acquire(&state->textures[i]->resource);
+ }
+ for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i)
+ {
+ if (state->fb->render_targets[i])
+ wined3d_resource_acquire(state->fb->render_targets[i]->resource);
+ }
+ if (state->fb->depth_stencil)
+ wined3d_resource_acquire(state->fb->depth_stencil->resource);
+ acquire_shader_resources(state, ~(1u << WINED3D_SHADER_TYPE_COMPUTE));
+ acquire_unordered_access_resources(state->shader[WINED3D_SHADER_TYPE_PIXEL],
+ state->unordered_access_view[WINED3D_PIPELINE_GRAPHICS]);
+
+ cs->ops->submit(cs, WINED3D_CS_QUEUE_DEFAULT);
+}
+
+void wined3d_cs_emit_draw_indirect(struct wined3d_cs *cs, GLenum primitive_type, unsigned int patch_vertex_count,
+ struct wined3d_buffer *buffer, unsigned int offset, BOOL indexed)
+{
+ const struct wined3d_state *state = &cs->device->state;
+ struct wined3d_cs_draw *op;
+ unsigned int i;
+
+ op = cs->ops->require_space(cs, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT);
+ op->opcode = WINED3D_CS_OP_DRAW;
+ op->primitive_type = primitive_type;
+ op->patch_vertex_count = patch_vertex_count;
+ op->parameters.indirect = TRUE;
+ op->parameters.u.indirect.buffer = buffer;
+ op->parameters.u.indirect.offset = offset;
+ op->parameters.indexed = indexed;
+
+ wined3d_resource_acquire(&buffer->resource);
if (indexed)
wined3d_resource_acquire(&state->index_buffer->resource);
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 54a058ae1ed..b6458cfde53 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3782,6 +3782,15 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device
device->state.base_vertex_index, start_idx, index_count, start_instance, instance_count, TRUE);
}
+void CDECL wined3d_device_draw_indexed_primitive_instanced_indirect(struct wined3d_device *device,
+ struct wined3d_buffer *buffer, unsigned int offset)
+{
+ TRACE("device %p, buffer %p, offset %u.\n", device, buffer, offset);
+
+ wined3d_cs_emit_draw_indirect(device->cs, device->state.gl_primitive_type, device->state.gl_patch_vertices,
+ buffer, offset, TRUE);
+}
+
HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
struct wined3d_texture *src_texture, struct wined3d_texture *dst_texture)
{
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 82f6300d0f5..0553a16ee4e 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -126,6 +126,7 @@ static const struct wined3d_extension_map gl_extension_map[] =
{"GL_ARB_derivative_control", ARB_DERIVATIVE_CONTROL },
{"GL_ARB_draw_buffers", ARB_DRAW_BUFFERS },
{"GL_ARB_draw_elements_base_vertex", ARB_DRAW_ELEMENTS_BASE_VERTEX },
+ {"GL_ARB_draw_indirect", ARB_DRAW_INDIRECT },
{"GL_ARB_draw_instanced", ARB_DRAW_INSTANCED },
{"GL_ARB_ES2_compatibility", ARB_ES2_COMPATIBILITY },
{"GL_ARB_ES3_compatibility", ARB_ES3_COMPATIBILITY },
@@ -2735,6 +2736,9 @@ static void load_gl_funcs(struct wined3d_gl_info *gl_info)
USE_GL_FUNC(glDrawElementsInstancedBaseVertex)
USE_GL_FUNC(glDrawRangeElementsBaseVertex)
USE_GL_FUNC(glMultiDrawElementsBaseVertex)
+ /* GL_ARB_draw_indirect */
+ USE_GL_FUNC(glDrawArraysIndirect)
+ USE_GL_FUNC(glDrawElementsIndirect)
/* GL_ARB_draw_instanced */
USE_GL_FUNC(glDrawArraysInstancedARB)
USE_GL_FUNC(glDrawElementsInstancedARB)
@@ -3886,6 +3890,7 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter,
{ARB_TIMER_QUERY, MAKEDWORD_VERSION(3, 3)},
{ARB_VERTEX_TYPE_2_10_10_10_REV, MAKEDWORD_VERSION(3, 3)},
+ {ARB_DRAW_INDIRECT, MAKEDWORD_VERSION(4, 0)},
{ARB_GPU_SHADER5, MAKEDWORD_VERSION(4, 0)},
{ARB_TESSELLATION_SHADER, MAKEDWORD_VERSION(4, 0)},
{ARB_TEXTURE_CUBE_MAP_ARRAY, MAKEDWORD_VERSION(4, 0)},
diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index 6de0d613d2d..bec0155c6ef 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -168,6 +168,38 @@ static void draw_primitive_arrays(struct wined3d_context *context, const struct
}
}
+/* Context activation is done by the caller. */
+static void draw_primitive_arrays_indirect(struct wined3d_context *context, const struct wined3d_state *state,
+ const void *idx_data, unsigned int idx_size, struct wined3d_buffer *buffer, unsigned int offset)
+{
+ const struct wined3d_gl_info *gl_info = context->gl_info;
+
+ if (!gl_info->supported[ARB_DRAW_INDIRECT])
+ {
+ FIXME("Indirect draw not supported.\n");
+ return;
+ }
+
+ wined3d_buffer_load(buffer, context, state);
+ GL_EXTCALL(glBindBuffer(GL_DRAW_INDIRECT_BUFFER, buffer->buffer_object));
+
+ if (idx_size)
+ {
+ GLenum idx_type = (idx_size == 2) ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT;
+
+ GL_EXTCALL(glDrawElementsIndirect(state->gl_primitive_type, idx_type,
+ (const BYTE *)NULL + offset));
+ }
+ else
+ {
+ GL_EXTCALL(glDrawArraysIndirect(state->gl_primitive_type,
+ (const BYTE *)NULL + offset));
+ }
+
+ GL_EXTCALL(glBindBuffer(GL_DRAW_INDIRECT_BUFFER, 0));
+ checkGLcall("draw indirect");
+}
+
static unsigned int get_stride_idx(const void *idx_data, unsigned int idx_size,
unsigned int base_vertex_idx, unsigned int start_idx, unsigned int vertex_idx)
{
@@ -477,8 +509,7 @@ static GLenum gl_tfb_primitive_type_from_d3d(enum wined3d_primitive_type primiti
/* Routine common to the draw primitive and draw indexed primitive routines */
void draw_primitive(struct wined3d_device *device, const struct wined3d_state *state,
- 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_draw_parameters *parameters)
{
BOOL emulation = FALSE, rasterizer_discard = FALSE;
const struct wined3d_fb_state *fb = state->fb;
@@ -491,7 +522,7 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s
unsigned int i, idx_size = 0;
const void *idx_data = NULL;
- if (!index_count)
+ if (!parameters->indirect && !parameters->u.direct.index_count)
return;
if (!(rtv = fb->render_targets[0]))
@@ -558,10 +589,8 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s
}
stream_info = &context->stream_info;
- if (context->instance_count)
- instance_count = context->instance_count;
- if (indexed)
+ if (parameters->indexed)
{
struct wined3d_buffer *index_buffer = state->index_buffer;
if (!index_buffer->buffer_object || !stream_info->all_vbo)
@@ -648,12 +677,29 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s
checkGLcall("glPatchParameteri");
}
- if (context->use_immediate_mode_draw || emulation)
- draw_primitive_immediate_mode(context, state, stream_info, idx_data,
- idx_size, base_vertex_idx, start_idx, index_count, instance_count);
+ if (parameters->indirect)
+ {
+ if (context->use_immediate_mode_draw || emulation)
+ FIXME("Indirect draw with immediate mode/emulation is not supported.\n");
+ else
+ draw_primitive_arrays_indirect(context, state, idx_data, idx_size,
+ parameters->u.indirect.buffer, parameters->u.indirect.offset);
+ }
else
- draw_primitive_arrays(context, state, idx_data, idx_size, base_vertex_idx,
- start_idx, index_count, start_instance, instance_count);
+ {
+ 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(context, state, stream_info, idx_data,
+ idx_size, parameters->u.direct.base_vertex_idx,
+ parameters->u.direct.start_idx, parameters->u.direct.index_count, instance_count);
+ else
+ draw_primitive_arrays(context, state, idx_data, idx_size, parameters->u.direct.base_vertex_idx,
+ parameters->u.direct.start_idx, parameters->u.direct.index_count,
+ parameters->u.direct.start_instance, instance_count);
+ }
if (context->uses_uavs)
{
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 122e39ba8ee..2d80b3a8772 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -45,6 +45,7 @@
@ cdecl wined3d_device_dispatch_compute_indirect(ptr ptr long)
@ cdecl wined3d_device_draw_indexed_primitive(ptr long long)
@ cdecl wined3d_device_draw_indexed_primitive_instanced(ptr long long long long)
+@ cdecl wined3d_device_draw_indexed_primitive_instanced_indirect(ptr ptr long)
@ cdecl wined3d_device_draw_primitive(ptr long long)
@ cdecl wined3d_device_draw_primitive_instanced(ptr long long long long)
@ cdecl wined3d_device_end_scene(ptr)
diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h
index 4fe1971b5e6..4f73478a3b4 100644
--- a/dlls/wined3d/wined3d_gl.h
+++ b/dlls/wined3d/wined3d_gl.h
@@ -60,6 +60,7 @@ enum wined3d_gl_extension
ARB_DERIVATIVE_CONTROL,
ARB_DRAW_BUFFERS,
ARB_DRAW_ELEMENTS_BASE_VERTEX,
+ ARB_DRAW_INDIRECT,
ARB_DRAW_INSTANCED,
ARB_ES2_COMPATIBILITY,
ARB_ES3_COMPATIBILITY,
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index e2461100a5a..50143a91425 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1481,6 +1481,32 @@ void wined3d_stream_info_from_declaration(struct wined3d_stream_info *stream_inf
const struct wined3d_state *state, const struct wined3d_gl_info *gl_info,
const struct wined3d_d3d_info *d3d_info) DECLSPEC_HIDDEN;
+struct wined3d_direct_draw_parameters
+{
+ int base_vertex_idx;
+ unsigned int start_idx;
+ unsigned int index_count;
+ unsigned int start_instance;
+ unsigned int instance_count;
+};
+
+struct wined3d_indirect_draw_parameters
+{
+ struct wined3d_buffer *buffer;
+ unsigned int offset;
+};
+
+struct wined3d_draw_parameters
+{
+ BOOL indirect;
+ union
+ {
+ struct wined3d_direct_draw_parameters direct;
+ struct wined3d_indirect_draw_parameters indirect;
+ } u;
+ BOOL indexed;
+};
+
struct wined3d_direct_dispatch_parameters
{
unsigned int group_count_x;
@@ -1505,8 +1531,7 @@ struct wined3d_dispatch_parameters
};
void draw_primitive(struct wined3d_device *device, const struct wined3d_state *state,
- int base_vertex_idx, unsigned int start_idx, unsigned int index_count,
- unsigned int start_instance, unsigned int instance_count, BOOL indexed) DECLSPEC_HIDDEN;
+ const struct wined3d_draw_parameters *draw_parameters) DECLSPEC_HIDDEN;
void dispatch_compute(struct wined3d_device *device, const struct wined3d_state *state,
const struct wined3d_dispatch_parameters *dispatch_parameters) DECLSPEC_HIDDEN;
DWORD get_flexible_vertex_size(DWORD d3dvtVertexType) DECLSPEC_HIDDEN;
@@ -3460,6 +3485,8 @@ void wined3d_cs_emit_dispatch_indirect(struct wined3d_cs *cs,
void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, unsigned int patch_vertex_count,
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_indirect(struct wined3d_cs *cs, GLenum primitive_type, unsigned int patch_vertex_count,
+ struct wined3d_buffer *buffer, unsigned int offset, BOOL indexed) DECLSPEC_HIDDEN;
void wined3d_cs_emit_flush(struct wined3d_cs *cs) 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,
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index a99dbf64686..0b4c97fad54 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2245,6 +2245,8 @@ void __cdecl wined3d_device_dispatch_compute_indirect(struct wined3d_device *dev
HRESULT __cdecl wined3d_device_draw_indexed_primitive(struct wined3d_device *device, UINT start_idx, UINT index_count);
void __cdecl wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device *device,
UINT start_idx, UINT index_count, UINT start_instance, UINT instance_count);
+void __cdecl wined3d_device_draw_indexed_primitive_instanced_indirect(struct wined3d_device *device,
+ struct wined3d_buffer *buffer, unsigned int offset);
HRESULT __cdecl wined3d_device_draw_primitive(struct wined3d_device *device, UINT start_vertex, UINT vertex_count);
void __cdecl wined3d_device_draw_primitive_instanced(struct wined3d_device *device,
UINT start_vertex, UINT vertex_count, UINT start_instance, UINT instance_count);
--
2.13.1

View File

@ -1,83 +0,0 @@
From d2b50ac6892808791c4d461317a4b011369fcc39 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Mon, 24 Jul 2017 20:30:13 +0200
Subject: wined3d: Implement DrawInstancedIndirect.
---
dlls/d3d11/device.c | 12 +++++++++++-
dlls/wined3d/device.c | 9 +++++++++
dlls/wined3d/wined3d.spec | 1 +
include/wine/wined3d.h | 2 ++
4 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index 2ecce826042..d3660a12e50 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -1802,7 +1802,17 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_DrawIndexedInstancedIndire
static void STDMETHODCALLTYPE d3d11_immediate_context_DrawInstancedIndirect(ID3D11DeviceContext *iface,
ID3D11Buffer *buffer, UINT offset)
{
- FIXME("iface %p, buffer %p, offset %u stub!\n", iface, buffer, offset);
+ struct d3d_device *device = device_from_immediate_ID3D11DeviceContext(iface);
+ struct d3d_buffer *d3d_buffer;
+
+ TRACE("iface %p, buffer %p, offset %u.\n", iface, buffer, offset);
+
+ d3d_buffer = unsafe_impl_from_ID3D11Buffer(buffer);
+
+ wined3d_mutex_lock();
+ wined3d_device_draw_primitive_instanced_indirect(device->wined3d_device,
+ d3d_buffer->wined3d_buffer, offset);
+ wined3d_mutex_unlock();
}
static void STDMETHODCALLTYPE d3d11_immediate_context_Dispatch(ID3D11DeviceContext *iface,
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index b6458cfde53..112e7f45ca4 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3752,6 +3752,15 @@ void CDECL wined3d_device_draw_primitive_instanced(struct wined3d_device *device
0, start_vertex, vertex_count, start_instance, instance_count, FALSE);
}
+void CDECL wined3d_device_draw_primitive_instanced_indirect(struct wined3d_device *device,
+ struct wined3d_buffer *buffer, unsigned int offset)
+{
+ TRACE("device %p, buffer %p, offset %u.\n", device, buffer, offset);
+
+ wined3d_cs_emit_draw_indirect(device->cs, device->state.gl_primitive_type, device->state.gl_patch_vertices,
+ buffer, offset, FALSE);
+}
+
HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *device, UINT start_idx, UINT index_count)
{
TRACE("device %p, start_idx %u, index_count %u.\n", device, start_idx, index_count);
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 2d80b3a8772..9c48b98b3ac 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -48,6 +48,7 @@
@ cdecl wined3d_device_draw_indexed_primitive_instanced_indirect(ptr ptr long)
@ cdecl wined3d_device_draw_primitive(ptr long long)
@ cdecl wined3d_device_draw_primitive_instanced(ptr long long long long)
+@ cdecl wined3d_device_draw_primitive_instanced_indirect(ptr ptr long)
@ cdecl wined3d_device_end_scene(ptr)
@ cdecl wined3d_device_end_stateblock(ptr ptr)
@ cdecl wined3d_device_evict_managed_resources(ptr)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 0b4c97fad54..b8fb5503e53 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2250,6 +2250,8 @@ void __cdecl wined3d_device_draw_indexed_primitive_instanced_indirect(struct win
HRESULT __cdecl wined3d_device_draw_primitive(struct wined3d_device *device, UINT start_vertex, UINT vertex_count);
void __cdecl wined3d_device_draw_primitive_instanced(struct wined3d_device *device,
UINT start_vertex, UINT vertex_count, UINT start_instance, UINT instance_count);
+void __cdecl wined3d_device_draw_primitive_instanced_indirect(struct wined3d_device *device,
+ struct wined3d_buffer *buffer, unsigned int offset);
HRESULT __cdecl wined3d_device_end_scene(struct wined3d_device *device);
HRESULT __cdecl wined3d_device_end_stateblock(struct wined3d_device *device, struct wined3d_stateblock **stateblock);
void __cdecl wined3d_device_evict_managed_resources(struct wined3d_device *device);
--
2.13.1

View File

@ -1,70 +0,0 @@
From 9cf4fd149607487343d264d1ae8b23807957a919 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Mon, 24 Jul 2017 20:36:31 +0200
Subject: d3d11/tests: Add a basic test for DrawInstancedIndirect.
---
dlls/d3d11/tests/d3d11.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index c1b7dfff839..af71dbef770 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -9940,6 +9940,7 @@ static void test_clear_state(void)
static void test_il_append_aligned(void)
{
+ static const unsigned int params[] = {4, 4, 0, 0};
struct d3d11_test_context test_context;
ID3D11InputLayout *input_layout;
ID3D11DeviceContext *context;
@@ -9947,6 +9948,7 @@ static void test_il_append_aligned(void)
ID3D11VertexShader *vs;
ID3D11PixelShader *ps;
ID3D11Device *device;
+ ID3D11Buffer *buffer;
ID3D11Buffer *vb[3];
DWORD color;
HRESULT hr;
@@ -10116,7 +10118,6 @@ static void test_il_append_aligned(void)
ID3D11DeviceContext_PSSetShader(context, ps, NULL, 0);
ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, red);
-
ID3D11DeviceContext_DrawInstanced(context, 4, 4, 0, 0);
color = get_texture_color(test_context.backbuffer, 80, 240);
@@ -10129,7 +10130,6 @@ static void test_il_append_aligned(void)
ok(compare_color(color, 0xffff00ff, 1), "Got unexpected color 0x%08x.\n", color);
ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, red);
-
ID3D11DeviceContext_DrawInstanced(context, 4, 4, 0, 4);
color = get_texture_color(test_context.backbuffer, 80, 240);
@@ -10141,6 +10141,21 @@ static void test_il_append_aligned(void)
color = get_texture_color(test_context.backbuffer, 560, 240);
ok(compare_color(color, 0xffff0000, 1), "Got unexpected color 0x%08x.\n", color);
+ buffer = create_buffer_misc(device, D3D11_BIND_UNORDERED_ACCESS,
+ D3D11_RESOURCE_MISC_DRAWINDIRECT_ARGS, sizeof(params), params);
+ ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, red);
+ ID3D11DeviceContext_DrawInstancedIndirect(context, buffer, 0);
+ ID3D11Buffer_Release(buffer);
+
+ color = get_texture_color(test_context.backbuffer, 80, 240);
+ ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color);
+ color = get_texture_color(test_context.backbuffer, 240, 240);
+ ok(compare_color(color, 0xff00ff00, 1), "Got unexpected color 0x%08x.\n", color);
+ color = get_texture_color(test_context.backbuffer, 400, 240);
+ ok(compare_color(color, 0xffff0000, 1), "Got unexpected color 0x%08x.\n", color);
+ color = get_texture_color(test_context.backbuffer, 560, 240);
+ ok(compare_color(color, 0xffff00ff, 1), "Got unexpected color 0x%08x.\n", color);
+
ID3D11PixelShader_Release(ps);
ID3D11VertexShader_Release(vs);
ID3D11Buffer_Release(vb[2]);
--
2.13.1

View File

@ -1,2 +0,0 @@
Fixes: [43405] Implement support for indirect drawing / compute shader dispatching
Depends: wined3d-draw_primitive_arrays

View File

@ -1,4 +1,4 @@
From 97d6b11b95d8cdcc0d777b11f6f00e9d6054adfb Mon Sep 17 00:00:00 2001
From 407c269c649604efd9a1f28d7dcb2494e1f3a090 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 31 Aug 2017 01:26:38 +0200
Subject: wined3d: Implement software processing for indexed vertex blending.
@ -12,10 +12,10 @@ Subject: wined3d: Implement software processing for indexed vertex blending.
5 files changed, 148 insertions(+), 30 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index d3ee3b0a839..31c7ea431d8 100644
index 572d99c20c1..b2e367dde4f 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3963,31 +3963,15 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device
@@ -3909,31 +3909,15 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device
void CDECL wined3d_device_set_software_vertex_processing(struct wined3d_device *device, BOOL software)
{
@ -48,11 +48,11 @@ index d3ee3b0a839..31c7ea431d8 100644
}
diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index 51460e54d1a..6adb7934134 100644
index 1164878985d..acc9afec2be 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -200,6 +200,101 @@ static void draw_primitive_arrays_indirect(struct wined3d_context *context, cons
checkGLcall("draw indirect");
@@ -165,6 +165,101 @@ static void draw_primitive_arrays(struct wined3d_context *context, const struct
}
}
+static const BYTE *software_vertex_blending(struct wined3d_context *context,
@ -153,7 +153,7 @@ index 51460e54d1a..6adb7934134 100644
static unsigned int get_stride_idx(const void *idx_data, unsigned int idx_size,
unsigned int base_vertex_idx, unsigned int start_idx, unsigned int vertex_idx)
{
@@ -228,6 +323,7 @@ static void draw_primitive_immediate_mode(struct wined3d_context *context, const
@@ -193,6 +288,7 @@ static void draw_primitive_immediate_mode(struct wined3d_context *context, const
BOOL specular_fog = FALSE;
BOOL ps = use_ps(state);
const void *ptr;
@ -161,7 +161,7 @@ index 51460e54d1a..6adb7934134 100644
static unsigned int once;
@@ -264,7 +360,7 @@ static void draw_primitive_immediate_mode(struct wined3d_context *context, const
@@ -229,7 +325,7 @@ static void draw_primitive_immediate_mode(struct wined3d_context *context, const
if (!(use_map & 1u << element_idx))
continue;
@ -170,7 +170,7 @@ index 51460e54d1a..6adb7934134 100644
ops->generic[si->elements[element_idx].format->emit_idx](element_idx, ptr);
}
}
@@ -376,7 +472,7 @@ static void draw_primitive_immediate_mode(struct wined3d_context *context, const
@@ -341,7 +437,7 @@ static void draw_primitive_immediate_mode(struct wined3d_context *context, const
if (normal)
{
@ -179,7 +179,7 @@ index 51460e54d1a..6adb7934134 100644
ops->normal[si->elements[WINED3D_FFP_NORMAL].format->emit_idx](ptr);
}
@@ -421,7 +517,7 @@ static void draw_primitive_immediate_mode(struct wined3d_context *context, const
@@ -386,7 +482,7 @@ static void draw_primitive_immediate_mode(struct wined3d_context *context, const
if (position)
{
@ -188,7 +188,7 @@ index 51460e54d1a..6adb7934134 100644
ops->position[si->elements[WINED3D_FFP_POSITION].format->emit_idx](ptr);
}
}
@@ -636,6 +732,11 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s
@@ -601,6 +697,11 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s
WARN_(d3d_perf)("Using software emulation because manual fog coordinates are provided.\n");
emulation = TRUE;
}
@ -201,10 +201,10 @@ index 51460e54d1a..6adb7934134 100644
if (emulation)
{
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index aaca2f63441..a3050590dfb 100644
index f34ff090414..dfc332adb1a 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -8359,14 +8359,21 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
@@ -8371,14 +8371,21 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
}
else
{
@ -232,7 +232,7 @@ index aaca2f63441..a3050590dfb 100644
}
shader_addline(buffer, "gl_Position = ffp_projection_matrix * ec_pos;\n");
@@ -8384,10 +8391,17 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
@@ -8396,10 +8403,17 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
shader_addline(buffer, "vec3 normal = vec3(0.0);\n");
if (settings->normal)
{
@ -254,10 +254,10 @@ index aaca2f63441..a3050590dfb 100644
if (settings->normalize)
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index b2effb5c2ec..438dfc6fef3 100644
index a9df5f2be49..c83cd6205b2 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -6086,7 +6086,12 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_context *context,
@@ -6079,7 +6079,12 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_context *context,
}
if (use_indexed_vertex_blending(state, si))
@ -272,10 +272,10 @@ index b2effb5c2ec..438dfc6fef3 100644
settings->clipping = state->render_states[WINED3D_RS_CLIPPING]
&& state->render_states[WINED3D_RS_CLIPPLANEENABLE];
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 08f4f01f7e6..a2be7326834 100644
index e26f991c222..de189571363 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2725,7 +2725,7 @@ struct wined3d_ffp_vs_settings
@@ -2731,7 +2731,7 @@ struct wined3d_ffp_vs_settings
DWORD flatshading : 1;
DWORD swizzle_map : 16; /* MAX_ATTRIBS, 16 */
DWORD vb_indices : 1;
@ -284,7 +284,7 @@ index 08f4f01f7e6..a2be7326834 100644
DWORD texgen[MAX_TEXTURES];
};
@@ -4317,6 +4317,20 @@ static inline BOOL use_indexed_vertex_blending(const struct wined3d_state *state
@@ -4280,6 +4280,20 @@ static inline BOOL use_indexed_vertex_blending(const struct wined3d_state *state
return TRUE;
}
@ -306,5 +306,5 @@ index 08f4f01f7e6..a2be7326834 100644
{
/* Check state->vertex_declaration to allow this to be used before the
--
2.14.1
2.14.2

View File

@ -1,3 +1,2 @@
Fixes: [39057] Support for indexed vertex blending
Depends: wined3d-WINED3D_RS_COLORWRITEENABLE
Depends: wined3d-DrawIndirect

View File

@ -1,61 +0,0 @@
From b50ae90472ecc8c926c11777ac40770b8a39dcd3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 20 Jul 2017 01:22:39 +0200
Subject: d3d11/tests: Add basic instance offset drawing test.
---
dlls/d3d11/tests/d3d11.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 9e05624bcf6..a932925b067 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -10057,6 +10057,12 @@ static void test_il_append_aligned(void)
{
{{0.5f, 0.5f}, {0.0f, 1.0f}},
{{0.5f, 0.5f}, {1.0f, 1.0f}},
+ /* fill data */
+ {{0.0f, 0.0f}, {0.0f, 0.0f}},
+ {{0.0f, 0.0f}, {0.0f, 0.0f}},
+ /* instance offset 4 */
+ {{0.5f, 0.5f}, {0.0f, 1.0f}},
+ {{0.5f, 0.5f}, {1.0f, 1.0f}},
};
static const struct
{
@@ -10069,6 +10075,11 @@ static void test_il_append_aligned(void)
{{0.5f, 0.5f}, {0.0f, 1.0f}},
{{0.5f, 0.5f}, {0.0f, 0.0f}},
{{0.5f, 0.5f}, {1.0f, 0.0f}},
+ /* instance offset 4 */
+ {{0.5f, 0.5f}, {0.0f, 1.0f}},
+ {{0.5f, 0.5f}, {1.0f, 0.0f}},
+ {{0.5f, 0.5f}, {1.0f, 0.0f}},
+ {{0.5f, 0.5f}, {0.0f, 0.0f}},
};
static const float red[] = {1.0f, 0.0f, 0.0f, 0.5f};
@@ -10116,6 +10127,19 @@ static void test_il_append_aligned(void)
color = get_texture_color(test_context.backbuffer, 560, 240);
ok(compare_color(color, 0xffff00ff, 1), "Got unexpected color 0x%08x.\n", color);
+ ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, red);
+
+ ID3D11DeviceContext_DrawInstanced(context, 4, 4, 0, 4);
+
+ color = get_texture_color(test_context.backbuffer, 80, 240);
+ todo_wine ok(compare_color(color, 0xff00ff00, 1), "Got unexpected color 0x%08x.\n", color);
+ color = get_texture_color(test_context.backbuffer, 240, 240);
+ todo_wine ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color);
+ color = get_texture_color(test_context.backbuffer, 400, 240);
+ todo_wine ok(compare_color(color, 0xffff00ff, 1), "Got unexpected color 0x%08x.\n", color);
+ color = get_texture_color(test_context.backbuffer, 560, 240);
+ todo_wine ok(compare_color(color, 0xffff0000, 1), "Got unexpected color 0x%08x.\n", color);
+
ID3D11PixelShader_Release(ps);
ID3D11VertexShader_Release(vs);
ID3D11Buffer_Release(vb[2]);
--
2.13.1

View File

@ -1,109 +0,0 @@
From 3a0ccfe9a6ae71785b62a69b1537ec0e544fcf51 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 20 Jul 2017 02:33:21 +0200
Subject: wined3d: Add support for start instance in draw_primitive_arrays.
---
dlls/d3d11/tests/d3d11.c | 8 ++++----
dlls/wined3d/directx.c | 4 ++++
dlls/wined3d/drawprim.c | 16 +++++++++++++++-
dlls/wined3d/wined3d_gl.h | 1 +
4 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index a932925b067..2cfc9ce812d 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -10132,13 +10132,13 @@ static void test_il_append_aligned(void)
ID3D11DeviceContext_DrawInstanced(context, 4, 4, 0, 4);
color = get_texture_color(test_context.backbuffer, 80, 240);
- todo_wine ok(compare_color(color, 0xff00ff00, 1), "Got unexpected color 0x%08x.\n", color);
+ ok(compare_color(color, 0xff00ff00, 1), "Got unexpected color 0x%08x.\n", color);
color = get_texture_color(test_context.backbuffer, 240, 240);
- todo_wine ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color);
+ ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color);
color = get_texture_color(test_context.backbuffer, 400, 240);
- todo_wine ok(compare_color(color, 0xffff00ff, 1), "Got unexpected color 0x%08x.\n", color);
+ ok(compare_color(color, 0xffff00ff, 1), "Got unexpected color 0x%08x.\n", color);
color = get_texture_color(test_context.backbuffer, 560, 240);
- todo_wine ok(compare_color(color, 0xffff0000, 1), "Got unexpected color 0x%08x.\n", color);
+ ok(compare_color(color, 0xffff0000, 1), "Got unexpected color 0x%08x.\n", color);
ID3D11PixelShader_Release(ps);
ID3D11VertexShader_Release(vs);
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 9862731bcba..d2815b8b3ac 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -109,6 +109,7 @@ static const struct wined3d_extension_map gl_extension_map[] =
{"GL_APPLE_ycbcr_422", APPLE_YCBCR_422 },
/* ARB */
+ {"GL_ARB_base_instance", ARB_BASE_INSTANCE },
{"GL_ARB_blend_func_extended", ARB_BLEND_FUNC_EXTENDED },
{"GL_ARB_clear_buffer_object", ARB_CLEAR_BUFFER_OBJECT },
{"GL_ARB_clear_texture", ARB_CLEAR_TEXTURE },
@@ -2698,6 +2699,9 @@ static void load_gl_funcs(struct wined3d_gl_info *gl_info)
/* GL_APPLE_flush_buffer_range */
USE_GL_FUNC(glBufferParameteriAPPLE)
USE_GL_FUNC(glFlushMappedBufferRangeAPPLE)
+ /* GL_ARB_base_instance */
+ USE_GL_FUNC(glDrawArraysInstancedBaseInstance)
+ USE_GL_FUNC(glDrawElementsInstancedBaseVertexBaseInstance)
/* GL_ARB_blend_func_extended */
USE_GL_FUNC(glBindFragDataLocationIndexed)
USE_GL_FUNC(glGetFragDataIndex)
diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index e9bce44a422..ad1e587cca7 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -72,18 +72,32 @@ static void draw_primitive_arrays(struct wined3d_context *context, const struct
return;
}
- if (start_instance)
+ if (start_instance && !(gl_info->supported[ARB_BASE_INSTANCE] && gl_info->supported[ARB_INSTANCED_ARRAYS]))
FIXME("Start instance (%u) not supported.\n", start_instance);
if (gl_info->supported[ARB_INSTANCED_ARRAYS])
{
if (!idx_size)
{
+ if (gl_info->supported[ARB_BASE_INSTANCE])
+ {
+ GL_EXTCALL(glDrawArraysInstancedBaseInstance(state->gl_primitive_type, start_idx, count, instance_count, start_instance));
+ checkGLcall("glDrawArraysInstancedBaseInstance");
+ return;
+ }
+
GL_EXTCALL(glDrawArraysInstanced(state->gl_primitive_type, start_idx, count, instance_count));
checkGLcall("glDrawArraysInstanced");
return;
}
+ if (gl_info->supported[ARB_BASE_INSTANCE])
+ {
+ GL_EXTCALL(glDrawElementsInstancedBaseVertexBaseInstance(state->gl_primitive_type, count, idx_type,
+ (const char *)idx_data + (idx_size * start_idx), instance_count, base_vertex_idx, start_instance));
+ checkGLcall("glDrawElementsInstancedBaseVertexBaseInstance");
+ return;
+ }
if (gl_info->supported[ARB_DRAW_ELEMENTS_BASE_VERTEX])
{
GL_EXTCALL(glDrawElementsInstancedBaseVertex(state->gl_primitive_type, count, idx_type,
diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h
index cac22963f0a..a048dc1d74e 100644
--- a/dlls/wined3d/wined3d_gl.h
+++ b/dlls/wined3d/wined3d_gl.h
@@ -43,6 +43,7 @@ enum wined3d_gl_extension
APPLE_FLUSH_BUFFER_RANGE,
APPLE_YCBCR_422,
/* ARB */
+ ARB_BASE_INSTANCE,
ARB_BLEND_FUNC_EXTENDED,
ARB_CLEAR_BUFFER_OBJECT,
ARB_CLEAR_TEXTURE,
--
2.13.1

View File

@ -1 +0,0 @@
Fixes: Implement support for start instance in draw_primitive_arrays

View File

@ -1,4 +1,3 @@
Fixes: Implement vsync handling for d3d10/d3d11
Depends: wined3d-DrawIndirect
Depends: dxgi-DXGI_PRESENT_TEST
Depends: wined3d-Silence_FIXMEs