Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- 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
November 2021
- 83 participants
- 2620 messages
[v2 PATCH 3/7] d3d10/effect: Handle NULL blend state assignments.
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/d3d10/effect.c | 4 +
dlls/d3d10/tests/effect.c | 154 ++++++++++++++++++++------------------
2 files changed, 85 insertions(+), 73 deletions(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c
index 0a6256d7ebd..901f800b623 100644
--- a/dlls/d3d10/effect.c
+++ b/dlls/d3d10/effect.c
@@ -1699,6 +1699,10 @@ static BOOL read_value_list(const char *data, size_t data_size, DWORD offset,
*(void **)out_data = &null_depth_stencil_variable;
break;
+ case D3D10_SVT_BLEND:
+ *(void **)out_data = &null_blend_variable;
+ break;
+
default:
FIXME("Unhandled out_type %#x.\n", out_type);
return FALSE;
diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c
index 87b591e3af8..a7a712edfb4 100644
--- a/dlls/d3d10/tests/effect.c
+++ b/dlls/d3d10/tests/effect.c
@@ -4219,14 +4219,15 @@ technique10 tech0
pass pass2
{
SetDepthStencilState(NULL, 0);
+ SetBlendState(NULL, float4(0.0f, 0.0f, 0.0f, 0.0f), 0xffff);
}
};
#endif
static DWORD fx_test_state_groups[] =
{
- 0x43425844, 0xefc189be, 0xdf31b02d, 0x77de2d1a, 0x7b97922c, 0x00000001, 0x00001218, 0x00000001,
- 0x00000024, 0x30315846, 0x000011ec, 0xfeff1001, 0x00000000, 0x00000000, 0x00000029, 0x00000000,
- 0x00000000, 0x00000000, 0x00000001, 0x00000940, 0x00000000, 0x00000024, 0x00000001, 0x00000001,
+ 0x43425844, 0x0c720f33, 0x6549d569, 0x9e62af53, 0xa210a455, 0x00000001, 0x00001284, 0x00000001,
+ 0x00000024, 0x30315846, 0x00001258, 0xfeff1001, 0x00000000, 0x00000000, 0x00000029, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000001, 0x0000097c, 0x00000000, 0x00000024, 0x00000001, 0x00000001,
0x00000001, 0x00000014, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x74736152,
0x7a697265, 0x74537265, 0x00657461, 0x00000004, 0x00000002, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000004, 0x74736172, 0x6174735f, 0x01006574, 0x02000000, 0x02000000, 0x01000000,
@@ -4301,74 +4302,78 @@ static DWORD fx_test_state_groups[] =
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x07260000, 0x00000000, 0x61700000, 0x00327373,
- 0x00000001, 0x00000002, 0x00000000, 0x00000001, 0x00000002, 0x00000000, 0x00000030, 0x00000014,
- 0x00000000, 0xffffffff, 0x0000000a, 0x0000000c, 0x00000000, 0x00000001, 0x0000003b, 0x0000000d,
- 0x00000000, 0x00000001, 0x00000047, 0x0000000e, 0x00000000, 0x00000001, 0x00000053, 0x0000000f,
- 0x00000000, 0x00000001, 0x0000005f, 0x00000010, 0x00000000, 0x00000001, 0x0000006b, 0x00000011,
- 0x00000000, 0x00000001, 0x00000077, 0x00000012, 0x00000000, 0x00000001, 0x00000083, 0x00000013,
- 0x00000000, 0x00000001, 0x0000008f, 0x00000014, 0x00000000, 0x00000001, 0x0000009b, 0x00000015,
- 0x00000000, 0x00000001, 0x000000a7, 0x00000000, 0x000000e1, 0x000000c5, 0x00000000, 0xffffffff,
- 0x0000000e, 0x00000016, 0x00000000, 0x00000001, 0x000000ea, 0x00000017, 0x00000000, 0x00000001,
- 0x000000f6, 0x00000018, 0x00000000, 0x00000001, 0x00000102, 0x00000019, 0x00000000, 0x00000001,
- 0x0000010e, 0x0000001a, 0x00000000, 0x00000001, 0x0000011a, 0x0000001b, 0x00000000, 0x00000001,
- 0x00000126, 0x0000001c, 0x00000000, 0x00000001, 0x00000132, 0x0000001d, 0x00000000, 0x00000001,
- 0x0000013e, 0x0000001e, 0x00000000, 0x00000001, 0x0000014a, 0x0000001f, 0x00000000, 0x00000001,
- 0x00000156, 0x00000020, 0x00000000, 0x00000001, 0x00000162, 0x00000021, 0x00000000, 0x00000001,
- 0x0000016e, 0x00000022, 0x00000000, 0x00000001, 0x0000017a, 0x00000023, 0x00000000, 0x00000001,
- 0x00000186, 0x00000000, 0x000001b9, 0x0000019d, 0x00000000, 0xffffffff, 0x0000000b, 0x00000024,
- 0x00000000, 0x00000001, 0x000001c5, 0x00000025, 0x00000000, 0x00000001, 0x000001d1, 0x00000025,
- 0x00000007, 0x00000001, 0x000001dd, 0x00000026, 0x00000000, 0x00000001, 0x000001e9, 0x00000027,
- 0x00000000, 0x00000001, 0x000001f5, 0x00000028, 0x00000000, 0x00000001, 0x00000201, 0x00000029,
- 0x00000000, 0x00000001, 0x0000020d, 0x0000002a, 0x00000000, 0x00000001, 0x00000219, 0x0000002b,
- 0x00000000, 0x00000001, 0x00000225, 0x0000002c, 0x00000000, 0x00000001, 0x00000231, 0x0000002c,
- 0x00000007, 0x00000001, 0x0000023d, 0x00000000, 0x00000272, 0x00000256, 0x00000000, 0xffffffff,
- 0x0000000b, 0x0000002d, 0x00000000, 0x00000001, 0x0000027b, 0x0000002e, 0x00000000, 0x00000001,
- 0x00000287, 0x0000002f, 0x00000000, 0x00000001, 0x00000293, 0x00000030, 0x00000000, 0x00000001,
- 0x0000029f, 0x00000031, 0x00000000, 0x00000001, 0x000002ab, 0x00000032, 0x00000000, 0x00000001,
- 0x000002b7, 0x00000033, 0x00000000, 0x00000001, 0x000002c3, 0x00000034, 0x00000000, 0x00000001,
- 0x000002cf, 0x00000035, 0x00000000, 0x00000001, 0x000002f3, 0x00000036, 0x00000000, 0x00000001,
- 0x000002ff, 0x00000037, 0x00000000, 0x00000001, 0x0000030b, 0x00000000, 0x0000033b, 0x0000031f,
- 0x00000000, 0xffffffff, 0x00000000, 0x00000364, 0x00000348, 0x00000000, 0xffffffff, 0x00000000,
- 0x00000392, 0x00000376, 0x00000000, 0xffffffff, 0x00000000, 0x000003bc, 0x000003a0, 0x00000000,
- 0xffffffff, 0x00000000, 0x000003ea, 0x000003ce, 0x00000000, 0xffffffff, 0x00000000, 0x00000416,
- 0x000003fa, 0x00000000, 0xffffffff, 0x00000000, 0x00000449, 0x0000042d, 0x00000000, 0xffffffff,
- 0x00000000, 0x00000476, 0x0000045a, 0x00000000, 0xffffffff, 0x00000000, 0x000004a1, 0x00000485,
- 0x00000000, 0xffffffff, 0x00000000, 0x000004a4, 0x00000256, 0x00000000, 0xffffffff, 0x00000001,
- 0x00000037, 0x00000000, 0x00000002, 0x0000033b, 0x00000000, 0x000004ad, 0x00000256, 0x00000000,
- 0xffffffff, 0x00000001, 0x00000037, 0x00000000, 0x00000002, 0x00000364, 0x00000000, 0x000004b6,
- 0x00000256, 0x00000000, 0xffffffff, 0x00000001, 0x00000037, 0x00000000, 0x00000002, 0x00000392,
- 0x00000000, 0x000004c0, 0x00000256, 0x00000000, 0xffffffff, 0x00000001, 0x00000037, 0x00000000,
- 0x00000002, 0x000003bc, 0x00000000, 0x000004c9, 0x00000256, 0x00000000, 0xffffffff, 0x00000001,
- 0x00000037, 0x00000000, 0x00000002, 0x000003ea, 0x00000000, 0x000004d3, 0x00000256, 0x00000000,
- 0xffffffff, 0x00000001, 0x00000037, 0x00000000, 0x00000002, 0x00000416, 0x00000000, 0x000004dc,
- 0x00000256, 0x00000000, 0xffffffff, 0x00000001, 0x00000037, 0x00000000, 0x00000002, 0x00000449,
- 0x00000000, 0x000004e6, 0x00000256, 0x00000000, 0xffffffff, 0x00000001, 0x00000037, 0x00000000,
- 0x00000002, 0x00000476, 0x00000000, 0x000004ef, 0x00000256, 0x00000000, 0xffffffff, 0x00000001,
- 0x00000037, 0x00000000, 0x00000002, 0x000004a1, 0x00000000, 0x00000514, 0x000004f8, 0x00000000,
- 0xffffffff, 0x00000000, 0x00000535, 0x00000519, 0x00000000, 0xffffffff, 0x00000000, 0x00000556,
- 0x0000053a, 0x00000000, 0xffffffff, 0x00000000, 0x00000578, 0x0000055c, 0x00000000, 0xffffffff,
- 0x00000000, 0x00000599, 0x0000057d, 0x00000000, 0xffffffff, 0x00000000, 0x000005bb, 0x0000059f,
- 0x00000000, 0xffffffff, 0x00000000, 0x000005df, 0x000005c3, 0x00000000, 0xffffffff, 0x00000000,
- 0x00000604, 0x000005e8, 0x00000000, 0xffffffff, 0x00000000, 0x00000625, 0x00000609, 0x00000000,
- 0xffffffff, 0x00000000, 0x0000062a, 0x00000256, 0x00000000, 0xffffffff, 0x00000001, 0x00000037,
- 0x00000000, 0x00000003, 0x00000633, 0x00000000, 0x0000063b, 0x00000256, 0x00000000, 0xffffffff,
- 0x00000001, 0x00000037, 0x00000000, 0x00000003, 0x00000644, 0x00000000, 0x0000064c, 0x00000256,
- 0x00000000, 0xffffffff, 0x00000001, 0x00000037, 0x00000000, 0x00000003, 0x00000655, 0x00000000,
- 0x0000065d, 0x00000256, 0x00000000, 0xffffffff, 0x00000001, 0x00000037, 0x00000000, 0x00000003,
- 0x00000667, 0x00000000, 0x0000066f, 0x00000256, 0x00000000, 0xffffffff, 0x00000001, 0x00000037,
- 0x00000000, 0x00000003, 0x00000679, 0x00000000, 0x00000681, 0x00000256, 0x00000000, 0xffffffff,
- 0x00000001, 0x00000037, 0x00000000, 0x00000003, 0x0000068b, 0x00000000, 0x00000693, 0x00000256,
- 0x00000000, 0xffffffff, 0x00000001, 0x00000037, 0x00000000, 0x00000003, 0x0000069d, 0x00000000,
- 0x000006a5, 0x00000256, 0x00000000, 0xffffffff, 0x00000001, 0x00000037, 0x00000000, 0x00000003,
- 0x000006af, 0x00000000, 0x000006b7, 0x00000256, 0x00000000, 0xffffffff, 0x00000001, 0x00000037,
- 0x00000000, 0x00000003, 0x000006c1, 0x00000000, 0x000006c9, 0x00000256, 0x00000000, 0xffffffff,
- 0x00000001, 0x00000037, 0x00000000, 0x00000001, 0x000006cc, 0x00000000, 0x000006d8, 0x00000003,
- 0x00000000, 0x000006de, 0x00000006, 0x00000000, 0x0000000a, 0x00000000, 0x00000001, 0x000006e4,
- 0x0000000b, 0x00000000, 0x00000001, 0x00000708, 0x00000002, 0x00000000, 0x00000002, 0x000001b9,
- 0x00000009, 0x00000000, 0x00000001, 0x00000714, 0x00000001, 0x00000000, 0x00000002, 0x000000e1,
- 0x00000000, 0x00000000, 0x00000002, 0x00000030, 0x00000720, 0x00000001, 0x00000000, 0x00000007,
- 0x00000000, 0x00000007, 0x0000091a, 0x00000922, 0x00000002, 0x00000000, 0x00000009, 0x00000000,
- 0x00000001, 0x00000928, 0x00000001, 0x00000000, 0x00000001, 0x00000934,
+ 0x00000001, 0x00000002, 0x00000000, 0x00000001, 0x00000002, 0x00000000, 0x00000004, 0x00000001,
+ 0x00000000, 0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000001,
+ 0x00000003, 0x0000ffff, 0x00000001, 0x00000002, 0x00000000, 0x00000030, 0x00000014, 0x00000000,
+ 0xffffffff, 0x0000000a, 0x0000000c, 0x00000000, 0x00000001, 0x0000003b, 0x0000000d, 0x00000000,
+ 0x00000001, 0x00000047, 0x0000000e, 0x00000000, 0x00000001, 0x00000053, 0x0000000f, 0x00000000,
+ 0x00000001, 0x0000005f, 0x00000010, 0x00000000, 0x00000001, 0x0000006b, 0x00000011, 0x00000000,
+ 0x00000001, 0x00000077, 0x00000012, 0x00000000, 0x00000001, 0x00000083, 0x00000013, 0x00000000,
+ 0x00000001, 0x0000008f, 0x00000014, 0x00000000, 0x00000001, 0x0000009b, 0x00000015, 0x00000000,
+ 0x00000001, 0x000000a7, 0x00000000, 0x000000e1, 0x000000c5, 0x00000000, 0xffffffff, 0x0000000e,
+ 0x00000016, 0x00000000, 0x00000001, 0x000000ea, 0x00000017, 0x00000000, 0x00000001, 0x000000f6,
+ 0x00000018, 0x00000000, 0x00000001, 0x00000102, 0x00000019, 0x00000000, 0x00000001, 0x0000010e,
+ 0x0000001a, 0x00000000, 0x00000001, 0x0000011a, 0x0000001b, 0x00000000, 0x00000001, 0x00000126,
+ 0x0000001c, 0x00000000, 0x00000001, 0x00000132, 0x0000001d, 0x00000000, 0x00000001, 0x0000013e,
+ 0x0000001e, 0x00000000, 0x00000001, 0x0000014a, 0x0000001f, 0x00000000, 0x00000001, 0x00000156,
+ 0x00000020, 0x00000000, 0x00000001, 0x00000162, 0x00000021, 0x00000000, 0x00000001, 0x0000016e,
+ 0x00000022, 0x00000000, 0x00000001, 0x0000017a, 0x00000023, 0x00000000, 0x00000001, 0x00000186,
+ 0x00000000, 0x000001b9, 0x0000019d, 0x00000000, 0xffffffff, 0x0000000b, 0x00000024, 0x00000000,
+ 0x00000001, 0x000001c5, 0x00000025, 0x00000000, 0x00000001, 0x000001d1, 0x00000025, 0x00000007,
+ 0x00000001, 0x000001dd, 0x00000026, 0x00000000, 0x00000001, 0x000001e9, 0x00000027, 0x00000000,
+ 0x00000001, 0x000001f5, 0x00000028, 0x00000000, 0x00000001, 0x00000201, 0x00000029, 0x00000000,
+ 0x00000001, 0x0000020d, 0x0000002a, 0x00000000, 0x00000001, 0x00000219, 0x0000002b, 0x00000000,
+ 0x00000001, 0x00000225, 0x0000002c, 0x00000000, 0x00000001, 0x00000231, 0x0000002c, 0x00000007,
+ 0x00000001, 0x0000023d, 0x00000000, 0x00000272, 0x00000256, 0x00000000, 0xffffffff, 0x0000000b,
+ 0x0000002d, 0x00000000, 0x00000001, 0x0000027b, 0x0000002e, 0x00000000, 0x00000001, 0x00000287,
+ 0x0000002f, 0x00000000, 0x00000001, 0x00000293, 0x00000030, 0x00000000, 0x00000001, 0x0000029f,
+ 0x00000031, 0x00000000, 0x00000001, 0x000002ab, 0x00000032, 0x00000000, 0x00000001, 0x000002b7,
+ 0x00000033, 0x00000000, 0x00000001, 0x000002c3, 0x00000034, 0x00000000, 0x00000001, 0x000002cf,
+ 0x00000035, 0x00000000, 0x00000001, 0x000002f3, 0x00000036, 0x00000000, 0x00000001, 0x000002ff,
+ 0x00000037, 0x00000000, 0x00000001, 0x0000030b, 0x00000000, 0x0000033b, 0x0000031f, 0x00000000,
+ 0xffffffff, 0x00000000, 0x00000364, 0x00000348, 0x00000000, 0xffffffff, 0x00000000, 0x00000392,
+ 0x00000376, 0x00000000, 0xffffffff, 0x00000000, 0x000003bc, 0x000003a0, 0x00000000, 0xffffffff,
+ 0x00000000, 0x000003ea, 0x000003ce, 0x00000000, 0xffffffff, 0x00000000, 0x00000416, 0x000003fa,
+ 0x00000000, 0xffffffff, 0x00000000, 0x00000449, 0x0000042d, 0x00000000, 0xffffffff, 0x00000000,
+ 0x00000476, 0x0000045a, 0x00000000, 0xffffffff, 0x00000000, 0x000004a1, 0x00000485, 0x00000000,
+ 0xffffffff, 0x00000000, 0x000004a4, 0x00000256, 0x00000000, 0xffffffff, 0x00000001, 0x00000037,
+ 0x00000000, 0x00000002, 0x0000033b, 0x00000000, 0x000004ad, 0x00000256, 0x00000000, 0xffffffff,
+ 0x00000001, 0x00000037, 0x00000000, 0x00000002, 0x00000364, 0x00000000, 0x000004b6, 0x00000256,
+ 0x00000000, 0xffffffff, 0x00000001, 0x00000037, 0x00000000, 0x00000002, 0x00000392, 0x00000000,
+ 0x000004c0, 0x00000256, 0x00000000, 0xffffffff, 0x00000001, 0x00000037, 0x00000000, 0x00000002,
+ 0x000003bc, 0x00000000, 0x000004c9, 0x00000256, 0x00000000, 0xffffffff, 0x00000001, 0x00000037,
+ 0x00000000, 0x00000002, 0x000003ea, 0x00000000, 0x000004d3, 0x00000256, 0x00000000, 0xffffffff,
+ 0x00000001, 0x00000037, 0x00000000, 0x00000002, 0x00000416, 0x00000000, 0x000004dc, 0x00000256,
+ 0x00000000, 0xffffffff, 0x00000001, 0x00000037, 0x00000000, 0x00000002, 0x00000449, 0x00000000,
+ 0x000004e6, 0x00000256, 0x00000000, 0xffffffff, 0x00000001, 0x00000037, 0x00000000, 0x00000002,
+ 0x00000476, 0x00000000, 0x000004ef, 0x00000256, 0x00000000, 0xffffffff, 0x00000001, 0x00000037,
+ 0x00000000, 0x00000002, 0x000004a1, 0x00000000, 0x00000514, 0x000004f8, 0x00000000, 0xffffffff,
+ 0x00000000, 0x00000535, 0x00000519, 0x00000000, 0xffffffff, 0x00000000, 0x00000556, 0x0000053a,
+ 0x00000000, 0xffffffff, 0x00000000, 0x00000578, 0x0000055c, 0x00000000, 0xffffffff, 0x00000000,
+ 0x00000599, 0x0000057d, 0x00000000, 0xffffffff, 0x00000000, 0x000005bb, 0x0000059f, 0x00000000,
+ 0xffffffff, 0x00000000, 0x000005df, 0x000005c3, 0x00000000, 0xffffffff, 0x00000000, 0x00000604,
+ 0x000005e8, 0x00000000, 0xffffffff, 0x00000000, 0x00000625, 0x00000609, 0x00000000, 0xffffffff,
+ 0x00000000, 0x0000062a, 0x00000256, 0x00000000, 0xffffffff, 0x00000001, 0x00000037, 0x00000000,
+ 0x00000003, 0x00000633, 0x00000000, 0x0000063b, 0x00000256, 0x00000000, 0xffffffff, 0x00000001,
+ 0x00000037, 0x00000000, 0x00000003, 0x00000644, 0x00000000, 0x0000064c, 0x00000256, 0x00000000,
+ 0xffffffff, 0x00000001, 0x00000037, 0x00000000, 0x00000003, 0x00000655, 0x00000000, 0x0000065d,
+ 0x00000256, 0x00000000, 0xffffffff, 0x00000001, 0x00000037, 0x00000000, 0x00000003, 0x00000667,
+ 0x00000000, 0x0000066f, 0x00000256, 0x00000000, 0xffffffff, 0x00000001, 0x00000037, 0x00000000,
+ 0x00000003, 0x00000679, 0x00000000, 0x00000681, 0x00000256, 0x00000000, 0xffffffff, 0x00000001,
+ 0x00000037, 0x00000000, 0x00000003, 0x0000068b, 0x00000000, 0x00000693, 0x00000256, 0x00000000,
+ 0xffffffff, 0x00000001, 0x00000037, 0x00000000, 0x00000003, 0x0000069d, 0x00000000, 0x000006a5,
+ 0x00000256, 0x00000000, 0xffffffff, 0x00000001, 0x00000037, 0x00000000, 0x00000003, 0x000006af,
+ 0x00000000, 0x000006b7, 0x00000256, 0x00000000, 0xffffffff, 0x00000001, 0x00000037, 0x00000000,
+ 0x00000003, 0x000006c1, 0x00000000, 0x000006c9, 0x00000256, 0x00000000, 0xffffffff, 0x00000001,
+ 0x00000037, 0x00000000, 0x00000001, 0x000006cc, 0x00000000, 0x000006d8, 0x00000003, 0x00000000,
+ 0x000006de, 0x00000006, 0x00000000, 0x0000000a, 0x00000000, 0x00000001, 0x000006e4, 0x0000000b,
+ 0x00000000, 0x00000001, 0x00000708, 0x00000002, 0x00000000, 0x00000002, 0x000001b9, 0x00000009,
+ 0x00000000, 0x00000001, 0x00000714, 0x00000001, 0x00000000, 0x00000002, 0x000000e1, 0x00000000,
+ 0x00000000, 0x00000002, 0x00000030, 0x00000720, 0x00000001, 0x00000000, 0x00000007, 0x00000000,
+ 0x00000007, 0x0000091a, 0x00000922, 0x00000005, 0x00000000, 0x00000009, 0x00000000, 0x00000001,
+ 0x00000928, 0x00000001, 0x00000000, 0x00000001, 0x00000934, 0x0000000a, 0x00000000, 0x00000001,
+ 0x00000940, 0x0000000b, 0x00000000, 0x00000001, 0x00000964, 0x00000002, 0x00000000, 0x00000001,
+ 0x00000970,
};
static void create_effect_texture_resource(ID3D10Device *device, ID3D10ShaderResourceView **srv,
@@ -4398,6 +4403,7 @@ static void create_effect_texture_resource(ID3D10Device *device, ID3D10ShaderRes
static void test_effect_state_groups(void)
{
ID3D10DepthStencilState *ds_state, *ds_state2;
+ ID3D10BlendState *blend_state, *blend_state2;
ID3D10ShaderResourceView *srv0, *srv1;
ID3D10EffectDepthStencilVariable *d;
ID3D10EffectRasterizerVariable *r;
@@ -4408,7 +4414,6 @@ static void test_effect_state_groups(void)
D3D10_SAMPLER_DESC sampler_desc;
ID3D10EffectSamplerVariable *s;
D3D10_EFFECT_DESC effect_desc;
- ID3D10BlendState *blend_state;
UINT sample_mask, stencil_ref;
ID3D10EffectBlendVariable *b;
D3D10_BLEND_DESC blend_desc;
@@ -4626,7 +4631,6 @@ static void test_effect_state_groups(void)
rast_desc.AntialiasedLineEnable);
ID3D10RasterizerState_Release(rast_state);
- ID3D10BlendState_Release(blend_state);
/* pass 1 - uses SamplerState.Texture = NULL, resource slot is reset. */
pass = technique->lpVtbl->GetPassByName(technique, "pass1");
@@ -4655,12 +4659,16 @@ static void test_effect_state_groups(void)
ok(pass->lpVtbl->IsValid(pass), "Failed to get pass.\n");
ID3D10Device_OMSetDepthStencilState(device, ds_state, 0);
+ ID3D10Device_OMSetBlendState(device, blend_state, NULL, 0);
hr = pass->lpVtbl->Apply(pass, 0);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ID3D10Device_OMGetDepthStencilState(device, &ds_state2, &stencil_ref);
ok(!ds_state2, "Unexpected depth stencil state.\n");
+ ID3D10Device_OMGetBlendState(device, &blend_state2, blend_factor, &sample_mask);
+ ok(!blend_state2, "Unexpected blend state.\n");
ID3D10DepthStencilState_Release(ds_state);
+ ID3D10BlendState_Release(blend_state);
effect->lpVtbl->Release(effect);
refcount = ID3D10Device_Release(device);
--
2.33.0
Nov. 1, 2021
[v2 PATCH 2/7] d3d10/effect: Handle NULL depth stencil state assignments.
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/d3d10/effect.c | 4 +
dlls/d3d10/tests/effect.c | 160 +++++++++++++++++++++-----------------
2 files changed, 92 insertions(+), 72 deletions(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c
index 5e65ad3f4be..0a6256d7ebd 100644
--- a/dlls/d3d10/effect.c
+++ b/dlls/d3d10/effect.c
@@ -1695,6 +1695,10 @@ static BOOL read_value_list(const char *data, size_t data_size, DWORD offset,
*(void **)out_data = &null_shader_resource_variable;
break;
+ case D3D10_SVT_DEPTHSTENCIL:
+ *(void **)out_data = &null_depth_stencil_variable;
+ break;
+
default:
FIXME("Unhandled out_type %#x.\n", out_type);
return FALSE;
diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c
index 149328301e1..87b591e3af8 100644
--- a/dlls/d3d10/tests/effect.c
+++ b/dlls/d3d10/tests/effect.c
@@ -4216,13 +4216,17 @@ technique10 tech0
{
SetPixelShader( CompileShader(ps_4_0, PS()) );
}
+ pass pass2
+ {
+ SetDepthStencilState(NULL, 0);
+ }
};
#endif
static DWORD fx_test_state_groups[] =
{
- 0x43425844, 0x61e5a938, 0x1d4228df, 0x536560dd, 0x76c777b2, 0x00000001, 0x000011ce, 0x00000001,
- 0x00000024, 0x30315846, 0x000011a2, 0xfeff1001, 0x00000000, 0x00000000, 0x00000029, 0x00000000,
- 0x00000000, 0x00000000, 0x00000001, 0x00000922, 0x00000000, 0x00000024, 0x00000001, 0x00000001,
+ 0x43425844, 0xefc189be, 0xdf31b02d, 0x77de2d1a, 0x7b97922c, 0x00000001, 0x00001218, 0x00000001,
+ 0x00000024, 0x30315846, 0x000011ec, 0xfeff1001, 0x00000000, 0x00000000, 0x00000029, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000001, 0x00000940, 0x00000000, 0x00000024, 0x00000001, 0x00000001,
0x00000001, 0x00000014, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x74736152,
0x7a697265, 0x74537265, 0x00657461, 0x00000004, 0x00000002, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000004, 0x74736172, 0x6174735f, 0x01006574, 0x02000000, 0x02000000, 0x01000000,
@@ -4296,73 +4300,75 @@ static DWORD fx_test_state_groups[] =
0x00000000, 0x00000000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x07260000, 0x00000000, 0x00300000, 0x00140000,
- 0x00000000, 0xffff0000, 0x000affff, 0x000c0000, 0x00000000, 0x00010000, 0x003b0000, 0x000d0000,
- 0x00000000, 0x00010000, 0x00470000, 0x000e0000, 0x00000000, 0x00010000, 0x00530000, 0x000f0000,
- 0x00000000, 0x00010000, 0x005f0000, 0x00100000, 0x00000000, 0x00010000, 0x006b0000, 0x00110000,
- 0x00000000, 0x00010000, 0x00770000, 0x00120000, 0x00000000, 0x00010000, 0x00830000, 0x00130000,
- 0x00000000, 0x00010000, 0x008f0000, 0x00140000, 0x00000000, 0x00010000, 0x009b0000, 0x00150000,
- 0x00000000, 0x00010000, 0x00a70000, 0x00000000, 0x00e10000, 0x00c50000, 0x00000000, 0xffff0000,
- 0x000effff, 0x00160000, 0x00000000, 0x00010000, 0x00ea0000, 0x00170000, 0x00000000, 0x00010000,
- 0x00f60000, 0x00180000, 0x00000000, 0x00010000, 0x01020000, 0x00190000, 0x00000000, 0x00010000,
- 0x010e0000, 0x001a0000, 0x00000000, 0x00010000, 0x011a0000, 0x001b0000, 0x00000000, 0x00010000,
- 0x01260000, 0x001c0000, 0x00000000, 0x00010000, 0x01320000, 0x001d0000, 0x00000000, 0x00010000,
- 0x013e0000, 0x001e0000, 0x00000000, 0x00010000, 0x014a0000, 0x001f0000, 0x00000000, 0x00010000,
- 0x01560000, 0x00200000, 0x00000000, 0x00010000, 0x01620000, 0x00210000, 0x00000000, 0x00010000,
- 0x016e0000, 0x00220000, 0x00000000, 0x00010000, 0x017a0000, 0x00230000, 0x00000000, 0x00010000,
- 0x01860000, 0x00000000, 0x01b90000, 0x019d0000, 0x00000000, 0xffff0000, 0x000bffff, 0x00240000,
- 0x00000000, 0x00010000, 0x01c50000, 0x00250000, 0x00000000, 0x00010000, 0x01d10000, 0x00250000,
- 0x00070000, 0x00010000, 0x01dd0000, 0x00260000, 0x00000000, 0x00010000, 0x01e90000, 0x00270000,
- 0x00000000, 0x00010000, 0x01f50000, 0x00280000, 0x00000000, 0x00010000, 0x02010000, 0x00290000,
- 0x00000000, 0x00010000, 0x020d0000, 0x002a0000, 0x00000000, 0x00010000, 0x02190000, 0x002b0000,
- 0x00000000, 0x00010000, 0x02250000, 0x002c0000, 0x00000000, 0x00010000, 0x02310000, 0x002c0000,
- 0x00070000, 0x00010000, 0x023d0000, 0x00000000, 0x02720000, 0x02560000, 0x00000000, 0xffff0000,
- 0x000bffff, 0x002d0000, 0x00000000, 0x00010000, 0x027b0000, 0x002e0000, 0x00000000, 0x00010000,
- 0x02870000, 0x002f0000, 0x00000000, 0x00010000, 0x02930000, 0x00300000, 0x00000000, 0x00010000,
- 0x029f0000, 0x00310000, 0x00000000, 0x00010000, 0x02ab0000, 0x00320000, 0x00000000, 0x00010000,
- 0x02b70000, 0x00330000, 0x00000000, 0x00010000, 0x02c30000, 0x00340000, 0x00000000, 0x00010000,
- 0x02cf0000, 0x00350000, 0x00000000, 0x00010000, 0x02f30000, 0x00360000, 0x00000000, 0x00010000,
- 0x02ff0000, 0x00370000, 0x00000000, 0x00010000, 0x030b0000, 0x00000000, 0x033b0000, 0x031f0000,
- 0x00000000, 0xffff0000, 0x0000ffff, 0x03640000, 0x03480000, 0x00000000, 0xffff0000, 0x0000ffff,
- 0x03920000, 0x03760000, 0x00000000, 0xffff0000, 0x0000ffff, 0x03bc0000, 0x03a00000, 0x00000000,
- 0xffff0000, 0x0000ffff, 0x03ea0000, 0x03ce0000, 0x00000000, 0xffff0000, 0x0000ffff, 0x04160000,
- 0x03fa0000, 0x00000000, 0xffff0000, 0x0000ffff, 0x04490000, 0x042d0000, 0x00000000, 0xffff0000,
- 0x0000ffff, 0x04760000, 0x045a0000, 0x00000000, 0xffff0000, 0x0000ffff, 0x04a10000, 0x04850000,
- 0x00000000, 0xffff0000, 0x0000ffff, 0x04a40000, 0x02560000, 0x00000000, 0xffff0000, 0x0001ffff,
- 0x00370000, 0x00000000, 0x00020000, 0x033b0000, 0x00000000, 0x04ad0000, 0x02560000, 0x00000000,
- 0xffff0000, 0x0001ffff, 0x00370000, 0x00000000, 0x00020000, 0x03640000, 0x00000000, 0x04b60000,
- 0x02560000, 0x00000000, 0xffff0000, 0x0001ffff, 0x00370000, 0x00000000, 0x00020000, 0x03920000,
- 0x00000000, 0x04c00000, 0x02560000, 0x00000000, 0xffff0000, 0x0001ffff, 0x00370000, 0x00000000,
- 0x00020000, 0x03bc0000, 0x00000000, 0x04c90000, 0x02560000, 0x00000000, 0xffff0000, 0x0001ffff,
- 0x00370000, 0x00000000, 0x00020000, 0x03ea0000, 0x00000000, 0x04d30000, 0x02560000, 0x00000000,
- 0xffff0000, 0x0001ffff, 0x00370000, 0x00000000, 0x00020000, 0x04160000, 0x00000000, 0x04dc0000,
- 0x02560000, 0x00000000, 0xffff0000, 0x0001ffff, 0x00370000, 0x00000000, 0x00020000, 0x04490000,
- 0x00000000, 0x04e60000, 0x02560000, 0x00000000, 0xffff0000, 0x0001ffff, 0x00370000, 0x00000000,
- 0x00020000, 0x04760000, 0x00000000, 0x04ef0000, 0x02560000, 0x00000000, 0xffff0000, 0x0001ffff,
- 0x00370000, 0x00000000, 0x00020000, 0x04a10000, 0x00000000, 0x05140000, 0x04f80000, 0x00000000,
- 0xffff0000, 0x0000ffff, 0x05350000, 0x05190000, 0x00000000, 0xffff0000, 0x0000ffff, 0x05560000,
- 0x053a0000, 0x00000000, 0xffff0000, 0x0000ffff, 0x05780000, 0x055c0000, 0x00000000, 0xffff0000,
- 0x0000ffff, 0x05990000, 0x057d0000, 0x00000000, 0xffff0000, 0x0000ffff, 0x05bb0000, 0x059f0000,
- 0x00000000, 0xffff0000, 0x0000ffff, 0x05df0000, 0x05c30000, 0x00000000, 0xffff0000, 0x0000ffff,
- 0x06040000, 0x05e80000, 0x00000000, 0xffff0000, 0x0000ffff, 0x06250000, 0x06090000, 0x00000000,
- 0xffff0000, 0x0000ffff, 0x062a0000, 0x02560000, 0x00000000, 0xffff0000, 0x0001ffff, 0x00370000,
- 0x00000000, 0x00030000, 0x06330000, 0x00000000, 0x063b0000, 0x02560000, 0x00000000, 0xffff0000,
- 0x0001ffff, 0x00370000, 0x00000000, 0x00030000, 0x06440000, 0x00000000, 0x064c0000, 0x02560000,
- 0x00000000, 0xffff0000, 0x0001ffff, 0x00370000, 0x00000000, 0x00030000, 0x06550000, 0x00000000,
- 0x065d0000, 0x02560000, 0x00000000, 0xffff0000, 0x0001ffff, 0x00370000, 0x00000000, 0x00030000,
- 0x06670000, 0x00000000, 0x066f0000, 0x02560000, 0x00000000, 0xffff0000, 0x0001ffff, 0x00370000,
- 0x00000000, 0x00030000, 0x06790000, 0x00000000, 0x06810000, 0x02560000, 0x00000000, 0xffff0000,
- 0x0001ffff, 0x00370000, 0x00000000, 0x00030000, 0x068b0000, 0x00000000, 0x06930000, 0x02560000,
- 0x00000000, 0xffff0000, 0x0001ffff, 0x00370000, 0x00000000, 0x00030000, 0x069d0000, 0x00000000,
- 0x06a50000, 0x02560000, 0x00000000, 0xffff0000, 0x0001ffff, 0x00370000, 0x00000000, 0x00030000,
- 0x06af0000, 0x00000000, 0x06b70000, 0x02560000, 0x00000000, 0xffff0000, 0x0001ffff, 0x00370000,
- 0x00000000, 0x00030000, 0x06c10000, 0x00000000, 0x06c90000, 0x02560000, 0x00000000, 0xffff0000,
- 0x0001ffff, 0x00370000, 0x00000000, 0x00010000, 0x06cc0000, 0x00000000, 0x06d80000, 0x00020000,
- 0x00000000, 0x06de0000, 0x00060000, 0x00000000, 0x000a0000, 0x00000000, 0x00010000, 0x06e40000,
- 0x000b0000, 0x00000000, 0x00010000, 0x07080000, 0x00020000, 0x00000000, 0x00020000, 0x01b90000,
- 0x00090000, 0x00000000, 0x00010000, 0x07140000, 0x00010000, 0x00000000, 0x00020000, 0x00e10000,
- 0x00000000, 0x00000000, 0x00020000, 0x00300000, 0x07200000, 0x00010000, 0x00000000, 0x00070000,
- 0x00000000, 0x00070000, 0x091a0000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x07260000, 0x00000000, 0x61700000, 0x00327373,
+ 0x00000001, 0x00000002, 0x00000000, 0x00000001, 0x00000002, 0x00000000, 0x00000030, 0x00000014,
+ 0x00000000, 0xffffffff, 0x0000000a, 0x0000000c, 0x00000000, 0x00000001, 0x0000003b, 0x0000000d,
+ 0x00000000, 0x00000001, 0x00000047, 0x0000000e, 0x00000000, 0x00000001, 0x00000053, 0x0000000f,
+ 0x00000000, 0x00000001, 0x0000005f, 0x00000010, 0x00000000, 0x00000001, 0x0000006b, 0x00000011,
+ 0x00000000, 0x00000001, 0x00000077, 0x00000012, 0x00000000, 0x00000001, 0x00000083, 0x00000013,
+ 0x00000000, 0x00000001, 0x0000008f, 0x00000014, 0x00000000, 0x00000001, 0x0000009b, 0x00000015,
+ 0x00000000, 0x00000001, 0x000000a7, 0x00000000, 0x000000e1, 0x000000c5, 0x00000000, 0xffffffff,
+ 0x0000000e, 0x00000016, 0x00000000, 0x00000001, 0x000000ea, 0x00000017, 0x00000000, 0x00000001,
+ 0x000000f6, 0x00000018, 0x00000000, 0x00000001, 0x00000102, 0x00000019, 0x00000000, 0x00000001,
+ 0x0000010e, 0x0000001a, 0x00000000, 0x00000001, 0x0000011a, 0x0000001b, 0x00000000, 0x00000001,
+ 0x00000126, 0x0000001c, 0x00000000, 0x00000001, 0x00000132, 0x0000001d, 0x00000000, 0x00000001,
+ 0x0000013e, 0x0000001e, 0x00000000, 0x00000001, 0x0000014a, 0x0000001f, 0x00000000, 0x00000001,
+ 0x00000156, 0x00000020, 0x00000000, 0x00000001, 0x00000162, 0x00000021, 0x00000000, 0x00000001,
+ 0x0000016e, 0x00000022, 0x00000000, 0x00000001, 0x0000017a, 0x00000023, 0x00000000, 0x00000001,
+ 0x00000186, 0x00000000, 0x000001b9, 0x0000019d, 0x00000000, 0xffffffff, 0x0000000b, 0x00000024,
+ 0x00000000, 0x00000001, 0x000001c5, 0x00000025, 0x00000000, 0x00000001, 0x000001d1, 0x00000025,
+ 0x00000007, 0x00000001, 0x000001dd, 0x00000026, 0x00000000, 0x00000001, 0x000001e9, 0x00000027,
+ 0x00000000, 0x00000001, 0x000001f5, 0x00000028, 0x00000000, 0x00000001, 0x00000201, 0x00000029,
+ 0x00000000, 0x00000001, 0x0000020d, 0x0000002a, 0x00000000, 0x00000001, 0x00000219, 0x0000002b,
+ 0x00000000, 0x00000001, 0x00000225, 0x0000002c, 0x00000000, 0x00000001, 0x00000231, 0x0000002c,
+ 0x00000007, 0x00000001, 0x0000023d, 0x00000000, 0x00000272, 0x00000256, 0x00000000, 0xffffffff,
+ 0x0000000b, 0x0000002d, 0x00000000, 0x00000001, 0x0000027b, 0x0000002e, 0x00000000, 0x00000001,
+ 0x00000287, 0x0000002f, 0x00000000, 0x00000001, 0x00000293, 0x00000030, 0x00000000, 0x00000001,
+ 0x0000029f, 0x00000031, 0x00000000, 0x00000001, 0x000002ab, 0x00000032, 0x00000000, 0x00000001,
+ 0x000002b7, 0x00000033, 0x00000000, 0x00000001, 0x000002c3, 0x00000034, 0x00000000, 0x00000001,
+ 0x000002cf, 0x00000035, 0x00000000, 0x00000001, 0x000002f3, 0x00000036, 0x00000000, 0x00000001,
+ 0x000002ff, 0x00000037, 0x00000000, 0x00000001, 0x0000030b, 0x00000000, 0x0000033b, 0x0000031f,
+ 0x00000000, 0xffffffff, 0x00000000, 0x00000364, 0x00000348, 0x00000000, 0xffffffff, 0x00000000,
+ 0x00000392, 0x00000376, 0x00000000, 0xffffffff, 0x00000000, 0x000003bc, 0x000003a0, 0x00000000,
+ 0xffffffff, 0x00000000, 0x000003ea, 0x000003ce, 0x00000000, 0xffffffff, 0x00000000, 0x00000416,
+ 0x000003fa, 0x00000000, 0xffffffff, 0x00000000, 0x00000449, 0x0000042d, 0x00000000, 0xffffffff,
+ 0x00000000, 0x00000476, 0x0000045a, 0x00000000, 0xffffffff, 0x00000000, 0x000004a1, 0x00000485,
+ 0x00000000, 0xffffffff, 0x00000000, 0x000004a4, 0x00000256, 0x00000000, 0xffffffff, 0x00000001,
+ 0x00000037, 0x00000000, 0x00000002, 0x0000033b, 0x00000000, 0x000004ad, 0x00000256, 0x00000000,
+ 0xffffffff, 0x00000001, 0x00000037, 0x00000000, 0x00000002, 0x00000364, 0x00000000, 0x000004b6,
+ 0x00000256, 0x00000000, 0xffffffff, 0x00000001, 0x00000037, 0x00000000, 0x00000002, 0x00000392,
+ 0x00000000, 0x000004c0, 0x00000256, 0x00000000, 0xffffffff, 0x00000001, 0x00000037, 0x00000000,
+ 0x00000002, 0x000003bc, 0x00000000, 0x000004c9, 0x00000256, 0x00000000, 0xffffffff, 0x00000001,
+ 0x00000037, 0x00000000, 0x00000002, 0x000003ea, 0x00000000, 0x000004d3, 0x00000256, 0x00000000,
+ 0xffffffff, 0x00000001, 0x00000037, 0x00000000, 0x00000002, 0x00000416, 0x00000000, 0x000004dc,
+ 0x00000256, 0x00000000, 0xffffffff, 0x00000001, 0x00000037, 0x00000000, 0x00000002, 0x00000449,
+ 0x00000000, 0x000004e6, 0x00000256, 0x00000000, 0xffffffff, 0x00000001, 0x00000037, 0x00000000,
+ 0x00000002, 0x00000476, 0x00000000, 0x000004ef, 0x00000256, 0x00000000, 0xffffffff, 0x00000001,
+ 0x00000037, 0x00000000, 0x00000002, 0x000004a1, 0x00000000, 0x00000514, 0x000004f8, 0x00000000,
+ 0xffffffff, 0x00000000, 0x00000535, 0x00000519, 0x00000000, 0xffffffff, 0x00000000, 0x00000556,
+ 0x0000053a, 0x00000000, 0xffffffff, 0x00000000, 0x00000578, 0x0000055c, 0x00000000, 0xffffffff,
+ 0x00000000, 0x00000599, 0x0000057d, 0x00000000, 0xffffffff, 0x00000000, 0x000005bb, 0x0000059f,
+ 0x00000000, 0xffffffff, 0x00000000, 0x000005df, 0x000005c3, 0x00000000, 0xffffffff, 0x00000000,
+ 0x00000604, 0x000005e8, 0x00000000, 0xffffffff, 0x00000000, 0x00000625, 0x00000609, 0x00000000,
+ 0xffffffff, 0x00000000, 0x0000062a, 0x00000256, 0x00000000, 0xffffffff, 0x00000001, 0x00000037,
+ 0x00000000, 0x00000003, 0x00000633, 0x00000000, 0x0000063b, 0x00000256, 0x00000000, 0xffffffff,
+ 0x00000001, 0x00000037, 0x00000000, 0x00000003, 0x00000644, 0x00000000, 0x0000064c, 0x00000256,
+ 0x00000000, 0xffffffff, 0x00000001, 0x00000037, 0x00000000, 0x00000003, 0x00000655, 0x00000000,
+ 0x0000065d, 0x00000256, 0x00000000, 0xffffffff, 0x00000001, 0x00000037, 0x00000000, 0x00000003,
+ 0x00000667, 0x00000000, 0x0000066f, 0x00000256, 0x00000000, 0xffffffff, 0x00000001, 0x00000037,
+ 0x00000000, 0x00000003, 0x00000679, 0x00000000, 0x00000681, 0x00000256, 0x00000000, 0xffffffff,
+ 0x00000001, 0x00000037, 0x00000000, 0x00000003, 0x0000068b, 0x00000000, 0x00000693, 0x00000256,
+ 0x00000000, 0xffffffff, 0x00000001, 0x00000037, 0x00000000, 0x00000003, 0x0000069d, 0x00000000,
+ 0x000006a5, 0x00000256, 0x00000000, 0xffffffff, 0x00000001, 0x00000037, 0x00000000, 0x00000003,
+ 0x000006af, 0x00000000, 0x000006b7, 0x00000256, 0x00000000, 0xffffffff, 0x00000001, 0x00000037,
+ 0x00000000, 0x00000003, 0x000006c1, 0x00000000, 0x000006c9, 0x00000256, 0x00000000, 0xffffffff,
+ 0x00000001, 0x00000037, 0x00000000, 0x00000001, 0x000006cc, 0x00000000, 0x000006d8, 0x00000003,
+ 0x00000000, 0x000006de, 0x00000006, 0x00000000, 0x0000000a, 0x00000000, 0x00000001, 0x000006e4,
+ 0x0000000b, 0x00000000, 0x00000001, 0x00000708, 0x00000002, 0x00000000, 0x00000002, 0x000001b9,
+ 0x00000009, 0x00000000, 0x00000001, 0x00000714, 0x00000001, 0x00000000, 0x00000002, 0x000000e1,
+ 0x00000000, 0x00000000, 0x00000002, 0x00000030, 0x00000720, 0x00000001, 0x00000000, 0x00000007,
+ 0x00000000, 0x00000007, 0x0000091a, 0x00000922, 0x00000002, 0x00000000, 0x00000009, 0x00000000,
+ 0x00000001, 0x00000928, 0x00000001, 0x00000000, 0x00000001, 0x00000934,
};
static void create_effect_texture_resource(ID3D10Device *device, ID3D10ShaderResourceView **srv,
@@ -4391,10 +4397,10 @@ static void create_effect_texture_resource(ID3D10Device *device, ID3D10ShaderRes
static void test_effect_state_groups(void)
{
+ ID3D10DepthStencilState *ds_state, *ds_state2;
ID3D10ShaderResourceView *srv0, *srv1;
ID3D10EffectDepthStencilVariable *d;
ID3D10EffectRasterizerVariable *r;
- ID3D10DepthStencilState *ds_state;
ID3D10RasterizerState *rast_state;
ID3D10EffectTechnique *technique;
D3D10_DEPTH_STENCIL_DESC ds_desc;
@@ -4620,7 +4626,6 @@ static void test_effect_state_groups(void)
rast_desc.AntialiasedLineEnable);
ID3D10RasterizerState_Release(rast_state);
- ID3D10DepthStencilState_Release(ds_state);
ID3D10BlendState_Release(blend_state);
/* pass 1 - uses SamplerState.Texture = NULL, resource slot is reset. */
@@ -4645,6 +4650,17 @@ static void test_effect_state_groups(void)
ID3D10ShaderResourceView_Release(srv0);
ID3D10Texture2D_Release(tex0);
+ /* pass 2 - NULL depth stencil state */
+ pass = technique->lpVtbl->GetPassByName(technique, "pass2");
+ ok(pass->lpVtbl->IsValid(pass), "Failed to get pass.\n");
+
+ ID3D10Device_OMSetDepthStencilState(device, ds_state, 0);
+ hr = pass->lpVtbl->Apply(pass, 0);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+ ID3D10Device_OMGetDepthStencilState(device, &ds_state2, &stencil_ref);
+ ok(!ds_state2, "Unexpected depth stencil state.\n");
+
+ ID3D10DepthStencilState_Release(ds_state);
effect->lpVtbl->Release(effect);
refcount = ID3D10Device_Release(device);
--
2.33.0
Nov. 1, 2021
[v2 PATCH 1/7] d3d10/effect: Handle D3D10_SVT_UINT type when returning numeric values.
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/d3d10/effect.c | 4 +++
dlls/d3d10/tests/effect.c | 59 +++++++++++++++++----------------------
2 files changed, 29 insertions(+), 34 deletions(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c
index 5da8d2065f7..5e65ad3f4be 100644
--- a/dlls/d3d10/effect.c
+++ b/dlls/d3d10/effect.c
@@ -4865,6 +4865,7 @@ static BOOL get_value_as_bool(void *src_data, D3D10_SHADER_VARIABLE_TYPE src_typ
{
case D3D10_SVT_FLOAT:
case D3D10_SVT_INT:
+ case D3D10_SVT_UINT:
case D3D10_SVT_BOOL:
if (*(DWORD *)src_data)
return -1;
@@ -4885,6 +4886,7 @@ static int get_value_as_int(void *src_data, D3D10_SHADER_VARIABLE_TYPE src_type)
return (int)(*(float *)src_data);
case D3D10_SVT_INT:
+ case D3D10_SVT_UINT:
return *(int *)src_data;
case D3D10_SVT_BOOL:
@@ -4903,6 +4905,7 @@ static float get_value_as_float(void *src_data, D3D10_SHADER_VARIABLE_TYPE src_t
return *(float *)src_data;
case D3D10_SVT_INT:
+ case D3D10_SVT_UINT:
return (float)(*(int *)src_data);
case D3D10_SVT_BOOL:
@@ -4933,6 +4936,7 @@ static void get_vector_as_type(BYTE *dst_data, D3D_SHADER_VARIABLE_TYPE dst_type
break;
case D3D10_SVT_INT:
+ case D3D10_SVT_UINT:
*(int *)dst_data_dword = get_value_as_int(src_data_dword, src_type);
break;
diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c
index a8a64a6ed0d..149328301e1 100644
--- a/dlls/d3d10/tests/effect.c
+++ b/dlls/d3d10/tests/effect.c
@@ -4843,43 +4843,32 @@ cbuffer cb
float f0, f_a[2];
int i0, i_a[2];
bool b0, b_a[2];
+ uint i1, i1_a[2];
};
#endif
static DWORD fx_test_scalar_variable[] =
{
- 0x43425844, 0xe4da4aa6, 0x1380ddc5, 0x445edad5,
- 0x08581666, 0x00000001, 0x0000020b, 0x00000001,
- 0x00000024, 0x30315846, 0x000001df, 0xfeff1001,
- 0x00000001, 0x00000006, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x000000d3,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x66006263,
- 0x74616f6c, 0x00000700, 0x00000100, 0x00000000,
- 0x00000400, 0x00001000, 0x00000400, 0x00090900,
- 0x00306600, 0x00000007, 0x00000001, 0x00000002,
- 0x00000014, 0x00000010, 0x00000008, 0x00000909,
- 0x00615f66, 0x00746e69, 0x0000004c, 0x00000001,
- 0x00000000, 0x00000004, 0x00000010, 0x00000004,
- 0x00000911, 0x4c003069, 0x01000000, 0x02000000,
- 0x14000000, 0x10000000, 0x08000000, 0x11000000,
- 0x69000009, 0x6200615f, 0x006c6f6f, 0x0000008f,
- 0x00000001, 0x00000000, 0x00000004, 0x00000010,
- 0x00000004, 0x00000921, 0x8f003062, 0x01000000,
- 0x02000000, 0x14000000, 0x10000000, 0x08000000,
- 0x21000000, 0x62000009, 0x0400615f, 0x70000000,
- 0x00000000, 0x06000000, 0xff000000, 0x00ffffff,
- 0x29000000, 0x0d000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x48000000,
- 0x2c000000, 0x00000000, 0x10000000, 0x00000000,
- 0x00000000, 0x00000000, 0x6c000000, 0x50000000,
- 0x00000000, 0x24000000, 0x00000000, 0x00000000,
- 0x00000000, 0x8b000000, 0x6f000000, 0x00000000,
- 0x30000000, 0x00000000, 0x00000000, 0x00000000,
- 0xb0000000, 0x94000000, 0x00000000, 0x44000000,
- 0x00000000, 0x00000000, 0x00000000, 0xcf000000,
- 0xb3000000, 0x00000000, 0x50000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000,
+ 0x43425844, 0x7d97f44c, 0x1da4b110, 0xb710407e, 0x26750c1c, 0x00000001, 0x00000288, 0x00000001,
+ 0x00000024, 0x30315846, 0x0000025c, 0xfeff1001, 0x00000001, 0x00000008, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000118, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x66006263,
+ 0x74616f6c, 0x00000700, 0x00000100, 0x00000000, 0x00000400, 0x00001000, 0x00000400, 0x00090900,
+ 0x00306600, 0x00000007, 0x00000001, 0x00000002, 0x00000014, 0x00000010, 0x00000008, 0x00000909,
+ 0x00615f66, 0x00746e69, 0x0000004c, 0x00000001, 0x00000000, 0x00000004, 0x00000010, 0x00000004,
+ 0x00000911, 0x4c003069, 0x01000000, 0x02000000, 0x14000000, 0x10000000, 0x08000000, 0x11000000,
+ 0x69000009, 0x6200615f, 0x006c6f6f, 0x0000008f, 0x00000001, 0x00000000, 0x00000004, 0x00000010,
+ 0x00000004, 0x00000921, 0x8f003062, 0x01000000, 0x02000000, 0x14000000, 0x10000000, 0x08000000,
+ 0x21000000, 0x62000009, 0x7500615f, 0x00746e69, 0x000000d3, 0x00000001, 0x00000000, 0x00000004,
+ 0x00000010, 0x00000004, 0x00000919, 0xd3003169, 0x01000000, 0x02000000, 0x14000000, 0x10000000,
+ 0x08000000, 0x19000000, 0x69000009, 0x00615f31, 0x00000004, 0x00000090, 0x00000000, 0x00000008,
+ 0xffffffff, 0x00000000, 0x00000029, 0x0000000d, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000048, 0x0000002c, 0x00000000, 0x00000010, 0x00000000, 0x00000000, 0x00000000,
+ 0x0000006c, 0x00000050, 0x00000000, 0x00000024, 0x00000000, 0x00000000, 0x00000000, 0x0000008b,
+ 0x0000006f, 0x00000000, 0x00000030, 0x00000000, 0x00000000, 0x00000000, 0x000000b0, 0x00000094,
+ 0x00000000, 0x00000044, 0x00000000, 0x00000000, 0x00000000, 0x000000cf, 0x000000b3, 0x00000000,
+ 0x00000050, 0x00000000, 0x00000000, 0x00000000, 0x000000f4, 0x000000d8, 0x00000000, 0x00000064,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000113, 0x000000f7, 0x00000000, 0x00000070, 0x00000000,
+ 0x00000000, 0x00000000,
};
static void test_scalar_methods(ID3D10EffectScalarVariable *var, D3D10_SHADER_VARIABLE_TYPE type,
@@ -5145,9 +5134,11 @@ static void test_effect_scalar_variable(void)
{
{"f0", D3D10_SVT_FLOAT},
{"i0", D3D10_SVT_INT},
+ {"i1", D3D10_SVT_UINT},
{"b0", D3D10_SVT_BOOL},
{"f_a", D3D10_SVT_FLOAT, TRUE},
{"i_a", D3D10_SVT_INT, TRUE},
+ {"i1_a", D3D10_SVT_UINT, TRUE},
{"b_a", D3D10_SVT_BOOL, TRUE},
};
ID3D10EffectScalarVariable *s_v, *s_v2;
@@ -5178,7 +5169,7 @@ static void test_effect_scalar_variable(void)
effect_desc.ConstantBuffers);
ok(effect_desc.SharedConstantBuffers == 0, "Unexpected shared constant buffers count %u.\n",
effect_desc.SharedConstantBuffers);
- ok(effect_desc.GlobalVariables == 6, "Unexpected global variables count %u.\n",
+ ok(effect_desc.GlobalVariables == 8, "Unexpected global variables count %u.\n",
effect_desc.GlobalVariables);
ok(effect_desc.SharedGlobalVariables == 0, "Unexpected shared global variables count %u.\n",
effect_desc.SharedGlobalVariables);
--
2.33.0
Nov. 1, 2021
[PATCH] wined3d: Reduce locking of device context operations.
by Jan Sikorski
Only actually take the lock for the immediate context. According to the
d3d11 documentation, operations on device contexts are not thread safe,
and testing on Windows confirms this.
Signed-off-by: Jan Sikorski <jsikorski(a)codeweavers.com>
---
dlls/wined3d/cs.c | 18 ++--
dlls/wined3d/device.c | 152 ++++++++++++++++-----------------
dlls/wined3d/wined3d_private.h | 12 +++
3 files changed, 97 insertions(+), 85 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index f266e59b4b5..bcd26b6fbb1 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -1019,7 +1019,7 @@ void CDECL wined3d_device_context_dispatch(struct wined3d_device_context *contex
{
struct wined3d_cs_dispatch *op;
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
op = wined3d_device_context_require_space(context, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT);
op->opcode = WINED3D_CS_OP_DISPATCH;
op->parameters.indirect = FALSE;
@@ -1030,7 +1030,7 @@ void CDECL wined3d_device_context_dispatch(struct wined3d_device_context *contex
acquire_compute_pipeline_resources(context);
wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT);
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
}
void CDECL wined3d_device_context_dispatch_indirect(struct wined3d_device_context *context,
@@ -1038,7 +1038,7 @@ void CDECL wined3d_device_context_dispatch_indirect(struct wined3d_device_contex
{
struct wined3d_cs_dispatch *op;
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
op = wined3d_device_context_require_space(context, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT);
op->opcode = WINED3D_CS_OP_DISPATCH;
op->parameters.indirect = TRUE;
@@ -1049,7 +1049,7 @@ void CDECL wined3d_device_context_dispatch_indirect(struct wined3d_device_contex
wined3d_device_context_acquire_resource(context, &buffer->resource);
wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT);
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
}
static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
@@ -1206,7 +1206,7 @@ void CDECL wined3d_device_context_draw_indirect(struct wined3d_device_context *c
const struct wined3d_state *state = context->state;
struct wined3d_cs_draw *op;
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
op = wined3d_device_context_require_space(context, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT);
op->opcode = WINED3D_CS_OP_DRAW;
op->primitive_type = state->primitive_type;
@@ -1220,7 +1220,7 @@ void CDECL wined3d_device_context_draw_indirect(struct wined3d_device_context *c
wined3d_device_context_acquire_resource(context, &buffer->resource);
wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT);
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
}
static void wined3d_cs_exec_flush(struct wined3d_cs *cs, const void *data)
@@ -3824,7 +3824,7 @@ HRESULT CDECL wined3d_deferred_context_record_command_list(struct wined3d_device
TRACE("context %p, list %p.\n", context, list);
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
memory = heap_alloc(sizeof(*object) + deferred->resource_count * sizeof(*object->resources)
+ deferred->upload_count * sizeof(*object->uploads)
+ deferred->command_list_count * sizeof(*object->command_lists)
@@ -3833,7 +3833,7 @@ HRESULT CDECL wined3d_deferred_context_record_command_list(struct wined3d_device
if (!memory)
{
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
return E_OUTOFMEMORY;
}
@@ -3886,7 +3886,7 @@ HRESULT CDECL wined3d_deferred_context_record_command_list(struct wined3d_device
TRACE("Created command list %p.\n", object);
*list = object;
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
return S_OK;
}
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 1c584b93fe0..c5de58c29c9 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1649,11 +1649,11 @@ void CDECL wined3d_device_context_reset_state(struct wined3d_device_context *con
{
TRACE("context %p.\n", context);
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
state_cleanup(context->state);
wined3d_state_reset(context->state, &context->device->adapter->d3d_info);
wined3d_device_context_emit_reset_state(context, true);
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
}
void CDECL wined3d_device_context_set_state(struct wined3d_device_context *context, struct wined3d_state *state)
@@ -1663,7 +1663,7 @@ void CDECL wined3d_device_context_set_state(struct wined3d_device_context *conte
TRACE("context %p, state %p.\n", context, state);
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
context->state = state;
wined3d_device_context_emit_set_feature_level(context, state->feature_level);
@@ -1760,7 +1760,7 @@ void CDECL wined3d_device_context_set_state(struct wined3d_device_context *conte
wined3d_device_context_emit_set_blend_state(context, state->blend_state, &state->blend_factor, state->sample_mask);
wined3d_device_context_emit_set_depth_stencil_state(context, state->depth_stencil_state, state->stencil_ref);
wined3d_device_context_emit_set_rasterizer_state(context, state->rasterizer_state);
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
}
struct wined3d_state * CDECL wined3d_device_get_state(struct wined3d_device *device)
@@ -1793,7 +1793,7 @@ void CDECL wined3d_device_context_set_shader(struct wined3d_device_context *cont
TRACE("context %p, type %#x, shader %p.\n", context, type, shader);
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
prev = state->shader[type];
if (shader == prev)
goto out;
@@ -1805,7 +1805,7 @@ void CDECL wined3d_device_context_set_shader(struct wined3d_device_context *cont
if (prev)
wined3d_shader_decref(prev);
out:
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
}
struct wined3d_shader * CDECL wined3d_device_context_get_shader(const struct wined3d_device_context *context,
@@ -1831,7 +1831,7 @@ void CDECL wined3d_device_context_set_constant_buffers(struct wined3d_device_con
return;
}
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
if (!memcmp(buffers, &state->cb[type][start_idx], count * sizeof(*buffers)))
goto out;
@@ -1848,7 +1848,7 @@ void CDECL wined3d_device_context_set_constant_buffers(struct wined3d_device_con
wined3d_buffer_decref(prev);
}
out:
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
}
void CDECL wined3d_device_context_set_blend_state(struct wined3d_device_context *context,
@@ -1860,7 +1860,7 @@ void CDECL wined3d_device_context_set_blend_state(struct wined3d_device_context
TRACE("context %p, blend_state %p, blend_factor %p, sample_mask %#x.\n",
context, blend_state, blend_factor, sample_mask);
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
prev = state->blend_state;
if (prev == blend_state && !memcmp(blend_factor, &state->blend_factor, sizeof(*blend_factor))
&& sample_mask == state->sample_mask)
@@ -1875,7 +1875,7 @@ void CDECL wined3d_device_context_set_blend_state(struct wined3d_device_context
if (prev)
wined3d_blend_state_decref(prev);
out:
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
}
void CDECL wined3d_device_context_set_depth_stencil_state(struct wined3d_device_context *context,
@@ -1886,7 +1886,7 @@ void CDECL wined3d_device_context_set_depth_stencil_state(struct wined3d_device_
TRACE("context %p, depth_stencil_state %p, stencil_ref %u.\n", context, depth_stencil_state, stencil_ref);
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
prev = state->depth_stencil_state;
if (prev == depth_stencil_state && state->stencil_ref == stencil_ref)
goto out;
@@ -1899,7 +1899,7 @@ void CDECL wined3d_device_context_set_depth_stencil_state(struct wined3d_device_
if (prev)
wined3d_depth_stencil_state_decref(prev);
out:
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
}
void CDECL wined3d_device_context_set_rasterizer_state(struct wined3d_device_context *context,
@@ -1910,7 +1910,7 @@ void CDECL wined3d_device_context_set_rasterizer_state(struct wined3d_device_con
TRACE("context %p, rasterizer_state %p.\n", context, rasterizer_state);
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
prev = state->rasterizer_state;
if (prev == rasterizer_state)
goto out;
@@ -1922,7 +1922,7 @@ void CDECL wined3d_device_context_set_rasterizer_state(struct wined3d_device_con
if (prev)
wined3d_rasterizer_state_decref(prev);
out:
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
}
void CDECL wined3d_device_context_set_viewports(struct wined3d_device_context *context, unsigned int viewport_count,
@@ -1939,7 +1939,7 @@ void CDECL wined3d_device_context_set_viewports(struct wined3d_device_context *c
viewports[i].width, viewports[i].height, viewports[i].min_z, viewports[i].max_z);
}
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
if (viewport_count)
memcpy(state->viewports, viewports, viewport_count * sizeof(*viewports));
else
@@ -1947,7 +1947,7 @@ void CDECL wined3d_device_context_set_viewports(struct wined3d_device_context *c
state->viewport_count = viewport_count;
wined3d_device_context_emit_set_viewports(context, viewport_count, viewports);
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
}
void CDECL wined3d_device_context_set_scissor_rects(struct wined3d_device_context *context, unsigned int rect_count,
@@ -1963,7 +1963,7 @@ void CDECL wined3d_device_context_set_scissor_rects(struct wined3d_device_contex
TRACE("%u: %s\n", i, wine_dbgstr_rect(&rects[i]));
}
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
if (state->scissor_rect_count == rect_count
&& !memcmp(state->scissor_rects, rects, rect_count * sizeof(*rects)))
{
@@ -1979,7 +1979,7 @@ void CDECL wined3d_device_context_set_scissor_rects(struct wined3d_device_contex
wined3d_device_context_emit_set_scissor_rects(context, rect_count, rects);
out:
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
}
void CDECL wined3d_device_context_set_shader_resource_views(struct wined3d_device_context *context,
@@ -1999,7 +1999,7 @@ void CDECL wined3d_device_context_set_shader_resource_views(struct wined3d_devic
return;
}
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
if (!memcmp(views, &state->shader_resource_view[type][start_idx], count * sizeof(*views)))
goto out;
@@ -2037,7 +2037,7 @@ void CDECL wined3d_device_context_set_shader_resource_views(struct wined3d_devic
}
}
out:
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
}
void CDECL wined3d_device_context_set_samplers(struct wined3d_device_context *context, enum wined3d_shader_type type,
@@ -2054,7 +2054,7 @@ void CDECL wined3d_device_context_set_samplers(struct wined3d_device_context *co
return;
}
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
if (!memcmp(samplers, &state->sampler[type][start_idx], count * sizeof(*samplers)))
goto out;
@@ -2071,7 +2071,7 @@ void CDECL wined3d_device_context_set_samplers(struct wined3d_device_context *co
wined3d_sampler_decref(prev);
}
out:
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
}
void CDECL wined3d_device_context_set_unordered_access_views(struct wined3d_device_context *context,
@@ -2090,7 +2090,7 @@ void CDECL wined3d_device_context_set_unordered_access_views(struct wined3d_devi
return;
}
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
if (!memcmp(uavs, &state->unordered_access_view[pipeline][start_idx], count * sizeof(*uavs)) && !initial_counts)
goto out;
@@ -2107,7 +2107,7 @@ void CDECL wined3d_device_context_set_unordered_access_views(struct wined3d_devi
wined3d_unordered_access_view_decref(prev);
}
out:
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
}
void CDECL wined3d_device_context_set_render_targets_and_unordered_access_views(struct wined3d_device_context *context,
@@ -2115,7 +2115,7 @@ void CDECL wined3d_device_context_set_render_targets_and_unordered_access_views(
struct wined3d_rendertarget_view *depth_stencil_view, UINT uav_count,
struct wined3d_unordered_access_view *const *unordered_access_views, const unsigned int *initial_counts)
{
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
if (rtv_count != ~0u)
{
if (depth_stencil_view && !(depth_stencil_view->resource->bind_flags & WINED3D_BIND_DEPTH_STENCIL))
@@ -2138,7 +2138,7 @@ void CDECL wined3d_device_context_set_render_targets_and_unordered_access_views(
unordered_access_views, initial_counts);
}
out:
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
}
static void wined3d_device_context_unbind_srv_for_rtv(struct wined3d_device_context *context,
@@ -2200,7 +2200,7 @@ HRESULT CDECL wined3d_device_context_set_rendertarget_views(struct wined3d_devic
}
}
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
/* Set the viewport and scissor rectangles, if requested. Tests show that
* stateblock recording is ignored, the change goes directly into the
* primary stateblock. */
@@ -2246,7 +2246,7 @@ HRESULT CDECL wined3d_device_context_set_rendertarget_views(struct wined3d_devic
wined3d_device_context_unbind_srv_for_rtv(context, view, FALSE);
}
out:
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
return WINED3D_OK;
}
@@ -2265,7 +2265,7 @@ HRESULT CDECL wined3d_device_context_set_depth_stencil_view(struct wined3d_devic
return WINED3DERR_INVALIDCALL;
}
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
prev = fb->depth_stencil;
if (prev == view)
{
@@ -2280,7 +2280,7 @@ HRESULT CDECL wined3d_device_context_set_depth_stencil_view(struct wined3d_devic
wined3d_rendertarget_view_decref(prev);
wined3d_device_context_unbind_srv_for_rtv(context, view, TRUE);
out:
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
return WINED3D_OK;
}
@@ -2292,7 +2292,7 @@ void CDECL wined3d_device_context_set_predication(struct wined3d_device_context
TRACE("context %p, predicate %p, value %#x.\n", context, predicate, value);
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
prev = state->predicate;
if (predicate)
{
@@ -2304,7 +2304,7 @@ void CDECL wined3d_device_context_set_predication(struct wined3d_device_context
wined3d_device_context_emit_set_predication(context, predicate, value);
if (prev)
wined3d_query_decref(prev);
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
}
HRESULT CDECL wined3d_device_context_set_stream_sources(struct wined3d_device_context *context,
@@ -2332,7 +2332,7 @@ HRESULT CDECL wined3d_device_context_set_stream_sources(struct wined3d_device_co
}
}
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
if (!memcmp(streams, &state->streams[start_idx], count * sizeof(*streams)))
goto out;
@@ -2350,7 +2350,7 @@ HRESULT CDECL wined3d_device_context_set_stream_sources(struct wined3d_device_co
wined3d_buffer_decref(prev);
}
out:
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
return WINED3D_OK;
}
@@ -2365,7 +2365,7 @@ void CDECL wined3d_device_context_set_index_buffer(struct wined3d_device_context
TRACE("context %p, buffer %p, format %s, offset %u.\n",
context, buffer, debug_d3dformat(format_id), offset);
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
prev_buffer = state->index_buffer;
prev_format = state->index_format;
prev_offset = state->index_offset;
@@ -2382,7 +2382,7 @@ void CDECL wined3d_device_context_set_index_buffer(struct wined3d_device_context
if (prev_buffer)
wined3d_buffer_decref(prev_buffer);
out:
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
}
void CDECL wined3d_device_context_set_vertex_declaration(struct wined3d_device_context *context,
@@ -2393,7 +2393,7 @@ void CDECL wined3d_device_context_set_vertex_declaration(struct wined3d_device_c
TRACE("context %p, declaration %p.\n", context, declaration);
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
prev = state->vertex_declaration;
if (declaration == prev)
goto out;
@@ -2405,7 +2405,7 @@ void CDECL wined3d_device_context_set_vertex_declaration(struct wined3d_device_c
if (prev)
wined3d_vertex_declaration_decref(prev);
out:
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
}
void CDECL wined3d_device_context_set_stream_outputs(struct wined3d_device_context *context,
@@ -2416,7 +2416,7 @@ void CDECL wined3d_device_context_set_stream_outputs(struct wined3d_device_conte
TRACE("context %p, outputs %p.\n", context, outputs);
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
wined3d_device_context_emit_set_stream_outputs(context, outputs);
for (i = 0; i < WINED3D_MAX_STREAM_OUTPUT_BUFFERS; ++i)
{
@@ -2429,7 +2429,7 @@ void CDECL wined3d_device_context_set_stream_outputs(struct wined3d_device_conte
if (prev_buffer)
wined3d_buffer_decref(prev_buffer);
}
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
}
void CDECL wined3d_device_context_draw(struct wined3d_device_context *context, unsigned int start_vertex,
@@ -2440,10 +2440,10 @@ void CDECL wined3d_device_context_draw(struct wined3d_device_context *context, u
TRACE("context %p, start_vertex %u, vertex_count %u, start_instance %u, instance_count %u.\n",
context, start_vertex, vertex_count, start_instance, instance_count);
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
wined3d_device_context_emit_draw(context, state->primitive_type, state->patch_vertex_count,
0, start_vertex, vertex_count, start_instance, instance_count, false);
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
}
void CDECL wined3d_device_context_draw_indexed(struct wined3d_device_context *context, int base_vertex_index,
@@ -2454,10 +2454,10 @@ void CDECL wined3d_device_context_draw_indexed(struct wined3d_device_context *co
TRACE("context %p, base_vertex_index %d, start_index %u, index_count %u, start_instance %u, instance_count %u.\n",
context, base_vertex_index, start_index, index_count, start_instance, instance_count);
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
wined3d_device_context_emit_draw(context, state->primitive_type, state->patch_vertex_count,
base_vertex_index, start_index, index_count, start_instance, instance_count, true);
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
}
void CDECL wined3d_device_context_get_constant_buffer(const struct wined3d_device_context *context,
@@ -4150,10 +4150,10 @@ void CDECL wined3d_device_context_set_primitive_type(struct wined3d_device_conte
TRACE("context %p, primitive_type %s, patch_vertex_count %u.\n",
context, debug_d3dprimitivetype(primitive_type), patch_vertex_count);
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
state->primitive_type = primitive_type;
state->patch_vertex_count = patch_vertex_count;
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
}
void CDECL wined3d_device_context_get_primitive_type(const struct wined3d_device_context *context,
@@ -4471,9 +4471,9 @@ void CDECL wined3d_device_context_copy_uav_counter(struct wined3d_device_context
TRACE("context %p, dst_buffer %p, offset %u, uav %p.\n",
context, dst_buffer, offset, uav);
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
wined3d_device_context_emit_copy_uav_counter(context, dst_buffer, offset, uav);
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
}
static bool resources_format_compatible(const struct wined3d_resource *src_resource,
@@ -4548,10 +4548,10 @@ void CDECL wined3d_device_context_copy_resource(struct wined3d_device_context *c
if (dst_resource->type == WINED3D_RTYPE_BUFFER)
{
wined3d_box_set(&src_box, 0, 0, src_resource->size, 1, 0, 1);
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
wined3d_device_context_emit_blt_sub_resource(context, dst_resource, 0, &src_box,
src_resource, 0, &src_box, WINED3D_BLT_RAW, NULL, WINED3D_TEXF_POINT);
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
return;
}
@@ -4567,7 +4567,7 @@ void CDECL wined3d_device_context_copy_resource(struct wined3d_device_context *c
return;
}
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
for (i = 0; i < dst_texture->level_count; ++i)
{
wined3d_texture_get_level_box(src_texture, i, &src_box);
@@ -4580,7 +4580,7 @@ void CDECL wined3d_device_context_copy_resource(struct wined3d_device_context *c
src_resource, idx, &src_box, WINED3D_BLT_RAW, NULL, WINED3D_TEXF_POINT);
}
}
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
}
HRESULT CDECL wined3d_device_context_copy_sub_resource_region(struct wined3d_device_context *context,
@@ -4737,10 +4737,10 @@ HRESULT CDECL wined3d_device_context_copy_sub_resource_region(struct wined3d_dev
}
}
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
wined3d_device_context_emit_blt_sub_resource(context, dst_resource, dst_sub_resource_idx, &dst_box,
src_resource, src_sub_resource_idx, src_box, WINED3D_BLT_RAW, NULL, WINED3D_TEXF_POINT);
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
return WINED3D_OK;
}
@@ -4780,10 +4780,10 @@ void CDECL wined3d_device_context_update_sub_resource(struct wined3d_device_cont
return;
}
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
wined3d_device_context_emit_update_sub_resource(context, resource,
sub_resource_idx, box, data, row_pitch, depth_pitch);
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
}
void CDECL wined3d_device_context_resolve_sub_resource(struct wined3d_device_context *context,
@@ -4820,7 +4820,7 @@ void CDECL wined3d_device_context_resolve_sub_resource(struct wined3d_device_con
return;
}
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
fx.resolve_format_id = format_id;
dst_texture = texture_from_resource(dst_resource);
@@ -4834,7 +4834,7 @@ void CDECL wined3d_device_context_resolve_sub_resource(struct wined3d_device_con
wined3d_texture_get_level_height(src_texture, src_level));
wined3d_device_context_blt(context, dst_texture, dst_sub_resource_idx, &dst_rect,
src_texture, src_sub_resource_idx, &src_rect, 0, &fx, WINED3D_TEXF_POINT);
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
}
HRESULT CDECL wined3d_device_context_clear_rendertarget_view(struct wined3d_device_context *context,
@@ -4871,9 +4871,9 @@ HRESULT CDECL wined3d_device_context_clear_rendertarget_view(struct wined3d_devi
return hr;
}
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
wined3d_device_context_emit_clear_rendertarget_view(context, view, rect, flags, color, depth, stencil);
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
return WINED3D_OK;
}
@@ -4889,9 +4889,9 @@ void CDECL wined3d_device_context_clear_uav_float(struct wined3d_device_context
return;
}
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
wined3d_device_context_emit_clear_uav(context, view, (const struct wined3d_uvec4 *)clear_value, true);
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
}
void CDECL wined3d_device_context_clear_uav_uint(struct wined3d_device_context *context,
@@ -4899,9 +4899,9 @@ void CDECL wined3d_device_context_clear_uav_uint(struct wined3d_device_context *
{
TRACE("context %p, view %p, clear_value %s.\n", context, view, debug_uvec4(clear_value));
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
wined3d_device_context_emit_clear_uav(context, view, clear_value, false);
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
}
static unsigned int sanitise_map_flags(const struct wined3d_resource *resource, unsigned int flags)
@@ -4989,9 +4989,9 @@ HRESULT CDECL wined3d_device_context_map(struct wined3d_device_context *context,
return WINED3DERR_INVALIDCALL;
}
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
hr = wined3d_device_context_emit_map(context, resource, sub_resource_idx, map_desc, box, flags);
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
return hr;
}
@@ -5001,9 +5001,9 @@ HRESULT CDECL wined3d_device_context_unmap(struct wined3d_device_context *contex
HRESULT hr;
TRACE("context %p, resource %p, sub_resource_idx %u.\n", context, resource, sub_resource_idx);
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
hr = wined3d_device_context_emit_unmap(context, resource, sub_resource_idx);
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
return hr;
}
@@ -5012,9 +5012,9 @@ void CDECL wined3d_device_context_issue_query(struct wined3d_device_context *con
{
TRACE("context %p, query %p, flags %#x.\n", context, query, flags);
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
context->ops->issue_query(context, query, flags);
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
}
void CDECL wined3d_device_context_execute_command_list(struct wined3d_device_context *context,
@@ -5022,9 +5022,9 @@ void CDECL wined3d_device_context_execute_command_list(struct wined3d_device_con
{
TRACE("context %p, list %p, restore_state %d.\n", context, list, restore_state);
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
wined3d_device_context_emit_execute_command_list(context, list, restore_state);
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
}
struct wined3d_rendertarget_view * CDECL wined3d_device_context_get_rendertarget_view(
@@ -5072,9 +5072,9 @@ void CDECL wined3d_device_context_generate_mipmaps(struct wined3d_device_context
return;
}
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
wined3d_device_context_emit_generate_mipmaps(context, view);
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
}
static struct wined3d_texture *wined3d_device_create_cursor_texture(struct wined3d_device *device,
@@ -5298,9 +5298,9 @@ void CDECL wined3d_device_context_flush(struct wined3d_device_context *context)
{
TRACE("context %p.\n", context);
- wined3d_mutex_lock();
+ wined3d_device_context_lock(context);
context->ops->flush(context);
- wined3d_mutex_unlock();
+ wined3d_device_context_unlock(context);
}
static void update_swapchain_flags(struct wined3d_texture *texture)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 588e39db9b2..6a6c84ee02f 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -4839,6 +4839,18 @@ struct wined3d_cs
LONG pending_presents;
};
+static inline void wined3d_device_context_lock(struct wined3d_device_context *context)
+{
+ if (context == &context->device->cs->c)
+ wined3d_mutex_lock();
+}
+
+static inline void wined3d_device_context_unlock(struct wined3d_device_context *context)
+{
+ if (context == &context->device->cs->c)
+ wined3d_mutex_unlock();
+}
+
struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device,
const enum wined3d_feature_level *levels, unsigned int level_count) DECLSPEC_HIDDEN;
void wined3d_cs_destroy(struct wined3d_cs *cs) DECLSPEC_HIDDEN;
--
2.32.0
Nov. 1, 2021
[PATCH 3/3] ntdll: Prevent loading Wine system dependencies in place of identically named application DLLs.
by Zebediah Figura
That is, load Wine system dependencies only when they are imported from Wine
builtins or other system dependencies, and do not match a Wine system dependency
by its base name when looking for already-loaded modules.
The reasoning is that it is possible for an application to ship, and expect to
use, a newer version of a MinGW-compiled library, or one with custom patches, or
possibly an unrelated library with the same name. We don't want to offer Wine's
system dependencies in place of the application's, or vice versa.
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
dlls/ntdll/loader.c | 45 ++++++++++++++++++++++++++-------------------
include/winternl.h | 1 +
2 files changed, 27 insertions(+), 19 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 42aa787cf34..fa18c6c4a26 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -187,7 +187,7 @@ static WINE_MODREF *current_modref;
static WINE_MODREF *last_failed_modref;
static NTSTATUS load_dll( const WCHAR *load_path, const WCHAR *libname, const WCHAR *default_ext,
- DWORD flags, WINE_MODREF** pwm );
+ DWORD flags, WINE_MODREF **pwm, BOOL system );
static NTSTATUS process_attach( WINE_MODREF *wm, LPVOID lpReserved );
static FARPROC find_ordinal_export( HMODULE module, const IMAGE_EXPORT_DIRECTORY *exports,
DWORD exp_size, DWORD ordinal, LPCWSTR load_path );
@@ -506,21 +506,23 @@ static WINE_MODREF *get_modref( HMODULE hmod )
* Find a module from its base name.
* The loader_section must be locked while calling this function
*/
-static WINE_MODREF *find_basename_module( LPCWSTR name )
+static WINE_MODREF *find_basename_module( const WCHAR *name, BOOL system )
{
PLIST_ENTRY mark, entry;
UNICODE_STRING name_str;
RtlInitUnicodeString( &name_str, name );
- if (cached_modref && RtlEqualUnicodeString( &name_str, &cached_modref->ldr.BaseDllName, TRUE ))
+ if (cached_modref && RtlEqualUnicodeString( &name_str, &cached_modref->ldr.BaseDllName, TRUE )
+ && system == !!(cached_modref->ldr.Flags & LDR_WINE_SYSTEM))
return cached_modref;
mark = &NtCurrentTeb()->Peb->LdrData->InLoadOrderModuleList;
for (entry = mark->Flink; entry != mark; entry = entry->Flink)
{
LDR_DATA_TABLE_ENTRY *mod = CONTAINING_RECORD(entry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
- if (RtlEqualUnicodeString( &name_str, &mod->BaseDllName, TRUE ))
+ if (RtlEqualUnicodeString( &name_str, &mod->BaseDllName, TRUE )
+ && system == !!(mod->Flags & LDR_WINE_SYSTEM))
{
cached_modref = CONTAINING_RECORD(mod, WINE_MODREF, ldr);
return cached_modref;
@@ -619,6 +621,7 @@ static WINE_MODREF **grow_module_deps( WINE_MODREF *wm, int count )
*/
static FARPROC find_forwarded_export( HMODULE module, const char *forward, LPCWSTR load_path )
{
+ BOOL system = !!(get_modref( module )->ldr.Flags & (LDR_WINE_SYSTEM | LDR_WINE_BUILTIN));
const IMAGE_EXPORT_DIRECTORY *exports;
DWORD exp_size;
WINE_MODREF *wm;
@@ -638,10 +641,10 @@ static FARPROC find_forwarded_export( HMODULE module, const char *forward, LPCWS
if (!wcschr( mod_name, '.' ))
memcpy( mod_name + (end - forward), L".dll", sizeof(L".dll") );
- if (!(wm = find_basename_module( mod_name )))
+ if (!(wm = find_basename_module( mod_name, system )))
{
TRACE( "delay loading %s for '%s'\n", debugstr_w(mod_name), forward );
- if (load_dll( load_path, mod_name, L".dll", 0, &wm ) == STATUS_SUCCESS &&
+ if (load_dll( load_path, mod_name, L".dll", 0, &wm, system ) == STATUS_SUCCESS &&
!(wm->ldr.Flags & LDR_DONT_RESOLVE_REFS))
{
if (!imports_fixup_done && current_modref)
@@ -809,6 +812,7 @@ void * WINAPI RtlFindExportedRoutineByName( HMODULE module, const char *name )
*/
static BOOL import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *descr, LPCWSTR load_path, WINE_MODREF **pwm )
{
+ BOOL system = !!(current_modref->ldr.Flags & (LDR_WINE_SYSTEM | LDR_WINE_BUILTIN));
NTSTATUS status;
WINE_MODREF *wmImp;
HMODULE imp_mod;
@@ -842,7 +846,7 @@ static BOOL import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *descr, LP
{
ascii_to_unicode( buffer, name, len );
buffer[len] = 0;
- status = load_dll( load_path, buffer, L".dll", 0, &wmImp );
+ status = load_dll( load_path, buffer, L".dll", 0, &wmImp, system );
}
else /* need to allocate a larger buffer */
{
@@ -850,7 +854,7 @@ static BOOL import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *descr, LP
if (!ptr) return FALSE;
ascii_to_unicode( ptr, name, len );
ptr[len] = 0;
- status = load_dll( load_path, ptr, L".dll", 0, &wmImp );
+ status = load_dll( load_path, ptr, L".dll", 0, &wmImp, system );
RtlFreeHeap( GetProcessHeap(), 0, ptr );
}
@@ -1131,7 +1135,7 @@ static NTSTATUS fixup_imports_ilonly( WINE_MODREF *wm, LPCWSTR load_path, void *
prev = current_modref;
current_modref = wm;
- if (!(status = load_dll( load_path, L"mscoree.dll", NULL, 0, &imp ))) wm->deps[0] = imp;
+ if (!(status = load_dll( load_path, L"mscoree.dll", NULL, 0, &imp, FALSE ))) wm->deps[0] = imp;
current_modref = prev;
if (status)
{
@@ -2802,7 +2806,7 @@ done:
*/
static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname, const WCHAR *default_ext,
UNICODE_STRING *nt_name, WINE_MODREF **pwm, HANDLE *mapping,
- SECTION_IMAGE_INFORMATION *image_info, struct file_id *id )
+ SECTION_IMAGE_INFORMATION *image_info, struct file_id *id, BOOL system )
{
WCHAR *ext, *dllname;
NTSTATUS status;
@@ -2843,7 +2847,7 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname, con
else
{
if (status != STATUS_SXS_KEY_NOT_FOUND) goto done;
- if ((*pwm = find_basename_module( libname )) != NULL)
+ if ((*pwm = find_basename_module( libname, system )) != NULL)
{
status = STATUS_SUCCESS;
goto done;
@@ -2876,7 +2880,7 @@ done:
* The loader_section must be locked while calling this function.
*/
static NTSTATUS load_dll( const WCHAR *load_path, const WCHAR *libname, const WCHAR *default_ext,
- DWORD flags, WINE_MODREF** pwm )
+ DWORD flags, WINE_MODREF **pwm, BOOL system )
{
UNICODE_STRING nt_name;
struct file_id id;
@@ -2887,10 +2891,10 @@ static NTSTATUS load_dll( const WCHAR *load_path, const WCHAR *libname, const WC
TRACE( "looking for %s in %s\n", debugstr_w(libname), debugstr_w(load_path) );
- if (system_dll_path.Buffer)
- nts = find_dll_file( system_dll_path.Buffer, libname, default_ext, &nt_name, pwm, &mapping, &image_info, &id );
+ if (system && system_dll_path.Buffer)
+ nts = find_dll_file( system_dll_path.Buffer, libname, default_ext, &nt_name, pwm, &mapping, &image_info, &id, TRUE );
if (nts)
- nts = find_dll_file( load_path, libname, default_ext, &nt_name, pwm, &mapping, &image_info, &id );
+ nts = find_dll_file( load_path, libname, default_ext, &nt_name, pwm, &mapping, &image_info, &id, FALSE );
if (*pwm) /* found already loaded module */
{
@@ -2927,6 +2931,9 @@ static NTSTATUS load_dll( const WCHAR *load_path, const WCHAR *libname, const WC
break;
}
+ if (system)
+ (*pwm)->ldr.Flags |= LDR_WINE_SYSTEM;
+
if (NtCurrentTeb64())
NtCurrentTeb64()->Tib.ArbitraryUserPointer = prev;
else
@@ -2984,7 +2991,7 @@ NTSTATUS WINAPI DECLSPEC_HOTPATCH LdrLoadDll(LPCWSTR path_name, DWORD flags,
RtlEnterCriticalSection( &loader_section );
- nts = load_dll( path_name, libname->Buffer, L".dll", flags, &wm );
+ nts = load_dll( path_name, libname->Buffer, L".dll", flags, &wm, FALSE );
if (nts == STATUS_SUCCESS && !(wm->ldr.Flags & LDR_DONT_RESOLVE_REFS))
{
@@ -3059,7 +3066,7 @@ NTSTATUS WINAPI LdrGetDllHandleEx( ULONG flags, LPCWSTR load_path, ULONG *dll_ch
RtlEnterCriticalSection( &loader_section );
- status = find_dll_file( load_path, name->Buffer, L".dll", &nt_name, &wm, &mapping, &image_info, &id );
+ status = find_dll_file( load_path, name->Buffer, L".dll", &nt_name, &wm, &mapping, &image_info, &id, FALSE );
if (wm) *base = wm->ldr.DllBase;
else
@@ -3740,7 +3747,7 @@ static void init_wow64( CONTEXT *context )
NTSTATUS status;
static const WCHAR wow64_path[] = L"C:\\windows\\system32\\wow64.dll";
- if ((status = load_dll( NULL, wow64_path, NULL, 0, &wm )))
+ if ((status = load_dll( NULL, wow64_path, NULL, 0, &wm, FALSE )))
{
ERR( "could not load %s, status %x\n", debugstr_w(wow64_path), status );
NtTerminateProcess( GetCurrentProcess(), status );
@@ -3891,7 +3898,7 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR
if (NtCurrentTeb()->WowTebOffset) init_wow64( context );
- if ((status = load_dll( NULL, L"kernel32.dll", NULL, 0, &kernel32 )) != STATUS_SUCCESS)
+ if ((status = load_dll( NULL, L"kernel32.dll", NULL, 0, &kernel32, FALSE )) != STATUS_SUCCESS)
{
MESSAGE( "wine: could not load kernel32.dll, status %x\n", status );
NtTerminateProcess( GetCurrentProcess(), status );
diff --git a/include/winternl.h b/include/winternl.h
index 5da3e010bf0..5d4be728b28 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -3393,6 +3393,7 @@ typedef void (CALLBACK *PLDR_DLL_NOTIFICATION_FUNCTION)(ULONG, LDR_DLL_NOTIFICAT
#define LDR_COR_ILONLY 0x01000000
/* these ones is Wine specific */
+#define LDR_WINE_SYSTEM 0x20000000
#define LDR_DONT_RESOLVE_REFS 0x40000000
#define LDR_WINE_BUILTIN 0x80000000
--
2.33.0
Nov. 1, 2021
[PATCH 2/3] ntdll: Allow loading system DLLs from a path specified at configure time.
by Zebediah Figura
Many distributions provide MinGW-compiled system DLLs which are currently
bundled with Wine. Unfortunately, while MinGW pkg-config can be used to detect
the linking path, there is no standardized runtime path, and many distributions
in fact use different paths.
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
To be clear I don't necessarily think this is *clearly* the best option.
Obviously it'd be nice to establish some sort of standard along the lines of
ld.so's standardized search location, but this may be a lengthy process.
An environment variable configurable at runtime would also be useful, as
LD_LIBRARY_PATH often is. I could see arguments for specifying it in addition
to, or in lieu of, a path supplied at configure time.
It's also possible that we should allow specifying multiple paths here.
Nevertheless, I believe we should allow some way to load DLLs from an external
path, rather than forcing the user to manually copy them into the prefix (or
forcing Wine to be built with bundled dependencies.) I readily welcome consensus
on any of the above questions, but in lieu thereof, since it is relatively easy
to effect incremental improvement here, I propose this solution for now.
configure.ac | 4 ++++
dlls/ntdll/loader.c | 10 ++++++++--
dlls/ntdll/unix/env.c | 1 +
dlls/ntdll/unix/loader.c | 5 +++++
dlls/ntdll/unix/unix_private.h | 1 +
5 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index bcce6c01041..8b969ca2dfb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -36,6 +36,8 @@ AC_ARG_ENABLE(maintainer-mode, AS_HELP_STRING([--enable-maintainer-mode],[enable
AC_ARG_ENABLE(silent-rules, AS_HELP_STRING([--enable-silent-rules],[use silent build rules (override: "make V=1")]))
AC_ARG_ENABLE(werror, AS_HELP_STRING([--enable-werror],[treat compilation warnings as errors]))
+AC_ARG_VAR([SYSTEMDLLDIR], [path containing system dependency shared libraries])
+
AC_ARG_WITH(alsa, AS_HELP_STRING([--without-alsa],[do not use the Alsa sound support]))
AC_ARG_WITH(capi, AS_HELP_STRING([--without-capi],[do not use CAPI (ISDN support)]))
AC_ARG_WITH(coreaudio, AS_HELP_STRING([--without-coreaudio],[do not use the CoreAudio sound support]),
@@ -109,6 +111,8 @@ AC_ARG_WITH(wine64, AS_HELP_STRING([--with-wine64=DIR],[use the 64-bit Wine i
AC_CANONICAL_HOST
+AS_VAR_IF([SYSTEMDLLDIR],[],[],[AC_DEFINE_UNQUOTED([SYSTEMDLLDIR],["$SYSTEMDLLDIR"],[Define to the path containing system dependency shared libraries.])])
+
dnl **** Check for some programs ****
AC_PROG_MAKE_SET
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 26192e48fba..42aa787cf34 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -95,6 +95,7 @@ static int free_lib_count; /* recursion depth of LdrUnloadDll calls */
static ULONG path_safe_mode; /* path mode set by RtlSetSearchPathMode */
static ULONG dll_safe_mode = 1; /* dll search mode */
static UNICODE_STRING dll_directory; /* extra path for LdrSetDllDirectory */
+static UNICODE_STRING system_dll_path; /* path to search for system dependency dlls */
static DWORD default_search_flags; /* default flags set by LdrSetDefaultDllDirectories */
static WCHAR *default_load_path; /* default dll search path */
@@ -2881,12 +2882,15 @@ static NTSTATUS load_dll( const WCHAR *load_path, const WCHAR *libname, const WC
struct file_id id;
HANDLE mapping = 0;
SECTION_IMAGE_INFORMATION image_info;
- NTSTATUS nts;
+ NTSTATUS nts = STATUS_DLL_NOT_FOUND;
ULONG64 prev;
TRACE( "looking for %s in %s\n", debugstr_w(libname), debugstr_w(load_path) );
- nts = find_dll_file( load_path, libname, default_ext, &nt_name, pwm, &mapping, &image_info, &id );
+ if (system_dll_path.Buffer)
+ nts = find_dll_file( system_dll_path.Buffer, libname, default_ext, &nt_name, pwm, &mapping, &image_info, &id );
+ if (nts)
+ nts = find_dll_file( load_path, libname, default_ext, &nt_name, pwm, &mapping, &image_info, &id );
if (*pwm) /* found already loaded module */
{
@@ -3878,6 +3882,8 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR
load_global_options();
version_init();
+ get_env_var( L"WINESYSTEMDLLDIR", 0, &system_dll_path );
+
wm = build_main_module();
wm->ldr.LoadCount = -1;
diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c
index 43a34bf831b..1647603efa5 100644
--- a/dlls/ntdll/unix/env.c
+++ b/dlls/ntdll/unix/env.c
@@ -1296,6 +1296,7 @@ static void add_dynamic_environment( WCHAR **env, SIZE_T *pos, SIZE_T *size )
add_path_var( env, pos, size, "WINEHOMEDIR", home_dir );
add_path_var( env, pos, size, "WINEBUILDDIR", build_dir );
add_path_var( env, pos, size, "WINECONFIGDIR", config_dir );
+ add_path_var( env, pos, size, "WINESYSTEMDLLDIR", system_dll_path );
for (i = 0; dll_paths[i]; i++)
{
sprintf( str, "WINEDLLDIR%u", i );
diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c
index 0ca4b1ea6dd..5dfe7191dbe 100644
--- a/dlls/ntdll/unix/loader.c
+++ b/dlls/ntdll/unix/loader.c
@@ -388,6 +388,7 @@ const char *data_dir = NULL;
const char *build_dir = NULL;
const char *config_dir = NULL;
const char **dll_paths = NULL;
+const char *system_dll_path = NULL;
const char *user_name = NULL;
SECTION_IMAGE_INFORMATION main_image_info = { NULL };
static HMODULE ntdll_module;
@@ -619,6 +620,10 @@ static void init_paths( char *argv[] )
data_dir = build_path( bin_dir, BIN_TO_DATADIR );
}
+#ifdef SYSTEMDLLDIR
+ system_dll_path = SYSTEMDLLDIR;
+#endif
+
set_dll_path();
set_home_dir();
set_config_dir();
diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h
index 792cb33710d..01c7cc1c103 100644
--- a/dlls/ntdll/unix/unix_private.h
+++ b/dlls/ntdll/unix/unix_private.h
@@ -125,6 +125,7 @@ extern const char *build_dir DECLSPEC_HIDDEN;
extern const char *config_dir DECLSPEC_HIDDEN;
extern const char *user_name DECLSPEC_HIDDEN;
extern const char **dll_paths DECLSPEC_HIDDEN;
+extern const char *system_dll_path DECLSPEC_HIDDEN;
extern PEB *peb DECLSPEC_HIDDEN;
extern USHORT *uctable DECLSPEC_HIDDEN;
extern USHORT *lctable DECLSPEC_HIDDEN;
--
2.33.0
Nov. 1, 2021
[PATCH 1/3] include: Rename LDR_WINE_INTERNAL to LDR_WINE_BUILTIN.
by Zebediah Figura
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
This series makes it possible to use dynamic libraries from an external path
without needing to first copy them into a prefix. To do this I used the
following configure line on Debian:
configure --enable-win64 ZLIB_PE_CFLAGS="$(x86_64-w64-mingw32-pkg-config --cflags zlib)" ZLIB_PE_LIBS="$(x86_64-w64-mingw32-pkg-config --libs zlib)" SYSTEMDLLDIR=/usr/x86_64-w64-mingw32/lib/
I would like to submit patches in the future to allow the use of pkg-config for
automatically detecting compile flags and libraries. I would also like to find
some way to obviate manual specification of DLL bindirs.
dlls/kernel32/kernel_main.c | 2 +-
dlls/krnl386.exe16/ne_module.c | 2 +-
dlls/ntdll/loader.c | 10 +++++-----
dlls/ntdll/signal_arm64.c | 2 +-
dlls/ntdll/signal_x86_64.c | 2 +-
include/winternl.h | 2 +-
6 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/dlls/kernel32/kernel_main.c b/dlls/kernel32/kernel_main.c
index 89394e16430..83c4ebf2130 100644
--- a/dlls/kernel32/kernel_main.c
+++ b/dlls/kernel32/kernel_main.c
@@ -136,7 +136,7 @@ static BOOL process_attach( HMODULE module )
{
LDR_DATA_TABLE_ENTRY *ldr;
- if (LdrFindEntryForAddress( GetModuleHandleW( 0 ), &ldr ) || !(ldr->Flags & LDR_WINE_INTERNAL))
+ if (LdrFindEntryForAddress( GetModuleHandleW( 0 ), &ldr ) || !(ldr->Flags & LDR_WINE_BUILTIN))
LoadLibraryA( "krnl386.exe16" );
}
#endif
diff --git a/dlls/krnl386.exe16/ne_module.c b/dlls/krnl386.exe16/ne_module.c
index c26fe778253..108e88e5546 100644
--- a/dlls/krnl386.exe16/ne_module.c
+++ b/dlls/krnl386.exe16/ne_module.c
@@ -982,7 +982,7 @@ static HINSTANCE16 MODULE_LoadModule16( LPCSTR libname, BOOL implicit, BOOL lib_
return ERROR_FILE_NOT_FOUND;
}
/* check if module was loaded native */
- if (LdrFindEntryForAddress( main_owner, &ldr ) || !(ldr->Flags & LDR_WINE_INTERNAL))
+ if (LdrFindEntryForAddress( main_owner, &ldr ) || !(ldr->Flags & LDR_WINE_BUILTIN))
{
FreeLibrary( mod32 );
descr = NULL;
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index dd41d6b66d2..26192e48fba 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -988,7 +988,7 @@ static BOOL is_dll_native_subsystem( LDR_DATA_TABLE_ENTRY *mod, const IMAGE_NT_H
if (nt->OptionalHeader.Subsystem != IMAGE_SUBSYSTEM_NATIVE) return FALSE;
if (nt->OptionalHeader.SectionAlignment < page_size) return TRUE;
- if (mod->Flags & LDR_WINE_INTERNAL) return TRUE;
+ if (mod->Flags & LDR_WINE_BUILTIN) return TRUE;
if ((imports = RtlImageDirectoryEntryToData( mod->DllBase, TRUE,
IMAGE_DIRECTORY_ENTRY_IMPORT, &size )))
@@ -1221,7 +1221,7 @@ static WINE_MODREF *alloc_module( HMODULE hModule, const UNICODE_STRING *nt_name
wm->ldr.DllBase = hModule;
wm->ldr.SizeOfImage = nt->OptionalHeader.SizeOfImage;
- wm->ldr.Flags = LDR_DONT_RESOLVE_REFS | (builtin ? LDR_WINE_INTERNAL : 0);
+ wm->ldr.Flags = LDR_DONT_RESOLVE_REFS | (builtin ? LDR_WINE_BUILTIN : 0);
wm->ldr.TlsIndex = -1;
wm->ldr.LoadCount = 1;
wm->CheckSum = nt->OptionalHeader.CheckSum;
@@ -1355,7 +1355,7 @@ static NTSTATUS MODULE_InitDLL( WINE_MODREF *wm, UINT reason, LPVOID lpReserved
if (wm->ldr.Flags & LDR_DONT_RESOLVE_REFS) return STATUS_SUCCESS;
if (wm->ldr.TlsIndex != -1) call_tls_callbacks( wm->ldr.DllBase, reason );
- if (wm->ldr.Flags & LDR_WINE_INTERNAL && reason == DLL_PROCESS_ATTACH)
+ if (wm->ldr.Flags & LDR_WINE_BUILTIN && reason == DLL_PROCESS_ATTACH)
unix_funcs->init_builtin_dll( wm->ldr.DllBase );
if (!entry) return STATUS_SUCCESS;
@@ -3522,7 +3522,7 @@ static void free_modref( WINE_MODREF *wm )
if (!TRACE_ON(module))
TRACE_(loaddll)("Unloaded module %s : %s\n",
debugstr_w(wm->ldr.FullDllName.Buffer),
- (wm->ldr.Flags & LDR_WINE_INTERNAL) ? "builtin" : "native" );
+ (wm->ldr.Flags & LDR_WINE_BUILTIN) ? "builtin" : "native" );
free_tls_slot( &wm->ldr );
RtlReleaseActivationContext( wm->ldr.ActivationContext );
@@ -3955,7 +3955,7 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR
}
release_address_space();
if (wm->ldr.TlsIndex != -1) call_tls_callbacks( wm->ldr.DllBase, DLL_PROCESS_ATTACH );
- if (wm->ldr.Flags & LDR_WINE_INTERNAL) unix_funcs->init_builtin_dll( wm->ldr.DllBase );
+ if (wm->ldr.Flags & LDR_WINE_BUILTIN) unix_funcs->init_builtin_dll( wm->ldr.DllBase );
if (wm->ldr.ActivationContext) RtlDeactivateActivationContext( 0, cookie );
process_breakpoint();
}
diff --git a/dlls/ntdll/signal_arm64.c b/dlls/ntdll/signal_arm64.c
index 290639b676b..bfbaeab47c9 100644
--- a/dlls/ntdll/signal_arm64.c
+++ b/dlls/ntdll/signal_arm64.c
@@ -191,7 +191,7 @@ static NTSTATUS virtual_unwind( ULONG type, DISPATCHER_CONTEXT *dispatch, CONTEX
/* then look for host system exception information */
- if (!module || (module->Flags & LDR_WINE_INTERNAL))
+ if (!module || (module->Flags & LDR_WINE_BUILTIN))
{
status = unix_funcs->unwind_builtin_dll( type, dispatch, context );
if (status != STATUS_SUCCESS) return status;
diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c
index ef32eba68b7..8515b176e5d 100644
--- a/dlls/ntdll/signal_x86_64.c
+++ b/dlls/ntdll/signal_x86_64.c
@@ -275,7 +275,7 @@ static NTSTATUS virtual_unwind( ULONG type, DISPATCHER_CONTEXT *dispatch, CONTEX
/* then look for host system exception information */
- if (!module || (module->Flags & LDR_WINE_INTERNAL))
+ if (!module || (module->Flags & LDR_WINE_BUILTIN))
{
status = unix_funcs->unwind_builtin_dll( type, dispatch, context );
diff --git a/include/winternl.h b/include/winternl.h
index 7a34629edb0..5da3e010bf0 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -3394,7 +3394,7 @@ typedef void (CALLBACK *PLDR_DLL_NOTIFICATION_FUNCTION)(ULONG, LDR_DLL_NOTIFICAT
/* these ones is Wine specific */
#define LDR_DONT_RESOLVE_REFS 0x40000000
-#define LDR_WINE_INTERNAL 0x80000000
+#define LDR_WINE_BUILTIN 0x80000000
/* flag for LdrAddRefDll */
#define LDR_ADDREF_DLL_PIN 0x00000001
--
2.33.0
Nov. 1, 2021
[PATCH 2/2] dmime: Skip Segment header only if too much data
by Alistair Leslie-Hughes
Tron 2.0 has a segment header of 56, so is missing the rtPlayStart field.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
---
dlls/dmime/segment.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/dlls/dmime/segment.c b/dlls/dmime/segment.c
index f5dbf4b9959..67522c0edb6 100644
--- a/dlls/dmime/segment.c
+++ b/dlls/dmime/segment.c
@@ -743,9 +743,7 @@ static HRESULT parse_segment_form(IDirectMusicSegment8Impl *This, IStream *strea
switch (chunk.id) {
case DMUS_FOURCC_SEGMENT_CHUNK:
/* DX7, DX8 and DX9 structure sizes */
- if (chunk.size != offsetof(DMUS_IO_SEGMENT_HEADER, rtLength) &&
- chunk.size != offsetof(DMUS_IO_SEGMENT_HEADER, rtLoopStart) &&
- chunk.size != sizeof(DMUS_IO_SEGMENT_HEADER)) {
+ if (chunk.size > sizeof(DMUS_IO_SEGMENT_HEADER)) {
WARN("Invalid size of %s\n", debugstr_chunk(&chunk));
break;
}
--
2.33.0
Nov. 1, 2021
[PATCH 1/2] dmime: Parse Wave track stream
by Alistair Leslie-Hughes
Tron 2.0
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
---
dlls/dmime/dmime_private.h | 6 ++
dlls/dmime/wavetrack.c | 148 ++++++++++++++++++++++++++++++++++++-
2 files changed, 152 insertions(+), 2 deletions(-)
diff --git a/dlls/dmime/dmime_private.h b/dlls/dmime/dmime_private.h
index c2221a15fd2..6ab47292b39 100644
--- a/dlls/dmime/dmime_private.h
+++ b/dlls/dmime/dmime_private.h
@@ -86,6 +86,12 @@ typedef struct _DMUS_PRIVATE_TEMPO_ITEM {
DMUS_IO_TEMPO_ITEM item;
} DMUS_PRIVATE_TEMPO_ITEM, *LPDMUS_PRIVATE_TEMPO_ITEM;
+struct wave_item {
+ struct list entry;
+ DMUS_IO_WAVE_TRACK_HEADER header;
+ IDirectMusicObject *object;
+};
+
typedef struct _DMUS_PRIVATE_GRAPH_TOOL {
struct list entry; /* for listing elements */
DWORD dwIndex;
diff --git a/dlls/dmime/wavetrack.c b/dlls/dmime/wavetrack.c
index 1c6b08b5235..da7ef37d2c8 100644
--- a/dlls/dmime/wavetrack.c
+++ b/dlls/dmime/wavetrack.c
@@ -20,6 +20,8 @@
#include "dmime_private.h"
#include "dmobject.h"
+#include "wine/heap.h"
+
WINE_DEFAULT_DEBUG_CHANNEL(dmime);
/*****************************************************************************
@@ -32,6 +34,8 @@ typedef struct IDirectMusicWaveTrack {
IDirectMusicTrack8 IDirectMusicTrack8_iface;
struct dmobject dmobj; /* IPersistStream only */
LONG ref;
+
+ struct list items;
} IDirectMusicWaveTrack;
/* IDirectMusicWaveTrack IDirectMusicTrack8 part: */
@@ -40,6 +44,11 @@ static inline IDirectMusicWaveTrack *impl_from_IDirectMusicTrack8(IDirectMusicTr
return CONTAINING_RECORD(iface, IDirectMusicWaveTrack, IDirectMusicTrack8_iface);
}
+static inline IDirectMusicWaveTrack *impl_from_IPersistStream(IPersistStream *iface)
+{
+ return CONTAINING_RECORD(iface, IDirectMusicWaveTrack, dmobj.IPersistStream_iface);
+}
+
static HRESULT WINAPI wave_track_QueryInterface(IDirectMusicTrack8 *iface, REFIID riid,
void **ret_iface)
{
@@ -81,6 +90,19 @@ static ULONG WINAPI wave_track_Release(IDirectMusicTrack8 *iface)
TRACE("(%p) ref=%d\n", This, ref);
if (!ref) {
+ struct list *cursor, *cursor2;
+ struct wave_item *item;
+
+ LIST_FOR_EACH_SAFE(cursor, cursor2, &This->items) {
+ item = LIST_ENTRY(cursor, struct wave_item, entry);
+ list_remove(cursor);
+
+ if (item->object)
+ IDirectMusicObject_Release(item->object);
+
+ heap_free(item);
+ }
+
HeapFree(GetProcessHeap(), 0, This);
DMIME_UnlockModule();
}
@@ -280,10 +302,131 @@ static const IDirectMusicTrack8Vtbl dmtrack8_vtbl = {
wave_track_Join
};
+static HRESULT parse_wave_item(IDirectMusicWaveTrack *This, IStream *stream,
+ struct chunk_entry *wave, struct wave_item *item)
+{
+ HRESULT hr;
+ struct chunk_entry chunk = {.parent = wave};
+
+ if (FAILED(hr = stream_next_chunk(stream, &chunk)))
+ return hr;
+
+ if(chunk.id == FOURCC_LIST && chunk.type == DMUS_FOURCC_WAVE_LIST)
+ {
+ struct chunk_entry child = {.parent = &chunk};
+ DMUS_IO_WAVE_ITEM_HEADER header;
+
+ if (FAILED(hr = stream_next_chunk(stream, &child)))
+ return hr;
+
+ if(child.id != DMUS_FOURCC_WAVEITEM_CHUNK)
+ return DMUS_E_UNSUPPORTED_STREAM;
+
+ if (FAILED(hr = stream_chunk_get_data(stream, &child, &header, sizeof(header)))) {
+ WARN("Failed to read data of %s\n", debugstr_chunk(&child));
+ return hr;
+ }
+
+ TRACE("Found DMUS_IO_WAVE_ITEM_HEADER\n");
+ TRACE(" - lVolume %d\n", header.lVolume);
+ TRACE(" - dwVariations %d\n", header.dwVariations);
+ TRACE(" - rtTime %s\n", wine_dbgstr_longlong(header.rtTime));
+ TRACE(" - rtStartOffset %s\n", wine_dbgstr_longlong(header.rtStartOffset));
+ TRACE(" - rtReserved %s\n", wine_dbgstr_longlong(header.rtReserved));
+ TRACE(" - rtDuration %s\n", wine_dbgstr_longlong(header.rtDuration));
+ TRACE(" - dwLoopStart %d\n", header.dwLoopStart);
+ TRACE(" - dwLoopEnd %d\n", header.dwLoopEnd);
+ TRACE(" - dwFlags 0x%08x\n", header.dwFlags);
+ TRACE(" - wVolumeRange %d\n", header.wVolumeRange);
+ TRACE(" - wPitchRange %d\n", header.wPitchRange);
+
+ if (FAILED(hr = stream_next_chunk(stream, &child)))
+ return hr;
+
+ if (FAILED(hr = dmobj_parsereference(stream, &chunk, &item->object)))
+ return hr;
+ }
+ else
+ hr = DMUS_E_UNSUPPORTED_STREAM;
+
+ return SUCCEEDED(hr) ? S_OK : hr;
+}
+
static HRESULT WINAPI wave_IPersistStream_Load(IPersistStream *iface, IStream *stream)
{
- FIXME(": Loading not implemented yet\n");
- return S_OK;
+ IDirectMusicWaveTrack *This = impl_from_IPersistStream(iface);
+ HRESULT hr;
+ struct chunk_entry chunk = {0};
+
+ TRACE("%p, %p\n", This, stream);
+
+ if (!stream)
+ return E_POINTER;
+
+ if ((hr = stream_get_chunk(stream, &chunk) != S_OK))
+ return hr;
+
+ if (chunk.id == FOURCC_LIST && chunk.type == DMUS_FOURCC_WAVETRACK_LIST)
+ {
+ struct chunk_entry chunklist = {.parent = &chunk};
+ struct wave_item *item = NULL;
+
+ TRACE("Parsing segment form in %p: %s\n", stream, debugstr_chunk(&chunklist));
+
+ if (FAILED(hr = stream_next_chunk(stream, &chunklist)))
+ return hr;
+
+ if (chunklist.id != DMUS_FOURCC_WAVETRACK_CHUNK)
+ return DMUS_E_UNSUPPORTED_STREAM;
+
+ item = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(struct wave_item));
+ if (!item)
+ return E_OUTOFMEMORY;
+
+ list_add_tail (&This->items, &item->entry);
+
+ if (FAILED(hr = stream_next_chunk(stream, &chunklist)))
+ return hr;
+
+ if (chunklist.id == FOURCC_LIST && chunklist.type == DMUS_FOURCC_WAVEPART_LIST)
+ {
+ struct chunk_entry child = {.parent = &chunklist};
+ DMUS_IO_WAVE_PART_HEADER header;
+
+ if (FAILED(hr = stream_next_chunk(stream, &child)))
+ return hr;
+
+ if (child.id != DMUS_FOURCC_WAVEPART_CHUNK)
+ return DMUS_E_UNSUPPORTED_STREAM;
+
+ if (FAILED(hr = stream_chunk_get_data(stream, &child, &header, sizeof(header)))) {
+ WARN("Failed to read data of %s\n", debugstr_chunk(&child));
+ return hr;
+ }
+
+ TRACE("Found DMUS_IO_WAVE_PART_HEADER\n");
+ TRACE(" - lVolume %d\n", header.lVolume);
+ TRACE(" - dwVariations %d\n", header.dwVariations);
+ TRACE(" - dwPChannel %d\n", header.dwPChannel);
+ TRACE(" - dwLockToPart %d\n", header.dwLockToPart);
+ TRACE(" - dwFlags 0x%08x\n", header.dwFlags);
+ TRACE(" - dwIndex %d\n", header.dwIndex);
+
+ if (FAILED(hr = stream_next_chunk(stream, &child)))
+ return hr;
+
+ if(child.id != FOURCC_LIST || child.type != DMUS_FOURCC_WAVEITEM_LIST)
+ return DMUS_E_UNSUPPORTED_STREAM;
+
+ hr = parse_wave_item(This, stream, &child, item);
+ }
+ else
+ hr = DMUS_E_UNSUPPORTED_STREAM;
+ }
+ else
+ hr = DMUS_E_UNSUPPORTED_STREAM;
+
+ return hr;
}
static const IPersistStreamVtbl persiststream_vtbl = {
@@ -313,6 +456,7 @@ HRESULT WINAPI create_dmwavetrack(REFIID lpcGUID, void **ppobj)
dmobject_init(&track->dmobj, &CLSID_DirectMusicWaveTrack,
(IUnknown *)&track->IDirectMusicTrack8_iface);
track->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl;
+ list_init(&track->items);
DMIME_LockModule();
hr = IDirectMusicTrack8_QueryInterface(&track->IDirectMusicTrack8_iface, lpcGUID, ppobj);
--
2.33.0
Nov. 1, 2021
[PATCH v2 8/8] winedbg: Implement GDB qXfer object exec-file.
by Jinoh Kang
Remove the necessity of using the `file` command to specify the
executable.
Otherwise, RHEL's downstream GDB complains with the following message:
Remote gdbserver does not support determining executable automatically.
RHEL <=6.8 and <=7.2 versions of gdbserver do not support such automatic executable detection.
The following versions of gdbserver support it:
- Upstream version of gdbserver (unsupported) 7.10 or later
- Red Hat Developer Toolset (DTS) version of gdbserver from DTS 4.0 or later (only on x86_64)
- RHEL-7.3 versions of gdbserver (on any architecture)
Signed-off-by: Jinoh Kang <jinoh.kang.kr(a)gmail.com>
---
programs/winedbg/gdbproxy.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c
index 19ad76910af..27f59aac259 100644
--- a/programs/winedbg/gdbproxy.c
+++ b/programs/winedbg/gdbproxy.c
@@ -99,7 +99,10 @@ struct gdb_context
/* assume standard signal and errno values */
enum host_error
{
+ HOST_EPERM = 1,
+ HOST_ENOENT = 2,
HOST_ESRCH = 3,
+ HOST_ENOMEM = 12,
HOST_EFAULT = 14,
HOST_EINVAL = 22,
};
@@ -1963,6 +1966,33 @@ static enum packet_return packet_query_features(struct gdb_context* gdbctx)
return packet_reply_error(gdbctx, 0);
}
+static enum packet_return packet_query_exec_file(struct gdb_context* gdbctx)
+{
+ struct vl_buffer *vlbuf = &gdbctx->qxfer_buffer;
+ struct dbg_process* process = gdbctx->process;
+ char *unix_path;
+ BOOL is_wow64;
+ char *tmp;
+
+ if (!process) return packet_error;
+
+ if (gdbctx->qxfer_object_annex[0] || !process->imageName)
+ return packet_reply_error(gdbctx, HOST_EPERM);
+
+ if (!(unix_path = wine_get_unix_file_name(process->imageName)))
+ return packet_reply_error(gdbctx, GetLastError() == ERROR_NOT_ENOUGH_MEMORY ? HOST_ENOMEM : HOST_ENOENT);
+
+ if (IsWow64Process(process->handle, &is_wow64) &&
+ is_wow64 && (tmp = strstr(unix_path, "system32")))
+ memcpy(tmp, "syswow64", 8);
+
+ vl_append_str(vlbuf, unix_path);
+
+ HeapFree(GetProcessHeap(), 0, unix_path);
+
+ return packet_send_buffer;
+}
+
struct qxfer
{
const char* name;
@@ -1972,6 +2002,7 @@ struct qxfer
{"libraries", packet_query_libraries},
{"threads" , packet_query_threads },
{"features" , packet_query_features },
+ {"exec-file", packet_query_exec_file},
};
static BOOL parse_xfer_read(const char *ptr, char *name_buf, size_t name_buf_size, char *annex_buf, size_t annex_buf_size, unsigned int *offp, unsigned int *lenp)
--
2.31.1
Nov. 1, 2021