ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
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
List overview
Download
Ros-diffs
February 2021
----- 2024 -----
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
30 participants
434 discussions
Start a n
N
ew thread
[reactos] 209/218: [WINESYNC] d3dx9_36/tests: Add additional tests for special cases.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=81b6936ac86306071ab65…
commit 81b6936ac86306071ab652eb9e5434d2189dae7e Author: winesync <ros-dev(a)reactos.org> AuthorDate: Tue Jan 5 13:22:40 2021 +0100 Commit: Jérôme Gardou <jerome.gardou(a)reactos.org> CommitDate: Thu Feb 4 16:37:07 2021 +0100 [WINESYNC] d3dx9_36/tests: Add additional tests for special cases. wine-staging patch by Christian Costa <titan.costa(a)gmail.com> --- modules/rostests/winetests/d3dx9_36/shader.c | 163 ++++++++++++++++++ ...ts__Add_additional_tests_for_special_cases.diff | 188 +++++++++++++++++++++ 2 files changed, 351 insertions(+) diff --git a/modules/rostests/winetests/d3dx9_36/shader.c b/modules/rostests/winetests/d3dx9_36/shader.c index 5edac61ae8d..0ae8f27b03c 100644 --- a/modules/rostests/winetests/d3dx9_36/shader.c +++ b/modules/rostests/winetests/d3dx9_36/shader.c @@ -6623,6 +6623,60 @@ static void test_fragment_linker(void) DestroyWindow(window); } +static const DWORD ps_tex[] = { + 0xffff0103, /* ps_1_3 */ + 0x00000042, 0xb00f0000, /* tex t0 */ + 0x00000000, /* nop */ + 0x0000ffff}; + +static const DWORD ps_texld_1_4[] = { + 0xffff0104, /* ps_1_4 */ + 0x00000042, 0xb00f0000, 0xa0e40000, /* texld t0, c0 */ + 0x00000000, /* nop */ + 0x0000ffff}; + +static const DWORD ps_texld_2_0[] = { + 0xffff0200, /* ps_2_0 */ + 0x00000042, 0xb00f0000, 0xa0e40000, 0xa0e40001, /* texld t0, c0, c1 */ + 0x00000000, /* nop */ + 0x0000ffff}; + +static const DWORD ps_texcoord[] = { + 0xffff0103, /* ps_1_4 */ + 0x00000040, 0xb00f0000, /* texcoord t0 */ + 0x00000000, /* nop */ + 0x0000ffff}; + +static const DWORD ps_texcrd[] = { + 0xffff0104, /* ps_2_0 */ + 0x00000040, 0xb00f0000, 0xa0e40000, /* texcrd t0, c0 */ + 0x00000000, /* nop */ + 0x0000ffff}; + +static const DWORD ps_sincos_2_0[] = { + 0xffff0200, /* ps_2_0 */ + 0x00000025, 0xb00f0000, 0xa0e40000, 0xa0e40001, 0xa0e40002, /* sincos t0, c0, c1, c2 */ + 0x00000000, /* nop */ + 0x0000ffff}; + +static const DWORD ps_sincos_3_0[] = { + 0xffff0300, /* ps_3_0 */ + 0x00000025, 0xb00f0000, 0xa0e40000, /* sincos t0, c0 */ + 0x00000000, /* nop */ + 0x0000ffff}; + +static const DWORD vs_sincos_2_0[] = { + 0xfffe0200, /* vs_2_0 */ + 0x00000025, 0xb00f0000, 0xa0e40000, 0xa0e40001, 0xa0e40002, /* sincos a0, c0, c1, c2 */ + 0x00000000, /* nop */ + 0x0000ffff}; + +static const DWORD vs_sincos_3_0[] = { + 0xfffe0300, /* vs_3_0 */ + 0x00000025, 0xb00f0000, 0xa0e40000, /* sincos a0, c0 */ + 0x00000000, /* nop */ + 0x0000ffff}; + static void test_disassemble_shader(void) { static const char disasm_vs[] = " vs_1_1\n" @@ -6637,6 +6691,33 @@ static void test_disassemble_shader(void) " dp3 r0, c1, c0\n" " mul r0, v0, r0\n" " mul r0, t0, r0\n"; + static const char disasm_ps_tex[] = " ps_1_3\n" + " tex t0\n" + " nop\n"; + static const char disasm_ps_texld_1_4[] = " ps_1_4\n" + " texld t0, c0\n" + " nop\n"; + static const char disasm_ps_texld_2_0[] = " ps_2_0\n" + " texld t0, c0, c1\n" + " nop\n"; + static const char disasm_ps_texcoord[] = " ps_1_3\n" + " texcoord t0\n" + " nop\n"; + static const char disasm_ps_texcrd[] = " ps_1_4\n" + " texcrd t0, c0\n" + " nop\n"; + static const char disasm_ps_sincos_2_0[] = " ps_2_0\n" + " sincos t0, c0, c1, c2\n" + " nop\n"; + static const char disasm_ps_sincos_3_0[] = " ps_3_0\n" + " sincos t0, c0\n" + " nop\n"; + static const char disasm_vs_sincos_2_0[] = " vs_2_0\n" + " sincos a0, c0, c1, c2\n" + " nop\n"; + static const char disasm_vs_sincos_3_0[] = " vs_3_0\n" + " sincos a0, c0\n" + " nop\n"; ID3DXBuffer *disassembly; HRESULT ret; char *ptr; @@ -6666,6 +6747,88 @@ static void test_disassemble_shader(void) ok(!memcmp(ptr, disasm_ps, sizeof(disasm_ps) - 1), /* compare beginning */ "Returned '%s', expected '%s'\n", ptr, disasm_ps); ID3DXBuffer_Release(disassembly); + + /* Test tex instruction with pixel shader 1.3 */ + disassembly = (void *)0xdeadbeef; + ret = D3DXDisassembleShader(ps_tex, FALSE, NULL, &disassembly); + ok(ret == D3D_OK, "Failed with %#x\n", ret); + ptr = ID3DXBuffer_GetBufferPointer(disassembly); + ok(!memcmp(ptr, disasm_ps_tex, sizeof(disasm_ps_tex) - 1), /* compare beginning */ + "Returned '%s', expected '%s'\n", ptr, disasm_ps_tex); + ID3DXBuffer_Release(disassembly); + + /* Test texld instruction with pixel shader 1.4 */ + disassembly = (void *)0xdeadbeef; + ret = D3DXDisassembleShader(ps_texld_1_4, FALSE, NULL, &disassembly); + ok(ret == D3D_OK, "Failed with %#x\n", ret); + ptr = ID3DXBuffer_GetBufferPointer(disassembly); + ok(!memcmp(ptr, disasm_ps_texld_1_4, sizeof(disasm_ps_texld_1_4) - 1), /* compare beginning */ + "Returned '%s', expected '%s'\n", ptr, disasm_ps_texld_1_4); + ID3DXBuffer_Release(disassembly); + + /* Test texld instruction with pixel shader 2.0 */ + disassembly = (void *)0xdeadbeef; + ret = D3DXDisassembleShader(ps_texld_2_0, FALSE, NULL, &disassembly); + ok(ret == D3D_OK, "Failed with %#x\n", ret); + ptr = ID3DXBuffer_GetBufferPointer(disassembly); + ok(!memcmp(ptr, disasm_ps_texld_2_0, sizeof(disasm_ps_texld_2_0) - 1), /* compare beginning */ + "Returned '%s', expected '%s'\n", ptr, disasm_ps_texld_2_0); + ID3DXBuffer_Release(disassembly); + + /* Test texcoord instruction with pixel shader 1.3 */ + disassembly = (void *)0xdeadbeef; + ret = D3DXDisassembleShader(ps_texcoord, FALSE, NULL, &disassembly); + ok(ret == D3D_OK, "Failed with %#x\n", ret); + ptr = ID3DXBuffer_GetBufferPointer(disassembly); + ok(!memcmp(ptr, disasm_ps_texcoord, sizeof(disasm_ps_texcoord) - 1), /* compare beginning */ + "Returned '%s', expected '%s'\n", ptr, disasm_ps_texcoord); + ID3DXBuffer_Release(disassembly); + + /* Test texcrd instruction with pixel shader 1.4 */ + disassembly = (void *)0xdeadbeef; + ret = D3DXDisassembleShader(ps_texcrd, FALSE, NULL, &disassembly); + ok(ret == D3D_OK, "Failed with %#x\n", ret); + ptr = ID3DXBuffer_GetBufferPointer(disassembly); + ok(!memcmp(ptr, disasm_ps_texcrd, sizeof(disasm_ps_texcrd) - 1), /* compare beginning */ + "Returned '%s', expected '%s'\n", ptr, disasm_ps_texcrd); + ID3DXBuffer_Release(disassembly); + + /* Test sincos instruction pixel shader 2.0 */ + disassembly = (void *)0xdeadbeef; + ret = D3DXDisassembleShader(ps_sincos_2_0, FALSE, NULL, &disassembly); + ok(ret == D3D_OK, "Failed with %#x\n", ret); + ptr = ID3DXBuffer_GetBufferPointer(disassembly); + ok(!memcmp(ptr, disasm_ps_sincos_2_0, sizeof(disasm_ps_sincos_2_0) - 1), /* compare beginning */ + "Returned '%s', expected '%s'\n", ptr, disasm_ps_sincos_2_0); + ID3DXBuffer_Release(disassembly); + + /* Test sincos instruction with pixel shader 3.0 */ + disassembly = (void *)0xdeadbeef; + ret = D3DXDisassembleShader(ps_sincos_3_0, FALSE, NULL, &disassembly); + ok(ret == D3D_OK, "Failed with %#x\n", ret); + ptr = ID3DXBuffer_GetBufferPointer(disassembly); + ok(!memcmp(ptr, disasm_ps_sincos_3_0, sizeof(disasm_ps_sincos_3_0) - 1), /* compare beginning */ + "Returned '%s', expected '%s'\n", ptr, disasm_ps_sincos_3_0); + ID3DXBuffer_Release(disassembly); + + /* Test sincos instruction with pixel shader 2.0 */ + disassembly = (void *)0xdeadbeef; + ret = D3DXDisassembleShader(vs_sincos_2_0, FALSE, NULL, &disassembly); + ok(ret == D3D_OK, "Failed with %#x\n", ret); + ptr = ID3DXBuffer_GetBufferPointer(disassembly); + ok(!memcmp(ptr, disasm_vs_sincos_2_0, sizeof(disasm_vs_sincos_2_0) - 1), /* compare beginning */ + "Returned '%s', expected '%s'\n", ptr, disasm_vs_sincos_2_0); + ID3DXBuffer_Release(disassembly); + + /* Test sincos instruction with pixel shader 3.0 */ + disassembly = (void *)0xdeadbeef; + ret = D3DXDisassembleShader(vs_sincos_3_0, FALSE, NULL, &disassembly); + ok(ret == D3D_OK, "Failed with %#x\n", ret); + ptr = ID3DXBuffer_GetBufferPointer(disassembly); + ok(!memcmp(ptr, disasm_vs_sincos_3_0, sizeof(disasm_vs_sincos_3_0) - 1), /* compare beginning */ + "Returned '%s', expected '%s'\n", ptr, disasm_vs_sincos_3_0); + ID3DXBuffer_Release(disassembly); + } START_TEST(shader) diff --git a/sdk/tools/winesync/d3dx9_staging/0006-d3dx9_36_tests__Add_additional_tests_for_special_cases.diff b/sdk/tools/winesync/d3dx9_staging/0006-d3dx9_36_tests__Add_additional_tests_for_special_cases.diff new file mode 100644 index 00000000000..81f71b0ff4c --- /dev/null +++ b/sdk/tools/winesync/d3dx9_staging/0006-d3dx9_36_tests__Add_additional_tests_for_special_cases.diff @@ -0,0 +1,188 @@ +diff --git a/modules/rostests/winetests/d3dx9_36/shader.c b/modules/rostests/winetests/d3dx9_36/shader.c +index 5edac61..0ae8f27 100644 +--- a/modules/rostests/winetests/d3dx9_36/shader.c ++++ b/modules/rostests/winetests/d3dx9_36/shader.c +@@ -6623,6 +6623,60 @@ static void test_fragment_linker(void) + DestroyWindow(window); + } + ++static const DWORD ps_tex[] = { ++ 0xffff0103, /* ps_1_3 */ ++ 0x00000042, 0xb00f0000, /* tex t0 */ ++ 0x00000000, /* nop */ ++ 0x0000ffff}; ++ ++static const DWORD ps_texld_1_4[] = { ++ 0xffff0104, /* ps_1_4 */ ++ 0x00000042, 0xb00f0000, 0xa0e40000, /* texld t0, c0 */ ++ 0x00000000, /* nop */ ++ 0x0000ffff}; ++ ++static const DWORD ps_texld_2_0[] = { ++ 0xffff0200, /* ps_2_0 */ ++ 0x00000042, 0xb00f0000, 0xa0e40000, 0xa0e40001, /* texld t0, c0, c1 */ ++ 0x00000000, /* nop */ ++ 0x0000ffff}; ++ ++static const DWORD ps_texcoord[] = { ++ 0xffff0103, /* ps_1_4 */ ++ 0x00000040, 0xb00f0000, /* texcoord t0 */ ++ 0x00000000, /* nop */ ++ 0x0000ffff}; ++ ++static const DWORD ps_texcrd[] = { ++ 0xffff0104, /* ps_2_0 */ ++ 0x00000040, 0xb00f0000, 0xa0e40000, /* texcrd t0, c0 */ ++ 0x00000000, /* nop */ ++ 0x0000ffff}; ++ ++static const DWORD ps_sincos_2_0[] = { ++ 0xffff0200, /* ps_2_0 */ ++ 0x00000025, 0xb00f0000, 0xa0e40000, 0xa0e40001, 0xa0e40002, /* sincos t0, c0, c1, c2 */ ++ 0x00000000, /* nop */ ++ 0x0000ffff}; ++ ++static const DWORD ps_sincos_3_0[] = { ++ 0xffff0300, /* ps_3_0 */ ++ 0x00000025, 0xb00f0000, 0xa0e40000, /* sincos t0, c0 */ ++ 0x00000000, /* nop */ ++ 0x0000ffff}; ++ ++static const DWORD vs_sincos_2_0[] = { ++ 0xfffe0200, /* vs_2_0 */ ++ 0x00000025, 0xb00f0000, 0xa0e40000, 0xa0e40001, 0xa0e40002, /* sincos a0, c0, c1, c2 */ ++ 0x00000000, /* nop */ ++ 0x0000ffff}; ++ ++static const DWORD vs_sincos_3_0[] = { ++ 0xfffe0300, /* vs_3_0 */ ++ 0x00000025, 0xb00f0000, 0xa0e40000, /* sincos a0, c0 */ ++ 0x00000000, /* nop */ ++ 0x0000ffff}; ++ + static void test_disassemble_shader(void) + { + static const char disasm_vs[] = " vs_1_1\n" +@@ -6637,6 +6691,33 @@ static void test_disassemble_shader(void) + " dp3 r0, c1, c0\n" + " mul r0, v0, r0\n" + " mul r0, t0, r0\n"; ++ static const char disasm_ps_tex[] = " ps_1_3\n" ++ " tex t0\n" ++ " nop\n"; ++ static const char disasm_ps_texld_1_4[] = " ps_1_4\n" ++ " texld t0, c0\n" ++ " nop\n"; ++ static const char disasm_ps_texld_2_0[] = " ps_2_0\n" ++ " texld t0, c0, c1\n" ++ " nop\n"; ++ static const char disasm_ps_texcoord[] = " ps_1_3\n" ++ " texcoord t0\n" ++ " nop\n"; ++ static const char disasm_ps_texcrd[] = " ps_1_4\n" ++ " texcrd t0, c0\n" ++ " nop\n"; ++ static const char disasm_ps_sincos_2_0[] = " ps_2_0\n" ++ " sincos t0, c0, c1, c2\n" ++ " nop\n"; ++ static const char disasm_ps_sincos_3_0[] = " ps_3_0\n" ++ " sincos t0, c0\n" ++ " nop\n"; ++ static const char disasm_vs_sincos_2_0[] = " vs_2_0\n" ++ " sincos a0, c0, c1, c2\n" ++ " nop\n"; ++ static const char disasm_vs_sincos_3_0[] = " vs_3_0\n" ++ " sincos a0, c0\n" ++ " nop\n"; + ID3DXBuffer *disassembly; + HRESULT ret; + char *ptr; +@@ -6666,6 +6747,88 @@ static void test_disassemble_shader(void) + ok(!memcmp(ptr, disasm_ps, sizeof(disasm_ps) - 1), /* compare beginning */ + "Returned '%s', expected '%s'\n", ptr, disasm_ps); + ID3DXBuffer_Release(disassembly); ++ ++ /* Test tex instruction with pixel shader 1.3 */ ++ disassembly = (void *)0xdeadbeef; ++ ret = D3DXDisassembleShader(ps_tex, FALSE, NULL, &disassembly); ++ ok(ret == D3D_OK, "Failed with %#x\n", ret); ++ ptr = ID3DXBuffer_GetBufferPointer(disassembly); ++ ok(!memcmp(ptr, disasm_ps_tex, sizeof(disasm_ps_tex) - 1), /* compare beginning */ ++ "Returned '%s', expected '%s'\n", ptr, disasm_ps_tex); ++ ID3DXBuffer_Release(disassembly); ++ ++ /* Test texld instruction with pixel shader 1.4 */ ++ disassembly = (void *)0xdeadbeef; ++ ret = D3DXDisassembleShader(ps_texld_1_4, FALSE, NULL, &disassembly); ++ ok(ret == D3D_OK, "Failed with %#x\n", ret); ++ ptr = ID3DXBuffer_GetBufferPointer(disassembly); ++ ok(!memcmp(ptr, disasm_ps_texld_1_4, sizeof(disasm_ps_texld_1_4) - 1), /* compare beginning */ ++ "Returned '%s', expected '%s'\n", ptr, disasm_ps_texld_1_4); ++ ID3DXBuffer_Release(disassembly); ++ ++ /* Test texld instruction with pixel shader 2.0 */ ++ disassembly = (void *)0xdeadbeef; ++ ret = D3DXDisassembleShader(ps_texld_2_0, FALSE, NULL, &disassembly); ++ ok(ret == D3D_OK, "Failed with %#x\n", ret); ++ ptr = ID3DXBuffer_GetBufferPointer(disassembly); ++ ok(!memcmp(ptr, disasm_ps_texld_2_0, sizeof(disasm_ps_texld_2_0) - 1), /* compare beginning */ ++ "Returned '%s', expected '%s'\n", ptr, disasm_ps_texld_2_0); ++ ID3DXBuffer_Release(disassembly); ++ ++ /* Test texcoord instruction with pixel shader 1.3 */ ++ disassembly = (void *)0xdeadbeef; ++ ret = D3DXDisassembleShader(ps_texcoord, FALSE, NULL, &disassembly); ++ ok(ret == D3D_OK, "Failed with %#x\n", ret); ++ ptr = ID3DXBuffer_GetBufferPointer(disassembly); ++ ok(!memcmp(ptr, disasm_ps_texcoord, sizeof(disasm_ps_texcoord) - 1), /* compare beginning */ ++ "Returned '%s', expected '%s'\n", ptr, disasm_ps_texcoord); ++ ID3DXBuffer_Release(disassembly); ++ ++ /* Test texcrd instruction with pixel shader 1.4 */ ++ disassembly = (void *)0xdeadbeef; ++ ret = D3DXDisassembleShader(ps_texcrd, FALSE, NULL, &disassembly); ++ ok(ret == D3D_OK, "Failed with %#x\n", ret); ++ ptr = ID3DXBuffer_GetBufferPointer(disassembly); ++ ok(!memcmp(ptr, disasm_ps_texcrd, sizeof(disasm_ps_texcrd) - 1), /* compare beginning */ ++ "Returned '%s', expected '%s'\n", ptr, disasm_ps_texcrd); ++ ID3DXBuffer_Release(disassembly); ++ ++ /* Test sincos instruction pixel shader 2.0 */ ++ disassembly = (void *)0xdeadbeef; ++ ret = D3DXDisassembleShader(ps_sincos_2_0, FALSE, NULL, &disassembly); ++ ok(ret == D3D_OK, "Failed with %#x\n", ret); ++ ptr = ID3DXBuffer_GetBufferPointer(disassembly); ++ ok(!memcmp(ptr, disasm_ps_sincos_2_0, sizeof(disasm_ps_sincos_2_0) - 1), /* compare beginning */ ++ "Returned '%s', expected '%s'\n", ptr, disasm_ps_sincos_2_0); ++ ID3DXBuffer_Release(disassembly); ++ ++ /* Test sincos instruction with pixel shader 3.0 */ ++ disassembly = (void *)0xdeadbeef; ++ ret = D3DXDisassembleShader(ps_sincos_3_0, FALSE, NULL, &disassembly); ++ ok(ret == D3D_OK, "Failed with %#x\n", ret); ++ ptr = ID3DXBuffer_GetBufferPointer(disassembly); ++ ok(!memcmp(ptr, disasm_ps_sincos_3_0, sizeof(disasm_ps_sincos_3_0) - 1), /* compare beginning */ ++ "Returned '%s', expected '%s'\n", ptr, disasm_ps_sincos_3_0); ++ ID3DXBuffer_Release(disassembly); ++ ++ /* Test sincos instruction with pixel shader 2.0 */ ++ disassembly = (void *)0xdeadbeef; ++ ret = D3DXDisassembleShader(vs_sincos_2_0, FALSE, NULL, &disassembly); ++ ok(ret == D3D_OK, "Failed with %#x\n", ret); ++ ptr = ID3DXBuffer_GetBufferPointer(disassembly); ++ ok(!memcmp(ptr, disasm_vs_sincos_2_0, sizeof(disasm_vs_sincos_2_0) - 1), /* compare beginning */ ++ "Returned '%s', expected '%s'\n", ptr, disasm_vs_sincos_2_0); ++ ID3DXBuffer_Release(disassembly); ++ ++ /* Test sincos instruction with pixel shader 3.0 */ ++ disassembly = (void *)0xdeadbeef; ++ ret = D3DXDisassembleShader(vs_sincos_3_0, FALSE, NULL, &disassembly); ++ ok(ret == D3D_OK, "Failed with %#x\n", ret); ++ ptr = ID3DXBuffer_GetBufferPointer(disassembly); ++ ok(!memcmp(ptr, disasm_vs_sincos_3_0, sizeof(disasm_vs_sincos_3_0) - 1), /* compare beginning */ ++ "Returned '%s', expected '%s'\n", ptr, disasm_vs_sincos_3_0); ++ ID3DXBuffer_Release(disassembly); ++ + } + + START_TEST(shader)
3 years, 9 months
1
0
0
0
[reactos] 208/218: [WINESYNC] d3dx9_36/tests: Add initial tests for D3DXDisassembleShader.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=51b19f6605abc04ed15a6…
commit 51b19f6605abc04ed15a63bffb9e871a2d971753 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Tue Jan 5 13:22:40 2021 +0100 Commit: Jérôme Gardou <jerome.gardou(a)reactos.org> CommitDate: Thu Feb 4 16:37:07 2021 +0100 [WINESYNC] d3dx9_36/tests: Add initial tests for D3DXDisassembleShader. wine-staging patch by Sebastian Lackner <sebastian(a)fds-team.de> --- modules/rostests/winetests/d3dx9_36/shader.c | 46 ++++++++++++++++ ...dd_initial_tests_for_D3DXDisassembleShader.diff | 62 ++++++++++++++++++++++ 2 files changed, 108 insertions(+) diff --git a/modules/rostests/winetests/d3dx9_36/shader.c b/modules/rostests/winetests/d3dx9_36/shader.c index e2925faad69..5edac61ae8d 100644 --- a/modules/rostests/winetests/d3dx9_36/shader.c +++ b/modules/rostests/winetests/d3dx9_36/shader.c @@ -6623,6 +6623,51 @@ static void test_fragment_linker(void) DestroyWindow(window); } +static void test_disassemble_shader(void) +{ + static const char disasm_vs[] = " vs_1_1\n" + " dcl_position v0\n" + " dp4 oPos.x, v0, c0\n" + " dp4 oPos.y, v0, c1\n" + " dp4 oPos.z, v0, c2\n" + " dp4 oPos.w, v0, c3\n"; + static const char disasm_ps[] = " ps_1_1\n" + " def c1, 1, 0, 0, 0\n" + " tex t0\n" + " dp3 r0, c1, c0\n" + " mul r0, v0, r0\n" + " mul r0, t0, r0\n"; + ID3DXBuffer *disassembly; + HRESULT ret; + char *ptr; + + /* Check wrong parameters */ + ret = D3DXDisassembleShader(NULL, FALSE, NULL, NULL); + ok(ret == D3DERR_INVALIDCALL, "Returned %#x, expected %#x\n", ret, D3DERR_INVALIDCALL); + ret = D3DXDisassembleShader(NULL, FALSE, NULL, &disassembly); + ok(ret == D3DERR_INVALIDCALL, "Returned %#x, expected %#x\n", ret, D3DERR_INVALIDCALL); + ret = D3DXDisassembleShader(simple_vs, FALSE, NULL, NULL); + ok(ret == D3DERR_INVALIDCALL, "Returned %#x, expected %#x\n", ret, D3DERR_INVALIDCALL); + + /* Test with vertex shader */ + disassembly = (void *)0xdeadbeef; + ret = D3DXDisassembleShader(simple_vs, FALSE, NULL, &disassembly); + ok(ret == D3D_OK, "Failed with %#x\n", ret); + ptr = ID3DXBuffer_GetBufferPointer(disassembly); + ok(!memcmp(ptr, disasm_vs, sizeof(disasm_vs) - 1), /* compare beginning */ + "Returned '%s', expected '%s'\n", ptr, disasm_vs); + ID3DXBuffer_Release(disassembly); + + /* Test with pixel shader */ + disassembly = (void *)0xdeadbeef; + ret = D3DXDisassembleShader(simple_ps, FALSE, NULL, &disassembly); + ok(ret == D3D_OK, "Failed with %#x\n", ret); + ptr = ID3DXBuffer_GetBufferPointer(disassembly); + ok(!memcmp(ptr, disasm_ps, sizeof(disasm_ps) - 1), /* compare beginning */ + "Returned '%s', expected '%s'\n", ptr, disasm_ps); + ID3DXBuffer_Release(disassembly); +} + START_TEST(shader) { test_get_shader_size(); @@ -6638,4 +6683,5 @@ START_TEST(shader) test_registerset_defaults(); test_shader_semantics(); test_fragment_linker(); + test_disassemble_shader(); } diff --git a/sdk/tools/winesync/d3dx9_staging/0005-d3dx9_36_tests__Add_initial_tests_for_D3DXDisassembleShader.diff b/sdk/tools/winesync/d3dx9_staging/0005-d3dx9_36_tests__Add_initial_tests_for_D3DXDisassembleShader.diff new file mode 100644 index 00000000000..ff1644850f1 --- /dev/null +++ b/sdk/tools/winesync/d3dx9_staging/0005-d3dx9_36_tests__Add_initial_tests_for_D3DXDisassembleShader.diff @@ -0,0 +1,62 @@ +diff --git a/modules/rostests/winetests/d3dx9_36/shader.c b/modules/rostests/winetests/d3dx9_36/shader.c +index e2925fa..5edac61 100644 +--- a/modules/rostests/winetests/d3dx9_36/shader.c ++++ b/modules/rostests/winetests/d3dx9_36/shader.c +@@ -6623,6 +6623,51 @@ static void test_fragment_linker(void) + DestroyWindow(window); + } + ++static void test_disassemble_shader(void) ++{ ++ static const char disasm_vs[] = " vs_1_1\n" ++ " dcl_position v0\n" ++ " dp4 oPos.x, v0, c0\n" ++ " dp4 oPos.y, v0, c1\n" ++ " dp4 oPos.z, v0, c2\n" ++ " dp4 oPos.w, v0, c3\n"; ++ static const char disasm_ps[] = " ps_1_1\n" ++ " def c1, 1, 0, 0, 0\n" ++ " tex t0\n" ++ " dp3 r0, c1, c0\n" ++ " mul r0, v0, r0\n" ++ " mul r0, t0, r0\n"; ++ ID3DXBuffer *disassembly; ++ HRESULT ret; ++ char *ptr; ++ ++ /* Check wrong parameters */ ++ ret = D3DXDisassembleShader(NULL, FALSE, NULL, NULL); ++ ok(ret == D3DERR_INVALIDCALL, "Returned %#x, expected %#x\n", ret, D3DERR_INVALIDCALL); ++ ret = D3DXDisassembleShader(NULL, FALSE, NULL, &disassembly); ++ ok(ret == D3DERR_INVALIDCALL, "Returned %#x, expected %#x\n", ret, D3DERR_INVALIDCALL); ++ ret = D3DXDisassembleShader(simple_vs, FALSE, NULL, NULL); ++ ok(ret == D3DERR_INVALIDCALL, "Returned %#x, expected %#x\n", ret, D3DERR_INVALIDCALL); ++ ++ /* Test with vertex shader */ ++ disassembly = (void *)0xdeadbeef; ++ ret = D3DXDisassembleShader(simple_vs, FALSE, NULL, &disassembly); ++ ok(ret == D3D_OK, "Failed with %#x\n", ret); ++ ptr = ID3DXBuffer_GetBufferPointer(disassembly); ++ ok(!memcmp(ptr, disasm_vs, sizeof(disasm_vs) - 1), /* compare beginning */ ++ "Returned '%s', expected '%s'\n", ptr, disasm_vs); ++ ID3DXBuffer_Release(disassembly); ++ ++ /* Test with pixel shader */ ++ disassembly = (void *)0xdeadbeef; ++ ret = D3DXDisassembleShader(simple_ps, FALSE, NULL, &disassembly); ++ ok(ret == D3D_OK, "Failed with %#x\n", ret); ++ ptr = ID3DXBuffer_GetBufferPointer(disassembly); ++ ok(!memcmp(ptr, disasm_ps, sizeof(disasm_ps) - 1), /* compare beginning */ ++ "Returned '%s', expected '%s'\n", ptr, disasm_ps); ++ ID3DXBuffer_Release(disassembly); ++} ++ + START_TEST(shader) + { + test_get_shader_size(); +@@ -6638,4 +6683,5 @@ START_TEST(shader) + test_registerset_defaults(); + test_shader_semantics(); + test_fragment_linker(); ++ test_disassemble_shader(); + }
3 years, 9 months
1
0
0
0
[reactos] 207/218: [WINESYNC] d3dx9_36: Implement D3DXDisassembleShader. (v2)
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7e6d9c5b393caf6486ee1…
commit 7e6d9c5b393caf6486ee1b2ec40a684c2264588b Author: winesync <ros-dev(a)reactos.org> AuthorDate: Tue Jan 5 13:16:41 2021 +0100 Commit: Jérôme Gardou <jerome.gardou(a)reactos.org> CommitDate: Thu Feb 4 16:37:07 2021 +0100 [WINESYNC] d3dx9_36: Implement D3DXDisassembleShader. (v2) Changes in v2 (by Christian Costa): * More generic code for D3DXDisassembleShader. wine-staging patch by Christian Costa <titan.costa(a)gmail.com> --- dll/directx/wine/d3dx9_36/shader.c | 331 ++++++++++++++++++- ..._36__Implement_D3DXDisassembleShader._(v2).diff | 358 +++++++++++++++++++++ 2 files changed, 686 insertions(+), 3 deletions(-) diff --git a/dll/directx/wine/d3dx9_36/shader.c b/dll/directx/wine/d3dx9_36/shader.c index 6a038265d11..c54bacc364b 100644 --- a/dll/directx/wine/d3dx9_36/shader.c +++ b/dll/directx/wine/d3dx9_36/shader.c @@ -4,6 +4,7 @@ /* * Copyright 2008 Luis Busquets * Copyright 2009 Matteo Bruni + * Copyright 2010, 2013, 2016 Christian Costa * Copyright 2011 Travis Athougies * * This library is free software; you can redistribute it and/or @@ -21,7 +22,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ - +#include <stdio.h> #include "d3dx9_private.h" #include "d3dcommon.h" #include "d3dcompiler.h" @@ -2341,10 +2342,334 @@ HRESULT WINAPI D3DXGetShaderSamplers(const DWORD *byte_code, const char **sample return D3D_OK; } + +static const char *decl_usage[] = { "position", "blendweight", "blendindices", "normal", "psize", "texcoord", + "tangent", "binormal", "tessfactor", "positiont", "color" }; + +static const char *tex_type[] = { "", "1d", "2d", "cube", "volume" }; + +static int add_modifier(char *buffer, DWORD param) +{ + char *buf = buffer; + DWORD dst_mod = param & D3DSP_DSTMOD_MASK; + + if (dst_mod & D3DSPDM_SATURATE) + buf += sprintf(buf, "_sat"); + if (dst_mod & D3DSPDM_PARTIALPRECISION) + buf += sprintf(buf, "_pp"); + if (dst_mod & D3DSPDM_MSAMPCENTROID) + buf += sprintf(buf, "_centroid"); + + return buf - buffer; +} + +static int add_register(char *buffer, DWORD param, BOOL dst, BOOL ps) +{ + char *buf = buffer; + DWORD reg_type = ((param & D3DSP_REGTYPE_MASK2) >> D3DSP_REGTYPE_SHIFT2) + | ((param & D3DSP_REGTYPE_MASK) >> D3DSP_REGTYPE_SHIFT); + DWORD reg_num = param & D3DSP_REGNUM_MASK; + + if (reg_type == D3DSPR_INPUT) + buf += sprintf(buf, "v%d", reg_num); + else if (reg_type == D3DSPR_CONST) + buf += sprintf(buf, "c%d", reg_num); + else if (reg_type == D3DSPR_TEMP) + buf += sprintf(buf, "r%d", reg_num); + else if (reg_type == D3DSPR_ADDR) + buf += sprintf(buf, "%s%d", ps ? "t" : "a", reg_num); + else if (reg_type == D3DSPR_SAMPLER) + buf += sprintf(buf, "s%d", reg_num); + else if (reg_type == D3DSPR_RASTOUT) + buf += sprintf(buf, "oPos"); + else if (reg_type == D3DSPR_COLOROUT) + buf += sprintf(buf, "oC%d", reg_num); + else if (reg_type == D3DSPR_TEXCRDOUT) + buf += sprintf(buf, "oT%d", reg_num); + else if (reg_type == D3DSPR_ATTROUT) + buf += sprintf(buf, "oD%d", reg_num); + else + buf += sprintf(buf, "? (%d)", reg_type); + + if (dst) + { + if ((param & D3DSP_WRITEMASK_ALL) != D3DSP_WRITEMASK_ALL) + { + buf += sprintf(buf, ".%s%s%s%s", param & D3DSP_WRITEMASK_0 ? "x" : "", + param & D3DSP_WRITEMASK_1 ? "y" : "", + param & D3DSP_WRITEMASK_2 ? "z" : "", + param & D3DSP_WRITEMASK_3 ? "w" : ""); + } + } + else + { + if ((param & D3DVS_SWIZZLE_MASK) != D3DVS_NOSWIZZLE) + { + if ( ((param & D3DSP_SWIZZLE_MASK) == (D3DVS_X_X | D3DVS_Y_X | D3DVS_Z_X | D3DVS_W_X)) || + ((param & D3DSP_SWIZZLE_MASK) == (D3DVS_X_Y | D3DVS_Y_Y | D3DVS_Z_Y | D3DVS_W_Y)) || + ((param & D3DSP_SWIZZLE_MASK) == (D3DVS_X_Z | D3DVS_Y_Z | D3DVS_Z_Z | D3DVS_W_Z)) || + ((param & D3DSP_SWIZZLE_MASK) == (D3DVS_X_W | D3DVS_Y_W | D3DVS_Z_W | D3DVS_W_W)) ) + buf += sprintf(buf, ".%c", 'w' + (((param >> D3DVS_SWIZZLE_SHIFT) + 1) & 0x3)); + else + buf += sprintf(buf, ".%c%c%c%c", 'w' + (((param >> (D3DVS_SWIZZLE_SHIFT+0)) + 1) & 0x3), + 'w' + (((param >> (D3DVS_SWIZZLE_SHIFT+2)) + 1) & 0x3), + 'w' + (((param >> (D3DVS_SWIZZLE_SHIFT+4)) + 1) & 0x3), + 'w' + (((param >> (D3DVS_SWIZZLE_SHIFT+6)) + 1) & 0x3)); + } + } + + return buf - buffer; +} + +struct instr_info +{ + DWORD opcode; + const char *name; + int length; + int (*function)(const struct instr_info *info, DWORD **ptr, char *buffer, BOOL ps); + WORD min_version; + WORD max_version; +}; + +static int instr_comment(const struct instr_info *info, DWORD **ptr, char *buffer, BOOL ps) +{ + *ptr += 1 + ((**ptr & D3DSI_COMMENTSIZE_MASK) >> D3DSI_COMMENTSIZE_SHIFT); + return 0; +} + +static int instr_def(const struct instr_info *info, DWORD **ptr, char *buffer, BOOL ps) +{ + int len = sprintf(buffer, " def c%d, %g, %g, %g, %g\n", *(*ptr+1) & D3DSP_REGNUM_MASK, + (double)*(float*)(*ptr+2), (double)*(float*)(*ptr+3), + (double)*(float*)(*ptr+4), (double)*(float*)(*ptr+5)); + *ptr += 6; + return len; +} + +static int instr_dcl(const struct instr_info *info, DWORD **ptr, char *buffer, BOOL ps) +{ + DWORD param1 = *++*ptr; + DWORD param2 = *++*ptr; + DWORD usage = (param1 & D3DSP_DCL_USAGE_MASK) >> D3DSP_DCL_USAGE_SHIFT; + DWORD usage_index = (param1 & D3DSP_DCL_USAGEINDEX_MASK) >> D3DSP_DCL_USAGEINDEX_SHIFT; + char *buf = buffer; + + buf += sprintf(buf, " dcl"); + if (ps) + { + if (param1 & D3DSP_TEXTURETYPE_MASK) + buf += sprintf(buf, "_%s", (usage <= D3DSTT_VOLUME) ? + tex_type[(param1 & D3DSP_TEXTURETYPE_MASK) >> D3DSP_TEXTURETYPE_SHIFT] : "???"); + } + else + { + buf += sprintf(buf, "_%s", (usage <= D3DDECLUSAGE_COLOR) ? decl_usage[usage] : "???"); + if (usage_index) + buf += sprintf(buf, "%d", usage_index); + } + + buf += add_modifier(buf, param2); + buf += sprintf(buf, " "); + buf += add_register(buf, param2, TRUE, TRUE); + buf += sprintf(buf, "\n"); + (*ptr)++; + return buf - buffer; +} + +static int instr_generic(const struct instr_info *info, DWORD **ptr, char *buffer, BOOL ps) +{ + char *buf = buffer; + int j; + + buf += sprintf(buf, " %s", info->name); + (*ptr)++; + + if (info->length) + { + buf += add_modifier(buf, **ptr); + + for (j = 0; j < info->length; j++) + { + buf += sprintf(buf, "%s ", j ? "," : ""); + + if ((j != 0) && ((**ptr & D3DSP_SRCMOD_MASK) != D3DSPSM_NONE)) + { + if ((**ptr & D3DSP_SRCMOD_MASK) == D3DSPSM_NEG) + buf += sprintf(buf, "-"); + else + buf += sprintf(buf, "*"); + } + + buf += add_register(buf, **ptr, j == 0, ps); + + if (*(*ptr)++ & D3DVS_ADDRESSMODE_MASK) + { + buf += sprintf(buf, "["); + buf += add_register(buf, **ptr, FALSE, FALSE); + buf += sprintf(buf, "]"); + (*ptr)++; + } + } + } + buf += sprintf(buf, "\n"); + return buf - buffer; +} + +const struct instr_info instructions[] = +{ + { D3DSIO_NOP, "nop", 0, instr_generic, 0x0100, 0xFFFF }, + { D3DSIO_MOV, "mov", 2, instr_generic, 0x0100, 0xFFFF }, + { D3DSIO_ADD, "add", 3, instr_generic, 0x0100, 0xFFFF }, + { D3DSIO_SUB, "sub", 3, instr_generic, 0x0100, 0xFFFF }, + { D3DSIO_MAD, "mad", 4, instr_generic, 0x0100, 0xFFFF }, + { D3DSIO_MUL, "mul", 3, instr_generic, 0x0100, 0xFFFF }, + { D3DSIO_RCP, "rcp", 2, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */ + { D3DSIO_RSQ, "rsq", 2, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */ + { D3DSIO_DP3, "dp3", 3, instr_generic, 0x0100, 0xFFFF }, + { D3DSIO_DP4, "dp4", 3, instr_generic, 0x0100, 0xFFFF }, /* >= 1.2 for PS */ + { D3DSIO_MIN, "min", 3, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */ + { D3DSIO_MAX, "max", 3, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */ + { D3DSIO_SLT, "slt", 3, instr_generic, 0x0100, 0xFFFF }, + { D3DSIO_SGE, "sge", 3, instr_generic, 0x0100, 0xFFFF }, /* VS only */ + { D3DSIO_EXP, "exp", 2, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */ + { D3DSIO_LOG, "log", 2, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */ + { D3DSIO_LIT, "lit", 2, instr_generic, 0x0100, 0xFFFF }, /* VS only */ + { D3DSIO_DST, "dst", 3, instr_generic, 0x0100, 0xFFFF }, /* VS only */ + { D3DSIO_LRP, "lrp", 4, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for VS */ + { D3DSIO_FRC, "frc", 2, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */ + { D3DSIO_M4x4, "m4x4", 3, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */ + { D3DSIO_M4x3, "m4x3", 3, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */ + { D3DSIO_M3x4, "m3x4", 3, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */ + { D3DSIO_M3x3, "m3x3", 3, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */ + { D3DSIO_M3x2, "m3x2", 3, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */ + { D3DSIO_CALL, "call", 1, instr_generic, 0x0200, 0xFFFF }, /* >= 2.a for PS */ + { D3DSIO_CALLNZ, "callnz", 2, instr_generic, 0x0200, 0xFFFF }, /* >= 2.a for PS */ + { D3DSIO_LOOP, "loop", 2, instr_generic, 0x0200, 0xFFFF }, /* >= 3.0 for PS */ + { D3DSIO_RET, "ret", 0, instr_generic, 0x0200, 0xFFFF }, /* >= 2.a for PS */ + { D3DSIO_ENDLOOP, "endloop", 1, instr_generic, 0x0200, 0xFFFF }, /* >= 3.0 for PS */ + { D3DSIO_LABEL, "label", 1, instr_generic, 0x0200, 0xFFFF }, /* >= 2.a for PS */ + { D3DSIO_DCL, "dcl", 1, instr_dcl, 0x0100, 0xFFFF }, + { D3DSIO_POW, "pow", 3, instr_generic, 0x0200, 0xFFFF }, + { D3DSIO_CRS, "crs", 3, instr_generic, 0x0200, 0xFFFF }, + { D3DSIO_SGN, "sgn", 4, instr_generic, 0x0200, 0xFFFF }, /* VS only */ + { D3DSIO_ABS, "abs", 2, instr_generic, 0x0200, 0xFFFF }, + { D3DSIO_NRM, "nrm", 2, instr_generic, 0x0200, 0xFFFF }, + { D3DSIO_SINCOS, "sincos", 4, instr_generic, 0x0200, 0x02FF }, + { D3DSIO_SINCOS, "sincos", 2, instr_generic, 0x0300, 0xFFFF }, + { D3DSIO_REP, "rep", 1, instr_generic, 0x0200, 0xFFFF }, /* >= 2.a for PS */ + { D3DSIO_ENDREP, "endrep", 0, instr_generic, 0x0200, 0xFFFF }, /* >= 2.a for PS */ + { D3DSIO_IF, "if", 1, instr_generic, 0x0200, 0xFFFF }, /* >= 2.a for PS */ + { D3DSIO_IFC, "if_comp", 2, instr_generic, 0x0200, 0xFFFF }, + { D3DSIO_ELSE, "else", 0, instr_generic, 0x0200, 0xFFFF }, /* >= 2.a for PS */ + { D3DSIO_ENDIF, "endif", 0, instr_generic, 0x0200, 0xFFFF }, /* >= 2.a for PS */ + { D3DSIO_BREAK, "break", 0, instr_generic, 0x0201, 0xFFFF }, + { D3DSIO_BREAKC, "break_comp", 2, instr_generic, 0x0201, 0xFFFF }, + { D3DSIO_MOVA, "mova", 2, instr_generic, 0x0200, 0xFFFF }, /* VS only */ + { D3DSIO_DEFB, "defb", 2, instr_generic, 0x0100, 0xFFFF }, + { D3DSIO_DEFI, "defi", 2, instr_generic, 0x0100, 0xFFFF }, + { D3DSIO_TEXCOORD, "texcoord", 1, instr_generic, 0x0100, 0x0103 }, /* PS only */ + { D3DSIO_TEXCOORD, "texcrd", 2, instr_generic, 0x0104, 0x0104 }, /* PS only */ + { D3DSIO_TEXKILL, "texkill", 1, instr_generic, 0x0100, 0xFFFF }, /* PS only */ + { D3DSIO_TEX, "tex", 1, instr_generic, 0x0100, 0x0103 }, /* PS only */ + { D3DSIO_TEX, "texld", 2, instr_generic, 0x0104, 0x0104 }, /* PS only */ + { D3DSIO_TEX, "texld", 3, instr_generic, 0x0200, 0xFFFF }, /* PS only */ + { D3DSIO_TEXBEM, "texbem", 2, instr_generic, 0x0100, 0x0103 }, /* PS only */ + { D3DSIO_TEXBEML, "texbeml", 2, instr_generic, 0x0100, 0x0103 }, /* PS only */ + { D3DSIO_TEXREG2AR, "texreg2ar", 2, instr_generic, 0x0100, 0x0103 }, /* PS only */ + { D3DSIO_TEXREG2GB, "texreg2gb", 2, instr_generic, 0x0102, 0x0103 }, /* PS only */ + { D3DSIO_TEXM3x2PAD, "texm3x2pad", 2, instr_generic, 0x0100, 0x0103 }, /* PS only */ + { D3DSIO_TEXM3x2TEX, "texm3x2tex", 2, instr_generic, 0x0100, 0x0103 }, /* PS only */ + { D3DSIO_TEXM3x3PAD, "texm3x3pad", 2, instr_generic, 0x0100, 0x0103 }, /* PS only */ + { D3DSIO_TEXM3x3TEX, "texm3x3tex", 2, instr_generic, 0x0100, 0x0103 }, /* PS only */ + { D3DSIO_TEXM3x3DIFF, "texm3x3diff", 2, instr_generic, 0x0100, 0xFFFF }, /* PS only - Not documented */ + { D3DSIO_TEXM3x3SPEC, "texm3x3spec", 3, instr_generic, 0x0100, 0x0103 }, /* PS only */ + { D3DSIO_TEXM3x3VSPEC, "texm3x3vspec", 2, instr_generic, 0x0100, 0x0103 }, /* PS only */ + { D3DSIO_EXPP, "expp", 2, instr_generic, 0x0100, 0xFFFF }, /* VS only */ + { D3DSIO_LOGP, "logp", 2, instr_generic, 0x0100, 0xFFFF }, /* VS only */ + { D3DSIO_CND, "cnd", 4, instr_generic, 0x0100, 0x0104 }, /* PS only */ + { D3DSIO_DEF, "def", 5, instr_def, 0x0100, 0xFFFF }, + { D3DSIO_TEXREG2RGB, "texreg2rgb", 2, instr_generic, 0x0102, 0x0103 }, /* PS only */ + { D3DSIO_TEXDP3TEX, "texdp3tex", 2, instr_generic, 0x0102, 0x0103 }, /* PS only */ + { D3DSIO_TEXM3x2DEPTH, "texm3x2depth", 2, instr_generic, 0x0103, 0x0103 }, /* PS only */ + { D3DSIO_TEXDP3, "texdp3", 2, instr_generic, 0x0102, 0x0103 }, /* PS only */ + { D3DSIO_TEXM3x3, "texm3x3", 2, instr_generic, 0x0102, 0x0103 }, /* PS only */ + { D3DSIO_TEXDEPTH, "texdepth", 1, instr_generic, 0x0104, 0x0104 }, /* PS only */ + { D3DSIO_CMP, "cmp", 4, instr_generic, 0x0102, 0xFFFF }, /* PS only */ + { D3DSIO_BEM, "bem", 3, instr_generic, 0x0104, 0x0104 }, /* PS only */ + { D3DSIO_DP2ADD, "dp2add", 4, instr_generic, 0x0200, 0xFFFF }, /* PS only */ + { D3DSIO_DSX, "dsx", 2, instr_generic, 0x0201, 0xFFFF }, /* PS only */ + { D3DSIO_DSY, "dsy", 2, instr_generic, 0x0201, 0xFFFF }, /* PS only */ + { D3DSIO_TEXLDD, "texldd", 5, instr_generic, 0x0201, 0xFFFF }, /* PS only - not existing for 2.b */ + { D3DSIO_SETP, "setp_comp", 3, instr_generic, 0x0201, 0xFFFF }, + { D3DSIO_TEXLDL, "texldl", 3, instr_generic, 0x0300, 0xFFFF }, + { D3DSIO_BREAKP, "breakp", 1, instr_generic, 0x0201, 0xFFFF }, + { D3DSIO_PHASE, "phase", 0, instr_generic, 0x0104, 0x0104 }, /* PS only */ + { D3DSIO_COMMENT, "", 0, instr_comment, 0x0100, 0xFFFF } +}; + HRESULT WINAPI D3DXDisassembleShader(const DWORD *shader, BOOL colorcode, const char *comments, ID3DXBuffer **disassembly) { - FIXME("%p %d %s %p: stub\n", shader, colorcode, debugstr_a(comments), disassembly); - return E_OUTOFMEMORY; + DWORD *ptr = (DWORD *)shader; + char *buffer, *buf; + UINT capacity = 4096; + BOOL ps; + WORD version; + HRESULT hr; + + TRACE("%p %d %s %p\n", shader, colorcode, debugstr_a(comments), disassembly); + + if (!shader || !disassembly) + return D3DERR_INVALIDCALL; + + buf = buffer = HeapAlloc(GetProcessHeap(), 0, capacity); + if (!buffer) + return E_OUTOFMEMORY; + + ps = (*ptr >> 16) & 1; + version = *ptr & 0xFFFF; + buf += sprintf(buf, " %s_%d_%d\n", ps ? "ps" : "vs", D3DSHADER_VERSION_MAJOR(*ptr), D3DSHADER_VERSION_MINOR(*ptr)); + ptr++; + + while (*ptr != D3DSIO_END) + { + DWORD index; + + if ((buf - buffer + 128) > capacity) + { + UINT count = buf - buffer; + char *new_buffer = HeapReAlloc(GetProcessHeap(), 0, buffer, capacity * 2); + if (!new_buffer) + { + HeapFree(GetProcessHeap(), 0, buffer); + return E_OUTOFMEMORY; + } + capacity *= 2; + buffer = new_buffer; + buf = buffer + count; + } + + for (index = 0; index < sizeof(instructions)/sizeof(instructions[0]); index++) + if (((*ptr & D3DSI_OPCODE_MASK) == instructions[index].opcode) && + (version >= instructions[index].min_version) && (version <= instructions[index].max_version)) + break; + + if (index != sizeof(instructions)/sizeof(instructions[0])) + { + buf += instructions[index].function(&(instructions[index]), &ptr, buf, ps); + } + else + { + buf += sprintf(buf, " ??? (Unknown opcode %x)\n", *ptr); + while (*++ptr & (1u << 31)); + } + } + + hr = D3DXCreateBuffer(buf - buffer + 1 , disassembly); + if (SUCCEEDED(hr)) + strcpy(ID3DXBuffer_GetBufferPointer(*disassembly), buffer); + HeapFree(GetProcessHeap(), 0, buffer); + + return hr; } struct d3dx9_texture_shader diff --git a/sdk/tools/winesync/d3dx9_staging/0004-d3dx9_36__Implement_D3DXDisassembleShader._(v2).diff b/sdk/tools/winesync/d3dx9_staging/0004-d3dx9_36__Implement_D3DXDisassembleShader._(v2).diff new file mode 100644 index 00000000000..965dc6b05e3 --- /dev/null +++ b/sdk/tools/winesync/d3dx9_staging/0004-d3dx9_36__Implement_D3DXDisassembleShader._(v2).diff @@ -0,0 +1,358 @@ +diff --git a/dll/directx/wine/d3dx9_36/shader.c b/dll/directx/wine/d3dx9_36/shader.c +index 6a038265d11..c54bacc364b 100644 +--- a/dll/directx/wine/d3dx9_36/shader.c ++++ b/dll/directx/wine/d3dx9_36/shader.c +@@ -4,6 +4,7 @@ + /* + * Copyright 2008 Luis Busquets + * Copyright 2009 Matteo Bruni ++ * Copyright 2010, 2013, 2016 Christian Costa + * Copyright 2011 Travis Athougies + * + * This library is free software; you can redistribute it and/or +@@ -21,7 +22,7 @@ + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +- ++#include <stdio.h> + #include "d3dx9_private.h" + #include "d3dcommon.h" + #include "d3dcompiler.h" +@@ -2341,10 +2342,334 @@ HRESULT WINAPI D3DXGetShaderSamplers(const DWORD *byte_code, const char **sample + return D3D_OK; + } + ++ ++static const char *decl_usage[] = { "position", "blendweight", "blendindices", "normal", "psize", "texcoord", ++ "tangent", "binormal", "tessfactor", "positiont", "color" }; ++ ++static const char *tex_type[] = { "", "1d", "2d", "cube", "volume" }; ++ ++static int add_modifier(char *buffer, DWORD param) ++{ ++ char *buf = buffer; ++ DWORD dst_mod = param & D3DSP_DSTMOD_MASK; ++ ++ if (dst_mod & D3DSPDM_SATURATE) ++ buf += sprintf(buf, "_sat"); ++ if (dst_mod & D3DSPDM_PARTIALPRECISION) ++ buf += sprintf(buf, "_pp"); ++ if (dst_mod & D3DSPDM_MSAMPCENTROID) ++ buf += sprintf(buf, "_centroid"); ++ ++ return buf - buffer; ++} ++ ++static int add_register(char *buffer, DWORD param, BOOL dst, BOOL ps) ++{ ++ char *buf = buffer; ++ DWORD reg_type = ((param & D3DSP_REGTYPE_MASK2) >> D3DSP_REGTYPE_SHIFT2) ++ | ((param & D3DSP_REGTYPE_MASK) >> D3DSP_REGTYPE_SHIFT); ++ DWORD reg_num = param & D3DSP_REGNUM_MASK; ++ ++ if (reg_type == D3DSPR_INPUT) ++ buf += sprintf(buf, "v%d", reg_num); ++ else if (reg_type == D3DSPR_CONST) ++ buf += sprintf(buf, "c%d", reg_num); ++ else if (reg_type == D3DSPR_TEMP) ++ buf += sprintf(buf, "r%d", reg_num); ++ else if (reg_type == D3DSPR_ADDR) ++ buf += sprintf(buf, "%s%d", ps ? "t" : "a", reg_num); ++ else if (reg_type == D3DSPR_SAMPLER) ++ buf += sprintf(buf, "s%d", reg_num); ++ else if (reg_type == D3DSPR_RASTOUT) ++ buf += sprintf(buf, "oPos"); ++ else if (reg_type == D3DSPR_COLOROUT) ++ buf += sprintf(buf, "oC%d", reg_num); ++ else if (reg_type == D3DSPR_TEXCRDOUT) ++ buf += sprintf(buf, "oT%d", reg_num); ++ else if (reg_type == D3DSPR_ATTROUT) ++ buf += sprintf(buf, "oD%d", reg_num); ++ else ++ buf += sprintf(buf, "? (%d)", reg_type); ++ ++ if (dst) ++ { ++ if ((param & D3DSP_WRITEMASK_ALL) != D3DSP_WRITEMASK_ALL) ++ { ++ buf += sprintf(buf, ".%s%s%s%s", param & D3DSP_WRITEMASK_0 ? "x" : "", ++ param & D3DSP_WRITEMASK_1 ? "y" : "", ++ param & D3DSP_WRITEMASK_2 ? "z" : "", ++ param & D3DSP_WRITEMASK_3 ? "w" : ""); ++ } ++ } ++ else ++ { ++ if ((param & D3DVS_SWIZZLE_MASK) != D3DVS_NOSWIZZLE) ++ { ++ if ( ((param & D3DSP_SWIZZLE_MASK) == (D3DVS_X_X | D3DVS_Y_X | D3DVS_Z_X | D3DVS_W_X)) || ++ ((param & D3DSP_SWIZZLE_MASK) == (D3DVS_X_Y | D3DVS_Y_Y | D3DVS_Z_Y | D3DVS_W_Y)) || ++ ((param & D3DSP_SWIZZLE_MASK) == (D3DVS_X_Z | D3DVS_Y_Z | D3DVS_Z_Z | D3DVS_W_Z)) || ++ ((param & D3DSP_SWIZZLE_MASK) == (D3DVS_X_W | D3DVS_Y_W | D3DVS_Z_W | D3DVS_W_W)) ) ++ buf += sprintf(buf, ".%c", 'w' + (((param >> D3DVS_SWIZZLE_SHIFT) + 1) & 0x3)); ++ else ++ buf += sprintf(buf, ".%c%c%c%c", 'w' + (((param >> (D3DVS_SWIZZLE_SHIFT+0)) + 1) & 0x3), ++ 'w' + (((param >> (D3DVS_SWIZZLE_SHIFT+2)) + 1) & 0x3), ++ 'w' + (((param >> (D3DVS_SWIZZLE_SHIFT+4)) + 1) & 0x3), ++ 'w' + (((param >> (D3DVS_SWIZZLE_SHIFT+6)) + 1) & 0x3)); ++ } ++ } ++ ++ return buf - buffer; ++} ++ ++struct instr_info ++{ ++ DWORD opcode; ++ const char *name; ++ int length; ++ int (*function)(const struct instr_info *info, DWORD **ptr, char *buffer, BOOL ps); ++ WORD min_version; ++ WORD max_version; ++}; ++ ++static int instr_comment(const struct instr_info *info, DWORD **ptr, char *buffer, BOOL ps) ++{ ++ *ptr += 1 + ((**ptr & D3DSI_COMMENTSIZE_MASK) >> D3DSI_COMMENTSIZE_SHIFT); ++ return 0; ++} ++ ++static int instr_def(const struct instr_info *info, DWORD **ptr, char *buffer, BOOL ps) ++{ ++ int len = sprintf(buffer, " def c%d, %g, %g, %g, %g\n", *(*ptr+1) & D3DSP_REGNUM_MASK, ++ (double)*(float*)(*ptr+2), (double)*(float*)(*ptr+3), ++ (double)*(float*)(*ptr+4), (double)*(float*)(*ptr+5)); ++ *ptr += 6; ++ return len; ++} ++ ++static int instr_dcl(const struct instr_info *info, DWORD **ptr, char *buffer, BOOL ps) ++{ ++ DWORD param1 = *++*ptr; ++ DWORD param2 = *++*ptr; ++ DWORD usage = (param1 & D3DSP_DCL_USAGE_MASK) >> D3DSP_DCL_USAGE_SHIFT; ++ DWORD usage_index = (param1 & D3DSP_DCL_USAGEINDEX_MASK) >> D3DSP_DCL_USAGEINDEX_SHIFT; ++ char *buf = buffer; ++ ++ buf += sprintf(buf, " dcl"); ++ if (ps) ++ { ++ if (param1 & D3DSP_TEXTURETYPE_MASK) ++ buf += sprintf(buf, "_%s", (usage <= D3DSTT_VOLUME) ? ++ tex_type[(param1 & D3DSP_TEXTURETYPE_MASK) >> D3DSP_TEXTURETYPE_SHIFT] : "???"); ++ } ++ else ++ { ++ buf += sprintf(buf, "_%s", (usage <= D3DDECLUSAGE_COLOR) ? decl_usage[usage] : "???"); ++ if (usage_index) ++ buf += sprintf(buf, "%d", usage_index); ++ } ++ ++ buf += add_modifier(buf, param2); ++ buf += sprintf(buf, " "); ++ buf += add_register(buf, param2, TRUE, TRUE); ++ buf += sprintf(buf, "\n"); ++ (*ptr)++; ++ return buf - buffer; ++} ++ ++static int instr_generic(const struct instr_info *info, DWORD **ptr, char *buffer, BOOL ps) ++{ ++ char *buf = buffer; ++ int j; ++ ++ buf += sprintf(buf, " %s", info->name); ++ (*ptr)++; ++ ++ if (info->length) ++ { ++ buf += add_modifier(buf, **ptr); ++ ++ for (j = 0; j < info->length; j++) ++ { ++ buf += sprintf(buf, "%s ", j ? "," : ""); ++ ++ if ((j != 0) && ((**ptr & D3DSP_SRCMOD_MASK) != D3DSPSM_NONE)) ++ { ++ if ((**ptr & D3DSP_SRCMOD_MASK) == D3DSPSM_NEG) ++ buf += sprintf(buf, "-"); ++ else ++ buf += sprintf(buf, "*"); ++ } ++ ++ buf += add_register(buf, **ptr, j == 0, ps); ++ ++ if (*(*ptr)++ & D3DVS_ADDRESSMODE_MASK) ++ { ++ buf += sprintf(buf, "["); ++ buf += add_register(buf, **ptr, FALSE, FALSE); ++ buf += sprintf(buf, "]"); ++ (*ptr)++; ++ } ++ } ++ } ++ buf += sprintf(buf, "\n"); ++ return buf - buffer; ++} ++ ++const struct instr_info instructions[] = ++{ ++ { D3DSIO_NOP, "nop", 0, instr_generic, 0x0100, 0xFFFF }, ++ { D3DSIO_MOV, "mov", 2, instr_generic, 0x0100, 0xFFFF }, ++ { D3DSIO_ADD, "add", 3, instr_generic, 0x0100, 0xFFFF }, ++ { D3DSIO_SUB, "sub", 3, instr_generic, 0x0100, 0xFFFF }, ++ { D3DSIO_MAD, "mad", 4, instr_generic, 0x0100, 0xFFFF }, ++ { D3DSIO_MUL, "mul", 3, instr_generic, 0x0100, 0xFFFF }, ++ { D3DSIO_RCP, "rcp", 2, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */ ++ { D3DSIO_RSQ, "rsq", 2, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */ ++ { D3DSIO_DP3, "dp3", 3, instr_generic, 0x0100, 0xFFFF }, ++ { D3DSIO_DP4, "dp4", 3, instr_generic, 0x0100, 0xFFFF }, /* >= 1.2 for PS */ ++ { D3DSIO_MIN, "min", 3, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */ ++ { D3DSIO_MAX, "max", 3, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */ ++ { D3DSIO_SLT, "slt", 3, instr_generic, 0x0100, 0xFFFF }, ++ { D3DSIO_SGE, "sge", 3, instr_generic, 0x0100, 0xFFFF }, /* VS only */ ++ { D3DSIO_EXP, "exp", 2, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */ ++ { D3DSIO_LOG, "log", 2, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */ ++ { D3DSIO_LIT, "lit", 2, instr_generic, 0x0100, 0xFFFF }, /* VS only */ ++ { D3DSIO_DST, "dst", 3, instr_generic, 0x0100, 0xFFFF }, /* VS only */ ++ { D3DSIO_LRP, "lrp", 4, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for VS */ ++ { D3DSIO_FRC, "frc", 2, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */ ++ { D3DSIO_M4x4, "m4x4", 3, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */ ++ { D3DSIO_M4x3, "m4x3", 3, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */ ++ { D3DSIO_M3x4, "m3x4", 3, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */ ++ { D3DSIO_M3x3, "m3x3", 3, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */ ++ { D3DSIO_M3x2, "m3x2", 3, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */ ++ { D3DSIO_CALL, "call", 1, instr_generic, 0x0200, 0xFFFF }, /* >= 2.a for PS */ ++ { D3DSIO_CALLNZ, "callnz", 2, instr_generic, 0x0200, 0xFFFF }, /* >= 2.a for PS */ ++ { D3DSIO_LOOP, "loop", 2, instr_generic, 0x0200, 0xFFFF }, /* >= 3.0 for PS */ ++ { D3DSIO_RET, "ret", 0, instr_generic, 0x0200, 0xFFFF }, /* >= 2.a for PS */ ++ { D3DSIO_ENDLOOP, "endloop", 1, instr_generic, 0x0200, 0xFFFF }, /* >= 3.0 for PS */ ++ { D3DSIO_LABEL, "label", 1, instr_generic, 0x0200, 0xFFFF }, /* >= 2.a for PS */ ++ { D3DSIO_DCL, "dcl", 1, instr_dcl, 0x0100, 0xFFFF }, ++ { D3DSIO_POW, "pow", 3, instr_generic, 0x0200, 0xFFFF }, ++ { D3DSIO_CRS, "crs", 3, instr_generic, 0x0200, 0xFFFF }, ++ { D3DSIO_SGN, "sgn", 4, instr_generic, 0x0200, 0xFFFF }, /* VS only */ ++ { D3DSIO_ABS, "abs", 2, instr_generic, 0x0200, 0xFFFF }, ++ { D3DSIO_NRM, "nrm", 2, instr_generic, 0x0200, 0xFFFF }, ++ { D3DSIO_SINCOS, "sincos", 4, instr_generic, 0x0200, 0x02FF }, ++ { D3DSIO_SINCOS, "sincos", 2, instr_generic, 0x0300, 0xFFFF }, ++ { D3DSIO_REP, "rep", 1, instr_generic, 0x0200, 0xFFFF }, /* >= 2.a for PS */ ++ { D3DSIO_ENDREP, "endrep", 0, instr_generic, 0x0200, 0xFFFF }, /* >= 2.a for PS */ ++ { D3DSIO_IF, "if", 1, instr_generic, 0x0200, 0xFFFF }, /* >= 2.a for PS */ ++ { D3DSIO_IFC, "if_comp", 2, instr_generic, 0x0200, 0xFFFF }, ++ { D3DSIO_ELSE, "else", 0, instr_generic, 0x0200, 0xFFFF }, /* >= 2.a for PS */ ++ { D3DSIO_ENDIF, "endif", 0, instr_generic, 0x0200, 0xFFFF }, /* >= 2.a for PS */ ++ { D3DSIO_BREAK, "break", 0, instr_generic, 0x0201, 0xFFFF }, ++ { D3DSIO_BREAKC, "break_comp", 2, instr_generic, 0x0201, 0xFFFF }, ++ { D3DSIO_MOVA, "mova", 2, instr_generic, 0x0200, 0xFFFF }, /* VS only */ ++ { D3DSIO_DEFB, "defb", 2, instr_generic, 0x0100, 0xFFFF }, ++ { D3DSIO_DEFI, "defi", 2, instr_generic, 0x0100, 0xFFFF }, ++ { D3DSIO_TEXCOORD, "texcoord", 1, instr_generic, 0x0100, 0x0103 }, /* PS only */ ++ { D3DSIO_TEXCOORD, "texcrd", 2, instr_generic, 0x0104, 0x0104 }, /* PS only */ ++ { D3DSIO_TEXKILL, "texkill", 1, instr_generic, 0x0100, 0xFFFF }, /* PS only */ ++ { D3DSIO_TEX, "tex", 1, instr_generic, 0x0100, 0x0103 }, /* PS only */ ++ { D3DSIO_TEX, "texld", 2, instr_generic, 0x0104, 0x0104 }, /* PS only */ ++ { D3DSIO_TEX, "texld", 3, instr_generic, 0x0200, 0xFFFF }, /* PS only */ ++ { D3DSIO_TEXBEM, "texbem", 2, instr_generic, 0x0100, 0x0103 }, /* PS only */ ++ { D3DSIO_TEXBEML, "texbeml", 2, instr_generic, 0x0100, 0x0103 }, /* PS only */ ++ { D3DSIO_TEXREG2AR, "texreg2ar", 2, instr_generic, 0x0100, 0x0103 }, /* PS only */ ++ { D3DSIO_TEXREG2GB, "texreg2gb", 2, instr_generic, 0x0102, 0x0103 }, /* PS only */ ++ { D3DSIO_TEXM3x2PAD, "texm3x2pad", 2, instr_generic, 0x0100, 0x0103 }, /* PS only */ ++ { D3DSIO_TEXM3x2TEX, "texm3x2tex", 2, instr_generic, 0x0100, 0x0103 }, /* PS only */ ++ { D3DSIO_TEXM3x3PAD, "texm3x3pad", 2, instr_generic, 0x0100, 0x0103 }, /* PS only */ ++ { D3DSIO_TEXM3x3TEX, "texm3x3tex", 2, instr_generic, 0x0100, 0x0103 }, /* PS only */ ++ { D3DSIO_TEXM3x3DIFF, "texm3x3diff", 2, instr_generic, 0x0100, 0xFFFF }, /* PS only - Not documented */ ++ { D3DSIO_TEXM3x3SPEC, "texm3x3spec", 3, instr_generic, 0x0100, 0x0103 }, /* PS only */ ++ { D3DSIO_TEXM3x3VSPEC, "texm3x3vspec", 2, instr_generic, 0x0100, 0x0103 }, /* PS only */ ++ { D3DSIO_EXPP, "expp", 2, instr_generic, 0x0100, 0xFFFF }, /* VS only */ ++ { D3DSIO_LOGP, "logp", 2, instr_generic, 0x0100, 0xFFFF }, /* VS only */ ++ { D3DSIO_CND, "cnd", 4, instr_generic, 0x0100, 0x0104 }, /* PS only */ ++ { D3DSIO_DEF, "def", 5, instr_def, 0x0100, 0xFFFF }, ++ { D3DSIO_TEXREG2RGB, "texreg2rgb", 2, instr_generic, 0x0102, 0x0103 }, /* PS only */ ++ { D3DSIO_TEXDP3TEX, "texdp3tex", 2, instr_generic, 0x0102, 0x0103 }, /* PS only */ ++ { D3DSIO_TEXM3x2DEPTH, "texm3x2depth", 2, instr_generic, 0x0103, 0x0103 }, /* PS only */ ++ { D3DSIO_TEXDP3, "texdp3", 2, instr_generic, 0x0102, 0x0103 }, /* PS only */ ++ { D3DSIO_TEXM3x3, "texm3x3", 2, instr_generic, 0x0102, 0x0103 }, /* PS only */ ++ { D3DSIO_TEXDEPTH, "texdepth", 1, instr_generic, 0x0104, 0x0104 }, /* PS only */ ++ { D3DSIO_CMP, "cmp", 4, instr_generic, 0x0102, 0xFFFF }, /* PS only */ ++ { D3DSIO_BEM, "bem", 3, instr_generic, 0x0104, 0x0104 }, /* PS only */ ++ { D3DSIO_DP2ADD, "dp2add", 4, instr_generic, 0x0200, 0xFFFF }, /* PS only */ ++ { D3DSIO_DSX, "dsx", 2, instr_generic, 0x0201, 0xFFFF }, /* PS only */ ++ { D3DSIO_DSY, "dsy", 2, instr_generic, 0x0201, 0xFFFF }, /* PS only */ ++ { D3DSIO_TEXLDD, "texldd", 5, instr_generic, 0x0201, 0xFFFF }, /* PS only - not existing for 2.b */ ++ { D3DSIO_SETP, "setp_comp", 3, instr_generic, 0x0201, 0xFFFF }, ++ { D3DSIO_TEXLDL, "texldl", 3, instr_generic, 0x0300, 0xFFFF }, ++ { D3DSIO_BREAKP, "breakp", 1, instr_generic, 0x0201, 0xFFFF }, ++ { D3DSIO_PHASE, "phase", 0, instr_generic, 0x0104, 0x0104 }, /* PS only */ ++ { D3DSIO_COMMENT, "", 0, instr_comment, 0x0100, 0xFFFF } ++}; ++ + HRESULT WINAPI D3DXDisassembleShader(const DWORD *shader, BOOL colorcode, const char *comments, ID3DXBuffer **disassembly) + { +- FIXME("%p %d %s %p: stub\n", shader, colorcode, debugstr_a(comments), disassembly); +- return E_OUTOFMEMORY; ++ DWORD *ptr = (DWORD *)shader; ++ char *buffer, *buf; ++ UINT capacity = 4096; ++ BOOL ps; ++ WORD version; ++ HRESULT hr; ++ ++ TRACE("%p %d %s %p\n", shader, colorcode, debugstr_a(comments), disassembly); ++ ++ if (!shader || !disassembly) ++ return D3DERR_INVALIDCALL; ++ ++ buf = buffer = HeapAlloc(GetProcessHeap(), 0, capacity); ++ if (!buffer) ++ return E_OUTOFMEMORY; ++ ++ ps = (*ptr >> 16) & 1; ++ version = *ptr & 0xFFFF; ++ buf += sprintf(buf, " %s_%d_%d\n", ps ? "ps" : "vs", D3DSHADER_VERSION_MAJOR(*ptr), D3DSHADER_VERSION_MINOR(*ptr)); ++ ptr++; ++ ++ while (*ptr != D3DSIO_END) ++ { ++ DWORD index; ++ ++ if ((buf - buffer + 128) > capacity) ++ { ++ UINT count = buf - buffer; ++ char *new_buffer = HeapReAlloc(GetProcessHeap(), 0, buffer, capacity * 2); ++ if (!new_buffer) ++ { ++ HeapFree(GetProcessHeap(), 0, buffer); ++ return E_OUTOFMEMORY; ++ } ++ capacity *= 2; ++ buffer = new_buffer; ++ buf = buffer + count; ++ } ++ ++ for (index = 0; index < sizeof(instructions)/sizeof(instructions[0]); index++) ++ if (((*ptr & D3DSI_OPCODE_MASK) == instructions[index].opcode) && ++ (version >= instructions[index].min_version) && (version <= instructions[index].max_version)) ++ break; ++ ++ if (index != sizeof(instructions)/sizeof(instructions[0])) ++ { ++ buf += instructions[index].function(&(instructions[index]), &ptr, buf, ps); ++ } ++ else ++ { ++ buf += sprintf(buf, " ??? (Unknown opcode %x)\n", *ptr); ++ while (*++ptr & (1u << 31)); ++ } ++ } ++ ++ hr = D3DXCreateBuffer(buf - buffer + 1 , disassembly); ++ if (SUCCEEDED(hr)) ++ strcpy(ID3DXBuffer_GetBufferPointer(*disassembly), buffer); ++ HeapFree(GetProcessHeap(), 0, buffer); ++ ++ return hr; + } + + struct d3dx9_texture_shader
3 years, 9 months
1
0
0
0
[reactos] 206/218: [WINESYNC] d3dx9_36: Improve stub for ID3DXEffectImpl_CloneEffect.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=62f40620f15da1b9be56a…
commit 62f40620f15da1b9be56ac6d8289501a38a01e05 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Tue Jan 5 13:16:41 2021 +0100 Commit: Jérôme Gardou <jerome.gardou(a)reactos.org> CommitDate: Thu Feb 4 16:37:07 2021 +0100 [WINESYNC] d3dx9_36: Improve stub for ID3DXEffectImpl_CloneEffect. wine-staging patch by Sebastian Lackner <sebastian(a)fds-team.de> --- dll/directx/wine/d3dx9_36/effect.c | 4 +- modules/rostests/winetests/d3dx9_36/effect.c | 16 ++----- ...prove_stub_for_ID3DXEffectImpl_CloneEffect.diff | 54 ++++++++++++++++++++++ 3 files changed, 62 insertions(+), 12 deletions(-) diff --git a/dll/directx/wine/d3dx9_36/effect.c b/dll/directx/wine/d3dx9_36/effect.c index 54d44341a24..9af899ce3b3 100644 --- a/dll/directx/wine/d3dx9_36/effect.c +++ b/dll/directx/wine/d3dx9_36/effect.c @@ -4313,7 +4313,9 @@ static HRESULT WINAPI d3dx_effect_CloneEffect(ID3DXEffect *iface, IDirect3DDevic if (!device) return D3DERR_INVALIDCALL; - return E_NOTIMPL; + iface->lpVtbl->AddRef(iface); + *new_effect = iface; + return S_OK; } #if D3DX_SDK_VERSION >= 27 diff --git a/modules/rostests/winetests/d3dx9_36/effect.c b/modules/rostests/winetests/d3dx9_36/effect.c index d96f70351ec..2434bc76b30 100644 --- a/modules/rostests/winetests/d3dx9_36/effect.c +++ b/modules/rostests/winetests/d3dx9_36/effect.c @@ -7434,29 +7434,23 @@ static void test_effect_clone(void) ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr); hr = effect->lpVtbl->CloneEffect(effect, device, &cloned); -todo_wine ok(hr == D3D_OK, "Got result %#x.\n", hr); -if (hr == D3D_OK) -{ - ok(cloned != effect, "Expected new effect instance.\n"); + + todo_wine ok(cloned != effect, "Expected new effect instance.\n"); cloned->lpVtbl->Release(cloned); -} /* Try with different device. */ device2 = create_device(&window2); hr = effect->lpVtbl->CloneEffect(effect, device2, &cloned); -todo_wine ok(hr == D3D_OK, "Got result %#x.\n", hr); -if (hr == D3D_OK) -{ - ok(cloned != effect, "Expected new effect instance.\n"); + todo_wine ok(cloned != effect, "Expected new effect instance.\n"); hr = cloned->lpVtbl->GetDevice(cloned, &device3); ok(hr == S_OK, "Failed to get effect device.\n"); - ok(device3 == device2, "Unexpected device instance.\n"); + todo_wine ok(device3 == device2, "Unexpected device instance, device3 %p, device2 %p.\n", device3, device2); IDirect3DDevice9_Release(device3); cloned->lpVtbl->Release(cloned); -} + IDirect3DDevice9_Release(device2); DestroyWindow(window2); effect->lpVtbl->Release(effect); diff --git a/sdk/tools/winesync/d3dx9_staging/0003-d3dx9_36__Improve_stub_for_ID3DXEffectImpl_CloneEffect.diff b/sdk/tools/winesync/d3dx9_staging/0003-d3dx9_36__Improve_stub_for_ID3DXEffectImpl_CloneEffect.diff new file mode 100644 index 00000000000..85971d79dc3 --- /dev/null +++ b/sdk/tools/winesync/d3dx9_staging/0003-d3dx9_36__Improve_stub_for_ID3DXEffectImpl_CloneEffect.diff @@ -0,0 +1,54 @@ +diff --git a/dll/directx/wine/d3dx9_36/effect.c b/dll/directx/wine/d3dx9_36/effect.c +index 710e999..d57b182 100644 +--- a/dll/directx/wine/d3dx9_36/effect.c ++++ b/dll/directx/wine/d3dx9_36/effect.c +@@ -4309,7 +4309,9 @@ static HRESULT WINAPI d3dx_effect_CloneEffect(ID3DXEffect *iface, IDirect3DDevic + if (!device) + return D3DERR_INVALIDCALL; + +- return E_NOTIMPL; ++ iface->lpVtbl->AddRef(iface); ++ *new_effect = iface; ++ return S_OK; + } + + #if D3DX_SDK_VERSION >= 27 +diff --git a/modules/rostests/winetests/d3dx9_36/effect.c b/modules/rostests/winetests/d3dx9_36/effect.c +index ae6f65d..1b5c944 100644 +--- a/modules/rostests/winetests/d3dx9_36/effect.c ++++ b/modules/rostests/winetests/d3dx9_36/effect.c +@@ -7419,29 +7419,23 @@ static void test_effect_clone(void) + ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr); + + hr = effect->lpVtbl->CloneEffect(effect, device, &cloned); +-todo_wine + ok(hr == D3D_OK, "Got result %#x.\n", hr); +-if (hr == D3D_OK) +-{ +- ok(cloned != effect, "Expected new effect instance.\n"); ++ ++ todo_wine ok(cloned != effect, "Expected new effect instance.\n"); + cloned->lpVtbl->Release(cloned); +-} + /* Try with different device. */ + device2 = create_device(&window2); + hr = effect->lpVtbl->CloneEffect(effect, device2, &cloned); +-todo_wine + ok(hr == D3D_OK, "Got result %#x.\n", hr); +-if (hr == D3D_OK) +-{ +- ok(cloned != effect, "Expected new effect instance.\n"); ++ todo_wine ok(cloned != effect, "Expected new effect instance.\n"); + + hr = cloned->lpVtbl->GetDevice(cloned, &device3); + ok(hr == S_OK, "Failed to get effect device.\n"); +- ok(device3 == device2, "Unexpected device instance.\n"); ++ todo_wine ok(device3 == device2, "Unexpected device instance, device3 %p, device2 %p.\n", device3, device2); + IDirect3DDevice9_Release(device3); + + cloned->lpVtbl->Release(cloned); +-} ++ + IDirect3DDevice9_Release(device2); + DestroyWindow(window2); + effect->lpVtbl->Release(effect);
3 years, 9 months
1
0
0
0
[reactos] 205/218: [WINESYNC] d3dx9_36: Add format description for X8L8V8U8 for format conversions.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7c02c861b151d8121d971…
commit 7c02c861b151d8121d971263c8a9b101add3ce63 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Tue Jan 5 13:16:40 2021 +0100 Commit: Jérôme Gardou <jerome.gardou(a)reactos.org> CommitDate: Thu Feb 4 16:37:07 2021 +0100 [WINESYNC] d3dx9_36: Add format description for X8L8V8U8 for format conversions. wine-staging patch by Christian Costa <titan.costa(a)gmail.com> --- dll/directx/wine/d3dx9_36/util.c | 1 + ...rmat_description_for_X8L8V8U8_for_format_conversions.diff | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/dll/directx/wine/d3dx9_36/util.c b/dll/directx/wine/d3dx9_36/util.c index 762c1e6034f..860ac21f1fc 100644 --- a/dll/directx/wine/d3dx9_36/util.c +++ b/dll/directx/wine/d3dx9_36/util.c @@ -92,6 +92,7 @@ static const struct pixel_format_desc formats[] = {D3DFMT_G32R32F, { 0, 32, 32, 0}, { 0, 0, 32, 0}, 8, 1, 1, 8, FORMAT_ARGBF, NULL, NULL }, {D3DFMT_A32B32G32R32F, {32, 32, 32, 32}, {96, 0, 32, 64}, 16, 1, 1, 16, FORMAT_ARGBF, NULL, NULL }, {D3DFMT_P8, { 8, 8, 8, 8}, { 0, 0, 0, 0}, 1, 1, 1, 1, FORMAT_INDEX, NULL, index_to_rgba}, + {D3DFMT_X8L8V8U8, { 0, 8, 8, 8}, { 0, 0, 8, 16}, 4, 1, 1, 4, FORMAT_ARGB, NULL, NULL }, /* marks last element */ {D3DFMT_UNKNOWN, { 0, 0, 0, 0}, { 0, 0, 0, 0}, 0, 1, 1, 0, FORMAT_UNKNOWN, NULL, NULL }, }; diff --git a/sdk/tools/winesync/d3dx9_staging/0002-d3dx9_36__Add_format_description_for_X8L8V8U8_for_format_conversions.diff b/sdk/tools/winesync/d3dx9_staging/0002-d3dx9_36__Add_format_description_for_X8L8V8U8_for_format_conversions.diff new file mode 100644 index 00000000000..c94a92934ed --- /dev/null +++ b/sdk/tools/winesync/d3dx9_staging/0002-d3dx9_36__Add_format_description_for_X8L8V8U8_for_format_conversions.diff @@ -0,0 +1,12 @@ +diff --git a/dll/directx/wine/d3dx9_36/util.c b/dll/directx/wine/d3dx9_36/util.c +index 39afe67..c79067c 100644 +--- a/dll/directx/wine/d3dx9_36/util.c ++++ b/dll/directx/wine/d3dx9_36/util.c +@@ -88,6 +88,7 @@ static const struct pixel_format_desc formats[] = + {D3DFMT_G32R32F, { 0, 32, 32, 0}, { 0, 0, 32, 0}, 8, 1, 1, 8, FORMAT_ARGBF, NULL, NULL }, + {D3DFMT_A32B32G32R32F, {32, 32, 32, 32}, {96, 0, 32, 64}, 16, 1, 1, 16, FORMAT_ARGBF, NULL, NULL }, + {D3DFMT_P8, { 8, 8, 8, 8}, { 0, 0, 0, 0}, 1, 1, 1, 1, FORMAT_INDEX, NULL, index_to_rgba}, ++ {D3DFMT_X8L8V8U8, { 0, 8, 8, 8}, { 0, 0, 8, 16}, 4, 1, 1, 4, FORMAT_ARGB, NULL, NULL }, + /* marks last element */ + {D3DFMT_UNKNOWN, { 0, 0, 0, 0}, { 0, 0, 0, 0}, 0, 1, 1, 0, FORMAT_UNKNOWN, NULL, NULL }, + };
3 years, 9 months
1
0
0
0
[reactos] 204/218: [WINESYNC] d3dx9: Return D3DFMT_A8R8G8B8 in D3DXGetImageInfoFromFileInMemory for 32 bpp BMP with alpha.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7a64c4dcc939403cce50f…
commit 7a64c4dcc939403cce50fc31d475619a724d3609 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Tue Jan 5 13:16:40 2021 +0100 Commit: Jérôme Gardou <jerome.gardou(a)reactos.org> CommitDate: Thu Feb 4 16:37:07 2021 +0100 [WINESYNC] d3dx9: Return D3DFMT_A8R8G8B8 in D3DXGetImageInfoFromFileInMemory for 32 bpp BMP with alpha. wine-staging patch by Christian Costa <titan.costa(a)gmail.com> --- dll/directx/wine/d3dx9_36/surface.c | 18 ++++++++++ modules/rostests/winetests/d3dx9_36/surface.c | 2 +- ...FromFileInMemory_for_32_bpp_BMP_with_alpha.diff | 42 ++++++++++++++++++++++ 3 files changed, 61 insertions(+), 1 deletion(-) diff --git a/dll/directx/wine/d3dx9_36/surface.c b/dll/directx/wine/d3dx9_36/surface.c index 0deca8c01a0..30d04684044 100644 --- a/dll/directx/wine/d3dx9_36/surface.c +++ b/dll/directx/wine/d3dx9_36/surface.c @@ -1010,6 +1010,24 @@ HRESULT WINAPI D3DXGetImageInfoFromFileInMemory(const void *data, UINT datasize, } } + /* For 32 bpp BMP, windowscodecs.dll never returns a format with alpha while + * d3dx9_xx.dll returns one if at least 1 pixel has a non zero alpha component */ + if (SUCCEEDED(hr) && (info->Format == D3DFMT_X8R8G8B8) && (info->ImageFileFormat == D3DXIFF_BMP)) { + DWORD size = sizeof(DWORD) * info->Width * info->Height; + BYTE *buffer = HeapAlloc(GetProcessHeap(), 0, size); + hr = IWICBitmapFrameDecode_CopyPixels(frame, NULL, sizeof(DWORD) * info->Width, size, buffer); + if (SUCCEEDED(hr)) { + DWORD i; + for (i = 0; i < info->Width * info->Height; i++) { + if (buffer[i*4+3]) { + info->Format = D3DFMT_A8R8G8B8; + break; + } + } + } + HeapFree(GetProcessHeap(), 0, buffer); + } + if (frame) IWICBitmapFrameDecode_Release(frame); diff --git a/modules/rostests/winetests/d3dx9_36/surface.c b/modules/rostests/winetests/d3dx9_36/surface.c index 4590a758d78..1d32b68c3a6 100644 --- a/modules/rostests/winetests/d3dx9_36/surface.c +++ b/modules/rostests/winetests/d3dx9_36/surface.c @@ -698,7 +698,7 @@ static void test_D3DXGetImageInfo(void) ok(info.Format == D3DFMT_X8R8G8B8, "Got unexpected format %u.\n", info.Format); hr = D3DXGetImageInfoFromFileInMemory(bmp_32bpp_argb, sizeof(bmp_32bpp_argb), &info); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); - todo_wine ok(info.Format == D3DFMT_A8R8G8B8, "Got unexpected format %u.\n", info.Format); + ok(info.Format == D3DFMT_A8R8G8B8, "Got unexpected format %u.\n", info.Format); /* Grayscale PNG */ hr = D3DXGetImageInfoFromFileInMemory(png_grayscale, sizeof(png_grayscale), &info); diff --git a/sdk/tools/winesync/d3dx9_staging/0001-d3dx9__Return_D3DFMT_A8R8G8B8_in_D3DXGetImageInfoFromFileInMemory_for_32_bpp_BMP_with_alpha.diff b/sdk/tools/winesync/d3dx9_staging/0001-d3dx9__Return_D3DFMT_A8R8G8B8_in_D3DXGetImageInfoFromFileInMemory_for_32_bpp_BMP_with_alpha.diff new file mode 100644 index 00000000000..0370cad886e --- /dev/null +++ b/sdk/tools/winesync/d3dx9_staging/0001-d3dx9__Return_D3DFMT_A8R8G8B8_in_D3DXGetImageInfoFromFileInMemory_for_32_bpp_BMP_with_alpha.diff @@ -0,0 +1,42 @@ +diff --git a/dll/directx/wine/d3dx9_36/surface.c b/dll/directx/wine/d3dx9_36/surface.c +index 045d726..ebec81f 100644 +--- a/dll/directx/wine/d3dx9_36/surface.c ++++ b/dll/directx/wine/d3dx9_36/surface.c +@@ -1006,6 +1006,24 @@ HRESULT WINAPI D3DXGetImageInfoFromFileInMemory(const void *data, UINT datasize, + } + } + ++ /* For 32 bpp BMP, windowscodecs.dll never returns a format with alpha while ++ * d3dx9_xx.dll returns one if at least 1 pixel has a non zero alpha component */ ++ if (SUCCEEDED(hr) && (info->Format == D3DFMT_X8R8G8B8) && (info->ImageFileFormat == D3DXIFF_BMP)) { ++ DWORD size = sizeof(DWORD) * info->Width * info->Height; ++ BYTE *buffer = HeapAlloc(GetProcessHeap(), 0, size); ++ hr = IWICBitmapFrameDecode_CopyPixels(frame, NULL, sizeof(DWORD) * info->Width, size, buffer); ++ if (SUCCEEDED(hr)) { ++ DWORD i; ++ for (i = 0; i < info->Width * info->Height; i++) { ++ if (buffer[i*4+3]) { ++ info->Format = D3DFMT_A8R8G8B8; ++ break; ++ } ++ } ++ } ++ HeapFree(GetProcessHeap(), 0, buffer); ++ } ++ + if (frame) + IWICBitmapFrameDecode_Release(frame); + +diff --git a/modules/rostests/winetests/d3dx9_36/surface.c b/modules/rostests/winetests/d3dx9_36/surface.c +index 4590a75..1d32b68 100644 +--- a/modules/rostests/winetests/d3dx9_36/surface.c ++++ b/modules/rostests/winetests/d3dx9_36/surface.c +@@ -698,7 +698,7 @@ static void test_D3DXGetImageInfo(void) + ok(info.Format == D3DFMT_X8R8G8B8, "Got unexpected format %u.\n", info.Format); + hr = D3DXGetImageInfoFromFileInMemory(bmp_32bpp_argb, sizeof(bmp_32bpp_argb), &info); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); +- todo_wine ok(info.Format == D3DFMT_A8R8G8B8, "Got unexpected format %u.\n", info.Format); ++ ok(info.Format == D3DFMT_A8R8G8B8, "Got unexpected format %u.\n", info.Format); + + /* Grayscale PNG */ + hr = D3DXGetImageInfoFromFileInMemory(png_grayscale, sizeof(png_grayscale), &info);
3 years, 9 months
1
0
0
0
[reactos] 203/218: [WINESYNC] d3dx9: Avoid closing invalid handles.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=93a4e84febaede9665d29…
commit 93a4e84febaede9665d29c6779aa833e7f838965 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Tue Jan 5 13:16:40 2021 +0100 Commit: Jérôme Gardou <jerome.gardou(a)reactos.org> CommitDate: Thu Feb 4 16:37:07 2021 +0100 [WINESYNC] d3dx9: Avoid closing invalid handles. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=50373
Signed-off-by: Akihiro Sagawa <sagawa.aki(a)gmail.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id e27a95e92097a601baa9b0e9dd6fcc5013c863fa by Akihiro Sagawa <sagawa.aki(a)gmail.com> --- dll/directx/wine/d3dx9_36/util.c | 6 ++++-- sdk/tools/winesync/d3dx9.cfg | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/dll/directx/wine/d3dx9_36/util.c b/dll/directx/wine/d3dx9_36/util.c index d15444e5cdc..762c1e6034f 100644 --- a/dll/directx/wine/d3dx9_36/util.c +++ b/dll/directx/wine/d3dx9_36/util.c @@ -138,8 +138,10 @@ HRESULT map_view_of_file(const WCHAR *filename, void **buffer, DWORD *length) return S_OK; error: - CloseHandle(hmapping); - CloseHandle(hfile); + if (hmapping) + CloseHandle(hmapping); + if (hfile != INVALID_HANDLE_VALUE) + CloseHandle(hfile); return HRESULT_FROM_WIN32(GetLastError()); } diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg index 9ff89d183a5..8e6beefe8fc 100644 --- a/sdk/tools/winesync/d3dx9.cfg +++ b/sdk/tools/winesync/d3dx9.cfg @@ -34,4 +34,4 @@ files: include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h include/d3dx9xof.h: sdk/include/dxsdk/d3dx9xof.h tags: - wine: 34c0055cfcb84e32d13556b7ec841d01acf5fe96 + wine: e27a95e92097a601baa9b0e9dd6fcc5013c863fa
3 years, 9 months
1
0
0
0
[reactos] 202/218: [WINESYNC] d3dx9: Correctly handle sprites array reallocation.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1f6645eb19049bdc9efe4…
commit 1f6645eb19049bdc9efe4b69321932ec972514ed Author: winesync <ros-dev(a)reactos.org> AuthorDate: Tue Jan 5 13:16:39 2021 +0100 Commit: Jérôme Gardou <jerome.gardou(a)reactos.org> CommitDate: Thu Feb 4 16:37:07 2021 +0100 [WINESYNC] d3dx9: Correctly handle sprites array reallocation. Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 34c0055cfcb84e32d13556b7ec841d01acf5fe96 by Matteo Bruni <mbruni(a)codeweavers.com> --- dll/directx/wine/d3dx9_36/sprite.c | 10 +++++++--- sdk/tools/winesync/d3dx9.cfg | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/dll/directx/wine/d3dx9_36/sprite.c b/dll/directx/wine/d3dx9_36/sprite.c index c47b6a12be0..71cc5867f6d 100644 --- a/dll/directx/wine/d3dx9_36/sprite.c +++ b/dll/directx/wine/d3dx9_36/sprite.c @@ -346,6 +346,7 @@ static HRESULT WINAPI d3dx9_sprite_Draw(ID3DXSprite *iface, IDirect3DTexture9 *t const RECT *rect, const D3DXVECTOR3 *center, const D3DXVECTOR3 *position, D3DCOLOR color) { struct d3dx9_sprite *This = impl_from_ID3DXSprite(iface); + struct sprite *new_sprites; D3DSURFACE_DESC texdesc; TRACE("iface %p, texture %p, rect %s, center %p, position %p, color 0x%08x.\n", @@ -361,9 +362,12 @@ static HRESULT WINAPI d3dx9_sprite_Draw(ID3DXSprite *iface, IDirect3DTexture9 *t } else if (This->allocated_sprites <= This->sprite_count) { - This->allocated_sprites += This->allocated_sprites / 2; - This->sprites = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - This->sprites, This->allocated_sprites * sizeof(*This->sprites)); + new_sprites = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + This->sprites, This->allocated_sprites * 2 * sizeof(*This->sprites)); + if (!new_sprites) + return E_OUTOFMEMORY; + This->sprites = new_sprites; + This->allocated_sprites *= 2; } This->sprites[This->sprite_count].texture=texture; if(!(This->flags & D3DXSPRITE_DO_NOT_ADDREF_TEXTURE)) diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg index 8e43f742f2f..9ff89d183a5 100644 --- a/sdk/tools/winesync/d3dx9.cfg +++ b/sdk/tools/winesync/d3dx9.cfg @@ -34,4 +34,4 @@ files: include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h include/d3dx9xof.h: sdk/include/dxsdk/d3dx9xof.h tags: - wine: a097f54ea1e7e75b78842ceb835f5db5f08fea06 + wine: 34c0055cfcb84e32d13556b7ec841d01acf5fe96
3 years, 9 months
1
0
0
0
[reactos] 201/218: [WINESYNC] d3dx9: Remove unreachable DT_SINGLELINE handling from ID3DXFont_DrawText.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d7f9f9f6e85ae005efbcd…
commit d7f9f9f6e85ae005efbcd320fc0668caf14d32be Author: winesync <ros-dev(a)reactos.org> AuthorDate: Tue Jan 5 13:16:38 2021 +0100 Commit: Jérôme Gardou <jerome.gardou(a)reactos.org> CommitDate: Thu Feb 4 16:37:07 2021 +0100 [WINESYNC] d3dx9: Remove unreachable DT_SINGLELINE handling from ID3DXFont_DrawText. Signed-off-by: Sven Baars <sbaars(a)codeweavers.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id a097f54ea1e7e75b78842ceb835f5db5f08fea06 by Sven Baars <sbaars(a)codeweavers.com> --- dll/directx/wine/d3dx9_36/font.c | 21 +++++++-------------- sdk/tools/winesync/d3dx9.cfg | 2 +- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/dll/directx/wine/d3dx9_36/font.c b/dll/directx/wine/d3dx9_36/font.c index 14300d32e5e..dbc4166d086 100644 --- a/dll/directx/wine/d3dx9_36/font.c +++ b/dll/directx/wine/d3dx9_36/font.c @@ -516,7 +516,7 @@ static INT WINAPI ID3DXFontImpl_DrawTextA(ID3DXFont *iface, ID3DXSprite *sprite, } static void word_break(HDC hdc, const WCHAR *str, unsigned int *str_len, - unsigned int chars_fit, unsigned int *chars_used, DWORD format, SIZE *size) + unsigned int chars_fit, unsigned int *chars_used, SIZE *size) { SCRIPT_LOGATTR *sla; SCRIPT_ANALYSIS sa; @@ -539,7 +539,7 @@ static void word_break(HDC hdc, const WCHAR *str, unsigned int *str_len, --i; /* If the there is no word that fits put in all characters that do fit */ - if (!sla[i].fSoftBreak || (format & DT_SINGLELINE)) + if (!sla[i].fSoftBreak) i = chars_fit; *chars_used = i; @@ -575,20 +575,13 @@ static const WCHAR *read_line(HDC hdc, const WCHAR *str, unsigned int *count, num_fit = 0; GetTextExtentExPointW(hdc, dest, *dest_len, width, &num_fit, NULL, size); - if (num_fit < *dest_len) + if (num_fit < *dest_len && (format & DT_WORDBREAK)) { - if (format & DT_WORDBREAK) - { - unsigned int chars_used; + unsigned int chars_used; - word_break(hdc, dest, dest_len, num_fit, &chars_used, format, size); - *count = orig_count - chars_used; - i = chars_used; - } - else if (format & DT_SINGLELINE) - { - *count = 0; - } + word_break(hdc, dest, dest_len, num_fit, &chars_used, size); + *count = orig_count - chars_used; + i = chars_used; } if (*count && str[i] == '\n') diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg index 9c4e5a95eb4..8e43f742f2f 100644 --- a/sdk/tools/winesync/d3dx9.cfg +++ b/sdk/tools/winesync/d3dx9.cfg @@ -34,4 +34,4 @@ files: include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h include/d3dx9xof.h: sdk/include/dxsdk/d3dx9xof.h tags: - wine: 84cbf6a49dfe75b9fd497b2c3ef7e922857bb618 + wine: a097f54ea1e7e75b78842ceb835f5db5f08fea06
3 years, 9 months
1
0
0
0
[reactos] 200/218: [WINESYNC] d3dx9: Implement clipping of glyphs in ID3DXFont_DrawText.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=06bd04061437fc54095e9…
commit 06bd04061437fc54095e93ec794856110b9e461a Author: winesync <ros-dev(a)reactos.org> AuthorDate: Tue Jan 5 13:16:38 2021 +0100 Commit: Jérôme Gardou <jerome.gardou(a)reactos.org> CommitDate: Thu Feb 4 16:37:07 2021 +0100 [WINESYNC] d3dx9: Implement clipping of glyphs in ID3DXFont_DrawText. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=49546
Signed-off-by: Sven Baars <sbaars(a)codeweavers.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 84cbf6a49dfe75b9fd497b2c3ef7e922857bb618 by Sven Baars <sbaars(a)codeweavers.com> --- dll/directx/wine/d3dx9_36/font.c | 16 +++++++++++++++- sdk/tools/winesync/d3dx9.cfg | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/dll/directx/wine/d3dx9_36/font.c b/dll/directx/wine/d3dx9_36/font.c index 56cef145461..14300d32e5e 100644 --- a/dll/directx/wine/d3dx9_36/font.c +++ b/dll/directx/wine/d3dx9_36/font.c @@ -587,7 +587,6 @@ static const WCHAR *read_line(HDC hdc, const WCHAR *str, unsigned int *count, } else if (format & DT_SINGLELINE) { - *dest_len = num_fit; *count = 0; } } @@ -772,6 +771,21 @@ static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface, ID3DXSprite *sprite, pos.y = cell_inc.y + y; pos.z = 0; + if (!(format & DT_NOCLIP)) + { + if (pos.x > rect->right) + { + IDirect3DTexture9_Release(texture); + continue; + } + + if (pos.x + black_box.right - black_box.left > rect->right) + black_box.right = black_box.left + rect->right - pos.x; + + if (pos.y + black_box.bottom - black_box.top > rect->bottom) + black_box.bottom = black_box.top + rect->bottom - pos.y; + } + ID3DXSprite_Draw(target, texture, &black_box, NULL, &pos, color); IDirect3DTexture9_Release(texture); } diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg index 47c8d9b9134..9c4e5a95eb4 100644 --- a/sdk/tools/winesync/d3dx9.cfg +++ b/sdk/tools/winesync/d3dx9.cfg @@ -34,4 +34,4 @@ files: include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h include/d3dx9xof.h: sdk/include/dxsdk/d3dx9xof.h tags: - wine: 2481e617bbd529a297266ad53b1afe1d96e9af89 + wine: 84cbf6a49dfe75b9fd497b2c3ef7e922857bb618
3 years, 9 months
1
0
0
0
← Newer
1
...
7
8
9
10
11
12
13
...
44
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Results per page:
10
25
50
100
200