Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to wine-staging 3.14 #65

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -9,6 +9,6 @@ Several related changes are included in the patchset as well:

**This patchset is prototype-quality at the moment. If `ARB_buffer_storage` is not present, you're not going to have a good time.**

Currently, these patches are based off wine-staging 3.7.
Currently, these patches are based off wine-staging 3.14.

[Details can be found here.](https://comminos.com/posts/2018-02-21-wined3d-profiling.html)
@@ -1,33 +1,54 @@
From db8f9546baea233a4bcfae27fa12d655e7c4be3d Mon Sep 17 00:00:00 2001
From aa286ccab751f7bf77c13734e8a83aed6fdf50a0 Mon Sep 17 00:00:00 2001
From: Andrew Comminos <andrew@comminos.com>
Date: Mon, 5 Mar 2018 15:38:35 -0800
Subject: [PATCH 1/9] wined3d: Initial implementation of a persistent mapped
buffer allocator.

---
dlls/wined3d/Makefile.in | 1 +
dlls/wined3d/adapter_gl.c | 3 +
dlls/wined3d/buffer_heap.c | 508 +++++++++++++++++++++++++++++++++
dlls/wined3d/cs.c | 9 +
dlls/wined3d/device.c | 52 ++++
dlls/wined3d/directx.c | 3 +
dlls/wined3d/query.c | 2 +-
dlls/wined3d/wined3d_gl.h | 1 +
dlls/wined3d/wined3d_private.h | 68 ++++-
8 files changed, 640 insertions(+), 4 deletions(-)
create mode 100644 dlls/wined3d/buffer_heap.c

diff --git a/dlls/wined3d/Makefile.in b/dlls/wined3d/Makefile.in
index b850ba6872c..52ef8666fb7 100644
index abc0ec6adba..a1a37c0e03b 100644
--- a/dlls/wined3d/Makefile.in
+++ b/dlls/wined3d/Makefile.in
@@ -6,6 +6,7 @@ C_SRCS = \
@@ -7,6 +7,7 @@ C_SRCS = \
arb_program_shader.c \
ati_fragment_shader.c \
buffer.c \
+ buffer_heap.c \
context.c \
cs.c \
device.c \
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c
index 11cf6cac691..b932ae9e3fc 100644
--- a/dlls/wined3d/adapter_gl.c
+++ b/dlls/wined3d/adapter_gl.c
@@ -58,6 +58,7 @@ static const struct wined3d_extension_map gl_extension_map[] =
/* ARB */
{"GL_ARB_base_instance", ARB_BASE_INSTANCE },
{"GL_ARB_blend_func_extended", ARB_BLEND_FUNC_EXTENDED },
+ {"GL_ARB_buffer_storage", ARB_BUFFER_STORAGE },
{"GL_ARB_clear_buffer_object", ARB_CLEAR_BUFFER_OBJECT },
{"GL_ARB_clear_texture", ARB_CLEAR_TEXTURE },
{"GL_ARB_clip_control", ARB_CLIP_CONTROL },
@@ -2075,6 +2076,8 @@ static void load_gl_funcs(struct wined3d_gl_info *gl_info)
/* GL_ARB_blend_func_extended */
USE_GL_FUNC(glBindFragDataLocationIndexed)
USE_GL_FUNC(glGetFragDataIndex)
+ /* GL_ARB_buffer_storage */
+ USE_GL_FUNC(glBufferStorage)
/* GL_ARB_clear_buffer_object */
USE_GL_FUNC(glClearBufferData)
USE_GL_FUNC(glClearBufferSubData)
diff --git a/dlls/wined3d/buffer_heap.c b/dlls/wined3d/buffer_heap.c
new file mode 100644
index 00000000000..b133bd68933
Expand Down Expand Up @@ -543,10 +564,10 @@ index 00000000000..b133bd68933
+ return WINED3D_OK;
+}
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index c60d67b83a7..e2bfd88dd2c 100644
index 488369cf72e..ea8903f8e61 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -467,6 +467,15 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
@@ -526,6 +526,15 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
}

