diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 2167a844..7420f1b6 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -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: diff --git a/patches/wined3d-CSMT_Helper/definition b/patches/wined3d-CSMT_Helper/definition index 09e2c596..483ac048 100644 --- a/patches/wined3d-CSMT_Helper/definition +++ b/patches/wined3d-CSMT_Helper/definition @@ -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 diff --git a/patches/wined3d-CSMT_Main/0001-Revert-wined3d-Use-buffer_bind-in-buffer_conversion_.patch b/patches/wined3d-CSMT_Main/0001-Revert-wined3d-Use-buffer_bind-in-buffer_conversion_.patch new file mode 100644 index 00000000..3482fea5 --- /dev/null +++ b/patches/wined3d-CSMT_Main/0001-Revert-wined3d-Use-buffer_bind-in-buffer_conversion_.patch @@ -0,0 +1,45 @@ +From a03e60da52d29835dfbace07951eeb399959f3d5 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +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 + diff --git a/patches/wined3d-CSMT_Main/0002-Revert-wined3d-Fix-index-offset-for-immediate-mode-d.patch b/patches/wined3d-CSMT_Main/0002-Revert-wined3d-Fix-index-offset-for-immediate-mode-d.patch new file mode 100644 index 00000000..00eeec5e --- /dev/null +++ b/patches/wined3d-CSMT_Main/0002-Revert-wined3d-Fix-index-offset-for-immediate-mode-d.patch @@ -0,0 +1,34 @@ +From 1c9ae567bdc07ccff7628ffbb829fd4f1e1c32b6 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +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 + diff --git a/patches/wined3d-CSMT_Main/0003-Revert-wined3d-Introduce-buffer_conversion_upload-he.patch b/patches/wined3d-CSMT_Main/0003-Revert-wined3d-Introduce-buffer_conversion_upload-he.patch new file mode 100644 index 00000000..b812d9c5 --- /dev/null +++ b/patches/wined3d-CSMT_Main/0003-Revert-wined3d-Introduce-buffer_conversion_upload-he.patch @@ -0,0 +1,165 @@ +From bc2f8df73631e95d23607eeff765fff9fd9c1b63 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +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 + diff --git a/patches/wined3d-CSMT_Main/0004-Revert-wined3d-Replace-wined3d_buffer_load_sysmem-ca.patch b/patches/wined3d-CSMT_Main/0004-Revert-wined3d-Replace-wined3d_buffer_load_sysmem-ca.patch new file mode 100644 index 00000000..0d05192b --- /dev/null +++ b/patches/wined3d-CSMT_Main/0004-Revert-wined3d-Replace-wined3d_buffer_load_sysmem-ca.patch @@ -0,0 +1,61 @@ +From 6a5243ef02834611838ca129057ff638262bded6 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +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 + diff --git a/patches/wined3d-CSMT_Main/0005-Revert-wined3d-Prefer-current-locations-to-WINED3D_L.patch b/patches/wined3d-CSMT_Main/0005-Revert-wined3d-Prefer-current-locations-to-WINED3D_L.patch new file mode 100644 index 00000000..1f191982 --- /dev/null +++ b/patches/wined3d-CSMT_Main/0005-Revert-wined3d-Prefer-current-locations-to-WINED3D_L.patch @@ -0,0 +1,143 @@ +From a9666cce9ad562187cc230b5cd9ae7d10dc04397 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +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 + diff --git a/patches/wined3d-CSMT_Main/0006-Revert-wined3d-Introduce-wined3d_buffer_get_memory.patch b/patches/wined3d-CSMT_Main/0006-Revert-wined3d-Introduce-wined3d_buffer_get_memory.patch new file mode 100644 index 00000000..fb628a0a --- /dev/null +++ b/patches/wined3d-CSMT_Main/0006-Revert-wined3d-Introduce-wined3d_buffer_get_memory.patch @@ -0,0 +1,88 @@ +From ccb0dc220e1b76fc78fa689bee336bdd0967d43f Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +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 + diff --git a/patches/wined3d-CSMT_Main/0007-Revert-wined3d-Implement-wined3d_buffer_prepare_loca.patch b/patches/wined3d-CSMT_Main/0007-Revert-wined3d-Implement-wined3d_buffer_prepare_loca.patch new file mode 100644 index 00000000..4fe9210c --- /dev/null +++ b/patches/wined3d-CSMT_Main/0007-Revert-wined3d-Implement-wined3d_buffer_prepare_loca.patch @@ -0,0 +1,203 @@ +From 4208255f60b1c317bfe892493cb601ce64433a8e Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +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 + diff --git a/patches/wined3d-CSMT_Main/0008-Revert-wined3d-Move-buffer_get_memory-under-wined3d_.patch b/patches/wined3d-CSMT_Main/0008-Revert-wined3d-Move-buffer_get_memory-under-wined3d_.patch new file mode 100644 index 00000000..cf5ce1e4 --- /dev/null +++ b/patches/wined3d-CSMT_Main/0008-Revert-wined3d-Move-buffer_get_memory-under-wined3d_.patch @@ -0,0 +1,82 @@ +From 5bf109a02335e2509f0042a5c03540a033e58968 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +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 + diff --git a/patches/wined3d-CSMT_Main/0009-Revert-wined3d-Do-not-assume-that-WINED3D_LOCATION_S.patch b/patches/wined3d-CSMT_Main/0009-Revert-wined3d-Do-not-assume-that-WINED3D_LOCATION_S.patch new file mode 100644 index 00000000..0f6eeb0e --- /dev/null +++ b/patches/wined3d-CSMT_Main/0009-Revert-wined3d-Do-not-assume-that-WINED3D_LOCATION_S.patch @@ -0,0 +1,78 @@ +From 96059d1ff1586959aeb7e11567eb7e243b3505aa Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +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 + diff --git a/patches/wined3d-CSMT_Main/0010-Revert-wined3d-Introduce-wined3d_buffer_load_locatio.patch b/patches/wined3d-CSMT_Main/0010-Revert-wined3d-Introduce-wined3d_buffer_load_locatio.patch new file mode 100644 index 00000000..60d40a8e --- /dev/null +++ b/patches/wined3d-CSMT_Main/0010-Revert-wined3d-Introduce-wined3d_buffer_load_locatio.patch @@ -0,0 +1,111 @@ +From cfef7146a768b0b511effedb4210165bf223b45c Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +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 + diff --git a/patches/wined3d-CSMT_Main/0011-Revert-wined3d-Introduce-wined3d_buffer_prepapre_loc.patch b/patches/wined3d-CSMT_Main/0011-Revert-wined3d-Introduce-wined3d_buffer_prepapre_loc.patch new file mode 100644 index 00000000..6b05cb3f --- /dev/null +++ b/patches/wined3d-CSMT_Main/0011-Revert-wined3d-Introduce-wined3d_buffer_prepapre_loc.patch @@ -0,0 +1,61 @@ +From ad964ed3cc6b945656cd04d1224503feeb520683 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +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 + diff --git a/patches/wined3d-CSMT_Main/0012-Revert-wined3d-Explicitly-track-locations-for-buffer.patch b/patches/wined3d-CSMT_Main/0012-Revert-wined3d-Explicitly-track-locations-for-buffer.patch new file mode 100644 index 00000000..a5ca029a --- /dev/null +++ b/patches/wined3d-CSMT_Main/0012-Revert-wined3d-Explicitly-track-locations-for-buffer.patch @@ -0,0 +1,223 @@ +From 0e54dcb380c4e9e1db44ec4ed7fea7d2f64b408d Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +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 + diff --git a/patches/wined3d-CSMT_Main/0013-Revert-wined3d-Clean-up-buffer_internal_preload.patch b/patches/wined3d-CSMT_Main/0013-Revert-wined3d-Clean-up-buffer_internal_preload.patch new file mode 100644 index 00000000..49396277 --- /dev/null +++ b/patches/wined3d-CSMT_Main/0013-Revert-wined3d-Clean-up-buffer_internal_preload.patch @@ -0,0 +1,148 @@ +From 0acb445f332dd03e7c2c2e708679251f069689a1 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +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 + diff --git a/patches/wined3d-CSMT_Main/0014-Revert-wined3d-Let-buffer_direct_upload-invalidate-S.patch b/patches/wined3d-CSMT_Main/0014-Revert-wined3d-Let-buffer_direct_upload-invalidate-S.patch new file mode 100644 index 00000000..6b2dd8c7 --- /dev/null +++ b/patches/wined3d-CSMT_Main/0014-Revert-wined3d-Let-buffer_direct_upload-invalidate-S.patch @@ -0,0 +1,61 @@ +From fa54b7252999e05dff732242c1d81e1a14a61d1f Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +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 + diff --git a/patches/wined3d-CSMT_Main/0001-Revert-wined3d-Sanitise-resource-map-flags-in-wined3.patch b/patches/wined3d-CSMT_Main/0015-Revert-wined3d-Sanitise-resource-map-flags-in-wined3.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0001-Revert-wined3d-Sanitise-resource-map-flags-in-wined3.patch rename to patches/wined3d-CSMT_Main/0015-Revert-wined3d-Sanitise-resource-map-flags-in-wined3.patch diff --git a/patches/wined3d-CSMT_Main/0002-Revert-wined3d-Send-resource-unmaps-through-the-comm.patch b/patches/wined3d-CSMT_Main/0016-Revert-wined3d-Send-resource-unmaps-through-the-comm.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0002-Revert-wined3d-Send-resource-unmaps-through-the-comm.patch rename to patches/wined3d-CSMT_Main/0016-Revert-wined3d-Send-resource-unmaps-through-the-comm.patch diff --git a/patches/wined3d-CSMT_Main/0003-Revert-wined3d-Send-resource-maps-through-the-comman.patch b/patches/wined3d-CSMT_Main/0017-Revert-wined3d-Send-resource-maps-through-the-comman.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0003-Revert-wined3d-Send-resource-maps-through-the-comman.patch rename to patches/wined3d-CSMT_Main/0017-Revert-wined3d-Send-resource-maps-through-the-comman.patch diff --git a/patches/wined3d-CSMT_Main/0004-Revert-wined3d-Send-shader-constant-updates-through-.patch b/patches/wined3d-CSMT_Main/0018-Revert-wined3d-Send-shader-constant-updates-through-.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0004-Revert-wined3d-Send-shader-constant-updates-through-.patch rename to patches/wined3d-CSMT_Main/0018-Revert-wined3d-Send-shader-constant-updates-through-.patch diff --git a/patches/wined3d-CSMT_Main/0005-wined3d-Make-surface_load_location-return-nothing.patch b/patches/wined3d-CSMT_Main/0019-wined3d-Make-surface_load_location-return-nothing.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0005-wined3d-Make-surface_load_location-return-nothing.patch rename to patches/wined3d-CSMT_Main/0019-wined3d-Make-surface_load_location-return-nothing.patch diff --git a/patches/wined3d-CSMT_Main/0006-wined3d-Call-texture_load_location-instead-of-surfac.patch b/patches/wined3d-CSMT_Main/0020-wined3d-Call-texture_load_location-instead-of-surfac.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0006-wined3d-Call-texture_load_location-instead-of-surfac.patch rename to patches/wined3d-CSMT_Main/0020-wined3d-Call-texture_load_location-instead-of-surfac.patch diff --git a/patches/wined3d-CSMT_Main/0007-wined3d-Share-surface-and-volume-system-memory-loadi.patch b/patches/wined3d-CSMT_Main/0021-wined3d-Share-surface-and-volume-system-memory-loadi.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0007-wined3d-Share-surface-and-volume-system-memory-loadi.patch rename to patches/wined3d-CSMT_Main/0021-wined3d-Share-surface-and-volume-system-memory-loadi.patch diff --git a/patches/wined3d-CSMT_Main/0008-wined3d-Don-t-call-the-public-map-function-in-surfac.patch b/patches/wined3d-CSMT_Main/0022-wined3d-Don-t-call-the-public-map-function-in-surfac.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0008-wined3d-Don-t-call-the-public-map-function-in-surfac.patch rename to patches/wined3d-CSMT_Main/0022-wined3d-Don-t-call-the-public-map-function-in-surfac.patch diff --git a/patches/wined3d-CSMT_Main/0009-wined3d-Don-t-call-the-public-map-function-in-surfac.patch b/patches/wined3d-CSMT_Main/0023-wined3d-Don-t-call-the-public-map-function-in-surfac.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0009-wined3d-Don-t-call-the-public-map-function-in-surfac.patch rename to patches/wined3d-CSMT_Main/0023-wined3d-Don-t-call-the-public-map-function-in-surfac.patch diff --git a/patches/wined3d-CSMT_Main/0010-wined3d-Move-the-framebuffer-into-wined3d_state.patch b/patches/wined3d-CSMT_Main/0024-wined3d-Move-the-framebuffer-into-wined3d_state.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0010-wined3d-Move-the-framebuffer-into-wined3d_state.patch rename to patches/wined3d-CSMT_Main/0024-wined3d-Move-the-framebuffer-into-wined3d_state.patch diff --git a/patches/wined3d-CSMT_Main/0011-wined3d-Preload-buffers-if-streamsrc-is-not-dirty.patch b/patches/wined3d-CSMT_Main/0025-wined3d-Preload-buffers-if-streamsrc-is-not-dirty.patch similarity index 66% rename from patches/wined3d-CSMT_Main/0011-wined3d-Preload-buffers-if-streamsrc-is-not-dirty.patch rename to patches/wined3d-CSMT_Main/0025-wined3d-Preload-buffers-if-streamsrc-is-not-dirty.patch index 7e079ea2..2e16af62 100644 --- a/patches/wined3d-CSMT_Main/0011-wined3d-Preload-buffers-if-streamsrc-is-not-dirty.patch +++ b/patches/wined3d-CSMT_Main/0025-wined3d-Preload-buffers-if-streamsrc-is-not-dirty.patch @@ -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?= 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 diff --git a/patches/wined3d-CSMT_Main/0012-wined3d-Hackily-introduce-a-multithreaded-command-st.patch b/patches/wined3d-CSMT_Main/0026-wined3d-Hackily-introduce-a-multithreaded-command-st.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0012-wined3d-Hackily-introduce-a-multithreaded-command-st.patch rename to patches/wined3d-CSMT_Main/0026-wined3d-Hackily-introduce-a-multithreaded-command-st.patch diff --git a/patches/wined3d-CSMT_Main/0013-wined3d-Wait-for-resource-updates-to-finish-when-usi.patch b/patches/wined3d-CSMT_Main/0027-wined3d-Wait-for-resource-updates-to-finish-when-usi.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0013-wined3d-Wait-for-resource-updates-to-finish-when-usi.patch rename to patches/wined3d-CSMT_Main/0027-wined3d-Wait-for-resource-updates-to-finish-when-usi.patch diff --git a/patches/wined3d-CSMT_Main/0014-wined3d-Wait-for-the-cs-before-destroying-objects.patch b/patches/wined3d-CSMT_Main/0028-wined3d-Wait-for-the-cs-before-destroying-objects.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0014-wined3d-Wait-for-the-cs-before-destroying-objects.patch rename to patches/wined3d-CSMT_Main/0028-wined3d-Wait-for-the-cs-before-destroying-objects.patch diff --git a/patches/wined3d-CSMT_Main/0015-wined3d-Give-the-cs-its-own-state.patch b/patches/wined3d-CSMT_Main/0029-wined3d-Give-the-cs-its-own-state.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0015-wined3d-Give-the-cs-its-own-state.patch rename to patches/wined3d-CSMT_Main/0029-wined3d-Give-the-cs-its-own-state.patch diff --git a/patches/wined3d-CSMT_Main/0016-wined3d-Send-float-constant-updates-through-the-comm.patch b/patches/wined3d-CSMT_Main/0030-wined3d-Send-float-constant-updates-through-the-comm.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0016-wined3d-Send-float-constant-updates-through-the-comm.patch rename to patches/wined3d-CSMT_Main/0030-wined3d-Send-float-constant-updates-through-the-comm.patch diff --git a/patches/wined3d-CSMT_Main/0017-wined3d-Request-a-glFinish-before-modifying-resource.patch b/patches/wined3d-CSMT_Main/0031-wined3d-Request-a-glFinish-before-modifying-resource.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0017-wined3d-Request-a-glFinish-before-modifying-resource.patch rename to patches/wined3d-CSMT_Main/0031-wined3d-Request-a-glFinish-before-modifying-resource.patch diff --git a/patches/wined3d-CSMT_Main/0018-wined3d-Finish-the-cs-before-changing-the-texture-lo.patch b/patches/wined3d-CSMT_Main/0032-wined3d-Finish-the-cs-before-changing-the-texture-lo.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0018-wined3d-Finish-the-cs-before-changing-the-texture-lo.patch rename to patches/wined3d-CSMT_Main/0032-wined3d-Finish-the-cs-before-changing-the-texture-lo.patch diff --git a/patches/wined3d-CSMT_Main/0019-wined3d-Don-t-call-glFinish-after-clears.patch b/patches/wined3d-CSMT_Main/0033-wined3d-Don-t-call-glFinish-after-clears.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0019-wined3d-Don-t-call-glFinish-after-clears.patch rename to patches/wined3d-CSMT_Main/0033-wined3d-Don-t-call-glFinish-after-clears.patch diff --git a/patches/wined3d-CSMT_Main/0020-wined3d-Don-t-call-glFinish-after-draws.patch b/patches/wined3d-CSMT_Main/0034-wined3d-Don-t-call-glFinish-after-draws.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0020-wined3d-Don-t-call-glFinish-after-draws.patch rename to patches/wined3d-CSMT_Main/0034-wined3d-Don-t-call-glFinish-after-draws.patch diff --git a/patches/wined3d-CSMT_Main/0021-wined3d-Pass-the-depth-stencil-to-swapchain-present.patch b/patches/wined3d-CSMT_Main/0035-wined3d-Pass-the-depth-stencil-to-swapchain-present.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0021-wined3d-Pass-the-depth-stencil-to-swapchain-present.patch rename to patches/wined3d-CSMT_Main/0035-wined3d-Pass-the-depth-stencil-to-swapchain-present.patch diff --git a/patches/wined3d-CSMT_Main/0022-wined3d-Keep-track-of-the-onscreen-depth-stencil-in-.patch b/patches/wined3d-CSMT_Main/0036-wined3d-Keep-track-of-the-onscreen-depth-stencil-in-.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0022-wined3d-Keep-track-of-the-onscreen-depth-stencil-in-.patch rename to patches/wined3d-CSMT_Main/0036-wined3d-Keep-track-of-the-onscreen-depth-stencil-in-.patch diff --git a/patches/wined3d-CSMT_Main/0023-wined3d-Send-base-vertex-index-updates-through-the-c.patch b/patches/wined3d-CSMT_Main/0037-wined3d-Send-base-vertex-index-updates-through-the-c.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0023-wined3d-Send-base-vertex-index-updates-through-the-c.patch rename to patches/wined3d-CSMT_Main/0037-wined3d-Send-base-vertex-index-updates-through-the-c.patch diff --git a/patches/wined3d-CSMT_Main/0024-wined3d-Send-primitive-type-updates-through-the-comm.patch b/patches/wined3d-CSMT_Main/0038-wined3d-Send-primitive-type-updates-through-the-comm.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0024-wined3d-Send-primitive-type-updates-through-the-comm.patch rename to patches/wined3d-CSMT_Main/0038-wined3d-Send-primitive-type-updates-through-the-comm.patch diff --git a/patches/wined3d-CSMT_Main/0025-wined3d-Send-bool-constant-updates-through-the-comma.patch b/patches/wined3d-CSMT_Main/0039-wined3d-Send-bool-constant-updates-through-the-comma.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0025-wined3d-Send-bool-constant-updates-through-the-comma.patch rename to patches/wined3d-CSMT_Main/0039-wined3d-Send-bool-constant-updates-through-the-comma.patch diff --git a/patches/wined3d-CSMT_Main/0026-wined3d-Send-int-constant-updates-through-the-comman.patch b/patches/wined3d-CSMT_Main/0040-wined3d-Send-int-constant-updates-through-the-comman.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0026-wined3d-Send-int-constant-updates-through-the-comman.patch rename to patches/wined3d-CSMT_Main/0040-wined3d-Send-int-constant-updates-through-the-comman.patch diff --git a/patches/wined3d-CSMT_Main/0027-wined3d-Send-light-updates-through-the-command-strea.patch b/patches/wined3d-CSMT_Main/0041-wined3d-Send-light-updates-through-the-command-strea.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0027-wined3d-Send-light-updates-through-the-command-strea.patch rename to patches/wined3d-CSMT_Main/0041-wined3d-Send-light-updates-through-the-command-strea.patch diff --git a/patches/wined3d-CSMT_Main/0028-wined3d-Prevent-the-command-stream-from-running-ahea.patch b/patches/wined3d-CSMT_Main/0042-wined3d-Prevent-the-command-stream-from-running-ahea.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0028-wined3d-Prevent-the-command-stream-from-running-ahea.patch rename to patches/wined3d-CSMT_Main/0042-wined3d-Prevent-the-command-stream-from-running-ahea.patch diff --git a/patches/wined3d-CSMT_Main/0029-wined3d-Wait-for-the-cs-to-finish-before-destroying-.patch b/patches/wined3d-CSMT_Main/0043-wined3d-Wait-for-the-cs-to-finish-before-destroying-.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0029-wined3d-Wait-for-the-cs-to-finish-before-destroying-.patch rename to patches/wined3d-CSMT_Main/0043-wined3d-Wait-for-the-cs-to-finish-before-destroying-.patch diff --git a/patches/wined3d-CSMT_Main/0030-wined3d-Run-the-cs-asynchronously.patch b/patches/wined3d-CSMT_Main/0044-wined3d-Run-the-cs-asynchronously.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0030-wined3d-Run-the-cs-asynchronously.patch rename to patches/wined3d-CSMT_Main/0044-wined3d-Run-the-cs-asynchronously.patch diff --git a/patches/wined3d-CSMT_Main/0031-wined3d-Send-blits-through-the-command-stream.patch b/patches/wined3d-CSMT_Main/0045-wined3d-Send-blits-through-the-command-stream.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0031-wined3d-Send-blits-through-the-command-stream.patch rename to patches/wined3d-CSMT_Main/0045-wined3d-Send-blits-through-the-command-stream.patch diff --git a/patches/wined3d-CSMT_Main/0032-wined3d-Hack-to-reject-unsupported-color-fills.patch b/patches/wined3d-CSMT_Main/0046-wined3d-Hack-to-reject-unsupported-color-fills.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0032-wined3d-Hack-to-reject-unsupported-color-fills.patch rename to patches/wined3d-CSMT_Main/0046-wined3d-Hack-to-reject-unsupported-color-fills.patch diff --git a/patches/wined3d-CSMT_Main/0033-wined3d-Restore-some-wined3d_device_copy_sub_resourc.patch b/patches/wined3d-CSMT_Main/0047-wined3d-Restore-some-wined3d_device_copy_sub_resourc.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0033-wined3d-Restore-some-wined3d_device_copy_sub_resourc.patch rename to patches/wined3d-CSMT_Main/0047-wined3d-Restore-some-wined3d_device_copy_sub_resourc.patch diff --git a/patches/wined3d-CSMT_Main/0034-wined3d-Don-t-force-strict-draw-ordering-for-multith.patch b/patches/wined3d-CSMT_Main/0048-wined3d-Don-t-force-strict-draw-ordering-for-multith.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0034-wined3d-Don-t-force-strict-draw-ordering-for-multith.patch rename to patches/wined3d-CSMT_Main/0048-wined3d-Don-t-force-strict-draw-ordering-for-multith.patch diff --git a/patches/wined3d-CSMT_Main/0035-wined3d-Send-render-target-view-clears-through-the-c.patch b/patches/wined3d-CSMT_Main/0049-wined3d-Send-render-target-view-clears-through-the-c.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0035-wined3d-Send-render-target-view-clears-through-the-c.patch rename to patches/wined3d-CSMT_Main/0049-wined3d-Send-render-target-view-clears-through-the-c.patch diff --git a/patches/wined3d-CSMT_Main/0036-wined3d-send-texture-maps-through-the-command-stream.patch b/patches/wined3d-CSMT_Main/0050-wined3d-send-texture-maps-through-the-command-stream.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0036-wined3d-send-texture-maps-through-the-command-stream.patch rename to patches/wined3d-CSMT_Main/0050-wined3d-send-texture-maps-through-the-command-stream.patch diff --git a/patches/wined3d-CSMT_Main/0037-wined3d-Get-rid-of-the-end_scene-flush-and-finish.patch b/patches/wined3d-CSMT_Main/0051-wined3d-Get-rid-of-the-end_scene-flush-and-finish.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0037-wined3d-Get-rid-of-the-end_scene-flush-and-finish.patch rename to patches/wined3d-CSMT_Main/0051-wined3d-Get-rid-of-the-end_scene-flush-and-finish.patch diff --git a/patches/wined3d-CSMT_Main/0038-wined3d-Replace-the-linked-lists-with-a-ringbuffer.patch b/patches/wined3d-CSMT_Main/0052-wined3d-Replace-the-linked-lists-with-a-ringbuffer.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0038-wined3d-Replace-the-linked-lists-with-a-ringbuffer.patch rename to patches/wined3d-CSMT_Main/0052-wined3d-Replace-the-linked-lists-with-a-ringbuffer.patch diff --git a/patches/wined3d-CSMT_Main/0039-wined3d-Don-t-preload-buffers-on-unmap.patch b/patches/wined3d-CSMT_Main/0053-wined3d-Don-t-preload-buffers-on-unmap.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0039-wined3d-Don-t-preload-buffers-on-unmap.patch rename to patches/wined3d-CSMT_Main/0053-wined3d-Don-t-preload-buffers-on-unmap.patch diff --git a/patches/wined3d-CSMT_Main/0040-wined3d-Don-t-call-glFinish-before-swapping.patch b/patches/wined3d-CSMT_Main/0054-wined3d-Don-t-call-glFinish-before-swapping.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0040-wined3d-Don-t-call-glFinish-before-swapping.patch rename to patches/wined3d-CSMT_Main/0054-wined3d-Don-t-call-glFinish-before-swapping.patch diff --git a/patches/wined3d-CSMT_Main/0041-wined3d-Add-query-support-to-the-command-stream.patch b/patches/wined3d-CSMT_Main/0055-wined3d-Add-query-support-to-the-command-stream.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0041-wined3d-Add-query-support-to-the-command-stream.patch rename to patches/wined3d-CSMT_Main/0055-wined3d-Add-query-support-to-the-command-stream.patch diff --git a/patches/wined3d-CSMT_Main/0042-wined3d-Check-our-CS-state-to-find-out-if-a-query-is.patch b/patches/wined3d-CSMT_Main/0056-wined3d-Check-our-CS-state-to-find-out-if-a-query-is.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0042-wined3d-Check-our-CS-state-to-find-out-if-a-query-is.patch rename to patches/wined3d-CSMT_Main/0056-wined3d-Check-our-CS-state-to-find-out-if-a-query-is.patch diff --git a/patches/wined3d-CSMT_Main/0043-wined3d-Poll-queries-automatically-in-the-CS.patch b/patches/wined3d-CSMT_Main/0057-wined3d-Poll-queries-automatically-in-the-CS.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0043-wined3d-Poll-queries-automatically-in-the-CS.patch rename to patches/wined3d-CSMT_Main/0057-wined3d-Poll-queries-automatically-in-the-CS.patch diff --git a/patches/wined3d-CSMT_Main/0044-wined3d-Introduce-a-separate-queue-for-priority-comm.patch b/patches/wined3d-CSMT_Main/0058-wined3d-Introduce-a-separate-queue-for-priority-comm.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0044-wined3d-Introduce-a-separate-queue-for-priority-comm.patch rename to patches/wined3d-CSMT_Main/0058-wined3d-Introduce-a-separate-queue-for-priority-comm.patch diff --git a/patches/wined3d-CSMT_Main/0045-wined3d-Don-t-poll-queries-that-failed-to-start.patch b/patches/wined3d-CSMT_Main/0059-wined3d-Don-t-poll-queries-that-failed-to-start.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0045-wined3d-Don-t-poll-queries-that-failed-to-start.patch rename to patches/wined3d-CSMT_Main/0059-wined3d-Don-t-poll-queries-that-failed-to-start.patch diff --git a/patches/wined3d-CSMT_Main/0046-wined3d-Remove-restated-queries-from-the-poll-list.patch b/patches/wined3d-CSMT_Main/0060-wined3d-Remove-restated-queries-from-the-poll-list.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0046-wined3d-Remove-restated-queries-from-the-poll-list.patch rename to patches/wined3d-CSMT_Main/0060-wined3d-Remove-restated-queries-from-the-poll-list.patch diff --git a/patches/wined3d-CSMT_Main/0047-wined3d-Put-this-into-the-query-poll-patch.patch b/patches/wined3d-CSMT_Main/0061-wined3d-Put-this-into-the-query-poll-patch.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0047-wined3d-Put-this-into-the-query-poll-patch.patch rename to patches/wined3d-CSMT_Main/0061-wined3d-Put-this-into-the-query-poll-patch.patch diff --git a/patches/wined3d-CSMT_Main/0048-wined3d-Don-t-access-device-state-in-clears.patch b/patches/wined3d-CSMT_Main/0062-wined3d-Don-t-access-device-state-in-clears.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0048-wined3d-Don-t-access-device-state-in-clears.patch rename to patches/wined3d-CSMT_Main/0062-wined3d-Don-t-access-device-state-in-clears.patch diff --git a/patches/wined3d-CSMT_Main/0049-wined3d-Avoid-destroying-views-in-color-and-depth-fi.patch b/patches/wined3d-CSMT_Main/0063-wined3d-Avoid-destroying-views-in-color-and-depth-fi.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0049-wined3d-Avoid-destroying-views-in-color-and-depth-fi.patch rename to patches/wined3d-CSMT_Main/0063-wined3d-Avoid-destroying-views-in-color-and-depth-fi.patch diff --git a/patches/wined3d-CSMT_Main/0050-wined3d-Avoid-calling-wined3d_surface_blt-from-surfa.patch b/patches/wined3d-CSMT_Main/0064-wined3d-Avoid-calling-wined3d_surface_blt-from-surfa.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0050-wined3d-Avoid-calling-wined3d_surface_blt-from-surfa.patch rename to patches/wined3d-CSMT_Main/0064-wined3d-Avoid-calling-wined3d_surface_blt-from-surfa.patch diff --git a/patches/wined3d-CSMT_Main/0051-wined3d-Send-update_texture-calls-through-the-CS.patch b/patches/wined3d-CSMT_Main/0065-wined3d-Send-update_texture-calls-through-the-CS.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0051-wined3d-Send-update_texture-calls-through-the-CS.patch rename to patches/wined3d-CSMT_Main/0065-wined3d-Send-update_texture-calls-through-the-CS.patch diff --git a/patches/wined3d-CSMT_Main/0052-wined3d-Get-rid-of-the-surface_upload_data-glFinish.patch b/patches/wined3d-CSMT_Main/0066-wined3d-Get-rid-of-the-surface_upload_data-glFinish.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0052-wined3d-Get-rid-of-the-surface_upload_data-glFinish.patch rename to patches/wined3d-CSMT_Main/0066-wined3d-Get-rid-of-the-surface_upload_data-glFinish.patch diff --git a/patches/wined3d-CSMT_Main/0053-wined3d-Don-t-lock-the-src-volume-in-device_update_v.patch b/patches/wined3d-CSMT_Main/0067-wined3d-Don-t-lock-the-src-volume-in-device_update_v.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0053-wined3d-Don-t-lock-the-src-volume-in-device_update_v.patch rename to patches/wined3d-CSMT_Main/0067-wined3d-Don-t-lock-the-src-volume-in-device_update_v.patch diff --git a/patches/wined3d-CSMT_Main/0054-wined3d-Fence-update_texture-calls.patch b/patches/wined3d-CSMT_Main/0068-wined3d-Fence-update_texture-calls.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0054-wined3d-Fence-update_texture-calls.patch rename to patches/wined3d-CSMT_Main/0068-wined3d-Fence-update_texture-calls.patch diff --git a/patches/wined3d-CSMT_Main/0055-wined3d-Dirtify-resources-on-unmap.patch b/patches/wined3d-CSMT_Main/0069-wined3d-Dirtify-resources-on-unmap.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0055-wined3d-Dirtify-resources-on-unmap.patch rename to patches/wined3d-CSMT_Main/0069-wined3d-Dirtify-resources-on-unmap.patch diff --git a/patches/wined3d-CSMT_Main/0056-wined3d-Fence-render-targets-and-depth-stencils.patch b/patches/wined3d-CSMT_Main/0070-wined3d-Fence-render-targets-and-depth-stencils.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0056-wined3d-Fence-render-targets-and-depth-stencils.patch rename to patches/wined3d-CSMT_Main/0070-wined3d-Fence-render-targets-and-depth-stencils.patch diff --git a/patches/wined3d-CSMT_Main/0057-wined3d-Fence-blit-operations.patch b/patches/wined3d-CSMT_Main/0071-wined3d-Fence-blit-operations.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0057-wined3d-Fence-blit-operations.patch rename to patches/wined3d-CSMT_Main/0071-wined3d-Fence-blit-operations.patch diff --git a/patches/wined3d-CSMT_Main/0058-wined3d-Fence-color_fill-operations.patch b/patches/wined3d-CSMT_Main/0072-wined3d-Fence-color_fill-operations.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0058-wined3d-Fence-color_fill-operations.patch rename to patches/wined3d-CSMT_Main/0072-wined3d-Fence-color_fill-operations.patch diff --git a/patches/wined3d-CSMT_Main/0059-wined3d-Make-resource-maps-and-unmaps-a-priority-com.patch b/patches/wined3d-CSMT_Main/0073-wined3d-Make-resource-maps-and-unmaps-a-priority-com.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0059-wined3d-Make-resource-maps-and-unmaps-a-priority-com.patch rename to patches/wined3d-CSMT_Main/0073-wined3d-Make-resource-maps-and-unmaps-a-priority-com.patch diff --git a/patches/wined3d-CSMT_Main/0060-wined3d-Send-update_sub_resource-calls-through-the-c.patch b/patches/wined3d-CSMT_Main/0074-wined3d-Send-update_sub_resource-calls-through-the-c.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0060-wined3d-Send-update_sub_resource-calls-through-the-c.patch rename to patches/wined3d-CSMT_Main/0074-wined3d-Send-update_sub_resource-calls-through-the-c.patch diff --git a/patches/wined3d-CSMT_Main/0061-wined3d-Dirtify-changed-textures-through-the-command.patch b/patches/wined3d-CSMT_Main/0075-wined3d-Dirtify-changed-textures-through-the-command.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0061-wined3d-Dirtify-changed-textures-through-the-command.patch rename to patches/wined3d-CSMT_Main/0075-wined3d-Dirtify-changed-textures-through-the-command.patch diff --git a/patches/wined3d-CSMT_Main/0062-wined3d-Wrap-GL-BOs-in-a-structure.patch b/patches/wined3d-CSMT_Main/0076-wined3d-Wrap-GL-BOs-in-a-structure.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0062-wined3d-Wrap-GL-BOs-in-a-structure.patch rename to patches/wined3d-CSMT_Main/0076-wined3d-Wrap-GL-BOs-in-a-structure.patch diff --git a/patches/wined3d-CSMT_Main/0063-wined3d-Separate-resource-map-and-draw-buffers.patch b/patches/wined3d-CSMT_Main/0077-wined3d-Separate-resource-map-and-draw-buffers.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0063-wined3d-Separate-resource-map-and-draw-buffers.patch rename to patches/wined3d-CSMT_Main/0077-wined3d-Separate-resource-map-and-draw-buffers.patch diff --git a/patches/wined3d-CSMT_Main/0064-wined3d-Implement-DISCARD-texture-maps-with-PBOs.patch b/patches/wined3d-CSMT_Main/0078-wined3d-Implement-DISCARD-texture-maps-with-PBOs.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0064-wined3d-Implement-DISCARD-texture-maps-with-PBOs.patch rename to patches/wined3d-CSMT_Main/0078-wined3d-Implement-DISCARD-texture-maps-with-PBOs.patch diff --git a/patches/wined3d-CSMT_Main/0065-wined3d-Implement-DISCARD-resource-maps-with-heap-me.patch b/patches/wined3d-CSMT_Main/0079-wined3d-Implement-DISCARD-resource-maps-with-heap-me.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0065-wined3d-Implement-DISCARD-resource-maps-with-heap-me.patch rename to patches/wined3d-CSMT_Main/0079-wined3d-Implement-DISCARD-resource-maps-with-heap-me.patch diff --git a/patches/wined3d-CSMT_Main/0066-wined3d-Unset-some-objects-in-state_init_default.patch b/patches/wined3d-CSMT_Main/0080-wined3d-Unset-some-objects-in-state_init_default.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0066-wined3d-Unset-some-objects-in-state_init_default.patch rename to patches/wined3d-CSMT_Main/0080-wined3d-Unset-some-objects-in-state_init_default.patch diff --git a/patches/wined3d-CSMT_Main/0068-wined3d-Use-double-buffered-buffers-for-multithreade.patch b/patches/wined3d-CSMT_Main/0081-wined3d-Use-double-buffered-buffers-for-multithreade.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0068-wined3d-Use-double-buffered-buffers-for-multithreade.patch rename to patches/wined3d-CSMT_Main/0081-wined3d-Use-double-buffered-buffers-for-multithreade.patch diff --git a/patches/wined3d-CSMT_Main/0069-wined3d-Don-t-synchronize-NOOVERWRITE-buffer-maps.patch b/patches/wined3d-CSMT_Main/0082-wined3d-Don-t-synchronize-NOOVERWRITE-buffer-maps.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0069-wined3d-Don-t-synchronize-NOOVERWRITE-buffer-maps.patch rename to patches/wined3d-CSMT_Main/0082-wined3d-Don-t-synchronize-NOOVERWRITE-buffer-maps.patch diff --git a/patches/wined3d-CSMT_Main/0070-wined3d-Separate-buffer-map-write-and-draw-read-memo.patch b/patches/wined3d-CSMT_Main/0083-wined3d-Separate-buffer-map-write-and-draw-read-memo.patch similarity index 76% rename from patches/wined3d-CSMT_Main/0070-wined3d-Separate-buffer-map-write-and-draw-read-memo.patch rename to patches/wined3d-CSMT_Main/0083-wined3d-Separate-buffer-map-write-and-draw-read-memo.patch index 7b22b7c6..c3015b67 100644 --- a/patches/wined3d-CSMT_Main/0070-wined3d-Separate-buffer-map-write-and-draw-read-memo.patch +++ b/patches/wined3d-CSMT_Main/0083-wined3d-Separate-buffer-map-write-and-draw-read-memo.patch @@ -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?= 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 diff --git a/patches/wined3d-CSMT_Main/0071-wined3d-Accelerate-DISCARD-buffer-maps.patch b/patches/wined3d-CSMT_Main/0084-wined3d-Accelerate-DISCARD-buffer-maps.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0071-wined3d-Accelerate-DISCARD-buffer-maps.patch rename to patches/wined3d-CSMT_Main/0084-wined3d-Accelerate-DISCARD-buffer-maps.patch diff --git a/patches/wined3d-CSMT_Main/0072-wined3d-Accelerate-READONLY-buffer-maps.patch b/patches/wined3d-CSMT_Main/0085-wined3d-Accelerate-READONLY-buffer-maps.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0072-wined3d-Accelerate-READONLY-buffer-maps.patch rename to patches/wined3d-CSMT_Main/0085-wined3d-Accelerate-READONLY-buffer-maps.patch diff --git a/patches/wined3d-CSMT_Main/0073-wined3d-Access-the-buffer-dirty-areas-through-the-CS.patch b/patches/wined3d-CSMT_Main/0086-wined3d-Access-the-buffer-dirty-areas-through-the-CS.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0073-wined3d-Access-the-buffer-dirty-areas-through-the-CS.patch rename to patches/wined3d-CSMT_Main/0086-wined3d-Access-the-buffer-dirty-areas-through-the-CS.patch diff --git a/patches/wined3d-CSMT_Main/0074-wined3d-Ignore-buffer-resource.map_count-in-the-CS.patch b/patches/wined3d-CSMT_Main/0087-wined3d-Ignore-buffer-resource.map_count-in-the-CS.patch similarity index 86% rename from patches/wined3d-CSMT_Main/0074-wined3d-Ignore-buffer-resource.map_count-in-the-CS.patch rename to patches/wined3d-CSMT_Main/0087-wined3d-Ignore-buffer-resource.map_count-in-the-CS.patch index b3ad7f25..2b07ced1 100644 --- a/patches/wined3d-CSMT_Main/0074-wined3d-Ignore-buffer-resource.map_count-in-the-CS.patch +++ b/patches/wined3d-CSMT_Main/0087-wined3d-Ignore-buffer-resource.map_count-in-the-CS.patch @@ -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?= 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 diff --git a/patches/wined3d-CSMT_Main/0075-wined3d-Use-glBufferSubData-instead-of-glMapBufferRa.patch b/patches/wined3d-CSMT_Main/0088-wined3d-Use-glBufferSubData-instead-of-glMapBufferRa.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0075-wined3d-Use-glBufferSubData-instead-of-glMapBufferRa.patch rename to patches/wined3d-CSMT_Main/0088-wined3d-Use-glBufferSubData-instead-of-glMapBufferRa.patch diff --git a/patches/wined3d-CSMT_Main/0076-wined3d-Separate-GL-buffer-discard-control-from-igno.patch b/patches/wined3d-CSMT_Main/0089-wined3d-Separate-GL-buffer-discard-control-from-igno.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0076-wined3d-Separate-GL-buffer-discard-control-from-igno.patch rename to patches/wined3d-CSMT_Main/0089-wined3d-Separate-GL-buffer-discard-control-from-igno.patch diff --git a/patches/wined3d-CSMT_Main/0077-wined3d-Create-buffers-before-mapping-them.patch b/patches/wined3d-CSMT_Main/0090-wined3d-Create-buffers-before-mapping-them.patch similarity index 87% rename from patches/wined3d-CSMT_Main/0077-wined3d-Create-buffers-before-mapping-them.patch rename to patches/wined3d-CSMT_Main/0090-wined3d-Create-buffers-before-mapping-them.patch index 7a247203..1afe99c1 100644 --- a/patches/wined3d-CSMT_Main/0077-wined3d-Create-buffers-before-mapping-them.patch +++ b/patches/wined3d-CSMT_Main/0090-wined3d-Create-buffers-before-mapping-them.patch @@ -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?= 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 diff --git a/patches/wined3d-CSMT_Main/0078-wined3d-Remove-another-glFinish.patch b/patches/wined3d-CSMT_Main/0091-wined3d-Remove-another-glFinish.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0078-wined3d-Remove-another-glFinish.patch rename to patches/wined3d-CSMT_Main/0091-wined3d-Remove-another-glFinish.patch diff --git a/patches/wined3d-CSMT_Main/0079-wined3d-Create-VBOs-through-the-command-stream.patch b/patches/wined3d-CSMT_Main/0092-wined3d-Create-VBOs-through-the-command-stream.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0079-wined3d-Create-VBOs-through-the-command-stream.patch rename to patches/wined3d-CSMT_Main/0092-wined3d-Create-VBOs-through-the-command-stream.patch diff --git a/patches/wined3d-CSMT_Main/0080-Swapchain-waits.patch b/patches/wined3d-CSMT_Main/0093-Swapchain-waits.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0080-Swapchain-waits.patch rename to patches/wined3d-CSMT_Main/0093-Swapchain-waits.patch diff --git a/patches/wined3d-CSMT_Main/0081-wined3d-Unload-resources-through-the-CS-in-uninit_3d.patch b/patches/wined3d-CSMT_Main/0094-wined3d-Unload-resources-through-the-CS-in-uninit_3d.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0081-wined3d-Unload-resources-through-the-CS-in-uninit_3d.patch rename to patches/wined3d-CSMT_Main/0094-wined3d-Unload-resources-through-the-CS-in-uninit_3d.patch diff --git a/patches/wined3d-CSMT_Main/0082-wined3d-Unload-resources-through-the-CS-in-device_re.patch b/patches/wined3d-CSMT_Main/0095-wined3d-Unload-resources-through-the-CS-in-device_re.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0082-wined3d-Unload-resources-through-the-CS-in-device_re.patch rename to patches/wined3d-CSMT_Main/0095-wined3d-Unload-resources-through-the-CS-in-device_re.patch diff --git a/patches/wined3d-CSMT_Main/0083-wined3d-Don-t-glFinish-after-a-depth-buffer-blit.patch b/patches/wined3d-CSMT_Main/0096-wined3d-Don-t-glFinish-after-a-depth-buffer-blit.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0083-wined3d-Don-t-glFinish-after-a-depth-buffer-blit.patch rename to patches/wined3d-CSMT_Main/0096-wined3d-Don-t-glFinish-after-a-depth-buffer-blit.patch diff --git a/patches/wined3d-CSMT_Main/0084-wined3d-Use-surface_blt_ugly-in-swapchain_gl_present.patch b/patches/wined3d-CSMT_Main/0097-wined3d-Use-surface_blt_ugly-in-swapchain_gl_present.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0084-wined3d-Use-surface_blt_ugly-in-swapchain_gl_present.patch rename to patches/wined3d-CSMT_Main/0097-wined3d-Use-surface_blt_ugly-in-swapchain_gl_present.patch diff --git a/patches/wined3d-CSMT_Main/0086-wined3d-Use-an-event-to-block-the-worker-thread-when.patch b/patches/wined3d-CSMT_Main/0098-wined3d-Use-an-event-to-block-the-worker-thread-when.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0086-wined3d-Use-an-event-to-block-the-worker-thread-when.patch rename to patches/wined3d-CSMT_Main/0098-wined3d-Use-an-event-to-block-the-worker-thread-when.patch diff --git a/patches/wined3d-CSMT_Main/0087-wined3d-Set-map_heap_memory-NULL-when-allocating-a-P.patch b/patches/wined3d-CSMT_Main/0099-wined3d-Set-map_heap_memory-NULL-when-allocating-a-P.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0087-wined3d-Set-map_heap_memory-NULL-when-allocating-a-P.patch rename to patches/wined3d-CSMT_Main/0099-wined3d-Set-map_heap_memory-NULL-when-allocating-a-P.patch diff --git a/patches/wined3d-CSMT_Main/0088-wined3d-Wait-only-for-the-buffer-to-be-idle.patch b/patches/wined3d-CSMT_Main/0100-wined3d-Wait-only-for-the-buffer-to-be-idle.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0088-wined3d-Wait-only-for-the-buffer-to-be-idle.patch rename to patches/wined3d-CSMT_Main/0100-wined3d-Wait-only-for-the-buffer-to-be-idle.patch diff --git a/patches/wined3d-CSMT_Main/0089-wined3d-Put-GL_APPLE_flush_buffer_range-syncing-back.patch b/patches/wined3d-CSMT_Main/0101-wined3d-Put-GL_APPLE_flush_buffer_range-syncing-back.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0089-wined3d-Put-GL_APPLE_flush_buffer_range-syncing-back.patch rename to patches/wined3d-CSMT_Main/0101-wined3d-Put-GL_APPLE_flush_buffer_range-syncing-back.patch diff --git a/patches/wined3d-CSMT_Main/0091-wined3d-Don-t-sync-on-redundant-discard-calls.patch b/patches/wined3d-CSMT_Main/0102-wined3d-Don-t-sync-on-redundant-discard-calls.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0091-wined3d-Don-t-sync-on-redundant-discard-calls.patch rename to patches/wined3d-CSMT_Main/0102-wined3d-Don-t-sync-on-redundant-discard-calls.patch diff --git a/patches/wined3d-CSMT_Main/0092-wined3d-Don-t-discard-new-buffers.patch b/patches/wined3d-CSMT_Main/0103-wined3d-Don-t-discard-new-buffers.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0092-wined3d-Don-t-discard-new-buffers.patch rename to patches/wined3d-CSMT_Main/0103-wined3d-Don-t-discard-new-buffers.patch diff --git a/patches/wined3d-CSMT_Main/0093-wined3d-Don-t-try-to-sync-VBOs-manually-on-OSX-with-.patch b/patches/wined3d-CSMT_Main/0104-wined3d-Don-t-try-to-sync-VBOs-manually-on-OSX-with-.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0093-wined3d-Don-t-try-to-sync-VBOs-manually-on-OSX-with-.patch rename to patches/wined3d-CSMT_Main/0104-wined3d-Don-t-try-to-sync-VBOs-manually-on-OSX-with-.patch diff --git a/patches/wined3d-CSMT_Main/0094-wined3d-Only-discard-buffers-that-are-in-use.patch b/patches/wined3d-CSMT_Main/0105-wined3d-Only-discard-buffers-that-are-in-use.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0094-wined3d-Only-discard-buffers-that-are-in-use.patch rename to patches/wined3d-CSMT_Main/0105-wined3d-Only-discard-buffers-that-are-in-use.patch diff --git a/patches/wined3d-CSMT_Main/0095-wined3d-Send-getdc-and-releasedc-through-the-command.patch b/patches/wined3d-CSMT_Main/0106-wined3d-Send-getdc-and-releasedc-through-the-command.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0095-wined3d-Send-getdc-and-releasedc-through-the-command.patch rename to patches/wined3d-CSMT_Main/0106-wined3d-Send-getdc-and-releasedc-through-the-command.patch diff --git a/patches/wined3d-CSMT_Main/0096-wined3d-Ignore-WINED3D_MAP_NO_DIRTY_UPDATE-in-resour.patch b/patches/wined3d-CSMT_Main/0107-wined3d-Ignore-WINED3D_MAP_NO_DIRTY_UPDATE-in-resour.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0096-wined3d-Ignore-WINED3D_MAP_NO_DIRTY_UPDATE-in-resour.patch rename to patches/wined3d-CSMT_Main/0107-wined3d-Ignore-WINED3D_MAP_NO_DIRTY_UPDATE-in-resour.patch diff --git a/patches/wined3d-CSMT_Main/0097-wined3d-Create-dummy-textures-through-the-CS.patch b/patches/wined3d-CSMT_Main/0108-wined3d-Create-dummy-textures-through-the-CS.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0097-wined3d-Create-dummy-textures-through-the-CS.patch rename to patches/wined3d-CSMT_Main/0108-wined3d-Create-dummy-textures-through-the-CS.patch diff --git a/patches/wined3d-CSMT_Main/0098-wined3d-Create-the-initial-context-through-the-CS.patch b/patches/wined3d-CSMT_Main/0109-wined3d-Create-the-initial-context-through-the-CS.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0098-wined3d-Create-the-initial-context-through-the-CS.patch rename to patches/wined3d-CSMT_Main/0109-wined3d-Create-the-initial-context-through-the-CS.patch diff --git a/patches/wined3d-CSMT_Main/0099-wined3d-Recreate-ctx-and-dummy-textures-through-the-.patch b/patches/wined3d-CSMT_Main/0110-wined3d-Recreate-ctx-and-dummy-textures-through-the-.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0099-wined3d-Recreate-ctx-and-dummy-textures-through-the-.patch rename to patches/wined3d-CSMT_Main/0110-wined3d-Recreate-ctx-and-dummy-textures-through-the-.patch diff --git a/patches/wined3d-CSMT_Main/0100-wined3d-Call-create_default_sampler-from-create_dumm.patch b/patches/wined3d-CSMT_Main/0111-wined3d-Call-create_default_sampler-from-create_dumm.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0100-wined3d-Call-create_default_sampler-from-create_dumm.patch rename to patches/wined3d-CSMT_Main/0111-wined3d-Call-create_default_sampler-from-create_dumm.patch diff --git a/patches/wined3d-CSMT_Main/0101-wined3d-Delete-GL-contexts-through-the-CS-in-reset.patch b/patches/wined3d-CSMT_Main/0112-wined3d-Delete-GL-contexts-through-the-CS-in-reset.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0101-wined3d-Delete-GL-contexts-through-the-CS-in-reset.patch rename to patches/wined3d-CSMT_Main/0112-wined3d-Delete-GL-contexts-through-the-CS-in-reset.patch diff --git a/patches/wined3d-CSMT_Main/0102-wined3d-Delete-GL-contexts-through-the-CS-in-uninit_.patch b/patches/wined3d-CSMT_Main/0113-wined3d-Delete-GL-contexts-through-the-CS-in-uninit_.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0102-wined3d-Delete-GL-contexts-through-the-CS-in-uninit_.patch rename to patches/wined3d-CSMT_Main/0113-wined3d-Delete-GL-contexts-through-the-CS-in-uninit_.patch diff --git a/patches/wined3d-CSMT_Main/0103-wined3d-Update-the-swap-interval-through-the-CS-in-r.patch b/patches/wined3d-CSMT_Main/0114-wined3d-Update-the-swap-interval-through-the-CS-in-r.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0103-wined3d-Update-the-swap-interval-through-the-CS-in-r.patch rename to patches/wined3d-CSMT_Main/0114-wined3d-Update-the-swap-interval-through-the-CS-in-r.patch diff --git a/patches/wined3d-CSMT_Main/0104-wined3d-Do-the-sampler-GL-init-through-the-CS.patch b/patches/wined3d-CSMT_Main/0115-wined3d-Do-the-sampler-GL-init-through-the-CS.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0104-wined3d-Do-the-sampler-GL-init-through-the-CS.patch rename to patches/wined3d-CSMT_Main/0115-wined3d-Do-the-sampler-GL-init-through-the-CS.patch diff --git a/patches/wined3d-CSMT_Main/0105-wined3d-Create-initial-DCs-through-the-CS.patch b/patches/wined3d-CSMT_Main/0116-wined3d-Create-initial-DCs-through-the-CS.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0105-wined3d-Create-initial-DCs-through-the-CS.patch rename to patches/wined3d-CSMT_Main/0116-wined3d-Create-initial-DCs-through-the-CS.patch diff --git a/patches/wined3d-CSMT_Main/0106-wined3d-Assign-a-read-buffer-when-discarding-a-new-t.patch b/patches/wined3d-CSMT_Main/0117-wined3d-Assign-a-read-buffer-when-discarding-a-new-t.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0106-wined3d-Assign-a-read-buffer-when-discarding-a-new-t.patch rename to patches/wined3d-CSMT_Main/0117-wined3d-Assign-a-read-buffer-when-discarding-a-new-t.patch diff --git a/patches/wined3d-CSMT_Main/0107-wined3d-Do-not-query-available-GPU-memory-on-main-th.patch b/patches/wined3d-CSMT_Main/0118-wined3d-Do-not-query-available-GPU-memory-on-main-th.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0107-wined3d-Do-not-query-available-GPU-memory-on-main-th.patch rename to patches/wined3d-CSMT_Main/0118-wined3d-Do-not-query-available-GPU-memory-on-main-th.patch diff --git a/patches/wined3d-CSMT_Main/0108-wined3d-Fix-incorrect-return-value-in-wined3d_cs_exe.patch b/patches/wined3d-CSMT_Main/0119-wined3d-Fix-incorrect-return-value-in-wined3d_cs_exe.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0108-wined3d-Fix-incorrect-return-value-in-wined3d_cs_exe.patch rename to patches/wined3d-CSMT_Main/0119-wined3d-Fix-incorrect-return-value-in-wined3d_cs_exe.patch diff --git a/patches/wined3d-CSMT_Main/0109-wined3d-Fix-context_acquire-not-being-called-from-th.patch b/patches/wined3d-CSMT_Main/0120-wined3d-Fix-context_acquire-not-being-called-from-th.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0109-wined3d-Fix-context_acquire-not-being-called-from-th.patch rename to patches/wined3d-CSMT_Main/0120-wined3d-Fix-context_acquire-not-being-called-from-th.patch diff --git a/patches/wined3d-CSMT_Main/0110-wined3d-Do-not-signal-CS-event-when-we-manage-to-uns.patch b/patches/wined3d-CSMT_Main/0121-wined3d-Do-not-signal-CS-event-when-we-manage-to-uns.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0110-wined3d-Do-not-signal-CS-event-when-we-manage-to-uns.patch rename to patches/wined3d-CSMT_Main/0121-wined3d-Do-not-signal-CS-event-when-we-manage-to-uns.patch diff --git a/patches/wined3d-CSMT_Main/9999-IfDefined.patch b/patches/wined3d-CSMT_Main/9999-IfDefined.patch index 5c37d206..67ee031f 100644 --- a/patches/wined3d-CSMT_Main/9999-IfDefined.patch +++ b/patches/wined3d-CSMT_Main/9999-IfDefined.patch @@ -110,80 +110,358 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c { if (!offset && (!size || size == buffer->resource.size)) goto invalidate_all; -@@ -122,7 +130,11 @@ static void delete_gl_buffer(struct wined3d_buffer *This, const struct wined3d_g +@@ -93,6 +101,7 @@ static BOOL buffer_is_fully_dirty(const struct wined3d_buffer *buffer) + && !buffer->maps->offset && buffer->maps->size == buffer->resource.size; + } + ++#if !defined(STAGING_CSMT) + void wined3d_buffer_validate_location(struct wined3d_buffer *buffer, DWORD location) + { + TRACE("buffer %p, location %s.\n", buffer, wined3d_debug_location(location)); +@@ -127,6 +136,7 @@ void wined3d_buffer_invalidate_location(struct wined3d_buffer *buffer, DWORD loc + wined3d_buffer_invalidate_range(buffer, location, 0, 0); + } + ++#endif /* STAGING_CSMT */ + /* Context activation is done by the caller. */ + static void buffer_bind(struct wined3d_buffer *buffer, struct wined3d_context *context) + { +@@ -156,6 +166,7 @@ static void delete_gl_buffer(struct wined3d_buffer *This, const struct wined3d_g } /* Context activation is done by the caller. */ +#if !defined(STAGING_CSMT) - static void buffer_create_buffer_object(struct wined3d_buffer *This, struct wined3d_context *context) + static BOOL buffer_create_buffer_object(struct wined3d_buffer *buffer, struct wined3d_context *context) + { + const struct wined3d_gl_info *gl_info = context->gl_info; +@@ -170,6 +181,22 @@ static BOOL buffer_create_buffer_object(struct wined3d_buffer *buffer, struct wi + * if an error during VBO creation occurs we can fall back to non-VBO operation + * with full functionality(but performance loss). + */ +#else /* STAGING_CSMT */ +void buffer_create_buffer_object(struct wined3d_buffer *This, struct wined3d_context *context) ++{ ++ GLenum gl_usage = GL_STATIC_DRAW_ARB; ++ GLenum error; ++ const struct wined3d_gl_info *gl_info = context->gl_info; ++ ++ 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) ++ */ +#endif /* STAGING_CSMT */ - { - GLenum gl_usage = GL_STATIC_DRAW_ARB; - GLenum error; -@@ -194,7 +206,14 @@ 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 + while (gl_info->gl_ops.gl.p_glGetError() != GL_NO_ERROR); + + /* Basically the FVF parameter passed to CreateVertexBuffer is no good. +@@ -178,27 +205,48 @@ 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. */ + +#if !defined(STAGING_CSMT) - wined3d_resource_free_sysmem(&This->resource); + GL_EXTCALL(glGenBuffers(1, &buffer->buffer_object)); + error = gl_info->gl_ops.gl.p_glGetError(); + if (!buffer->buffer_object || error != GL_NO_ERROR) + { + ERR("Failed to create a BO with error %s (%#x).\n", debug_glerror(error), error); +#else /* STAGING_CSMT */ ++ GL_EXTCALL(glGenBuffers(1, &This->buffer_object)); ++ error = gl_info->gl_ops.gl.p_glGetError(); ++ if (!This->buffer_object || error != GL_NO_ERROR) ++ { ++ ERR("Failed to create a VBO with error %s (%#x)\n", debug_glerror(error), error); ++#endif /* STAGING_CSMT */ + goto fail; + } + ++#if !defined(STAGING_CSMT) + buffer_bind(buffer, context); ++#else /* STAGING_CSMT */ ++ buffer_bind(This, context); ++#endif /* STAGING_CSMT */ + error = gl_info->gl_ops.gl.p_glGetError(); + if (error != GL_NO_ERROR) + { ++#if !defined(STAGING_CSMT) + ERR("Failed to bind the BO with error %s (%#x).\n", debug_glerror(error), error); ++#else /* STAGING_CSMT */ ++ ERR("Failed to bind the VBO with error %s (%#x)\n", debug_glerror(error), error); ++#endif /* STAGING_CSMT */ + goto fail; + } + ++#if !defined(STAGING_CSMT) + if (buffer->resource.usage & WINED3DUSAGE_DYNAMIC) ++#else /* STAGING_CSMT */ ++ if (This->resource.usage & WINED3DUSAGE_DYNAMIC) ++#endif /* STAGING_CSMT */ + { + TRACE("Buffer has WINED3DUSAGE_DYNAMIC set.\n"); + gl_usage = GL_STREAM_DRAW_ARB; + ++#if !defined(STAGING_CSMT) + if (gl_info->supported[APPLE_FLUSH_BUFFER_RANGE]) + { + GL_EXTCALL(glBufferParameteriAPPLE(buffer->buffer_type_hint, GL_BUFFER_FLUSHING_UNMAP_APPLE, GL_FALSE)); +@@ -207,21 +255,46 @@ static BOOL buffer_create_buffer_object(struct wined3d_buffer *buffer, struct wi + buffer->flags |= WINED3D_BUFFER_APPLESYNC; + } + /* No setup is needed here for GL_ARB_map_buffer_range. */ ++#else /* STAGING_CSMT */ ++ if(gl_info->supported[APPLE_FLUSH_BUFFER_RANGE]) ++ { ++ 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 */ ++#endif /* STAGING_CSMT */ + } + ++#if !defined(STAGING_CSMT) + /* 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. + */ + GL_EXTCALL(glBufferData(buffer->buffer_type_hint, buffer->resource.size, buffer->resource.heap_memory, gl_usage)); ++#else /* STAGING_CSMT */ ++ /* 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 ++ */ ++ GL_EXTCALL(glBufferData(This->buffer_type_hint, This->resource.size, This->resource.heap_memory, gl_usage)); ++#endif /* STAGING_CSMT */ + error = gl_info->gl_ops.gl.p_glGetError(); + if (error != GL_NO_ERROR) + { ++#if !defined(STAGING_CSMT) + ERR("glBufferData failed with error %s (%#x).\n", debug_glerror(error), error); ++#else /* STAGING_CSMT */ ++ ERR("glBufferData failed with error %s (%#x)\n", debug_glerror(error), error); ++#endif /* STAGING_CSMT */ + goto fail; + } + ++#if !defined(STAGING_CSMT) + buffer->buffer_object_usage = gl_usage; + + if (buffer->flags & WINED3D_BUFFER_DOUBLEBUFFER) +@@ -244,6 +317,26 @@ fail: + delete_gl_buffer(buffer, gl_info); + buffer_clear_dirty_areas(buffer); + return FALSE; ++#else /* STAGING_CSMT */ ++ 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); + This->resource.map_heap_memory = NULL; + } ++ ++ 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"); ++ This->flags &= ~WINED3D_BUFFER_USE_BO; ++ delete_gl_buffer(This, gl_info); ++ buffer_clear_dirty_areas(This); +#endif /* STAGING_CSMT */ + } - return; + static BOOL buffer_process_converted_attribute(struct wined3d_buffer *buffer, +@@ -462,7 +555,11 @@ static BOOL buffer_find_decl(struct wined3d_buffer *This, const struct wined3d_s + return ret; + } -@@ -461,7 +480,12 @@ void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *co - data->buffer_object = buffer->buffer_object; - if (!buffer->buffer_object) - { +#if !defined(STAGING_CSMT) - if ((buffer->flags & WINED3D_BUFFER_USE_BO) && !buffer->resource.map_count) + static inline unsigned int fixup_d3dcolor(DWORD *dst_color) +#else /* STAGING_CSMT */ ++static inline void fixup_d3dcolor(DWORD *dst_color) ++#endif /* STAGING_CSMT */ + { + DWORD src_color = *dst_color; + +@@ -479,11 +576,17 @@ 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 */ ++#if !defined(STAGING_CSMT) + + return sizeof(*dst_color); + } + + static inline unsigned int fixup_transformed_pos(float *p) ++#else /* STAGING_CSMT */ ++} ++ ++static inline void fixup_transformed_pos(float *p) ++#endif /* STAGING_CSMT */ + { + /* rhw conversion like in position_float4(). */ + if (p[3] != 1.0f && p[3] != 0.0f) +@@ -494,6 +597,7 @@ static inline unsigned int fixup_transformed_pos(float *p) + p[2] *= w; + p[3] = w; + } ++#if !defined(STAGING_CSMT) + + return 4 * sizeof(*p); + } +@@ -595,11 +699,49 @@ BOOL wined3d_buffer_load_location(struct wined3d_buffer *buffer, + + wined3d_buffer_validate_location(buffer, location); + return TRUE; ++#else /* STAGING_CSMT */ ++} ++ ++/* 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->resource.map_count || buffer->flags & WINED3D_BUFFER_DOUBLEBUFFER) + && buffer->flags & WINED3D_BUFFER_USE_BO) ++ { ++ 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); ++ ++ TRACE("%p increasing refcount to %u.\n", buffer, refcount); ++ ++ return refcount; +#endif /* STAGING_CSMT */ - { - buffer_create_buffer_object(buffer, context); - if (buffer->buffer_object) -@@ -499,6 +523,9 @@ BYTE *buffer_get_sysmem(struct wined3d_buffer *buffer, struct wined3d_context *c + } - if (!wined3d_resource_allocate_sysmem(&buffer->resource)) - ERR("Failed to allocate system memory.\n"); -+#if defined(STAGING_CSMT) -+ buffer->resource.heap_memory = buffer->resource.map_heap_memory; -+#endif /* STAGING_CSMT */ - - buffer_bind(buffer, context); - GL_EXTCALL(glGetBufferSubData(buffer->buffer_type_hint, 0, buffer->resource.size, buffer->resource.heap_memory)); -@@ -670,13 +697,18 @@ drop_query: - /* The caller provides a GL context */ - static void buffer_direct_upload(struct wined3d_buffer *This, const struct wined3d_gl_info *gl_info, DWORD flags) + /* Context activation is done by the caller. */ + BYTE *wined3d_buffer_load_sysmem(struct wined3d_buffer *buffer, struct wined3d_context *context) { +#if !defined(STAGING_CSMT) - BYTE *map; - UINT start, len; + wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_SYSMEM); + return buffer->resource.heap_memory; + } +@@ -626,12 +768,32 @@ void wined3d_buffer_get_memory(struct wined3d_buffer *buffer, + ERR("Unexpected locations %s.\n", wined3d_debug_location(locations)); + data->buffer_object = 0; + data->addr = NULL; +#else /* STAGING_CSMT */ -+ UINT start = 0, len = 0; ++ const struct wined3d_gl_info *gl_info = context->gl_info; ++ ++ /* 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; ++ ++ if (!wined3d_resource_allocate_sysmem(&buffer->resource)) ++ ERR("Failed to allocate system memory.\n"); ++ buffer->resource.heap_memory = buffer->resource.map_heap_memory; ++ ++ 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; ++ ++ return buffer->resource.heap_memory; ++#endif /* STAGING_CSMT */ + } + + static void buffer_unload(struct wined3d_resource *resource) + { + struct wined3d_buffer *buffer = buffer_from_resource(resource); ++#if !defined(STAGING_CSMT) + DWORD flags = buffer->flags; +#endif /* STAGING_CSMT */ - /* 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"); + TRACE("buffer %p.\n", buffer); + +@@ -642,12 +804,22 @@ static void buffer_unload(struct wined3d_resource *resource) + + context = context_acquire(device, NULL); + +#if !defined(STAGING_CSMT) - if (gl_info->supported[ARB_MAP_BUFFER_RANGE]) + /* Download the buffer, but don't permanently enable double buffering. */ + wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_SYSMEM); + if (!(flags & WINED3D_BUFFER_DOUBLEBUFFER)) + buffer->flags &= ~WINED3D_BUFFER_DOUBLEBUFFER; + + wined3d_buffer_invalidate_location(buffer, WINED3D_LOCATION_BUFFER); ++#else /* STAGING_CSMT */ ++ /* 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; ++ } ++ ++#endif /* STAGING_CSMT */ + delete_gl_buffer(buffer, context->gl_info); + buffer_clear_dirty_areas(buffer); + +@@ -665,12 +837,16 @@ static void buffer_unload(struct wined3d_resource *resource) + * happens only once per changed vertexbuffer and should occur rather + * rarely. */ + if (resource->bind_count) ++#if !defined(STAGING_CSMT) + { + device_invalidate_state(device, STATE_STREAMSRC); + + if (buffer->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER) + device_invalidate_state(device, STATE_INDEXBUFFER); + } ++#else /* STAGING_CSMT */ ++ device_invalidate_state(device, STATE_STREAMSRC); ++#endif /* STAGING_CSMT */ + } + + resource_unload(resource); +@@ -793,6 +969,7 @@ drop_query: + } + + /* The caller provides a GL context */ ++#if !defined(STAGING_CSMT) + static void buffer_direct_upload(struct wined3d_buffer *This, struct wined3d_context *context, DWORD flags) + { + const struct wined3d_gl_info *gl_info = context->gl_info; +@@ -830,6 +1007,33 @@ static void buffer_direct_upload(struct wined3d_buffer *This, struct wined3d_con { - GLbitfield mapflags; -@@ -707,6 +739,25 @@ static void buffer_direct_upload(struct wined3d_buffer *This, const struct wined - { - ERR("Failed to map opengl buffer\n"); + ERR("Failed to map OpenGL buffer.\n"); return; +#else /* STAGING_CSMT */ ++static void buffer_direct_upload(struct wined3d_buffer *This, const struct wined3d_gl_info *gl_info, DWORD flags) ++{ ++ UINT start = 0, len = 0; ++ ++ /* 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 (flags & WINED3D_BUFFER_DISCARD) + { @@ -205,7 +483,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c } while (This->modified_areas) -@@ -715,6 +766,7 @@ static void buffer_direct_upload(struct wined3d_buffer *This, const struct wined +@@ -838,6 +1042,7 @@ static void buffer_direct_upload(struct wined3d_buffer *This, struct wined3d_con start = This->maps[This->modified_areas].offset; len = This->maps[This->modified_areas].size; @@ -213,7 +491,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c memcpy(map + start, (BYTE *)This->resource.heap_memory + start, len); if (gl_info->supported[ARB_MAP_BUFFER_RANGE]) -@@ -733,6 +785,14 @@ static void buffer_direct_upload(struct wined3d_buffer *This, const struct wined +@@ -916,6 +1121,14 @@ static void buffer_conversion_upload(struct wined3d_buffer *buffer, struct wined } void buffer_mark_used(struct wined3d_buffer *buffer) @@ -228,7 +506,19 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c { buffer->flags &= ~(WINED3D_BUFFER_SYNC | WINED3D_BUFFER_DISCARD); } -@@ -751,12 +811,14 @@ void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_conte +@@ -926,10 +1139,19 @@ 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; ++#if !defined(STAGING_CSMT) ++ BOOL decl_changed = FALSE; ++#else /* STAGING_CSMT */ ++ struct wined3d_device *device = buffer->resource.device; ++ UINT start, end, len, vertices; + BOOL decl_changed = FALSE; ++ unsigned int i, j; ++ BYTE *data; ++#endif /* STAGING_CSMT */ TRACE("buffer %p.\n", buffer); @@ -236,18 +526,142 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c if (buffer->resource.map_count) { WARN("Buffer is mapped, skipping preload.\n"); - return; +@@ -946,6 +1168,23 @@ void wined3d_buffer_load(struct wined3d_buffer *buffer, struct wined3d_context * } + wined3d_buffer_prepare_location(buffer, context, WINED3D_LOCATION_BUFFER); ++#else /* STAGING_CSMT */ ++ buffer_mark_used(buffer); ++ ++ if (!buffer->buffer_object) ++ { ++ /* 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; ++ } ++ } +#endif /* STAGING_CSMT */ - buffer_mark_used(buffer); - if (!buffer->buffer_object) -@@ -939,9 +1001,14 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI + /* Reading the declaration makes only sense if we have valid state information + * (i.e., if this function is called during draws). */ +@@ -1027,15 +1266,29 @@ void wined3d_buffer_load(struct wined3d_buffer *buffer, struct wined3d_context * + } + } + ++#if defined(STAGING_CSMT) ++ if (buffer->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER_ARB) ++ device_invalidate_state(device, STATE_INDEXBUFFER); ++ ++#endif /* STAGING_CSMT */ + if (!buffer->conversion_map) + { ++#if !defined(STAGING_CSMT) + /* That means that there is nothing to fixup. Just upload from + * buffer->resource.heap_memory directly into the BO. 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. */ ++#else /* STAGING_CSMT */ ++ /* That means that there is nothing to fixup. Just upload from ++ * 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. */ ++#endif /* STAGING_CSMT */ + TRACE("No conversion needed.\n"); + ++#if !defined(STAGING_CSMT) + /* Nothing to do because heap memory exists if the buffer is double buffer or has no BO at all. */ + if (!(buffer->flags & WINED3D_BUFFER_DOUBLEBUFFER)) + return; +@@ -1046,6 +1299,69 @@ void wined3d_buffer_load(struct wined3d_buffer *buffer, struct wined3d_context * + { + buffer_conversion_upload(buffer, context); + } ++#else /* STAGING_CSMT */ ++ /* Nothing to do because we locked directly into the vbo */ ++ if (!(buffer->flags & WINED3D_BUFFER_DOUBLEBUFFER)) ++ { ++ return; ++ } ++ ++ buffer_direct_upload(buffer, gl_info, flags); ++ ++ return; ++ } ++ ++ if(!(buffer->flags & WINED3D_BUFFER_DOUBLEBUFFER)) ++ { ++ wined3d_buffer_load_sysmem(buffer, context); ++ } ++ ++ /* Now for each vertex in the buffer that needs conversion */ ++ vertices = buffer->resource.size / buffer->stride; ++ ++ data = HeapAlloc(GetProcessHeap(), 0, buffer->resource.size); ++ ++ 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, vertices); ++i) ++ { ++ for (j = 0; j < buffer->stride; ++j) ++ { ++ switch (buffer->conversion_map[j]) ++ { ++ case CONV_NONE: ++ /* Done already */ ++ j += 3; ++ break; ++ case CONV_D3DCOLOR: ++ fixup_d3dcolor((DWORD *) (data + i * buffer->stride + j)); ++ j += 3; ++ break; ++ ++ case CONV_POSITIONT: ++ 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]); ++ } ++ } ++ } ++ ++ 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); ++#endif /* STAGING_CSMT */ + } + + struct wined3d_resource * CDECL wined3d_buffer_get_resource(struct wined3d_buffer *buffer) +@@ -1057,13 +1373,21 @@ 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) { ++#if !defined(STAGING_CSMT) + struct wined3d_device *device = buffer->resource.device; + struct wined3d_context *context; LONG count; BYTE *base; -+#if defined(STAGING_CSMT) ++#else /* STAGING_CSMT */ ++ LONG count; ++ BYTE *base; + struct wined3d_device *device = buffer->resource.device; + struct wined3d_context *context; +#endif /* STAGING_CSMT */ @@ -258,13 +672,13 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c /* Filter redundant WINED3D_MAP_DISCARD maps. The 3DMark2001 multitexture * fill rate test seems to depend on this. When we map a buffer with * GL_MAP_INVALIDATE_BUFFER_BIT, the driver is free to discard the -@@ -949,6 +1016,35 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI +@@ -1071,18 +1395,50 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI * the buffer is currently in use, while the proprietary NVIDIA driver * appears to do this unconditionally. */ if (buffer->flags & WINED3D_BUFFER_DISCARD) +#else /* STAGING_CSMT */ + /* 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 @@ -294,29 +708,35 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c flags &= ~WINED3D_MAP_DISCARD; count = ++buffer->resource.map_count; -@@ -959,17 +1055,34 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI + if (buffer->buffer_object) + { ++#if !defined(STAGING_CSMT) + unsigned int dirty_offset = offset, dirty_size = size; + ++#endif /* STAGING_CSMT */ + /* 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) +#if !defined(STAGING_CSMT) - buffer_invalidate_bo_range(buffer, 0, 0); - else if (!(flags & WINED3D_MAP_READONLY)) - buffer_invalidate_bo_range(buffer, offset, size); + { + dirty_offset = 0; + dirty_size = 0; +@@ -1108,6 +1464,25 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI + if (count == 1) + { + const struct wined3d_gl_info *gl_info; +#else /* STAGING_CSMT */ + wined3d_cs_emit_buffer_invalidate_bo_range(device->cs, buffer, 0, 0); + else if (!(flags & WINED3D_MAP_READONLY)) + wined3d_cs_emit_buffer_invalidate_bo_range(device->cs, buffer, offset, size); -+#endif /* STAGING_CSMT */ - - if (!(buffer->flags & WINED3D_BUFFER_DOUBLEBUFFER)) - { - if (count == 1) - { - struct wined3d_device *device = buffer->resource.device; -+#if !defined(STAGING_CSMT) - struct wined3d_context *context; - const struct wined3d_gl_info *gl_info; -+#else /* STAGING_CSMT */ ++ ++ if (!(buffer->flags & WINED3D_BUFFER_DOUBLEBUFFER)) ++ { ++ if (count == 1) ++ { ++ struct wined3d_device *device = buffer->resource.device; + const struct wined3d_gl_info *gl_info; + + if (wined3d_settings.cs_multithreaded) @@ -329,12 +749,19 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c context = context_acquire(device, NULL); gl_info = context->gl_info; -@@ -1015,11 +1128,14 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI - buffer_get_sysmem(buffer, context); +@@ -1150,14 +1525,21 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI + else + { + TRACE("Falling back to doublebuffered operation.\n"); ++#if !defined(STAGING_CSMT) + wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_SYSMEM); } TRACE("New pointer is %p.\n", buffer->resource.heap_memory); -+#if !defined(STAGING_CSMT) buffer->map_ptr = NULL; ++#else /* STAGING_CSMT */ ++ wined3d_buffer_load_sysmem(buffer, context); ++ } ++ TRACE("New pointer is %p.\n", buffer->resource.heap_memory); +#endif /* STAGING_CSMT */ } context_release(context); @@ -344,7 +771,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c if (flags & WINED3D_MAP_DISCARD) buffer->flags |= WINED3D_BUFFER_DISCARD; -@@ -1028,6 +1144,43 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI +@@ -1166,6 +1548,43 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI } base = buffer->map_ptr ? buffer->map_ptr : buffer->resource.heap_memory; @@ -388,7 +815,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c *data = base + offset; TRACE("Returning memory at %p (base %p, offset %u).\n", *data, base, offset); -@@ -1090,17 +1243,25 @@ static void wined3d_buffer_unmap(struct wined3d_buffer *buffer) +@@ -1228,28 +1647,44 @@ static void wined3d_buffer_unmap(struct wined3d_buffer *buffer) } GL_EXTCALL(glUnmapBuffer(buffer->buffer_type_hint)); @@ -414,7 +841,104 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c } HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_offset, -@@ -1220,6 +1381,14 @@ static void buffer_resource_preload(struct wined3d_resource *resource) + struct wined3d_buffer *src_buffer, unsigned int src_offset, unsigned int size) + { ++#if !defined(STAGING_CSMT) + 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; ++#else /* STAGING_CSMT */ ++ 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_context *context; ++ struct wined3d_device *device; ++#endif /* STAGING_CSMT */ + HRESULT hr; + + device = dst_buffer->resource.device; +@@ -1257,17 +1692,33 @@ HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_ + context = context_acquire(device, NULL); + gl_info = context->gl_info; + ++#if !defined(STAGING_CSMT) + wined3d_buffer_get_memory(dst_buffer, &dst, dst_buffer->locations); + wined3d_buffer_get_memory(src_buffer, &src, src_buffer->locations); + + if (dst.buffer_object && src.buffer_object) ++#else /* STAGING_CSMT */ ++ 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 && !src_buffer_mem) ++#endif /* STAGING_CSMT */ + { + if (gl_info->supported[ARB_COPY_BUFFER]) + { ++#if !defined(STAGING_CSMT) + 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)); ++#else /* STAGING_CSMT */ ++ 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)); ++#endif /* STAGING_CSMT */ + checkGLcall("direct buffer copy"); + } + else +@@ -1292,6 +1743,7 @@ HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_ + wined3d_buffer_unmap(dst_buffer); + } + } ++#if !defined(STAGING_CSMT) + else if (!dst.buffer_object && src.buffer_object) + { + buffer_bind(src_buffer, context); +@@ -1302,15 +1754,35 @@ HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_ + { + buffer_bind(dst_buffer, context); + GL_EXTCALL(glBufferSubData(dst_buffer->buffer_type_hint, dst_offset, size, src.addr + src_offset)); ++#else /* STAGING_CSMT */ ++ 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_buffer_mem + dst_offset)); ++ checkGLcall("buffer download"); ++ } ++ 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_buffer_mem + src_offset)); ++#endif /* STAGING_CSMT */ + checkGLcall("buffer upload"); + } + else + { ++#if !defined(STAGING_CSMT) + memcpy(dst.addr + dst_offset, src.addr + 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); ++#else /* STAGING_CSMT */ ++ memcpy(dst_buffer_mem + dst_offset, src_buffer_mem + src_offset, size); ++ } ++ ++ if (dst_buffer_mem) ++ buffer_invalidate_bo_range(dst_buffer, dst_offset, size); ++#endif /* STAGING_CSMT */ + + context_release(context); + return WINED3D_OK; +@@ -1357,6 +1829,14 @@ static void buffer_resource_preload(struct wined3d_resource *resource) { struct wined3d_context *context; @@ -427,19 +951,21 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c + +#endif /* STAGING_CSMT */ 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); -@@ -1302,6 +1471,9 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device +@@ -1439,7 +1919,11 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device return hr; } buffer->buffer_type_hint = bind_hint; -+#if defined(STAGING_CSMT) ++#if !defined(STAGING_CSMT) + buffer->locations = WINED3D_LOCATION_SYSMEM; ++#else /* STAGING_CSMT */ + buffer->ignore_discard = TRUE; +#endif /* STAGING_CSMT */ 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); -@@ -1337,6 +1509,11 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device +@@ -1475,6 +1959,11 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device buffer->flags |= WINED3D_BUFFER_USE_BO; } @@ -451,7 +977,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c if (!(buffer->maps = HeapAlloc(GetProcessHeap(), 0, sizeof(*buffer->maps)))) { ERR("Out of memory.\n"); -@@ -1458,3 +1635,12 @@ HRESULT CDECL wined3d_buffer_create_ib(struct wined3d_device *device, UINT size, +@@ -1596,3 +2085,12 @@ HRESULT CDECL wined3d_buffer_create_ib(struct wined3d_device *device, UINT size, return WINED3D_OK; } @@ -584,7 +1110,19 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c } static BOOL fixed_get_input(BYTE usage, BYTE usage_idx, unsigned int *regnum) -@@ -3409,7 +3451,11 @@ BOOL context_apply_draw_state(struct wined3d_context *context, +@@ -3219,7 +3261,11 @@ static void context_update_stream_info(struct wined3d_context *context, const st + else + { + wined3d_buffer_load(buffer, context, state); ++#if !defined(STAGING_CSMT) + wined3d_buffer_get_memory(buffer, &data, buffer->locations); ++#else /* STAGING_CSMT */ ++ buffer_get_memory(buffer, context, &data); ++#endif /* STAGING_CSMT */ + element->data.buffer_object = data.buffer_object; + element->data.addr += (ULONG_PTR)data.addr; + } +@@ -3409,7 +3455,11 @@ BOOL context_apply_draw_state(struct wined3d_context *context, const struct wined3d_device *device, const struct wined3d_state *state) { const struct StateEntry *state_table = context->state_table; @@ -596,7 +1134,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c unsigned int i; WORD map; -@@ -3442,8 +3488,17 @@ BOOL context_apply_draw_state(struct wined3d_context *context, +@@ -3442,8 +3492,17 @@ 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) @@ -604,7 +1142,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c buffer_mark_used(state->streams[context->stream_info.elements[i].stream_idx].buffer); } +#else /* STAGING_CSMT */ -+ 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. */ @@ -614,7 +1152,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c } if (state->index_buffer) { -@@ -3563,6 +3618,11 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device, str +@@ -3563,6 +3622,11 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device, str TRACE("device %p, target %p.\n", device, target); @@ -4025,7 +4563,17 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_device_get_transform(device, WINED3D_TS_VIEW, &view_mat); wined3d_device_get_transform(device, WINED3D_TS_PROJECTION, &proj_mat); wined3d_device_get_transform(device, WINED3D_TS_WORLD_MATRIX(0), &world_mat); -@@ -3524,8 +3729,10 @@ HRESULT CDECL wined3d_device_begin_scene(struct wined3d_device *device) +@@ -3228,7 +3433,9 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, + { + GL_EXTCALL(glDeleteBuffers(1, &buffer->buffer_object)); + buffer->buffer_object = 0; ++#if !defined(STAGING_CSMT) + wined3d_buffer_invalidate_location(buffer, WINED3D_LOCATION_BUFFER); ++#endif /* STAGING_CSMT */ + } + if (e->data.addr) + e->data.addr += e->stride * src_start_idx; +@@ -3525,8 +3732,10 @@ HRESULT CDECL wined3d_device_begin_scene(struct wined3d_device *device) HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) { @@ -4036,7 +4584,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p.\n", device); if (!device->inScene) -@@ -3534,6 +3741,7 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) +@@ -3535,6 +3744,7 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) return WINED3DERR_INVALIDCALL; } @@ -4044,7 +4592,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c context = context_acquire(device, NULL); /* We only have to do this if we need to read the, swapbuffers performs a flush for us */ context->gl_info->gl_ops.gl.p_glFlush(); -@@ -3541,6 +3749,7 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) +@@ -3542,6 +3752,7 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) * fails. */ context_release(context); @@ -4052,7 +4600,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c device->inScene = FALSE; return WINED3D_OK; } -@@ -3548,6 +3757,10 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) +@@ -3549,6 +3760,10 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_count, const RECT *rects, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil) { @@ -4063,7 +4611,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, rect_count %u, rects %p, flags %#x, color %s, depth %.8e, stencil %u.\n", device, rect_count, rects, flags, debug_color(color), depth, stencil); -@@ -3559,7 +3772,11 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou +@@ -3560,7 +3775,11 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) { @@ -4075,7 +4623,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (!ds) { WARN("Clearing depth and/or stencil without a depth stencil buffer attached, returning WINED3DERR_INVALIDCALL\n"); -@@ -3568,8 +3785,13 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou +@@ -3569,8 +3788,13 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou } else if (flags & WINED3DCLEAR_TARGET) { @@ -4089,7 +4637,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { WARN("Silently ignoring depth and target clear with mismatching sizes\n"); return WINED3D_OK; -@@ -3615,7 +3837,9 @@ void CDECL wined3d_device_set_primitive_type(struct wined3d_device *device, +@@ -3616,7 +3840,9 @@ void CDECL wined3d_device_set_primitive_type(struct wined3d_device *device, enum wined3d_primitive_type primitive_type) { GLenum gl_primitive_type, prev; @@ -4099,7 +4647,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, primitive_type %s\n", device, debug_d3dprimitivetype(primitive_type)); gl_primitive_type = gl_primitive_type_from_d3d(primitive_type); -@@ -3623,8 +3847,13 @@ void CDECL wined3d_device_set_primitive_type(struct wined3d_device *device, +@@ -3624,8 +3850,13 @@ void CDECL wined3d_device_set_primitive_type(struct wined3d_device *device, device->update_state->gl_primitive_type = gl_primitive_type; if (device->recording) device->recording->changed.primitive_type = TRUE; @@ -4113,7 +4661,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } void CDECL wined3d_device_get_primitive_type(const struct wined3d_device *device, -@@ -3684,10 +3913,16 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device +@@ -3685,10 +3916,16 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device start_idx, index_count, start_instance, instance_count, TRUE); } @@ -4130,7 +4678,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c struct wined3d_const_bo_address data; struct wined3d_context *context; struct wined3d_map_desc src; -@@ -3712,6 +3947,14 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, +@@ -3713,6 +3950,14 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, } context = context_acquire(device, NULL); @@ -4145,7 +4693,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Only a prepare, since we're uploading entire volumes. */ wined3d_texture_prepare_texture(dst_texture, context, FALSE); -@@ -3719,6 +3962,7 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, +@@ -3720,6 +3965,7 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, for (i = 0; i < level_count; ++i) { @@ -4153,7 +4701,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (FAILED(hr = wined3d_resource_map(&src_texture->resource, src_level + i, &src, NULL, WINED3D_MAP_READONLY))) goto done; -@@ -3735,16 +3979,94 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, +@@ -3736,16 +3982,94 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, done: context_release(context); return hr; @@ -4248,7 +4796,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, src_texture %p, dst_texture %p.\n", device, src_texture, dst_texture); -@@ -3781,6 +4103,7 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, +@@ -3782,6 +4106,7 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, return WINED3DERR_INVALIDCALL; } @@ -4256,7 +4804,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c level_count = min(wined3d_texture_get_level_count(src_texture), wined3d_texture_get_level_count(dst_texture)); -@@ -3803,9 +4126,21 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, +@@ -3804,9 +4129,21 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, context_release(context); /* Update every surface level of the texture. */ @@ -4278,7 +4826,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { unsigned int src_levels = src_texture->level_count; unsigned int dst_levels = dst_texture->level_count; -@@ -3838,6 +4173,38 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, +@@ -3839,6 +4176,38 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, FIXME("Unsupported texture type %#x.\n", type); return WINED3DERR_INVALIDCALL; } @@ -4317,7 +4865,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device, DWORD *num_passes) -@@ -3885,8 +4252,13 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device +@@ -3886,8 +4255,13 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device if (state->render_states[WINED3D_RS_ZENABLE] || state->render_states[WINED3D_RS_ZWRITEENABLE] || state->render_states[WINED3D_RS_STENCILENABLE]) { @@ -4331,7 +4879,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (ds && rt && (ds->width < rt->width || ds->height < rt->height)) { -@@ -4075,6 +4447,9 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev +@@ -4076,6 +4450,9 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev struct wined3d_texture *dst_texture, *src_texture; RECT dst_rect, src_rect; HRESULT hr; @@ -4341,7 +4889,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, dst_resource %p, dst_sub_resource_idx %u, dst_x %u, dst_y %u, dst_z %u, " "src_resource %p, src_sub_resource_idx %u, src_box %s.\n", -@@ -4162,6 +4537,16 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev +@@ -4163,6 +4540,16 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev if (src_box) { @@ -4358,7 +4906,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c SetRect(&src_rect, src_box->left, src_box->top, src_box->right, src_box->bottom); } else -@@ -4175,6 +4560,25 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev +@@ -4176,6 +4563,25 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev SetRect(&dst_rect, dst_x, dst_y, dst_x + (src_rect.right - src_rect.left), dst_y + (src_rect.bottom - src_rect.top)); @@ -4384,7 +4932,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (FAILED(hr = wined3d_texture_blt(dst_texture, dst_sub_resource_idx, &dst_rect, src_texture, src_sub_resource_idx, &src_rect, 0, NULL, WINED3D_TEXF_POINT))) WARN("Failed to blit, hr %#x.\n", hr); -@@ -4187,6 +4591,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str +@@ -4188,6 +4594,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str unsigned int depth_pitch) { struct wined3d_texture_sub_resource *sub_resource; @@ -4392,7 +4940,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c const struct wined3d_gl_info *gl_info; struct wined3d_const_bo_address addr; unsigned int width, height, level; -@@ -4195,6 +4600,9 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str +@@ -4196,6 +4603,9 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str struct wined3d_surface *surface; POINT dst_point; RECT src_rect; @@ -4402,7 +4950,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, resource %p, sub_resource_idx %u, box %s, data %p, row_pitch %u, depth_pitch %u.\n", device, resource, sub_resource_idx, debug_box(box), data, row_pitch, depth_pitch); -@@ -4228,6 +4636,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str +@@ -4229,6 +4639,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str WARN("Invalid sub_resource_idx %u.\n", sub_resource_idx); return; } @@ -4410,7 +4958,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c surface = sub_resource->u.surface; level = sub_resource_idx % texture->level_count; -@@ -4238,6 +4647,17 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str +@@ -4239,6 +4650,17 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str src_rect.top = 0; if (box) { @@ -4428,7 +4976,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (box->left >= box->right || box->right > width || box->top >= box->bottom || box->bottom > height || box->front >= box->back) -@@ -4245,6 +4665,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str +@@ -4246,6 +4668,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str WARN("Invalid box %s specified.\n", debug_box(box)); return; } @@ -4436,7 +4984,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c src_rect.right = box->right - box->left; src_rect.bottom = box->bottom - box->top; -@@ -4279,6 +4700,11 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str +@@ -4280,6 +4703,11 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str wined3d_texture_validate_location(texture, sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB); wined3d_texture_invalidate_location(texture, sub_resource_idx, ~WINED3D_LOCATION_TEXTURE_RGB); @@ -4448,7 +4996,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *device, -@@ -4287,8 +4713,13 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi +@@ -4288,8 +4716,13 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi { const struct blit_shader *blitter; struct wined3d_resource *resource; @@ -4462,7 +5010,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, view %p, rect %s, flags %#x, color %s, depth %.8e, stencil %u.\n", device, view, wine_dbgstr_rect(rect), flags, debug_color(color), depth, stencil); -@@ -4327,10 +4758,15 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi +@@ -4328,10 +4761,15 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi return WINED3DERR_INVALIDCALL; } @@ -4478,7 +5026,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(const struct wined3d_device *device, -@@ -4344,20 +4780,31 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co +@@ -4345,20 +4783,31 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co return NULL; } @@ -4510,7 +5058,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, view_idx %u, view %p, set_viewport %#x.\n", device, view_idx, view, set_viewport); -@@ -4394,13 +4841,21 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device +@@ -4395,13 +4844,21 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device } @@ -4532,7 +5080,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_cs_emit_set_rendertarget_view(device->cs, view_idx, view); /* Release after the assignment, to prevent device_resource_released() * from seeing the surface as still in use. */ -@@ -4412,18 +4867,29 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device +@@ -4413,18 +4870,29 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device void CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *device, struct wined3d_rendertarget_view *view) { @@ -4562,7 +5110,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_rendertarget_view_incref(view); wined3d_cs_emit_set_depth_stencil_view(device->cs, view); if (prev) -@@ -4657,19 +5123,26 @@ void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device) +@@ -4658,19 +5126,26 @@ void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device) } } @@ -4589,7 +5137,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c LIST_FOR_EACH_ENTRY(shader, &device->shaders, struct wined3d_shader, shader_list_entry) { device->shader_backend->shader_destroy(shader); -@@ -4701,12 +5174,30 @@ static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d +@@ -4702,12 +5177,30 @@ static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d HeapFree(GetProcessHeap(), 0, swapchain->context); swapchain->context = NULL; @@ -4620,7 +5168,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c HRESULT hr; if (FAILED(hr = device->shader_backend->shader_alloc_private(device, -@@ -4723,6 +5214,7 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru +@@ -4724,6 +5217,7 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru return hr; } @@ -4628,7 +5176,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Recreate the primary swapchain's context */ swapchain->context = HeapAlloc(GetProcessHeap(), 0, sizeof(*swapchain->context)); if (!swapchain->context) -@@ -4735,10 +5227,15 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru +@@ -4736,10 +5230,15 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru target = swapchain->back_buffers ? swapchain->back_buffers[0] : swapchain->front_buffer; if (!(context = context_create(swapchain, target, swapchain->ds_format))) @@ -4644,7 +5192,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c HeapFree(GetProcessHeap(), 0, swapchain->context); return E_FAIL; } -@@ -4748,6 +5245,12 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru +@@ -4749,6 +5248,12 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru create_dummy_textures(device, context); create_default_samplers(device, context); context_release(context); @@ -4657,7 +5205,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -4766,6 +5269,14 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4767,6 +5272,14 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, TRACE("device %p, swapchain_desc %p, mode %p, callback %p, reset_state %#x.\n", device, swapchain_desc, mode, callback, reset_state); @@ -4672,7 +5220,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (!(swapchain = wined3d_device_get_swapchain(device, 0))) { ERR("Failed to get the first implicit swapchain.\n"); -@@ -4784,10 +5295,16 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4785,10 +5298,16 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, wined3d_texture_decref(device->cursor_texture); device->cursor_texture = NULL; } @@ -4689,7 +5237,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { -@@ -4796,10 +5313,22 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4797,10 +5316,22 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, } wined3d_device_set_depth_stencil_view(device, NULL); @@ -4712,7 +5260,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } if (reset_state) -@@ -4964,27 +5493,48 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4965,27 +5496,48 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, if (device->d3d_initialized) delete_opengl_contexts(device, swapchain); @@ -4761,7 +5309,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect); } -@@ -4992,7 +5542,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4993,7 +5545,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, { if (reset_state) hr = create_primary_opengl_context(device, swapchain); @@ -4773,7 +5321,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } /* All done. There is no need to reload resources or shaders, this will happen automatically on the -@@ -5074,11 +5628,19 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso +@@ -5075,11 +5631,19 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { @@ -4793,7 +5341,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c ERR("Resource %p is still in use as depth/stencil buffer.\n", resource); switch (type) -@@ -5203,8 +5765,17 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, +@@ -5204,8 +5768,17 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, device->blitter = adapter->blitter; @@ -4811,7 +5359,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c device->update_state = &device->state; if (!(device->cs = wined3d_cs_create(device))) -@@ -5298,3 +5869,58 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL +@@ -5299,3 +5872,58 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL else return CallWindowProcA(proc, window, message, wparam, lparam); } @@ -4873,7 +5421,27 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c -@@ -412,7 +412,11 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s +@@ -196,10 +196,19 @@ static void draw_primitive_immediate_mode(struct wined3d_context *context, const + if (instance_count) + FIXME("Instancing not implemented.\n"); + ++#if !defined(STAGING_CSMT) + /* 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; ++#else /* STAGING_CSMT */ ++ /* 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); ++#endif /* STAGING_CSMT */ + + ops = &d3d_info->ffp_attrib_ops; + +@@ -411,7 +420,11 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s int base_vertex_idx, unsigned int start_idx, unsigned int index_count, unsigned int start_instance, unsigned int instance_count, BOOL indexed) { @@ -4885,7 +5453,7 @@ diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c const struct wined3d_stream_info *stream_info; struct wined3d_event_query *ib_query = NULL; struct wined3d_stream_info si_emulated; -@@ -469,8 +473,13 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s +@@ -468,8 +481,13 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s { RECT current_rect, draw_rect, r; @@ -8335,13 +8903,13 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; +#if !defined(STAGING_CSMT) - void wined3d_texture_prepare_texture(struct wined3d_texture *texture, - struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; ++void wined3d_texture_prepare_texture(struct wined3d_texture *texture, ++ struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; +#else /* STAGING_CSMT */ +void *wined3d_texture_map_internal(struct wined3d_texture *texture, unsigned int sub_resource_idx, + DWORD flags) DECLSPEC_HIDDEN; -+void wined3d_texture_prepare_texture(struct wined3d_texture *texture, -+ struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; + void wined3d_texture_prepare_texture(struct wined3d_texture *texture, + struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; +void wined3d_texture_release_dc_cs(struct wined3d_texture *texture, + unsigned int sub_resource_idx) DECLSPEC_HIDDEN; +#endif /* STAGING_CSMT */ @@ -8512,11 +9080,11 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, DWORD flags) DECLSPEC_HIDDEN; void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags) DECLSPEC_HIDDEN; +#if !defined(STAGING_CSMT) -+void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) DECLSPEC_HIDDEN; + void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) DECLSPEC_HIDDEN; +#else /* STAGING_CSMT */ +void wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture *texture, + unsigned int sub_resource_idx) DECLSPEC_HIDDEN; - void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) DECLSPEC_HIDDEN; ++void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) DECLSPEC_HIDDEN; +void wined3d_cs_emit_sampler_init(struct wined3d_cs *cs, struct wined3d_sampler *sampler) DECLSPEC_HIDDEN; +void wined3d_cs_emit_set_base_vertex_index(struct wined3d_cs *cs, + UINT base_vertex_index) DECLSPEC_HIDDEN; @@ -8586,7 +9154,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h /* TODO: Add tests and support for FLOAT16_4 POSITIONT, D3DCOLOR position, other * fixed function semantics as D3DCOLOR or FLOAT16 */ -@@ -3162,6 +3424,9 @@ struct wined3d_buffer +@@ -3162,11 +3424,16 @@ struct wined3d_buffer GLenum buffer_object_usage; GLenum buffer_type_hint; DWORD flags; @@ -8596,18 +9164,39 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void *map_ptr; struct wined3d_map_range *maps; -@@ -3186,11 +3451,19 @@ 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; + ULONG maps_size, modified_areas; ++#if !defined(STAGING_CSMT) + DWORD locations; ++#endif /* STAGING_CSMT */ + struct wined3d_event_query *query; + + /* conversion stuff */ +@@ -3182,6 +3449,7 @@ static inline struct wined3d_buffer *buffer_from_resource(struct wined3d_resourc + return CONTAINING_RECORD(resource, struct wined3d_buffer, resource); + } + +#if !defined(STAGING_CSMT) 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; +@@ -3190,12 +3458,25 @@ void wined3d_buffer_load(struct wined3d_buffer *buffer, struct wined3d_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; ++#else /* STAGING_CSMT */ ++void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *context, ++ struct wined3d_bo_address *data) DECLSPEC_HIDDEN; ++void wined3d_buffer_load(struct wined3d_buffer *buffer, struct wined3d_context *context, ++ const struct wined3d_state *state) DECLSPEC_HIDDEN; +#endif /* STAGING_CSMT */ + 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; HRESULT wined3d_buffer_upload_data(struct wined3d_buffer *buffer, const struct wined3d_box *box, const void *data) DECLSPEC_HIDDEN; -+#if defined(STAGING_CSMT) ++#if !defined(STAGING_CSMT) + void wined3d_buffer_validate_location(struct wined3d_buffer *buffer, DWORD location) DECLSPEC_HIDDEN; ++#else /* STAGING_CSMT */ +void buffer_invalidate_bo_range(struct wined3d_buffer *buffer, unsigned int offset, unsigned int size) DECLSPEC_HIDDEN; +void buffer_swap_mem(struct wined3d_buffer *buffer, BYTE *mem) DECLSPEC_HIDDEN; +void buffer_create_buffer_object(struct wined3d_buffer *This, @@ -8616,7 +9205,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_rendertarget_view { -@@ -3252,7 +3525,12 @@ struct wined3d_unordered_access_view +@@ -3257,7 +3538,12 @@ struct wined3d_unordered_access_view struct wined3d_swapchain_ops { void (*swapchain_present)(struct wined3d_swapchain *swapchain, @@ -8629,7 +9218,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void (*swapchain_frontbuffer_updated)(struct wined3d_swapchain *swapchain); }; -@@ -3289,6 +3567,10 @@ struct wined3d_swapchain +@@ -3294,6 +3580,10 @@ struct wined3d_swapchain void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activate) DECLSPEC_HIDDEN; struct wined3d_context *swapchain_get_context(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/definition b/patches/wined3d-CSMT_Main/definition index dcae18bb..b3acc9dd 100644 --- a/patches/wined3d-CSMT_Main/definition +++ b/patches/wined3d-CSMT_Main/definition @@ -5,7 +5,6 @@ Fixes: [11674] Support for CSMT (command stream) to increase graphic performance Apply-After: dlls/wined3d/* Depends: wined3d-CSMT_Helper IfDefined: STAGING_CSMT -Disabled: true # Known issues: # https://bugs.wine-staging.com/buglist.cgi?component=Bugs&keywords=csmt%2C%20&keywords_type=allwords&list_id=3690&query_format=advanced&resolution=---