wined3d-CSMT_Main: Reenable CSMT patchset.

FIXME: Adjust CSMT patches to be compatible with the new buffer management.
This commit is contained in:
Sebastian Lackner 2016-11-01 15:54:37 +01:00
parent 1f8b19cb25
commit 5216147032
125 changed files with 2441 additions and 189 deletions

View File

@ -368,6 +368,7 @@ patch_enable_all ()
enable_wined3d_1DTextures="$1"
enable_wined3d_Accounting="$1"
enable_wined3d_CSMT_Helper="$1"
enable_wined3d_CSMT_Main="$1"
enable_wined3d_DXTn="$1"
enable_wined3d_GTX_560M="$1"
enable_wined3d_Invalidate_INDEXBUFFER="$1"
@ -1288,6 +1289,9 @@ patch_enable ()
wined3d-CSMT_Helper)
enable_wined3d_CSMT_Helper="$2"
;;
wined3d-CSMT_Main)
enable_wined3d_CSMT_Main="$2"
;;
wined3d-DXTn)
enable_wined3d_DXTn="$2"
;;
@ -2014,6 +2018,13 @@ if test "$enable_wpcap_Dynamic_Linking" -eq 1; then
enable_wpcap_Several_Fixes=1
fi
if test "$enable_wined3d_CSMT_Main" -eq 1; then
if test "$enable_wined3d_CSMT_Helper" -gt 1; then
abort "Patchset wined3d-CSMT_Helper disabled, but wined3d-CSMT_Main depends on that."
fi
enable_wined3d_CSMT_Helper=1
fi
if test "$enable_wined3d_CSMT_Helper" -eq 1; then
if test "$enable_makedep_PARENTSPEC" -gt 1; then
abort "Patchset makedep-PARENTSPEC disabled, but wined3d-CSMT_Helper depends on that."
@ -2030,6 +2041,9 @@ if test "$enable_wined3d_CSMT_Helper" -eq 1; then
if test "$enable_wined3d_DXTn" -gt 1; then
abort "Patchset wined3d-DXTn disabled, but wined3d-CSMT_Helper depends on that."
fi
if test "$enable_wined3d_Invalidate_INDEXBUFFER" -gt 1; then
abort "Patchset wined3d-Invalidate_INDEXBUFFER disabled, but wined3d-CSMT_Helper depends on that."
fi
if test "$enable_wined3d_QUERY_Stubs" -gt 1; then
abort "Patchset wined3d-QUERY_Stubs disabled, but wined3d-CSMT_Helper depends on that."
fi
@ -2044,6 +2058,7 @@ if test "$enable_wined3d_CSMT_Helper" -eq 1; then
enable_wined3d_1DTextures=1
enable_wined3d_Accounting=1
enable_wined3d_DXTn=1
enable_wined3d_Invalidate_INDEXBUFFER=1
enable_wined3d_QUERY_Stubs=1
enable_wined3d_Revert_Pixel_Center_Offset=1
enable_wined3d_Silence_FIXMEs=1
@ -7490,6 +7505,18 @@ if test "$enable_wined3d_Accounting" -eq 1; then
) >> "$patchlist"
fi
# Patchset wined3d-Invalidate_INDEXBUFFER
# |
# | Modified files:
# | * dlls/wined3d/buffer.c
# |
if test "$enable_wined3d_Invalidate_INDEXBUFFER" -eq 1; then
patch_apply wined3d-Invalidate_INDEXBUFFER/0001-wined3d-Invalidate-INDEXBUFFER-device-state-when-bou.patch
(
echo '+ { "Józef Kucia", "wined3d: Invalidate INDEXBUFFER device state when bound index buffer is unloaded.", 1 },';
) >> "$patchlist"
fi
# Patchset wined3d-QUERY_Stubs
# |
# | This patchset fixes the following Wine bugs:
@ -7545,8 +7572,8 @@ fi
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * makedep-PARENTSPEC, ntdll-Attach_Process_DLLs, ntdll-DllOverrides_WOW64, ntdll-Loader_Machine_Type, ntdll-DllRedirects,
# | wined3d-1DTextures, wined3d-Accounting, wined3d-DXTn, wined3d-QUERY_Stubs, wined3d-Revert_Pixel_Center_Offset, wined3d-
# | Silence_FIXMEs
# | wined3d-1DTextures, wined3d-Accounting, wined3d-DXTn, wined3d-Invalidate_INDEXBUFFER, wined3d-QUERY_Stubs, wined3d-
# | Revert_Pixel_Center_Offset, wined3d-Silence_FIXMEs
# |
# | Modified files:
# | * configure.ac, dlls/wined3d-csmt/Makefile.in, dlls/wined3d-csmt/version.rc
@ -7570,18 +7597,6 @@ if test "$enable_wined3d_GTX_560M" -eq 1; then
) >> "$patchlist"
fi
# Patchset wined3d-Invalidate_INDEXBUFFER
# |
# | Modified files:
# | * dlls/wined3d/buffer.c
# |
if test "$enable_wined3d_Invalidate_INDEXBUFFER" -eq 1; then
patch_apply wined3d-Invalidate_INDEXBUFFER/0001-wined3d-Invalidate-INDEXBUFFER-device-state-when-bou.patch
(
echo '+ { "Józef Kucia", "wined3d: Invalidate INDEXBUFFER device state when bound index buffer is unloaded.", 1 },';
) >> "$patchlist"
fi
# Patchset wined3d-Limit_Vram
# |
# | Modified files:
@ -7634,6 +7649,151 @@ if test "$enable_wined3d_check_format_support" -eq 1; then
) >> "$patchlist"
fi
# Patchset wined3d-CSMT_Main
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * makedep-PARENTSPEC, ntdll-Attach_Process_DLLs, ntdll-DllOverrides_WOW64, ntdll-Loader_Machine_Type, ntdll-DllRedirects,
# | wined3d-1DTextures, wined3d-Accounting, wined3d-DXTn, wined3d-Invalidate_INDEXBUFFER, wined3d-QUERY_Stubs, wined3d-
# | Revert_Pixel_Center_Offset, wined3d-Silence_FIXMEs, wined3d-CSMT_Helper
# |
# | This patchset fixes the following Wine bugs:
# | * [#11674] Support for CSMT (command stream) to increase graphic performance
# |
# | Modified files:
# | * dlls/wined3d/arb_program_shader.c, dlls/wined3d/buffer.c, dlls/wined3d/context.c, dlls/wined3d/cs.c,
# | dlls/wined3d/device.c, dlls/wined3d/drawprim.c, dlls/wined3d/glsl_shader.c, dlls/wined3d/query.c,
# | dlls/wined3d/resource.c, dlls/wined3d/sampler.c, dlls/wined3d/shader.c, dlls/wined3d/state.c, dlls/wined3d/stateblock.c,
# | dlls/wined3d/surface.c, dlls/wined3d/swapchain.c, dlls/wined3d/texture.c, dlls/wined3d/utils.c,
# | dlls/wined3d/wined3d_main.c, dlls/wined3d/wined3d_private.h
# |
if test "$enable_wined3d_CSMT_Main" -eq 1; then
patch_apply wined3d-CSMT_Main/9999-IfDefined.patch
(
echo '+ { "Sebastian Lackner", "Revert \"wined3d: Use buffer_bind() in buffer_conversion_upload().\".", 1 },';
echo '+ { "Sebastian Lackner", "Revert \"wined3d: Fix index offset for immediate mode draws.\".", 1 },';
echo '+ { "Sebastian Lackner", "Revert \"wined3d: Introduce buffer_conversion_upload() helper function.\".", 1 },';
echo '+ { "Sebastian Lackner", "Revert \"wined3d: Replace wined3d_buffer_load_sysmem() calls with wined3d_buffer_load_location().\".", 1 },';
echo '+ { "Sebastian Lackner", "Revert \"wined3d: Prefer current locations to WINED3D_LOCATION_SYSMEM in wined3d_buffer_copy().\".", 1 },';
echo '+ { "Sebastian Lackner", "Revert \"wined3d: Introduce wined3d_buffer_get_memory().\".", 1 },';
echo '+ { "Sebastian Lackner", "Revert \"wined3d: Implement wined3d_buffer_prepare_location() for WINED3D_LOCATION_BUFFER.\".", 1 },';
echo '+ { "Sebastian Lackner", "Revert \"wined3d: Move buffer_get_memory() under wined3d_buffer_load_sysmem().\".", 1 },';
echo '+ { "Sebastian Lackner", "Revert \"wined3d: Do not assume that WINED3D_LOCATION_SYSMEM is always valid for double buffered buffers.\".", 1 },';
echo '+ { "Sebastian Lackner", "Revert \"wined3d: Introduce wined3d_buffer_load_location().\".", 1 },';
echo '+ { "Sebastian Lackner", "Revert \"wined3d: Introduce wined3d_buffer_prepapre_location().\".", 1 },';
echo '+ { "Sebastian Lackner", "Revert \"wined3d: Explicitly track locations for buffers.\".", 1 },';
echo '+ { "Sebastian Lackner", "Revert \"wined3d: Clean up buffer_internal_preload().\".", 1 },';
echo '+ { "Sebastian Lackner", "Revert \"wined3d: Let buffer_direct_upload() invalidate STATE_INDEXBUFFER if needed.\".", 1 },';
echo '+ { "Sebastian Lackner", "Revert \"wined3d: Sanitise resource map flags in wined3d_resource_map().\".", 1 },';
echo '+ { "Sebastian Lackner", "Revert \"wined3d: Send resource unmaps through the command stream.\".", 1 },';
echo '+ { "Sebastian Lackner", "Revert \"wined3d: Send resource maps through the command stream.\".", 1 },';
echo '+ { "Sebastian Lackner", "Revert \"wined3d: Send shader constant updates through the command stream.\".", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Make surface_load_location return nothing.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Call texture_load_location instead of surface_load_location.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Share surface and volume system memory loading code.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Don'\''t call the public map function in surface_convert_format.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Don'\''t call the public map function in surface_cpu_blt.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Move the framebuffer into wined3d_state.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Preload buffers if streamsrc is not dirty.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Hackily introduce a multithreaded command stream.", 1 },';
echo '+ { "Henri Verbeet", "wined3d: Wait for resource updates to finish when using the multithreaded command stream.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Wait for the cs before destroying objects.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Give the cs its own state.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Send float constant updates through the command stream.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Request a glFinish before modifying resources outside the cs.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Finish the cs before changing the texture lod.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Don'\''t call glFinish after clears.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Don'\''t call glFinish after draws.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Pass the depth stencil to swapchain->present.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Keep track of the onscreen depth stencil in the command stream instead of the device.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Send base vertex index updates through the cs.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Send primitive type updates through the command stream.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Send bool constant updates through the command stream.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Send int constant updates through the command stream.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Send light updates through the command stream.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Prevent the command stream from running ahead too far.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Wait for the cs to finish before destroying the device.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Run the cs asynchronously.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Send blits through the command stream.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Hack to reject unsupported color fills.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Restore some wined3d_device_copy_sub_resource_region checks.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Don'\''t force strict draw ordering for multithreaded CS.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Send render target view clears through the command stream.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Send texture maps through the command stream.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Get rid of the end_scene flush and finish.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Replace the linked lists with a ringbuffer.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Don'\''t preload buffers on unmap.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Don'\''t call glFinish before swapping.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Add query support to the command stream.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Check our CS state to find out if a query is done.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Poll queries automatically in the CS.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Introduce a separate queue for priority commands.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Don'\''t poll queries that failed to start.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Remove restated queries from the poll list.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Put this into the query poll patch.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Don'\''t access device state in clears.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Avoid destroying views in color and depth fills.", 1 },';
echo '+ { "Matteo Bruni", "wined3d: Avoid calling wined3d_surface_blt() from surface_upload_from_surface().", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Send update_texture calls through the CS.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Get rid of the surface_upload_data glFinish.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Don'\''t lock the src volume in device_update_volume.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Fence update_texture calls.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Dirtify resources on unmap.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Fence render targets and depth stencils.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Fence blit operations.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Fence color_fill operations.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Make resource maps and unmaps a priority command.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Send update_sub_resource calls through the command stream.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Dirtify changed textures through the command stream.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Wrap GL BOs in a structure.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Separate resource map and draw buffers.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Implement DISCARD texture maps with PBOs.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Implement DISCARD resource maps with heap memory.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Unset some objects in state_init_default.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Use double-buffered buffers for multithreaded CS.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Don'\''t synchronize NOOVERWRITE buffer maps.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Separate buffer map write and draw read memory pointers.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Accelerate DISCARD buffer maps.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Accelerate READONLY buffer maps.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Access the buffer dirty areas through the CS.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Ignore buffer->resource.map_count in the CS.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Use glBufferSubData instead of glMapBufferRange.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Separate GL buffer discard control from ignoring MAP_DISCARD.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Create buffers before mapping them.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Remove another glFinish.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Create VBOs through the command stream.", 1 },';
echo '+ { "Stefan Dösinger", "Swapchain waits.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Unload resources through the CS in uninit_3d.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Unload resources through the CS in device_reset.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Don'\''t glFinish after a depth buffer blit.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Use surface_blt_ugly in swapchain_gl_present.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Use an event to block the worker thread when it is idle.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Set map_heap_memory = NULL when allocating a PBO.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Wait only for the buffer to be idle.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Put GL_APPLE_flush_buffer_range syncing back in place.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Don'\''t sync on redundant discard calls.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Don'\''t discard new buffers.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Don'\''t try to sync VBOs manually on OSX with CSMT.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Only discard buffers that are in use.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Send getdc and releasedc through the command stream.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Ignore WINED3D_MAP_NO_DIRTY_UPDATE in resource_map.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Create dummy textures through the CS.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Create the initial context through the CS.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Recreate ctx and dummy textures through the CS after resets.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Call create_default_sampler from create_dummy_textures.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Delete GL contexts through the CS in reset.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Delete GL contexts through the CS in uninit_3d.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Update the swap interval through the CS in reset.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Do the sampler GL init through the CS.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Create initial DCs through the CS.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Assign a read buffer when discarding a new texture.", 1 },';
echo '+ { "Sebastian Lackner", "wined3d: Do not query available GPU memory on main thread when CSMT is enabled.", 1 },';
echo '+ { "Nils Kuhnhenn", "wined3d: Fix incorrect return value in wined3d_cs_exec_set_light.", 1 },';
echo '+ { "Nils Kuhnhenn", "wined3d: Fix context_acquire not being called from the command thread in wined3d_texture_add_dirty_region.", 1 },';
echo '+ { "Sebastian Lackner", "wined3d: Do not signal CS event when we manage to unset waiting_for_event quickly enough.", 1 },';
echo '+ { "Sebastian Lackner", "wined3d: Enable CSMT by default, print a winediag message informing about this patchset.", 1 },';
) >> "$patchlist"
fi
# Patchset winedevice-Fix_Relocation
# |
# | This patchset fixes the following Wine bugs:

