https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9fef76cb44eca1ab5a93b…
commit 9fef76cb44eca1ab5a93bb8eff07515ee955f358
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Sat Jan 4 01:49:33 2020 +0100
Commit: Jérôme Gardou <zefklop(a)users.noreply.github.com>
CommitDate: Wed Feb 26 18:19:18 2020 +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 b67ffb209c4..02675c65b53 100644
--- a/modules/rostests/winetests/d3dx9_36/shader.c
+++ b/modules/rostests/winetests/d3dx9_36/shader.c
@@ -6575,6 +6575,51 @@ static void test_shader_semantics(void)
}
}
+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();
@@ -6589,4 +6634,5 @@ START_TEST(shader)
test_registerset();
test_registerset_defaults();
test_shader_semantics();
+ test_disassemble_shader();
}
diff --git
a/sdk/tools/winesync/d3dx9_staging/0006-d3dx9_36_tests__Add_initial_tests_for_D3DXDisassembleShader.diff
b/sdk/tools/winesync/d3dx9_staging/0006-d3dx9_36_tests__Add_initial_tests_for_D3DXDisassembleShader.diff
new file mode 100644
index 00000000000..9c56aa31739
--- /dev/null
+++
b/sdk/tools/winesync/d3dx9_staging/0006-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 b67ffb2..02675c6 100644
+--- a/modules/rostests/winetests/d3dx9_36/shader.c
++++ b/modules/rostests/winetests/d3dx9_36/shader.c
+@@ -6575,6 +6575,51 @@ static void test_shader_semantics(void)
+ }
+ }
+
++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();
+@@ -6589,4 +6634,5 @@ START_TEST(shader)
+ test_registerset();
+ test_registerset_defaults();
+ test_shader_semantics();
++ test_disassemble_shader();
+ }