reactos/sdk/tools/winesync/d3dx9_staging/0006-d3dx9_36_tests__Add_initial_tests_for_D3DXDisassembleShader.diff
winesync 9fef76cb44 [WINESYNC]d3dx9_36/tests: Add initial tests for D3DXDisassembleShader.
wine-staging patch by Sebastian Lackner <sebastian@fds-team.de>
2020-02-26 18:19:18 +01:00

63 lines
2.7 KiB
Diff

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();
}