View File

@ -4,5 +4,6 @@ Depends: wined3d-QUERY_Stubs
Depends: wined3d-1DTextures
Depends: wined3d-Silence_FIXMEs
Depends: wined3d-Revert_Pixel_Center_Offset
Depends: wined3d-Invalidate_INDEXBUFFER
Depends: makedep-PARENTSPEC
Depends: ntdll-DllRedirects

View File

@ -0,0 +1,45 @@
From a03e60da52d29835dfbace07951eeb399959f3d5 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 1 Nov 2016 14:56:36 +0100
Subject: Revert "wined3d: Use buffer_bind() in buffer_conversion_upload()."
This reverts commit 61fef3bd1ead45deca83e94e404790d8d5f8e6c4.
---
dlls/wined3d/buffer.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index 13953c9..2030ae7 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -863,6 +863,10 @@ static void buffer_conversion_upload(struct wined3d_buffer *buffer, struct wined
unsigned int i, j, start, end, len, vertex_count;
BYTE *data;
+ /* This would potentially invalidate the element array buffer binding. */
+ if (buffer->buffer_type_hint != GL_ARRAY_BUFFER)
+ ERR("Converting data in non-vertex buffer.\n");
+
wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_SYSMEM);
/* Now for each vertex in the buffer that needs conversion. */
@@ -874,7 +878,6 @@ static void buffer_conversion_upload(struct wined3d_buffer *buffer, struct wined
return;
}
- buffer_bind(buffer, context);
while (buffer->modified_areas)
{
buffer->modified_areas--;
@@ -906,6 +909,8 @@ static void buffer_conversion_upload(struct wined3d_buffer *buffer, struct wined
}
}
+ GL_EXTCALL(glBindBuffer(buffer->buffer_type_hint, buffer->buffer_object));
+ checkGLcall("glBindBuffer");
GL_EXTCALL(glBufferSubData(buffer->buffer_type_hint, start, len, data + start));
checkGLcall("glBufferSubData");
}
--
2.9.0

View File