InterlockedDecrement(&cs->pending_presents);
Expand All @@ -563,7 +584,7 @@ index c60d67b83a7..e2bfd88dd2c 100644

void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain,
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index b97b7b963ba..f6bf07604c7 100644
index 49be6e8af47..ae52fda9422 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -837,6 +837,53 @@ static void destroy_default_samplers(struct wined3d_device *device, struct wined
Expand Down Expand Up @@ -639,29 +660,8 @@ index b97b7b963ba..f6bf07604c7 100644
context_release(context);
}

diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index d55d5674f4f..eabdb658b48 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -111,6 +111,7 @@ static const struct wined3d_extension_map gl_extension_map[] =
/* ARB */
{"GL_ARB_base_instance", ARB_BASE_INSTANCE },
{"GL_ARB_blend_func_extended", ARB_BLEND_FUNC_EXTENDED },
+ {"GL_ARB_buffer_storage", ARB_BUFFER_STORAGE },
{"GL_ARB_clear_buffer_object", ARB_CLEAR_BUFFER_OBJECT },
{"GL_ARB_clear_texture", ARB_CLEAR_TEXTURE },
{"GL_ARB_clip_control", ARB_CLIP_CONTROL },
@@ -2713,6 +2714,8 @@ static void load_gl_funcs(struct wined3d_gl_info *gl_info)
/* GL_ARB_blend_func_extended */
USE_GL_FUNC(glBindFragDataLocationIndexed)
USE_GL_FUNC(glGetFragDataIndex)
+ /* GL_ARB_buffer_storage */
+ USE_GL_FUNC(glBufferStorage)
/* GL_ARB_clear_buffer_object */
USE_GL_FUNC(glClearBufferData)
USE_GL_FUNC(glClearBufferSubData)
diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
index 5ea79b6e4a7..f3ca1630e58 100644
index 1eb35306b9a..bf1ece51ac4 100644
--- a/dlls/wined3d/query.c
+++ b/dlls/wined3d/query.c
@@ -88,7 +88,7 @@ static BOOL wined3d_fence_supported(const struct wined3d_gl_info *gl_info)
Expand All @@ -674,7 +674,7 @@ index 5ea79b6e4a7..f3ca1630e58 100644
{
const struct wined3d_gl_info *gl_info;
diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h
index bbee7881f2f..730eff131f3 100644
index 14f8a497344..21f842c9933 100644
--- a/dlls/wined3d/wined3d_gl.h
+++ b/dlls/wined3d/wined3d_gl.h
@@ -44,6 +44,7 @@ enum wined3d_gl_extension
Expand All @@ -686,10 +686,10 @@ index bbee7881f2f..730eff131f3 100644
ARB_CLEAR_TEXTURE,
ARB_CLIP_CONTROL,
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index ee4e1a4d6c3..dea1c2f5207 100644
index 50e182e5780..d8a813858be 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1726,6 +1726,9 @@ void wined3d_fence_destroy(struct wined3d_fence *fence) DECLSPEC_HIDDEN;
@@ -1710,6 +1710,9 @@ void wined3d_fence_destroy(struct wined3d_fence *fence) DECLSPEC_HIDDEN;
void wined3d_fence_issue(struct wined3d_fence *fence, const struct wined3d_device *device) DECLSPEC_HIDDEN;
enum wined3d_fence_result wined3d_fence_wait(const struct wined3d_fence *fence,
const struct wined3d_device *device) DECLSPEC_HIDDEN;
Expand All @@ -699,7 +699,7 @@ index ee4e1a4d6c3..dea1c2f5207 100644

/* Direct3D terminology with little modifications. We do not have an issued
* state because only the driver knows about it, but we have a created state
@@ -3015,6 +3018,10 @@ struct wined3d_device
@@ -3048,6 +3051,10 @@ struct wined3d_device
/* Context management */
struct wined3d_context **contexts;
UINT context_count;
Expand All @@ -710,7 +710,7 @@ index ee4e1a4d6c3..dea1c2f5207 100644
};

