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
October 2021
----- 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
1165 discussions
Start a n
N
ew thread
Zebediah Figura : winegstreamer: Implement IWMProfile::GetStream().
by Alexandre Julliard
27 Oct '21
27 Oct '21
Module: wine Branch: master Commit: 40ced5e054d1f16ce47161079c960ac839910cb7 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=40ced5e054d1f16ce4716107…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Tue Oct 26 22:22:05 2021 -0500 winegstreamer: Implement IWMProfile::GetStream(). Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winegstreamer/gst_private.h | 7 ++ dlls/winegstreamer/wm_reader.c | 192 ++++++++++++++++++++++++++++++++++++++- dlls/wmvcore/tests/wmvcore.c | 41 ++++----- 3 files changed, 216 insertions(+), 24 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=40ced5e054d1f16ce471…
1
0
0
0
Zebediah Figura : winegstreamer: Implement IWMSyncReader::GetOutputCount().
by Alexandre Julliard
27 Oct '21
27 Oct '21
Module: wine Branch: master Commit: 8bd3c8bf5a9ea4765f791f1f78f60bcf7060eba6 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=8bd3c8bf5a9ea4765f791f1f…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Tue Oct 26 22:22:04 2021 -0500 winegstreamer: Implement IWMSyncReader::GetOutputCount(). Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winegstreamer/wm_syncreader.c | 13 +++++++++---- dlls/wmvcore/tests/wmvcore.c | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/dlls/winegstreamer/wm_syncreader.c b/dlls/winegstreamer/wm_syncreader.c index bb98a60ad48..32b668f68c6 100644 --- a/dlls/winegstreamer/wm_syncreader.c +++ b/dlls/winegstreamer/wm_syncreader.c @@ -85,11 +85,16 @@ static HRESULT WINAPI WMSyncReader_GetNextSample(IWMSyncReader2 *iface, WORD str return E_NOTIMPL; } -static HRESULT WINAPI WMSyncReader_GetOutputCount(IWMSyncReader2 *iface, DWORD *outputs) +static HRESULT WINAPI WMSyncReader_GetOutputCount(IWMSyncReader2 *iface, DWORD *count) { - struct sync_reader *This = impl_from_IWMSyncReader2(iface); - FIXME("(%p)->(%p): stub!\n", This, outputs); - return E_NOTIMPL; + struct sync_reader *reader = impl_from_IWMSyncReader2(iface); + + TRACE("reader %p, count %p.\n", reader, count); + + EnterCriticalSection(&reader->reader.cs); + *count = reader->reader.stream_count; + LeaveCriticalSection(&reader->reader.cs); + return S_OK; } static HRESULT WINAPI WMSyncReader_GetOutputFormat(IWMSyncReader2 *iface, DWORD output_num, DWORD format_num, diff --git a/dlls/wmvcore/tests/wmvcore.c b/dlls/wmvcore/tests/wmvcore.c index ad58f53d552..5576018b1d6 100644 --- a/dlls/wmvcore/tests/wmvcore.c +++ b/dlls/wmvcore/tests/wmvcore.c @@ -463,8 +463,8 @@ static void test_sync_reader_streaming(void) count = 0xdeadbeef; hr = IWMSyncReader_GetOutputCount(reader, &count); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); - todo_wine ok(count == 2, "Got count %u.\n", count); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(count == 2, "Got count %u.\n", count); for (i = 0; i < 2; ++i) {
1
0
0
0
Zebediah Figura : ntdll: Merge critsection.c into sync.c.
by Alexandre Julliard
27 Oct '21
27 Oct '21
Module: wine Branch: master Commit: f4672a6f0f07b4fdc47dab6b93d1fa997c21b2fe URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f4672a6f0f07b4fdc47dab6b…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Tue Oct 26 21:41:52 2021 -0500 ntdll: Merge critsection.c into sync.c. Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/Makefile.in | 1 - dlls/ntdll/critsection.c | 543 ----------------------------------------------- dlls/ntdll/sync.c | 335 ++++++++++++++++++++++++++++- 3 files changed, 334 insertions(+), 545 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=f4672a6f0f07b4fdc47d…
1
0
0
0
Nikolay Sivov : d3d10/effect: Implement SetRawValue().
by Alexandre Julliard
27 Oct '21
27 Oct '21
Module: wine Branch: master Commit: 000767f92de2acf3a3a818da1fcdbaddea4f6c33 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=000767f92de2acf3a3a818da…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Tue Oct 26 23:25:16 2021 +0200 d3d10/effect: Implement SetRawValue(). Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d10/effect.c | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index 9f652680747..22a09f45e14 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -4514,9 +4514,36 @@ static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_varia static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_SetRawValue(ID3D10EffectVariable *iface, void *data, UINT offset, UINT count) { - FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count); + struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable(iface); + BOOL is_buffer; - return E_NOTIMPL; + TRACE("iface %p, data %p, offset %u, count %u.\n", iface, data, offset, count); + + if (!iface->lpVtbl->IsValid(iface)) + { + WARN("Invalid variable.\n"); + return E_FAIL; + } + + is_buffer = v->type->basetype == D3D10_SVT_CBUFFER || v->type->basetype == D3D10_SVT_TBUFFER; + + if (v->type->type_class == D3D10_SVC_OBJECT && !is_buffer) + { + WARN("Not supported on object variables of type %s.\n", + debug_d3d10_shader_variable_type(v->type->basetype)); + return D3DERR_INVALIDCALL; + } + + if (!is_buffer) + { + offset += v->buffer_offset; + v = v->buffer; + } + + memcpy(v->u.buffer.local_buffer + offset, data, count); + v->u.buffer.changed = TRUE; + + return S_OK; } static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_GetRawValue(ID3D10EffectVariable *iface, @@ -4524,7 +4551,6 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_GetRawValue(ID3D10EffectV { struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable(iface); BOOL is_buffer; - BYTE *src; TRACE("iface %p, data %p, offset %u, count %u.\n", iface, data, offset, count); @@ -4543,8 +4569,13 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_GetRawValue(ID3D10EffectV return D3DERR_INVALIDCALL; } - src = is_buffer ? v->u.buffer.local_buffer : v->buffer->u.buffer.local_buffer + v->buffer_offset; - memcpy(data, src + offset, count); + if (!is_buffer) + { + offset += v->buffer_offset; + v = v->buffer; + } + + memcpy(data, v->u.buffer.local_buffer + offset, count); return S_OK; }
1
0
0
0
Nikolay Sivov : d3d10/effect: Implement GetRawValue().
by Alexandre Julliard
27 Oct '21
27 Oct '21
Module: wine Branch: master Commit: 3f598171bedfb4203ca54344f5a2498d4922f650 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3f598171bedfb4203ca54344…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Tue Oct 26 23:25:15 2021 +0200 d3d10/effect: Implement GetRawValue(). Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d10/effect.c | 26 +++++++++++- dlls/d3d10/tests/effect.c | 104 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 128 insertions(+), 2 deletions(-) diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index b4a2f448ad0..9f652680747 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -4522,9 +4522,31 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_SetRawValue(ID3D10EffectV static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_GetRawValue(ID3D10EffectVariable *iface, void *data, UINT offset, UINT count) { - FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count); + struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable(iface); + BOOL is_buffer; + BYTE *src; - return E_NOTIMPL; + TRACE("iface %p, data %p, offset %u, count %u.\n", iface, data, offset, count); + + if (!iface->lpVtbl->IsValid(iface)) + { + WARN("Invalid variable.\n"); + return E_FAIL; + } + + is_buffer = v->type->basetype == D3D10_SVT_CBUFFER || v->type->basetype == D3D10_SVT_TBUFFER; + + if (v->type->type_class == D3D10_SVC_OBJECT && !is_buffer) + { + WARN("Not supported on object variables of type %s.\n", + debug_d3d10_shader_variable_type(v->type->basetype)); + return D3DERR_INVALIDCALL; + } + + src = is_buffer ? v->u.buffer.local_buffer : v->buffer->u.buffer.local_buffer + v->buffer_offset; + memcpy(data, src + offset, count); + + return S_OK; } static const struct ID3D10EffectVariableVtbl d3d10_effect_variable_vtbl = diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index ae4db49f283..a8a64a6ed0d 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -7535,6 +7535,109 @@ static void test_effect_default_variable_value(void) ok(!refcount, "Device has %u references left.\n", refcount); } +static void test_effect_raw_value(void) +{ + ID3D10EffectConstantBuffer *cb; + ID3D10EffectVariable *v; + ID3D10Effect *effect; + ID3D10Device *device; + unsigned int i; + ULONG refcount; + int i_v[10]; + HRESULT hr; + float f; + + if (!(device = create_device())) + { + skip("Failed to create device, skipping tests.\n"); + return; + } + + hr = create_effect(fx_test_default_variable_value, 0, device, NULL, &effect); + ok(SUCCEEDED(hr), "Failed to create an effect, hr %#x.\n", hr); + + /* Read 1 float at a time, from float4 vector. */ + v = effect->lpVtbl->GetVariableByName(effect, "f4"); + for (i = 0; i < 4; ++i) + { + hr = v->lpVtbl->GetRawValue(v, &f, sizeof(f) * i, sizeof(f)); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(f == i + 1.0f, "Unexpected value %f.\n", f); + } + /* Offset outside of variable storage, returns adjacent memory contents. */ + hr = v->lpVtbl->GetRawValue(v, &f, 16, sizeof(f)); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(f == 1.0f, "Unexpected value %f.\n", f); + hr = v->lpVtbl->GetRawValue(v, &f, 20, sizeof(f)); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(f == 2.0f, "Unexpected value %f.\n", f); + + /* Array */ + v = effect->lpVtbl->GetVariableByName(effect, "i2"); + ok(v->lpVtbl->IsValid(v), "Expected valid variable.\n"); + hr = v->lpVtbl->GetRawValue(v, i_v, 0, 8 * sizeof(float)); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(i_v[0] == 9, "Unexpected value %d.\n", i_v[0]); + ok(i_v[1] == 0, "Unexpected value %d.\n", i_v[1]); + ok(i_v[2] == 0, "Unexpected value %d.\n", i_v[2]); + ok(i_v[3] == 0, "Unexpected value %d.\n", i_v[3]); + ok(i_v[4] == 12, "Unexpected value %d.\n", i_v[4]); + + hr = v->lpVtbl->GetRawValue(v, &f, 20, sizeof(f)); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(f == 0.2f, "Unexpected value %f.\n", f); + + /* Matrix */ + v = effect->lpVtbl->GetVariableByName(effect, "m1"); + hr = v->lpVtbl->GetRawValue(v, i_v, 0, sizeof(i_v)); + ok(i_v[0] == 1, "Unexpected value %d.\n", i_v[0]); + ok(i_v[1] == 4, "Unexpected value %d.\n", i_v[1]); + ok(i_v[2] == 0, "Unexpected value %d.\n", i_v[2]); + ok(i_v[3] == 0, "Unexpected value %d.\n", i_v[3]); + ok(i_v[4] == 2, "Unexpected value %d.\n", i_v[4]); + ok(i_v[5] == 5, "Unexpected value %d.\n", i_v[5]); + ok(i_v[6] == 0, "Unexpected value %d.\n", i_v[6]); + ok(i_v[7] == 0, "Unexpected value %d.\n", i_v[7]); + ok(i_v[8] == 3, "Unexpected value %d.\n", i_v[8]); + ok(i_v[9] == 6, "Unexpected value %d.\n", i_v[9]); + + v = effect->lpVtbl->GetVariableByName(effect, "m2"); + hr = v->lpVtbl->GetRawValue(v, i_v, 0, 7 * sizeof(i_v[0])); + ok(i_v[0] == 1, "Unexpected value %d.\n", i_v[0]); + ok(i_v[1] == 2, "Unexpected value %d.\n", i_v[1]); + ok(i_v[2] == 3, "Unexpected value %d.\n", i_v[2]); + ok(i_v[3] == 0, "Unexpected value %d.\n", i_v[3]); + ok(i_v[4] == 4, "Unexpected value %d.\n", i_v[4]); + ok(i_v[5] == 5, "Unexpected value %d.\n", i_v[5]); + ok(i_v[6] == 6, "Unexpected value %d.\n", i_v[6]); + + /* Read from constant buffer directly. */ + cb = effect->lpVtbl->GetConstantBufferByIndex(effect, 0); + + for (i = 0; i < 4; ++i) + { + hr = cb->lpVtbl->GetRawValue(cb, &f, sizeof(f) * i, sizeof(f)); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(f == i + 1.0f, "Unexpected value %f.\n", f); + } + hr = cb->lpVtbl->GetRawValue(cb, &f, 16, sizeof(f)); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(f == 1.0f, "Unexpected value %f.\n", f); + hr = cb->lpVtbl->GetRawValue(cb, &f, 20, sizeof(f)); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(f == 2.0f, "Unexpected value %f.\n", f); + + /* Invalid variable */ + v = effect->lpVtbl->GetVariableByName(effect, "invalid"); + hr = v->lpVtbl->GetRawValue(v, &f, 0, sizeof(f)); + ok(hr == E_FAIL, "Unexpected hr %#x.\n", hr); + + effect->lpVtbl->Release(effect); + + refcount = ID3D10Device_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +} + START_TEST(effect) { test_effect_constant_buffer_type(); @@ -7557,4 +7660,5 @@ START_TEST(effect) test_effect_shader_object(); test_effect_pool(); test_effect_default_variable_value(); + test_effect_raw_value(); }
1
0
0
0
Nikolay Sivov : d3d10/effect: Implement default values handling.
by Alexandre Julliard
27 Oct '21
27 Oct '21
Module: wine Branch: master Commit: 6839d8cba3a8cb94297c6819a069d2014dca54b3 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=6839d8cba3a8cb94297c6819…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Tue Oct 26 23:25:14 2021 +0200 d3d10/effect: Implement default values handling. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d10/effect.c | 76 +++++++++++++++++++++++++++++++++++++++++++++-- dlls/d3d10/tests/effect.c | 30 ++----------------- 2 files changed, 76 insertions(+), 30 deletions(-) diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index e3ca46772dc..b4a2f448ad0 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -2076,6 +2076,65 @@ static HRESULT parse_fx10_technique(const char *data, size_t data_size, return S_OK; } +static void parse_fx10_set_default_numeric_value(const char **ptr, struct d3d10_effect_variable *v) +{ + float *dst = (float *)(v->buffer->u.buffer.local_buffer + v->buffer_offset), *src; + BOOL col_major = v->type->type_class == D3D10_SVC_MATRIX_COLUMNS; + unsigned int col_count = v->type->column_count, col; + unsigned int row_count = v->type->row_count, row; + + src = (float *)*ptr; + + if (col_major) + { + for (col = 0; col < col_count; ++col) + { + for (row = 0; row < row_count; ++row) + dst[row] = src[row * col_count + col]; + dst += 4; + } + } + else + { + for (row = 0; row < row_count; ++row) + { + memcpy(dst, src, col_count * sizeof(float)); + src += col_count; + dst += 4; + } + } + + *ptr += col_count * row_count * sizeof(float); +} + +static void parse_fx10_default_value(const char **ptr, struct d3d10_effect_variable *var) +{ + unsigned int element_count = max(var->type->element_count, 1), i, m; + struct d3d10_effect_variable *v; + + for (i = 0; i < element_count; ++i) + { + v = d3d10_array_get_element(var, i); + + switch (v->type->type_class) + { + case D3D10_SVC_STRUCT: + for (m = 0; m < v->type->member_count; ++m) + parse_fx10_default_value(ptr, &v->members[m]); + break; + case D3D10_SVC_SCALAR: + case D3D10_SVC_VECTOR: + case D3D10_SVC_MATRIX_COLUMNS: + case D3D10_SVC_MATRIX_ROWS: + parse_fx10_set_default_numeric_value(ptr, v); + break; + default: + FIXME("Unexpected initial value for type %#x.\n", v->type->basetype); + return; + } + } +} + static void d3d10_effect_variable_update_buffer_offsets(struct d3d10_effect_variable *v, unsigned int offset) { @@ -2093,8 +2152,8 @@ static void d3d10_effect_variable_update_buffer_offsets(struct d3d10_effect_vari static HRESULT parse_fx10_numeric_variable(const char *data, size_t data_size, const char **ptr, BOOL local, struct d3d10_effect_variable *v) { - DWORD offset, flags, default_value_offset; - uint32_t buffer_offset; + uint32_t offset, flags, default_value_offset, buffer_offset; + const char *data_ptr; HRESULT hr; if (FAILED(hr = parse_fx10_variable_head(data, data_size, ptr, v))) @@ -2114,6 +2173,7 @@ static HRESULT parse_fx10_numeric_variable(const char *data, size_t data_size, TRACE("Variable offset in buffer: %#x.\n", buffer_offset); read_dword(ptr, &default_value_offset); + TRACE("Variable default value offset: %#x.\n", default_value_offset); read_dword(ptr, &flags); TRACE("Variable flags: %#x.\n", flags); @@ -2127,7 +2187,17 @@ static HRESULT parse_fx10_numeric_variable(const char *data, size_t data_size, if (local) { if (default_value_offset) - FIXME("Set default variable value.\n"); + { + if (!require_space(default_value_offset, 1, v->type->size_packed, data_size)) + { + WARN("Invalid default value offset %#x, variable packed size %u.\n", default_value_offset, + v->type->size_packed); + return E_FAIL; + } + + data_ptr = data + default_value_offset; + parse_fx10_default_value(&data_ptr, v); + } read_dword(ptr, &v->annotations.count); TRACE("Variable has %u annotations.\n", v->annotations.count); diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index 4d853c64baa..ae4db49f283 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -7404,7 +7404,6 @@ static void test_effect_default_variable_value(void) vector = v->lpVtbl->AsVector(v); hr = vector->lpVtbl->GetFloatVector(vector, float_v); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); -todo_wine ok(float_v[0] == 1.0f && float_v[1] == 2.0f && float_v[2] == 3.0f && float_v[3] == 4.0f, "Unexpected vector {%.8e,%.8e,%.8e,%.8e}\n", float_v[0], float_v[1], float_v[2], float_v[3]); @@ -7414,7 +7413,6 @@ todo_wine vector = v->lpVtbl->AsVector(v); hr = vector->lpVtbl->GetFloatVector(vector, float_v); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); -todo_wine ok(float_v[0] == 1.0f && float_v[1] == 2.0f && float_v[2] == 5.0f && float_v[3] == 5.0f, "Unexpected vector {%.8e,%.8e,%.8e,%.8e}\n", float_v[0], float_v[1], float_v[2], float_v[3]); @@ -7424,7 +7422,6 @@ todo_wine vector = v->lpVtbl->AsVector(v); hr = vector->lpVtbl->GetFloatVector(vector, float_v); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); -todo_wine ok(float_v[0] == 1.0f && float_v[1] == 5.0f && float_v[2] == 5.0f && float_v[3] == 5.0f, "Unexpected vector {%.8e,%.8e,%.8e,%.8e}\n", float_v[0], float_v[1], float_v[2], float_v[3]); @@ -7433,7 +7430,6 @@ todo_wine scalar = v->lpVtbl->AsScalar(v); hr = scalar->lpVtbl->GetInt(scalar, &int_s); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); -todo_wine ok(int_s == 10, "Unexpected value %d.\n", int_s); memset(int_v, 0, sizeof(int_v)); @@ -7441,7 +7437,6 @@ todo_wine scalar = v->lpVtbl->AsScalar(v); hr = scalar->lpVtbl->GetIntArray(scalar, int_v, 0, 2); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); -todo_wine ok(int_v[0] == 9 && int_v[1] == 12, "Unexpected vector {%d,%d}\n", int_v[0], int_v[1]); hr = v->lpVtbl->GetDesc(v, &var_desc); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); @@ -7460,7 +7455,6 @@ todo_wine scalar = v->lpVtbl->AsScalar(v); hr = scalar->lpVtbl->GetFloat(scalar, &float_s); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); -todo_wine ok(float_s == 0.2f, "Unexpected value %.8e.\n", float_s); /* Matrix */ @@ -7472,10 +7466,7 @@ todo_wine ok(hr == S_OK, "Unexpected hr %#x.\n", hr); set_test_matrix(&m_set, D3D10_SVT_INT, 2, 3, 1); -todo_wine -{ compare_matrix("m1", __LINE__, &m_set, &m_ret, 2, 3, FALSE); -} v = effect->lpVtbl->GetVariableByName(effect, "m2"); matrix = v->lpVtbl->AsMatrix(v); @@ -7485,10 +7476,8 @@ todo_wine ok(hr == S_OK, "Unexpected hr %#x.\n", hr); set_test_matrix(&m_set, D3D10_SVT_INT, 2, 3, 1); -todo_wine -{ compare_matrix("m2", __LINE__, &m_set, &m_ret, 2, 3, FALSE); -} + v = effect->lpVtbl->GetVariableByName(effect, "m3"); matrix = v->lpVtbl->AsMatrix(v); ok(matrix->lpVtbl->IsValid(matrix), "Expected valid matrix.\n"); @@ -7503,16 +7492,7 @@ todo_wine *(unsigned int *)&m_set.m[1][0] = 0; *(unsigned int *)&m_set.m[1][1] = 1; *(unsigned int *)&m_set.m[1][2] = 0; - -todo_wine - ok(m_ret.m[0][0] == m_set.m[0][0], "Unexpected value.\n"); - ok(m_ret.m[0][1] == m_set.m[0][1], "Unexpected value.\n"); -todo_wine - ok(m_ret.m[0][2] == m_set.m[0][2], "Unexpected value.\n"); - ok(m_ret.m[1][0] == m_set.m[1][0], "Unexpected value.\n"); -todo_wine - ok(m_ret.m[1][1] == m_set.m[1][1], "Unexpected value.\n"); - ok(m_ret.m[1][2] == m_set.m[1][2], "Unexpected value.\n"); + compare_matrix("m3", __LINE__, &m_set, &m_ret, 2, 3, FALSE); v = effect->lpVtbl->GetVariableByName(effect, "m4"); matrix = v->lpVtbl->AsMatrix(v); @@ -7522,10 +7502,8 @@ todo_wine ok(hr == S_OK, "Unexpected hr %#x.\n", hr); set_test_matrix(&m_set, D3D10_SVT_FLOAT, 2, 2, 1); -todo_wine -{ compare_matrix("m4", __LINE__, &m_set, &m_ret, 2, 2, FALSE); -} + /* Struct */ v = effect->lpVtbl->GetVariableByName(effect, "s1"); ok(v->lpVtbl->IsValid(v), "Expected valid variable.\n"); @@ -7535,7 +7513,6 @@ todo_wine scalar = m->lpVtbl->AsScalar(m); hr = scalar->lpVtbl->GetBool(scalar, &ret); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); -todo_wine ok(ret == 1, "Unexpected value.\n"); m = v->lpVtbl->GetMemberByName(v, "f2"); @@ -7543,7 +7520,6 @@ todo_wine scalar = m->lpVtbl->AsScalar(m); hr = scalar->lpVtbl->GetFloat(scalar, &float_s); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); -todo_wine ok(float_s == -0.2f, "Unexpected value %f.\n", float_s); m = v->lpVtbl->GetMemberByName(v, "b2");
1
0
0
0
Nikolay Sivov : d3d10/tests: Extend default values test.
by Alexandre Julliard
27 Oct '21
27 Oct '21
Module: wine Branch: master Commit: 3a975ebcd77fa2487f14f4adc1d16572f4e0e151 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3a975ebcd77fa2487f14f4ad…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Tue Oct 26 23:25:13 2021 +0200 d3d10/tests: Extend default values test. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d10/tests/effect.c | 142 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 132 insertions(+), 10 deletions(-) diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index ab3cdc71d9c..4d853c64baa 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -7321,12 +7321,25 @@ float1 f1 = {1}; int i = 10; int i2[2] = {9,12}; float f = 0.2f; + +struct test +{ + bool b1; + float f2; + bool b2; +}; +test s1 = { true, -0.2f, false }; + +matrix <uint, 2, 3> m1 = { 1, 2, 3, 4, 5, 6 }; +row_major matrix <uint, 2, 3> m2 = { 1, 2, 3, 4, 5, 6 }; +row_major matrix <bool, 2, 3> m3 = { true, false, true, false, true, false }; +float2x2 m4 = { 1.0f, 2.0f, 3.0f, 4.0f }; #endif static DWORD fx_test_default_variable_value[] = { - 0x43425844, 0xe57b41f2, 0x98392802, 0xed3d94b4, 0xc4074c4f, 0x00000001, 0x00000248, 0x00000001, - 0x00000024, 0x30315846, 0x0000021c, 0xfeff1001, 0x00000001, 0x00000006, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000110, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x43425844, 0x3673286d, 0xd7bb3432, 0xb571508a, 0x5d70cc01, 0x00000001, 0x00000448, 0x00000001, + 0x00000024, 0x30315846, 0x0000041c, 0xfeff1001, 0x00000001, 0x0000000b, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000284, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x6f6c4724, 0x736c6162, 0x6f6c6600, 0x00347461, 0x0000000d, 0x00000001, 0x00000000, 0x00000010, 0x00000010, 0x00000010, 0x0000210a, 0x00003466, 0x003f8000, 0x00400000, 0x00404000, 0x66408000, 0x74616f6c, @@ -7336,12 +7349,28 @@ static DWORD fx_test_default_variable_value[] = 0x04000000, 0x10000000, 0x04000000, 0x11000000, 0x69000009, 0x00000a00, 0x00009b00, 0x00000100, 0x00000200, 0x00001400, 0x00001000, 0x00000800, 0x00091100, 0x00326900, 0x00000009, 0x0000000c, 0x616f6c66, 0x00e80074, 0x00010000, 0x00000000, 0x00040000, 0x00100000, 0x00040000, 0x09090000, - 0x00660000, 0x3e4ccccd, 0x00000004, 0x00000040, 0x00000000, 0x00000006, 0xffffffff, 0x00000000, - 0x00000030, 0x00000014, 0x00000000, 0x00000000, 0x00000033, 0x00000000, 0x00000000, 0x00000066, - 0x0000004a, 0x00000000, 0x00000010, 0x00000069, 0x00000000, 0x00000000, 0x00000094, 0x00000078, - 0x00000000, 0x00000018, 0x00000097, 0x00000000, 0x00000000, 0x000000bb, 0x0000009f, 0x00000000, - 0x0000001c, 0x000000bd, 0x00000000, 0x00000000, 0x000000dd, 0x000000c1, 0x00000000, 0x00000020, - 0x000000e0, 0x00000000, 0x00000000, 0x0000010a, 0x000000ee, 0x00000000, 0x00000034, 0x0000010c, + 0x00660000, 0x3e4ccccd, 0x74736574, 0x00316200, 0x6c6f6f62, 0x00011800, 0x00000100, 0x00000000, + 0x00000400, 0x00001000, 0x00000400, 0x00092100, 0x00326200, 0x00000110, 0x00000003, 0x00000000, + 0x0000000c, 0x00000010, 0x0000000c, 0x00000003, 0x00000115, 0x00000000, 0x00000000, 0x0000011d, + 0x00000066, 0x00000000, 0x00000004, 0x000000ee, 0x00000139, 0x00000000, 0x00000008, 0x0000011d, + 0x01003173, 0xcd000000, 0x00be4ccc, 0x75000000, 0x32746e69, 0x97003378, 0x01000001, 0x00000000, + 0x28000000, 0x30000000, 0x18000000, 0x1b000000, 0x6d00005a, 0x00010031, 0x00020000, 0x00030000, + 0x00040000, 0x00050000, 0x00060000, 0x01970000, 0x00010000, 0x00000000, 0x001c0000, 0x00200000, + 0x00180000, 0x1a1b0000, 0x326d0000, 0x00000100, 0x00000200, 0x00000300, 0x00000400, 0x00000500, + 0x00000600, 0x6f6f6200, 0x3378326c, 0x00020d00, 0x00000100, 0x00000000, 0x00001c00, 0x00002000, + 0x00001800, 0x001a2300, 0x00336d00, 0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000001, + 0x00000000, 0x616f6c66, 0x32783274, 0x00024c00, 0x00000100, 0x00000000, 0x00001800, 0x00002000, + 0x00001000, 0x00520b00, 0x00346d00, 0x3f800000, 0x40000000, 0x40400000, 0x40800000, 0x00000004, + 0x000000e0, 0x00000000, 0x0000000b, 0xffffffff, 0x00000000, 0x00000030, 0x00000014, 0x00000000, + 0x00000000, 0x00000033, 0x00000000, 0x00000000, 0x00000066, 0x0000004a, 0x00000000, 0x00000010, + 0x00000069, 0x00000000, 0x00000000, 0x00000094, 0x00000078, 0x00000000, 0x00000018, 0x00000097, + 0x00000000, 0x00000000, 0x000000bb, 0x0000009f, 0x00000000, 0x0000001c, 0x000000bd, 0x00000000, + 0x00000000, 0x000000dd, 0x000000c1, 0x00000000, 0x00000020, 0x000000e0, 0x00000000, 0x00000000, + 0x0000010a, 0x000000ee, 0x00000000, 0x00000034, 0x0000010c, 0x00000000, 0x00000000, 0x00000188, + 0x0000013c, 0x00000000, 0x00000040, 0x0000018b, 0x00000000, 0x00000000, 0x000001bb, 0x0000019f, + 0x00000000, 0x00000050, 0x000001be, 0x00000000, 0x00000000, 0x000001f2, 0x000001d6, 0x00000000, + 0x00000080, 0x000001f5, 0x00000000, 0x00000000, 0x00000231, 0x00000215, 0x00000000, 0x000000a0, + 0x00000234, 0x00000000, 0x00000000, 0x00000271, 0x00000255, 0x00000000, 0x000000c0, 0x00000274, 0x00000000, 0x00000000, }; @@ -7350,13 +7379,16 @@ static void test_effect_default_variable_value(void) D3D10_EFFECT_VARIABLE_DESC var_desc; ID3D10EffectVectorVariable *vector; ID3D10EffectScalarVariable *scalar; - ID3D10EffectVariable *v, *v2; + ID3D10EffectMatrixVariable *matrix; + struct d3d10_matrix m_set, m_ret; + ID3D10EffectVariable *v, *v2, *m; float float_v[4], float_s; ID3D10Effect *effect; ID3D10Device *device; int int_v[2], int_s; ULONG refcount; HRESULT hr; + BOOL ret; if (!(device = create_device())) { @@ -7431,6 +7463,96 @@ todo_wine todo_wine ok(float_s == 0.2f, "Unexpected value %.8e.\n", float_s); + /* Matrix */ + v = effect->lpVtbl->GetVariableByName(effect, "m1"); + matrix = v->lpVtbl->AsMatrix(v); + ok(matrix->lpVtbl->IsValid(matrix), "Expected valid matrix.\n"); + memset(&m_ret, 0, sizeof(m_ret)); + hr = matrix->lpVtbl->GetMatrix(matrix, &m_ret.m[0][0]); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + set_test_matrix(&m_set, D3D10_SVT_INT, 2, 3, 1); +todo_wine +{ + compare_matrix("m1", __LINE__, &m_set, &m_ret, 2, 3, FALSE); +} + + v = effect->lpVtbl->GetVariableByName(effect, "m2"); + matrix = v->lpVtbl->AsMatrix(v); + ok(matrix->lpVtbl->IsValid(matrix), "Expected valid matrix.\n"); + memset(&m_ret, 0, sizeof(m_ret)); + hr = matrix->lpVtbl->GetMatrix(matrix, &m_ret.m[0][0]); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + set_test_matrix(&m_set, D3D10_SVT_INT, 2, 3, 1); +todo_wine +{ + compare_matrix("m2", __LINE__, &m_set, &m_ret, 2, 3, FALSE); +} + v = effect->lpVtbl->GetVariableByName(effect, "m3"); + matrix = v->lpVtbl->AsMatrix(v); + ok(matrix->lpVtbl->IsValid(matrix), "Expected valid matrix.\n"); + memset(&m_ret, 0, sizeof(m_ret)); + hr = matrix->lpVtbl->GetMatrix(matrix, &m_ret.m[0][0]); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + memset(&m_set, 0, sizeof(m_set)); + *(unsigned int *)&m_set.m[0][0] = 1; + *(unsigned int *)&m_set.m[0][1] = 0; + *(unsigned int *)&m_set.m[0][2] = 1; + *(unsigned int *)&m_set.m[1][0] = 0; + *(unsigned int *)&m_set.m[1][1] = 1; + *(unsigned int *)&m_set.m[1][2] = 0; + +todo_wine + ok(m_ret.m[0][0] == m_set.m[0][0], "Unexpected value.\n"); + ok(m_ret.m[0][1] == m_set.m[0][1], "Unexpected value.\n"); +todo_wine + ok(m_ret.m[0][2] == m_set.m[0][2], "Unexpected value.\n"); + ok(m_ret.m[1][0] == m_set.m[1][0], "Unexpected value.\n"); +todo_wine + ok(m_ret.m[1][1] == m_set.m[1][1], "Unexpected value.\n"); + ok(m_ret.m[1][2] == m_set.m[1][2], "Unexpected value.\n"); + + v = effect->lpVtbl->GetVariableByName(effect, "m4"); + matrix = v->lpVtbl->AsMatrix(v); + ok(matrix->lpVtbl->IsValid(matrix), "Expected valid matrix.\n"); + memset(&m_ret, 0, sizeof(m_ret)); + hr = matrix->lpVtbl->GetMatrix(matrix, &m_ret.m[0][0]); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + set_test_matrix(&m_set, D3D10_SVT_FLOAT, 2, 2, 1); +todo_wine +{ + compare_matrix("m4", __LINE__, &m_set, &m_ret, 2, 2, FALSE); +} + /* Struct */ + v = effect->lpVtbl->GetVariableByName(effect, "s1"); + ok(v->lpVtbl->IsValid(v), "Expected valid variable.\n"); + + m = v->lpVtbl->GetMemberByName(v, "b1"); + ok(m->lpVtbl->IsValid(m), "Expected valid variable.\n"); + scalar = m->lpVtbl->AsScalar(m); + hr = scalar->lpVtbl->GetBool(scalar, &ret); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); +todo_wine + ok(ret == 1, "Unexpected value.\n"); + + m = v->lpVtbl->GetMemberByName(v, "f2"); + ok(m->lpVtbl->IsValid(m), "Expected valid variable.\n"); + scalar = m->lpVtbl->AsScalar(m); + hr = scalar->lpVtbl->GetFloat(scalar, &float_s); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); +todo_wine + ok(float_s == -0.2f, "Unexpected value %f.\n", float_s); + + m = v->lpVtbl->GetMemberByName(v, "b2"); + ok(m->lpVtbl->IsValid(m), "Expected valid variable.\n"); + scalar = m->lpVtbl->AsScalar(m); + hr = scalar->lpVtbl->GetBool(scalar, &ret); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(!ret, "Unexpected value.\n"); + effect->lpVtbl->Release(effect); refcount = ID3D10Device_Release(device);
1
0
0
0
Nikolay Sivov : d3d10/effect: Remove interface vs implementation pointer comparsion in buffer variable's IsValid().
by Alexandre Julliard
27 Oct '21
27 Oct '21
Module: wine Branch: master Commit: cfd93716efd74fcddf4391307a9e66af2eb01345 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=cfd93716efd74fcddf439130…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Tue Oct 26 23:25:12 2021 +0200 d3d10/effect: Remove interface vs implementation pointer comparsion in buffer variable's IsValid(). Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d10/effect.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index de2be971c9f..e3ca46772dc 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -4495,9 +4495,11 @@ static inline struct d3d10_effect_variable *impl_from_ID3D10EffectConstantBuffer static BOOL STDMETHODCALLTYPE d3d10_effect_constant_buffer_IsValid(ID3D10EffectConstantBuffer *iface) { - TRACE("iface %p\n", iface); + struct d3d10_effect_variable *v = impl_from_ID3D10EffectConstantBuffer(iface); + + TRACE("iface %p.\n", iface); - return (struct d3d10_effect_variable *)iface != &null_local_buffer; + return v != &null_local_buffer; } static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetType(ID3D10EffectConstantBuffer *iface)
1
0
0
0
Nikolay Sivov : d3d10/effect: Implement GetConstantBuffer().
by Alexandre Julliard
27 Oct '21
27 Oct '21
Module: wine Branch: master Commit: 48759a68bbf8fdc4737bccd3631af04ec5fe41e5 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=48759a68bbf8fdc4737bccd3…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Tue Oct 26 23:25:11 2021 +0200 d3d10/effect: Implement GetConstantBuffer(). Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d10/effect.c | 40 ++++++++++++++++++++++++++++++++++++++-- dlls/d3d10/tests/effect.c | 36 ++++++++++++++++++++++++++++-------- 2 files changed, 66 insertions(+), 10 deletions(-) diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index dcfb09211bb..de2be971c9f 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -4488,6 +4488,11 @@ static const struct ID3D10EffectVariableVtbl d3d10_effect_variable_vtbl = }; /* ID3D10EffectVariable methods */ +static inline struct d3d10_effect_variable *impl_from_ID3D10EffectConstantBuffer(ID3D10EffectConstantBuffer *iface) +{ + return CONTAINING_RECORD(iface, struct d3d10_effect_variable, ID3D10EffectVariable_iface); +} + static BOOL STDMETHODCALLTYPE d3d10_effect_constant_buffer_IsValid(ID3D10EffectConstantBuffer *iface) { TRACE("iface %p\n", iface); @@ -4649,9 +4654,26 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetConstantBuffer( static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetConstantBuffer(ID3D10EffectConstantBuffer *iface, ID3D10Buffer **buffer) { - FIXME("iface %p, buffer %p stub!\n", iface, buffer); + struct d3d10_effect_variable *v = impl_from_ID3D10EffectConstantBuffer(iface); - return E_NOTIMPL; + TRACE("iface %p, buffer %p.\n", iface, buffer); + + if (!iface->lpVtbl->IsValid(iface)) + { + WARN("Null variable specified.\n"); + return E_FAIL; + } + + if (v->type->basetype != D3D10_SVT_CBUFFER) + { + WARN("Wrong variable type %s.\n", debug_d3d10_shader_variable_type(v->type->basetype)); + return D3DERR_INVALIDCALL; + } + + *buffer = v->u.buffer.buffer; + ID3D10Buffer_AddRef(*buffer); + + return S_OK; } static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetTextureBuffer(ID3D10EffectConstantBuffer *iface, @@ -4665,8 +4687,22 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetTextureBuffer(I static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetTextureBuffer(ID3D10EffectConstantBuffer *iface, ID3D10ShaderResourceView **view) { + struct d3d10_effect_variable *v = impl_from_ID3D10EffectConstantBuffer(iface); + FIXME("iface %p, view %p stub!\n", iface, view); + if (!iface->lpVtbl->IsValid(iface)) + { + WARN("Null variable specified.\n"); + return E_FAIL; + } + + if (v->type->basetype != D3D10_SVT_TBUFFER) + { + WARN("Wrong variable type %s.\n", debug_d3d10_shader_variable_type(v->type->basetype)); + return D3DERR_INVALIDCALL; + } + return E_NOTIMPL; } diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index 2844386ef51..ab3cdc71d9c 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -101,9 +101,12 @@ static void test_effect_constant_buffer_type(void) ID3D10EffectType *type, *type2, *null_type; D3D10_EFFECT_VARIABLE_DESC var_desc; D3D10_EFFECT_TYPE_DESC type_desc; + D3D10_BUFFER_DESC buffer_desc; + ID3D10ShaderResourceView *srv; ID3D10EffectVariable *v; D3D10_EFFECT_DESC desc; ID3D10Device *device; + ID3D10Buffer *buffer; ULONG refcount; HRESULT hr; LPCSTR string; @@ -155,6 +158,20 @@ static void test_effect_constant_buffer_type(void) ok(type_desc.UnpackedSize == 0x10, "UnpackedSize is %#x, expected 0x10\n", type_desc.UnpackedSize); ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride); + hr = constantbuffer->lpVtbl->GetConstantBuffer(constantbuffer, &buffer); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ID3D10Buffer_GetDesc(buffer, &buffer_desc); + ok(buffer_desc.ByteWidth == type_desc.UnpackedSize, "Unexpected buffer size %u.\n", buffer_desc.ByteWidth); + ok(!buffer_desc.Usage, "Unexpected buffer usage %u.\n", buffer_desc.Usage); + ok(buffer_desc.BindFlags == D3D10_BIND_CONSTANT_BUFFER, "Unexpected bind flags %#x.\n", + buffer_desc.BindFlags); + ok(!buffer_desc.CPUAccessFlags, "Unexpected CPU access flags %#x.\n", buffer_desc.CPUAccessFlags); + ok(!buffer_desc.MiscFlags, "Unexpected misc flags %#x.\n", buffer_desc.MiscFlags); + ID3D10Buffer_Release(buffer); + + hr = constantbuffer->lpVtbl->GetTextureBuffer(constantbuffer, &srv); + ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x.\n", hr); + string = type->lpVtbl->GetMemberName(type, 0); ok(strcmp(string, "f1") == 0, "GetMemberName is \"%s\", expected \"f1\"\n", string); @@ -244,6 +261,13 @@ static void test_effect_constant_buffer_type(void) ok(var_desc.BufferOffset == 0x20, "Unexpected buffer offset %#x.\n", var_desc.BufferOffset); ok(var_desc.ExplicitBindPoint == 0x20, "Unexpected bind point %#x.\n", var_desc.ExplicitBindPoint); + /* Invalid buffer variable */ + constantbuffer = effect->lpVtbl->GetConstantBufferByIndex(effect, 100); + hr = constantbuffer->lpVtbl->GetConstantBuffer(constantbuffer, &buffer); + ok(hr == E_FAIL, "Unexpected hr %#x.\n", hr); + hr = constantbuffer->lpVtbl->GetTextureBuffer(constantbuffer, &srv); + ok(hr == E_FAIL, "Unexpected hr %#x.\n", hr); + effect->lpVtbl->Release(effect); refcount = ID3D10Device_Release(device); @@ -7160,15 +7184,11 @@ todo_wine { ok(cb->lpVtbl->IsValid(cb), "Expected valid constant buffer.\n"); hr = cb->lpVtbl->GetConstantBuffer(cb, &buffer); -todo_wine ok(hr == S_OK, "Unexpected hr %#x.\n", hr); - if (SUCCEEDED(hr)) - { - ID3D10Buffer_GetDevice(buffer, &device3); - ok(device3 == device2, "Unexpected device.\n"); - ID3D10Device_Release(device3); - ID3D10Buffer_Release(buffer); - } + ID3D10Buffer_GetDevice(buffer, &device3); + ok(device3 == device2, "Unexpected device.\n"); + ID3D10Device_Release(device3); + ID3D10Buffer_Release(buffer); child_effect->lpVtbl->Release(child_effect); pool2->lpVtbl->Release(pool2);
1
0
0
0
Matteo Bruni : d3d10/effect: Create variable buffer before parsing buffer members.
by Alexandre Julliard
27 Oct '21
27 Oct '21
Module: wine Branch: master Commit: 5b9407db48fff03d3b407e9a548037b077e0720c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5b9407db48fff03d3b407e9a…
Author: Matteo Bruni <mbruni(a)codeweavers.com> Date: Tue Oct 26 23:25:10 2021 +0200 d3d10/effect: Create variable buffer before parsing buffer members. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d10/effect.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index dd8efedad45..dcfb09211bb 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -2346,7 +2346,7 @@ static HRESULT parse_fx10_object_variable(const char *data, size_t data_size, return S_OK; } -static HRESULT create_variable_buffer(struct d3d10_effect_variable *v) +static HRESULT create_buffer_object(struct d3d10_effect_variable *v) { D3D10_BUFFER_DESC buffer_desc; D3D10_SUBRESOURCE_DATA subresource_data; @@ -2354,12 +2354,6 @@ static HRESULT create_variable_buffer(struct d3d10_effect_variable *v) ID3D10Device *device = v->effect->device; HRESULT hr; - if (!(v->u.buffer.local_buffer = heap_alloc_zero(v->data_size))) - { - ERR("Failed to allocate local constant buffer memory.\n"); - return E_OUTOFMEMORY; - } - buffer_desc.ByteWidth = v->data_size; buffer_desc.Usage = D3D10_USAGE_DEFAULT; buffer_desc.CPUAccessFlags = 0; @@ -2490,6 +2484,12 @@ static HRESULT parse_fx10_buffer(const char *data, size_t data_size, const char return E_OUTOFMEMORY; } + if (local && !(l->u.buffer.local_buffer = heap_alloc_zero(l->data_size))) + { + ERR("Failed to allocate local constant buffer memory.\n"); + return E_OUTOFMEMORY; + } + for (i = 0; i < l->type->member_count; ++i) { struct d3d10_effect_variable *v = &l->members[i]; @@ -2581,8 +2581,11 @@ static HRESULT parse_fx10_buffer(const char *data, size_t data_size, const char if (local && l->data_size) { - if (FAILED(hr = create_variable_buffer(l))) + if (FAILED(hr = create_buffer_object(l))) + { + WARN("Failed to create a buffer object, hr %#x.\n", hr); return hr; + } } if (l->explicit_bind_point != ~0u)
1
0
0
0
← Newer
1
...
11
12
13
14
15
16
17
...
117
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
Results per page:
10
25
50
100
200