@ -0,0 +1,34 @@
From 1c9ae567bdc07ccff7628ffbb829fd4f1e1c32b6 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 1 Nov 2016 14:56:59 +0100
Subject: Revert "wined3d: Fix index offset for immediate mode draws."
This reverts commit 0581d8614784cd24340123eae520159aeb40ec0f.
---
dlls/wined3d/drawprim.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index 36c8d98..bf035ae 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -196,10 +196,12 @@ static void draw_primitive_immediate_mode(struct wined3d_context *context, const
if (instance_count)
FIXME("Instancing not implemented.\n");
- /* Immediate mode drawing can't make use of indices in a VBO - get the
- * data from the index buffer. */
- if (idx_size)
- idx_data = wined3d_buffer_load_sysmem(state->index_buffer, context) + state->index_offset;
+ /* Immediate mode drawing can't make use of indices in a vbo - get the
+ * data from the index buffer. If the index buffer has no vbo (not
+ * supported or other reason), or with user pointer drawing idx_data
+ * will be non-NULL. */
+ if (idx_size && !idx_data)
+ idx_data = wined3d_buffer_load_sysmem(state->index_buffer, context);
ops = &d3d_info->ffp_attrib_ops;
--
2.9.0

View File

@ -0,0 +1,165 @@
From bc2f8df73631e95d23607eeff765fff9fd9c1b63 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 1 Nov 2016 14:58:10 +0100
Subject: Revert "wined3d: Introduce buffer_conversion_upload() helper
function."
This reverts commit 6454242009715249b497fa7db9df21946b74d648.
---
dlls/wined3d/buffer.c | 122 +++++++++++++++++++++++---------------------------
1 file changed, 57 insertions(+), 65 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index 2030ae7..05be910 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -857,69 +857,6 @@ static void buffer_direct_upload(struct wined3d_buffer *This, struct wined3d_con
wined3d_buffer_validate_location(This, WINED3D_LOCATION_BUFFER);
}
-static void buffer_conversion_upload(struct wined3d_buffer *buffer, struct wined3d_context *context)
-{
- const struct wined3d_gl_info *gl_info = context->gl_info;
- unsigned int i, j, start, end, len, vertex_count;
- BYTE *data;
-
- /* This would potentially invalidate the element array buffer binding. */
- if (buffer->buffer_type_hint != GL_ARRAY_BUFFER)
- ERR("Converting data in non-vertex buffer.\n");
-
- wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_SYSMEM);
-
- /* Now for each vertex in the buffer that needs conversion. */
- vertex_count = buffer->resource.size / buffer->stride;
-
- if (!(data = HeapAlloc(GetProcessHeap(), 0, buffer->resource.size)))
- {
- ERR("Out of memory.\n");
- return;
- }
-
- while (buffer->modified_areas)
- {
- buffer->modified_areas--;
- start = buffer->maps[buffer->modified_areas].offset;
- len = buffer->maps[buffer->modified_areas].size;
- end = start + len;
-
- memcpy(data + start, (BYTE *)buffer->resource.heap_memory + start, end - start);
- for (i = start / buffer->stride; i < min((end / buffer->stride) + 1, vertex_count); ++i)
- {
- for (j = 0; j < buffer->stride;)
- {
- switch (buffer->conversion_map[j])
- {
- case CONV_NONE:
- /* Done already */
- j += sizeof(DWORD);
- break;
- case CONV_D3DCOLOR:
- j += fixup_d3dcolor((DWORD *) (data + i * buffer->stride + j));
- break;
- case CONV_POSITIONT:
- j += fixup_transformed_pos((float *) (data + i * buffer->stride + j));
- break;
- default:
- FIXME("Unimplemented conversion %d in shifted conversion.\n", buffer->conversion_map[j]);
- ++j;
- }
- }
- }
-
- GL_EXTCALL(glBindBuffer(buffer->buffer_type_hint, buffer->buffer_object));
- checkGLcall("glBindBuffer");
- GL_EXTCALL(glBufferSubData(buffer->buffer_type_hint, start, len, data + start));
- checkGLcall("glBufferSubData");
- }
-
- HeapFree(GetProcessHeap(), 0, data);
-
- wined3d_buffer_validate_location(buffer, WINED3D_LOCATION_BUFFER);
-}
-
void buffer_mark_used(struct wined3d_buffer *buffer)
{
buffer->flags &= ~(WINED3D_BUFFER_SYNC | WINED3D_BUFFER_DISCARD);
@@ -931,7 +868,9 @@ void wined3d_buffer_load(struct wined3d_buffer *buffer, struct wined3d_context *
{
DWORD flags = buffer->flags & (WINED3D_BUFFER_SYNC | WINED3D_BUFFER_DISCARD);
const struct wined3d_gl_info *gl_info = context->gl_info;
+ unsigned int i, j, start, end, len, vertex_count;
BOOL decl_changed = FALSE;
+ BYTE *data;
TRACE("buffer %p.\n", buffer);
@@ -1046,11 +985,64 @@ void wined3d_buffer_load(struct wined3d_buffer *buffer, struct wined3d_context *
return;
buffer_direct_upload(buffer, context, flags);
+ return;
}
- else
+
+ /* This would potentially invalidate the element array buffer binding. */
+ if (buffer->buffer_type_hint != GL_ARRAY_BUFFER)
+ ERR("Converting data in non-vertex buffer.\n");
+
+ wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_SYSMEM);
+
+ /* Now for each vertex in the buffer that needs conversion */
+ vertex_count = buffer->resource.size / buffer->stride;
+
+ if (!(data = HeapAlloc(GetProcessHeap(), 0, buffer->resource.size)))
{
- buffer_conversion_upload(buffer, context);
+ ERR("Out of memory.\n");
+ return;
}
+
+ while (buffer->modified_areas)
+ {
+ buffer->modified_areas--;
+ start = buffer->maps[buffer->modified_areas].offset;
+ len = buffer->maps[buffer->modified_areas].size;
+ end = start + len;
+
+ memcpy(data + start, (BYTE *)buffer->resource.heap_memory + start, end - start);
+ for (i = start / buffer->stride; i < min((end / buffer->stride) + 1, vertex_count); ++i)
+ {
+ for (j = 0; j < buffer->stride;)
+ {
+ switch (buffer->conversion_map[j])
+ {
+ case CONV_NONE:
+ /* Done already */
+ j += sizeof(DWORD);
+ break;
+ case CONV_D3DCOLOR:
+ j += fixup_d3dcolor((DWORD *) (data + i * buffer->stride + j));
+ break;
+ case CONV_POSITIONT:
+ j += fixup_transformed_pos((float *) (data + i * buffer->stride + j));
+ break;
+ default:
+ FIXME("Unimplemented conversion %d in shifted conversion.\n", buffer->conversion_map[j]);
+ ++j;
+ }
+ }
+ }
+
+ GL_EXTCALL(glBindBuffer(buffer->buffer_type_hint, buffer->buffer_object));
+ checkGLcall("glBindBuffer");
+ GL_EXTCALL(glBufferSubData(buffer->buffer_type_hint, start, len, data + start));
+ checkGLcall("glBufferSubData");
+ }
+
+ HeapFree(GetProcessHeap(), 0, data);
+
+ wined3d_buffer_validate_location(buffer, WINED3D_LOCATION_BUFFER);
}
struct wined3d_resource * CDECL wined3d_buffer_get_resource(struct wined3d_buffer *buffer)
--
2.9.0

View File

@ -0,0 +1,61 @@
From 6a5243ef02834611838ca129057ff638262bded6 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 1 Nov 2016 14:58:21 +0100
Subject: Revert "wined3d: Replace wined3d_buffer_load_sysmem() calls with
wined3d_buffer_load_location()."
This reverts commit 4a23e91462083db82058111977762532c86afcad.
---
dlls/wined3d/buffer.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index 05be910..6af5529 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -631,7 +631,6 @@ void wined3d_buffer_get_memory(struct wined3d_buffer *buffer,
static void buffer_unload(struct wined3d_resource *resource)
{
struct wined3d_buffer *buffer = buffer_from_resource(resource);
- DWORD flags = buffer->flags;
TRACE("buffer %p.\n", buffer);
@@ -642,10 +641,12 @@ static void buffer_unload(struct wined3d_resource *resource)
context = context_acquire(device, NULL);
- /* Download the buffer, but don't permanently enable double buffering. */
- wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_SYSMEM);
- if (!(flags & WINED3D_BUFFER_DOUBLEBUFFER))
+ /* Download the buffer, but don't permanently enable double buffering */
+ if (!(buffer->flags & WINED3D_BUFFER_DOUBLEBUFFER))
+ {
+ wined3d_buffer_load_sysmem(buffer, context);
buffer->flags &= ~WINED3D_BUFFER_DOUBLEBUFFER;
+ }
wined3d_buffer_invalidate_location(buffer, WINED3D_LOCATION_BUFFER);
delete_gl_buffer(buffer, context->gl_info);
@@ -992,7 +993,8 @@ void wined3d_buffer_load(struct wined3d_buffer *buffer, struct wined3d_context *
if (buffer->buffer_type_hint != GL_ARRAY_BUFFER)
ERR("Converting data in non-vertex buffer.\n");
- wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_SYSMEM);
+ if (!(buffer->flags & WINED3D_BUFFER_DOUBLEBUFFER))
+ wined3d_buffer_load_sysmem(buffer, context);
/* Now for each vertex in the buffer that needs conversion */
vertex_count = buffer->resource.size / buffer->stride;
@@ -1147,7 +1149,7 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI
else
{
TRACE("Falling back to doublebuffered operation.\n");
- wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_SYSMEM);
+ wined3d_buffer_load_sysmem(buffer, context);
}
TRACE("New pointer is %p.\n", buffer->resource.heap_memory);
buffer->map_ptr = NULL;
--
2.9.0

View File

@ -0,0 +1,143 @@
From a9666cce9ad562187cc230b5cd9ae7d10dc04397 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 1 Nov 2016 14:58:57 +0100
Subject: Revert "wined3d: Prefer current locations to WINED3D_LOCATION_SYSMEM
in wined3d_buffer_copy()."
This reverts commit 6ced2a82930f11a80695ff0a3290e6125af52cd6.
---
dlls/wined3d/buffer.c | 71 +++++++++++++++++++++++++++++++++++++++------------
1 file changed, 54 insertions(+), 17 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index 6af5529..eaec38a 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -111,6 +111,12 @@ static void wined3d_buffer_invalidate_range(struct wined3d_buffer *buffer, DWORD
TRACE("buffer %p, location %s, offset %u, size %u.\n",
buffer, wined3d_debug_location(location), offset, size);
+ if ((offset || size) && (location & ~WINED3D_LOCATION_BUFFER))
+ {
+ ERR("Range can be invalidated only for WINED3D_LOCATION_BUFFER.\n");
+ return;
+ }
+
if (location & WINED3D_LOCATION_BUFFER)
buffer_invalidate_bo_range(buffer, offset, size);
@@ -604,6 +610,31 @@ BYTE *wined3d_buffer_load_sysmem(struct wined3d_buffer *buffer, struct wined3d_c
return buffer->resource.heap_memory;
}
+/* Context activation is done by the caller. */
+static void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *context,
+ struct wined3d_bo_address *data)
+{
+ data->buffer_object = buffer->buffer_object;
+ if (!buffer->buffer_object)
+ {
+ if ((buffer->flags & WINED3D_BUFFER_USE_BO) && !buffer->resource.map_count)
+ {
+ wined3d_buffer_prepare_location(buffer, context, WINED3D_LOCATION_BUFFER);
+ if (buffer->buffer_object)
+ {
+ data->buffer_object = buffer->buffer_object;
+ data->addr = NULL;
+ return;
+ }
+ }
+ data->addr = buffer->resource.heap_memory;
+ }
+ else
+ {
+ data->addr = NULL;
+ }
+}
+
void wined3d_buffer_get_memory(struct wined3d_buffer *buffer,
struct wined3d_bo_address *data, DWORD locations)
{
@@ -1243,12 +1274,11 @@ static void wined3d_buffer_unmap(struct wined3d_buffer *buffer)
HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_offset,
struct wined3d_buffer *src_buffer, unsigned int src_offset, unsigned int size)
{
+ BYTE *dst_buffer_mem, *src_buffer_mem, *dst_ptr, *src_ptr;
+ struct wined3d_bo_address dst_bo_address, src_bo_address;
const struct wined3d_gl_info *gl_info;
- struct wined3d_bo_address dst, src;
struct wined3d_context *context;
struct wined3d_device *device;
- BYTE *dst_ptr, *src_ptr;
- DWORD dst_location;
HRESULT hr;
device = dst_buffer->resource.device;
@@ -1256,17 +1286,24 @@ HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_
context = context_acquire(device, NULL);
gl_info = context->gl_info;
- wined3d_buffer_get_memory(dst_buffer, &dst, dst_buffer->locations);
- wined3d_buffer_get_memory(src_buffer, &src, src_buffer->locations);
+ buffer_get_memory(dst_buffer, context, &dst_bo_address);
+ buffer_get_memory(src_buffer, context, &src_bo_address);
+
+ dst_buffer_mem = dst_buffer->resource.heap_memory;
+ src_buffer_mem = src_buffer->resource.heap_memory;
+
+ if (dst_buffer_mem && (dst_offset || size != dst_buffer->resource.size))
+ wined3d_buffer_load_location(dst_buffer, context, WINED3D_LOCATION_SYSMEM);
+ if (src_buffer_mem)
+ wined3d_buffer_load_location(src_buffer, context, WINED3D_LOCATION_SYSMEM);
- if (dst.buffer_object && src.buffer_object)
+ if (!dst_buffer_mem && !src_buffer_mem)
{
if (gl_info->supported[ARB_COPY_BUFFER])
{
- GL_EXTCALL(glBindBuffer(GL_COPY_READ_BUFFER, src.buffer_object));
- GL_EXTCALL(glBindBuffer(GL_COPY_WRITE_BUFFER, dst.buffer_object));
- GL_EXTCALL(glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER,
- src_offset, dst_offset, size));
+ GL_EXTCALL(glBindBuffer(GL_COPY_READ_BUFFER, src_bo_address.buffer_object));
+ GL_EXTCALL(glBindBuffer(GL_COPY_WRITE_BUFFER, dst_bo_address.buffer_object));
+ GL_EXTCALL(glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, src_offset, dst_offset, size));
checkGLcall("direct buffer copy");
}
else
@@ -1291,25 +1328,25 @@ HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_
wined3d_buffer_unmap(dst_buffer);
}
}
- else if (!dst.buffer_object && src.buffer_object)
+ else if (dst_buffer_mem && !src_buffer_mem)
{
buffer_bind(src_buffer, context);
- GL_EXTCALL(glGetBufferSubData(src_buffer->buffer_type_hint, src_offset, size, dst.addr + dst_offset));
+ GL_EXTCALL(glGetBufferSubData(src_buffer->buffer_type_hint, src_offset, size, dst_buffer_mem + dst_offset));
checkGLcall("buffer download");
}
- else if (dst.buffer_object && !src.buffer_object)
+ else if (!dst_buffer_mem && src_buffer_mem)
{
buffer_bind(dst_buffer, context);
- GL_EXTCALL(glBufferSubData(dst_buffer->buffer_type_hint, dst_offset, size, src.addr + src_offset));
+ GL_EXTCALL(glBufferSubData(dst_buffer->buffer_type_hint, dst_offset, size, src_buffer_mem + src_offset));
checkGLcall("buffer upload");
}
else
{
- memcpy(dst.addr + dst_offset, src.addr + src_offset, size);
+ memcpy(dst_buffer_mem + dst_offset, src_buffer_mem + src_offset, size);
}
- dst_location = dst.buffer_object ? WINED3D_LOCATION_BUFFER : WINED3D_LOCATION_SYSMEM;
- wined3d_buffer_invalidate_range(dst_buffer, ~dst_location, dst_offset, size);
+ if (dst_buffer_mem)
+ wined3d_buffer_invalidate_range(dst_buffer, WINED3D_LOCATION_BUFFER, dst_offset, size);
context_release(context);
return WINED3D_OK;
--
2.9.0

