Added patch to implement support for start instance in draw_primitive_arrays.

This commit is contained in:
Sebastian Lackner 2017-07-20 15:24:23 +02:00
parent 43f5b05fd5
commit 8706a334ad
4 changed files with 189 additions and 0 deletions

View File

@ -446,6 +446,7 @@ patch_enable_all ()
enable_wined3d_Silence_FIXMEs="$1"
enable_wined3d_WINED3DFMT_R32G32_UINT="$1"
enable_wined3d_buffer_create="$1"
enable_wined3d_draw_primitive_arrays="$1"
enable_wined3d_sample_c_lz="$1"
enable_wined3d_wined3d_guess_gl_vendor="$1"
enable_winedbg_Process_Arguments="$1"
@ -1594,6 +1595,9 @@ patch_enable ()
wined3d-buffer_create)
enable_wined3d_buffer_create="$2"
;;
wined3d-draw_primitive_arrays)
enable_wined3d_draw_primitive_arrays="$2"
;;
wined3d-sample_c_lz)
enable_wined3d_sample_c_lz="$2"
;;
@ -9334,6 +9338,20 @@ if test "$enable_wined3d_buffer_create" -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-sample_c_lz
# |
# | This patchset fixes the following Wine bugs:

View File

@ -0,0 +1,61 @@
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

@ -0,0 +1,109 @@
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

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