void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, const struct wined3d_fb_state *fb,
@@ -3522,6 +3529,12 @@ void state_init(struct wined3d_state *state, struct wined3d_fb_state *fb,
@@ -3557,6 +3564,12 @@ void state_init(struct wined3d_state *state, struct wined3d_fb_state *fb,
DWORD flags) DECLSPEC_HIDDEN;
void state_unbind_resources(struct wined3d_state *state) DECLSPEC_HIDDEN;

Expand All @@ -723,7 +723,7 @@ index ee4e1a4d6c3..dea1c2f5207 100644
enum wined3d_cs_queue_id
{
WINED3D_CS_QUEUE_DEFAULT = 0,
@@ -3699,12 +3712,61 @@ enum wined3d_buffer_conversion_type
@@ -3734,12 +3747,61 @@ enum wined3d_buffer_conversion_type
CONV_POSITIONT,
};

Expand Down Expand Up @@ -789,5 +789,5 @@ index ee4e1a4d6c3..dea1c2f5207 100644
{
struct wined3d_resource resource;
--
2.17.0
2.18.0

@@ -1,4 +1,4 @@
From 21a562c674ab753e3f818d4c2fc96af6cbe27013 Mon Sep 17 00:00:00 2001
From 8777f63a02d819ce4adc38d7ce4969ea95ad051c Mon Sep 17 00:00:00 2001
From: Andrew Comminos <andrew@comminos.com>
Date: Mon, 5 Mar 2018 15:39:11 -0800
Subject: [PATCH 2/9] wined3d: Add support for backing dynamic wined3d_buffer
Expand All @@ -16,7 +16,7 @@ Subject: [PATCH 2/9] wined3d: Add support for backing dynamic wined3d_buffer
8 files changed, 336 insertions(+), 10 deletions(-)

diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index 2350661e363..40c454e4668 100644
index bf1486b8c11..4a4f23b878c 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -28,12 +28,14 @@
Expand Down Expand Up @@ -331,7 +331,7 @@ index 2350661e363..40c454e4668 100644
};

static GLenum buffer_type_hint_from_bind_flags(const struct wined3d_gl_info *gl_info,
@@ -1392,12 +1590,30 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device
@@ -1394,12 +1592,30 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device
buffer->flags |= WINED3D_BUFFER_PIN_SYSMEM;
}

Expand Down Expand Up @@ -364,10 +364,10 @@ index 2350661e363..40c454e4668 100644
TRACE("Not creating a BO because GL_ARB_vertex_buffer is not supported.\n");
}
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index cff50df6574..698ba6fc8f2 100644
index 0e86f76e961..a47ed2862ea 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -4970,7 +4970,11 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s
@@ -4979,7 +4979,11 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s
if (parameters->indexed)
{
struct wined3d_buffer *index_buffer = state->index_buffer;
Expand All @@ -381,7 +381,7 @@ index cff50df6574..698ba6fc8f2 100644
idx_data = index_buffer->resource.heap_memory;
}
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index e2bfd88dd2c..a11d21d1961 100644
index ea8903f8e61..76f9648d857 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -73,6 +73,7 @@ enum wined3d_cs_op
Expand All @@ -406,7 +406,7 @@ index e2bfd88dd2c..a11d21d1961 100644
struct wined3d_cs_stop
{
enum wined3d_cs_op opcode;
@@ -2025,7 +2033,7 @@ static void wined3d_cs_exec_map(struct wined3d_cs *cs, const void *data)
@@ -2083,7 +2091,7 @@ static void wined3d_cs_exec_map(struct wined3d_cs *cs, const void *data)
const struct wined3d_cs_map *op = data;
struct wined3d_resource *resource = op->resource;

Expand All @@ -415,7 +415,7 @@ index e2bfd88dd2c..a11d21d1961 100644
op->sub_resource_idx, op->map_desc, op->box, op->flags);
}

@@ -2059,7 +2067,7 @@ static void wined3d_cs_exec_unmap(struct wined3d_cs *cs, const void *data)
@@ -2117,7 +2125,7 @@ static void wined3d_cs_exec_unmap(struct wined3d_cs *cs, const void *data)
const struct wined3d_cs_unmap *op = data;
struct wined3d_resource *resource = op->resource;

Expand All @@ -424,7 +424,7 @@ index e2bfd88dd2c..a11d21d1961 100644
}

HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx)
@@ -2454,6 +2462,53 @@ void wined3d_cs_emit_generate_mipmaps(struct wined3d_cs *cs, struct wined3d_shad
@@ -2512,6 +2520,53 @@ void wined3d_cs_emit_generate_mipmaps(struct wined3d_cs *cs, struct wined3d_shad
cs->ops->submit(cs, WINED3D_CS_QUEUE_DEFAULT);
}

Expand Down Expand Up @@ -478,7 +478,7 @@ index e2bfd88dd2c..a11d21d1961 100644
static void wined3d_cs_emit_stop(struct wined3d_cs *cs)
{
struct wined3d_cs_stop *op;
@@ -2514,6 +2569,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
@@ -2572,6 +2627,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_CLEAR_UNORDERED_ACCESS_VIEW */ wined3d_cs_exec_clear_unordered_access_view,
/* WINED3D_CS_OP_COPY_UAV_COUNTER */ wined3d_cs_exec_copy_uav_counter,
/* WINED3D_CS_OP_GENERATE_MIPMAPS */ wined3d_cs_exec_generate_mipmaps,
Expand All @@ -487,7 +487,7 @@ index e2bfd88dd2c..a11d21d1961 100644

static BOOL wined3d_cs_st_check_space(struct wined3d_cs *cs, size_t size, enum wined3d_cs_queue_id queue_id)
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
index df73997c84c..7060d71613a 100644
index d856f6b446c..e136f14ab0b 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -334,6 +334,7 @@ static DWORD wined3d_resource_sanitise_map_flags(const struct wined3d_resource *
Expand Down Expand Up @@ -533,10 +533,10 @@ index df73997c84c..7060d71613a 100644

UINT CDECL wined3d_resource_update_info(struct wined3d_resource *resource, unsigned int sub_resource_idx,
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 89f2576fd01..6564f7cc180 100644
index 1bd38632b82..07d8d69083f 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -4348,7 +4348,11 @@ static void indexbuffer(struct wined3d_context *context, const struct wined3d_st
@@ -4323,7 +4323,11 @@ static void indexbuffer(struct wined3d_context *context, const struct wined3d_st
else
{
struct wined3d_buffer *ib = state->index_buffer;
Expand All @@ -549,15 +549,15 @@ index 89f2576fd01..6564f7cc180 100644
}
}

@@ -4414,6 +4418,7 @@ static void state_cb(struct wined3d_context *context, const struct wined3d_state
@@ -4407,6 +4411,7 @@ static void state_cb(struct wined3d_context *context, const struct wined3d_state
enum wined3d_shader_type shader_type;
struct wined3d_buffer *buffer;
unsigned int i, base, count;
+ struct wined3d_bo_address bo_addr;

TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id);

@@ -4426,7 +4431,15 @@ static void state_cb(struct wined3d_context *context, const struct wined3d_state
@@ -4419,7 +4424,15 @@ static void state_cb(struct wined3d_context *context, const struct wined3d_state
for (i = 0; i < count; ++i)
{
buffer = state->cb[shader_type][i];
Expand All @@ -575,10 +575,10 @@ index 89f2576fd01..6564f7cc180 100644
checkGLcall("bind constant buffers");
}
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 3290879451d..e15cfa42544 100644
index 540f58b6641..dafa0ef6f3a 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -2216,6 +2216,12 @@ static void wined3d_texture_unload(struct wined3d_resource *resource)
@@ -2243,6 +2243,12 @@ static void wined3d_texture_unload(struct wined3d_resource *resource)

static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resource, unsigned int sub_resource_idx,
struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags)
Expand All @@ -591,7 +591,7 @@ index 3290879451d..e15cfa42544 100644
{
const struct wined3d_format *format = resource->format;
struct wined3d_texture_sub_resource *sub_resource;
@@ -2376,6 +2382,11 @@ static HRESULT texture_resource_sub_resource_map_info(struct wined3d_resource *r
@@ -2403,6 +2409,11 @@ static HRESULT texture_resource_sub_resource_map_info(struct wined3d_resource *r
}

static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx)
Expand All @@ -603,7 +603,7 @@ index 3290879451d..e15cfa42544 100644
{
struct wined3d_texture_sub_resource *sub_resource;
struct wined3d_device *device = resource->device;
@@ -2428,6 +2439,8 @@ static const struct wined3d_resource_ops texture_resource_ops =
@@ -2455,6 +2466,8 @@ static const struct wined3d_resource_ops texture_resource_ops =
texture_resource_sub_resource_map,
texture_resource_sub_resource_map_info,
texture_resource_sub_resource_unmap,
Expand All @@ -613,10 +613,10 @@ index 3290879451d..e15cfa42544 100644

/* Context activation is done by the caller. */
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index a092c83e03b..f834decba88 100644
index cfa2d3cfb82..1ea542d83f8 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -6322,6 +6322,7 @@ const char *wined3d_debug_location(DWORD location)
@@ -6565,6 +6565,7 @@ const char *wined3d_debug_location(DWORD location)
LOCATION_TO_STR(WINED3D_LOCATION_DRAWABLE);
LOCATION_TO_STR(WINED3D_LOCATION_RB_MULTISAMPLE);
LOCATION_TO_STR(WINED3D_LOCATION_RB_RESOLVED);
Expand All @@ -625,18 +625,18 @@ index a092c83e03b..f834decba88 100644
if (location)
FIXME("Unrecognized location flag(s) %#x.\n", location);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index dea1c2f5207..4918293b82b 100644
index d8a813858be..bc8ba6e708a 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1484,6 +1484,7 @@ struct wined3d_bo_address
@@ -1468,6 +1468,7 @@ struct wined3d_bo_address
{
GLuint buffer_object;
BYTE *addr;
+ GLsizeiptr length;
};

struct wined3d_const_bo_address
@@ -3063,6 +3064,9 @@ struct wined3d_resource_ops
@@ -3096,6 +3097,9 @@ struct wined3d_resource_ops
HRESULT (*resource_map_info)(struct wined3d_resource *resource, unsigned int sub_resource_idx,
struct wined3d_map_info *info, DWORD flags);
HRESULT (*resource_sub_resource_unmap)(struct wined3d_resource *resource, unsigned int sub_resource_idx);
Expand All @@ -646,23 +646,23 @@ index dea1c2f5207..4918293b82b 100644
};

struct wined3d_resource
@@ -3377,6 +3381,7 @@ void wined3d_texture_validate_location(struct wined3d_texture *texture,
@@ -3412,6 +3416,7 @@ void wined3d_texture_validate_location(struct wined3d_texture *texture,
#define WINED3D_LOCATION_DRAWABLE 0x00000040
#define WINED3D_LOCATION_RB_MULTISAMPLE 0x00000080
#define WINED3D_LOCATION_RB_RESOLVED 0x00000100
+#define WINED3D_LOCATION_PERSISTENT_MAP 0x00000200

const char *wined3d_debug_location(DWORD location) DECLSPEC_HIDDEN;

@@ -3679,6 +3684,7 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou
@@ -3714,6 +3719,7 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou
void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *resource,
unsigned int sub_resource_idx, const struct wined3d_box *box, const void *data, unsigned int row_pitch,
unsigned int slice_pitch) DECLSPEC_HIDDEN;
+void wined3d_cs_emit_discard_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer, struct wined3d_map_range map_range) DECLSPEC_HIDDEN;
void wined3d_cs_init_object(struct wined3d_cs *cs,
void (*callback)(void *object), void *object) DECLSPEC_HIDDEN;
HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx,
@@ -3791,6 +3797,11 @@ struct wined3d_buffer
@@ -3826,6 +3832,11 @@ struct wined3d_buffer
UINT stride; /* 0 if no conversion */
enum wined3d_buffer_conversion_type *conversion_map; /* NULL if no conversion */
UINT conversion_stride; /* 0 if no shifted conversion */
Expand All @@ -675,5 +675,5 @@ index dea1c2f5207..4918293b82b 100644

static inline struct wined3d_buffer *buffer_from_resource(struct wined3d_resource *resource)
--
2.17.0
2.18.0