View File

@ -0,0 +1,88 @@
From ccb0dc220e1b76fc78fa689bee336bdd0967d43f Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 1 Nov 2016 15:06:18 +0100
Subject: Revert "wined3d: Introduce wined3d_buffer_get_memory()."
This reverts commit 2e15ae85a1f7f0799a296cd8b7627a4ec5e2db3e.
---
dlls/wined3d/buffer.c | 26 +-------------------------
dlls/wined3d/context.c | 2 +-
dlls/wined3d/wined3d_private.h | 4 ++--
3 files changed, 4 insertions(+), 28 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index eaec38a..fb6592c 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -611,7 +611,7 @@ BYTE *wined3d_buffer_load_sysmem(struct wined3d_buffer *buffer, struct wined3d_c
}
/* Context activation is done by the caller. */
-static void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *context,
+void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *context,
struct wined3d_bo_address *data)
{
data->buffer_object = buffer->buffer_object;
@@ -635,30 +635,6 @@ static void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_cont
}
}
-void wined3d_buffer_get_memory(struct wined3d_buffer *buffer,
- struct wined3d_bo_address *data, DWORD locations)
-{
- TRACE("buffer %p, data %p, locations %s.\n",
- buffer, data, wined3d_debug_location(locations));
-
- if (locations & WINED3D_LOCATION_BUFFER)
- {
- data->buffer_object = buffer->buffer_object;
- data->addr = NULL;
- return;
- }
- if (locations & WINED3D_LOCATION_SYSMEM)
- {
- data->buffer_object = 0;
- data->addr = buffer->resource.heap_memory;
- return;
- }
-
- ERR("Unexpected locations %s.\n", wined3d_debug_location(locations));
- data->buffer_object = 0;
- data->addr = NULL;
-}
-
static void buffer_unload(struct wined3d_resource *resource)
{
struct wined3d_buffer *buffer = buffer_from_resource(resource);
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 88d34e6..1ca12bc 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -3201,7 +3201,7 @@ static void context_update_stream_info(struct wined3d_context *context, const st
else
{
wined3d_buffer_load(buffer, context, state);
- wined3d_buffer_get_memory(buffer, &data, buffer->locations);
+ buffer_get_memory(buffer, context, &data);
element->data.buffer_object = data.buffer_object;
element->data.addr += (ULONG_PTR)data.addr;
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index c56558d..bf2f938 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3179,9 +3179,9 @@ static inline struct wined3d_buffer *buffer_from_resource(struct wined3d_resourc
return CONTAINING_RECORD(resource, struct wined3d_buffer, resource);
}
+void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *context,
+ struct wined3d_bo_address *data) DECLSPEC_HIDDEN;
void buffer_mark_used(struct wined3d_buffer *buffer) DECLSPEC_HIDDEN;
-void wined3d_buffer_get_memory(struct wined3d_buffer *buffer,
- struct wined3d_bo_address *data, DWORD locations) DECLSPEC_HIDDEN;
void wined3d_buffer_invalidate_location(struct wined3d_buffer *buffer, DWORD location) DECLSPEC_HIDDEN;
void wined3d_buffer_load(struct wined3d_buffer *buffer, struct wined3d_context *context,
const struct wined3d_state *state) DECLSPEC_HIDDEN;
--
2.9.0

View File

@ -0,0 +1,203 @@
From 4208255f60b1c317bfe892493cb601ce64433a8e Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 1 Nov 2016 15:06:25 +0100
Subject: Revert "wined3d: Implement wined3d_buffer_prepare_location() for
WINED3D_LOCATION_BUFFER."
This reverts commit 4e7ef680e3cecaeccb96a0e827f97019efa751cc.
---
dlls/wined3d/buffer.c | 104 +++++++++++++++++++++++++-------------------------
1 file changed, 51 insertions(+), 53 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index fb6592c..e49be01 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -162,20 +162,20 @@ static void delete_gl_buffer(struct wined3d_buffer *This, const struct wined3d_g
}
/* Context activation is done by the caller. */
-static BOOL buffer_create_buffer_object(struct wined3d_buffer *buffer, struct wined3d_context *context)
+static void buffer_create_buffer_object(struct wined3d_buffer *This, struct wined3d_context *context)
{
- const struct wined3d_gl_info *gl_info = context->gl_info;
- GLenum gl_usage = GL_STATIC_DRAW;
+ GLenum gl_usage = GL_STATIC_DRAW_ARB;
GLenum error;
+ const struct wined3d_gl_info *gl_info = context->gl_info;
- TRACE("Creating an OpenGL buffer object for wined3d_buffer %p with usage %s.\n",
- buffer, debug_d3dusage(buffer->resource.usage));
+ TRACE("Creating an OpenGL vertex buffer object for wined3d_buffer %p with usage %s.\n",
+ This, debug_d3dusage(This->resource.usage));
/* Make sure that the gl error is cleared. Do not use checkGLcall
- * here because checkGLcall just prints a fixme and continues. However,
- * if an error during VBO creation occurs we can fall back to non-VBO operation
- * with full functionality(but performance loss).
- */
+ * here because checkGLcall just prints a fixme and continues. However,
+ * if an error during VBO creation occurs we can fall back to non-vbo operation
+ * with full functionality(but performance loss)
+ */
while (gl_info->gl_ops.gl.p_glGetError() != GL_NO_ERROR);
/* Basically the FVF parameter passed to CreateVertexBuffer is no good.
@@ -184,72 +184,72 @@ static BOOL buffer_create_buffer_object(struct wined3d_buffer *buffer, struct wi
* to be verified to check if the rhw and color values are in the correct
* format. */
- GL_EXTCALL(glGenBuffers(1, &buffer->buffer_object));
+ GL_EXTCALL(glGenBuffers(1, &This->buffer_object));
error = gl_info->gl_ops.gl.p_glGetError();
- if (!buffer->buffer_object || error != GL_NO_ERROR)
+ if (!This->buffer_object || error != GL_NO_ERROR)
{
- ERR("Failed to create a BO with error %s (%#x).\n", debug_glerror(error), error);
+ ERR("Failed to create a VBO with error %s (%#x)\n", debug_glerror(error), error);
goto fail;
}
- buffer_bind(buffer, context);
+ buffer_bind(This, context);
error = gl_info->gl_ops.gl.p_glGetError();
if (error != GL_NO_ERROR)
{
- ERR("Failed to bind the BO with error %s (%#x).\n", debug_glerror(error), error);
+ ERR("Failed to bind the VBO with error %s (%#x)\n", debug_glerror(error), error);
goto fail;
}
- if (buffer->resource.usage & WINED3DUSAGE_DYNAMIC)
+ if (This->resource.usage & WINED3DUSAGE_DYNAMIC)
{
TRACE("Buffer has WINED3DUSAGE_DYNAMIC set.\n");
gl_usage = GL_STREAM_DRAW_ARB;
- if (gl_info->supported[APPLE_FLUSH_BUFFER_RANGE])
+ if(gl_info->supported[APPLE_FLUSH_BUFFER_RANGE])
{
- GL_EXTCALL(glBufferParameteriAPPLE(buffer->buffer_type_hint, GL_BUFFER_FLUSHING_UNMAP_APPLE, GL_FALSE));
- GL_EXTCALL(glBufferParameteriAPPLE(buffer->buffer_type_hint, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_FALSE));
- checkGLcall("glBufferParameteriAPPLE");
- buffer->flags |= WINED3D_BUFFER_APPLESYNC;
+ GL_EXTCALL(glBufferParameteriAPPLE(This->buffer_type_hint, GL_BUFFER_FLUSHING_UNMAP_APPLE, GL_FALSE));
+ checkGLcall("glBufferParameteriAPPLE(This->buffer_type_hint, GL_BUFFER_FLUSHING_UNMAP_APPLE, GL_FALSE)");
+ GL_EXTCALL(glBufferParameteriAPPLE(This->buffer_type_hint, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_FALSE));
+ checkGLcall("glBufferParameteriAPPLE(This->buffer_type_hint, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_FALSE)");
+ This->flags |= WINED3D_BUFFER_APPLESYNC;
}
- /* No setup is needed here for GL_ARB_map_buffer_range. */
+ /* No setup is needed here for GL_ARB_map_buffer_range */
}
/* Reserve memory for the buffer. The amount of data won't change
* so we are safe with calling glBufferData once and
* calling glBufferSubData on updates. Upload the actual data in case
- * we're not double buffering, so we can release the heap mem afterwards.
+ * we're not double buffering, so we can release the heap mem afterwards
*/
- GL_EXTCALL(glBufferData(buffer->buffer_type_hint, buffer->resource.size, buffer->resource.heap_memory, gl_usage));
+ GL_EXTCALL(glBufferData(This->buffer_type_hint, This->resource.size, This->resource.heap_memory, gl_usage));
error = gl_info->gl_ops.gl.p_glGetError();
if (error != GL_NO_ERROR)
{
- ERR("glBufferData failed with error %s (%#x).\n", debug_glerror(error), error);
+ ERR("glBufferData failed with error %s (%#x)\n", debug_glerror(error), error);
goto fail;
}
- buffer->buffer_object_usage = gl_usage;
+ This->buffer_object_usage = gl_usage;
- if (buffer->flags & WINED3D_BUFFER_DOUBLEBUFFER)
+ if (This->flags & WINED3D_BUFFER_DOUBLEBUFFER)
{
- buffer_invalidate_bo_range(buffer, 0, 0);
+ buffer_invalidate_bo_range(This, 0, 0);
}
else
{
- wined3d_resource_free_sysmem(&buffer->resource);
- wined3d_buffer_validate_location(buffer, WINED3D_LOCATION_BUFFER);
- wined3d_buffer_invalidate_location(buffer, WINED3D_LOCATION_SYSMEM);
+ wined3d_resource_free_sysmem(&This->resource);
+ wined3d_buffer_validate_location(This, WINED3D_LOCATION_BUFFER);
+ wined3d_buffer_invalidate_location(This, WINED3D_LOCATION_SYSMEM);
}
- return TRUE;
+ return;
fail:
- /* Clean up all BO init, but continue because we can work without a BO :-) */
- ERR("Failed to create a buffer object. Continuing, but performance issues may occur.\n");
- buffer->flags &= ~WINED3D_BUFFER_USE_BO;
- delete_gl_buffer(buffer, gl_info);
- buffer_clear_dirty_areas(buffer);
- return FALSE;
+ /* Clean up all VBO init, but continue because we can work without a VBO :-) */
+ ERR("Failed to create a vertex buffer object. Continuing, but performance issues may occur.\n");
+ This->flags &= ~WINED3D_BUFFER_USE_BO;
+ delete_gl_buffer(This, gl_info);
+ buffer_clear_dirty_areas(This);
}
static BOOL buffer_process_converted_attribute(struct wined3d_buffer *buffer,
@@ -530,15 +530,8 @@ static BOOL wined3d_buffer_prepare_location(struct wined3d_buffer *buffer,
return TRUE;
case WINED3D_LOCATION_BUFFER:
- if (buffer->buffer_object)
- return TRUE;
-
- if (!(buffer->flags & WINED3D_BUFFER_USE_BO))
- {
- WARN("Trying to create BO for buffer %p with no WINED3D_BUFFER_USE_BO.\n", buffer);
- return FALSE;
- }
- return buffer_create_buffer_object(buffer, context);
+ FIXME("Not implemented yet.\n");
+ return FALSE;
default:
ERR("Invalid location %s.\n", wined3d_debug_location(location));
@@ -619,7 +612,7 @@ void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *co
{
if ((buffer->flags & WINED3D_BUFFER_USE_BO) && !buffer->resource.map_count)
{
- wined3d_buffer_prepare_location(buffer, context, WINED3D_LOCATION_BUFFER);
+ buffer_create_buffer_object(buffer, context);
if (buffer->buffer_object)
{
data->buffer_object = buffer->buffer_object;
@@ -890,15 +883,20 @@ void wined3d_buffer_load(struct wined3d_buffer *buffer, struct wined3d_context *
buffer_mark_used(buffer);
- /* TODO: Make converting independent from VBOs */
- if (!(buffer->flags & WINED3D_BUFFER_USE_BO))
+ if (!buffer->buffer_object)
{
- /* Not doing any conversion */
- return;
+ /* TODO: Make converting independent from VBOs */
+ if (buffer->flags & WINED3D_BUFFER_USE_BO)
+ {
+ buffer_create_buffer_object(buffer, context);
+ }
+ else
+ {
+ /* Not doing any conversion */
+ return;
+ }
}
- wined3d_buffer_prepare_location(buffer, context, WINED3D_LOCATION_BUFFER);
-
/* Reading the declaration makes only sense if we have valid state information
* (i.e., if this function is called during draws). */
if (state)
--
2.9.0

View File

@ -0,0 +1,82 @@
From 5bf109a02335e2509f0042a5c03540a033e58968 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 1 Nov 2016 15:06:34 +0100
Subject: Revert "wined3d: Move buffer_get_memory() under
wined3d_buffer_load_sysmem()."
This reverts commit 8db3b5512e034ee448bbbb7631e4cd79cc362edc.
---
dlls/wined3d/buffer.c | 50 +++++++++++++++++++++++++-------------------------
1 file changed, 25 insertions(+), 25 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index e49be01..c19025e 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -504,6 +504,31 @@ static inline unsigned int fixup_transformed_pos(float *p)
return 4 * sizeof(*p);
}
+/* Context activation is done by the caller. */
+void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *context,
+ struct wined3d_bo_address *data)
+{
+ data->buffer_object = buffer->buffer_object;
+ if (!buffer->buffer_object)
+ {
+ if ((buffer->flags & WINED3D_BUFFER_USE_BO) && !buffer->resource.map_count)
+ {
+ buffer_create_buffer_object(buffer, context);
+ if (buffer->buffer_object)
+ {
+ data->buffer_object = buffer->buffer_object;
+ data->addr = NULL;
+ return;
+ }
+ }
+ data->addr = buffer->resource.heap_memory;
+ }
+ else
+ {
+ data->addr = NULL;
+ }
+}
+
ULONG CDECL wined3d_buffer_incref(struct wined3d_buffer *buffer)
{
ULONG refcount = InterlockedIncrement(&buffer->resource.ref);
@@ -603,31 +628,6 @@ BYTE *wined3d_buffer_load_sysmem(struct wined3d_buffer *buffer, struct wined3d_c
return buffer->resource.heap_memory;
}
-/* Context activation is done by the caller. */
-void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *context,
- struct wined3d_bo_address *data)
-{
- data->buffer_object = buffer->buffer_object;
- if (!buffer->buffer_object)
- {
- if ((buffer->flags & WINED3D_BUFFER_USE_BO) && !buffer->resource.map_count)
- {
- buffer_create_buffer_object(buffer, context);
- if (buffer->buffer_object)
- {
- data->buffer_object = buffer->buffer_object;
- data->addr = NULL;
- return;
- }
- }
- data->addr = buffer->resource.heap_memory;
- }
- else
- {
- data->addr = NULL;
- }
-}
-
static void buffer_unload(struct wined3d_resource *resource)
{
struct wined3d_buffer *buffer = buffer_from_resource(resource);
--
2.9.0

View File

@ -0,0 +1,78 @@
From 96059d1ff1586959aeb7e11567eb7e243b3505aa Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 1 Nov 2016 15:06:44 +0100
Subject: Revert "wined3d: Do not assume that WINED3D_LOCATION_SYSMEM is always
valid for double buffered buffers."
This reverts commit 3c847a20c13d8037c5b1c83e1a112d61a1aa2b55.
---
dlls/wined3d/buffer.c | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index c19025e..912c4d6 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -980,13 +980,13 @@ void wined3d_buffer_load(struct wined3d_buffer *buffer, struct wined3d_context *
if (!buffer->conversion_map)
{
/* That means that there is nothing to fixup. Just upload from
- * buffer->resource.heap_memory directly into the BO. Do not
+ * buffer->resource.heap_memory directly into the vbo. Do not
* free the system memory copy because drawPrimitive may need it if
* the stride is 0, for instancing emulation, vertex blending
* emulation or shader emulation. */
TRACE("No conversion needed.\n");
- /* Nothing to do because heap memory exists if the buffer is double buffer or has no BO at all. */
+ /* Nothing to do because we locked directly into the vbo */
if (!(buffer->flags & WINED3D_BUFFER_DOUBLEBUFFER))
return;
@@ -1061,8 +1061,6 @@ struct wined3d_resource * CDECL wined3d_buffer_get_resource(struct wined3d_buffe
static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UINT size, BYTE **data, DWORD flags)
{
- struct wined3d_device *device = buffer->resource.device;
- struct wined3d_context *context;
LONG count;
BYTE *base;
@@ -1094,13 +1092,6 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI
if (buffer->flags & WINED3D_BUFFER_DOUBLEBUFFER)
{
- if (!(buffer->locations & WINED3D_LOCATION_SYSMEM))
- {
- context = context_acquire(device, NULL);
- wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_SYSMEM);
- context_release(context);
- }
-
if (!(flags & WINED3D_MAP_READONLY))
wined3d_buffer_invalidate_range(buffer, WINED3D_LOCATION_BUFFER, dirty_offset, dirty_size);
}
@@ -1111,6 +1102,8 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI
if (count == 1)
{
+ struct wined3d_device *device = buffer->resource.device;
+ struct wined3d_context *context;
const struct wined3d_gl_info *gl_info;
context = context_acquire(device, NULL);
@@ -1266,11 +1259,6 @@ HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_
dst_buffer_mem = dst_buffer->resource.heap_memory;
src_buffer_mem = src_buffer->resource.heap_memory;
- if (dst_buffer_mem && (dst_offset || size != dst_buffer->resource.size))
- wined3d_buffer_load_location(dst_buffer, context, WINED3D_LOCATION_SYSMEM);
- if (src_buffer_mem)
- wined3d_buffer_load_location(src_buffer, context, WINED3D_LOCATION_SYSMEM);
-
if (!dst_buffer_mem && !src_buffer_mem)
{
if (gl_info->supported[ARB_COPY_BUFFER])
--
2.9.0

View File

@ -0,0 +1,111 @@
From cfef7146a768b0b511effedb4210165bf223b45c Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 1 Nov 2016 15:06:52 +0100
Subject: Revert "wined3d: Introduce wined3d_buffer_load_location()."
This reverts commit 645d3cac14b1303d0152ac6463586ce147c25b9c.
---
dlls/wined3d/buffer.c | 66 ++++++++----------------------------------
dlls/wined3d/wined3d_private.h | 2 --
2 files changed, 12 insertions(+), 56 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index 912c4d6..fdd7e3b 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -564,67 +564,25 @@ static BOOL wined3d_buffer_prepare_location(struct wined3d_buffer *buffer,
}
}
-BOOL wined3d_buffer_load_location(struct wined3d_buffer *buffer,
- struct wined3d_context *context, DWORD location)
+/* Context activation is done by the caller. */
+BYTE *wined3d_buffer_load_sysmem(struct wined3d_buffer *buffer, struct wined3d_context *context)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
- TRACE("buffer %p, context %p, location %s.\n",
- buffer, context, wined3d_debug_location(location));
-
- if (buffer->locations & location)
- {
- TRACE("Location (%#x) is already up to date.\n", location);
- return WINED3D_OK;
- }
-
- if (!buffer->locations)
- {
- ERR("Buffer %p does not have any up to date location.\n", buffer);
- wined3d_buffer_validate_location(buffer, WINED3D_LOCATION_DISCARDED);
- return wined3d_buffer_load_location(buffer, context, location);
- }
-
- TRACE("Current buffer location %s.\n", wined3d_debug_location(buffer->locations));
-
- if (!wined3d_buffer_prepare_location(buffer, context, location))
- return FALSE;
-
- if (buffer->locations & WINED3D_LOCATION_DISCARDED)
- {
- TRACE("Buffer previously discarded, nothing to do.\n");
- wined3d_buffer_validate_location(buffer, location);
- wined3d_buffer_invalidate_location(buffer, WINED3D_LOCATION_DISCARDED);
- return TRUE;
- }
-
- switch (location)
- {
- case WINED3D_LOCATION_SYSMEM:
- buffer_bind(buffer, context);
- GL_EXTCALL(glGetBufferSubData(buffer->buffer_type_hint, 0, buffer->resource.size,
- buffer->resource.heap_memory));
- checkGLcall("buffer download");
- buffer->flags |= WINED3D_BUFFER_DOUBLEBUFFER;
- break;
+ /* Heap_memory exists if the buffer is double buffered or has no buffer object at all. */
+ if (buffer->resource.heap_memory)
+ return buffer->resource.heap_memory;
- case WINED3D_LOCATION_BUFFER:
- FIXME("Not implemented yet.\n");
- return FALSE;
+ if (!wined3d_buffer_prepare_location(buffer, context, WINED3D_LOCATION_SYSMEM))
+ return NULL;
- default:
- ERR("Invalid location %s.\n", wined3d_debug_location(location));
- return FALSE;
- }
+ buffer_bind(buffer, context);
+ GL_EXTCALL(glGetBufferSubData(buffer->buffer_type_hint, 0, buffer->resource.size, buffer->resource.heap_memory));
+ checkGLcall("buffer download");
+ buffer->flags |= WINED3D_BUFFER_DOUBLEBUFFER;
- wined3d_buffer_validate_location(buffer, location);
- return TRUE;
-}
+ wined3d_buffer_validate_location(buffer, WINED3D_LOCATION_SYSMEM);
-/* Context activation is done by the caller. */
-BYTE *wined3d_buffer_load_sysmem(struct wined3d_buffer *buffer, struct wined3d_context *context)
-{
- wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_SYSMEM);
return buffer->resource.heap_memory;
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index bf2f938..c5de837 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3185,8 +3185,6 @@ void buffer_mark_used(struct wined3d_buffer *buffer) DECLSPEC_HIDDEN;
void wined3d_buffer_invalidate_location(struct wined3d_buffer *buffer, DWORD location) DECLSPEC_HIDDEN;
void wined3d_buffer_load(struct wined3d_buffer *buffer, struct wined3d_context *context,
const struct wined3d_state *state) DECLSPEC_HIDDEN;
-BOOL wined3d_buffer_load_location(struct wined3d_buffer *buffer, struct wined3d_context *context,
- DWORD location) DECLSPEC_HIDDEN;
BYTE *wined3d_buffer_load_sysmem(struct wined3d_buffer *buffer, struct wined3d_context *context) DECLSPEC_HIDDEN;
HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_offset,
struct wined3d_buffer *src_buffer, unsigned int src_offset, unsigned int size) DECLSPEC_HIDDEN;
--
2.9.0

View File

@ -0,0 +1,61 @@
From ad964ed3cc6b945656cd04d1224503feeb520683 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 1 Nov 2016 15:07:01 +0100
Subject: Revert "wined3d: Introduce wined3d_buffer_prepapre_location()."
This reverts commit 171e272f852465e1d015c79f0ebc632e4643f873.
---
dlls/wined3d/buffer.c | 30 ++----------------------------
1 file changed, 2 insertions(+), 28 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index fdd7e3b..e119fa6 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -538,32 +538,6 @@ ULONG CDECL wined3d_buffer_incref(struct wined3d_buffer *buffer)
return refcount;
}
-static BOOL wined3d_buffer_prepare_location(struct wined3d_buffer *buffer,
- struct wined3d_context *context, DWORD location)
-{
- switch (location)
- {
- case WINED3D_LOCATION_SYSMEM:
- if (buffer->resource.heap_memory)
- return TRUE;
-
- if (!wined3d_resource_allocate_sysmem(&buffer->resource))
- {
- ERR("Failed to allocate system memory.\n");
- return FALSE;
- }
- return TRUE;
-
- case WINED3D_LOCATION_BUFFER:
- FIXME("Not implemented yet.\n");
- return FALSE;
-
- default:
- ERR("Invalid location %s.\n", wined3d_debug_location(location));
- return FALSE;
- }
-}
-
/* Context activation is done by the caller. */
BYTE *wined3d_buffer_load_sysmem(struct wined3d_buffer *buffer, struct wined3d_context *context)
{
@@ -573,8 +547,8 @@ BYTE *wined3d_buffer_load_sysmem(struct wined3d_buffer *buffer, struct wined3d_c
if (buffer->resource.heap_memory)
return buffer->resource.heap_memory;
- if (!wined3d_buffer_prepare_location(buffer, context, WINED3D_LOCATION_SYSMEM))
- return NULL;
+ if (!wined3d_resource_allocate_sysmem(&buffer->resource))
+ ERR("Failed to allocate system memory.\n");
buffer_bind(buffer, context);
GL_EXTCALL(glGetBufferSubData(buffer->buffer_type_hint, 0, buffer->resource.size, buffer->resource.heap_memory));
--
2.9.0

View File

@ -0,0 +1,223 @@
From 0e54dcb380c4e9e1db44ec4ed7fea7d2f64b408d Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 1 Nov 2016 15:45:08 +0100
Subject: Revert "wined3d: Explicitly track locations for buffers."
This reverts commit 2a385e420a2bafd7ca868ae57428798bb941d0a2.
---
dlls/wined3d/buffer.c | 79 ++++--------------------------------------
dlls/wined3d/device.c | 1 -
dlls/wined3d/wined3d_private.h | 3 --
3 files changed, 7 insertions(+), 76 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index e119fa6..a35436b 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -93,46 +93,6 @@ static BOOL buffer_is_fully_dirty(const struct wined3d_buffer *buffer)
&& !buffer->maps->offset && buffer->maps->size == buffer->resource.size;
}
-void wined3d_buffer_validate_location(struct wined3d_buffer *buffer, DWORD location)
-{
- TRACE("buffer %p, location %s.\n", buffer, wined3d_debug_location(location));
-
- if (location & WINED3D_LOCATION_BUFFER)
- buffer_clear_dirty_areas(buffer);
-
- buffer->locations |= location;
-
- TRACE("New locations flags are %s.\n", wined3d_debug_location(buffer->locations));
-}
-
-static void wined3d_buffer_invalidate_range(struct wined3d_buffer *buffer, DWORD location,
- unsigned int offset, unsigned int size)
-{
- TRACE("buffer %p, location %s, offset %u, size %u.\n",
- buffer, wined3d_debug_location(location), offset, size);
-
- if ((offset || size) && (location & ~WINED3D_LOCATION_BUFFER))
- {
- ERR("Range can be invalidated only for WINED3D_LOCATION_BUFFER.\n");
- return;
- }
-
- if (location & WINED3D_LOCATION_BUFFER)
- buffer_invalidate_bo_range(buffer, offset, size);
-
- buffer->locations &= ~location;
-
- TRACE("New locations flags are %s.\n", wined3d_debug_location(buffer->locations));
-
- if (!buffer->locations)
- ERR("Buffer %p does not have any up to date location.\n", buffer);
-}
-
-void wined3d_buffer_invalidate_location(struct wined3d_buffer *buffer, DWORD location)
-{
- wined3d_buffer_invalidate_range(buffer, location, 0, 0);
-}
-
/* Context activation is done by the caller. */
static void buffer_bind(struct wined3d_buffer *buffer, struct wined3d_context *context)
{
@@ -232,21 +192,15 @@ static void buffer_create_buffer_object(struct wined3d_buffer *This, struct wine
This->buffer_object_usage = gl_usage;
if (This->flags & WINED3D_BUFFER_DOUBLEBUFFER)
- {
buffer_invalidate_bo_range(This, 0, 0);
- }
else
- {
wined3d_resource_free_sysmem(&This->resource);
- wined3d_buffer_validate_location(This, WINED3D_LOCATION_BUFFER);
- wined3d_buffer_invalidate_location(This, WINED3D_LOCATION_SYSMEM);
- }
return;
fail:
/* Clean up all VBO init, but continue because we can work without a VBO :-) */
- ERR("Failed to create a vertex buffer object. Continuing, but performance issues may occur.\n");
+ ERR("Failed to create a vertex buffer object. Continuing, but performance issues may occur\n");
This->flags &= ~WINED3D_BUFFER_USE_BO;
delete_gl_buffer(This, gl_info);
buffer_clear_dirty_areas(This);
@@ -555,8 +509,6 @@ BYTE *wined3d_buffer_load_sysmem(struct wined3d_buffer *buffer, struct wined3d_c
checkGLcall("buffer download");
buffer->flags |= WINED3D_BUFFER_DOUBLEBUFFER;
- wined3d_buffer_validate_location(buffer, WINED3D_LOCATION_SYSMEM);
-
return buffer->resource.heap_memory;
}
@@ -580,7 +532,6 @@ static void buffer_unload(struct wined3d_resource *resource)
buffer->flags &= ~WINED3D_BUFFER_DOUBLEBUFFER;
}
- wined3d_buffer_invalidate_location(buffer, WINED3D_LOCATION_BUFFER);
delete_gl_buffer(buffer, context->gl_info);
buffer_clear_dirty_areas(buffer);
@@ -761,7 +712,7 @@ static void buffer_direct_upload(struct wined3d_buffer *This, struct wined3d_con
}
if (!map)
{
- ERR("Failed to map OpenGL buffer.\n");
+ ERR("Failed to map opengl buffer\n");
return;
}
@@ -786,8 +737,6 @@ static void buffer_direct_upload(struct wined3d_buffer *This, struct wined3d_con
}
GL_EXTCALL(glUnmapBuffer(This->buffer_type_hint));
checkGLcall("glUnmapBuffer");
-
- wined3d_buffer_validate_location(This, WINED3D_LOCATION_BUFFER);
}
void buffer_mark_used(struct wined3d_buffer *buffer)
@@ -980,8 +929,6 @@ void wined3d_buffer_load(struct wined3d_buffer *buffer, struct wined3d_context *
}
HeapFree(GetProcessHeap(), 0, data);
-
- wined3d_buffer_validate_location(buffer, WINED3D_LOCATION_BUFFER);
}
struct wined3d_resource * CDECL wined3d_buffer_get_resource(struct wined3d_buffer *buffer)
@@ -1010,28 +957,17 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI
if (buffer->buffer_object)
{
- unsigned int dirty_offset = offset, dirty_size = size;
-
/* DISCARD invalidates the entire buffer, regardless of the specified
* offset and size. Some applications also depend on the entire buffer
* being uploaded in that case. Two such applications are Port Royale
* and Darkstar One. */
if (flags & WINED3D_MAP_DISCARD)
- {
- dirty_offset = 0;
- dirty_size = 0;
- }
+ buffer_invalidate_bo_range(buffer, 0, 0);
+ else if (!(flags & WINED3D_MAP_READONLY))
+ buffer_invalidate_bo_range(buffer, offset, size);
- if (buffer->flags & WINED3D_BUFFER_DOUBLEBUFFER)
- {
- if (!(flags & WINED3D_MAP_READONLY))
- wined3d_buffer_invalidate_range(buffer, WINED3D_LOCATION_BUFFER, dirty_offset, dirty_size);
- }
- else
+ if (!(buffer->flags & WINED3D_BUFFER_DOUBLEBUFFER))
{
- if (!(flags & WINED3D_MAP_READONLY))
- buffer_invalidate_bo_range(buffer, dirty_offset, dirty_size);
-
if (count == 1)
{
struct wined3d_device *device = buffer->resource.device;
@@ -1240,7 +1176,7 @@ HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_
}
if (dst_buffer_mem)
- wined3d_buffer_invalidate_range(dst_buffer, WINED3D_LOCATION_BUFFER, dst_offset, size);
+ buffer_invalidate_bo_range(dst_buffer, dst_offset, size);
context_release(context);
return WINED3D_OK;
@@ -1369,7 +1305,6 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device
return hr;
}
buffer->buffer_type_hint = bind_hint;
- buffer->locations = WINED3D_LOCATION_SYSMEM;
TRACE("size %#x, usage %#x, format %s, memory @ %p, iface @ %p.\n", buffer->resource.size, buffer->resource.usage,
debug_d3dformat(buffer->resource.format->id), buffer->resource.heap_memory, buffer);
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index cea5ad9..577b53c 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3228,7 +3228,6 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device,
{
GL_EXTCALL(glDeleteBuffers(1, &buffer->buffer_object));
buffer->buffer_object = 0;
- wined3d_buffer_invalidate_location(buffer, WINED3D_LOCATION_BUFFER);
}
if (e->data.addr)
e->data.addr += e->stride * src_start_idx;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index c956b0f..3ddee2d 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3165,7 +3165,6 @@ struct wined3d_buffer
struct wined3d_map_range *maps;
ULONG maps_size, modified_areas;
- DWORD locations;
struct wined3d_event_query *query;
/* conversion stuff */
@@ -3184,7 +3183,6 @@ static inline struct wined3d_buffer *buffer_from_resource(struct wined3d_resourc
void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *context,
struct wined3d_bo_address *data) DECLSPEC_HIDDEN;
void buffer_mark_used(struct wined3d_buffer *buffer) DECLSPEC_HIDDEN;
-void wined3d_buffer_invalidate_location(struct wined3d_buffer *buffer, DWORD location) DECLSPEC_HIDDEN;
void wined3d_buffer_load(struct wined3d_buffer *buffer, struct wined3d_context *context,
const struct wined3d_state *state) DECLSPEC_HIDDEN;
BYTE *wined3d_buffer_load_sysmem(struct wined3d_buffer *buffer, struct wined3d_context *context) DECLSPEC_HIDDEN;
@@ -3192,7 +3190,6 @@ HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_
struct wined3d_buffer *src_buffer, unsigned int src_offset, unsigned int size) DECLSPEC_HIDDEN;
HRESULT wined3d_buffer_upload_data(struct wined3d_buffer *buffer,
const struct wined3d_box *box, const void *data) DECLSPEC_HIDDEN;
-void wined3d_buffer_validate_location(struct wined3d_buffer *buffer, DWORD location) DECLSPEC_HIDDEN;
struct wined3d_rendertarget_view
{
--
2.9.0

View File

@ -0,0 +1,148 @@
From 0acb445f332dd03e7c2c2e708679251f069689a1 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 1 Nov 2016 15:47:27 +0100
Subject: Revert "wined3d: Clean up buffer_internal_preload()."
This reverts commit e3a8cd20ced9f33db64a35f60bc8487ae8173e47.
---
dlls/wined3d/buffer.c | 54 ++++++++++++++++++++++-----------------------------
1 file changed, 23 insertions(+), 31 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index a35436b..b49494f 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -422,7 +422,7 @@ static BOOL buffer_find_decl(struct wined3d_buffer *This, const struct wined3d_s
return ret;
}
-static inline unsigned int fixup_d3dcolor(DWORD *dst_color)
+static inline void fixup_d3dcolor(DWORD *dst_color)
{
DWORD src_color = *dst_color;
@@ -439,11 +439,9 @@ static inline unsigned int fixup_d3dcolor(DWORD *dst_color)
*dst_color |= (src_color & 0xff00ff00u); /* Alpha Green */
*dst_color |= (src_color & 0x00ff0000u) >> 16; /* Red */
*dst_color |= (src_color & 0x000000ffu) << 16; /* Blue */
-
- return sizeof(*dst_color);
}
-static inline unsigned int fixup_transformed_pos(float *p)
+static inline void fixup_transformed_pos(float *p)
{
/* rhw conversion like in position_float4(). */
if (p[3] != 1.0f && p[3] != 0.0f)
@@ -454,8 +452,6 @@ static inline unsigned int fixup_transformed_pos(float *p)
p[2] *= w;
p[3] = w;
}
-
- return 4 * sizeof(*p);
}
/* Context activation is done by the caller. */
@@ -549,12 +545,7 @@ static void buffer_unload(struct wined3d_resource *resource)
* happens only once per changed vertexbuffer and should occur rather
* rarely. */
if (resource->bind_count)
- {
device_invalidate_state(device, STATE_STREAMSRC);
-
- if (buffer->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER)
- device_invalidate_state(device, STATE_INDEXBUFFER);
- }
}
resource_unload(resource);
@@ -750,8 +741,10 @@ void wined3d_buffer_load(struct wined3d_buffer *buffer, struct wined3d_context *
{
DWORD flags = buffer->flags & (WINED3D_BUFFER_SYNC | WINED3D_BUFFER_DISCARD);
const struct wined3d_gl_info *gl_info = context->gl_info;
- unsigned int i, j, start, end, len, vertex_count;
+ struct wined3d_device *device = buffer->resource.device;
+ UINT start, end, len, vertices;
BOOL decl_changed = FALSE;
+ unsigned int i, j;
BYTE *data;
TRACE("buffer %p.\n", buffer);
@@ -858,6 +851,9 @@ void wined3d_buffer_load(struct wined3d_buffer *buffer, struct wined3d_context *
}
}
+ if (buffer->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER_ARB)
+ device_invalidate_state(device, STATE_INDEXBUFFER);
+
if (!buffer->conversion_map)
{
/* That means that there is nothing to fixup. Just upload from
@@ -875,23 +871,17 @@ void wined3d_buffer_load(struct wined3d_buffer *buffer, struct wined3d_context *
return;
}
- /* This would potentially invalidate the element array buffer binding. */
- if (buffer->buffer_type_hint != GL_ARRAY_BUFFER)
- ERR("Converting data in non-vertex buffer.\n");
-
- if (!(buffer->flags & WINED3D_BUFFER_DOUBLEBUFFER))
+ if(!(buffer->flags & WINED3D_BUFFER_DOUBLEBUFFER))
+ {
wined3d_buffer_load_sysmem(buffer, context);
+ }
/* Now for each vertex in the buffer that needs conversion */
- vertex_count = buffer->resource.size / buffer->stride;
+ vertices = buffer->resource.size / buffer->stride;
- if (!(data = HeapAlloc(GetProcessHeap(), 0, buffer->resource.size)))
- {
- ERR("Out of memory.\n");
- return;
- }
+ data = HeapAlloc(GetProcessHeap(), 0, buffer->resource.size);
- while (buffer->modified_areas)
+ while(buffer->modified_areas)
{
buffer->modified_areas--;
start = buffer->maps[buffer->modified_areas].offset;
@@ -899,25 +889,27 @@ void wined3d_buffer_load(struct wined3d_buffer *buffer, struct wined3d_context *
end = start + len;
memcpy(data + start, (BYTE *)buffer->resource.heap_memory + start, end - start);
- for (i = start / buffer->stride; i < min((end / buffer->stride) + 1, vertex_count); ++i)
+ for (i = start / buffer->stride; i < min((end / buffer->stride) + 1, vertices); ++i)
{
- for (j = 0; j < buffer->stride;)
+ for (j = 0; j < buffer->stride; ++j)
{
switch (buffer->conversion_map[j])
{
case CONV_NONE:
/* Done already */
- j += sizeof(DWORD);
+ j += 3;
break;
case CONV_D3DCOLOR:
- j += fixup_d3dcolor((DWORD *) (data + i * buffer->stride + j));
+ fixup_d3dcolor((DWORD *) (data + i * buffer->stride + j));
+ j += 3;
break;
+
case CONV_POSITIONT:
- j += fixup_transformed_pos((float *) (data + i * buffer->stride + j));
+ fixup_transformed_pos((float *) (data + i * buffer->stride + j));
+ j += 15;
break;
default:
- FIXME("Unimplemented conversion %d in shifted conversion.\n", buffer->conversion_map[j]);
- ++j;
+ FIXME("Unimplemented conversion %d in shifted conversion\n", buffer->conversion_map[j]);
}
}
}
--
2.9.0

View File

@ -0,0 +1,61 @@
From fa54b7252999e05dff732242c1d81e1a14a61d1f Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 1 Nov 2016 15:48:15 +0100
Subject: Revert "wined3d: Let buffer_direct_upload() invalidate
STATE_INDEXBUFFER if needed."
This reverts commit b1cc82a29f50dd7cc6703c33ee11df0f0db84b02.
---
dlls/wined3d/buffer.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index 8943144..b50132a 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -668,13 +668,15 @@ drop_query:
}
/* The caller provides a GL context */
-static void buffer_direct_upload(struct wined3d_buffer *This, struct wined3d_context *context, DWORD flags)
+static void buffer_direct_upload(struct wined3d_buffer *This, const struct wined3d_gl_info *gl_info, DWORD flags)
{
- const struct wined3d_gl_info *gl_info = context->gl_info;
- unsigned int start, len;
BYTE *map;
+ UINT start, len;
- buffer_bind(This, context);
+ /* This potentially invalidates the element array buffer binding, but the
+ * caller always takes care of this. */
+ GL_EXTCALL(glBindBuffer(This->buffer_type_hint, This->buffer_object));
+ checkGLcall("glBindBuffer");
if (gl_info->supported[ARB_MAP_BUFFER_RANGE])
{
GLbitfield mapflags;
@@ -684,7 +686,7 @@ static void buffer_direct_upload(struct wined3d_buffer *This, struct wined3d_con
else if (!(flags & WINED3D_BUFFER_SYNC))
mapflags |= GL_MAP_UNSYNCHRONIZED_BIT;
map = GL_EXTCALL(glMapBufferRange(This->buffer_type_hint, 0,
- This->resource.size, mapflags));
+ This->resource.size, mapflags));
checkGLcall("glMapBufferRange");
}
else
@@ -865,9 +867,12 @@ void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_conte
/* Nothing to do because we locked directly into the vbo */
if (!(buffer->flags & WINED3D_BUFFER_DOUBLEBUFFER))
+ {
return;
+ }
+
+ buffer_direct_upload(buffer, gl_info, flags);
- buffer_direct_upload(buffer, context, flags);
return;
}
--
2.9.0

View File

@ -1,4 +1,4 @@
From 536b18f20cf89bb8a177794057ad7dbae5c26e4c Mon Sep 17 00:00:00 2001
From 877fde84f960fac19204627ce0edc82118d1e2d1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Sun, 7 Jul 2013 12:06:31 +0200
Subject: wined3d: Preload buffers if streamsrc is not dirty
@ -18,10 +18,10 @@ here...
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index ce4d9d7..43920ac 100644
index bd63508..bb94189 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -716,7 +716,7 @@ static void buffer_direct_upload(struct wined3d_buffer *This, const struct wined
@@ -732,7 +732,7 @@ static void buffer_direct_upload(struct wined3d_buffer *This, const struct wined
checkGLcall("glUnmapBuffer");
}
@ -31,15 +31,15 @@ index ce4d9d7..43920ac 100644
buffer->flags &= ~(WINED3D_BUFFER_SYNC | WINED3D_BUFFER_DISCARD);
}
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index a67aeca..ccba3e5 100644
index 8ea46f7..a38c325 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -3414,8 +3414,12 @@ BOOL context_apply_draw_state(struct wined3d_context *context,
@@ -3453,8 +3453,12 @@ BOOL context_apply_draw_state(struct wined3d_context *context,
for (i = 0, map = context->stream_info.use_map; map; map >>= 1, ++i)
{
if (map & 1)
- buffer_mark_used(state->streams[context->stream_info.elements[i].stream_idx].buffer);
+ buffer_internal_preload(state->streams[context->stream_info.elements[i].stream_idx].buffer,
+ wined3d_buffer_load(state->streams[context->stream_info.elements[i].stream_idx].buffer,
+ context, state);
}
+ /* PreLoad may kick buffers out of vram. */
@ -49,17 +49,17 @@ index a67aeca..ccba3e5 100644
if (state->index_buffer)
{
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index f38e1aa..2fffc07 100644
index 05224d7..82b0947 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3007,7 +3007,6 @@ void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *co
BYTE *buffer_get_sysmem(struct wined3d_buffer *buffer, struct wined3d_context *context) DECLSPEC_HIDDEN;
void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_context *context,
const struct wined3d_state *state) DECLSPEC_HIDDEN;
@@ -3183,7 +3183,6 @@ static inline struct wined3d_buffer *buffer_from_resource(struct wined3d_resourc
void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *context,
struct wined3d_bo_address *data) DECLSPEC_HIDDEN;
-void buffer_mark_used(struct wined3d_buffer *buffer) DECLSPEC_HIDDEN;
HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_offset,
struct wined3d_buffer *src_buffer, unsigned int src_offset, unsigned int size) DECLSPEC_HIDDEN;
HRESULT wined3d_buffer_upload_data(struct wined3d_buffer *buffer,
void wined3d_buffer_load(struct wined3d_buffer *buffer, struct wined3d_context *context,
const struct wined3d_state *state) DECLSPEC_HIDDEN;
BYTE *wined3d_buffer_load_sysmem(struct wined3d_buffer *buffer, struct wined3d_context *context) DECLSPEC_HIDDEN;
--
2.8.0
2.9.0

View File

@ -1,4 +1,4 @@
From 3c978812ef2e535ed943368d9513dbe92685a558 Mon Sep 17 00:00:00 2001
From f2998aeecb808b643988659b63e69bf3056515dd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Sat, 6 Jul 2013 15:59:11 +0200
Subject: wined3d: Separate buffer map write and draw read memory pointers
@ -11,10 +11,10 @@ patch that introduces this for all resources.
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index f38c8a2..3d9cb5c 100644
index 5dc8b6f..8090924 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -200,7 +200,10 @@ static void buffer_create_buffer_object(struct wined3d_buffer *This, struct wine
@@ -194,7 +194,10 @@ static void buffer_create_buffer_object(struct wined3d_buffer *This, struct wine
if (This->flags & WINED3D_BUFFER_DOUBLEBUFFER)
buffer_invalidate_bo_range(This, 0, 0);
else
@ -25,15 +25,15 @@ index f38c8a2..3d9cb5c 100644
return;
@@ -1050,7 +1053,6 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN
buffer_get_sysmem(buffer, context);
@@ -1025,7 +1028,6 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI
wined3d_buffer_load_sysmem(buffer, context);
}
TRACE("New pointer is %p.\n", buffer->resource.heap_memory);
- buffer->map_ptr = NULL;
}
context_release(context);
}
@@ -1068,7 +1070,7 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN
@@ -1043,7 +1045,7 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI
device->cs->ops->finish(device->cs);
}
@ -43,5 +43,5 @@ index f38c8a2..3d9cb5c 100644
TRACE("Returning memory at %p (base %p, offset %u).\n", *data, base, offset);
--
2.8.0
2.9.0

View File

@ -1,4 +1,4 @@
From baa97e78450e50c136330d533f284e1cdfdb8b94 Mon Sep 17 00:00:00 2001
From 7b550b404989e14b41b412b233c0cda5eedb0bc5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Sat, 6 Jul 2013 22:52:06 +0200
Subject: wined3d: Ignore buffer->resource.map_count in the CS
@ -14,7 +14,7 @@ incrementing map_count.
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index 78b8d8b..d754bc9 100644
index 014a44d..6abbfc5 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -464,7 +464,8 @@ void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *co
@ -27,7 +27,7 @@ index 78b8d8b..d754bc9 100644
{
buffer_create_buffer_object(buffer, context);
if (buffer->buffer_object)
@@ -755,12 +756,6 @@ void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_conte
@@ -755,12 +756,6 @@ void wined3d_buffer_load(struct wined3d_buffer *buffer, struct wined3d_context *
TRACE("buffer %p.\n", buffer);
@ -51,7 +51,7 @@ index 78b8d8b..d754bc9 100644
+ }
+
context = context_acquire(resource->device, NULL);
buffer_internal_preload(buffer_from_resource(resource), context, NULL);
wined3d_buffer_load(buffer_from_resource(resource), context, NULL);
context_release(context);
--
2.9.0

View File

@ -1,4 +1,4 @@
From dcb0cb00e9b28768c25536a68b68181a14724f7e Mon Sep 17 00:00:00 2001
From dae8728a7c0b62fce2d59d84f57326ef1d43a633 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 29 Aug 2013 17:35:53 +0200
Subject: wined3d: Create buffers before mapping them.
@ -8,7 +8,7 @@ Subject: wined3d: Create buffers before mapping them.
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index 1461c72..bbf5a79 100644
index 9cb3308..adaff7c 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -188,6 +188,8 @@ static void buffer_create_buffer_object(struct wined3d_buffer *This, struct wine
@ -20,7 +20,7 @@ index 1461c72..bbf5a79 100644
This->buffer_object_usage = gl_usage;
@@ -914,9 +916,31 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN
@@ -901,9 +903,31 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI
LONG count;
BYTE *base;
struct wined3d_device *device = buffer->resource.device;
@ -29,7 +29,7 @@ index 1461c72..bbf5a79 100644
TRACE("buffer %p, offset %u, size %u, data %p, flags %#x.\n", buffer, offset, size, data, flags);
+ /* FIXME: There is a race condition with the same code in
+ * buffer_internal_preload and buffer_get_memory.
+ * wined3d_buffer_load and buffer_get_memory.
+ *
+ * This deals with a race condition concering buffer creation and buffer maps.
+ * If a VBO is created by the worker thread while the buffer is mapped, outdated
@ -52,7 +52,7 @@ index 1461c72..bbf5a79 100644
flags = wined3d_resource_sanitize_map_flags(&buffer->resource, flags);
/* Filter redundant WINED3D_MAP_DISCARD maps. The 3DMark2001 multitexture
* fill rate test seems to depend on this. When we map a buffer with
@@ -944,7 +968,6 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN
@@ -931,7 +955,6 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI
if (count == 1)
{
struct wined3d_device *device = buffer->resource.device;
@ -61,5 +61,5 @@ index 1461c72..bbf5a79 100644
if (wined3d_settings.cs_multithreaded)
--
2.8.0
2.9.0

Some files were not shown because too many files have changed in this diff Show More