From c1c337b07c652c27d591c472d6ac054f378fdeb9 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sat, 18 Jul 2015 09:38:28 +0200 Subject: [PATCH] Update patches for d3dx9_36.D3DXGetShader{Input,Output}Semantics and add additional tests. --- debian/changelog | 2 + ...nt-D3DXGetShaderInputSemantics-tests.patch | 27 ++-- ...nt-D3DXGetShaderOutputSemantics.-rev.patch | 140 ++++++++++++++++++ ...plement-D3DXGetShaderOutputSemantics.patch | 82 ---------- patches/patchinstall.sh | 6 +- 5 files changed, 157 insertions(+), 100 deletions(-) create mode 100644 patches/d3dx9_36-GetShaderSemantics/0002-d3dx9_36-Implement-D3DXGetShaderOutputSemantics.-rev.patch delete mode 100644 patches/d3dx9_36-GetShaderSemantics/0002-d3dx9_36-Implement-D3DXGetShaderOutputSemantics.patch diff --git a/debian/changelog b/debian/changelog index a75da0f0..71b46e70 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,6 @@ wine-staging (1.7.48) UNRELEASED; urgency=low + * Update patches for d3dx9_36.D3DXGetShader{Input,Output}Semantics and add + additional tests. * Added patch to forward exitcode from child process when in wineconsole. * Added patch to check architecture before trying to load libraries. * Removed patch to allow to enable/disable InsertMode in wineconsole settings diff --git a/patches/d3dx9_36-GetShaderSemantics/0001-d3dx9_36-Implement-D3DXGetShaderInputSemantics-tests.patch b/patches/d3dx9_36-GetShaderSemantics/0001-d3dx9_36-Implement-D3DXGetShaderInputSemantics-tests.patch index c794722e..6e70063c 100644 --- a/patches/d3dx9_36-GetShaderSemantics/0001-d3dx9_36-Implement-D3DXGetShaderInputSemantics-tests.patch +++ b/patches/d3dx9_36-GetShaderSemantics/0001-d3dx9_36-Implement-D3DXGetShaderInputSemantics-tests.patch @@ -1,15 +1,15 @@ -From b514784351ed8c2bc33cb0238ab81b4eedf29308 Mon Sep 17 00:00:00 2001 +From f791fc56711cd4860b405604af4b30b0efc22f52 Mon Sep 17 00:00:00 2001 From: Christian Costa Date: Sat, 5 Apr 2014 14:02:07 +0200 -Subject: d3dx9_36: Implement D3DXGetShaderInputSemantics + tests. (rev 2) +Subject: d3dx9_36: Implement D3DXGetShaderInputSemantics + tests. (rev 3) Fixes bug 22682. --- dlls/d3dx9_36/d3dx9_36.spec | 2 +- - dlls/d3dx9_36/shader.c | 95 ++++++++++++++++++++++++++++++++++++++++++++ - dlls/d3dx9_36/tests/shader.c | 86 +++++++++++++++++++++++++++++++++++++++ + dlls/d3dx9_36/shader.c | 92 ++++++++++++++++++++++++++++++++++++++++++++ + dlls/d3dx9_36/tests/shader.c | 86 +++++++++++++++++++++++++++++++++++++++++ include/d3dx9shader.h | 1 + - 4 files changed, 183 insertions(+), 1 deletion(-) + 4 files changed, 180 insertions(+), 1 deletion(-) diff --git a/dlls/d3dx9_36/d3dx9_36.spec b/dlls/d3dx9_36/d3dx9_36.spec index 15d693c..9b55d21 100644 @@ -25,7 +25,7 @@ index 15d693c..9b55d21 100644 @ stdcall D3DXGetShaderSamplers(ptr ptr ptr) @ stdcall D3DXGetShaderSize(ptr) diff --git a/dlls/d3dx9_36/shader.c b/dlls/d3dx9_36/shader.c -index c66936d..62aaa5b 100644 +index cdc470b..fecc3ee 100644 --- a/dlls/d3dx9_36/shader.c +++ b/dlls/d3dx9_36/shader.c @@ -1,6 +1,7 @@ @@ -36,7 +36,7 @@ index c66936d..62aaa5b 100644 * Copyright 2011 Travis Athougies * * This library is free software; you can redistribute it and/or -@@ -2132,3 +2133,97 @@ HRESULT WINAPI D3DXDisassembleShader(const DWORD *shader, BOOL colorcode, const +@@ -2130,3 +2131,94 @@ HRESULT WINAPI D3DXDisassembleShader(const DWORD *shader, BOOL colorcode, const FIXME("%p %d %s %p: stub\n", shader, colorcode, debugstr_a(comments), disassembly); return E_OUTOFMEMORY; } @@ -67,7 +67,7 @@ index c66936d..62aaa5b 100644 + return byte_code; +} + -+static UINT get_shader_semantics(const DWORD *byte_code, D3DXSEMANTIC *semantics, BOOL input) ++static UINT get_shader_semantics(const DWORD *byte_code, D3DXSEMANTIC *semantics, DWORD type) +{ + const DWORD *ptr = byte_code; + UINT shader_model = (*ptr >> 8) & 0xff; @@ -94,7 +94,7 @@ index c66936d..62aaa5b 100644 + TRACE("D3DSIO_DCL param1: %#x, param2: %#x, usage: %u, usage_index: %u, reg_type: %u\n", + param1, param2, usage, usage_index, reg_type); + -+ if (input && (reg_type == D3DSPR_INPUT)) ++ if (reg_type == type) + { + if (semantics) + { @@ -103,10 +103,7 @@ index c66936d..62aaa5b 100644 + } + i++; + } -+ else -+ { -+ /* FIXME: Support for output semantics */ -+ } ++ + ptr++; + } + else @@ -127,7 +124,7 @@ index c66936d..62aaa5b 100644 + if (!byte_code) + return D3DERR_INVALIDCALL; + -+ nb_semantics = get_shader_semantics(byte_code, semantics, TRUE); ++ nb_semantics = get_shader_semantics(byte_code, semantics, D3DSPR_INPUT); + + if (count) + *count = nb_semantics; @@ -262,5 +259,5 @@ index d665f72..f565432 100644 HRESULT WINAPI D3DXAssembleShaderFromFileA(const char *filename, const D3DXMACRO *defines, ID3DXInclude *include, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages); -- -2.3.0 +2.4.5 diff --git a/patches/d3dx9_36-GetShaderSemantics/0002-d3dx9_36-Implement-D3DXGetShaderOutputSemantics.-rev.patch b/patches/d3dx9_36-GetShaderSemantics/0002-d3dx9_36-Implement-D3DXGetShaderOutputSemantics.-rev.patch new file mode 100644 index 00000000..66bc2cbe --- /dev/null +++ b/patches/d3dx9_36-GetShaderSemantics/0002-d3dx9_36-Implement-D3DXGetShaderOutputSemantics.-rev.patch @@ -0,0 +1,140 @@ +From f16ccf29286616feb69533c178cfccf2709184d6 Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Wed, 8 Jul 2015 10:55:03 +1000 +Subject: d3dx9_36: Implement D3DXGetShaderOutputSemantics. (rev 2) + +--- + dlls/d3dx9_36/d3dx9_36.spec | 2 +- + dlls/d3dx9_36/shader.c | 20 +++++++++++++++- + dlls/d3dx9_36/tests/shader.c | 54 ++++++++++++++++++++++++++++++++++++++++++++ + include/d3dx9shader.h | 1 + + 4 files changed, 75 insertions(+), 2 deletions(-) + +diff --git a/dlls/d3dx9_36/d3dx9_36.spec b/dlls/d3dx9_36/d3dx9_36.spec +index 9b55d21..4ae1384 100644 +--- a/dlls/d3dx9_36/d3dx9_36.spec ++++ b/dlls/d3dx9_36/d3dx9_36.spec +@@ -160,7 +160,7 @@ + @ stdcall D3DXGetShaderConstantTable(ptr ptr) + @ stdcall D3DXGetShaderConstantTableEx(ptr long ptr) + @ stdcall D3DXGetShaderInputSemantics(ptr ptr ptr) +-@ stub D3DXGetShaderOutputSemantics(ptr ptr ptr) ++@ stdcall D3DXGetShaderOutputSemantics(ptr ptr ptr) + @ stdcall D3DXGetShaderSamplers(ptr ptr ptr) + @ stdcall D3DXGetShaderSize(ptr) + @ stdcall D3DXGetShaderVersion(ptr) +diff --git a/dlls/d3dx9_36/shader.c b/dlls/d3dx9_36/shader.c +index fecc3ee..07e3ff1 100644 +--- a/dlls/d3dx9_36/shader.c ++++ b/dlls/d3dx9_36/shader.c +@@ -2171,7 +2171,7 @@ static UINT get_shader_semantics(const DWORD *byte_code, D3DXSEMANTIC *semantics + { + if (*ptr & (1 << 31)) + { +- FIXME("Opcode expected\n"); ++ FIXME("Opcode expected but got %#x\n", *ptr); + return 0; + } + else if ((*ptr & D3DSI_OPCODE_MASK) == D3DSIO_DCL) +@@ -2222,3 +2222,21 @@ HRESULT WINAPI D3DXGetShaderInputSemantics(const DWORD *byte_code, D3DXSEMANTIC + + return D3D_OK; + } ++ ++ ++HRESULT WINAPI D3DXGetShaderOutputSemantics(const DWORD *byte_code, D3DXSEMANTIC *semantics, UINT *count) ++{ ++ UINT nb_semantics; ++ ++ TRACE("byte_code %p, semantics %p, count %p\n", byte_code, semantics, count); ++ ++ if (!byte_code) ++ return D3DERR_INVALIDCALL; ++ ++ nb_semantics = get_shader_semantics(byte_code, semantics, D3DSPR_OUTPUT); ++ ++ if (count) ++ *count = nb_semantics; ++ ++ return D3D_OK; ++} +diff --git a/dlls/d3dx9_36/tests/shader.c b/dlls/d3dx9_36/tests/shader.c +index 728cd86..62de9fb 100644 +--- a/dlls/d3dx9_36/tests/shader.c ++++ b/dlls/d3dx9_36/tests/shader.c +@@ -6572,6 +6572,60 @@ static void test_get_shader_semantics(void) + ok(semantics[1].UsageIndex == 0, "Got %u, expected 0\n", semantics[0].UsageIndex); + ok(semantics[2].Usage == D3DDECLUSAGE_TEXCOORD, "Got %u, expected %u\n", semantics[2].Usage, D3DDECLUSAGE_TEXCOORD); + ok(semantics[2].UsageIndex == 1, "Got %u, expected 1\n", semantics[0].UsageIndex); ++ ++ /* Test D3DXGetShaderOutputSemantics */ ++ ++ /* Check wrong parameters */ ++ ret = D3DXGetShaderOutputSemantics(NULL, NULL, NULL); ++ ok(ret == D3DERR_INVALIDCALL, "Returned %#x, expected %#x\n", ret, D3DERR_INVALIDCALL); ++ ret = D3DXGetShaderOutputSemantics(NULL, NULL, &count); ++ ok(ret == D3DERR_INVALIDCALL, "Returned %#x, expected %#x\n", ret, D3DERR_INVALIDCALL); ++ ret = D3DXGetShaderOutputSemantics(NULL, semantics, NULL); ++ ok(ret == D3DERR_INVALIDCALL, "Returned %#x, expected %#x\n", ret, D3DERR_INVALIDCALL); ++ ret = D3DXGetShaderOutputSemantics(NULL, semantics, &count); ++ ok(ret == D3DERR_INVALIDCALL, "Returned %#x, expected %#x\n", ret, D3DERR_INVALIDCALL); ++if (0) ++{ ++ /* Crashes on wvistau64 */ ++ ret = D3DXGetShaderOutputSemantics(semantics_vs11, NULL, NULL); ++ ok(ret == D3D_OK, "Failed with %#x\n", ret); ++} ++ ++ /* Check null semantics pointer */ ++ count = 0xdeadbeef; ++ ret = D3DXGetShaderOutputSemantics(semantics_vs11, NULL, &count); ++ ok(ret == D3D_OK, "Failed with %#x\n", ret); ++ ok(count == 1, "Got %u, expected 1\n", count); ++ ++ /* Check null count pointer */ ++if (0) ++{ ++ /* Crashes on wvistau64 */ ++ memset(semantics, 0xcc, sizeof(semantics)); ++ ret = D3DXGetShaderOutputSemantics(semantics_vs11, semantics, NULL); ++ ok(ret == D3D_OK, "Failed with %#x\n", ret); ++ ok(semantics[0].Usage == D3DDECLUSAGE_COLOR, "Got %u, expected %u\n", semantics[0].Usage, D3DDECLUSAGE_COLOR); ++ ok(semantics[0].UsageIndex == 0, "Got %u, expected 0\n", semantics[0].UsageIndex); ++} ++ ++ /* Check with vs11 shader */ ++ count = 0xdeadbeef; ++ memset(semantics, 0xcc, sizeof(semantics)); ++ ret = D3DXGetShaderOutputSemantics(semantics_vs11, semantics, &count); ++ ok(ret == D3D_OK, "Failed with %#x\n", ret); ++ ok(count == 1, "Got %u, expected 1\n", count); ++ todo_wine ++ ok(semantics[0].Usage == D3DDECLUSAGE_TEXCOORD, "Got %u, expected %u\n", semantics[0].Usage, D3DDECLUSAGE_TEXCOORD); ++ ok(semantics[0].UsageIndex == 0, "Got %u, expected 0\n", semantics[0].UsageIndex); ++ ++ /* Check with vs30 shader */ ++ count = 0xdeadbeef; ++ memset(semantics, 0xcc, sizeof(semantics)); ++ ret = D3DXGetShaderOutputSemantics(semantics_vs30, semantics, &count); ++ ok(ret == D3D_OK, "Failed with %#x\n", ret); ++ ok(count == 1, "Got %u, expected 1\n", count); ++ ok(semantics[0].Usage == D3DDECLUSAGE_COLOR, "Got %u, expected %u\n", semantics[0].Usage, D3DDECLUSAGE_COLOR); ++ ok(semantics[0].UsageIndex == 0, "Got %u, expected 0\n", semantics[0].UsageIndex); + } + + START_TEST(shader) +diff --git a/include/d3dx9shader.h b/include/d3dx9shader.h +index f565432..056033b 100644 +--- a/include/d3dx9shader.h ++++ b/include/d3dx9shader.h +@@ -316,6 +316,7 @@ const char * WINAPI D3DXGetVertexShaderProfile(struct IDirect3DDevice9 *device); + HRESULT WINAPI D3DXFindShaderComment(const DWORD *byte_code, DWORD fourcc, const void **data, UINT *size); + HRESULT WINAPI D3DXGetShaderSamplers(const DWORD *byte_code, const char **samplers, UINT *count); + HRESULT WINAPI D3DXGetShaderInputSemantics(const DWORD *byte_code, D3DXSEMANTIC *semantics, UINT *count); ++HRESULT WINAPI D3DXGetShaderOuputSemantics(const DWORD *byte_code, D3DXSEMANTIC *semantics, UINT *count); + + HRESULT WINAPI D3DXAssembleShaderFromFileA(const char *filename, const D3DXMACRO *defines, + ID3DXInclude *include, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages); +-- +2.4.5 + diff --git a/patches/d3dx9_36-GetShaderSemantics/0002-d3dx9_36-Implement-D3DXGetShaderOutputSemantics.patch b/patches/d3dx9_36-GetShaderSemantics/0002-d3dx9_36-Implement-D3DXGetShaderOutputSemantics.patch deleted file mode 100644 index 5ad81704..00000000 --- a/patches/d3dx9_36-GetShaderSemantics/0002-d3dx9_36-Implement-D3DXGetShaderOutputSemantics.patch +++ /dev/null @@ -1,82 +0,0 @@ -From a3f87586958bbc1c1bb2df30b7605705254f7655 Mon Sep 17 00:00:00 2001 -From: Christian Costa -Date: Tue, 10 Feb 2015 00:45:05 +0100 -Subject: d3dx9_36: Implement D3DXGetShaderOutputSemantics. - ---- - dlls/d3dx9_36/d3dx9_36.spec | 2 +- - dlls/d3dx9_36/shader.c | 27 +++++++++++++++++++++------ - 2 files changed, 22 insertions(+), 7 deletions(-) - -diff --git a/dlls/d3dx9_36/d3dx9_36.spec b/dlls/d3dx9_36/d3dx9_36.spec -index 1fb2aaf..13b1684 100644 ---- a/dlls/d3dx9_36/d3dx9_36.spec -+++ b/dlls/d3dx9_36/d3dx9_36.spec -@@ -160,7 +160,7 @@ - @ stdcall D3DXGetShaderConstantTable(ptr ptr) - @ stdcall D3DXGetShaderConstantTableEx(ptr long ptr) - @ stdcall D3DXGetShaderInputSemantics(ptr ptr ptr) --@ stub D3DXGetShaderOutputSemantics(ptr ptr ptr) -+@ stdcall D3DXGetShaderOutputSemantics(ptr ptr ptr) - @ stdcall D3DXGetShaderSamplers(ptr ptr ptr) - @ stdcall D3DXGetShaderSize(ptr) - @ stdcall D3DXGetShaderVersion(ptr) -diff --git a/dlls/d3dx9_36/shader.c b/dlls/d3dx9_36/shader.c -index 63852d0..c3f02d2 100644 ---- a/dlls/d3dx9_36/shader.c -+++ b/dlls/d3dx9_36/shader.c -@@ -2166,7 +2166,7 @@ static UINT get_shader_semantics(const DWORD *byte_code, D3DXSEMANTIC *semantics - { - if (*ptr & (1 << 31)) - { -- FIXME("Opcode expected\n"); -+ FIXME("Opcode expected but got %#x\n", *ptr); - return 0; - } - else if ((*ptr & D3DSI_OPCODE_MASK) == D3DSIO_DCL) -@@ -2180,7 +2180,7 @@ static UINT get_shader_semantics(const DWORD *byte_code, D3DXSEMANTIC *semantics - TRACE("D3DSIO_DCL param1: %#x, param2: %#x, usage: %u, usage_index: %u, reg_type: %u\n", - param1, param2, usage, usage_index, reg_type); - -- if (input && (reg_type == D3DSPR_INPUT)) -+ if ((input && (reg_type == D3DSPR_INPUT)) || (!input && (reg_type == D3DSPR_OUTPUT))) - { - if (semantics) - { -@@ -2189,10 +2189,7 @@ static UINT get_shader_semantics(const DWORD *byte_code, D3DXSEMANTIC *semantics - } - i++; - } -- else -- { -- /* FIXME: Support for output semantics */ -- } -+ - ptr++; - } - else -@@ -2220,3 +2217,21 @@ HRESULT WINAPI D3DXGetShaderInputSemantics(const DWORD *byte_code, D3DXSEMANTIC - - return D3D_OK; - } -+ -+ -+HRESULT WINAPI D3DXGetShaderOutputSemantics(const DWORD *byte_code, D3DXSEMANTIC *semantics, UINT *count) -+{ -+ UINT nb_semantics; -+ -+ TRACE("byte_code %p, semantics %p, count %p\n", byte_code, semantics, count); -+ -+ if (!byte_code) -+ return D3DERR_INVALIDCALL; -+ -+ nb_semantics = get_shader_semantics(byte_code, semantics, FALSE); -+ -+ if (count) -+ *count = nb_semantics; -+ -+ return D3D_OK; -+} --- -2.2.2 - diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 4c5ad2b1..54dada2d 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -2329,10 +2329,10 @@ fi # | if test "$enable_d3dx9_36_GetShaderSemantics" -eq 1; then patch_apply d3dx9_36-GetShaderSemantics/0001-d3dx9_36-Implement-D3DXGetShaderInputSemantics-tests.patch - patch_apply d3dx9_36-GetShaderSemantics/0002-d3dx9_36-Implement-D3DXGetShaderOutputSemantics.patch + patch_apply d3dx9_36-GetShaderSemantics/0002-d3dx9_36-Implement-D3DXGetShaderOutputSemantics.-rev.patch ( - echo '+ { "Christian Costa", "d3dx9_36: Implement D3DXGetShaderInputSemantics + tests.", 2 },'; - echo '+ { "Christian Costa", "d3dx9_36: Implement D3DXGetShaderOutputSemantics.", 1 },'; + echo '+ { "Christian Costa", "d3dx9_36: Implement D3DXGetShaderInputSemantics + tests.", 3 },'; + echo '+ { "Alistair Leslie-Hughes", "d3dx9_36: Implement D3DXGetShaderOutputSemantics.", 2 },'; ) >> "$patchlist" fi