winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
December 2012
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
549 discussions
Start a n
N
ew thread
Stefan Dösinger : d3d9: Use dynamic buffers for DrawIndexedPrimitiveUP.
by Alexandre Julliard
19 Dec '12
19 Dec '12
Module: wine Branch: master Commit: f3f172ce81ea17679854441674d55ffc8493a766 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f3f172ce81ea1767985444167…
Author: Stefan Dösinger <stefan(a)codeweavers.com> Date: Tue Dec 18 22:53:15 2012 +0100 d3d9: Use dynamic buffers for DrawIndexedPrimitiveUP. --- dlls/d3d9/d3d9_private.h | 3 + dlls/d3d9/device.c | 125 +++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 121 insertions(+), 7 deletions(-) diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h index 866078c..26d990a 100644 --- a/dlls/d3d9/d3d9_private.h +++ b/dlls/d3d9/d3d9_private.h @@ -153,6 +153,9 @@ struct d3d9_device struct wined3d_buffer *vertex_buffer; UINT vertex_buffer_size; UINT vertex_buffer_pos; + struct wined3d_buffer *index_buffer; + UINT index_buffer_size; + UINT index_buffer_pos; BOOL in_destruction; BOOL not_reset; diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 32f12d3..d79ad62 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -299,6 +299,8 @@ static ULONG WINAPI DECLSPEC_HOTPATCH d3d9_device_Release(IDirect3DDevice9Ex *if if (device->vertex_buffer) wined3d_buffer_decref(device->vertex_buffer); + if (device->index_buffer) + wined3d_buffer_decref(device->index_buffer); wined3d_device_uninit_3d(device->wined3d_device); wined3d_device_release_focus_window(device->wined3d_device); @@ -591,6 +593,12 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_Reset(IDirect3DDevice9Ex *if device->vertex_buffer = NULL; device->vertex_buffer_size = 0; } + if (device->index_buffer) + { + wined3d_buffer_decref(device->index_buffer); + device->index_buffer = NULL; + device->index_buffer_size = 0; + } wined3d_swapchain_desc_from_present_parameters(&swapchain_desc, present_parameters); hr = wined3d_device_reset(device->wined3d_device, &swapchain_desc, @@ -2063,26 +2071,123 @@ done: return hr; } +/* The caller is responsible for wined3d locking */ +static HRESULT d3d9_device_prepare_index_buffer(struct d3d9_device *device, UINT min_size) +{ + HRESULT hr; + + if (device->index_buffer_size < min_size || !device->index_buffer) + { + UINT size = max(device->index_buffer_size * 2, min_size); + struct wined3d_buffer *buffer; + + TRACE("Growing index buffer to %u bytes\n", size); + + hr = wined3d_buffer_create_ib(device->wined3d_device, size, WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY, + WINED3D_POOL_DEFAULT, NULL, &d3d9_null_wined3d_parent_ops, &buffer); + if (FAILED(hr)) + { + ERR("(%p) wined3d_buffer_create_ib failed with hr = %08x\n", device, hr); + return hr; + } + + if (device->index_buffer) + wined3d_buffer_decref(device->index_buffer); + + device->index_buffer = buffer; + device->index_buffer_size = size; + device->index_buffer_pos = 0; + } + return D3D_OK; +} + static HRESULT WINAPI d3d9_device_DrawIndexedPrimitiveUP(IDirect3DDevice9Ex *iface, - D3DPRIMITIVETYPE primitive_type, UINT min_vertex_idx, UINT index_count, + D3DPRIMITIVETYPE primitive_type, UINT min_vertex_idx, UINT vertex_count, UINT primitive_count, const void *index_data, D3DFORMAT index_format, const void *vertex_data, UINT vertex_stride) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; + BYTE *buffer_data; + + UINT idx_count = vertex_count_from_primitive_count(primitive_type, primitive_count); + UINT idx_fmt_size = index_format == D3DFMT_INDEX16 ? 2 : 4; + UINT idx_size = idx_count * idx_fmt_size; + UINT ib_pos; + + UINT vtx_size = vertex_count * vertex_stride; + UINT vb_pos, align; - TRACE("iface %p, primitive_type %#x, min_vertex_idx %u, index_count %u, primitive_count %u,\n" + TRACE("iface %p, primitive_type %#x, min_vertex_idx %u, vertex_count %u, primitive_count %u,\n" "index_data %p, index_format %#x, vertex_data %p, vertex_stride %u.\n", - iface, primitive_type, min_vertex_idx, index_count, primitive_count, + iface, primitive_type, min_vertex_idx, vertex_count, primitive_count, index_data, index_format, vertex_data, vertex_stride); + if (!primitive_count) + { + WARN("primitive_count is 0, returning D3D_OK\n"); + return D3D_OK; + } + wined3d_mutex_lock(); + + hr = d3d9_device_prepare_vertex_buffer(device, vtx_size); + if (FAILED(hr)) + goto done; + + vb_pos = device->vertex_buffer_pos; + align = vb_pos % vertex_stride; + if (align) align = vertex_stride - align; + if (vb_pos + vtx_size + align > device->vertex_buffer_size) + vb_pos = 0; + else + vb_pos += align; + + hr = wined3d_buffer_map(device->vertex_buffer, vb_pos, vtx_size, &buffer_data, + vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD); + if (FAILED(hr)) + goto done; + memcpy(buffer_data, vertex_data, vtx_size); + wined3d_buffer_unmap(device->vertex_buffer); + device->vertex_buffer_pos = vb_pos + vtx_size; + + hr = d3d9_device_prepare_index_buffer(device, idx_size); + if (FAILED(hr)) + goto done; + + ib_pos = device->index_buffer_pos; + align = ib_pos % idx_fmt_size; + if (align) align = idx_fmt_size - align; + if (ib_pos + idx_size + align > device->index_buffer_size) + ib_pos = 0; + else + ib_pos += align; + + hr = wined3d_buffer_map(device->index_buffer, ib_pos, idx_size, &buffer_data, + ib_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD); + if (FAILED(hr)) + goto done; + memcpy(buffer_data, index_data, idx_size); + wined3d_buffer_unmap(device->index_buffer); + device->index_buffer_pos = ib_pos + idx_size; + + hr = wined3d_device_set_stream_source(device->wined3d_device, 0, device->vertex_buffer, 0, vertex_stride); + if (FAILED(hr)) + goto done; + + wined3d_device_set_index_buffer(device->wined3d_device, device->index_buffer, + wined3dformat_from_d3dformat(index_format)); + wined3d_device_set_base_vertex_index(device->wined3d_device, vb_pos / vertex_stride); + wined3d_device_set_primitive_type(device->wined3d_device, primitive_type); - hr = wined3d_device_draw_indexed_primitive_up(device->wined3d_device, - vertex_count_from_primitive_count(primitive_type, primitive_count), index_data, - wined3dformat_from_d3dformat(index_format), vertex_data, vertex_stride); - wined3d_mutex_unlock(); + hr = wined3d_device_draw_indexed_primitive(device->wined3d_device, ib_pos / idx_fmt_size, idx_count); + + wined3d_device_set_stream_source(device->wined3d_device, 0, NULL, 0, 0); + wined3d_device_set_index_buffer(device->wined3d_device, NULL, WINED3DFMT_UNKNOWN); + wined3d_device_set_base_vertex_index(device->wined3d_device, 0); +done: + wined3d_mutex_unlock(); return hr; } @@ -2997,6 +3102,12 @@ static HRESULT WINAPI d3d9_device_ResetEx(IDirect3DDevice9Ex *iface, device->vertex_buffer = NULL; device->vertex_buffer_size = 0; } + if (device->index_buffer) + { + wined3d_buffer_decref(device->index_buffer); + device->index_buffer = NULL; + device->index_buffer_size = 0; + } wined3d_swapchain_desc_from_present_parameters(&swapchain_desc, present_parameters); hr = wined3d_device_reset(device->wined3d_device, &swapchain_desc,
1
0
0
0
Stefan Dösinger : d3d9: Use a dynamic buffer for DrawPrimitiveUP.
by Alexandre Julliard
19 Dec '12
19 Dec '12
Module: wine Branch: master Commit: 873603f941ebb4b5c5c818e0fac5638fcfc07ae1 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=873603f941ebb4b5c5c818e0f…
Author: Stefan Dösinger <stefan(a)codeweavers.com> Date: Tue Dec 18 22:53:14 2012 +0100 d3d9: Use a dynamic buffer for DrawPrimitiveUP. --- dlls/d3d9/d3d9_private.h | 4 ++ dlls/d3d9/device.c | 99 ++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 99 insertions(+), 4 deletions(-) diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h index ae8f7c6..866078c 100644 --- a/dlls/d3d9/d3d9_private.h +++ b/dlls/d3d9/d3d9_private.h @@ -150,6 +150,10 @@ struct d3d9_device struct fvf_declaration *fvf_decls; UINT fvf_decl_count, fvf_decl_size; + struct wined3d_buffer *vertex_buffer; + UINT vertex_buffer_size; + UINT vertex_buffer_pos; + BOOL in_destruction; BOOL not_reset; BOOL in_scene; diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 1c707e2..32f12d3 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -297,6 +297,9 @@ static ULONG WINAPI DECLSPEC_HOTPATCH d3d9_device_Release(IDirect3DDevice9Ex *if } HeapFree(GetProcessHeap(), 0, device->fvf_decls); + if (device->vertex_buffer) + wined3d_buffer_decref(device->vertex_buffer); + wined3d_device_uninit_3d(device->wined3d_device); wined3d_device_release_focus_window(device->wined3d_device); wined3d_device_decref(device->wined3d_device); @@ -581,6 +584,14 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_Reset(IDirect3DDevice9Ex *if TRACE("iface %p, present_parameters %p.\n", iface, present_parameters); wined3d_mutex_lock(); + + if (device->vertex_buffer) + { + wined3d_buffer_decref(device->vertex_buffer); + device->vertex_buffer = NULL; + device->vertex_buffer_size = 0; + } + wined3d_swapchain_desc_from_present_parameters(&swapchain_desc, present_parameters); hr = wined3d_device_reset(device->wined3d_device, &swapchain_desc, NULL, reset_enum_callback, !device->d3d_parent->extended); @@ -1961,22 +1972,94 @@ static HRESULT WINAPI d3d9_device_DrawIndexedPrimitive(IDirect3DDevice9Ex *iface return hr; } +static void STDMETHODCALLTYPE d3d9_null_wined3d_object_destroyed(void *parent) {} + +static const struct wined3d_parent_ops d3d9_null_wined3d_parent_ops = +{ + d3d9_null_wined3d_object_destroyed, +}; + +/* The caller is responsible for wined3d locking */ +static HRESULT d3d9_device_prepare_vertex_buffer(struct d3d9_device *device, UINT min_size) +{ + HRESULT hr; + + if (device->vertex_buffer_size < min_size || !device->vertex_buffer) + { + UINT size = max(device->vertex_buffer_size * 2, min_size); + struct wined3d_buffer *buffer; + + TRACE("Growing vertex buffer to %u bytes\n", size); + + hr = wined3d_buffer_create_vb(device->wined3d_device, size, WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY, + WINED3D_POOL_DEFAULT, NULL, &d3d9_null_wined3d_parent_ops, &buffer); + if (FAILED(hr)) + { + ERR("(%p) wined3d_buffer_create_vb failed with hr = %08x\n", device, hr); + return hr; + } + + if (device->vertex_buffer) + wined3d_buffer_decref(device->vertex_buffer); + + device->vertex_buffer = buffer; + device->vertex_buffer_size = size; + device->vertex_buffer_pos = 0; + } + return D3D_OK; +} + static HRESULT WINAPI d3d9_device_DrawPrimitiveUP(IDirect3DDevice9Ex *iface, D3DPRIMITIVETYPE primitive_type, UINT primitive_count, const void *data, UINT stride) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; + UINT vtx_count = vertex_count_from_primitive_count(primitive_type, primitive_count); + UINT size = vtx_count * stride; + UINT vb_pos, align; + BYTE *buffer_data; TRACE("iface %p, primitive_type %#x, primitive_count %u, data %p, stride %u.\n", iface, primitive_type, primitive_count, data, stride); + if (!primitive_count) + { + WARN("primitive_count is 0, returning D3D_OK\n"); + return D3D_OK; + } + wined3d_mutex_lock(); + + hr = d3d9_device_prepare_vertex_buffer(device, size); + if (FAILED(hr)) + goto done; + + vb_pos = device->vertex_buffer_pos; + align = vb_pos % stride; + if (align) align = stride - align; + if (vb_pos + size + align > device->vertex_buffer_size) + vb_pos = 0; + else + vb_pos += align; + + hr = wined3d_buffer_map(device->vertex_buffer, vb_pos, size, &buffer_data, + vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD); + if (FAILED(hr)) + goto done; + memcpy(buffer_data, data, size); + wined3d_buffer_unmap(device->vertex_buffer); + device->vertex_buffer_pos = vb_pos + size; + + hr = wined3d_device_set_stream_source(device->wined3d_device, 0, device->vertex_buffer, 0, stride); + if (FAILED(hr)) + goto done; + wined3d_device_set_primitive_type(device->wined3d_device, primitive_type); - hr = wined3d_device_draw_primitive_up(device->wined3d_device, - vertex_count_from_primitive_count(primitive_type, primitive_count), - data, stride); - wined3d_mutex_unlock(); + hr = wined3d_device_draw_primitive(device->wined3d_device, vb_pos / stride, vtx_count); + wined3d_device_set_stream_source(device->wined3d_device, 0, NULL, 0, 0); +done: + wined3d_mutex_unlock(); return hr; } @@ -2907,6 +2990,14 @@ static HRESULT WINAPI d3d9_device_ResetEx(IDirect3DDevice9Ex *iface, } wined3d_mutex_lock(); + + if (device->vertex_buffer) + { + wined3d_buffer_decref(device->vertex_buffer); + device->vertex_buffer = NULL; + device->vertex_buffer_size = 0; + } + wined3d_swapchain_desc_from_present_parameters(&swapchain_desc, present_parameters); hr = wined3d_device_reset(device->wined3d_device, &swapchain_desc, mode ? &wined3d_mode : NULL, reset_enum_callback, FALSE);
1
0
0
0
Stefan Dösinger : d3d8: Use dynamic buffers for DrawIndexedPrimitiveUP.
by Alexandre Julliard
19 Dec '12
19 Dec '12
Module: wine Branch: master Commit: 01197730efba8124d94481a187912b3936c68e16 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=01197730efba8124d94481a18…
Author: Stefan Dösinger <stefan(a)codeweavers.com> Date: Tue Dec 18 22:53:13 2012 +0100 d3d8: Use dynamic buffers for DrawIndexedPrimitiveUP. --- dlls/d3d8/d3d8_private.h | 3 + dlls/d3d8/device.c | 119 +++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 115 insertions(+), 7 deletions(-) diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h index 4c50e82..fc79fe1 100644 --- a/dlls/d3d8/d3d8_private.h +++ b/dlls/d3d8/d3d8_private.h @@ -162,6 +162,9 @@ struct d3d8_device struct wined3d_buffer *vertex_buffer; UINT vertex_buffer_size; UINT vertex_buffer_pos; + struct wined3d_buffer *index_buffer; + UINT index_buffer_size; + UINT index_buffer_pos; /* Avoids recursion with nested ReleaseRef to 0 */ BOOL inDestruction; diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index e1e8e78..7a13344 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -359,6 +359,8 @@ static ULONG WINAPI d3d8_device_Release(IDirect3DDevice8 *iface) if (device->vertex_buffer) wined3d_buffer_decref(device->vertex_buffer); + if (device->index_buffer) + wined3d_buffer_decref(device->index_buffer); wined3d_device_uninit_3d(device->wined3d_device); wined3d_device_release_focus_window(device->wined3d_device); @@ -605,6 +607,12 @@ static HRESULT WINAPI d3d8_device_Reset(IDirect3DDevice8 *iface, device->vertex_buffer = NULL; device->vertex_buffer_size = 0; } + if (device->index_buffer) + { + wined3d_buffer_decref(device->index_buffer); + device->index_buffer = NULL; + device->index_buffer_size = 0; + } wined3d_swapchain_desc_from_present_parameters(&swapchain_desc, present_parameters); if (SUCCEEDED(hr = wined3d_device_reset(device->wined3d_device, &swapchain_desc, @@ -1989,26 +1997,123 @@ done: return hr; } +/* The caller is responsible for wined3d locking */ +static HRESULT d3d8_device_prepare_index_buffer(struct d3d8_device *device, UINT min_size) +{ + HRESULT hr; + + if (device->index_buffer_size < min_size || !device->index_buffer) + { + UINT size = max(device->index_buffer_size * 2, min_size); + struct wined3d_buffer *buffer; + + TRACE("Growing index buffer to %u bytes\n", size); + + hr = wined3d_buffer_create_ib(device->wined3d_device, size, WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY, + WINED3D_POOL_DEFAULT, NULL, &d3d8_null_wined3d_parent_ops, &buffer); + if (FAILED(hr)) + { + ERR("(%p) wined3d_buffer_create_ib failed with hr = %08x\n", device, hr); + return hr; + } + + if (device->index_buffer) + wined3d_buffer_decref(device->index_buffer); + + device->index_buffer = buffer; + device->index_buffer_size = size; + device->index_buffer_pos = 0; + } + return D3D_OK; +} + static HRESULT WINAPI d3d8_device_DrawIndexedPrimitiveUP(IDirect3DDevice8 *iface, - D3DPRIMITIVETYPE primitive_type, UINT min_vertex_idx, UINT index_count, + D3DPRIMITIVETYPE primitive_type, UINT min_vertex_idx, UINT vertex_count, UINT primitive_count, const void *index_data, D3DFORMAT index_format, const void *vertex_data, UINT vertex_stride) { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); HRESULT hr; + BYTE *buffer_data; + + UINT idx_count = vertex_count_from_primitive_count(primitive_type, primitive_count); + UINT idx_fmt_size = index_format == D3DFMT_INDEX16 ? 2 : 4; + UINT idx_size = idx_count * idx_fmt_size; + UINT ib_pos; - TRACE("iface %p, primitive_type %#x, min_vertex_idx %u, index_count %u, primitive_count %u,\n" + UINT vtx_size = vertex_count * vertex_stride; + UINT vb_pos, align; + + TRACE("iface %p, primitive_type %#x, min_vertex_idx %u, vertex_count %u, primitive_count %u,\n" "index_data %p, index_format %#x, vertex_data %p, vertex_stride %u.\n", - iface, primitive_type, min_vertex_idx, index_count, primitive_count, + iface, primitive_type, min_vertex_idx, vertex_count, primitive_count, index_data, index_format, vertex_data, vertex_stride); + if (!primitive_count) + { + WARN("primitive_count is 0, returning D3D_OK\n"); + return D3D_OK; + } + wined3d_mutex_lock(); + + hr = d3d8_device_prepare_vertex_buffer(device, vtx_size); + if (FAILED(hr)) + goto done; + + vb_pos = device->vertex_buffer_pos; + align = vb_pos % vertex_stride; + if (align) align = vertex_stride - align; + if (vb_pos + vtx_size + align > device->vertex_buffer_size) + vb_pos = 0; + else + vb_pos += align; + + hr = wined3d_buffer_map(device->vertex_buffer, vb_pos, vtx_size, &buffer_data, + vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD); + if (FAILED(hr)) + goto done; + memcpy(buffer_data, vertex_data, vtx_size); + wined3d_buffer_unmap(device->vertex_buffer); + device->vertex_buffer_pos = vb_pos + vtx_size; + + hr = d3d8_device_prepare_index_buffer(device, idx_size); + if (FAILED(hr)) + goto done; + + ib_pos = device->index_buffer_pos; + align = ib_pos % idx_fmt_size; + if (align) align = idx_fmt_size - align; + if (ib_pos + idx_size + align > device->index_buffer_size) + ib_pos = 0; + else + ib_pos += align; + + hr = wined3d_buffer_map(device->index_buffer, ib_pos, idx_size, &buffer_data, + ib_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD); + if (FAILED(hr)) + goto done; + memcpy(buffer_data, index_data, idx_size); + wined3d_buffer_unmap(device->index_buffer); + device->index_buffer_pos = ib_pos + idx_size; + + hr = wined3d_device_set_stream_source(device->wined3d_device, 0, device->vertex_buffer, 0, vertex_stride); + if (FAILED(hr)) + goto done; + + wined3d_device_set_index_buffer(device->wined3d_device, device->index_buffer, + wined3dformat_from_d3dformat(index_format)); + wined3d_device_set_base_vertex_index(device->wined3d_device, vb_pos / vertex_stride); + wined3d_device_set_primitive_type(device->wined3d_device, primitive_type); - hr = wined3d_device_draw_indexed_primitive_up(device->wined3d_device, - vertex_count_from_primitive_count(primitive_type, primitive_count), index_data, - wined3dformat_from_d3dformat(index_format), vertex_data, vertex_stride); - wined3d_mutex_unlock(); + hr = wined3d_device_draw_indexed_primitive(device->wined3d_device, ib_pos / idx_fmt_size, idx_count); + wined3d_device_set_stream_source(device->wined3d_device, 0, NULL, 0, 0); + wined3d_device_set_index_buffer(device->wined3d_device, NULL, WINED3DFMT_UNKNOWN); + wined3d_device_set_base_vertex_index(device->wined3d_device, 0); + +done: + wined3d_mutex_unlock(); return hr; }
1
0
0
0
Stefan Dösinger : d3d8: Use a dynamic vertex buffer for DrawPrimitiveUP.
by Alexandre Julliard
19 Dec '12
19 Dec '12
Module: wine Branch: master Commit: 7dd4460bc80351ff2303dfb22ec9ab3e04292099 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=7dd4460bc80351ff2303dfb22…
Author: Stefan Dösinger <stefan(a)codeweavers.com> Date: Tue Dec 18 22:53:12 2012 +0100 d3d8: Use a dynamic vertex buffer for DrawPrimitiveUP. --- dlls/d3d8/d3d8_private.h | 5 +++ dlls/d3d8/device.c | 90 +++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 91 insertions(+), 4 deletions(-) diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h index 9ae6077..4c50e82 100644 --- a/dlls/d3d8/d3d8_private.h +++ b/dlls/d3d8/d3d8_private.h @@ -158,6 +158,11 @@ struct d3d8_device struct FvfToDecl *decls; UINT numConvertedDecls, declArraySize; + /* User data draws */ + struct wined3d_buffer *vertex_buffer; + UINT vertex_buffer_size; + UINT vertex_buffer_pos; + /* Avoids recursion with nested ReleaseRef to 0 */ BOOL inDestruction; BOOL lost; diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index d8d230f..e1e8e78 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -357,6 +357,9 @@ static ULONG WINAPI d3d8_device_Release(IDirect3DDevice8 *iface) } HeapFree(GetProcessHeap(), 0, device->decls); + if (device->vertex_buffer) + wined3d_buffer_decref(device->vertex_buffer); + wined3d_device_uninit_3d(device->wined3d_device); wined3d_device_release_focus_window(device->wined3d_device); wined3d_device_decref(device->wined3d_device); @@ -595,6 +598,14 @@ static HRESULT WINAPI d3d8_device_Reset(IDirect3DDevice8 *iface, TRACE("iface %p, present_parameters %p.\n", iface, present_parameters); wined3d_mutex_lock(); + + if (device->vertex_buffer) + { + wined3d_buffer_decref(device->vertex_buffer); + device->vertex_buffer = NULL; + device->vertex_buffer_size = 0; + } + wined3d_swapchain_desc_from_present_parameters(&swapchain_desc, present_parameters); if (SUCCEEDED(hr = wined3d_device_reset(device->wined3d_device, &swapchain_desc, NULL, reset_enum_callback, TRUE))) @@ -1887,23 +1898,94 @@ static HRESULT WINAPI d3d8_device_DrawIndexedPrimitive(IDirect3DDevice8 *iface, return hr; } +static void STDMETHODCALLTYPE d3d8_null_wined3d_object_destroyed(void *parent) {} + +static const struct wined3d_parent_ops d3d8_null_wined3d_parent_ops = +{ + d3d8_null_wined3d_object_destroyed, +}; + +/* The caller is responsible for wined3d locking */ +static HRESULT d3d8_device_prepare_vertex_buffer(struct d3d8_device *device, UINT min_size) +{ + HRESULT hr; + + if (device->vertex_buffer_size < min_size || !device->vertex_buffer) + { + UINT size = max(device->vertex_buffer_size * 2, min_size); + struct wined3d_buffer *buffer; + + TRACE("Growing vertex buffer to %u bytes\n", size); + + hr = wined3d_buffer_create_vb(device->wined3d_device, size, WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY, + WINED3D_POOL_DEFAULT, NULL, &d3d8_null_wined3d_parent_ops, &buffer); + if (FAILED(hr)) + { + ERR("(%p) wined3d_buffer_create_vb failed with hr = %08x\n", device, hr); + return hr; + } + + if (device->vertex_buffer) + wined3d_buffer_decref(device->vertex_buffer); + + device->vertex_buffer = buffer; + device->vertex_buffer_size = size; + device->vertex_buffer_pos = 0; + } + return D3D_OK; +} + static HRESULT WINAPI d3d8_device_DrawPrimitiveUP(IDirect3DDevice8 *iface, D3DPRIMITIVETYPE primitive_type, UINT primitive_count, const void *data, UINT stride) { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); HRESULT hr; + UINT vtx_count = vertex_count_from_primitive_count(primitive_type, primitive_count); + UINT size = vtx_count * stride; + UINT vb_pos, align; + BYTE *buffer_data; TRACE("iface %p, primitive_type %#x, primitive_count %u, data %p, stride %u.\n", iface, primitive_type, primitive_count, data, stride); + if (!primitive_count) + { + WARN("primitive_count is 0, returning D3D_OK\n"); + return D3D_OK; + } + wined3d_mutex_lock(); + hr = d3d8_device_prepare_vertex_buffer(device, size); + if (FAILED(hr)) + goto done; + + vb_pos = device->vertex_buffer_pos; + align = vb_pos % stride; + if (align) align = stride - align; + if (vb_pos + size + align > device->vertex_buffer_size) + vb_pos = 0; + else + vb_pos += align; + + hr = wined3d_buffer_map(device->vertex_buffer, vb_pos, size, &buffer_data, + vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD); + if (FAILED(hr)) + goto done; + memcpy(buffer_data, data, size); + wined3d_buffer_unmap(device->vertex_buffer); + device->vertex_buffer_pos = vb_pos + size; + + hr = wined3d_device_set_stream_source(device->wined3d_device, 0, device->vertex_buffer, 0, stride); + if (FAILED(hr)) + goto done; + wined3d_device_set_primitive_type(device->wined3d_device, primitive_type); - hr = wined3d_device_draw_primitive_up(device->wined3d_device, - vertex_count_from_primitive_count(primitive_type, primitive_count), - data, stride); - wined3d_mutex_unlock(); + hr = wined3d_device_draw_primitive(device->wined3d_device, vb_pos / stride, vtx_count); + wined3d_device_set_stream_source(device->wined3d_device, 0, NULL, 0, 0); +done: + wined3d_mutex_unlock(); return hr; }
1
0
0
0
Christian Costa : dmloader: COM cleanup of IDirectMusicLoader object.
by Alexandre Julliard
18 Dec '12
18 Dec '12
Module: wine Branch: master Commit: b47facb4af09f86c99c6b506024eed392bafc31c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b47facb4af09f86c99c6b5060…
Author: Christian Costa <titan.costa(a)gmail.com> Date: Tue Dec 18 09:05:39 2012 +0100 dmloader: COM cleanup of IDirectMusicLoader object. --- dlls/dmloader/dmloader_private.h | 14 ++-- dlls/dmloader/loader.c | 182 ++++++++++++++++++++++---------------- 2 files changed, 111 insertions(+), 85 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=b47facb4af09f86c99c6b…
1
0
0
0
Alexandre Julliard : gdi32: Remove from the GetTextExtentExPoint entry points parameters that can' t be handled by the driver.
by Alexandre Julliard
18 Dec '12
18 Dec '12
Module: wine Branch: master Commit: bbf3e8621ab2168032979489300122e54751b2c9 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=bbf3e8621ab21680329794893…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Dec 18 17:52:37 2012 +0100 gdi32: Remove from the GetTextExtentExPoint entry points parameters that can't be handled by the driver. --- dlls/gdi32/driver.c | 6 +--- dlls/gdi32/font.c | 4 +- dlls/gdi32/freetype.c | 62 +++++++++++--------------------------------- dlls/wineps.drv/builtin.c | 26 +++---------------- dlls/wineps.drv/psdrv.h | 3 +- include/wine/gdi_driver.h | 6 ++-- 6 files changed, 28 insertions(+), 79 deletions(-) diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c index f5cadbe..6b68499 100644 --- a/dlls/gdi32/driver.c +++ b/dlls/gdi32/driver.c @@ -423,14 +423,12 @@ static UINT nulldrv_GetTextCharsetInfo( PHYSDEV dev, LPFONTSIGNATURE fs, DWORD f return DEFAULT_CHARSET; } -static BOOL nulldrv_GetTextExtentExPoint( PHYSDEV dev, LPCWSTR str, INT count, INT max_ext, - INT *fit, INT *dx, SIZE *size ) +static BOOL nulldrv_GetTextExtentExPoint( PHYSDEV dev, LPCWSTR str, INT count, INT *dx ) { return FALSE; } -static BOOL nulldrv_GetTextExtentExPointI( PHYSDEV dev, const WORD *indices, INT count, INT max_ext, - INT *fit, INT *dx, SIZE *size ) +static BOOL nulldrv_GetTextExtentExPointI( PHYSDEV dev, const WORD *indices, INT count, INT *dx ) { return FALSE; } diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index 3c609a2..3f79dff 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -320,7 +320,7 @@ static BOOL get_char_positions( DC *dc, const WCHAR *str, INT count, INT *dx, SI dev = GET_DC_PHYSDEV( dc, pGetTextMetrics ); dev->funcs->pGetTextMetrics( dev, &tm ); - if (!dev->funcs->pGetTextExtentExPoint( dev, str, count, 0, NULL, dx, size )) return FALSE; + if (!dev->funcs->pGetTextExtentExPoint( dev, str, count, dx )) return FALSE; if (dc->breakExtra || dc->breakRem) { @@ -357,7 +357,7 @@ static BOOL get_char_positions_indices( DC *dc, const WORD *indices, INT count, dev = GET_DC_PHYSDEV( dc, pGetTextMetrics ); dev->funcs->pGetTextMetrics( dev, &tm ); - if (!dev->funcs->pGetTextExtentExPointI( dev, indices, count, 0, NULL, dx, size )) return FALSE; + if (!dev->funcs->pGetTextExtentExPointI( dev, indices, count, dx )) return FALSE; if (dc->breakExtra || dc->breakRem) { diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index 6c39b97..9b6a909 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -7134,97 +7134,67 @@ static BOOL freetype_GetCharABCWidthsI( PHYSDEV dev, UINT firstChar, UINT count, /************************************************************* * freetype_GetTextExtentExPoint */ -static BOOL freetype_GetTextExtentExPoint( PHYSDEV dev, LPCWSTR wstr, INT count, - INT max_ext, LPINT pnfit, LPINT dxs, LPSIZE size) +static BOOL freetype_GetTextExtentExPoint( PHYSDEV dev, LPCWSTR wstr, INT count, LPINT dxs ) { static const MAT2 identity = { {0,1},{0,0},{0,0},{0,1} }; - INT idx; - INT nfit = 0, ext; + INT idx, pos; ABC abc; GLYPHMETRICS gm; - TEXTMETRICW tm; struct freetype_physdev *physdev = get_freetype_dev( dev ); if (!physdev->font) { dev = GET_NEXT_PHYSDEV( dev, pGetTextExtentExPoint ); - return dev->funcs->pGetTextExtentExPoint( dev, wstr, count, max_ext, pnfit, dxs, size ); + return dev->funcs->pGetTextExtentExPoint( dev, wstr, count, dxs ); } - TRACE("%p, %s, %d, %d, %p\n", physdev->font, debugstr_wn(wstr, count), count, max_ext, size); + TRACE("%p, %s, %d\n", physdev->font, debugstr_wn(wstr, count), count); GDI_CheckNotLock(); EnterCriticalSection( &freetype_cs ); - size->cx = 0; - get_text_metrics( physdev->font, &tm ); - size->cy = tm.tmHeight; - - for(idx = 0; idx < count; idx++) { + for (idx = pos = 0; idx < count; idx++) + { get_glyph_outline( physdev->font, wstr[idx], GGO_METRICS, &gm, &abc, 0, NULL, &identity ); - size->cx += abc.abcA + abc.abcB + abc.abcC; - ext = size->cx; - if (! pnfit || ext <= max_ext) { - ++nfit; - if (dxs) - dxs[idx] = ext; - } + pos += abc.abcA + abc.abcB + abc.abcC; + dxs[idx] = pos; } - if (pnfit) - *pnfit = nfit; - LeaveCriticalSection( &freetype_cs ); - TRACE("return %d, %d, %d\n", size->cx, size->cy, nfit); return TRUE; } /************************************************************* * freetype_GetTextExtentExPointI */ -static BOOL freetype_GetTextExtentExPointI( PHYSDEV dev, const WORD *indices, INT count, - INT max_ext, LPINT pnfit, LPINT dxs, LPSIZE size ) +static BOOL freetype_GetTextExtentExPointI( PHYSDEV dev, const WORD *indices, INT count, LPINT dxs ) { static const MAT2 identity = { {0,1},{0,0},{0,0},{0,1} }; - INT idx; - INT nfit = 0, ext; + INT idx, pos; ABC abc; GLYPHMETRICS gm; - TEXTMETRICW tm; struct freetype_physdev *physdev = get_freetype_dev( dev ); if (!physdev->font) { dev = GET_NEXT_PHYSDEV( dev, pGetTextExtentExPointI ); - return dev->funcs->pGetTextExtentExPointI( dev, indices, count, max_ext, pnfit, dxs, size ); + return dev->funcs->pGetTextExtentExPointI( dev, indices, count, dxs ); } - TRACE("%p, %p, %d, %d, %p\n", physdev->font, indices, count, max_ext, size); + TRACE("%p, %p, %d\n", physdev->font, indices, count); GDI_CheckNotLock(); EnterCriticalSection( &freetype_cs ); - size->cx = 0; - get_text_metrics(physdev->font, &tm); - size->cy = tm.tmHeight; - - for(idx = 0; idx < count; idx++) { + for (idx = pos = 0; idx < count; idx++) + { get_glyph_outline( physdev->font, indices[idx], GGO_METRICS | GGO_GLYPH_INDEX, &gm, &abc, 0, NULL, &identity ); - size->cx += abc.abcA + abc.abcB + abc.abcC; - ext = size->cx; - if (! pnfit || ext <= max_ext) { - ++nfit; - if (dxs) - dxs[idx] = ext; - } + pos += abc.abcA + abc.abcB + abc.abcC; + dxs[idx] = pos; } - if (pnfit) - *pnfit = nfit; - LeaveCriticalSection( &freetype_cs ); - TRACE("return %d, %d, %d\n", size->cx, size->cy, nfit); return TRUE; } diff --git a/dlls/wineps.drv/builtin.c b/dlls/wineps.drv/builtin.c index 873a473..e2106d3 100644 --- a/dlls/wineps.drv/builtin.c +++ b/dlls/wineps.drv/builtin.c @@ -317,43 +317,25 @@ const AFMMETRICS *PSDRV_UVMetrics(LONG UV, const AFM *afm) /*********************************************************************** * PSDRV_GetTextExtentExPoint */ -BOOL PSDRV_GetTextExtentExPoint(PHYSDEV dev, LPCWSTR str, INT count, - INT maxExt, LPINT lpnFit, LPINT alpDx, LPSIZE size) +BOOL PSDRV_GetTextExtentExPoint(PHYSDEV dev, LPCWSTR str, INT count, LPINT alpDx) { PSDRV_PDEVICE *physDev = get_psdrv_dev( dev ); - int nfit = 0; int i; float width = 0.0; - float scale; if (physDev->font.fontloc == Download) { dev = GET_NEXT_PHYSDEV( dev, pGetTextExtentExPoint ); - return dev->funcs->pGetTextExtentExPoint( dev, str, count, maxExt, lpnFit, alpDx, size ); + return dev->funcs->pGetTextExtentExPoint( dev, str, count, alpDx ); } TRACE("%s %i\n", debugstr_wn(str, count), count); - scale = physDev->font.fontinfo.Builtin.scale; - for (i = 0; i < count && str[i] != '\0'; ++i) + for (i = 0; i < count; ++i) { - float scaled_width; width += PSDRV_UVMetrics(str[i], physDev->font.fontinfo.Builtin.afm)->WX; - scaled_width = width * scale; - if (alpDx) - alpDx[i] = scaled_width; - if (scaled_width <= maxExt) - ++nfit; + alpDx[i] = width * physDev->font.fontinfo.Builtin.scale; } - - size->cx = width * physDev->font.fontinfo.Builtin.scale; - size->cy = physDev->font.fontinfo.Builtin.tm.tmHeight; - - if (lpnFit) - *lpnFit = nfit; - - TRACE("cx=%i cy=%i\n", size->cx, size->cy); - return TRUE; } diff --git a/dlls/wineps.drv/psdrv.h b/dlls/wineps.drv/psdrv.h index bfc2ad6..428f7ba 100644 --- a/dlls/wineps.drv/psdrv.h +++ b/dlls/wineps.drv/psdrv.h @@ -425,8 +425,7 @@ extern BOOL PSDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *lprect, LPCWSTR str, UINT count, const INT *lpDx ) DECLSPEC_HIDDEN; extern BOOL PSDRV_FillPath( PHYSDEV dev ) DECLSPEC_HIDDEN; extern BOOL PSDRV_GetCharWidth(PHYSDEV dev, UINT firstChar, UINT lastChar, LPINT buffer) DECLSPEC_HIDDEN; -extern BOOL PSDRV_GetTextExtentExPoint(PHYSDEV dev, LPCWSTR str, INT count, - INT maxExt, LPINT lpnFit, LPINT alpDx, LPSIZE size) DECLSPEC_HIDDEN; +extern BOOL PSDRV_GetTextExtentExPoint(PHYSDEV dev, LPCWSTR str, INT count, LPINT alpDx) DECLSPEC_HIDDEN; extern BOOL PSDRV_GetTextMetrics(PHYSDEV dev, TEXTMETRICW *metrics) DECLSPEC_HIDDEN; extern BOOL PSDRV_LineTo(PHYSDEV dev, INT x, INT y) DECLSPEC_HIDDEN; extern BOOL PSDRV_PaintRgn( PHYSDEV dev, HRGN hrgn ) DECLSPEC_HIDDEN; diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index f6be211d..fffbad0 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -116,8 +116,8 @@ struct gdi_dc_funcs COLORREF (*pGetPixel)(PHYSDEV,INT,INT); UINT (*pGetSystemPaletteEntries)(PHYSDEV,UINT,UINT,LPPALETTEENTRY); UINT (*pGetTextCharsetInfo)(PHYSDEV,LPFONTSIGNATURE,DWORD); - BOOL (*pGetTextExtentExPoint)(PHYSDEV,LPCWSTR,INT,INT,LPINT,LPINT,LPSIZE); - BOOL (*pGetTextExtentExPointI)(PHYSDEV,const WORD*,INT,INT,LPINT,LPINT,LPSIZE); + BOOL (*pGetTextExtentExPoint)(PHYSDEV,LPCWSTR,INT,LPINT); + BOOL (*pGetTextExtentExPointI)(PHYSDEV,const WORD*,INT,LPINT); INT (*pGetTextFace)(PHYSDEV,INT,LPWSTR); BOOL (*pGetTextMetrics)(PHYSDEV,TEXTMETRICW*); BOOL (*pGradientFill)(PHYSDEV,TRIVERTEX*,ULONG,void*,ULONG,ULONG); @@ -197,7 +197,7 @@ struct gdi_dc_funcs }; /* increment this when you change the DC function table */ -#define WINE_GDI_DRIVER_VERSION 45 +#define WINE_GDI_DRIVER_VERSION 46 #define GDI_PRIORITY_NULL_DRV 0 /* null driver */ #define GDI_PRIORITY_FONT_DRV 100 /* any font driver */
1
0
0
0
Alexandre Julliard : gdi32: Add helper functions for GetTextExtentExPoint and fix handling of text justification .
by Alexandre Julliard
18 Dec '12
18 Dec '12
Module: wine Branch: master Commit: 1c2f23cf2f139fc55e6776033f4eed46f0e44d26 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=1c2f23cf2f139fc55e6776033…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Dec 18 17:41:42 2012 +0100 gdi32: Add helper functions for GetTextExtentExPoint and fix handling of text justification. --- dlls/gdi32/font.c | 237 +++++++++++++++++++++++------------------ dlls/gdi32/tests/font.c | 73 ++++++++++++- dlls/gdiplus/tests/graphics.c | 2 +- 3 files changed, 202 insertions(+), 110 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=1c2f23cf2f139fc55e677…
1
0
0
0
Jörg Höhle : winealsa: Separate read and write pointers.
by Alexandre Julliard
18 Dec '12
18 Dec '12
Module: wine Branch: master Commit: 17f098869fec3f051e6c85d8716fb22cb7bc18e6 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=17f098869fec3f051e6c85d87…
Author: Jörg Höhle <hoehle(a)users.sourceforge.net> Date: Thu Mar 8 22:47:37 2012 +0100 winealsa: Separate read and write pointers. --- dlls/winealsa.drv/mmdevdrv.c | 53 ++++++++++++++++++++++++++--------------- 1 files changed, 33 insertions(+), 20 deletions(-) diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c index e903b9e..3e8ad8d 100644 --- a/dlls/winealsa.drv/mmdevdrv.c +++ b/dlls/winealsa.drv/mmdevdrv.c @@ -118,6 +118,7 @@ struct ACImpl { UINT32 bufsize_frames, held_frames, tmp_buffer_frames, mmdev_period_frames; snd_pcm_uframes_t remapping_buf_frames; UINT32 lcl_offs_frames; /* offs into local_buffer where valid data starts */ + UINT32 wri_offs_frames; /* where to write fresh data in local_buffer */ UINT32 hidden_frames; /* ALSA reserve to ensure continuous rendering */ HANDLE timer; @@ -1960,13 +1961,28 @@ static snd_pcm_sframes_t alsa_write_best_effort(snd_pcm_t *handle, BYTE *buf, return written; } +/* The callback and mmdevapi API functions execute concurrently. + * Shared state & life time after Start: + * This constant until _Release + *->pcm_handle likewise + *->fmt likewise + *->alsa_format, hidden_frames likewise + *->local_buffer, bufsize_frames, alsa_bufsize_frames likewise + *->event Read Only, even constant until _Release(!) + *->started Read Only from cb POV, constant if _Stop kills the cb + * + *->held_frames is the only R/W object. + *->lcl_offs_frames/wri_offs_frames are written by one side exclusively: + * lcl_offs_frames by CaptureClient & write callback + * wri_offs_frames by read callback & RenderClient + */ static void alsa_write_data(ACImpl *This) { snd_pcm_sframes_t written, in_alsa; snd_pcm_uframes_t to_write, avail, write_limit, max_period; int err; BYTE *buf = - This->local_buffer + (This->lcl_offs_frames * This->fmt->nBlockAlign); + This->local_buffer + This->lcl_offs_frames * This->fmt->nBlockAlign; /* this call seems to be required to get an accurate snd_pcm_state() */ avail = snd_pcm_avail_update(This->pcm_handle); @@ -2064,14 +2080,16 @@ static void alsa_write_data(ACImpl *This) static void alsa_read_data(ACImpl *This) { - snd_pcm_sframes_t pos, readable, nread; + snd_pcm_sframes_t nread; + UINT32 pos = This->wri_offs_frames, limit = This->held_frames; - pos = (This->held_frames + This->lcl_offs_frames) % This->bufsize_frames; - readable = This->bufsize_frames - pos; + /* FIXME: Detect overrun and signal DATA_DISCONTINUITY + * How to count overrun frames and report them as position increase? */ + limit = This->bufsize_frames - max(limit, pos); nread = snd_pcm_readi(This->pcm_handle, - This->local_buffer + pos * This->fmt->nBlockAlign, readable); - TRACE("read %ld from %u limit %lu\n", nread, This->held_frames + This->lcl_offs_frames, readable); + This->local_buffer + pos * This->fmt->nBlockAlign, limit); + TRACE("read %ld from %u limit %u\n", nread, pos, limit); if(nread < 0){ int ret; @@ -2087,7 +2105,7 @@ static void alsa_read_data(ACImpl *This) } nread = snd_pcm_readi(This->pcm_handle, - This->local_buffer + pos * This->fmt->nBlockAlign, readable); + This->local_buffer + pos * This->fmt->nBlockAlign, limit); if(nread < 0){ WARN("read failed: %ld (%s)\n", nread, snd_strerror(nread)); return; @@ -2103,14 +2121,9 @@ static void alsa_read_data(ACImpl *This) snd_strerror(err)); } + This->wri_offs_frames += nread; + This->wri_offs_frames %= This->bufsize_frames; This->held_frames += nread; - - if(This->held_frames > This->bufsize_frames){ - WARN("Overflow of unread data\n"); - This->lcl_offs_frames += This->held_frames; - This->lcl_offs_frames %= This->bufsize_frames; - This->held_frames = This->bufsize_frames; - } } static void CALLBACK alsa_push_buffer_data(void *user, BOOLEAN timer) @@ -2256,6 +2269,7 @@ static HRESULT WINAPI AudioClient_Reset(IAudioClient *iface) } This->held_frames = 0; This->lcl_offs_frames = 0; + This->wri_offs_frames = 0; LeaveCriticalSection(&This->lock); @@ -2463,8 +2477,7 @@ static HRESULT WINAPI AudioRenderClient_GetBuffer(IAudioRenderClient *iface, return AUDCLNT_E_BUFFER_TOO_LARGE; } - write_pos = - (This->lcl_offs_frames + This->held_frames) % This->bufsize_frames; + write_pos = This->wri_offs_frames; if(write_pos + frames > This->bufsize_frames){ if(This->tmp_buffer_frames < frames){ HeapFree(GetProcessHeap(), 0, This->tmp_buffer); @@ -2490,8 +2503,7 @@ static HRESULT WINAPI AudioRenderClient_GetBuffer(IAudioRenderClient *iface, static void alsa_wrap_buffer(ACImpl *This, BYTE *buffer, UINT32 written_frames) { - snd_pcm_uframes_t write_offs_frames = - (This->lcl_offs_frames + This->held_frames) % This->bufsize_frames; + snd_pcm_uframes_t write_offs_frames = This->wri_offs_frames; UINT32 write_offs_bytes = write_offs_frames * This->fmt->nBlockAlign; snd_pcm_uframes_t chunk_frames = This->bufsize_frames - write_offs_frames; UINT32 chunk_bytes = chunk_frames * This->fmt->nBlockAlign; @@ -2533,8 +2545,7 @@ static HRESULT WINAPI AudioRenderClient_ReleaseBuffer( } if(This->getbuf_last >= 0) - buffer = This->local_buffer + This->fmt->nBlockAlign * - ((This->lcl_offs_frames + This->held_frames) % This->bufsize_frames); + buffer = This->local_buffer + This->wri_offs_frames * This->fmt->nBlockAlign; else buffer = This->tmp_buffer; @@ -2548,6 +2559,8 @@ static HRESULT WINAPI AudioRenderClient_ReleaseBuffer( if(This->getbuf_last < 0) alsa_wrap_buffer(This, buffer, written_frames); + This->wri_offs_frames += written_frames; + This->wri_offs_frames %= This->bufsize_frames; This->held_frames += written_frames; This->written_frames += written_frames; This->getbuf_last = 0;
1
0
0
0
Jörg Höhle : mmdevapi: SetEventHandle is allowed only once.
by Alexandre Julliard
18 Dec '12
18 Dec '12
Module: wine Branch: master Commit: b18c5e811f6569c8acb373b529e931dd7505281e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b18c5e811f6569c8acb373b52…
Author: Jörg Höhle <hoehle(a)users.sourceforge.net> Date: Sun Dec 9 21:39:16 2012 +0100 mmdevapi: SetEventHandle is allowed only once. --- dlls/mmdevapi/tests/render.c | 2 +- dlls/winealsa.drv/mmdevdrv.c | 6 ++++++ dlls/winecoreaudio.drv/mmdevdrv.c | 6 ++++++ dlls/wineoss.drv/mmdevdrv.c | 6 ++++++ 4 files changed, 19 insertions(+), 1 deletions(-) diff --git a/dlls/mmdevapi/tests/render.c b/dlls/mmdevapi/tests/render.c index 9d9478a..e753299 100644 --- a/dlls/mmdevapi/tests/render.c +++ b/dlls/mmdevapi/tests/render.c @@ -634,7 +634,7 @@ static void test_event(void) ok(hr == S_OK, "SetEventHandle failed: %08x\n", hr); hr = IAudioClient_SetEventHandle(ac, event); - todo_wine ok(hr == HRESULT_FROM_WIN32(ERROR_INVALID_NAME), "SetEventHandle returns %08x\n", hr); + ok(hr == HRESULT_FROM_WIN32(ERROR_INVALID_NAME), "SetEventHandle returns %08x\n", hr); r = WaitForSingleObject(event, 40); ok(r == WAIT_TIMEOUT, "Wait(event) before Start gave %x\n", r); diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c index 416f1ba..e903b9e 100644 --- a/dlls/winealsa.drv/mmdevdrv.c +++ b/dlls/winealsa.drv/mmdevdrv.c @@ -2284,6 +2284,12 @@ static HRESULT WINAPI AudioClient_SetEventHandle(IAudioClient *iface, return AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED; } + if (This->event){ + LeaveCriticalSection(&This->lock); + FIXME("called twice\n"); + return HRESULT_FROM_WIN32(ERROR_INVALID_NAME); + } + This->event = event; LeaveCriticalSection(&This->lock); diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c index 8ee0dec..ee965e7 100644 --- a/dlls/winecoreaudio.drv/mmdevdrv.c +++ b/dlls/winecoreaudio.drv/mmdevdrv.c @@ -1816,6 +1816,12 @@ static HRESULT WINAPI AudioClient_SetEventHandle(IAudioClient *iface, return AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED; } + if (This->event){ + OSSpinLockUnlock(&This->lock); + FIXME("called twice\n"); + return HRESULT_FROM_WIN32(ERROR_INVALID_NAME); + } + This->event = event; OSSpinLockUnlock(&This->lock); diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c index 9fc6f02..4de5ae6 100644 --- a/dlls/wineoss.drv/mmdevdrv.c +++ b/dlls/wineoss.drv/mmdevdrv.c @@ -1620,6 +1620,12 @@ static HRESULT WINAPI AudioClient_SetEventHandle(IAudioClient *iface, return AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED; } + if (This->event){ + LeaveCriticalSection(&This->lock); + FIXME("called twice\n"); + return HRESULT_FROM_WIN32(ERROR_INVALID_NAME); + } + This->event = event; LeaveCriticalSection(&This->lock);
1
0
0
0
Jacek Caban : atl100: Added AtlWinModuleInit tests.
by Alexandre Julliard
18 Dec '12
18 Dec '12
Module: wine Branch: master Commit: c38d5ce73c7cb4d89346bcef3793669d5594e4b3 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c38d5ce73c7cb4d89346bcef3…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Dec 18 11:48:47 2012 +0100 atl100: Added AtlWinModuleInit tests. --- configure | 1 + configure.ac | 1 + dlls/atl100/tests/Makefile.in | 8 +++++ dlls/atl100/tests/atl.c | 63 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 73 insertions(+), 0 deletions(-) diff --git a/configure b/configure index 7b3b31d..e19bf2b 100755 --- a/configure +++ b/configure @@ -15356,6 +15356,7 @@ wine_fn_config_dll appwiz.cpl enable_appwiz_cpl po wine_fn_config_dll atl enable_atl implib wine_fn_config_test dlls/atl/tests atl_test wine_fn_config_dll atl100 enable_atl100 implib +wine_fn_config_test dlls/atl100/tests atl100_test wine_fn_config_dll atl80 enable_atl80 wine_fn_config_dll authz enable_authz wine_fn_config_dll avicap32 enable_avicap32 implib diff --git a/configure.ac b/configure.ac index 3a07cbf..0036376 100644 --- a/configure.ac +++ b/configure.ac @@ -2535,6 +2535,7 @@ WINE_CONFIG_DLL(appwiz.cpl,,[po]) WINE_CONFIG_DLL(atl,,[implib]) WINE_CONFIG_TEST(dlls/atl/tests) WINE_CONFIG_DLL(atl100,,[implib]) +WINE_CONFIG_TEST(dlls/atl100/tests) WINE_CONFIG_DLL(atl80) WINE_CONFIG_DLL(authz) WINE_CONFIG_DLL(avicap32,,[implib]) diff --git a/dlls/atl100/tests/Makefile.in b/dlls/atl100/tests/Makefile.in new file mode 100644 index 0000000..4230bad --- /dev/null +++ b/dlls/atl100/tests/Makefile.in @@ -0,0 +1,8 @@ +TESTDLL = atl100.dll +IMPORTS = ole32 atl100 +EXTRADEFS = -D_ATL_VER=_ATL_VER_100 + +C_SRCS = \ + atl.c + +@MAKE_TEST_RULES@ diff --git a/dlls/atl100/tests/atl.c b/dlls/atl100/tests/atl.c new file mode 100644 index 0000000..43d9bd5 --- /dev/null +++ b/dlls/atl100/tests/atl.c @@ -0,0 +1,63 @@ +/* + * Copyright 2012 Jacek Caban for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <stdarg.h> +#include <stdio.h> + +#define COBJMACROS + +#include <atlbase.h> + +#include <wine/test.h> + +static void test_winmodule(void) +{ + _ATL_WIN_MODULE winmod; + HRESULT hres; + + winmod.cbSize = 0xdeadbeef; + hres = AtlWinModuleInit(&winmod); + ok(hres == E_INVALIDARG, "AtlWinModuleInit failed: %08x\n", hres); + + winmod.cbSize = sizeof(winmod); + winmod.m_pCreateWndList = (void*)0xdeadbeef; + winmod.m_csWindowCreate.LockCount = 0xdeadbeef; + winmod.m_rgWindowClassAtoms.m_aT = (void*)0xdeadbeef; + winmod.m_rgWindowClassAtoms.m_nSize = 0xdeadbeef; + winmod.m_rgWindowClassAtoms.m_nAllocSize = 0xdeadbeef; + hres = AtlWinModuleInit(&winmod); + ok(hres == S_OK, "AtlWinModuleInit failed: %08x\n", hres); + ok(!winmod.m_pCreateWndList, "winmod.m_pCreateWndList = %p\n", winmod.m_pCreateWndList); + ok(winmod.m_csWindowCreate.LockCount == -1, "winmod.m_csWindowCreate.LockCount = %d\n", + winmod.m_csWindowCreate.LockCount); + ok(winmod.m_rgWindowClassAtoms.m_aT == (void*)0xdeadbeef, "winmod.m_rgWindowClassAtoms.m_aT = %p\n", + winmod.m_rgWindowClassAtoms.m_aT); + ok(winmod.m_rgWindowClassAtoms.m_nSize == 0xdeadbeef, "winmod.m_rgWindowClassAtoms.m_nSize = %d\n", + winmod.m_rgWindowClassAtoms.m_nSize); + ok(winmod.m_rgWindowClassAtoms.m_nAllocSize == 0xdeadbeef, "winmod.m_rgWindowClassAtoms.m_nAllocSize = %d\n", + winmod.m_rgWindowClassAtoms.m_nAllocSize); +} + +START_TEST(atl) +{ + CoInitialize(NULL); + + test_winmodule(); + + CoUninitialize(); +}
1
0
0
0
← Newer
1
...
14
15
16
17
18
19
20
...
55
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Results per page:
10
25
50
100
200