[D3DCOMPILER_43_WINETEST] Sync with Wine Staging 4.18. CORE-16441
authorAmine Khaldi <amine.khaldi@reactos.org>
Sat, 26 Oct 2019 12:01:05 +0000 (13:01 +0100)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sat, 26 Oct 2019 12:01:05 +0000 (13:01 +0100)
dll/directx/wine/d3dx9_43/CMakeLists.txt
modules/rostests/winetests/CMakeLists.txt
modules/rostests/winetests/d3dcompiler_43/CMakeLists.txt [new file with mode: 0644]
modules/rostests/winetests/d3dcompiler_43/asm.c [new file with mode: 0644]
modules/rostests/winetests/d3dcompiler_43/blob.c [new file with mode: 0644]
modules/rostests/winetests/d3dcompiler_43/hlsl.c [new file with mode: 0644]
modules/rostests/winetests/d3dcompiler_43/reflection.c [new file with mode: 0644]
modules/rostests/winetests/d3dcompiler_43/testlist.c [new file with mode: 0644]

index 2361819..385278a 100644 (file)
@@ -1,7 +1,7 @@
 
 add_definitions(-D__WINESRC__)
 include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine)
 
 add_definitions(-D__WINESRC__)
 include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine)
-spec2def(d3dx9_43.dll d3dx9_43.spec)
+spec2def(d3dx9_43.dll d3dx9_43.spec ADD_IMPORTLIB)
 
 list(APPEND SOURCE
     d3dx9_43_main.c
 
 list(APPEND SOURCE
     d3dx9_43_main.c
index 0e70ccb..702f31f 100644 (file)
@@ -23,6 +23,7 @@ add_subdirectory(credui)
 add_subdirectory(crypt32)
 add_subdirectory(cryptnet)
 add_subdirectory(cryptui)
 add_subdirectory(crypt32)
 add_subdirectory(cryptnet)
 add_subdirectory(cryptui)
+add_subdirectory(d3dcompiler_43)
 add_subdirectory(d3drm)
 add_subdirectory(devenum)
 add_subdirectory(dinput)
 add_subdirectory(d3drm)
 add_subdirectory(devenum)
 add_subdirectory(dinput)
diff --git a/modules/rostests/winetests/d3dcompiler_43/CMakeLists.txt b/modules/rostests/winetests/d3dcompiler_43/CMakeLists.txt
new file mode 100644 (file)
index 0000000..2fe0698
--- /dev/null
@@ -0,0 +1,13 @@
+
+add_definitions(-DUSE_WINE_TODOS -DD3D_COMPILER_VERSION=43)
+
+add_executable(d3dcompiler_43_winetest
+    asm.c
+    blob.c
+    hlsl.c
+    reflection.c
+    testlist.c)
+
+set_module_type(d3dcompiler_43_winetest win32cui)
+add_importlibs(d3dcompiler_43_winetest d3d9 d3dx9_43 user32 msvcrt kernel32)
+add_rostests_file(TARGET d3dcompiler_43_winetest)
diff --git a/modules/rostests/winetests/d3dcompiler_43/asm.c b/modules/rostests/winetests/d3dcompiler_43/asm.c
new file mode 100644 (file)
index 0000000..900e662
--- /dev/null
@@ -0,0 +1,1760 @@
+/*
+ * Copyright (C) 2010 Matteo Bruni
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+#define COBJMACROS
+#define CONST_VTABLE
+#include "wine/test.h"
+
+#include <d3d9types.h>
+#include <d3dcommon.h>
+#include <d3dcompiler.h>
+
+/* TODO: maybe this is defined in some header file,
+   perhaps with a different name? */
+#define D3DXERR_INVALIDDATA                      0x88760b59
+
+static HRESULT (WINAPI *pD3DAssemble)(const void *data, SIZE_T datasize, const char *filename,
+        const D3D_SHADER_MACRO *defines, ID3DInclude *include, UINT flags, ID3DBlob **shader,
+        ID3DBlob **error_messages);
+static pD3DPreprocess ppD3DPreprocess;
+
+struct shader_test {
+    const char *text;
+    const DWORD bytes[128];
+};
+
+static void dump_shader(DWORD *shader) {
+    unsigned int i = 0, j = 0;
+    do {
+        trace("0x%08x ", shader[i]);
+        j++;
+        i++;
+        if(j == 6) trace("\n");
+    } while(shader[i - 1] != D3DSIO_END);
+    if(j != 6) trace("\n");
+}
+
+static void exec_tests(const char *name, struct shader_test tests[], unsigned int count) {
+    HRESULT hr;
+    DWORD *res;
+    unsigned int i, j;
+    BOOL diff;
+    ID3DBlob *shader, *messages;
+
+    for(i = 0; i < count; i++) {
+        /* D3DAssemble sets messages to 0 if there aren't error messages */
+        messages = NULL;
+        hr = pD3DAssemble(tests[i].text, strlen(tests[i].text), NULL,
+                          NULL, NULL, D3DCOMPILE_SKIP_VALIDATION,
+                          &shader, &messages);
+        ok(hr == S_OK, "Test %s, shader %d: D3DAssemble failed with error 0x%x - %d\n", name, i, hr, hr & 0x0000FFFF);
+        if(messages) {
+            trace("D3DAssemble messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
+            ID3D10Blob_Release(messages);
+        }
+        if(FAILED(hr)) continue;
+
+        j = 0;
+        diff = FALSE;
+        res = ID3D10Blob_GetBufferPointer(shader);
+        while(res[j] != D3DSIO_END && tests[i].bytes[j] != D3DSIO_END) {
+            if(res[j] != tests[i].bytes[j]) diff = TRUE;
+            j++;
+        };
+        /* Both must have an end token */
+        if(res[j] != tests[i].bytes[j]) diff = TRUE;
+
+        if(diff) {
+            ok(FALSE, "Test %s, shader %d: Generated code differs\n", name, i);
+            dump_shader(res);
+        }
+        ID3D10Blob_Release(shader);
+    }
+}
+
+static void preproc_test(void) {
+    struct shader_test tests[] = {
+        {   /* shader 0 */
+            "vs.1.1\r\n"
+            "//some comments\r\n"
+            "//other comments\n"
+            "; yet another comment\r\n"
+            "add r0, r0, r1\n",
+            {0xfffe0101, 0x00000002, 0x800f0000, 0x80e40000, 0x80e40001, 0x0000ffff}
+        },
+        {   /* shader 1 */
+            "#line 1 \"vertex.vsh\"\n"
+            "vs.1.1\n",
+            {0xfffe0101, 0x0000ffff}
+        },
+        {   /* shader 2 */
+            "#define REG 1 + 2 +\\\n"
+            "3 + 4\n"
+            "vs.1.1\n"
+            "mov r0, c0[ REG ]\n",
+            {0xfffe0101, 0x00000001, 0x800f0000, 0xa0e4000a, 0x0000ffff}
+        },
+    };
+
+    exec_tests("preproc", tests, ARRAY_SIZE(tests));
+}
+
+static void ps_1_1_test(void) {
+    struct shader_test tests[] = {
+        {   /* shader 0 */
+            "ps.1.1\r\n"
+            "tex t0\r\n"
+            "add r0.rgb, r0, r1\r\n"
+            "+mov r0.a, t0\r\n",
+            {0xffff0101, 0x00000042, 0xb00f0000, 0x00000002, 0x80070000, 0x80e40000,
+             0x80e40001, 0x40000001, 0x80080000, 0xb0e40000, 0x0000ffff}
+        },
+        {   /* shader 1 */
+            "ps.1.1\n"
+            "mov_d4 r0, r1\n",
+            {0xffff0101, 0x00000001, 0x8e0f0000, 0x80e40001, 0x0000ffff}
+        },
+        {   /* shader 2 */
+            "ps_1_1\n"
+            "def c2, 0, 0., 0, 0.\n",
+            {0xffff0101, 0x00000051, 0xa00f0002, 0x00000000, 0x00000000, 0x00000000,
+             0x00000000, 0x0000ffff}
+        },
+    };
+
+    exec_tests("ps_1_1", tests, ARRAY_SIZE(tests));
+}
+
+static void vs_1_1_test(void) {
+    struct shader_test tests[] = {
+        /* Basic instruction tests */
+        {   /* shader 0 */
+            "vs_1_1\n"
+            "add r0, r1, r2\n",
+            {0xfffe0101, 0x00000002, 0x800f0000, 0x80e40001, 0x80e40002, 0x0000ffff}
+        },
+        {   /* shader 1 */
+            "vs_1_1\n"
+            "nop\n",
+            {0xfffe0101, 0x00000000, 0x0000ffff}
+        },
+        /* Output register tests */
+        {   /* shader 2 */
+            "vs_1_1\n"
+            "mov oPos, c0\n",
+            {0xfffe0101, 0x00000001, 0xc00f0000, 0xa0e40000, 0x0000ffff}
+        },
+        {   /* shader 3 */
+            "vs_1_1\n"
+            "mov oT0, c0\n",
+            {0xfffe0101, 0x00000001, 0xe00f0000, 0xa0e40000, 0x0000ffff}
+        },
+        {   /* shader 4 */
+            "vs_1_1\n"
+            "mov oT5, c0\n",
+            {0xfffe0101, 0x00000001, 0xe00f0005, 0xa0e40000, 0x0000ffff}
+        },
+        {   /* shader 5 */
+            "vs_1_1\n"
+            "mov oD0, c0\n",
+            {0xfffe0101, 0x00000001, 0xd00f0000, 0xa0e40000, 0x0000ffff}
+        },
+        {   /* shader 6 */
+            "vs_1_1\n"
+            "mov oD1, c0\n",
+            {0xfffe0101, 0x00000001, 0xd00f0001, 0xa0e40000, 0x0000ffff}
+        },
+        {   /* shader 7 */
+            "vs_1_1\n"
+            "mov oFog, c0.x\n",
+            {0xfffe0101, 0x00000001, 0xc00f0001, 0xa0000000, 0x0000ffff}
+        },
+        {   /* shader 8 */
+            "vs_1_1\n"
+            "mov oPts, c0.x\n",
+            {0xfffe0101, 0x00000001, 0xc00f0002, 0xa0000000, 0x0000ffff}
+        },
+        /* A bunch of tests for declarations */
+        {   /* shader 9 */
+            "vs_1_1\n"
+            "dcl_position0 v0",
+            {0xfffe0101, 0x0000001f, 0x80000000, 0x900f0000, 0x0000ffff}
+        },
+        {   /* shader 10 */
+            "vs_1_1\n"
+            "dcl_position v1",
+            {0xfffe0101, 0x0000001f, 0x80000000, 0x900f0001, 0x0000ffff}
+        },
+        {   /* shader 11 */
+            "vs_1_1\n"
+            "dcl_normal12 v15",
+            {0xfffe0101, 0x0000001f, 0x800c0003, 0x900f000f, 0x0000ffff}
+        },
+        {   /* shader 12 */
+            "vs_1_1\n"
+            "add r0, v0, v1\n",
+            {0xfffe0101, 0x00000002, 0x800f0000, 0x90e40000, 0x90e40001, 0x0000ffff}
+        },
+        {   /* shader 13 */
+            "vs_1_1\n"
+            "def c12, 0, -1, -0.5, 1024\n",
+            {0xfffe0101, 0x00000051, 0xa00f000c, 0x00000000, 0xbf800000, 0xbf000000,
+             0x44800000, 0x0000ffff}
+        },
+        {   /* shader 14: writemasks, swizzles */
+            "vs_1_1\n"
+            "dp4 r0.xw, r1.wzyx, r2.xxww\n",
+            {0xfffe0101, 0x00000009, 0x80090000, 0x801b0001, 0x80f00002, 0x0000ffff}
+        },
+        {   /* shader 15: negation input modifier. Other modifiers not supprted in vs_1_1 */
+            "vs_1_1\n"
+            "add r0, -r0.x, -r1\n",
+            {0xfffe0101, 0x00000002, 0x800f0000, 0x81000000, 0x81e40001, 0x0000ffff}
+        },
+        {   /* shader 16: relative addressing */
+            "vs_1_1\n"
+            "mov r0, c0[a0.x]\n",
+            {0xfffe0101, 0x00000001, 0x800f0000, 0xa0e42000, 0x0000ffff}
+        },
+        {   /* shader 17: relative addressing */
+            "vs_1_1\n"
+            "mov r0, c1[a0.x + 2]\n",
+            {0xfffe0101, 0x00000001, 0x800f0000, 0xa0e42003, 0x0000ffff}
+        },
+        {   /* shader 18 */
+            "vs_1_1\n"
+            "def c0, 1.0f, 1.0f, 1.0f, 0.5f\n",
+            {0xfffe0101, 0x00000051, 0xa00f0000, 0x3f800000, 0x3f800000, 0x3f800000,
+             0x3f000000, 0x0000ffff}
+        },
+        /* Other relative addressing tests */
+        {   /* shader 19 */
+            "vs_1_1\n"
+            "mov r0, c[ a0.x + 12 ]\n",
+            {0xfffe0101, 0x00000001, 0x800f0000, 0xa0e4200c, 0x0000ffff}
+        },
+        {   /* shader 20 */
+            "vs_1_1\n"
+            "mov r0, c[ 2 + a0.x ]\n",
+            {0xfffe0101, 0x00000001, 0x800f0000, 0xa0e42002, 0x0000ffff}
+        },
+        {   /* shader 21 */
+            "vs_1_1\n"
+            "mov r0, c[ 2 + a0.x + 12 ]\n",
+            {0xfffe0101, 0x00000001, 0x800f0000, 0xa0e4200e, 0x0000ffff}
+        },
+        {   /* shader 22 */
+            "vs_1_1\n"
+            "mov r0, c[ 2 + 10 + 12 ]\n",
+            {0xfffe0101, 0x00000001, 0x800f0000, 0xa0e40018, 0x0000ffff}
+        },
+        {   /* shader 23 */
+            "vs_1_1\n"
+            "mov r0, c4[ 2 ]\n",
+            {0xfffe0101, 0x00000001, 0x800f0000, 0xa0e40006, 0x0000ffff}
+        },
+        {   /* shader 24 */
+            "vs_1_1\n"
+            "rcp r0, v0.x\n",
+            {0xfffe0101, 0x00000006, 0x800f0000, 0x90000000, 0x0000ffff}
+        },
+        {   /* shader 25 */
+            "vs.1.1\n"
+            "rsq r0, v0.x\n",
+            {0xfffe0101, 0x00000007, 0x800f0000, 0x90000000, 0x0000ffff}
+        },
+    };
+
+    exec_tests("vs_1_1", tests, ARRAY_SIZE(tests));
+}
+
+static void ps_1_3_test(void) {
+    struct shader_test tests[] = {
+        /* Basic instruction tests */
+        {   /* shader 0 */
+            "ps_1_3\n"
+            "mov r0, r1\n",
+            {0xffff0103, 0x00000001, 0x800f0000, 0x80e40001, 0x0000ffff}
+        },
+        {   /* shader 1 */
+            "ps_1_3\n"
+            "add r0, r1, r0\n",
+            {0xffff0103, 0x00000002, 0x800f0000, 0x80e40001, 0x80e40000, 0x0000ffff}
+        },
+        /* Color interpolator tests */
+        {   /* shader 2 */
+            "ps_1_3\n"
+            "mov r0, v0\n",
+            {0xffff0103, 0x00000001, 0x800f0000, 0x90e40000, 0x0000ffff}
+        },
+        {   /* shader 3 */
+            "ps_1_3\n"
+            "mov r0, v1\n",
+            {0xffff0103, 0x00000001, 0x800f0000, 0x90e40001, 0x0000ffff}
+        },
+        /* Texture sampling instructions */
+        {   /* shader 4 */
+            "ps_1_3\n"
+            "tex t0\n",
+            {0xffff0103, 0x00000042, 0xb00f0000, 0x0000ffff}
+        },
+        {   /* shader 5 */
+            "ps_1_3\n"
+            "tex t0\n"
+            "texreg2ar t1, t0\n",
+            {0xffff0103, 0x00000042, 0xb00f0000, 0x00000045, 0xb00f0001, 0xb0e40000,
+             0x0000ffff}
+        },
+        {   /* shader 6 */
+            "ps_1_3\n"
+            "tex t0\n"
+            "texreg2gb t1, t0\n",
+            {0xffff0103, 0x00000042, 0xb00f0000, 0x00000046, 0xb00f0001, 0xb0e40000,
+             0x0000ffff}
+        },
+        {   /* shader 7 */
+            "ps_1_3\n"
+            "tex t0\n"
+            "texreg2rgb t1, t0\n",
+            {0xffff0103, 0x00000042, 0xb00f0000, 0x00000052, 0xb00f0001, 0xb0e40000,
+             0x0000ffff}
+        },
+        {   /* shader 8 */
+            "ps_1_3\n"
+            "cnd r0, r1, r0, v0\n",
+            {0xffff0103, 0x00000050, 0x800f0000, 0x80e40001, 0x80e40000, 0x90e40000,
+             0x0000ffff}
+        },
+        {   /* shader 9 */
+            "ps_1_3\n"
+            "cmp r0, r1, r0, v0\n",
+            {0xffff0103, 0x00000058, 0x800f0000, 0x80e40001, 0x80e40000, 0x90e40000,
+             0x0000ffff}
+        },
+        {   /* shader 10 */
+            "ps_1_3\n"
+            "texkill t0\n",
+            {0xffff0103, 0x00000041, 0xb00f0000, 0x0000ffff}
+        },
+        {   /* shader 11 */
+            "ps_1_3\n"
+            "tex t0\n"
+            "texm3x2pad t1, t0\n"
+            "texm3x2tex t2, t0\n",
+            {0xffff0103, 0x00000042, 0xb00f0000, 0x00000047, 0xb00f0001, 0xb0e40000,
+             0x00000048, 0xb00f0002, 0xb0e40000, 0x0000ffff}
+        },
+        {   /* shader 12 */
+            "ps_1_3\n"
+            "tex t0\n"
+            "texm3x2pad t1, t0\n"
+            "texm3x2depth t2, t0\n",
+            {0xffff0103, 0x00000042, 0xb00f0000, 0x00000047, 0xb00f0001, 0xb0e40000,
+             0x00000054, 0xb00f0002, 0xb0e40000, 0x0000ffff}
+        },
+        {   /* shader 13 */
+            "ps_1_3\n"
+            "tex t0\n"
+            "texbem t1, t0\n",
+            {0xffff0103, 0x00000042, 0xb00f0000, 0x00000043, 0xb00f0001, 0xb0e40000,
+             0x0000ffff}
+        },
+        {   /* shader 14 */
+            "ps_1_3\n"
+            "tex t0\n"
+            "texbeml t1, t0\n",
+            {0xffff0103, 0x00000042, 0xb00f0000, 0x00000044, 0xb00f0001, 0xb0e40000,
+             0x0000ffff}
+        },
+        {   /* shader 15 */
+            "ps_1_3\n"
+            "tex t0\n"
+            "texdp3tex t1, t0\n",
+            {0xffff0103, 0x00000042, 0xb00f0000, 0x00000053, 0xb00f0001, 0xb0e40000,
+             0x0000ffff}
+        },
+        {   /* shader 16 */
+            "ps_1_3\n"
+            "tex t0\n"
+            "texdp3 t1, t0\n",
+            {0xffff0103, 0x00000042, 0xb00f0000, 0x00000055, 0xb00f0001, 0xb0e40000,
+             0x0000ffff}
+        },
+        {   /* shader 17 */
+            "ps_1_3\n"
+            "tex t0\n"
+            "texm3x3pad t1, t0\n"
+            "texm3x3pad t2, t0\n"
+            "texm3x3tex t3, t0\n",
+            {0xffff0103, 0x00000042, 0xb00f0000, 0x00000049, 0xb00f0001, 0xb0e40000,
+             0x00000049, 0xb00f0002, 0xb0e40000, 0x0000004a, 0xb00f0003, 0xb0e40000,
+             0x0000ffff}
+        },
+        {   /* shader 18 */
+            "ps_1_3\n"
+            "tex t0\n"
+            "texm3x3pad t1, t0\n"
+            "texm3x3pad t2, t0\n"
+            "texm3x3 t3, t0\n",
+            {0xffff0103, 0x00000042, 0xb00f0000, 0x00000049, 0xb00f0001, 0xb0e40000,
+             0x00000049, 0xb00f0002, 0xb0e40000, 0x00000056, 0xb00f0003, 0xb0e40000,
+             0x0000ffff}
+        },
+        {   /* shader 19 */
+            "ps_1_3\n"
+            "tex t0\n"
+            "texm3x3pad t1, t0\n"
+            "texm3x3pad t2, t0\n"
+            "texm3x3spec t3, t0, c0\n",
+            {0xffff0103, 0x00000042, 0xb00f0000, 0x00000049, 0xb00f0001, 0xb0e40000,
+             0x00000049, 0xb00f0002, 0xb0e40000, 0x0000004c, 0xb00f0003, 0xb0e40000,
+             0xa0e40000, 0x0000ffff}
+        },
+        {   /* shader 20 */
+            "ps_1_3\n"
+            "tex t0\n"
+            "texm3x3pad t1, t0\n"
+            "texm3x3pad t2, t0\n"
+            "texm3x3vspec t3, t0\n",
+            {0xffff0103, 0x00000042, 0xb00f0000, 0x00000049, 0xb00f0001, 0xb0e40000,
+             0x00000049, 0xb00f0002, 0xb0e40000, 0x0000004d, 0xb00f0003, 0xb0e40000,
+             0x0000ffff}
+        },
+        {   /* shader 21 */
+            "ps_1_3\n"
+            "texcoord t0\n",
+            {0xffff0103, 0x00000040, 0xb00f0000, 0x0000ffff}
+        },
+        /* Modifiers, shifts */
+        {   /* shader 22 */
+            "ps_1_3\n"
+            "mov_x2_sat r0, 1 - r1\n",
+            {0xffff0103, 0x00000001, 0x811f0000, 0x86e40001, 0x0000ffff}
+        },
+        {   /* shader 23 */
+            "ps_1_3\n"
+            "mov_d8 r0, -r1\n",
+            {0xffff0103, 0x00000001, 0x8d0f0000, 0x81e40001, 0x0000ffff}
+        },
+        {   /* shader 24 */
+            "ps_1_3\n"
+            "mov_sat r0, r1_bx2\n",
+            {0xffff0103, 0x00000001, 0x801f0000, 0x84e40001, 0x0000ffff}
+        },
+        {   /* shader 25 */
+            "ps_1_3\n"
+            "mov_sat r0, r1_bias\n",
+            {0xffff0103, 0x00000001, 0x801f0000, 0x82e40001, 0x0000ffff}
+        },
+        {   /* shader 26 */
+            "ps_1_3\n"
+            "mov_sat r0, -r1_bias\n",
+            {0xffff0103, 0x00000001, 0x801f0000, 0x83e40001, 0x0000ffff}
+        },
+        {   /* shader 27 */
+            "ps_1_3\n"
+            "mov_sat r0, -r1_bx2\n",
+            {0xffff0103, 0x00000001, 0x801f0000, 0x85e40001, 0x0000ffff}
+        },
+        {   /* shader 28 */
+            "ps_1_3\n"
+            "mov_sat r0, -r1_x2\n",
+            {0xffff0103, 0x00000001, 0x801f0000, 0x88e40001, 0x0000ffff}
+        },
+        {   /* shader 29 */
+            "ps_1_3\n"
+            "mov_x4_sat r0.a, -r1_bx2.a\n",
+            {0xffff0103, 0x00000001, 0x82180000, 0x85ff0001, 0x0000ffff}
+        },
+        {   /* shader 30 */
+            "ps_1_3\n"
+            "texcoord_x2 t0\n",
+            {0xffff0103, 0x00000040, 0xb10f0000, 0x0000ffff}
+        },
+        {   /* shader 31 */
+            "ps_1_3\n"
+            "tex_x2 t0\n",
+            {0xffff0103, 0x00000042, 0xb10f0000, 0x0000ffff}
+        },
+        {   /* shader 32 */
+            "ps_1_3\n"
+            "texreg2ar_x4 t0, t1\n",
+            {0xffff0103, 0x00000045, 0xb20f0000, 0xb0e40001, 0x0000ffff}
+        },
+        {   /* shader 33 */
+            "ps_1_3\n"
+            "texbem_d4 t1, t0\n",
+            {0xffff0103, 0x00000043, 0xbe0f0001, 0xb0e40000, 0x0000ffff}
+        },
+        {   /* shader 34 */
+            "ps_1_3\n"
+            "tex t0\n"
+            "texm3x3pad_x2 t1, t0\n"
+            "texm3x3pad_x2 t2, t0\n"
+            "texm3x3tex_x2 t3, t0\n",
+            {0xffff0103, 0x00000042, 0xb00f0000, 0x00000049, 0xb10f0001, 0xb0e40000,
+             0x00000049, 0xb10f0002, 0xb0e40000, 0x0000004a, 0xb10f0003, 0xb0e40000,
+             0x0000ffff}
+        },
+        {   /* shader 35 */
+            "ps.1.3\n"
+            "tex t0\n"
+            "texdp3tex_x8 t1, t0\n",
+            {0xffff0103, 0x00000042, 0xb00f0000, 0x00000053, 0xb30f0001, 0xb0e40000,
+             0x0000ffff}
+        },
+    };
+
+    exec_tests("ps_1_3", tests, ARRAY_SIZE(tests));
+}
+
+static void ps_1_4_test(void) {
+    struct shader_test tests[] = {
+        /* Basic instruction tests */
+        {   /* shader 0 */
+            "ps_1_4\n"
+            "mov r0, r1\n",
+            {0xffff0104, 0x00000001, 0x800f0000, 0x80e40001, 0x0000ffff}
+        },
+        {   /* shader 1 */
+            "ps_1_4\n"
+            "mov r0, r5\n",
+            {0xffff0104, 0x00000001, 0x800f0000, 0x80e40005, 0x0000ffff}
+        },
+        {   /* shader 2 */
+            "ps_1_4\n"
+            "mov r0, c7\n",
+            {0xffff0104, 0x00000001, 0x800f0000, 0xa0e40007, 0x0000ffff}
+        },
+        {   /* shader 3 */
+            "ps_1_4\n"
+            "mov r0, v1\n",
+            {0xffff0104, 0x00000001, 0x800f0000, 0x90e40001, 0x0000ffff}
+        },
+        {   /* shader 4 */
+            "ps_1_4\n"
+            "phase\n",
+            {0xffff0104, 0x0000fffd, 0x0000ffff}
+        },
+        {   /* shader 5 */
+            "ps_1_4\n"
+            "texcrd r0, t0\n",
+            {0xffff0104, 0x00000040, 0x800f0000, 0xb0e40000, 0x0000ffff}
+        },
+        {   /* shader 6 */
+            "ps_1_4\n"
+            "texcrd r4, t3\n",
+            {0xffff0104, 0x00000040, 0x800f0004, 0xb0e40003, 0x0000ffff}
+        },
+        {   /* shader 7 */
+            "ps_1_4\n"
+            "texcrd_sat r4, t3\n",
+            {0xffff0104, 0x00000040, 0x801f0004, 0xb0e40003, 0x0000ffff}
+        },
+        {   /* shader 8 */
+            "ps_1_4\n"
+            "texld r0, t0\n",
+            {0xffff0104, 0x00000042, 0x800f0000, 0xb0e40000, 0x0000ffff}
+        },
+        {   /* shader 9 */
+            "ps_1_4\n"
+            "texld r1, t4\n",
+            {0xffff0104, 0x00000042, 0x800f0001, 0xb0e40004, 0x0000ffff}
+        },
+        {   /* shader 10 */
+            "ps_1_4\n"
+            "texld r5, r0\n",
+            {0xffff0104, 0x00000042, 0x800f0005, 0x80e40000, 0x0000ffff}
+        },
+        {   /* shader 11 */
+            "ps_1_4\n"
+            "texld r5, c0\n", /* Assembly succeeds, validation fails */
+            {0xffff0104, 0x00000042, 0x800f0005, 0xa0e40000, 0x0000ffff}
+        },
+        {   /* shader 12 */
+            "ps_1_4\n"
+            "texld r5, r2_dz\n",
+            {0xffff0104, 0x00000042, 0x800f0005, 0x89e40002, 0x0000ffff}
+        },
+        {   /* shader 13 */
+            "ps_1_4\n"
+            "bem r1.rg, c0, r0\n",
+            {0xffff0104, 0x00000059, 0x80030001, 0xa0e40000, 0x80e40000, 0x0000ffff}
+        },
+        {   /* shader 14 */
+            "ps_1_4\n"
+            "texdepth r5\n",
+            {0xffff0104, 0x00000057, 0x800f0005, 0x0000ffff}
+        },
+        {   /* shader 15 */
+            "ps_1_4\n"
+            "add r0, r1, r2_bx2\n",
+            {0xffff0104, 0x00000002, 0x800f0000, 0x80e40001, 0x84e40002, 0x0000ffff}
+        },
+        {   /* shader 16 */
+            "ps_1_4\n"
+            "add_x4 r0, r1, r2\n",
+            {0xffff0104, 0x00000002, 0x820f0000, 0x80e40001, 0x80e40002, 0x0000ffff}
+        },
+        {   /* shader 17 */
+            "ps_1_4\n"
+            "add r0.rgb, r1, r2\n"
+            "+add r0.a, r1, r2\n",
+            {0xffff0104, 0x00000002, 0x80070000, 0x80e40001, 0x80e40002, 0x40000002,
+             0x80080000, 0x80e40001, 0x80e40002, 0x0000ffff}
+        },
+        {   /* shader 18 */
+            "ps_1_4\n"
+            "texdepth_x2 r5\n",
+            {0xffff0104, 0x00000057, 0x810f0005, 0x0000ffff}
+        },
+        {   /* shader 18 */
+            "ps.1.4\n"
+            "bem_d2 r1, c0, r0\n",
+            {0xffff0104, 0x00000059, 0x8f0f0001, 0xa0e40000, 0x80e40000, 0x0000ffff}
+        },
+    };
+
+    exec_tests("ps_1_4", tests, ARRAY_SIZE(tests));
+}
+
+static void vs_2_0_test(void) {
+    struct shader_test tests[] = {
+        /* Basic instruction tests */
+        {   /* shader 0 */
+            "vs_2_0\n"
+            "mov r0, r1\n",
+            {0xfffe0200, 0x02000001, 0x800f0000, 0x80e40001, 0x0000ffff}
+        },
+        {   /* shader 1 */
+            "vs_2_0\n"
+            "lrp r0, v0, c0, r1\n",
+            {0xfffe0200, 0x04000012, 0x800f0000, 0x90e40000, 0xa0e40000, 0x80e40001,
+             0x0000ffff}
+        },
+        {   /* shader 2 */
+            "vs_2_0\n"
+            "dp4 oPos, v0, c0\n",
+            {0xfffe0200, 0x03000009, 0xc00f0000, 0x90e40000, 0xa0e40000, 0x0000ffff}
+        },
+        {   /* shader 3 */
+            "vs_2_0\n"
+            "mov r0, c0[a0.x]\n",
+            {0xfffe0200, 0x03000001, 0x800f0000, 0xa0e42000, 0xb0000000, 0x0000ffff}
+        },
+        {   /* shader 4 */
+            "vs_2_0\n"
+            "mov r0, c0[a0.y]\n",
+            {0xfffe0200, 0x03000001, 0x800f0000, 0xa0e42000, 0xb0550000, 0x0000ffff}
+        },
+        {   /* shader 5 */
+            "vs_2_0\n"
+            "mov r0, c0[a0.z]\n",
+            {0xfffe0200, 0x03000001, 0x800f0000, 0xa0e42000, 0xb0aa0000, 0x0000ffff}
+        },
+        {   /* shader 6 */
+            "vs_2_0\n"
+            "mov r0, c0[a0.w]\n",
+            {0xfffe0200, 0x03000001, 0x800f0000, 0xa0e42000, 0xb0ff0000, 0x0000ffff}
+        },
+        {   /* shader 7 */
+            "vs_2_0\n"
+            "mov r0, c0[a0.w].x\n",
+            {0xfffe0200, 0x03000001, 0x800f0000, 0xa0002000, 0xb0ff0000, 0x0000ffff}
+        },
+        {   /* shader 8 */
+            "vs_2_0\n"
+            "mov r0, -c0[a0.w+5].x\n",
+            {0xfffe0200, 0x03000001, 0x800f0000, 0xa1002005, 0xb0ff0000, 0x0000ffff}
+        },
+        {   /* shader 9 */
+            "vs_2_0\n"
+            "mov r0, c0[a0]\n",
+            {0xfffe0200, 0x03000001, 0x800f0000, 0xa0e42000, 0xb0e40000, 0x0000ffff}
+        },
+        {   /* shader 10 */
+            "vs_2_0\n"
+            "mov r0, c0[a0.xyww]\n",
+            {0xfffe0200, 0x03000001, 0x800f0000, 0xa0e42000, 0xb0f40000, 0x0000ffff}
+        },
+        {   /* shader 11 */
+            "vs_2_0\n"
+            "add r0, c0[a0.x], c1[a0.y]\n", /* validation would fail on this line */
+            {0xfffe0200, 0x05000002, 0x800f0000, 0xa0e42000, 0xb0000000, 0xa0e42001,
+             0xb0550000, 0x0000ffff}
+        },
+        {   /* shader 12 */
+            "vs_2_0\n"
+            "rep i0\n"
+            "endrep\n",
+            {0xfffe0200, 0x01000026, 0xf0e40000, 0x00000027, 0x0000ffff}
+        },
+        {   /* shader 13 */
+            "vs_2_0\n"
+            "if b0\n"
+            "else\n"
+            "endif\n",
+            {0xfffe0200, 0x01000028, 0xe0e40800, 0x0000002a, 0x0000002b, 0x0000ffff}
+        },
+        {   /* shader 14 */
+            "vs_2_0\n"
+            "loop aL, i0\n"
+            "endloop\n",
+            {0xfffe0200, 0x0200001b, 0xf0e40800, 0xf0e40000, 0x0000001d, 0x0000ffff}
+        },
+        {   /* shader 15 */
+            "vs_2_0\n"
+            "nrm r0, c0\n",
+            {0xfffe0200, 0x02000024, 0x800f0000, 0xa0e40000, 0x0000ffff}
+        },
+        {   /* shader 16 */
+            "vs_2_0\n"
+            "crs r0, r1, r2\n",
+            {0xfffe0200, 0x03000021, 0x800f0000, 0x80e40001, 0x80e40002, 0x0000ffff}
+        },
+        {   /* shader 17 */
+            "vs_2_0\n"
+            "sgn r0, r1, r2, r3\n",
+            {0xfffe0200, 0x04000022, 0x800f0000, 0x80e40001, 0x80e40002, 0x80e40003,
+             0x0000ffff}
+        },
+        {   /* shader 18 */
+            "vs_2_0\n"
+            "sincos r0, r1, r2, r3\n",
+            {0xfffe0200, 0x04000025, 0x800f0000, 0x80e40001, 0x80e40002, 0x80e40003,
+             0x0000ffff}
+        },
+        {   /* shader 19 */
+            "vs_2_0\n"
+            "pow r0, r1, r2\n",
+            {0xfffe0200, 0x03000020, 0x800f0000, 0x80e40001, 0x80e40002, 0x0000ffff}
+        },
+        {   /* shader 20 */
+            "vs_2_0\n"
+            "mova a0.y, c0.z\n",
+            {0xfffe0200, 0x0200002e, 0xb0020000, 0xa0aa0000, 0x0000ffff}
+        },
+        {   /* shader 21 */
+            "vs_2_0\n"
+            "defb b0, true\n"
+            "defb b1, false\n",
+            {0xfffe0200, 0x0200002f, 0xe00f0800, 0x00000001, 0x0200002f, 0xe00f0801,
+             0x00000000, 0x0000ffff}
+        },
+        {   /* shader 22 */
+            "vs_2_0\n"
+            "defi i0, -1, 1, 10, 0\n"
+            "defi i1, 0, 40, 30, 10\n",
+            {0xfffe0200, 0x05000030, 0xf00f0000, 0xffffffff, 0x00000001, 0x0000000a,
+             0x00000000, 0x05000030, 0xf00f0001, 0x00000000, 0x00000028, 0x0000001e,
+             0x0000000a, 0x0000ffff}
+        },
+        {   /* shader 23 */
+            "vs_2_0\n"
+            "loop aL, i0\n"
+            "mov r0, c0[aL]\n"
+            "endloop\n",
+            {0xfffe0200, 0x0200001b, 0xf0e40800, 0xf0e40000, 0x03000001, 0x800f0000,
+             0xa0e42000, 0xf0e40800, 0x0000001d, 0x0000ffff}
+        },
+        {   /* shader 24 */
+            "vs_2_0\n"
+            "call l0\n"
+            "ret\n"
+            "label l0\n"
+            "ret\n",
+            {0xfffe0200, 0x01000019, 0xa0e41000, 0x0000001c, 0x0100001e, 0xa0e41000,
+             0x0000001c, 0x0000ffff}
+        },
+        {   /* shader 25 */
+            "vs_2_0\n"
+            "callnz l0, b0\n"
+            "ret\n"
+            "label l0\n"
+            "ret\n",
+            {0xfffe0200, 0x0200001a, 0xa0e41000, 0xe0e40800, 0x0000001c, 0x0100001e,
+             0xa0e41000, 0x0000001c, 0x0000ffff}
+        },
+        {   /* shader 26 */
+            "vs_2_0\n"
+            "callnz l0, !b0\n"
+            "ret\n"
+            "label l0\n"
+            "ret\n",
+            {0xfffe0200, 0x0200001a, 0xa0e41000, 0xede40800, 0x0000001c, 0x0100001e,
+             0xa0e41000, 0x0000001c, 0x0000ffff}
+        },
+        {   /* shader 27 */
+            "vs_2_0\n"
+            "if !b0\n"
+            "else\n"
+            "endif\n",
+            {0xfffe0200, 0x01000028, 0xede40800, 0x0000002a, 0x0000002b, 0x0000ffff}
+        },
+        {   /* shader 28 */
+            "vs_2_0\n"
+            "call l3\n"
+            "ret\n"
+            "label l3\n"
+            "ret\n",
+            {0xfffe0200, 0x01000019, 0xa0e41003, 0x0000001c, 0x0100001e, 0xa0e41003, 0x0000001c, 0x0000ffff}
+        },
+        {   /* shader 29: labels up to 2047 are accepted even in vs_2_0 */
+            "vs.2.0\n"
+            "call l2047\n",
+            {0xfffe0200, 0x01000019, 0xa0e417ff, 0x0000ffff}
+        },
+    };
+
+    exec_tests("vs_2_0", tests, ARRAY_SIZE(tests));
+}
+
+static void vs_2_x_test(void) {
+    struct shader_test tests[] = {
+        {   /* shader 0 */
+            "vs_2_x\n"
+            "rep i0\n"
+            "break\n"
+            "endrep\n",
+            {0xfffe0201, 0x01000026, 0xf0e40000, 0x0000002c, 0x00000027, 0x0000ffff}
+        },
+        {   /* shader 1 */
+            "vs_2_x\n"
+            "if_ge r0, r1\n"
+            "endif\n",
+            {0xfffe0201, 0x02030029, 0x80e40000, 0x80e40001, 0x0000002b, 0x0000ffff}
+        },
+        {   /* shader 2 */
+            "vs_2_x\n"
+            "rep i0\n"
+            "break_ne r0, r1\n"
+            "endrep",
+            {0xfffe0201, 0x01000026, 0xf0e40000, 0x0205002d, 0x80e40000, 0x80e40001,
+             0x00000027, 0x0000ffff}
+        },
+
+        /* predicates */
+        {   /* shader 3 */
+            "vs_2_x\n"
+            "setp_gt p0, r0, r1\n"
+            "(!p0) add r2, r2, r3\n",
+            {0xfffe0201, 0x0301005e, 0xb00f1000, 0x80e40000, 0x80e40001, 0x14000002,
+             0x800f0002, 0xbde41000, 0x80e40002, 0x80e40003, 0x0000ffff}
+        },
+        {   /* shader 4 */
+            "vs_2_x\n"
+            "if p0.x\n"
+            "else\n"
+            "endif\n",
+            {0xfffe0201, 0x01000028, 0xb0001000, 0x0000002a, 0x0000002b, 0x0000ffff}
+        },
+        {   /* shader 5 */
+            "vs_2_x\n"
+            "callnz l0, !p0.z\n"
+            "ret\n"
+            "label l0\n"
+            "ret\n",
+            {0xfffe0201, 0x0200001a, 0xa0e41000, 0xbdaa1000, 0x0000001c,
+             0x0100001e, 0xa0e41000, 0x0000001c, 0x0000ffff}
+        },
+        {   /* shader 6 */
+            "vs.2.x\n"
+            "rep i0\n"
+            "breakp p0.w\n"
+            "endrep\n",
+            {0xfffe0201, 0x01000026, 0xf0e40000, 0x01000060, 0xb0ff1000,
+             0x00000027, 0x0000ffff}
+        },
+    };
+
+    exec_tests("vs_2_x", tests, ARRAY_SIZE(tests));
+}
+
+static void ps_2_0_test(void) {
+    struct shader_test tests[] = {
+        {   /* shader 0 */
+            "ps_2_0\n"
+            "dcl_2d s0\n",
+            {0xffff0200, 0x0200001f, 0x90000000, 0xa00f0800, 0x0000ffff}
+        },
+        {   /* shader 1 */
+            "ps_2_0\n"
+            "dcl_cube s0\n",
+            {0xffff0200, 0x0200001f, 0x98000000, 0xa00f0800, 0x0000ffff}
+        },
+        {   /* shader 2 */
+            "ps_2_0\n"
+            "dcl_volume s0\n",
+            {0xffff0200, 0x0200001f, 0xa0000000, 0xa00f0800, 0x0000ffff}
+        },
+        {   /* shader 3 */
+            "ps_2_0\n"
+            "dcl_volume s0\n"
+            "dcl_cube s1\n"
+            "dcl_2d s2\n",
+            {0xffff0200, 0x0200001f, 0xa0000000, 0xa00f0800, 0x0200001f, 0x98000000,
+             0xa00f0801, 0x0200001f, 0x90000000, 0xa00f0802, 0x0000ffff}
+        },
+        {   /* shader 4 */
+            "ps_2_0\n"
+            "mov r0, t0\n",
+            {0xffff0200, 0x02000001, 0x800f0000, 0xb0e40000, 0x0000ffff}
+        },
+        {   /* shader 5 */
+            "ps_2_0\n"
+            "dcl_2d s2\n"
+            "texld r0, t1, s2\n",
+            {0xffff0200, 0x0200001f, 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000,
+             0xb0e40001, 0xa0e40802, 0x0000ffff}
+        },
+        {   /* shader 6 */
+            "ps_2_0\n"
+            "texkill t0\n",
+            {0xffff0200, 0x01000041, 0xb00f0000, 0x0000ffff}
+        },
+        {   /* shader 7 */
+            "ps_2_0\n"
+            "mov oC0, c0\n"
+            "mov oC1, c1\n",
+            {0xffff0200, 0x02000001, 0x800f0800, 0xa0e40000, 0x02000001, 0x800f0801,
+             0xa0e40001, 0x0000ffff}
+        },
+        {   /* shader 8 */
+            "ps_2_0\n"
+            "mov oDepth, c0.x\n",
+            {0xffff0200, 0x02000001, 0x900f0800, 0xa0000000, 0x0000ffff}
+        },
+        {   /* shader 9 */
+            "ps_2_0\n"
+            "dcl_2d s2\n"
+            "texldp r0, t1, s2\n",
+            {0xffff0200, 0x0200001f, 0x90000000, 0xa00f0802, 0x03010042, 0x800f0000,
+             0xb0e40001, 0xa0e40802, 0x0000ffff}
+        },
+        {   /* shader 10 */
+            "ps.2.0\n"
+            "dcl_2d s2\n"
+            "texldb r0, t1, s2\n",
+            {0xffff0200, 0x0200001f, 0x90000000, 0xa00f0802, 0x03020042, 0x800f0000,
+             0xb0e40001, 0xa0e40802, 0x0000ffff}
+        },
+    };
+
+    exec_tests("ps_2_0", tests, ARRAY_SIZE(tests));
+}
+
+static void ps_2_x_test(void) {
+    struct shader_test tests[] = {
+        /* defb and defi are not supposed to work in ps_2_0 (even if defb actually works in ps_2_0 with native) */
+        {   /* shader 0 */
+            "ps_2_x\n"
+            "defb b0, true\n"
+            "defb b1, false\n",
+            {0xffff0201, 0x0200002f, 0xe00f0800, 0x00000001, 0x0200002f, 0xe00f0801,
+             0x00000000, 0x0000ffff}
+        },
+        {   /* shader 1 */
+            "ps_2_x\n"
+            "defi i0, -1, 1, 10, 0\n"
+            "defi i1, 0, 40, 30, 10\n",
+            {0xffff0201, 0x05000030, 0xf00f0000, 0xffffffff, 0x00000001, 0x0000000a,
+             0x00000000, 0x05000030, 0xf00f0001, 0x00000000, 0x00000028, 0x0000001e,
+             0x0000000a, 0x0000ffff}
+        },
+        {   /* shader 2 */
+            "ps_2_x\n"
+            "dsx r0, r0\n",
+            {0xffff0201, 0x0200005b, 0x800f0000, 0x80e40000, 0x0000ffff}
+        },
+        {   /* shader 3 */
+            "ps_2_x\n"
+            "dsy r0, r0\n",
+            {0xffff0201, 0x0200005c, 0x800f0000, 0x80e40000, 0x0000ffff}
+        },
+        {   /* shader 4 */
+            "ps_2_x\n"
+            "dcl_2d s2\n"
+            "texldd r0, v1, s2, r3, r4\n",
+            {0xffff0201, 0x0200001f, 0x90000000, 0xa00f0802, 0x0500005d, 0x800f0000,
+             0x90e40001, 0xa0e40802, 0x80e40003, 0x80e40004, 0x0000ffff}
+        },
+        /* Static flow control tests */
+        {   /* shader 5 */
+            "ps_2_x\n"
+            "call l0\n"
+            "ret\n"
+            "label l0\n"
+            "ret\n",
+            {0xffff0201, 0x01000019, 0xa0e41000, 0x0000001c, 0x0100001e, 0xa0e41000,
+             0x0000001c, 0x0000ffff}
+        },
+        {   /* shader 6 */
+            "ps_2_x\n"
+            "callnz l0, b0\n"
+            "ret\n"
+            "label l0\n"
+            "ret\n",
+            {0xffff0201, 0x0200001a, 0xa0e41000, 0xe0e40800, 0x0000001c, 0x0100001e,
+             0xa0e41000, 0x0000001c, 0x0000ffff}
+        },
+        {   /* shader 7 */
+            "ps_2_x\n"
+            "callnz l0, !b0\n"
+            "ret\n"
+            "label l0\n"
+            "ret\n",
+            {0xffff0201, 0x0200001a, 0xa0e41000, 0xede40800, 0x0000001c, 0x0100001e,
+             0xa0e41000, 0x0000001c, 0x0000ffff}
+        },
+        {   /* shader 8 */
+            "ps_2_x\n"
+            "if !b0\n"
+            "else\n"
+            "endif\n",
+            {0xffff0201, 0x01000028, 0xede40800, 0x0000002a, 0x0000002b, 0x0000ffff}
+        },
+        /* Dynamic flow control tests */
+        {   /* shader 9 */
+            "ps_2_x\n"
+            "rep i0\n"
+            "break\n"
+            "endrep\n",
+            {0xffff0201, 0x01000026, 0xf0e40000, 0x0000002c, 0x00000027, 0x0000ffff}
+        },
+        {   /* shader 10 */
+            "ps_2_x\n"
+            "if_ge r0, r1\n"
+            "endif\n",
+            {0xffff0201, 0x02030029, 0x80e40000, 0x80e40001, 0x0000002b, 0x0000ffff}
+        },
+        {   /* shader 11 */
+            "ps_2_x\n"
+            "rep i0\n"
+            "break_ne r0, r1\n"
+            "endrep",
+            {0xffff0201, 0x01000026, 0xf0e40000, 0x0205002d, 0x80e40000, 0x80e40001,
+             0x00000027, 0x0000ffff}
+        },
+        /* Predicates */
+        {   /* shader 12 */
+            "ps_2_x\n"
+            "setp_gt p0, r0, r1\n"
+            "(!p0) add r2, r2, r3\n",
+            {0xffff0201, 0x0301005e, 0xb00f1000, 0x80e40000, 0x80e40001, 0x14000002,
+             0x800f0002, 0xbde41000, 0x80e40002, 0x80e40003, 0x0000ffff}
+        },
+        {   /* shader 13 */
+            "ps_2_x\n"
+            "if p0.x\n"
+            "else\n"
+            "endif\n",
+            {0xffff0201, 0x01000028, 0xb0001000, 0x0000002a, 0x0000002b, 0x0000ffff}
+        },
+        {   /* shader 14 */
+            "ps_2_x\n"
+            "callnz l0, !p0.z\n"
+            "ret\n"
+            "label l0\n"
+            "ret\n",
+            {0xffff0201, 0x0200001a, 0xa0e41000, 0xbdaa1000, 0x0000001c,
+             0x0100001e, 0xa0e41000, 0x0000001c, 0x0000ffff}
+        },
+        {   /* shader 15 */
+            "ps_2_x\n"
+            "rep i0\n"
+            "breakp p0.w\n"
+            "endrep\n",
+            {0xffff0201, 0x01000026, 0xf0e40000, 0x01000060, 0xb0ff1000,
+             0x00000027, 0x0000ffff}
+        },
+        {   /* shader 16 */
+            "ps.2.x\n"
+            "call l2047\n"
+            "ret\n"
+            "label l2047\n"
+            "ret\n",
+            {0xffff0201, 0x01000019, 0xa0e417ff, 0x0000001c, 0x0100001e, 0xa0e417ff,
+             0x0000001c, 0x0000ffff}
+        },
+    };
+
+    exec_tests("ps_2_x", tests, ARRAY_SIZE(tests));
+}
+
+static void vs_3_0_test(void) {
+    struct shader_test tests[] = {
+        {   /* shader 0 */
+            "vs_3_0\n"
+            "mov r0, c0\n",
+            {0xfffe0300, 0x02000001, 0x800f0000, 0xa0e40000, 0x0000ffff}
+        },
+        {   /* shader 1 */
+            "vs_3_0\n"
+            "dcl_2d s0\n",
+            {0xfffe0300, 0x0200001f, 0x90000000, 0xa00f0800, 0x0000ffff}
+        },
+        {   /* shader 2 */
+            "vs_3_0\n"
+            "dcl_position o0\n",
+            {0xfffe0300, 0x0200001f, 0x80000000, 0xe00f0000, 0x0000ffff}
+        },
+        {   /* shader 3 */
+            "vs_3_0\n"
+            "dcl_texcoord12 o11\n",
+            {0xfffe0300, 0x0200001f, 0x800c0005, 0xe00f000b, 0x0000ffff}
+        },
+        {   /* shader 4 */
+            "vs_3_0\n"
+            "texldl r0, v0, s0\n",
+            {0xfffe0300, 0x0300005f, 0x800f0000, 0x90e40000, 0xa0e40800, 0x0000ffff}
+        },
+        {   /* shader 5 */
+            "vs_3_0\n"
+            "mov r0, c0[aL]\n",
+            {0xfffe0300, 0x03000001, 0x800f0000, 0xa0e42000, 0xf0e40800, 0x0000ffff}
+        },
+        {   /* shader 6 */
+            "vs_3_0\n"
+            "mov o[ a0.x + 12 ], r0\n",
+            {0xfffe0300, 0x03000001, 0xe00f200c, 0xb0000000, 0x80e40000, 0x0000ffff}
+        },
+        {   /* shader 7 */
+            "vs_3_0\n"
+            "add_sat r0, r0, r1\n",
+            {0xfffe0300, 0x03000002, 0x801f0000, 0x80e40000, 0x80e40001, 0x0000ffff}
+        },
+        {   /* shader 8 */
+            "vs_3_0\n"
+            "mov r2, r1_abs\n",
+            {0xfffe0300, 0x02000001, 0x800f0002, 0x8be40001, 0x0000ffff}
+        },
+        {   /* shader 9 */
+            "vs_3_0\n"
+            "mov r2, r1.xygb\n",
+            {0xfffe0300, 0x02000001, 0x800f0002, 0x80940001, 0x0000ffff}
+        },
+        {   /* shader 10 */
+            "vs_3_0\n"
+            "mov r2.xyb, r1\n",
+            {0xfffe0300, 0x02000001, 0x80070002, 0x80e40001, 0x0000ffff}
+        },
+        {   /* shader 11 */
+            "vs_3_0\n"
+            "mova_sat a0.x, r1\n",
+            {0xfffe0300, 0x0200002e, 0xb0110000, 0x80e40001, 0x0000ffff}
+        },
+        {   /* shader 12 */
+            "vs_3_0\n"
+            "sincos r0, r1\n",
+            {0xfffe0300, 0x02000025, 0x800f0000, 0x80e40001, 0x0000ffff}
+        },
+        {   /* shader 13 */
+            "vs_3_0\n"
+            "def c0, 1.0f, 1.0f, 1.0f, 0.5f\n",
+            {0xfffe0300, 0x05000051, 0xa00f0000, 0x3f800000, 0x3f800000, 0x3f800000,
+             0x3f000000, 0x0000ffff}
+        },
+        {   /* shader 14: no register number checks with relative addressing */
+            "vs.3.0\n"
+            "add r0, v20[aL], r2\n",
+            {0xfffe0300, 0x04000002, 0x800f0000, 0x90e42014, 0xf0e40800, 0x80e40002,
+             0x0000ffff}
+        },
+
+    };
+
+    exec_tests("vs_3_0", tests, ARRAY_SIZE(tests));
+}
+
+static void ps_3_0_test(void) {
+    struct shader_test tests[] = {
+        {   /* shader 0 */
+            "ps_3_0\n"
+            "mov r0, c0\n",
+            {0xffff0300, 0x02000001, 0x800f0000, 0xa0e40000, 0x0000ffff}
+        },
+        {   /* shader 1 */
+            "ps_3_0\n"
+            "dcl_normal5 v0\n",
+            {0xffff0300, 0x0200001f, 0x80050003, 0x900f0000, 0x0000ffff}
+        },
+        {   /* shader 2 */
+            "ps_3_0\n"
+            "mov r0, vPos\n",
+            {0xffff0300, 0x02000001, 0x800f0000, 0x90e41000, 0x0000ffff}
+        },
+        {   /* shader 3 */
+            "ps_3_0\n"
+            "mov r0, vFace\n",
+            {0xffff0300, 0x02000001, 0x800f0000, 0x90e41001, 0x0000ffff}
+        },
+        {   /* shader 4 */
+            "ps_3_0\n"
+            "mov r0, v[ aL + 12 ]\n",
+            {0xffff0300, 0x03000001, 0x800f0000, 0x90e4200c, 0xf0e40800, 0x0000ffff}
+        },
+        {   /* shader 5 */
+            "ps_3_0\n"
+            "loop aL, i0\n"
+            "mov r0, v0[aL]\n"
+            "endloop\n",
+            {0xffff0300, 0x0200001b, 0xf0e40800, 0xf0e40000, 0x03000001, 0x800f0000,
+             0x90e42000, 0xf0e40800, 0x0000001d, 0x0000ffff}
+        },
+        {   /* shader 6 */
+            "ps_3_0\n"
+            "texldl r0, v0, s0\n",
+            {0xffff0300, 0x0300005f, 0x800f0000, 0x90e40000, 0xa0e40800, 0x0000ffff}
+        },
+        {   /* shader 7 */
+            "ps_3_0\n"
+            "add_pp r0, r0, r1\n",
+            {0xffff0300, 0x03000002, 0x802f0000, 0x80e40000, 0x80e40001, 0x0000ffff}
+        },
+        {   /* shader 8 */
+            "ps_3_0\n"
+            "dsx_sat r0, r1\n",
+            {0xffff0300, 0x0200005b, 0x801f0000, 0x80e40001, 0x0000ffff}
+        },
+        {   /* shader 9 */
+            "ps_3_0\n"
+            "texldd_pp r0, r1, r2, r3, r4\n",
+            {0xffff0300, 0x0500005d, 0x802f0000, 0x80e40001, 0x80e40002, 0x80e40003,
+             0x80e40004, 0x0000ffff}
+        },
+        {   /* shader 10 */
+            "ps_3_0\n"
+            "texkill v0\n",
+            {0xffff0300, 0x01000041, 0x900f0000, 0x0000ffff}
+        },
+        {   /* shader 11 */
+            "ps_3_0\n"
+            "add oC3, r0, r1\n",
+            {0xffff0300, 0x03000002, 0x800f0803, 0x80e40000, 0x80e40001, 0x0000ffff}
+        },
+        {   /* shader 12 */
+            "ps_3_0\n"
+            "dcl_texcoord0_centroid v0\n",
+            {0xffff0300, 0x0200001f, 0x80000005, 0x904f0000, 0x0000ffff}
+        },
+        {   /* shader 13 */
+            "ps_3_0\n"
+            "dcl_2d_centroid s0\n",
+            {0xffff0300, 0x0200001f, 0x90000000, 0xa04f0800, 0x0000ffff}
+        },
+        {   /* shader 14 */
+            "ps.3.0\n"
+            "dcl_2d_pp s0\n",
+            {0xffff0300, 0x0200001f, 0x90000000, 0xa02f0800, 0x0000ffff}
+        },
+    };
+
+    exec_tests("ps_3_0", tests, ARRAY_SIZE(tests));
+}
+
+static void failure_test(void) {
+    const char * tests[] = {
+        /* shader 0: instruction modifier not allowed */
+        "ps_3_0\n"
+        "dcl_2d s2\n"
+        "texldd_x2 r0, v1, s2, v3, v4\n",
+        /* shader 1: coissue not supported in vertex shaders */
+        "vs.1.1\r\n"
+        "add r0.rgb, r0, r1\n"
+        "+add r0.a, r0, r2\n",
+        /* shader 2: coissue not supported in pixel shader version >= 2.0 */
+        "ps_2_0\n"
+        "texld r0, t0, s0\n"
+        "add r0.rgb, r0, r1\n"
+        "+add r0.a, r0, v1\n",
+        /* shader 3: predicates not supported in vertex shader < 2.0 */
+        "vs_1_1\n"
+        "(p0) add r0, r0, v0\n",
+        /* shader 4: register a0 doesn't exist in pixel shaders */
+        "ps_3_0\n"
+        "mov r0, v[ a0 + 12 ]\n",
+        /* shader 5: s0 doesn't exist in vs_1_1 */
+        "vs_1_1\n"
+        "mov r0, s0\n",
+        /* shader 6: aL is a scalar register, no swizzles allowed */
+        "ps_3_0\n"
+        "mov r0, v[ aL.x + 12 ]\n",
+        /* shader 7: tn doesn't exist in ps_3_0 */
+        "ps_3_0\n"
+        "dcl_2d s2\n"
+        "texldd r0, t1, s2, v3, v4\n",
+        /* shader 8: two shift modifiers */
+        "ps_1_3\n"
+        "mov_x2_x2 r0, r1\n",
+        /* shader 9: too many source registers for mov instruction */
+        "vs_1_1\n"
+        "mov r0, r1, r2\n",
+        /* shader 10: invalid combination of negate and divide modifiers */
+        "ps_1_4\n"
+        "texld r5, -r2_dz\n",
+        /* shader 11: complement modifier not allowed in >= PS 2 */
+        "ps_2_0\n"
+        "mov r2, 1 - r0\n",
+        /* shader 12: invalid modifier */
+        "vs_3_0\n"
+        "mov r2, 2 - r0\n",
+        /* shader 13: float value in relative addressing */
+        "vs_3_0\n"
+        "mov r2, c[ aL + 3.4 ]\n",
+        /* shader 14: complement modifier not available in VS */
+        "vs_3_0\n"
+        "mov r2, 1 - r1\n",
+        /* shader 15: _x2 modifier not available in VS */
+        "vs_1_1\n"
+        "mov r2, r1_x2\n",
+        /* shader 16: _abs modifier not available in < VS 3.0 */
+        "vs_1_1\n"
+        "mov r2, r1_abs\n",
+        /* shader 17: _x2 modifier not available in >= PS 2.0 */
+        "ps_2_0\n"
+        "mov r0, r1_x2\n",
+        /* shader 18: wrong swizzle */
+        "vs_2_0\n"
+        "mov r0, r1.abcd\n",
+        /* shader 19: wrong swizzle */
+        "vs_2_0\n"
+        "mov r0, r1.xyzwx\n",
+        /* shader 20: wrong swizzle */
+        "vs_2_0\n"
+        "mov r0, r1.\n",
+        /* shader 21: invalid writemask */
+        "vs_2_0\n"
+        "mov r0.xxyz, r1\n",
+        /* shader 22: register r5 doesn't exist in PS < 1.4 */
+        "ps_1_3\n"
+        "mov r5, r0\n",
+        /* shader 23: can't declare output registers in a pixel shader */
+        "ps_3_0\n"
+        "dcl_positiont o0\n",
+        /* shader 24: _pp instruction modifier not allowed in vertex shaders */
+        "vs_3_0\n"
+        "add_pp r0, r0, r1\n",
+        /* shader 25: _x4 instruction modified not allowed in > ps_1_x */
+        "ps_3_0\n"
+        "add_x4 r0, r0, r1\n",
+        /* shader 26: there aren't oCx registers in ps_1_x */
+        "ps_1_3\n"
+        "add oC0, r0, r1\n",
+        /* shader 27: oC3 is the max in >= ps_2_0 */
+        "ps_3_0\n"
+        "add oC4, r0, r1\n",
+        /* shader 28: register v17 doesn't exist */
+        "vs_3_0\n"
+        "add r0, r0, v17\n",
+        /* shader 29: register o13 doesn't exist */
+        "vs_3_0\n"
+        "add o13, r0, r1\n",
+        /* shader 30: label > 2047 not allowed */
+        "vs_3_0\n"
+        "call l2048\n",
+        /* shader 31: s20 register does not exist */
+        "ps_3_0\n"
+        "texld r0, r1, s20\n",
+        /* shader 32: t5 not allowed in ps_1_3 */
+        "ps_1_3\n"
+        "tex t5\n",
+        /* shader 33: no temporary registers relative addressing */
+        "vs_3_0\n"
+        "add r0, r0[ a0.x ], r1\n",
+        /* shader 34: no input registers relative addressing in vs_2_0 */
+        "vs_2_0\n"
+        "add r0, v[ a0.x ], r1\n",
+        /* shader 35: no aL register in ps_2_0 */
+        "ps_2_0\n"
+        "add r0, v[ aL ], r1\n",
+        /* shader 36: no relative addressing in ps_2_0 */
+        "ps_2_0\n"
+        "add r0, v[ r0 ], r1\n",
+        /* shader 37: no a0 register in ps_3_0 */
+        "ps_3_0\n"
+        "add r0, v[ a0.x ], r1\n",
+        /* shader 38: only a0.x accepted in vs_1_1 */
+        "vs_1_1\n"
+        "mov r0, c0[ a0 ]\n",
+        /* shader 39: invalid modifier for dcl instruction */
+        "ps_3_0\n"
+        "dcl_texcoord0_sat v0\n",
+        /* shader 40: shift not allowed */
+        "ps_3_0\n"
+        "dcl_texcoord0_x2 v0\n",
+        /* shader 41: no modifier allowed with dcl instruction in vs */
+        "vs_3_0\n"
+        "dcl_texcoord0_centroid v0\n",
+        /* shader 42: no modifiers with vs dcl sampler instruction */
+        "vs_3_0\n"
+        "dcl_2d_pp s0\n",
+        /* shader 43: */
+        "ps_2_0\n"
+        "texm3x3vspec t3, t0\n",
+    };
+    HRESULT hr;
+    unsigned int i;
+    ID3DBlob *shader, *messages;
+
+    for(i = 0; i < ARRAY_SIZE(tests); i++)
+    {
+        shader = NULL;
+        messages = NULL;
+        hr = pD3DAssemble(tests[i], strlen(tests[i]), NULL,
+                          NULL, NULL, D3DCOMPILE_SKIP_VALIDATION,
+                          &shader, &messages);
+        ok(hr == D3DXERR_INVALIDDATA, "Failure test, shader %d: "
+           "expected D3DAssemble failure with D3DXERR_INVALIDDATA, "
+           "got 0x%x - %d\n", i, hr, hr & 0x0000FFFF);
+        if(messages) {
+            trace("D3DAssemble messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
+            ID3D10Blob_Release(messages);
+        }
+        if(shader) {
+            DWORD *res = ID3D10Blob_GetBufferPointer(shader);
+            dump_shader(res);
+            ID3D10Blob_Release(shader);
+        }
+    }
+}
+
+static HRESULT WINAPI testD3DInclude_open(ID3DInclude *iface, D3D_INCLUDE_TYPE include_type,
+        const char *filename, const void *parent_data, const void **data, UINT *bytes)
+{
+    static const char include[] = "#define REGISTER r0\nvs.1.1\n";
+    static const char include2[] = "#include \"incl3.vsh\"\n";
+    static const char include3[] = "vs.1.1\n";
+    static const char include4[] = "#include <incl3.vsh>\n";
+    char *buffer;
+
+    trace("include_type = %d, filename %s\n", include_type, filename);
+    trace("parent_data (%p) -> %s\n", parent_data, parent_data ? (char *)parent_data : "(null)");
+
+    if (!strcmp(filename, "incl.vsh"))
+    {
+        buffer = HeapAlloc(GetProcessHeap(), 0, sizeof(include));
+        CopyMemory(buffer, include, sizeof(include));
+        *bytes = sizeof(include);
+        ok(!parent_data, "Wrong parent_data value.\n");
+    }
+    else if (!strcmp(filename, "incl2.vsh"))
+    {
+        buffer = HeapAlloc(GetProcessHeap(), 0, sizeof(include2));
+        CopyMemory(buffer, include2, sizeof(include2));
+        *bytes = sizeof(include2);
+        ok(!parent_data, "Wrong parent_data value.\n");
+        ok(include_type == D3D_INCLUDE_LOCAL, "Wrong include type %d.\n", include_type);
+    }
+    else if (!strcmp(filename, "incl3.vsh"))
+    {
+        buffer = HeapAlloc(GetProcessHeap(), 0, sizeof(include3));
+        CopyMemory(buffer, include3, sizeof(include3));
+        *bytes = sizeof(include3);
+        /* Also check for the correct parent_data content */
+        ok(parent_data != NULL
+                && (!strncmp(include2, parent_data, strlen(include2))
+                || !strncmp(include4, parent_data, strlen(include4))),
+                "Wrong parent_data value.\n");
+    }
+    else if (!strcmp(filename, "incl4.vsh"))
+    {
+        buffer = HeapAlloc(GetProcessHeap(), 0, sizeof(include4));
+        CopyMemory(buffer, include4, sizeof(include4));
+        *bytes = sizeof(include4);
+        ok(parent_data == NULL, "Wrong parent_data value.\n");
+        ok(include_type == D3D_INCLUDE_SYSTEM, "Wrong include type %d.\n", include_type);
+    }
+    else if (!strcmp(filename, "includes/incl.vsh"))
+    {
+        buffer = HeapAlloc(GetProcessHeap(), 0, sizeof(include));
+        CopyMemory(buffer, include, sizeof(include));
+        *bytes = sizeof(include);
+        ok(!parent_data, "Wrong parent_data value.\n");
+    }
+    else
+    {
+        ok(FALSE, "Unexpected file %s included.\n", filename);
+        return E_FAIL;
+    }
+
+    *data = buffer;
+
+    return S_OK;
+}
+
+static HRESULT WINAPI testD3DInclude_close(ID3DInclude *iface, const void *data)
+{
+    HeapFree(GetProcessHeap(), 0, (void *)data);
+    return S_OK;
+}
+
+static const struct ID3DIncludeVtbl D3DInclude_Vtbl =
+{
+    testD3DInclude_open,
+    testD3DInclude_close
+};
+
+struct D3DIncludeImpl {
+    ID3DInclude ID3DInclude_iface;
+};
+
+static void assembleshader_test(void) {
+    static const char test1[] =
+    {
+        "vs.1.1\n"
+        "mov DEF2, v0\n"
+    };
+    static const char testshader[] =
+    {
+        "#include \"incl.vsh\"\n"
+        "mov REGISTER, v0\n"
+    };
+    static const D3D_SHADER_MACRO defines[] =
+    {
+        {
+            "DEF1", "10 + 15"
+        },
+        {
+            "DEF2", "r0"
+        },
+        {
+            NULL, NULL
+        }
+    };
+    HRESULT hr;
+    ID3DBlob *shader, *messages;
+    struct D3DIncludeImpl include;
+
+    /* defines test */
+    shader = NULL;
+    messages = NULL;
+    hr = pD3DAssemble(test1, strlen(test1), NULL,
+                      defines, NULL, D3DCOMPILE_SKIP_VALIDATION,
+                      &shader, &messages);
+    ok(hr == S_OK, "defines test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
+    if(messages) {
+        trace("D3DAssemble messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
+        ID3D10Blob_Release(messages);
+    }
+    if(shader) ID3D10Blob_Release(shader);
+
+    /* NULL messages test */
+    shader = NULL;
+    hr = pD3DAssemble(test1, strlen(test1), NULL,
+                      defines, NULL, D3DCOMPILE_SKIP_VALIDATION,
+                      &shader, NULL);
+    ok(hr == S_OK, "NULL messages test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
+    if(shader) ID3D10Blob_Release(shader);
+
+    /* NULL shader test */
+    messages = NULL;
+    hr = pD3DAssemble(test1, strlen(test1), NULL,
+                      defines, NULL, D3DCOMPILE_SKIP_VALIDATION,
+                      NULL, &messages);
+    ok(hr == S_OK, "NULL shader test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
+    if(messages) {
+        trace("D3DAssemble messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
+        ID3D10Blob_Release(messages);
+    }
+
+    /* D3DInclude test */
+    shader = NULL;
+    messages = NULL;
+    include.ID3DInclude_iface.lpVtbl = &D3DInclude_Vtbl;
+    hr = pD3DAssemble(testshader, strlen(testshader), NULL, NULL, &include.ID3DInclude_iface,
+                      D3DCOMPILE_SKIP_VALIDATION, &shader, &messages);
+    ok(hr == S_OK, "D3DInclude test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
+    if(messages) {
+        trace("D3DAssemble messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
+        ID3D10Blob_Release(messages);
+    }
+    if(shader) ID3D10Blob_Release(shader);
+
+    /* NULL shader tests */
+    shader = NULL;
+    messages = NULL;
+    hr = pD3DAssemble(NULL, 0, NULL,
+                      NULL, NULL, D3DCOMPILE_SKIP_VALIDATION,
+                      &shader, &messages);
+    ok(hr == D3DXERR_INVALIDDATA, "NULL shader test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
+    if(messages) {
+        trace("D3DAssemble messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
+        ID3D10Blob_Release(messages);
+    }
+    if(shader) ID3D10Blob_Release(shader);
+}
+
+static void d3dpreprocess_test(void)
+{
+    static const char test1[] =
+    {
+        "vs.1.1\n"
+        "mov DEF2, v0\n"
+    };
+    static const char quotation_marks_test[] =
+    {
+        "vs.1.1\n"
+        "; ' comment\n"
+        "; \" comment\n"
+        "mov 0, v0\n"
+    };
+    static const char *include_test_shaders[] =
+    {
+        "#include \"incl.vsh\"\n"
+        "mov REGISTER, v0\n",
+
+        "#include \"incl2.vsh\"\n"
+        "mov REGISTER, v0\n",
+
+        "#include <incl.vsh>\n"
+        "mov REGISTER, v0\n",
+
+        "#include <incl4.vsh>\n"
+        "mov REGISTER, v0\n",
+
+        "#include \"includes/incl.vsh\"\n"
+        "mov REGISTER, v0\n"
+    };
+    HRESULT hr;
+    ID3DBlob *shader, *messages;
+    static const D3D_SHADER_MACRO defines[] =
+    {
+        {
+            "DEF1", "10 + 15"
+        },
+        {
+            "DEF2", "r0"
+        },
+        {
+            NULL, NULL
+        }
+    };
+    struct D3DIncludeImpl include;
+    unsigned int i;
+
+    /* pDefines test */
+    shader = NULL;
+    messages = NULL;
+    hr = ppD3DPreprocess(test1, strlen(test1), NULL,
+            defines, NULL, &shader, &messages);
+    ok(hr == S_OK, "pDefines test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
+    if (messages)
+    {
+        trace("D3DPreprocess messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
+        ID3D10Blob_Release(messages);
+    }
+    if (shader) ID3D10Blob_Release(shader);
+
+    /* NULL messages test */
+    shader = NULL;
+    hr = ppD3DPreprocess(test1, strlen(test1), NULL,
+            defines, NULL, &shader, NULL);
+    ok(hr == S_OK, "NULL messages test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
+    if (shader) ID3D10Blob_Release(shader);
+
+    /* NULL shader test */
+    messages = NULL;
+    hr = ppD3DPreprocess(test1, strlen(test1), NULL,
+            defines, NULL, NULL, &messages);
+    ok(hr == E_INVALIDARG, "NULL shader test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
+    if (messages)
+    {
+        trace("D3DPreprocess messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
+        ID3D10Blob_Release(messages);
+    }
+
+    /* quotation marks test */
+    shader = NULL;
+    messages = NULL;
+    hr = ppD3DPreprocess(quotation_marks_test, strlen(quotation_marks_test), NULL,
+            NULL, NULL, &shader, &messages);
+    todo_wine ok(hr == S_OK, "quotation marks test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
+    if (messages)
+    {
+        trace("D3DPreprocess messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
+        ID3D10Blob_Release(messages);
+    }
+    if (shader) ID3D10Blob_Release(shader);
+
+    /* pInclude tests */
+    include.ID3DInclude_iface.lpVtbl = &D3DInclude_Vtbl;
+    for (i = 0; i < ARRAY_SIZE(include_test_shaders); ++i)
+    {
+        shader = NULL;
+        messages = NULL;
+        hr = ppD3DPreprocess(include_test_shaders[i], strlen(include_test_shaders[i]), NULL, NULL,
+                &include.ID3DInclude_iface, &shader, &messages);
+        ok(hr == S_OK, "pInclude test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
+        if (messages)
+        {
+            trace("D3DPreprocess messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
+            ID3D10Blob_Release(messages);
+        }
+        if (shader) ID3D10Blob_Release(shader);
+    }
+
+    /* NULL shader tests */
+    shader = NULL;
+    messages = NULL;
+    hr = ppD3DPreprocess(NULL, 0, NULL,
+            NULL, NULL, &shader, &messages);
+    ok(hr == E_INVALIDARG, "NULL shader test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
+    if (messages)
+    {
+        trace("D3DPreprocess messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
+        ID3D10Blob_Release(messages);
+    }
+    if (shader) ID3D10Blob_Release(shader);
+}
+
+static BOOL load_d3dcompiler(void)
+{
+    HMODULE module;
+
+    if (!(module = LoadLibraryA("d3dcompiler_43.dll"))) return FALSE;
+
+    pD3DAssemble = (void*)GetProcAddress(module, "D3DAssemble");
+    ppD3DPreprocess = (void*)GetProcAddress(module, "D3DPreprocess");
+    return TRUE;
+}
+
+START_TEST(asm)
+{
+    if (!load_d3dcompiler())
+    {
+        win_skip("Could not load d3dcompiler_43.dll\n");
+        return;
+    }
+
+    preproc_test();
+    ps_1_1_test();
+    vs_1_1_test();
+    ps_1_3_test();
+    ps_1_4_test();
+    vs_2_0_test();
+    vs_2_x_test();
+    ps_2_0_test();
+    ps_2_x_test();
+    vs_3_0_test();
+    ps_3_0_test();
+
+    failure_test();
+
+    assembleshader_test();
+
+    d3dpreprocess_test();
+}
diff --git a/modules/rostests/winetests/d3dcompiler_43/blob.c b/modules/rostests/winetests/d3dcompiler_43/blob.c
new file mode 100644 (file)
index 0000000..3e1a3aa
--- /dev/null
@@ -0,0 +1,886 @@
+/*
+ * Copyright 2010 Rico Schüller
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+/*
+ * Nearly all compiler functions need the shader blob and the size. The size
+ * is always located at DWORD #6 in the shader blob (blob[6]).
+ * The functions are e.g.: D3DGet*SignatureBlob, D3DReflect
+ */
+
+#define COBJMACROS
+#include "d3dcompiler.h"
+#include "wine/test.h"
+
+/*
+ * This doesn't belong here, but for some functions it is possible to return that value,
+ * see http://msdn.microsoft.com/en-us/library/bb205278%28v=VS.85%29.aspx
+ * The original definition is in D3DX10core.h.
+ */
+#define D3DERR_INVALIDCALL 0x8876086c
+
+static HRESULT (WINAPI *pD3DCreateBlob)(SIZE_T, ID3DBlob **);
+static HRESULT (WINAPI *pD3DGetBlobPart)(const void *, SIZE_T, D3D_BLOB_PART, UINT, ID3DBlob **);
+static HRESULT (WINAPI *pD3DReadFileToBlob)(const WCHAR *, ID3DBlob **);
+static HRESULT (WINAPI *pD3DStripShader)(const void *, SIZE_T, UINT, ID3DBlob **);
+
+#define MAKE_TAG(ch0, ch1, ch2, ch3) \
+    ((DWORD)(ch0) | ((DWORD)(ch1) << 8) | \
+    ((DWORD)(ch2) << 16) | ((DWORD)(ch3) << 24 ))
+#define TAG_Aon9 MAKE_TAG('A', 'o', 'n', '9')
+#define TAG_DXBC MAKE_TAG('D', 'X', 'B', 'C')
+#define TAG_ISGN MAKE_TAG('I', 'S', 'G', 'N')
+#define TAG_OSGN MAKE_TAG('O', 'S', 'G', 'N')
+#define TAG_PCSG MAKE_TAG('P', 'C', 'S', 'G')
+#define TAG_RDEF MAKE_TAG('R', 'D', 'E', 'F')
+#define TAG_SDBG MAKE_TAG('S', 'D', 'B', 'G')
+#define TAG_SHDR MAKE_TAG('S', 'H', 'D', 'R')
+#define TAG_SHEX MAKE_TAG('S', 'H', 'E', 'X')
+#define TAG_STAT MAKE_TAG('S', 'T', 'A', 'T')
+#define TAG_XNAP MAKE_TAG('X', 'N', 'A', 'P')
+#define TAG_XNAS MAKE_TAG('X', 'N', 'A', 'S')
+
+static void test_create_blob(void)
+{
+    ID3D10Blob *blob;
+    HRESULT hr;
+    ULONG refcount;
+
+    hr = pD3DCreateBlob(1, NULL);
+    ok(hr == D3DERR_INVALIDCALL, "D3DCreateBlob failed with %x\n", hr);
+
+    hr = pD3DCreateBlob(0, NULL);
+    ok(hr == D3DERR_INVALIDCALL, "D3DCreateBlob failed with %x\n", hr);
+
+    hr = pD3DCreateBlob(0, &blob);
+    ok(hr == S_OK, "D3DCreateBlob failed with %x\n", hr);
+
+    refcount = ID3D10Blob_Release(blob);
+    ok(!refcount, "ID3DBlob has %u references left\n", refcount);
+}
+
+static const D3D_BLOB_PART parts[] =
+{
+   D3D_BLOB_INPUT_SIGNATURE_BLOB, D3D_BLOB_OUTPUT_SIGNATURE_BLOB, D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB,
+   D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB, D3D_BLOB_ALL_SIGNATURE_BLOB, D3D_BLOB_DEBUG_INFO,
+   D3D_BLOB_LEGACY_SHADER, D3D_BLOB_XNA_PREPASS_SHADER, D3D_BLOB_XNA_SHADER,
+   D3D_BLOB_TEST_ALTERNATE_SHADER, D3D_BLOB_TEST_COMPILE_DETAILS, D3D_BLOB_TEST_COMPILE_PERF
+};
+
+/*
+ * test_blob_part - fxc.exe /E VS /Tvs_4_0_level_9_0 /Fx
+ */
+#if 0
+float4 VS(float4 position : POSITION, float4 pos : SV_POSITION) : SV_POSITION
+{
+  return position;
+}
+#endif
+static DWORD test_blob_part[] = {
+0x43425844, 0x0ef2a70f, 0x6a548011, 0x91ff9409, 0x9973a43d, 0x00000001, 0x000002e0, 0x00000008,
+0x00000040, 0x0000008c, 0x000000d8, 0x0000013c, 0x00000180, 0x000001fc, 0x00000254, 0x000002ac,
+0x53414e58, 0x00000044, 0x00000044, 0xfffe0200, 0x00000020, 0x00000024, 0x00240000, 0x00240000,
+0x00240000, 0x00240000, 0x00240000, 0xfffe0200, 0x0200001f, 0x80000005, 0x900f0000, 0x02000001,
+0xc00f0000, 0x80e40000, 0x0000ffff, 0x50414e58, 0x00000044, 0x00000044, 0xfffe0200, 0x00000020,
+0x00000024, 0x00240000, 0x00240000, 0x00240000, 0x00240000, 0x00240000, 0xfffe0200, 0x0200001f,
+0x80000005, 0x900f0000, 0x02000001, 0xc00f0000, 0x80e40000, 0x0000ffff, 0x396e6f41, 0x0000005c,
+0x0000005c, 0xfffe0200, 0x00000034, 0x00000028, 0x00240000, 0x00240000, 0x00240000, 0x00240000,
+0x00240001, 0x00000000, 0xfffe0200, 0x0200001f, 0x80000005, 0x900f0000, 0x04000004, 0xc0030000,
+0x90ff0000, 0xa0e40000, 0x90e40000, 0x02000001, 0xc00c0000, 0x90e40000, 0x0000ffff, 0x52444853,
+0x0000003c, 0x00010040, 0x0000000f, 0x0300005f, 0x001010f2, 0x00000000, 0x04000067, 0x001020f2,
+0x00000000, 0x00000001, 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000000, 0x0100003e,
+0x54415453, 0x00000074, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
+0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452,
+0x00000050, 0x00000000, 0x00000000, 0x00000000, 0x0000001c, 0xfffe0400, 0x00000100, 0x0000001c,
+0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d,
+0x39207265, 0x2e39322e, 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000050, 0x00000002,
+0x00000008, 0x00000038, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000f0f, 0x00000041,
+0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000000f, 0x49534f50, 0x4e4f4954, 0x5f565300,
+0x49534f50, 0x4e4f4954, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020,
+0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49,
+};
+
+static void test_get_blob_part(void)
+{
+    ID3DBlob *blob, *blob2;
+    HRESULT hr;
+    ULONG refcount;
+    DWORD *dword;
+    SIZE_T size;
+    UINT i;
+
+    hr = pD3DCreateBlob(1, &blob2);
+    ok(hr == S_OK, "D3DCreateBlob failed with %x\n", hr);
+    blob = blob2;
+
+    /* invalid cases */
+    hr = pD3DGetBlobPart(NULL, test_blob_part[6], D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, &blob);
+    ok(hr == D3DERR_INVALIDCALL, "D3DGetBlobPart failed with %x\n", hr);
+    ok(blob2 == blob, "D3DGetBlobPart failed got %p, expected %p\n", blob, blob2);
+
+    hr = pD3DGetBlobPart(NULL, 0, D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, &blob);
+    ok(hr == D3DERR_INVALIDCALL, "D3DGetBlobPart failed with %x\n", hr);
+    ok(blob2 == blob, "D3DGetBlobPart failed got %p, expected %p\n", blob, blob2);
+
+    hr = pD3DGetBlobPart(NULL, test_blob_part[6], D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, NULL);
+    ok(hr == D3DERR_INVALIDCALL, "D3DGetBlobPart failed with %x\n", hr);
+
+    hr = pD3DGetBlobPart(NULL, 0, D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, NULL);
+    ok(hr == D3DERR_INVALIDCALL, "D3DGetBlobPart failed with %x\n", hr);
+
+    hr = pD3DGetBlobPart(test_blob_part, 0, D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, &blob);
+    ok(hr == D3DERR_INVALIDCALL, "D3DGetBlobPart failed with %x\n", hr);
+    ok(blob2 == blob, "D3DGetBlobPart failed got %p, expected %p\n", blob, blob2);
+
+    hr = pD3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, NULL);
+    ok(hr == D3DERR_INVALIDCALL, "D3DGetBlobPart failed with %x\n", hr);
+
+    hr = pD3DGetBlobPart(test_blob_part, 0, D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, NULL);
+    ok(hr == D3DERR_INVALIDCALL, "D3DGetBlobPart failed with %x\n", hr);
+
+    hr = pD3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_INPUT_SIGNATURE_BLOB, 1, &blob);
+    ok(hr == D3DERR_INVALIDCALL, "D3DGetBlobPart failed with %x\n", hr);
+    ok(blob2 == blob, "D3DGetBlobPart failed got %p, expected %p\n", blob, blob2);
+
+    hr = pD3DGetBlobPart(test_blob_part, test_blob_part[6], 0xffffffff, 0, &blob);
+    ok(hr == D3DERR_INVALIDCALL, "D3DGetBlobPart failed with %x\n", hr);
+    ok(blob2 == blob, "D3DGetBlobPart failed got %p, expected %p\n", blob, blob2);
+
+    refcount = ID3D10Blob_Release(blob2);
+    ok(!refcount, "ID3DBlob has %u references left\n", refcount);
+
+    /* D3D_BLOB_INPUT_SIGNATURE_BLOB */
+    hr = pD3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, &blob);
+    ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
+
+    size = ID3D10Blob_GetBufferSize(blob);
+    ok(size == 124, "GetBufferSize failed, got %lu, expected %u\n", size, 124);
+
+    dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
+    ok(TAG_DXBC == *dword, "DXBC got %#x, expected %#x.\n", *dword, TAG_DXBC);
+    ok(TAG_ISGN == *(dword+9), "ISGN got %#x, expected %#x.\n", *(dword+9), TAG_ISGN);
+
+    for (i = 0; i < ARRAY_SIZE(parts); i++)
+    {
+        hr = pD3DGetBlobPart(dword, size, parts[i], 0, &blob2);
+
+        if (parts[i] == D3D_BLOB_INPUT_SIGNATURE_BLOB)
+        {
+            ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
+
+            refcount = ID3D10Blob_Release(blob2);
+            ok(!refcount, "ID3DBlob has %u references left\n", refcount);
+        }
+        else
+        {
+            ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
+        }
+    }
+
+    refcount = ID3D10Blob_Release(blob);
+    ok(!refcount, "ID3DBlob has %u references left\n", refcount);
+
+    /* D3D_BLOB_OUTPUT_SIGNATURE_BLOB */
+    hr = pD3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_OUTPUT_SIGNATURE_BLOB, 0, &blob);
+    ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
+
+    size = ID3D10Blob_GetBufferSize(blob);
+    ok(size == 88, "GetBufferSize failed, got %lu, expected %u\n", size, 88);
+
+    dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
+    ok(TAG_DXBC == *dword, "DXBC got %#x, expected %#x.\n", *dword, TAG_DXBC);
+    ok(TAG_OSGN == *(dword+9), "OSGN got %#x, expected %#x.\n", *(dword+9), TAG_OSGN);
+
+    for (i = 0; i < ARRAY_SIZE(parts); i++)
+    {
+        hr = pD3DGetBlobPart(dword, size, parts[i], 0, &blob2);
+
+        if (parts[i] == D3D_BLOB_OUTPUT_SIGNATURE_BLOB)
+        {
+            ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
+
+            refcount = ID3D10Blob_Release(blob2);
+            ok(!refcount, "ID3DBlob has %u references left\n", refcount);
+        }
+        else
+        {
+            ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
+        }
+    }
+
+    refcount = ID3D10Blob_Release(blob);
+    ok(!refcount, "ID3DBlob has %u references left\n", refcount);
+
+    /* D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB */
+    hr = pD3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB, 0, &blob);
+    ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
+
+    size = ID3D10Blob_GetBufferSize(blob);
+    ok(size == 180, "GetBufferSize failed, got %lu, expected %u\n", size, 180);
+
+    dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
+    ok(TAG_DXBC == *dword, "DXBC got %#x, expected %#x.\n", *dword, TAG_DXBC);
+    ok(TAG_ISGN == *(dword+10), "ISGN got %#x, expected %#x.\n", *(dword+10), TAG_ISGN);
+    ok(TAG_OSGN == *(dword+32), "OSGN got %#x, expected %#x.\n", *(dword+32), TAG_OSGN);
+
+    for (i = 0; i < ARRAY_SIZE(parts); i++)
+    {
+        hr = pD3DGetBlobPart(dword, size, parts[i], 0, &blob2);
+
+        if (parts[i] == D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB
+                || parts[i] == D3D_BLOB_INPUT_SIGNATURE_BLOB
+                || parts[i] == D3D_BLOB_OUTPUT_SIGNATURE_BLOB)
+        {
+            ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
+
+            refcount = ID3D10Blob_Release(blob2);
+            ok(!refcount, "ID3DBlob has %u references left\n", refcount);
+        }
+        else
+        {
+            ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
+        }
+    }
+
+    refcount = ID3D10Blob_Release(blob);
+    ok(!refcount, "ID3DBlob has %u references left\n", refcount);
+
+    /* D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB */
+    hr = pD3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB, 0, &blob);
+    ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
+
+    /* D3D_BLOB_ALL_SIGNATURE_BLOB */
+    hr = pD3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_ALL_SIGNATURE_BLOB, 0, &blob);
+    ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
+
+    /* D3D_BLOB_DEBUG_INFO */
+    hr = pD3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_DEBUG_INFO, 0, &blob);
+    ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
+
+    /* D3D_BLOB_LEGACY_SHADER */
+    hr = pD3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_LEGACY_SHADER, 0, &blob);
+    ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
+
+    size = ID3D10Blob_GetBufferSize(blob);
+    ok(size == 92, "GetBufferSize failed, got %lu, expected %u\n", size, 92);
+
+    dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
+    ok(test_blob_part[0] != *dword, "DXBC failed got %#x.\n", *dword);
+
+    for (i = 0; i < ARRAY_SIZE(parts); i++)
+    {
+        /* There isn't a full DXBC blob returned for D3D_BLOB_LEGACY_SHADER */
+        hr = pD3DGetBlobPart(dword, size, parts[i], 0, &blob2);
+        ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
+    }
+
+    refcount = ID3D10Blob_Release(blob);
+    ok(!refcount, "ID3DBlob has %u references left\n", refcount);
+
+    /* D3D_BLOB_XNA_PREPASS_SHADER */
+    hr = pD3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_XNA_PREPASS_SHADER, 0, &blob);
+    ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
+
+    size = ID3D10Blob_GetBufferSize(blob);
+    ok(size == 68, "GetBufferSize failed, got %lu, expected %u\n", size, 68);
+
+    dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
+    ok(test_blob_part[0] != *dword, "DXBC failed got %#x.\n", *dword);
+
+    for (i = 0; i < ARRAY_SIZE(parts); i++)
+    {
+        /* There isn't a full DXBC blob returned for D3D_BLOB_XNA_PREPASS_SHADER */
+        hr = pD3DGetBlobPart(dword, size, parts[i], 0, &blob2);
+        ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
+    }
+
+    refcount = ID3D10Blob_Release(blob);
+    ok(!refcount, "ID3DBlob has %u references left\n", refcount);
+
+    /* D3D_BLOB_XNA_SHADER */
+    hr = pD3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_XNA_SHADER, 0, &blob);
+    ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
+
+    size = ID3D10Blob_GetBufferSize(blob);
+    ok(size == 68, "GetBufferSize failed, got %lu, expected %u\n", size, 68);
+
+    dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
+    ok(test_blob_part[0] != *dword, "DXBC failed got %#x.\n", *dword);
+
+    for (i = 0; i < ARRAY_SIZE(parts); i++)
+    {
+        /* There isn't a full DXBC blob returned for D3D_BLOB_XNA_SHADER */
+        hr = pD3DGetBlobPart(dword, size, parts[i], 0, &blob2);
+        ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
+    }
+
+    refcount = ID3D10Blob_Release(blob);
+    ok(!refcount, "ID3DBlob has %u references left\n", refcount);
+
+    /* check corner cases for D3DStripShader */
+    hr = pD3DStripShader(test_blob_part, test_blob_part[6], 0xffffffff, &blob);
+    ok(hr == S_OK, "D3DStripShader failed, got %x, expected %x\n", hr, S_OK);
+
+    refcount = ID3D10Blob_Release(blob);
+    ok(!refcount, "ID3DBlob has %u references left\n", refcount);
+
+    hr = pD3DStripShader(test_blob_part, test_blob_part[6], 0, &blob);
+    ok(hr == S_OK, "D3DStripShader failed, got %x, expected %x\n", hr, S_OK);
+
+    refcount = ID3D10Blob_Release(blob);
+    ok(!refcount, "ID3DBlob has %u references left\n", refcount);
+
+    hr = pD3DStripShader(NULL, test_blob_part[6], 0, &blob);
+    ok(hr == D3DERR_INVALIDCALL, "D3DStripShader failed, got %x, expected %x\n", hr, D3DERR_INVALIDCALL);
+
+    hr = pD3DStripShader(test_blob_part, 2, 0, &blob);
+    ok(hr == D3DERR_INVALIDCALL, "D3DStripShader failed, got %x, expected %x\n", hr, D3DERR_INVALIDCALL);
+
+    hr = pD3DStripShader(test_blob_part, test_blob_part[6], 0, NULL);
+    ok(hr == E_FAIL, "D3DStripShader failed, got %x, expected %x\n", hr, E_FAIL);
+
+    hr = pD3DStripShader(NULL, test_blob_part[6], 0, NULL);
+    ok(hr == E_FAIL, "D3DStripShader failed, got %x, expected %x\n", hr, E_FAIL);
+
+    hr = pD3DStripShader(test_blob_part, 0, 0, NULL);
+    ok(hr == E_FAIL, "D3DStripShader failed, got %x, expected %x\n", hr, E_FAIL);
+
+    /* D3DCOMPILER_STRIP_DEBUG_INFO */
+    hr = pD3DStripShader(test_blob_part, test_blob_part[6], D3DCOMPILER_STRIP_DEBUG_INFO, &blob);
+    ok(hr == S_OK, "D3DStripShader failed, got %x, expected %x\n", hr, S_OK);
+
+    size = ID3D10Blob_GetBufferSize(blob);
+    ok(size == 736, "GetBufferSize failed, got %lu, expected %u\n", size, 736);
+
+    dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
+    ok(TAG_DXBC == *dword, "DXBC got %#x, expected %#x.\n", *dword, TAG_DXBC);
+    ok(TAG_XNAS == *(dword+16), "XNAS got %#x, expected %#x.\n", *(dword+16), TAG_XNAS);
+    ok(TAG_XNAP == *(dword+35), "XNAP got %#x, expected %#x.\n", *(dword+35), TAG_XNAP);
+    ok(TAG_Aon9 == *(dword+54), "Aon9 got %#x, expected %#x.\n", *(dword+54), TAG_Aon9);
+    ok(TAG_SHDR == *(dword+79), "SHDR got %#x, expected %#x.\n", *(dword+79), TAG_SHDR);
+    ok(TAG_STAT == *(dword+96), "STAT got %#x, expected %#x.\n", *(dword+96), TAG_STAT);
+    ok(TAG_RDEF == *(dword+127), "RDEF got %#x, expected %#x.\n", *(dword+127), TAG_RDEF);
+    ok(TAG_ISGN == *(dword+149), "ISGN got %#x, expected %#x.\n", *(dword+149), TAG_ISGN);
+    ok(TAG_OSGN == *(dword+171), "OSGN got %#x, expected %#x.\n", *(dword+171), TAG_OSGN);
+
+    hr = pD3DGetBlobPart(dword, size, D3D_BLOB_DEBUG_INFO, 0, &blob2);
+    ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
+
+    refcount = ID3D10Blob_Release(blob);
+    ok(!refcount, "ID3DBlob has %u references left\n", refcount);
+
+    /* D3DCOMPILER_STRIP_REFLECTION_DATA */
+    hr = pD3DStripShader(test_blob_part, test_blob_part[6], D3DCOMPILER_STRIP_REFLECTION_DATA, &blob);
+    ok(hr == S_OK, "D3DStripShader failed, got %x, expected %x\n", hr, S_OK);
+
+    size = ID3D10Blob_GetBufferSize(blob);
+    ok(size == 516, "GetBufferSize failed, got %lu, expected %u\n", size, 516);
+
+    dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
+    ok(TAG_DXBC == *dword, "DXBC got %#x, expected %#x.\n", *dword, TAG_DXBC);
+    ok(TAG_XNAS == *(dword+14), "XNAS got %#x, expected %#x.\n", *(dword+14), TAG_XNAS);
+    ok(TAG_XNAP == *(dword+33), "XNAP got %#x, expected %#x.\n", *(dword+33), TAG_XNAP);
+    ok(TAG_Aon9 == *(dword+52), "Aon9 got %#x, expected %#x.\n", *(dword+52), TAG_Aon9);
+    ok(TAG_SHDR == *(dword+77), "SHDR got %#x, expected %#x.\n", *(dword+77), TAG_SHDR);
+    ok(TAG_ISGN == *(dword+94), "ISGN got %#x, expected %#x.\n", *(dword+94), TAG_ISGN);
+    ok(TAG_OSGN == *(dword+116), "OSGN got %#x, expected %#x.\n", *(dword+116), TAG_OSGN);
+
+    refcount = ID3D10Blob_Release(blob);
+    ok(!refcount, "ID3DBlob has %u references left\n", refcount);
+}
+
+/*
+ * test_blob_part2 - fxc.exe /E BHS /Ths_5_0 /Zi
+ */
+#if 0
+struct VSO { float3 p : POSITION; };
+struct HSDO { float e[4] : SV_TessFactor; float i[2] : SV_InsideTessFactor; };
+struct HSO { float3 p : BEZIERPOS; };
+HSDO BCHS( InputPatch<VSO, 8> ip, uint PatchID : SV_PrimitiveID )
+{
+    HSDO res;
+    res.e[0] = res.e[1] = res.e[2] = res.e[3] = 1.0f;
+    res.i[0] = res.i[1] = 1.0f;
+    return res;
+}
+[domain("quad")]
+[partitioning("integer")]
+[outputtopology("triangle_cw")]
+[outputcontrolpoints(8)]
+[patchconstantfunc("BCHS")]
+HSO BHS( InputPatch<VSO, 8> p, uint i : SV_OutputControlPointID, uint PatchID : SV_PrimitiveID )
+{
+    HSO res;
+    res.p = p[i].p;
+    return res;
+}
+#endif
+static DWORD test_blob_part2[] = {
+0x43425844, 0xa9d455ae, 0x4cf9c0df, 0x4cf806dc, 0xc57a8c2c, 0x00000001, 0x0000139b, 0x00000007,
+0x0000003c, 0x000000b4, 0x000000e8, 0x0000011c, 0x000001e0, 0x00000320, 0x000003bc, 0x46454452,
+0x00000070, 0x00000000, 0x00000000, 0x00000000, 0x0000003c, 0x48530500, 0x00000101, 0x0000003c,
+0x31314452, 0x0000003c, 0x00000018, 0x00000020, 0x00000028, 0x00000024, 0x0000000c, 0x00000000,
+0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d,
+0x39207265, 0x2e39322e, 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x0000002c, 0x00000001,
+0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000707, 0x49534f50,
+0x4e4f4954, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000,
+0x00000000, 0x00000003, 0x00000000, 0x00000807, 0x495a4542, 0x4f505245, 0xabab0053, 0x47534350,
+0x000000bc, 0x00000006, 0x00000008, 0x00000098, 0x00000000, 0x0000000b, 0x00000003, 0x00000000,
+0x00000e01, 0x00000098, 0x00000001, 0x0000000b, 0x00000003, 0x00000001, 0x00000e01, 0x00000098,
+0x00000002, 0x0000000b, 0x00000003, 0x00000002, 0x00000e01, 0x00000098, 0x00000003, 0x0000000b,
+0x00000003, 0x00000003, 0x00000e01, 0x000000a6, 0x00000000, 0x0000000c, 0x00000003, 0x00000004,
+0x00000e01, 0x000000a6, 0x00000001, 0x0000000c, 0x00000003, 0x00000005, 0x00000e01, 0x545f5653,
+0x46737365, 0x6f746361, 0x56530072, 0x736e495f, 0x54656469, 0x46737365, 0x6f746361, 0xabab0072,
+0x58454853, 0x00000138, 0x00030050, 0x0000004e, 0x01000071, 0x01004093, 0x01004094, 0x01001895,
+0x01000896, 0x01001897, 0x0100086a, 0x01000073, 0x02000099, 0x00000004, 0x0200005f, 0x00017000,
+0x04000067, 0x00102012, 0x00000000, 0x0000000b, 0x04000067, 0x00102012, 0x00000001, 0x0000000c,
+0x04000067, 0x00102012, 0x00000002, 0x0000000d, 0x04000067, 0x00102012, 0x00000003, 0x0000000e,
+0x02000068, 0x00000001, 0x0400005b, 0x00102012, 0x00000000, 0x00000004, 0x04000036, 0x00100012,
+0x00000000, 0x0001700a, 0x06000036, 0x00902012, 0x0010000a, 0x00000000, 0x00004001, 0x3f800000,
+0x0100003e, 0x01000073, 0x02000099, 0x00000002, 0x0200005f, 0x00017000, 0x04000067, 0x00102012,
+0x00000004, 0x0000000f, 0x04000067, 0x00102012, 0x00000005, 0x00000010, 0x02000068, 0x00000001,
+0x0400005b, 0x00102012, 0x00000004, 0x00000002, 0x04000036, 0x00100012, 0x00000000, 0x0001700a,
+0x07000036, 0x00d02012, 0x00000004, 0x0010000a, 0x00000000, 0x00004001, 0x3f800000, 0x0100003e,
+0x54415453, 0x00000094, 0x00000006, 0x00000001, 0x00000000, 0x00000005, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x0000000f, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000008, 0x00000003, 0x00000001, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x47424453,
+0x00000fd7, 0x00000054, 0x000002d5, 0x00000306, 0x0000030a, 0x00000101, 0x00000001, 0x00000000,
+0x00000006, 0x00000010, 0x00000006, 0x00000958, 0x00000000, 0x000009e8, 0x00000008, 0x000009e8,
+0x00000006, 0x00000a88, 0x00000007, 0x00000b00, 0x00000c34, 0x00000c64, 0x00000000, 0x0000004a,
+0x0000004a, 0x0000026a, 0x00000000, 0x00000036, 0x00000001, 0x00000004, 0x00000000, 0xffffffff,
+0x00000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000003, 0x00000000,
+0x00000003, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0xffffffff, 0xffffffff, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000007,
+0x00000000, 0x00000003, 0x00000024, 0x00000000, 0x00000000, 0x00000001, 0x00000036, 0x00000001,
+0x00000001, 0x00000000, 0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000,
+0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
+0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000007, 0x00000000, 0x00000003, 0x00000024, 0x00000000, 0x00000000,
+0x00000002, 0x0000003e, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000007, 0x00000000, 0x00000003,
+0x00000024, 0x00000000, 0x00000000, 0x00000003, 0x00000036, 0x00000001, 0x00000004, 0x00000000,
+0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000001,
+0x00000000, 0x00000001, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0xffffffff, 0xffffffff, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000007, 0x00000000, 0x00000003, 0x00000024, 0x00000000, 0x00000000, 0x00000004, 0x00000036,
+0x00000001, 0x00000001, 0x00000004, 0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0xffffffff,
+0x00000004, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000,
+0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000007, 0x00000000, 0x00000003, 0x00000024, 0x00000000,
+0x00000000, 0x00000005, 0x0000003e, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000007, 0x00000000,
+0x00000003, 0x00000024, 0x00000000, 0x00000000, 0x00000006, 0x00000003, 0xffffffff, 0xffffffff,
+0x00000003, 0x00000000, 0x00000006, 0x00000003, 0xffffffff, 0xffffffff, 0x00000003, 0x00000001,
+0x00000006, 0x00000003, 0xffffffff, 0xffffffff, 0x00000003, 0x00000002, 0x00000006, 0x00000003,
+0xffffffff, 0xffffffff, 0x00000003, 0x00000003, 0x00000006, 0x00000003, 0xffffffff, 0xffffffff,
+0x00000003, 0x00000004, 0x00000006, 0x00000003, 0xffffffff, 0xffffffff, 0x00000003, 0x00000005,
+0x00000000, 0x00000002, 0x00000014, 0x00000007, 0x000002c1, 0x00000000, 0x00000002, 0x00000030,
+0x00000007, 0x000002c8, 0x00000000, 0x00000004, 0x0000001e, 0x00000002, 0x00000102, 0x00000000,
+0x00000004, 0x00000027, 0x00000007, 0x0000010b, 0x00000000, 0x00000006, 0x00000009, 0x00000003,
+0x00000131, 0x00000000, 0x00000001, 0x00000014, 0x00000006, 0x000002cf, 0x00000000, 0x00000004,
+0x00000005, 0x00000004, 0x000000e9, 0x00000000, 0x00000009, 0x00000004, 0x00000000, 0x00000000,
+0x00000003, 0x00000051, 0x00000003, 0x00000001, 0x00000000, 0x00000003, 0x00000076, 0x00000004,
+0x00000002, 0x00000004, 0x00000000, 0x000002b4, 0x00000007, 0x00000001, 0x0000000c, 0x00000003,
+0x00000076, 0x00000004, 0x00000002, 0x00000004, 0x00000001, 0x000002bb, 0x00000006, 0x00000001,
+0x00000010, 0x00000004, 0x000000e9, 0x00000004, 0x00000003, 0x00000014, 0x00000005, 0x00000000,
+0x00000001, 0x00000001, 0x00000003, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000003,
+0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0xffffffff, 0x00000001,
+0x00000014, 0x00000004, 0x00000004, 0xffffffff, 0x00000001, 0x00000000, 0x00000000, 0x00000001,
+0x00000001, 0xffffffff, 0x00000001, 0x00000008, 0x00000004, 0x00000002, 0xffffffff, 0x00000006,
+0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
+0x00000006, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000001, 0x00000020, 0x0000000c, 0x00000018, 0xffffffff, 0x00000003, 0x00000000, 0x00000000,
+0x00000001, 0x00000001, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0xffffffff,
+0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000,
+0x00000000, 0x00000006, 0xffffffff, 0x00000000, 0x00000001, 0x00000002, 0x00000003, 0x00000006,
+0x00000004, 0x00000005, 0x00000006, 0x00000008, 0x00000004, 0x00000005, 0x00000002, 0x505c3a43,
+0x72676f72, 0x656d6d61, 0x63694d5c, 0x6f736f72, 0x44207466, 0x63657269, 0x53205874, 0x28204b44,
+0x656e754a, 0x31303220, 0x555c2930, 0x696c6974, 0x73656974, 0x6e69625c, 0x3638785c, 0x6165685c,
+0x2e726564, 0x74737866, 0x74637572, 0x4f535620, 0x66207b20, 0x74616f6c, 0x20702033, 0x4f50203a,
+0x49544953, 0x203b4e4f, 0x730a3b7d, 0x63757274, 0x53482074, 0x7b204f44, 0x6f6c6620, 0x65207461,
+0x205d345b, 0x5653203a, 0x7365545f, 0x63614673, 0x3b726f74, 0x6f6c6620, 0x69207461, 0x205d325b,
+0x5653203a, 0x736e495f, 0x54656469, 0x46737365, 0x6f746361, 0x7d203b72, 0x74730a3b, 0x74637572,
+0x4f534820, 0x66207b20, 0x74616f6c, 0x20702033, 0x4542203a, 0x5245495a, 0x3b534f50, 0x0a3b7d20,
+0x4f445348, 0x48434220, 0x49202853, 0x7475706e, 0x63746150, 0x53563c68, 0x38202c4f, 0x7069203e,
+0x6975202c, 0x5020746e, 0x68637461, 0x3a204449, 0x5f565320, 0x6d697250, 0x76697469, 0x20444965,
+0x0a7b0a29, 0x20202020, 0x4f445348, 0x73657220, 0x20200a3b, 0x65722020, 0x5b652e73, 0x3d205d30,
+0x73657220, 0x315b652e, 0x203d205d, 0x2e736572, 0x5d325b65, 0x72203d20, 0x652e7365, 0x205d335b,
+0x2e31203d, 0x0a3b6630, 0x20202020, 0x2e736572, 0x5d305b69, 0x72203d20, 0x692e7365, 0x205d315b,
+0x2e31203d, 0x0a3b6630, 0x20202020, 0x75746572, 0x72206e72, 0x0a3b7365, 0x645b0a7d, 0x69616d6f,
+0x7122286e, 0x22646175, 0x5b0a5d29, 0x74726170, 0x6f697469, 0x676e696e, 0x6e692228, 0x65676574,
+0x5d292272, 0x756f5b0a, 0x74757074, 0x6f706f74, 0x79676f6c, 0x72742228, 0x676e6169, 0x635f656c,
+0x5d292277, 0x756f5b0a, 0x74757074, 0x746e6f63, 0x706c6f72, 0x746e696f, 0x29382873, 0x705b0a5d,
+0x68637461, 0x736e6f63, 0x746e6174, 0x636e7566, 0x43422228, 0x29225348, 0x53480a5d, 0x4842204f,
+0x49202853, 0x7475706e, 0x63746150, 0x53563c68, 0x38202c4f, 0x2c70203e, 0x6e697520, 0x20692074,
+0x5653203a, 0x74754f5f, 0x43747570, 0x72746e6f, 0x6f506c6f, 0x49746e69, 0x75202c44, 0x20746e69,
+0x63746150, 0x20444968, 0x5653203a, 0x6972505f, 0x6974696d, 0x44496576, 0x7b0a2920, 0x2020200a,
+0x4f534820, 0x73657220, 0x20200a3b, 0x65722020, 0x20702e73, 0x5b70203d, 0x702e5d69, 0x20200a3b,
+0x65722020, 0x6e727574, 0x73657220, 0x0a7d0a3b, 0x626f6c47, 0x4c736c61, 0x6c61636f, 0x44534873,
+0x653a3a4f, 0x4f445348, 0x56693a3a, 0x3a3a4f53, 0x63694d70, 0x6f736f72, 0x28207466, 0x48202952,
+0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e,
+0x48420031, 0x73680053, 0x305f355f, 0x6e6f6320, 0x6c6f7274, 0x696f7020, 0x0000746e,
+};
+
+static void test_get_blob_part2(void)
+{
+    ID3DBlob *blob, *blob2;
+    HRESULT hr;
+    ULONG refcount;
+    DWORD *dword;
+    SIZE_T size;
+    UINT i;
+
+    /* D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB */
+    hr = pD3DGetBlobPart(test_blob_part2, test_blob_part2[6], D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB, 0, &blob);
+    ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
+
+    size = ID3D10Blob_GetBufferSize(blob);
+    ok(size == 232, "GetBufferSize failed, got %lu, expected %u\n", size, 232);
+
+    dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
+    ok(TAG_DXBC == *dword, "DXBC got %#x, expected %#x.\n", *dword, TAG_DXBC);
+    ok(TAG_PCSG == *(dword+9), "PCSG got %#x, expected %#x.\n", *(dword+9), TAG_PCSG);
+
+    for (i = 0; i < ARRAY_SIZE(parts); i++)
+    {
+        hr = pD3DGetBlobPart(dword, size, parts[i], 0, &blob2);
+
+        if (parts[i] == D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB)
+        {
+            ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
+
+            refcount = ID3D10Blob_Release(blob2);
+            ok(!refcount, "ID3DBlob has %u references left\n", refcount);
+        }
+        else
+        {
+            ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
+        }
+    }
+
+    refcount = ID3D10Blob_Release(blob);
+    ok(!refcount, "ID3DBlob has %u references left\n", refcount);
+
+    /* D3D_BLOB_ALL_SIGNATURE_BLOB */
+    hr = pD3DGetBlobPart(test_blob_part2, test_blob_part2[6], D3D_BLOB_ALL_SIGNATURE_BLOB, 0, &blob);
+    ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
+
+    size = ID3D10Blob_GetBufferSize(blob);
+    ok(size == 344, "GetBufferSize failed, got %lu, expected %u\n", size, 344);
+
+    dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
+    ok(TAG_DXBC == *dword, "DXBC got %#x, expected %#x.\n", *dword, TAG_DXBC);
+    ok(TAG_ISGN == *(dword+11), "ISGN got %#x, expected %#x.\n", *(dword+11), TAG_ISGN);
+    ok(TAG_OSGN == *(dword+24), "OSGN got %#x, expected %#x.\n", *(dword+24), TAG_OSGN);
+    ok(TAG_PCSG == *(dword+37), "PCSG got %#x, expected %#x.\n", *(dword+37), TAG_PCSG);
+
+    for (i = 0; i < ARRAY_SIZE(parts); i++)
+    {
+        hr = pD3DGetBlobPart(dword, size, parts[i], 0, &blob2);
+
+        if (parts[i] == D3D_BLOB_ALL_SIGNATURE_BLOB
+                || parts[i] == D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB
+                || parts[i] == D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB
+                || parts[i] == D3D_BLOB_INPUT_SIGNATURE_BLOB
+                || parts[i] == D3D_BLOB_OUTPUT_SIGNATURE_BLOB)
+        {
+            ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
+
+            refcount = ID3D10Blob_Release(blob2);
+            ok(!refcount, "ID3DBlob has %u references left\n", refcount);
+        }
+        else
+        {
+            ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
+        }
+    }
+
+    refcount = ID3D10Blob_Release(blob);
+    ok(!refcount, "ID3DBlob has %u references left\n", refcount);
+
+    /* D3D_BLOB_DEBUG_INFO */
+    hr = pD3DGetBlobPart(test_blob_part2, test_blob_part2[6], D3D_BLOB_DEBUG_INFO, 0, &blob);
+    ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
+
+    size = ID3D10Blob_GetBufferSize(blob);
+    ok(size == 4055, "GetBufferSize failed, got %lu, expected %u\n", size, 4055);
+
+    dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
+    ok(TAG_DXBC != *dword, "DXBC failed got %#x.\n", *dword);
+
+    for (i = 0; i < ARRAY_SIZE(parts); i++)
+    {
+        /* There isn't a full DXBC blob returned for D3D_BLOB_DEBUG_INFO */
+        hr = pD3DGetBlobPart(dword, size, parts[i], 0, &blob2);
+        ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
+    }
+
+    refcount = ID3D10Blob_Release(blob);
+    ok(!refcount, "ID3DBlob has %u references left\n", refcount);
+
+    /* D3D_BLOB_LEGACY_SHADER */
+    hr = pD3DGetBlobPart(test_blob_part2, test_blob_part2[6], D3D_BLOB_LEGACY_SHADER, 0, &blob);
+    ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
+
+    /* D3D_BLOB_XNA_PREPASS_SHADER */
+    hr = pD3DGetBlobPart(test_blob_part2, test_blob_part2[6], D3D_BLOB_XNA_PREPASS_SHADER, 0, &blob);
+    ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
+
+    /* D3D_BLOB_XNA_SHADER */
+    hr = pD3DGetBlobPart(test_blob_part2, test_blob_part2[6], D3D_BLOB_XNA_SHADER, 0, &blob);
+    ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
+
+    /* D3DCOMPILER_STRIP_DEBUG_INFO */
+    hr = pD3DStripShader(test_blob_part2, test_blob_part2[6], D3DCOMPILER_STRIP_DEBUG_INFO, &blob);
+    ok(hr == S_OK, "D3DStripShader failed, got %x, expected %x\n", hr, S_OK);
+
+    size = ID3D10Blob_GetBufferSize(blob);
+    ok(size == 952, "GetBufferSize failed, got %lu, expected %u\n", size, 952);
+
+    dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
+    ok(TAG_DXBC == *dword, "DXBC got %#x, expected %#x.\n", *dword, TAG_DXBC);
+    ok(TAG_RDEF == *(dword+14), "RDEF got %#x, expected %#x.\n", *(dword+14), TAG_RDEF);
+    ok(TAG_ISGN == *(dword+44), "ISGN got %#x, expected %#x.\n", *(dword+44), TAG_ISGN);
+    ok(TAG_OSGN == *(dword+57), "OSGN got %#x, expected %#x.\n", *(dword+57), TAG_OSGN);
+    ok(TAG_PCSG == *(dword+70), "PCSG got %#x, expected %#x.\n", *(dword+70), TAG_PCSG);
+    ok(TAG_SHEX == *(dword+119), "SHEX got %#x, expected %#x.\n", *(dword+119), TAG_SHEX);
+    ok(TAG_STAT == *(dword+199), "STAT got %#x, expected %#x.\n", *(dword+199), TAG_STAT);
+
+    hr = pD3DGetBlobPart(dword, size, D3D_BLOB_DEBUG_INFO, 0, &blob2);
+    ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
+
+    refcount = ID3D10Blob_Release(blob);
+    ok(!refcount, "ID3DBlob has %u references left\n", refcount);
+
+    /* D3DCOMPILER_STRIP_REFLECTION_DATA */
+    hr = pD3DStripShader(test_blob_part2, test_blob_part2[6], D3DCOMPILER_STRIP_REFLECTION_DATA, &blob);
+    ok(hr == S_OK, "D3DStripShader failed, got %x, expected %x\n", hr, S_OK);
+
+    size = ID3D10Blob_GetBufferSize(blob);
+    ok(size == 4735, "GetBufferSize failed, got %lu, expected %u\n", size, 4735);
+
+    dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
+    ok(TAG_DXBC == *dword, "DXBC got %#x, expected %#x.\n", *dword, TAG_DXBC);
+    ok(TAG_ISGN == *(dword+13), "ISGN got %#x, expected %#x.\n", *(dword+13), TAG_ISGN);
+    ok(TAG_OSGN == *(dword+26), "OSGN got %#x, expected %#x.\n", *(dword+26), TAG_OSGN);
+    ok(TAG_PCSG == *(dword+39), "PCSG got %#x, expected %#x.\n", *(dword+39), TAG_PCSG);
+    ok(TAG_SHEX == *(dword+88), "SHEX got %#x, expected %#x.\n", *(dword+88), TAG_SHEX);
+    ok(TAG_SDBG == *(dword+168), "SDBG got %#x, expected %#x.\n", *(dword+168), TAG_SDBG);
+
+    refcount = ID3D10Blob_Release(blob);
+    ok(!refcount, "ID3DBlob has %u references left\n", refcount);
+}
+
+static BOOL load_d3dcompiler_43(void)
+{
+    HMODULE module;
+
+    if (!(module = LoadLibraryA("d3dcompiler_43.dll"))) return FALSE;
+
+    pD3DCreateBlob = (void*)GetProcAddress(module, "D3DCreateBlob");
+    pD3DGetBlobPart = (void*)GetProcAddress(module, "D3DGetBlobPart");
+    pD3DStripShader = (void*)GetProcAddress(module, "D3DStripShader");
+    return TRUE;
+}
+
+static BOOL load_d3dcompiler_47(void)
+{
+    HMODULE module;
+
+    if (!(module = LoadLibraryA("d3dcompiler_47.dll")))
+        return FALSE;
+
+    pD3DReadFileToBlob = (void *)GetProcAddress(module, "D3DReadFileToBlob");
+    return TRUE;
+}
+
+static BOOL create_file(WCHAR *filename, const DWORD *data, DWORD data_size)
+{
+    static WCHAR temp_dir[MAX_PATH];
+    DWORD written;
+    HANDLE file;
+
+    if (!temp_dir[0])
+        GetTempPathW(ARRAY_SIZE(temp_dir), temp_dir);
+    GetTempFileNameW(temp_dir, NULL, 0, filename);
+    file = CreateFileW(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
+    if (file == INVALID_HANDLE_VALUE)
+        return FALSE;
+
+    if (data)
+    {
+        WriteFile(file, data, data_size, &written, NULL);
+        if (written != data_size)
+        {
+            CloseHandle(file);
+            DeleteFileW(filename);
+            return FALSE;
+        }
+    }
+    CloseHandle(file);
+    return TRUE;
+}
+
+/* test_cso_data - fxc.exe file.hlsl /Fo file.cso */
+static const DWORD test_cso_data[] =
+{
+#if 0
+    struct PSInput
+    {
+        float4 value : SV_POSITION;
+    };
+
+    PSInput main(float4 position : POSITION)
+    {
+        PSInput result;
+        result.value = position;
+        return result;
+    }
+#endif
+    0xfffe0200, 0x0014fffe, 0x42415443, 0x0000001c, 0x00000023, 0xfffe0200, 0x00000000, 0x00000000,
+    0x00000100, 0x0000001c, 0x325f7376, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820,
+    0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x30312072, 0xab00312e, 0x0200001f, 0x80000000,
+    0x900f0000, 0x02000001, 0xc00f0000, 0x90e40000, 0x0000ffff
+};
+
+static void test_D3DReadFileToBlob(void)
+{
+    WCHAR filename[MAX_PATH] = {'n','o','n','e','x','i','s','t','e','n','t',0};
+    ID3DBlob *blob = NULL;
+    SIZE_T data_size;
+    DWORD *data;
+    HRESULT hr;
+
+    hr = pD3DReadFileToBlob(filename, NULL);
+    ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "Got unexpected hr %#x.\n", hr);
+
+    hr = pD3DReadFileToBlob(filename, &blob);
+    ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "Got unexpected hr %#x.\n", hr);
+
+    if (0)
+    {
+        /* Crashes on Windows. */
+        create_file(filename, test_cso_data, ARRAY_SIZE(test_cso_data));
+        pD3DReadFileToBlob(filename, NULL);
+        DeleteFileW(filename);
+    }
+
+    if (!create_file(filename, NULL, 0))
+    {
+        win_skip("File creation failed.\n");
+        return;
+    }
+    hr = pD3DReadFileToBlob(filename, &blob);
+    ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+    data_size = ID3D10Blob_GetBufferSize(blob);
+    ok(!data_size, "Got unexpected data size.\n");
+    DeleteFileW(filename);
+    ID3D10Blob_Release(blob);
+
+    if (!create_file(filename, test_cso_data, ARRAY_SIZE(test_cso_data)))
+    {
+        win_skip("File creation failed.\n");
+        return;
+    }
+    hr = pD3DReadFileToBlob(filename, &blob);
+    ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+    data_size = ID3D10Blob_GetBufferSize(blob);
+    ok(data_size == ARRAY_SIZE(test_cso_data), "Got unexpected data size.\n");
+    data = ID3D10Blob_GetBufferPointer(blob);
+    ok(!memcmp(data, test_cso_data, ARRAY_SIZE(test_cso_data)), "Got unexpected data.\n");
+    DeleteFileW(filename);
+    ID3D10Blob_Release(blob);
+}
+
+START_TEST(blob)
+{
+    if (load_d3dcompiler_43())
+    {
+        test_create_blob();
+        test_get_blob_part();
+        test_get_blob_part2();
+    }
+    else
+    {
+        win_skip("Could not load d3dcompiler_43.dll\n");
+    }
+
+    if (load_d3dcompiler_47())
+    {
+        test_D3DReadFileToBlob();
+    }
+    else
+    {
+        win_skip("Could not load d3dcompiler_47.dll.\n");
+    }
+}
diff --git a/modules/rostests/winetests/d3dcompiler_43/hlsl.c b/modules/rostests/winetests/d3dcompiler_43/hlsl.c
new file mode 100644 (file)
index 0000000..f169f68
--- /dev/null
@@ -0,0 +1,685 @@
+/*
+ * Copyright (C) 2010 Travis Athougies
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+#define COBJMACROS
+#include "wine/test.h"
+#include "d3dx9.h"
+#include "d3dcompiler.h"
+
+#include <math.h>
+
+static pD3DCompile ppD3DCompile;
+
+struct vertex
+{
+    float x, y, z;
+    float tx, ty;
+};
+
+/* Tells compute_shader_probe* which pixels should be what colors */
+struct hlsl_probe_info
+{
+    unsigned int x, y;
+    /* The expected values in this region */
+    D3DXCOLOR c;
+    /* The max error for any value */
+    float epsilon;
+    /* An error message to print if this test fails */
+    const char *message;
+};
+
+static HWND create_window(void)
+{
+    WNDCLASSA wc = {0};
+    wc.lpfnWndProc = DefWindowProcA;
+    wc.lpszClassName = "d3d9_test_wc";
+    RegisterClassA(&wc);
+
+    return CreateWindowA("d3d9_test_wc", "d3d9_test", 0, 0, 0, 0, 0, 0, 0, 0, 0);
+}
+
+static IDirect3DDevice9 *init_d3d9(IDirect3DVertexDeclaration9 **vdeclaration,
+        IDirect3DVertexBuffer9 **quad_geometry, IDirect3DVertexShader9 **vshader_passthru)
+{
+    static const struct vertex quad_vertices[4] =
+    {
+        {-1.0f, -1.0f, 0.0f, 0.0f, 1.0f},
+        {-1.0f,  1.0f, 0.0f, 0.0f, 0.0f},
+        { 1.0f, -1.0f, 0.0f, 1.0f, 1.0f},
+        { 1.0f,  1.0f, 0.0f, 1.0f, 0.0f}
+    };
+
+    static const D3DVERTEXELEMENT9 vdeclelements[] =
+    {
+        {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
+        {0, 12, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0},
+        D3DDECL_END()
+    };
+
+    static const char *vshader_passthru_hlsl =
+        "float4 vshader(float4 pos: POSITION, inout float2 texcoord: TEXCOORD0): POSITION\n"
+        "{\n"
+        "   return pos;\n"
+        "}";
+
+    IDirect3D9 *d3d9_ptr;
+    IDirect3DDevice9 *device_ptr = NULL;
+    D3DPRESENT_PARAMETERS present_parameters;
+
+    void *temp_geometry_vertices;
+
+    ID3D10Blob *compiled = NULL;
+    ID3D10Blob *errors = NULL;
+
+    HRESULT hr;
+
+    d3d9_ptr = Direct3DCreate9(D3D_SDK_VERSION);
+    if (!d3d9_ptr)
+    {
+        skip("could not create D3D9\n");
+        return NULL;
+    }
+
+    hr = IDirect3D9_CheckDeviceFormat(d3d9_ptr, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8,
+            0, D3DRTYPE_SURFACE, D3DFMT_A32B32G32R32F);
+    if (FAILED(hr))
+    {
+        skip("A32B32G32R32F format not available on this device\n");
+        IDirect3D9_Release(d3d9_ptr);
+        return NULL;
+    }
+
+    ZeroMemory(&present_parameters, sizeof(present_parameters));
+    present_parameters.Windowed = TRUE;
+    present_parameters.hDeviceWindow = create_window();
+    present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
+
+    hr = IDirect3D9_CreateDevice(d3d9_ptr, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, NULL,
+            D3DCREATE_HARDWARE_VERTEXPROCESSING, &present_parameters, &device_ptr);
+    IDirect3D9_Release(d3d9_ptr);
+    if (FAILED(hr))
+    {
+        skip("could not create Direct3D9 device\n");
+        return NULL;
+    }
+
+    /* Create the quad geometry */
+    hr = IDirect3DDevice9_CreateVertexBuffer(device_ptr, 4 * sizeof(struct vertex),
+            D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, quad_geometry, NULL);
+    ok(SUCCEEDED(hr),
+            "Could not create vertex buffer, IDirect3DDevice9_CreateVertexBuffer returned: %08x\n", hr);
+
+    hr = IDirect3DVertexBuffer9_Lock(*quad_geometry, 0, sizeof(quad_vertices), &temp_geometry_vertices, 0);
+    ok(SUCCEEDED(hr), "IDirect3DVertexBuffer9_Lock returned: %08x\n", hr);
+    memcpy(temp_geometry_vertices, quad_vertices, sizeof(quad_vertices));
+    IDirect3DVertexBuffer9_Unlock(*quad_geometry);
+
+    hr = IDirect3DDevice9_CreateVertexDeclaration(device_ptr, vdeclelements, vdeclaration);
+    ok(SUCCEEDED(hr), "Could not create vertex declaration: "
+            "IDirect3DDevice9_CreateVertexDeclaration returned: %08x\n", hr);
+
+    hr = IDirect3DDevice9_SetVertexDeclaration(device_ptr, *vdeclaration);
+    ok(hr == D3D_OK, "IDirect3DDevice9_SetVertexDeclaration returned: %08x\n", hr);
+
+    /* Create a simple vertex shader to just pass through the values */
+    hr = ppD3DCompile(vshader_passthru_hlsl, strlen(vshader_passthru_hlsl), NULL,
+            NULL, NULL, "vshader", "vs_1_1", 0, 0, &compiled, &errors);
+    if (FAILED(hr))
+    {
+        skip("not compiling vertex shader due to lacking wine HLSL support!\n");
+        if (errors)
+            ID3D10Blob_Release(errors);
+        return NULL;
+    }
+
+    hr = IDirect3DDevice9_CreateVertexShader(device_ptr, ID3D10Blob_GetBufferPointer(compiled),
+            vshader_passthru);
+    ok(SUCCEEDED(hr), "IDirect3DDevice9_CreateVertexShader returned: %08x\n", hr);
+    ID3D10Blob_Release(compiled);
+
+    return device_ptr;
+}
+
+/* Convenience functions */
+static void set_float4_d3d9(IDirect3DDevice9 *device, ID3DXConstantTable *constants, const char *name,
+        float x, float y, float z, float w)
+{
+    D3DXVECTOR4 vector;
+    vector.x = x;
+    vector.y = y;
+    vector.z = z;
+    vector.w = w;
+    ID3DXConstantTable_SetVector(constants, device, name, &vector);
+}
+
+/* Compile our pixel shader and get back the compiled version and a constant table */
+static IDirect3DPixelShader9 *compile_pixel_shader9(IDirect3DDevice9 *device, const char *shader,
+        const char *profile, ID3DXConstantTable **constants)
+{
+    ID3D10Blob *compiled = NULL;
+    ID3D10Blob *errors = NULL;
+    IDirect3DPixelShader9 *pshader;
+    HRESULT hr;
+
+    hr = ppD3DCompile(shader, strlen(shader), NULL, NULL,
+            NULL, "test", profile, /* test is the name of the entry point of our shader */
+            0, 0, &compiled, &errors);
+    ok(hr == D3D_OK, "Pixel shader %s compilation failed: %s\n", shader,
+            errors ? (char *)ID3D10Blob_GetBufferPointer(errors) : "");
+    if (FAILED(hr)) return NULL;
+
+    hr = D3DXGetShaderConstantTable(ID3D10Blob_GetBufferPointer(compiled), constants);
+    ok(hr == D3D_OK, "Could not get constant table from compiled pixel shader\n");
+
+    hr = IDirect3DDevice9_CreatePixelShader(device, ID3D10Blob_GetBufferPointer(compiled), &pshader);
+    ok(SUCCEEDED(hr), "IDirect3DDevice9_CreatePixelShader returned: %08x\n", hr);
+    ID3D10Blob_Release(compiled);
+    return pshader;
+}
+
+/* Draw a full screen quad */
+static void draw_quad_with_shader9(IDirect3DDevice9 *device, IDirect3DVertexBuffer9 *quad_geometry)
+{
+    HRESULT hr;
+    D3DXMATRIX projection_matrix;
+
+    D3DXMatrixOrthoLH(&projection_matrix, 2.0f, 2.0f, 0.0f, 1.0f);
+    IDirect3DDevice9_SetTransform(device, D3DTS_PROJECTION, &projection_matrix);
+
+    hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
+    ok(hr == D3D_OK, "IDirect3DDevice9_Clear returned: %08x\n", hr);
+
+    hr = IDirect3DDevice9_BeginScene(device);
+    ok(hr == D3D_OK, "IDirect3DDevice9_BeginScene returned: %08x\n", hr);
+
+    hr = IDirect3DDevice9_SetStreamSource(device, 0, quad_geometry, 0, sizeof(struct vertex));
+    ok(hr == D3D_OK, "IDirect3DDevice9_SetStreamSource returned: %08x\n", hr);
+    hr = IDirect3DDevice9_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, 0, 2);
+    ok(hr == D3D_OK, "IDirect3DDevice9_DrawPrimitive returned: %08x\n", hr);
+
+    hr = IDirect3DDevice9_EndScene(device);
+    ok(hr == D3D_OK, "IDirect3DDevice9_EndScene returned: %08x\n", hr);
+}
+
+static void setup_device9(IDirect3DDevice9 *device, IDirect3DSurface9 **render_target,
+        IDirect3DSurface9 **readback, D3DFORMAT format, unsigned int width, unsigned int height,
+        IDirect3DVertexShader9 *vshader, IDirect3DPixelShader9 *pshader)
+{
+    HRESULT hr;
+    hr = IDirect3DDevice9_CreateRenderTarget(device, width, height, format,
+            D3DMULTISAMPLE_NONE, 0, FALSE, render_target, NULL);
+    ok(hr == D3D_OK, "IDirect3DDevice9_CreateRenderTarget returned: %08x\n", hr);
+
+    /* The Direct3D 9 docs state that we cannot lock a render target surface,
+       instead we must copy the render target onto this surface to lock it */
+    hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, width, height, format,
+            D3DPOOL_SYSTEMMEM, readback, NULL);
+    ok(hr == D3D_OK, "IDirect3DDevice9_CreateOffscreenPlainSurface returned: %08x\n", hr);
+
+    hr = IDirect3DDevice9_SetRenderTarget(device, 0, *render_target);
+    ok(hr == D3D_OK, "IDirect3DDevice9_SetRenderTarget returned: %08x\n", hr);
+
+    hr = IDirect3DDevice9_SetVertexShader(device, vshader);
+    ok(hr == D3D_OK, "IDirect3DDevice9_SetVertexShader returned: %08x\n", hr);
+    hr = IDirect3DDevice9_SetPixelShader(device, pshader);
+    ok(hr == D3D_OK, "IDirect3DDevice9_SetPixelShader returned: %08x\n", hr);
+}
+
+static BOOL colors_match(D3DXCOLOR a, D3DXCOLOR b, float epsilon)
+{
+  return (fabs(a.r - b.r) < epsilon && fabs(a.g - b.g) < epsilon && fabs(a.b - b.b) < epsilon &&
+          fabs(a.a - b.a) < epsilon);
+}
+
+/* Compute a shader on a width by height buffer and probes certain locations
+   to see if they are as expected. */
+static void compute_shader_probe9(IDirect3DDevice9 *device, IDirect3DVertexShader9 *vshader,
+        IDirect3DPixelShader9 *pshader, IDirect3DVertexBuffer9 *quad_geometry,
+        const struct hlsl_probe_info *probes, unsigned int count,
+        unsigned int width, unsigned int height, unsigned int line_number)
+{
+    IDirect3DSurface9 *render_target;
+    IDirect3DSurface9 *readback;
+
+    HRESULT hr;
+    D3DLOCKED_RECT lr;
+    D3DXCOLOR *pbits_data;
+    unsigned int i;
+
+    setup_device9(device, &render_target, &readback, D3DFMT_A32B32G32R32F,
+            width, height, vshader, pshader);
+
+    /* Draw the quad with the shader and read back the data */
+    draw_quad_with_shader9(device, quad_geometry);
+    IDirect3DDevice9_GetRenderTargetData(device, render_target, readback);
+    hr = IDirect3DSurface9_LockRect(readback, &lr, NULL, D3DLOCK_READONLY);
+    ok(hr == D3D_OK, "IDirect3DSurface9_LockRect returned: %08x\n", hr);
+    pbits_data = lr.pBits;
+
+    /* Now go through the probes and check each one */
+    for (i = 0; i < count; i++, probes++) {
+        int index = probes->x + (probes->y * lr.Pitch / sizeof(D3DXCOLOR));
+        ok(colors_match(probes->c, pbits_data[index], probes->epsilon),
+                "Line %d: At (%d, %d): %s: Expected (%.04f,%.04f,%.04f, %.04f), got "
+                "(%.04f,%.04f,%.04f,%.04f)\n", line_number, probes->x, probes->y, probes->message,
+                probes->c.r, probes->c.g, probes->c.b, probes->c.a, pbits_data[index].r,
+                pbits_data[index].g, pbits_data[index].b, pbits_data[index].a);
+    }
+
+    hr = IDirect3DSurface9_UnlockRect(readback);
+    ok(hr == D3D_OK, "IDirect3DSurface9_UnlockRect returned: %08x\n", hr);
+
+    /* We now present the scene. This is mostly for debugging purposes, since GetRenderTargetData
+       also waits for drawing commands to complete. The reason this call is here and not in a
+       draw function is because the contents of the render target surface are invalidated after
+       this call. */
+    hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
+    ok(hr == D3D_OK, "IDirect3DDevice9_Present returned: %08x\n", hr);
+
+    IDirect3DSurface9_Release(render_target);
+    IDirect3DSurface9_Release(readback);
+}
+
+/* Now the actual test functions */
+static void test_swizzle(IDirect3DDevice9 *device, IDirect3DVertexBuffer9 *quad_geometry,
+        IDirect3DVertexShader9 *vshader_passthru)
+{
+    static const struct hlsl_probe_info probes[] =
+    {
+       {0, 0, {0.0101f, 0.0303f, 0.0202f, 0.0404f}, 0.0001f, "swizzle_test"}
+    };
+
+    static const char *swizzle_test_shader =
+        "uniform float4 color;\n"
+        "float4 test(): COLOR\n"
+        "{\n"
+        "    float4 ret = color;\n"
+        "    ret.gb = ret.ra;\n"
+        "    ret.ra = float2(0.0101, 0.0404);\n"
+        "    return ret;\n"
+        "}";
+
+    ID3DXConstantTable *constants;
+    IDirect3DPixelShader9 *pshader;
+
+    pshader = compile_pixel_shader9(device, swizzle_test_shader, "ps_2_0", &constants);
+    if (pshader != NULL)
+    {
+        set_float4_d3d9(device, constants, "color", 0.0303f, 0.0f, 0.0f, 0.0202f);
+
+        compute_shader_probe9(device, vshader_passthru, pshader, quad_geometry,
+                probes, ARRAY_SIZE(probes), 1, 1, __LINE__);
+
+        ID3DXConstantTable_Release(constants);
+        IDirect3DPixelShader9_Release(pshader);
+    }
+}
+
+static void test_math(IDirect3DDevice9 *device, IDirect3DVertexBuffer9 *quad_geometry,
+        IDirect3DVertexShader9 *vshader_passthru)
+{
+    /* Tests order of operations */
+    static const float u = 2.5f, v = 0.3f, w = 0.2f, x = 0.7f, y = 0.1f, z = 1.5f;
+
+    static const struct hlsl_probe_info probes[] =
+    {
+        {0, 0, {-12.4300f, 9.8333f, 1.6000f, 34.9999f}, 0.0001f,
+                "order of operations test"}
+    };
+
+    static const char *order_of_operations_shader =
+        "float4 test(uniform float u, uniform float v, uniform float w, uniform float x,\n"
+        "            uniform float y, uniform float z): COLOR\n"
+        "{\n"
+        "    return float4(x * y - z / w + --u / -v,\n"
+        "            z * x / y + w / -v,\n"
+        "            u + v - w,\n"
+        "            x / y / w);\n"
+        "}";
+
+    ID3DXConstantTable *constants;
+    IDirect3DPixelShader9 *pshader;
+
+    pshader = compile_pixel_shader9(device, order_of_operations_shader, "ps_2_0", &constants);
+    if (pshader != NULL)
+    {
+        ID3DXConstantTable_SetFloat(constants, device, "$u", u);
+        ID3DXConstantTable_SetFloat(constants, device, "$v", v);
+        ID3DXConstantTable_SetFloat(constants, device, "$w", w);
+        ID3DXConstantTable_SetFloat(constants, device, "$x", x);
+        ID3DXConstantTable_SetFloat(constants, device, "$y", y);
+        ID3DXConstantTable_SetFloat(constants, device, "$z", z);
+
+        compute_shader_probe9(device, vshader_passthru, pshader, quad_geometry,
+                probes, ARRAY_SIZE(probes), 1, 1, __LINE__);
+
+        ID3DXConstantTable_Release(constants);
+        IDirect3DPixelShader9_Release(pshader);
+    }
+}
+
+static void test_conditionals(IDirect3DDevice9 *device, IDirect3DVertexBuffer9 *quad_geometry,
+        IDirect3DVertexShader9 *vshader_passthru)
+{
+    static const struct hlsl_probe_info if_greater_probes[] =
+    {
+        { 0, 0, {0.9f, 0.8f, 0.7f, 0.6f}, 0.0001f, "if greater test"},
+        { 5, 0, {0.9f, 0.8f, 0.7f, 0.6f}, 0.0001f, "if greater test"},
+        {10, 0, {0.9f, 0.8f, 0.7f, 0.6f}, 0.0001f, "if greater test"},
+        {15, 0, {0.9f, 0.8f, 0.7f, 0.6f}, 0.0001f, "if greater test"},
+        {25, 0, {0.1f, 0.2f, 0.3f, 0.4f}, 0.0001f, "if greater test"},
+        {30, 0, {0.1f, 0.2f, 0.3f, 0.4f}, 0.0001f, "if greater test"}
+    };
+
+    static const char *if_greater_shader =
+        "float4 test(float2 pos: TEXCOORD0): COLOR\n"
+        "{\n"
+        "    if((pos.x * 32.0) > 20.0)\n"
+        "        return float4(0.1, 0.2, 0.3, 0.4);\n"
+        "    else\n"
+        "        return float4(0.9, 0.8, 0.7, 0.6);\n"
+        "}";
+
+    static const struct hlsl_probe_info ternary_operator_probes[] =
+    {
+        {0, 0, {0.50f, 0.25f, 0.50f, 0.75f}, 0.00001f, "ternary operator test"},
+        {1, 0, {0.50f, 0.25f, 0.50f, 0.75f}, 0.00001f, "ternary operator test"},
+        {2, 0, {0.50f, 0.25f, 0.50f, 0.75f}, 0.00001f, "ternary operator test"},
+        {3, 0, {0.50f, 0.25f, 0.50f, 0.75f}, 0.00001f, "ternary operator test"},
+        {4, 0, {0.60f, 0.80f, 0.10f, 0.20f}, 0.00001f, "ternary operator test"},
+        {5, 0, {0.60f, 0.80f, 0.10f, 0.20f}, 0.00001f, "ternary operator test"},
+        {6, 0, {0.60f, 0.80f, 0.10f, 0.20f}, 0.00001f, "ternary operator test"},
+        {7, 0, {0.60f, 0.80f, 0.10f, 0.20f}, 0.00001f, "ternary operator test"}
+    };
+
+    static const char *ternary_operator_shader =
+        "float4 test(float2 pos: TEXCOORD0): COLOR\n"
+        "{\n"
+        "    return (pos.x < 0.5?float4(0.5, 0.25, 0.5, 0.75):float4(0.6, 0.8, 0.1, 0.2));\n"
+        "}";
+
+    ID3DXConstantTable *constants;
+    IDirect3DPixelShader9 *pshader;
+
+    pshader = compile_pixel_shader9(device, if_greater_shader, "ps_2_0", &constants);
+    if (pshader != NULL)
+    {
+        compute_shader_probe9(device, vshader_passthru, pshader, quad_geometry, if_greater_probes,
+                ARRAY_SIZE(if_greater_probes), 32, 1, __LINE__);
+
+        ID3DXConstantTable_Release(constants);
+        IDirect3DPixelShader9_Release(pshader);
+    }
+
+    pshader = compile_pixel_shader9(device, ternary_operator_shader, "ps_2_0", &constants);
+    if (pshader != NULL)
+    {
+        compute_shader_probe9(device, vshader_passthru, pshader, quad_geometry, ternary_operator_probes,
+                ARRAY_SIZE(ternary_operator_probes), 8, 1, __LINE__);
+
+        ID3DXConstantTable_Release(constants);
+        IDirect3DPixelShader9_Release(pshader);
+    }
+}
+
+static void test_float_vectors(IDirect3DDevice9 *device, IDirect3DVertexBuffer9 *quad_geometry,
+        IDirect3DVertexShader9 *vshader_passthru)
+{
+    static const struct hlsl_probe_info vec4_indexing_test1_probes[] =
+    {
+        {0, 0, {0.020f, 0.245f, 0.351f, 1.000f}, 0.0001f, "vec4 indexing test 1"}
+    };
+
+    static const char *vec4_indexing_test1_shader =
+        "float4 test(): COLOR\n"
+        "{\n"
+        "    float4 color;\n"
+        "    color[0] = 0.020;\n"
+        "    color[1] = 0.245;\n"
+        "    color[2] = 0.351;\n"
+        "    color[3] = 1.0;\n"
+        "    return color;\n"
+        "}";
+
+    static const struct hlsl_probe_info vec4_indexing_test2_probes[] =
+    {
+        {0, 0, {0.5f, 0.3f, 0.8f, 0.2f}, 0.0001f, "vec4 indexing test 2"}
+    };
+
+    /* We have this uniform i here so the compiler can't optimize */
+    static const char *vec4_indexing_test2_shader =
+        "uniform int i;\n"
+        "float4 test(): COLOR\n"
+        "{\n"
+        "    float4 color = float4(0.5, 0.4, 0.3, 0.2);\n"
+        "    color.g = color[i];\n"
+        "    color.b = 0.8;\n"
+        "    return color;\n"
+        "}";
+
+    ID3DXConstantTable *constants;
+    IDirect3DPixelShader9 *pshader;
+
+    pshader = compile_pixel_shader9(device, vec4_indexing_test1_shader, "ps_2_0", &constants);
+    if (pshader != NULL)
+    {
+        compute_shader_probe9(device, vshader_passthru, pshader, quad_geometry, vec4_indexing_test1_probes,
+                ARRAY_SIZE(vec4_indexing_test1_probes), 1, 1, __LINE__);
+
+        ID3DXConstantTable_Release(constants);
+        IDirect3DPixelShader9_Release(pshader);
+    }
+
+    pshader = compile_pixel_shader9(device, vec4_indexing_test2_shader, "ps_2_0", &constants);
+    if (pshader != NULL)
+    {
+        ID3DXConstantTable_SetInt(constants, device, "i", 2);
+
+        compute_shader_probe9(device, vshader_passthru, pshader, quad_geometry, vec4_indexing_test2_probes,
+                ARRAY_SIZE(vec4_indexing_test2_probes), 32, 1, __LINE__);
+
+        ID3DXConstantTable_Release(constants);
+        IDirect3DPixelShader9_Release(pshader);
+    }
+}
+
+static void test_trig(IDirect3DDevice9 *device, IDirect3DVertexBuffer9 *quad_geometry,
+        IDirect3DVertexShader9 *vshader_passthru)
+{
+    static const struct hlsl_probe_info sincos_probes[] =
+    {
+        {0, 0, {0.5000f, 1.0000f, 0.0f, 0.0f}, 0.001f, "sin/cos test"},
+        {1, 0, {0.5975f, 0.9904f, 0.0f, 0.0f}, 0.001f, "sin/cos test"},
+        {2, 0, {0.6913f, 0.9620f, 0.0f, 0.0f}, 0.001f, "sin/cos test"},
+        {3, 0, {0.7778f, 0.9160f, 0.0f, 0.0f}, 0.001f, "sin/cos test"},
+        {4, 0, {0.8536f, 0.8536f, 0.0f, 0.0f}, 0.001f, "sin/cos test"},
+        {5, 0, {0.9157f, 0.7778f, 0.0f, 0.0f}, 0.001f, "sin/cos test"},
+        {6, 0, {0.9620f, 0.6913f, 0.0f, 0.0f}, 0.001f, "sin/cos test"},
+        {7, 0, {0.9904f, 0.5975f, 0.0f, 0.0f}, 0.001f, "sin/cos test"},
+        {8, 0, {1.0000f, 0.5000f, 0.0f, 0.0f}, 0.001f, "sin/cos test"},
+        {9, 0, {0.9904f, 0.4025f, 0.0f, 0.0f}, 0.001f, "sin/cos test"},
+        {10, 0, {0.9619f, 0.3087f, 0.0f, 0.0f}, 0.001f, "sin/cos test"},
+        {11, 0, {0.9157f, 0.2222f, 0.0f, 0.0f}, 0.001f, "sin/cos test"},
+        {12, 0, {0.8536f, 0.1464f, 0.0f, 0.0f}, 0.001f, "sin/cos test"},
+        {13, 0, {0.7778f, 0.0843f, 0.0f, 0.0f}, 0.001f, "sin/cos test"},
+        {14, 0, {0.6913f, 0.0381f, 0.0f, 0.0f}, 0.001f, "sin/cos test"},
+        {15, 0, {0.5975f, 0.0096f, 0.0f, 0.0f}, 0.001f, "sin/cos test"},
+        {16, 0, {0.5000f, 0.0000f, 0.0f, 0.0f}, 0.001f, "sin/cos test"},
+        {17, 0, {0.4025f, 0.0096f, 0.0f, 0.0f}, 0.001f, "sin/cos test"},
+        {18, 0, {0.3087f, 0.0381f, 0.0f, 0.0f}, 0.001f, "sin/cos test"},
+        {19, 0, {0.2222f, 0.0843f, 0.0f, 0.0f}, 0.001f, "sin/cos test"},
+        {20, 0, {0.1464f, 0.1464f, 0.0f, 0.0f}, 0.001f, "sin/cos test"},
+        {21, 0, {0.0843f, 0.2222f, 0.0f, 0.0f}, 0.001f, "sin/cos test"},
+        {22, 0, {0.0381f, 0.3087f, 0.0f, 0.0f}, 0.001f, "sin/cos test"},
+        {23, 0, {0.0096f, 0.4025f, 0.0f, 0.0f}, 0.001f, "sin/cos test"},
+        {24, 0, {0.0000f, 0.5000f, 0.0f, 0.0f}, 0.001f, "sin/cos test"},
+        {25, 0, {0.0096f, 0.5975f, 0.0f, 0.0f}, 0.001f, "sin/cos test"},
+        {26, 0, {0.0381f, 0.6913f, 0.0f, 0.0f}, 0.001f, "sin/cos test"},
+        {27, 0, {0.0843f, 0.7778f, 0.0f, 0.0f}, 0.001f, "sin/cos test"},
+        {28, 0, {0.1464f, 0.8536f, 0.0f, 0.0f}, 0.001f, "sin/cos test"},
+        {29, 0, {0.2222f, 0.9157f, 0.0f, 0.0f}, 0.001f, "sin/cos test"},
+        {30, 0, {0.3087f, 0.9619f, 0.0f, 0.0f}, 0.001f, "sin/cos test"},
+        {31, 0, {0.4025f, 0.9904f, 0.0f, 0.0f}, 0.001f, "sin/cos test"},
+    };
+
+    static const char *sincos_shader =
+        "float4 test(float x: TEXCOORD0): COLOR\n"
+        "{\n"
+        "    const float pi2 = 6.2831853;\n"
+        "    float calcd_sin = (sin(x * pi2) + 1)/2;\n"
+        "    float calcd_cos = (cos(x * pi2) + 1)/2;\n"
+        "    return float4(calcd_sin, calcd_cos, 0, 0);\n"
+        "}";
+
+    ID3DXConstantTable *constants;
+    IDirect3DPixelShader9 *pshader;
+
+    pshader = compile_pixel_shader9(device, sincos_shader, "ps_2_0", &constants);
+    if (pshader != NULL)
+    {
+        compute_shader_probe9(device, vshader_passthru, pshader, quad_geometry, sincos_probes,
+                ARRAY_SIZE(sincos_probes), 32, 1, __LINE__);
+
+        ID3DXConstantTable_Release(constants);
+        IDirect3DPixelShader9_Release(pshader);
+    }
+}
+
+static void test_fail(IDirect3DDevice9 *device, IDirect3DVertexBuffer9 *qquad_geometry,
+        IDirect3DVertexShader9 *vshader_passthru)
+{
+    static const char *tests[] =
+    {
+        "float4 test(float2 pos: TEXCOORD0) : COLOR\n"
+        "{\n"
+        "   return y;\n"
+        "}",
+
+        "float4 test(float2 pos: TEXCOORD0) : COLOR\n"
+        "{\n"
+        "  float4 x = float4(0, 0, 0, 0);\n"
+        "  x.xzzx = float4(1, 2, 3, 4);\n"
+        "  return x;\n"
+        "}",
+
+        "float4 test(float2 pos: TEXCOORD0) : COLOR\n"
+        "{\n"
+        "  float4 x = pos;\n"
+        "  return x;\n"
+        "}",
+
+        "float4 test(float2 pos, TEXCOORD0) ; COLOR\n"
+        "{\n"
+        "  pos = float4 x;\n"
+        "  mul(float4(5, 4, 3, 2), mvp) = x;\n"
+        "  return float4;\n"
+        "}",
+
+        "float4 563r(float2 45s: TEXCOORD0) : COLOR\n"
+        "{\n"
+        "  float2 x = 45s;\n"
+        "  return float4(x.x, x.y, 0, 0);\n"
+        "}",
+
+        "float4 test(float2 pos: TEXCOORD0) : COLOR\n"
+        "{\n"
+        "   struct { int b,c; } x = {0};\n"
+        "   return y;\n"
+        "}",
+
+        "float4 test(float2 pos: TEXCOORD0) : COLOR\n"
+        "{\n"
+        "   struct {} x = {};\n"
+        "   return y;\n"
+        "}",
+    };
+
+    ID3D10Blob *compiled, *errors;
+    unsigned int i;
+    HRESULT hr;
+
+    for (i = 0; i < ARRAY_SIZE(tests); ++i)
+    {
+        compiled = errors = NULL;
+        hr = ppD3DCompile(tests[i], strlen(tests[i]), NULL, NULL, NULL, "test", "ps_2_0", 0, 0, &compiled, &errors);
+        ok(hr == E_FAIL, "Test %u, got unexpected hr %#x.\n", i, hr);
+        ok(!!errors, "Test %u, expected non-NULL error blob.\n", i);
+        ok(!compiled, "Test %u, expected no compiled shader blob.\n", i);
+        ID3D10Blob_Release(errors);
+    }
+}
+
+static BOOL load_d3dcompiler(void)
+{
+    HMODULE module;
+
+    if (!(module = LoadLibraryA("d3dcompiler_43.dll"))) return FALSE;
+
+    ppD3DCompile = (void*)GetProcAddress(module, "D3DCompile");
+    return TRUE;
+}
+
+START_TEST(hlsl)
+{
+    D3DCAPS9 caps;
+    ULONG refcount;
+    IDirect3DDevice9 *device;
+    IDirect3DVertexDeclaration9 *vdeclaration;
+    IDirect3DVertexBuffer9 *quad_geometry;
+    IDirect3DVertexShader9 *vshader_passthru;
+
+    if (!load_d3dcompiler())
+    {
+        win_skip("Could not load d3dcompiler_43.dll\n");
+        return;
+    }
+
+    device = init_d3d9(&vdeclaration, &quad_geometry, &vshader_passthru);
+    if (!device) return;
+
+    /* Make sure we support pixel shaders, before trying to compile them! */
+    /* Direct3D 9 (Shader model 1-3 tests) */
+    IDirect3DDevice9_GetDeviceCaps(device, &caps);
+    if (caps.PixelShaderVersion >= D3DPS_VERSION(2, 0))
+    {
+        todo_wine
+        {
+            test_swizzle(device, quad_geometry, vshader_passthru);
+            test_math(device, quad_geometry, vshader_passthru);
+            test_conditionals(device, quad_geometry, vshader_passthru);
+            test_float_vectors(device, quad_geometry, vshader_passthru);
+            test_trig(device, quad_geometry, vshader_passthru);
+            test_fail(device, quad_geometry, vshader_passthru);
+        }
+    } else skip("no pixel shader support\n");
+
+    /* Reference counting sanity checks */
+    if (vshader_passthru)
+    {
+        refcount = IDirect3DVertexShader9_Release(vshader_passthru);
+        ok(!refcount, "Pass-through vertex shader has %u references left\n", refcount);
+    }
+
+    refcount = IDirect3DVertexBuffer9_Release(quad_geometry);
+    ok(!refcount, "Vertex buffer has %u references left\n", refcount);
+
+    refcount = IDirect3DVertexDeclaration9_Release(vdeclaration);
+    ok(!refcount, "Vertex declaration has %u references left\n", refcount);
+
+    refcount = IDirect3DDevice9_Release(device);
+    ok(!refcount, "Device has %u references left\n", refcount);
+}
diff --git a/modules/rostests/winetests/d3dcompiler_43/reflection.c b/modules/rostests/winetests/d3dcompiler_43/reflection.c
new file mode 100644 (file)
index 0000000..23c3d9c
--- /dev/null
@@ -0,0 +1,1545 @@
+/*
+ * Copyright 2010 Rico Schüller
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+/*
+ * Nearly all compiler functions need the shader blob and the size. The size
+ * is always located at DWORD #6 in the shader blob (blob[6]).
+ * The functions are e.g.: D3DGet*SignatureBlob, D3DReflect
+ */
+
+#define COBJMACROS
+#include "initguid.h"
+#include "d3dcompiler.h"
+#include "wine/test.h"
+
+/* includes for older reflection interfaces */
+#ifndef __REACTOS__
+#include "d3d10.h"
+#include "d3d10_1shader.h"
+#endif
+
+/*
+ * This doesn't belong here, but for some functions it is possible to return that value,
+ * see http://msdn.microsoft.com/en-us/library/bb205278%28v=VS.85%29.aspx
+ * The original definition is in D3DX10core.h.
+ */
+#define D3DERR_INVALIDCALL 0x8876086c
+
+static HRESULT (WINAPI *pD3DReflect)(const void *, SIZE_T, REFIID, void **);
+
+/* Creator string for comparison - Version 9.29.952.3111 (43) */
+static DWORD shader_creator[] = {
+0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d,
+0x39207265, 0x2e39322e, 0x2e323539, 0x31313133, 0xababab00,
+};
+
+/*
+ * fxc.exe /E VS /Tvs_4_0 /Fx
+ */
+#if 0
+float4 VS(float4 position : POSITION, float4 pos : SV_POSITION) : SV_POSITION
+{
+  return position;
+}
+#endif
+
+#ifndef __REACTOS__
+
+static DWORD test_reflection_blob[] = {
+0x43425844, 0x77c6324f, 0xfd27948a, 0xe6958d31, 0x53361cba, 0x00000001, 0x000001d8, 0x00000005,
+0x00000034, 0x0000008c, 0x000000e4, 0x00000118, 0x0000015c, 0x46454452, 0x00000050, 0x00000000,
+0x00000000, 0x00000000, 0x0000001c, 0xfffe0400, 0x00000100, 0x0000001c, 0x7263694d, 0x666f736f,
+0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, 0x2e39322e,
+0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038,
+0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000f0f, 0x00000041, 0x00000000, 0x00000000,
+0x00000003, 0x00000001, 0x0000000f, 0x49534f50, 0x4e4f4954, 0x5f565300, 0x49534f50, 0x4e4f4954,
+0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000001,
+0x00000003, 0x00000000, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x52444853, 0x0000003c,
+0x00010040, 0x0000000f, 0x0300005f, 0x001010f2, 0x00000000, 0x04000067, 0x001020f2, 0x00000000,
+0x00000001, 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000000, 0x0100003e, 0x54415453,
+0x00000074, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000,
+0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+};
+
+static void test_reflection_references(void)
+{
+    HRESULT hr;
+    ULONG count;
+    ID3D11ShaderReflection *ref11, *ref11_test;
+    ID3D10ShaderReflection *ref10;
+    ID3D10ShaderReflection1 *ref10_1;
+
+    hr = pD3DReflect(test_reflection_blob, test_reflection_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11);
+    ok(hr == S_OK, "D3DReflect failed, got %x, expected %x\n", hr, S_OK);
+
+    hr = ref11->lpVtbl->QueryInterface(ref11, &IID_ID3D11ShaderReflection, (void **)&ref11_test);
+    ok(hr == S_OK, "QueryInterface failed, got %x, expected %x\n", hr, S_OK);
+
+    count = ref11_test->lpVtbl->Release(ref11_test);
+    ok(count == 1, "Release failed %u\n", count);
+
+    hr = ref11->lpVtbl->QueryInterface(ref11, &IID_ID3D10ShaderReflection, (void **)&ref10);
+    ok(hr == E_NOINTERFACE, "QueryInterface failed, got %x, expected %x\n", hr, E_NOINTERFACE);
+
+    hr = ref11->lpVtbl->QueryInterface(ref11, &IID_ID3D10ShaderReflection1, (void **)&ref10_1);
+    ok(hr == E_NOINTERFACE, "QueryInterface failed, got %x, expected %x\n", hr, E_NOINTERFACE);
+
+    count = ref11->lpVtbl->Release(ref11);
+    ok(count == 0, "Release failed %u\n", count);
+
+    /* check invalid cases */
+    hr = pD3DReflect(test_reflection_blob, test_reflection_blob[6], &IID_ID3D10ShaderReflection, (void **)&ref10);
+    ok(hr == E_NOINTERFACE, "D3DReflect failed, got %x, expected %x\n", hr, E_NOINTERFACE);
+
+    hr = pD3DReflect(test_reflection_blob, test_reflection_blob[6], &IID_ID3D10ShaderReflection1, (void **)&ref10_1);
+    ok(hr == E_NOINTERFACE, "D3DReflect failed, got %x, expected %x\n", hr, E_NOINTERFACE);
+
+    hr = pD3DReflect(NULL, test_reflection_blob[6], &IID_ID3D10ShaderReflection1, (void **)&ref10_1);
+    ok(hr == D3DERR_INVALIDCALL, "D3DReflect failed, got %x, expected %x\n", hr, D3DERR_INVALIDCALL);
+
+    hr = pD3DReflect(NULL, test_reflection_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11);
+    ok(hr == D3DERR_INVALIDCALL, "D3DReflect failed, got %x, expected %x\n", hr, D3DERR_INVALIDCALL);
+
+    /* returns different errors with different sizes */
+    hr = pD3DReflect(test_reflection_blob, 31, &IID_ID3D10ShaderReflection1, (void **)&ref10_1);
+    ok(hr == D3DERR_INVALIDCALL, "D3DReflect failed, got %x, expected %x\n", hr, D3DERR_INVALIDCALL);
+
+    hr = pD3DReflect(test_reflection_blob,  32, &IID_ID3D10ShaderReflection1, (void **)&ref10_1);
+    ok(hr == E_FAIL, "D3DReflect failed, got %x, expected %x\n", hr, E_FAIL);
+
+    hr = pD3DReflect(test_reflection_blob, test_reflection_blob[6]-1, &IID_ID3D10ShaderReflection1, (void **)&ref10_1);
+    ok(hr == E_FAIL, "D3DReflect failed, got %x, expected %x\n", hr, E_FAIL);
+
+    hr = pD3DReflect(test_reflection_blob,  31, &IID_ID3D11ShaderReflection, (void **)&ref11);
+    ok(hr == D3DERR_INVALIDCALL, "D3DReflect failed, got %x, expected %x\n", hr, D3DERR_INVALIDCALL);
+
+    hr = pD3DReflect(test_reflection_blob,  32, &IID_ID3D11ShaderReflection, (void **)&ref11);
+    ok(hr == E_FAIL, "D3DReflect failed, got %x, expected %x\n", hr, E_FAIL);
+
+    hr = pD3DReflect(test_reflection_blob,  test_reflection_blob[6]-1, &IID_ID3D11ShaderReflection, (void **)&ref11);
+    ok(hr == E_FAIL, "D3DReflect failed, got %x, expected %x\n", hr, E_FAIL);
+}
+
+#endif /* !__REACTOS__ */
+
+/*
+ * fxc.exe /E VS /Tvs_4_1 /Fx
+ */
+#if 0
+struct vsin
+{
+    float4 x : SV_position;
+    float4 a : BINORMAL;
+    uint b : BLENDINDICES;
+    float c : BLENDWEIGHT;
+    float4 d : COLOR;
+    float4 d1 : COLOR1;
+    float4 e : NORMAL;
+    float4 f : POSITION;
+    float4 g : POSITIONT;
+    float h : PSIZE;
+    float4 i : TANGENT;
+    float4 j : TEXCOORD;
+    uint k : SV_VertexID;
+    uint l : SV_InstanceID;
+    float m : testin;
+};
+struct vsout
+{
+    float4 x : SV_position;
+    float4 a : COLOR0;
+    float b : FOG;
+    float4 c : POSITION0;
+    float d : PSIZE;
+    float e : TESSFACTOR0;
+    float4 f : TEXCOORD0;
+    float g : SV_ClipDistance0;
+    float h : SV_CullDistance0;
+    uint i : SV_InstanceID;
+    float j : testout;
+};
+vsout VS(vsin x)
+{
+    vsout s;
+    s.x = float4(1.6f, 0.3f, 0.1f, 0.0f);
+    int y = 1;
+    int p[5] = {1, 2, 3, 5, 4};
+    y = y << (int) x.x.x & 0xf;
+    s.x.x = p[y];
+    s.a = x.d;
+    s.b = x.c;
+    s.c = x.f;
+    s.d = x.h;
+    s.e = x.h;
+    s.f = x.j;
+    s.g = 1.0f;
+    s.h = 1.0f;
+    s.i = 2;
+    s.j = x.m;
+    return s;
+}
+#endif
+static DWORD test_reflection_desc_vs_blob[] = {
+0x43425844, 0xb65955ac, 0xcea1cb75, 0x06c5a1ad, 0x8a555fa1, 0x00000001, 0x0000076c, 0x00000005,
+0x00000034, 0x0000008c, 0x0000028c, 0x00000414, 0x000006f0, 0x46454452, 0x00000050, 0x00000000,
+0x00000000, 0x00000000, 0x0000001c, 0xfffe0401, 0x00000100, 0x0000001c, 0x7263694d, 0x666f736f,
+0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, 0x2e39322e,
+0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x000001f8, 0x0000000f, 0x00000008, 0x00000170,
+0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000010f, 0x0000017c, 0x00000000, 0x00000000,
+0x00000003, 0x00000001, 0x0000000f, 0x00000185, 0x00000000, 0x00000000, 0x00000001, 0x00000002,
+0x00000001, 0x00000192, 0x00000000, 0x00000000, 0x00000003, 0x00000003, 0x00000101, 0x0000019e,
+0x00000000, 0x00000000, 0x00000003, 0x00000004, 0x00000f0f, 0x0000019e, 0x00000001, 0x00000000,
+0x00000003, 0x00000005, 0x0000000f, 0x000001a4, 0x00000000, 0x00000000, 0x00000003, 0x00000006,
+0x0000000f, 0x000001ab, 0x00000000, 0x00000000, 0x00000003, 0x00000007, 0x00000f0f, 0x000001b4,
+0x00000000, 0x00000000, 0x00000003, 0x00000008, 0x0000000f, 0x000001be, 0x00000000, 0x00000000,
+0x00000003, 0x00000009, 0x00000101, 0x000001c4, 0x00000000, 0x00000000, 0x00000003, 0x0000000a,
+0x0000000f, 0x000001cc, 0x00000000, 0x00000000, 0x00000003, 0x0000000b, 0x00000f0f, 0x000001d5,
+0x00000000, 0x00000006, 0x00000001, 0x0000000c, 0x00000001, 0x000001e1, 0x00000000, 0x00000008,
+0x00000001, 0x0000000d, 0x00000001, 0x000001ef, 0x00000000, 0x00000000, 0x00000003, 0x0000000e,
+0x00000101, 0x705f5653, 0x7469736f, 0x006e6f69, 0x4f4e4942, 0x4c414d52, 0x454c4200, 0x4e49444e,
+0x45434944, 0x4c420053, 0x57444e45, 0x48474945, 0x4f430054, 0x00524f4c, 0x4d524f4e, 0x50004c41,
+0x5449534f, 0x004e4f49, 0x49534f50, 0x4e4f4954, 0x53500054, 0x00455a49, 0x474e4154, 0x00544e45,
+0x43584554, 0x44524f4f, 0x5f565300, 0x74726556, 0x44497865, 0x5f565300, 0x74736e49, 0x65636e61,
+0x74004449, 0x69747365, 0xabab006e, 0x4e47534f, 0x00000180, 0x0000000b, 0x00000008, 0x00000110,
+0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000011c, 0x00000000, 0x00000000,
+0x00000003, 0x00000001, 0x0000000f, 0x00000122, 0x00000000, 0x00000000, 0x00000003, 0x00000002,
+0x00000e01, 0x00000126, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000d02, 0x0000012c,
+0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000b04, 0x00000137, 0x00000000, 0x00000000,
+0x00000003, 0x00000002, 0x00000708, 0x0000013f, 0x00000000, 0x00000000, 0x00000003, 0x00000003,
+0x0000000f, 0x00000148, 0x00000000, 0x00000000, 0x00000003, 0x00000004, 0x0000000f, 0x00000151,
+0x00000000, 0x00000002, 0x00000003, 0x00000005, 0x00000e01, 0x00000161, 0x00000000, 0x00000003,
+0x00000003, 0x00000005, 0x00000d02, 0x00000171, 0x00000000, 0x00000000, 0x00000001, 0x00000006,
+0x00000e01, 0x705f5653, 0x7469736f, 0x006e6f69, 0x4f4c4f43, 0x4f460052, 0x53500047, 0x00455a49,
+0x53534554, 0x54434146, 0x7400524f, 0x6f747365, 0x50007475, 0x5449534f, 0x004e4f49, 0x43584554,
+0x44524f4f, 0x5f565300, 0x70696c43, 0x74736944, 0x65636e61, 0x5f565300, 0x6c6c7543, 0x74736944,
+0x65636e61, 0x5f565300, 0x74736e49, 0x65636e61, 0xab004449, 0x52444853, 0x000002d4, 0x00010041,
+0x000000b5, 0x0100086a, 0x0300005f, 0x00101012, 0x00000000, 0x0300005f, 0x00101012, 0x00000003,
+0x0300005f, 0x001010f2, 0x00000004, 0x0300005f, 0x001010f2, 0x00000007, 0x0300005f, 0x00101012,
+0x00000009, 0x0300005f, 0x001010f2, 0x0000000b, 0x0300005f, 0x00101012, 0x0000000e, 0x04000067,
+0x001020f2, 0x00000000, 0x00000001, 0x03000065, 0x001020f2, 0x00000001, 0x03000065, 0x00102012,
+0x00000002, 0x03000065, 0x00102022, 0x00000002, 0x03000065, 0x00102042, 0x00000002, 0x03000065,
+0x00102082, 0x00000002, 0x03000065, 0x001020f2, 0x00000003, 0x03000065, 0x001020f2, 0x00000004,
+0x04000067, 0x00102012, 0x00000005, 0x00000002, 0x04000067, 0x00102022, 0x00000005, 0x00000003,
+0x03000065, 0x00102012, 0x00000006, 0x02000068, 0x00000001, 0x04000069, 0x00000000, 0x00000005,
+0x00000004, 0x06000036, 0x00203012, 0x00000000, 0x00000000, 0x00004001, 0x00000001, 0x06000036,
+0x00203012, 0x00000000, 0x00000001, 0x00004001, 0x00000002, 0x06000036, 0x00203012, 0x00000000,
+0x00000002, 0x00004001, 0x00000003, 0x06000036, 0x00203012, 0x00000000, 0x00000003, 0x00004001,
+0x00000005, 0x06000036, 0x00203012, 0x00000000, 0x00000004, 0x00004001, 0x00000004, 0x0500001b,
+0x00100012, 0x00000000, 0x0010100a, 0x00000000, 0x07000029, 0x00100012, 0x00000000, 0x00004001,
+0x00000001, 0x0010000a, 0x00000000, 0x07000001, 0x00100012, 0x00000000, 0x0010000a, 0x00000000,
+0x00004001, 0x0000000f, 0x07000036, 0x00100012, 0x00000000, 0x0420300a, 0x00000000, 0x0010000a,
+0x00000000, 0x0500002b, 0x00102012, 0x00000000, 0x0010000a, 0x00000000, 0x08000036, 0x001020e2,
+0x00000000, 0x00004002, 0x00000000, 0x3e99999a, 0x3dcccccd, 0x00000000, 0x05000036, 0x001020f2,
+0x00000001, 0x00101e46, 0x00000004, 0x05000036, 0x00102012, 0x00000002, 0x0010100a, 0x00000003,
+0x05000036, 0x00102062, 0x00000002, 0x00101006, 0x00000009, 0x05000036, 0x00102082, 0x00000002,
+0x0010100a, 0x0000000e, 0x05000036, 0x001020f2, 0x00000003, 0x00101e46, 0x00000007, 0x05000036,
+0x001020f2, 0x00000004, 0x00101e46, 0x0000000b, 0x05000036, 0x00102012, 0x00000005, 0x00004001,
+0x3f800000, 0x05000036, 0x00102022, 0x00000005, 0x00004001, 0x3f800000, 0x05000036, 0x00102012,
+0x00000006, 0x00004001, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x00000015, 0x00000001,
+0x00000000, 0x00000012, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000000,
+0x00000005, 0x00000006, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x0000000a, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000,
+};
+
+static const D3D11_SIGNATURE_PARAMETER_DESC test_reflection_desc_vs_resultin[] =
+{
+    {"SV_position", 0, 0, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0xf, 0x1, 0},
+    {"BINORMAL", 0, 1, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0xf, 0x0, 0},
+    {"BLENDINDICES", 0, 2, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_UINT32, 0x1, 0x0, 0},
+    {"BLENDWEIGHT", 0, 3, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0x1, 0x1, 0},
+    {"COLOR", 0, 4, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0xf, 0xf, 0},
+    {"COLOR", 1, 5, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0xf, 0x0, 0},
+    {"NORMAL", 0, 6, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0xf, 0x0, 0},
+    {"POSITION", 0, 7, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0xf, 0xf, 0},
+    {"POSITIONT", 0, 8, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0xf, 0x0, 0},
+    {"PSIZE", 0, 9, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0x1, 0x1, 0},
+    {"TANGENT", 0, 10, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0xf, 0x0, 0},
+    {"TEXCOORD", 0, 11, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0xf, 0xf, 0},
+    {"SV_VertexID", 0, 12, D3D_NAME_VERTEX_ID, D3D_REGISTER_COMPONENT_UINT32, 0x1, 0x0, 0},
+    {"SV_InstanceID", 0, 13, D3D_NAME_INSTANCE_ID, D3D_REGISTER_COMPONENT_UINT32, 0x1, 0x0, 0},
+    {"testin", 0, 14, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0x1, 0x1, 0},
+};
+
+static const D3D11_SIGNATURE_PARAMETER_DESC test_reflection_desc_vs_resultout[] =
+{
+    {"SV_position", 0, 0, D3D_NAME_POSITION, D3D_REGISTER_COMPONENT_FLOAT32, 0xf, 0x0, 0},
+    {"COLOR", 0, 1, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0xf, 0x0, 0},
+    {"FOG", 0, 2, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0x1, 0xe, 0},
+    {"PSIZE", 0, 2, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0x2, 0xd, 0},
+    {"TESSFACTOR", 0, 2, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0x4, 0xb, 0},
+    {"testout", 0, 2, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0x8, 0x7, 0},
+    {"POSITION", 0, 3, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0xf, 0x0, 0},
+    {"TEXCOORD", 0, 4, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0xf, 0x0, 0},
+    {"SV_ClipDistance", 0, 5, D3D_NAME_CLIP_DISTANCE, D3D_REGISTER_COMPONENT_FLOAT32, 0x1, 0xe, 0},
+    {"SV_CullDistance", 0, 5, D3D_NAME_CULL_DISTANCE, D3D_REGISTER_COMPONENT_FLOAT32, 0x2, 0xd, 0},
+    {"SV_InstanceID", 0, 6, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_UINT32, 0x1, 0xe, 0},
+};
+
+static void test_reflection_desc_vs(void)
+{
+    HRESULT hr;
+    ULONG count;
+    ID3D11ShaderReflection *ref11;
+    D3D11_SHADER_DESC sdesc11 = {0};
+    D3D11_SIGNATURE_PARAMETER_DESC desc = {0};
+    const D3D11_SIGNATURE_PARAMETER_DESC *pdesc;
+    UINT ret;
+    unsigned int i;
+
+    hr = pD3DReflect(test_reflection_desc_vs_blob, test_reflection_desc_vs_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11);
+    ok(hr == S_OK, "D3DReflect failed %x\n", hr);
+
+    hr = ref11->lpVtbl->GetDesc(ref11, NULL);
+    ok(hr == E_FAIL, "GetDesc failed %x\n", hr);
+
+    hr = ref11->lpVtbl->GetDesc(ref11, &sdesc11);
+    ok(hr == S_OK, "GetDesc failed %x\n", hr);
+
+    ok(sdesc11.Version == 65601, "GetDesc failed, got %u, expected %u\n", sdesc11.Version, 65601);
+    ok(strcmp(sdesc11.Creator, (char*) shader_creator) == 0, "GetDesc failed, got \"%s\", expected \"%s\"\n", sdesc11.Creator, (char*)shader_creator);
+    ok(sdesc11.Flags == 256, "GetDesc failed, got %u, expected %u\n", sdesc11.Flags, 256);
+    ok(sdesc11.ConstantBuffers == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.ConstantBuffers, 0);
+    ok(sdesc11.BoundResources == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.BoundResources, 0);
+    ok(sdesc11.InputParameters == 15, "GetDesc failed, got %u, expected %u\n", sdesc11.InputParameters, 15);
+    ok(sdesc11.OutputParameters == 11, "GetDesc failed, got %u, expected %u\n", sdesc11.OutputParameters, 11);
+    ok(sdesc11.InstructionCount == 21, "GetDesc failed, got %u, expected %u\n", sdesc11.InstructionCount, 21);
+    ok(sdesc11.TempRegisterCount == 1, "GetDesc failed, got %u, expected %u\n", sdesc11.TempRegisterCount, 1);
+    ok(sdesc11.TempArrayCount == 5, "GetDesc failed, got %u, expected %u\n", sdesc11.TempArrayCount, 5);
+    ok(sdesc11.DefCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.DefCount, 0);
+    ok(sdesc11.DclCount == 18, "GetDesc failed, got %u, expected %u\n", sdesc11.DclCount, 18);
+    ok(sdesc11.TextureNormalInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.TextureNormalInstructions, 0);
+    ok(sdesc11.TextureLoadInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.TextureLoadInstructions, 0);
+    ok(sdesc11.TextureCompInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.TextureCompInstructions, 0);
+    ok(sdesc11.TextureBiasInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.TextureBiasInstructions, 0);
+    ok(sdesc11.TextureGradientInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.TextureGradientInstructions, 0);
+    ok(sdesc11.FloatInstructionCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.FloatInstructionCount, 0);
+    ok(sdesc11.IntInstructionCount == 1, "GetDesc failed, got %u, expected %u\n", sdesc11.IntInstructionCount, 1);
+    ok(sdesc11.UintInstructionCount == 1, "GetDesc failed, got %u, expected %u\n", sdesc11.UintInstructionCount, 1);
+    ok(sdesc11.StaticFlowControlCount == 1, "GetDesc failed, got %u, expected %u\n", sdesc11.StaticFlowControlCount, 1);
+    ok(sdesc11.DynamicFlowControlCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.DynamicFlowControlCount, 0);
+    ok(sdesc11.MacroInstructionCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.MacroInstructionCount, 0);
+    ok(sdesc11.ArrayInstructionCount == 6, "GetDesc failed, got %u, expected %u\n", sdesc11.ArrayInstructionCount, 6);
+    ok(sdesc11.CutInstructionCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.CutInstructionCount, 0);
+    ok(sdesc11.EmitInstructionCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.EmitInstructionCount, 0);
+    ok(sdesc11.GSOutputTopology == 0, "GetDesc failed, got %x, expected %x\n", sdesc11.GSOutputTopology, 0);
+    ok(sdesc11.GSMaxOutputVertexCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.GSMaxOutputVertexCount, 0);
+    ok(sdesc11.InputPrimitive == 0, "GetDesc failed, got %x, expected %x\n", sdesc11.InputPrimitive, 0);
+    ok(sdesc11.PatchConstantParameters == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.PatchConstantParameters, 0);
+    ok(sdesc11.cGSInstanceCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.cGSInstanceCount, 0);
+    ok(sdesc11.cControlPoints == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.cControlPoints, 0);
+    ok(sdesc11.HSOutputPrimitive == 0, "GetDesc failed, got %x, expected %x\n", sdesc11.HSOutputPrimitive, 0);
+    ok(sdesc11.HSPartitioning == 0, "GetDesc failed, got %x, expected %x\n", sdesc11.HSPartitioning, 0);
+    ok(sdesc11.TessellatorDomain == 0, "GetDesc failed, got %x, expected %x\n", sdesc11.TessellatorDomain, 0);
+    ok(sdesc11.cBarrierInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.cBarrierInstructions, 0);
+    ok(sdesc11.cInterlockedInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.cInterlockedInstructions, 0);
+    ok(sdesc11.cTextureStoreInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.cTextureStoreInstructions, 0);
+
+    ret = ref11->lpVtbl->GetBitwiseInstructionCount(ref11);
+    ok(ret == 0, "GetBitwiseInstructionCount failed, got %u, expected %u\n", ret, 0);
+
+    ret = ref11->lpVtbl->GetConversionInstructionCount(ref11);
+    ok(ret == 2, "GetConversionInstructionCount failed, got %u, expected %u\n", ret, 2);
+
+    ret = ref11->lpVtbl->GetMovInstructionCount(ref11);
+    ok(ret == 10, "GetMovInstructionCount failed, got %u, expected %u\n", ret, 10);
+
+    ret = ref11->lpVtbl->GetMovcInstructionCount(ref11);
+    ok(ret == 0, "GetMovcInstructionCount failed, got %u, expected %u\n", ret, 0);
+
+    /* GetIn/OutputParameterDesc */
+    for (i = 0; i < ARRAY_SIZE(test_reflection_desc_vs_resultin); ++i)
+    {
+        pdesc = &test_reflection_desc_vs_resultin[i];
+
+        hr = ref11->lpVtbl->GetInputParameterDesc(ref11, i, &desc);
+        ok(hr == S_OK, "GetInputParameterDesc(%u) failed, got %x, expected %x\n", i, hr, S_OK);
+
+        ok(!strcmp(desc.SemanticName, pdesc->SemanticName), "GetInputParameterDesc(%u) SemanticName failed, got \"%s\", expected \"%s\"\n",
+                i, desc.SemanticName, pdesc->SemanticName);
+        ok(desc.SemanticIndex == pdesc->SemanticIndex, "GetInputParameterDesc(%u) SemanticIndex failed, got %u, expected %u\n",
+                i, desc.SemanticIndex, pdesc->SemanticIndex);
+        ok(desc.Register == pdesc->Register, "GetInputParameterDesc(%u) Register failed, got %u, expected %u\n",
+                i, desc.Register, pdesc->Register);
+        ok(desc.SystemValueType == pdesc->SystemValueType, "GetInputParameterDesc(%u) SystemValueType failed, got %x, expected %x\n",
+                i, desc.SystemValueType, pdesc->SystemValueType);
+        ok(desc.ComponentType == pdesc->ComponentType, "GetInputParameterDesc(%u) ComponentType failed, got %x, expected %x\n",
+                i, desc.ComponentType, pdesc->ComponentType);
+        ok(desc.Mask == pdesc->Mask, "GetInputParameterDesc(%u) Mask failed, got %x, expected %x\n",
+                i, desc.Mask, pdesc->Mask);
+        ok(desc.ReadWriteMask == pdesc->ReadWriteMask, "GetInputParameterDesc(%u) ReadWriteMask failed, got %x, expected %x\n",
+                i, desc.ReadWriteMask, pdesc->ReadWriteMask);
+        ok(desc.Stream == pdesc->Stream, "GetInputParameterDesc(%u) Stream failed, got %u, expected %u\n",
+                i, desc.Stream, pdesc->ReadWriteMask);
+    }
+
+    for (i = 0; i < ARRAY_SIZE(test_reflection_desc_vs_resultout); ++i)
+    {
+        pdesc = &test_reflection_desc_vs_resultout[i];
+
+        hr = ref11->lpVtbl->GetOutputParameterDesc(ref11, i, &desc);
+        ok(hr == S_OK, "GetOutputParameterDesc(%u) failed, got %x, expected %x\n", i, hr, S_OK);
+
+        ok(!strcmp(desc.SemanticName, pdesc->SemanticName), "GetOutputParameterDesc(%u) SemanticName failed, got \"%s\", expected \"%s\"\n",
+                i, desc.SemanticName, pdesc->SemanticName);
+        ok(desc.SemanticIndex == pdesc->SemanticIndex, "GetOutputParameterDesc(%u) SemanticIndex failed, got %u, expected %u\n",
+                i, desc.SemanticIndex, pdesc->SemanticIndex);
+        ok(desc.Register == pdesc->Register, "GetOutputParameterDesc(%u) Register failed, got %u, expected %u\n",
+                i, desc.Register, pdesc->Register);
+        ok(desc.SystemValueType == pdesc->SystemValueType, "GetOutputParameterDesc(%u) SystemValueType failed, got %x, expected %x\n",
+                i, desc.SystemValueType, pdesc->SystemValueType);
+        ok(desc.ComponentType == pdesc->ComponentType, "GetOutputParameterDesc(%u) ComponentType failed, got %x, expected %x\n",
+                i, desc.ComponentType, pdesc->ComponentType);
+        ok(desc.Mask == pdesc->Mask, "GetOutputParameterDesc(%u) Mask failed, got %x, expected %x\n",
+                i, desc.Mask, pdesc->Mask);
+        ok(desc.ReadWriteMask == pdesc->ReadWriteMask, "GetOutputParameterDesc(%u) ReadWriteMask failed, got %x, expected %x\n",
+                i, desc.ReadWriteMask, pdesc->ReadWriteMask);
+        ok(desc.Stream == pdesc->Stream, "GetOutputParameterDesc(%u) Stream failed, got %u, expected %u\n",
+                i, desc.Stream, pdesc->ReadWriteMask);
+    }
+
+    count = ref11->lpVtbl->Release(ref11);
+    ok(count == 0, "Release failed %u\n", count);
+}
+
+/*
+ * fxc.exe /E PS /Tps_4_1 /Fx
+ */
+#if 0
+Texture2D tex1;
+Texture2D tex2;
+SamplerState sam
+{
+    Filter = MIN_MAG_MIP_LINEAR;
+    AddressU = Wrap;
+    AddressV = Wrap;
+};
+SamplerComparisonState samc
+{
+    Filter = MIN_MAG_MIP_LINEAR;
+    AddressU = w1;
+    AddressV = Wrap;
+    ComparisonFunc = LESS;
+};
+struct psin
+{
+    uint f : SV_RenderTargetArrayIndex;
+    uint g : SV_InstanceID;
+    uint h : SV_PrimitiveID;
+    float2 uv : TEXCOORD;
+    float4 a : COLOR3;
+    float b : VFACE;
+    float4 c : SV_position;
+    bool d : SV_Coverage;
+    bool e : SV_IsFrontFace;
+};
+struct psout
+{
+    float a : SV_Target1;
+    float b : SV_Depth;
+    float x : SV_Target;
+    bool c : SV_Coverage;
+};
+psout PS(psin p)
+{
+    psout a;
+    float4 x = tex1.Sample(sam, p.uv);
+    x += tex1.SampleCmp(samc, p.uv, 0.3f);
+    if (x.y < 0.1f)
+        x += tex2.SampleCmp(samc, p.uv, 0.4f);
+    else if (x.y < 0.2f)
+        x += tex2.SampleCmp(samc, p.uv, 0.1f);
+    else if (x.y < 0.3f)
+        x += tex2.SampleBias(sam, p.uv, 0.1f);
+    else if (x.y < 0.4f)
+        x += tex2.SampleBias(sam, p.uv, 0.2f);
+    else if (x.y < 0.5f)
+        x += tex2.SampleBias(sam, p.uv, 0.3f);
+    else
+        x += tex2.SampleBias(sam, p.uv, 0.4f);
+    x += tex2.SampleGrad(sam, p.uv, x.xy, x.xy);
+    x += tex2.SampleGrad(sam, p.uv, x.xz, x.xz);
+    x += tex2.SampleGrad(sam, p.uv, x.xz, x.zy);
+    x += tex2.SampleGrad(sam, p.uv, x.xz, x.zw);
+    x += tex2.SampleGrad(sam, p.uv, x.xz, x.wz);
+    a.a = x.y;
+    a.b = x.x;
+    a.x = x.x;
+    a.c = true;
+    return a;
+}
+#endif
+static DWORD test_reflection_desc_ps_blob[] = {
+0x43425844, 0x19e2f325, 0xf1ec39a3, 0x3c5a8b53, 0x5bd5fb65, 0x00000001, 0x000008d0, 0x00000005,
+0x00000034, 0x0000011c, 0x00000254, 0x000002e4, 0x00000854, 0x46454452, 0x000000e0, 0x00000000,
+0x00000000, 0x00000004, 0x0000001c, 0xffff0401, 0x00000100, 0x000000af, 0x0000009c, 0x00000003,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x000000a0, 0x00000003,
+0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000002, 0x000000a5, 0x00000002,
+0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000c, 0x000000aa, 0x00000002,
+0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000c, 0x006d6173, 0x636d6173,
+0x78657400, 0x65740031, 0x4d003278, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c,
+0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x4e475349,
+0x00000130, 0x00000008, 0x00000008, 0x000000c8, 0x00000000, 0x00000004, 0x00000001, 0x00000000,
+0x00000001, 0x000000e2, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000002, 0x000000f0,
+0x00000000, 0x00000007, 0x00000001, 0x00000000, 0x00000004, 0x000000ff, 0x00000000, 0x00000009,
+0x00000001, 0x00000000, 0x00000008, 0x0000010e, 0x00000000, 0x00000000, 0x00000003, 0x00000001,
+0x00000303, 0x00000117, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000004, 0x0000011d,
+0x00000003, 0x00000000, 0x00000003, 0x00000002, 0x0000000f, 0x00000123, 0x00000000, 0x00000001,
+0x00000003, 0x00000003, 0x0000000f, 0x525f5653, 0x65646e65, 0x72615472, 0x41746567, 0x79617272,
+0x65646e49, 0x56530078, 0x736e495f, 0x636e6174, 0x00444965, 0x505f5653, 0x696d6972, 0x65766974,
+0x53004449, 0x73495f56, 0x6e6f7246, 0x63614674, 0x45540065, 0x4f4f4358, 0x56004452, 0x45434146,
+0x4c4f4300, 0x5300524f, 0x6f705f56, 0x69746973, 0xab006e6f, 0x4e47534f, 0x00000088, 0x00000004,
+0x00000008, 0x00000068, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000e01, 0x00000068,
+0x00000001, 0x00000000, 0x00000003, 0x00000001, 0x00000e01, 0x00000072, 0x00000000, 0x00000000,
+0x00000001, 0xffffffff, 0x00000e01, 0x0000007e, 0x00000000, 0x00000000, 0x00000003, 0xffffffff,
+0x00000e01, 0x545f5653, 0x65677261, 0x56530074, 0x766f435f, 0x67617265, 0x56530065, 0x7065445f,
+0xab006874, 0x52444853, 0x00000568, 0x00000041, 0x0000015a, 0x0100086a, 0x0300005a, 0x00106000,
+0x00000000, 0x0300085a, 0x00106000, 0x00000001, 0x04001858, 0x00107000, 0x00000000, 0x00005555,
+0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065,
+0x00102012, 0x00000000, 0x03000065, 0x00102012, 0x00000001, 0x02000065, 0x0000f000, 0x02000065,
+0x0000c001, 0x02000068, 0x00000003, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, 0x00000001,
+0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x0b000046, 0x00100012, 0x00000001, 0x00101046,
+0x00000001, 0x00107006, 0x00000000, 0x00106000, 0x00000001, 0x00004001, 0x3e99999a, 0x07000000,
+0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00100006, 0x00000001, 0x07000031, 0x00100012,
+0x00000001, 0x0010001a, 0x00000000, 0x00004001, 0x3dcccccd, 0x0304001f, 0x0010000a, 0x00000001,
+0x0b000046, 0x00100012, 0x00000001, 0x00101046, 0x00000001, 0x00107006, 0x00000001, 0x00106000,
+0x00000001, 0x00004001, 0x3ecccccd, 0x07000000, 0x001000f2, 0x00000001, 0x00100e46, 0x00000000,
+0x00100006, 0x00000001, 0x01000012, 0x07000031, 0x00100012, 0x00000002, 0x0010001a, 0x00000000,
+0x00004001, 0x3e4ccccd, 0x0304001f, 0x0010000a, 0x00000002, 0x0b000046, 0x00100012, 0x00000002,
+0x00101046, 0x00000001, 0x00107006, 0x00000001, 0x00106000, 0x00000001, 0x00004001, 0x3dcccccd,
+0x07000000, 0x001000f2, 0x00000001, 0x00100e46, 0x00000000, 0x00100006, 0x00000002, 0x01000012,
+0x07000031, 0x00100012, 0x00000002, 0x0010001a, 0x00000000, 0x00004001, 0x3e99999a, 0x0304001f,
+0x0010000a, 0x00000002, 0x0b00004a, 0x001000f2, 0x00000002, 0x00101046, 0x00000001, 0x00107e46,
+0x00000001, 0x00106000, 0x00000000, 0x00004001, 0x3dcccccd, 0x07000000, 0x001000f2, 0x00000001,
+0x00100e46, 0x00000000, 0x00100e46, 0x00000002, 0x01000012, 0x07000031, 0x00100012, 0x00000002,
+0x0010001a, 0x00000000, 0x00004001, 0x3ecccccd, 0x0304001f, 0x0010000a, 0x00000002, 0x0b00004a,
+0x001000f2, 0x00000002, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000,
+0x00004001, 0x3e4ccccd, 0x07000000, 0x001000f2, 0x00000001, 0x00100e46, 0x00000000, 0x00100e46,
+0x00000002, 0x01000012, 0x07000031, 0x00100012, 0x00000002, 0x0010001a, 0x00000000, 0x00004001,
+0x3f000000, 0x0304001f, 0x0010000a, 0x00000002, 0x0b00004a, 0x001000f2, 0x00000002, 0x00101046,
+0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x00004001, 0x3e99999a, 0x07000000,
+0x001000f2, 0x00000001, 0x00100e46, 0x00000000, 0x00100e46, 0x00000002, 0x01000012, 0x0b00004a,
+0x001000f2, 0x00000002, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000,
+0x00004001, 0x3ecccccd, 0x07000000, 0x001000f2, 0x00000001, 0x00100e46, 0x00000000, 0x00100e46,
+0x00000002, 0x01000015, 0x01000015, 0x01000015, 0x01000015, 0x01000015, 0x0d000049, 0x001000f2,
+0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x00100046,
+0x00000001, 0x00100046, 0x00000001, 0x07000000, 0x001000f2, 0x00000000, 0x00100e46, 0x00000000,
+0x00100e46, 0x00000001, 0x0d000049, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46,
+0x00000001, 0x00106000, 0x00000000, 0x00100086, 0x00000000, 0x00100086, 0x00000000, 0x07000000,
+0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00100e46, 0x00000001, 0x0d000049, 0x001000f2,
+0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x00100086,
+0x00000000, 0x00100a66, 0x00000000, 0x07000000, 0x001000f2, 0x00000000, 0x00100e46, 0x00000000,
+0x00100e46, 0x00000001, 0x0d000049, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46,
+0x00000001, 0x00106000, 0x00000000, 0x00100086, 0x00000000, 0x00100ae6, 0x00000000, 0x07000000,
+0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00100e46, 0x00000001, 0x0d000049, 0x001000c2,
+0x00000000, 0x00101046, 0x00000001, 0x001074e6, 0x00000001, 0x00106000, 0x00000000, 0x00100086,
+0x00000000, 0x00100fb6, 0x00000000, 0x07000000, 0x00100032, 0x00000000, 0x00100ae6, 0x00000000,
+0x00100046, 0x00000000, 0x05000036, 0x00102012, 0x00000001, 0x0010001a, 0x00000000, 0x04000036,
+0x0000c001, 0x0010000a, 0x00000000, 0x05000036, 0x00102012, 0x00000000, 0x0010000a, 0x00000000,
+0x04000036, 0x0000f001, 0x00004001, 0xffffffff, 0x0100003e, 0x54415453, 0x00000074, 0x00000032,
+0x00000003, 0x00000000, 0x00000005, 0x00000011, 0x00000000, 0x00000000, 0x00000006, 0x00000005,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000003,
+0x00000004, 0x00000005, 0x00000018, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+};
+
+static const D3D11_SIGNATURE_PARAMETER_DESC test_reflection_desc_ps_resultin[] =
+{
+    {"SV_RenderTargetArrayIndex", 0, 0, D3D_NAME_RENDER_TARGET_ARRAY_INDEX, D3D_REGISTER_COMPONENT_UINT32, 0x1, 0x0, 0},
+    {"SV_InstanceID", 0, 0, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_UINT32, 0x2, 0x0, 0},
+    {"SV_PrimitiveID", 0, 0, D3D_NAME_PRIMITIVE_ID, D3D_REGISTER_COMPONENT_UINT32, 0x4, 0x0, 0},
+    {"SV_IsFrontFace", 0, 0, D3D_NAME_IS_FRONT_FACE, D3D_REGISTER_COMPONENT_UINT32, 0x8, 0x0, 0},
+    {"TEXCOORD", 0, 1, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0x3, 0x3, 0},
+    {"VFACE", 0, 1, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0x4, 0x0, 0},
+    {"COLOR", 3, 2, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0xf, 0x0, 0},
+    {"SV_position", 0, 3, D3D_NAME_POSITION, D3D_REGISTER_COMPONENT_FLOAT32, 0xf, 0x0, 0},
+};
+
+static const D3D11_SIGNATURE_PARAMETER_DESC test_reflection_desc_ps_resultout[] =
+{
+    {"SV_Target", 0, 0, D3D_NAME_TARGET, D3D_REGISTER_COMPONENT_FLOAT32, 0x1, 0xe, 0},
+    {"SV_Target", 1, 1, D3D_NAME_TARGET, D3D_REGISTER_COMPONENT_FLOAT32, 0x1, 0xe, 0},
+    {"SV_Coverage", 0, 0xffffffff, D3D_NAME_COVERAGE, D3D_REGISTER_COMPONENT_UINT32, 0x1, 0xe, 0},
+    {"SV_Depth", 0, 0xffffffff, D3D_NAME_DEPTH, D3D_REGISTER_COMPONENT_FLOAT32, 0x1, 0xe, 0},
+};
+
+static void test_reflection_desc_ps(void)
+{
+    HRESULT hr;
+    ULONG count;
+    ID3D11ShaderReflection *ref11;
+    D3D11_SHADER_DESC sdesc11 = {0};
+    D3D11_SIGNATURE_PARAMETER_DESC desc = {0};
+    const D3D11_SIGNATURE_PARAMETER_DESC *pdesc;
+    UINT ret;
+    unsigned int i;
+
+    hr = pD3DReflect(test_reflection_desc_ps_blob, test_reflection_desc_ps_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11);
+    ok(hr == S_OK, "D3DReflect failed %x\n", hr);
+
+    hr = ref11->lpVtbl->GetDesc(ref11, &sdesc11);
+    ok(hr == S_OK, "GetDesc failed %x\n", hr);
+
+    ok(sdesc11.Version == 65, "GetDesc failed, got %u, expected %u\n", sdesc11.Version, 65);
+    ok(strcmp(sdesc11.Creator, (char*) shader_creator) == 0, "GetDesc failed, got \"%s\", expected \"%s\"\n", sdesc11.Creator, (char*)shader_creator);
+    ok(sdesc11.Flags == 256, "GetDesc failed, got %u, expected %u\n", sdesc11.Flags, 256);
+    ok(sdesc11.ConstantBuffers == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.ConstantBuffers, 0);
+    ok(sdesc11.BoundResources == 4, "GetDesc failed, got %u, expected %u\n", sdesc11.BoundResources, 4);
+    ok(sdesc11.InputParameters == 8, "GetDesc failed, got %u, expected %u\n", sdesc11.InputParameters, 8);
+    ok(sdesc11.OutputParameters == 4, "GetDesc failed, got %u, expected %u\n", sdesc11.OutputParameters, 4);
+    ok(sdesc11.InstructionCount == 50, "GetDesc failed, got %u, expected %u\n", sdesc11.InstructionCount, 50);
+    ok(sdesc11.TempRegisterCount == 3, "GetDesc failed, got %u, expected %u\n", sdesc11.TempRegisterCount, 3);
+    ok(sdesc11.TempArrayCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.TempArrayCount, 0);
+    ok(sdesc11.DefCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.DefCount, 0);
+    ok(sdesc11.DclCount == 5, "GetDesc failed, got %u, expected %u\n", sdesc11.DclCount, 5);
+    ok(sdesc11.TextureNormalInstructions == 1, "GetDesc failed, got %u, expected %u\n", sdesc11.TextureNormalInstructions, 1);
+    ok(sdesc11.TextureLoadInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.TextureLoadInstructions, 0);
+    ok(sdesc11.TextureCompInstructions == 3, "GetDesc failed, got %u, expected %u\n", sdesc11.TextureCompInstructions, 3);
+    ok(sdesc11.TextureBiasInstructions == 4, "GetDesc failed, got %u, expected %u\n", sdesc11.TextureBiasInstructions, 4);
+    ok(sdesc11.TextureGradientInstructions == 5, "GetDesc failed, got %u, expected %u\n", sdesc11.TextureGradientInstructions, 5);
+    ok(sdesc11.FloatInstructionCount == 17, "GetDesc failed, got %u, expected %u\n", sdesc11.FloatInstructionCount, 17);
+    ok(sdesc11.IntInstructionCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.IntInstructionCount, 0);
+    ok(sdesc11.UintInstructionCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.UintInstructionCount, 0);
+    ok(sdesc11.StaticFlowControlCount == 6, "GetDesc failed, got %u, expected %u\n", sdesc11.StaticFlowControlCount, 6);
+    ok(sdesc11.DynamicFlowControlCount == 5, "GetDesc failed, got %u, expected %u\n", sdesc11.DynamicFlowControlCount, 5);
+    ok(sdesc11.MacroInstructionCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.MacroInstructionCount, 0);
+    ok(sdesc11.ArrayInstructionCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.ArrayInstructionCount, 0);
+    ok(sdesc11.CutInstructionCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.CutInstructionCount, 0);
+    ok(sdesc11.EmitInstructionCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.EmitInstructionCount, 0);
+    ok(sdesc11.GSOutputTopology == 0, "GetDesc failed, got %x, expected %x\n", sdesc11.GSOutputTopology, 0);
+    ok(sdesc11.GSMaxOutputVertexCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.GSMaxOutputVertexCount, 0);
+    ok(sdesc11.InputPrimitive == 0, "GetDesc failed, got %x, expected %x\n", sdesc11.InputPrimitive, 0);
+    ok(sdesc11.PatchConstantParameters == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.PatchConstantParameters, 0);
+    ok(sdesc11.cGSInstanceCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.cGSInstanceCount, 0);
+    ok(sdesc11.cControlPoints == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.cControlPoints, 0);
+    ok(sdesc11.HSOutputPrimitive == 0, "GetDesc failed, got %x, expected %x\n", sdesc11.HSOutputPrimitive, 0);
+    ok(sdesc11.HSPartitioning == 0, "GetDesc failed, got %x, expected %x\n", sdesc11.HSPartitioning, 0);
+    ok(sdesc11.TessellatorDomain == 0, "GetDesc failed, got %x, expected %x\n", sdesc11.TessellatorDomain, 0);
+    ok(sdesc11.cBarrierInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.cBarrierInstructions, 0);
+    ok(sdesc11.cInterlockedInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.cInterlockedInstructions, 0);
+    ok(sdesc11.cTextureStoreInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.cTextureStoreInstructions, 0);
+
+    ret = ref11->lpVtbl->GetBitwiseInstructionCount(ref11);
+    ok(ret == 0, "GetBitwiseInstructionCount failed, got %u, expected %u\n", ret, 0);
+
+    ret = ref11->lpVtbl->GetConversionInstructionCount(ref11);
+    ok(ret == 0, "GetConversionInstructionCount failed, got %u, expected %u\n", ret, 0);
+
+    ret = ref11->lpVtbl->GetMovInstructionCount(ref11);
+    ok(ret == 24, "GetMovInstructionCount failed, got %u, expected %u\n", ret, 24);
+
+    ret = ref11->lpVtbl->GetMovcInstructionCount(ref11);
+    ok(ret == 0, "GetMovcInstructionCount failed, got %u, expected %u\n", ret, 0);
+
+    /* check invalid Get*ParameterDesc cases*/
+    hr = ref11->lpVtbl->GetInputParameterDesc(ref11, 0, NULL);
+    ok(hr == E_INVALIDARG, "GetInputParameterDesc failed, got %x, expected %x\n", hr, E_INVALIDARG);
+
+    hr = ref11->lpVtbl->GetInputParameterDesc(ref11, 0xffffffff, &desc);
+    ok(hr == E_INVALIDARG, "GetInputParameterDesc failed, got %x, expected %x\n", hr, E_INVALIDARG);
+
+    hr = ref11->lpVtbl->GetOutputParameterDesc(ref11, 0, NULL);
+    ok(hr == E_INVALIDARG, "GetOutputParameterDesc failed, got %x, expected %x\n", hr, E_INVALIDARG);
+
+    hr = ref11->lpVtbl->GetOutputParameterDesc(ref11, 0xffffffff, &desc);
+    ok(hr == E_INVALIDARG, "GetOutputParameterDesc failed, got %x, expected %x\n", hr, E_INVALIDARG);
+
+    hr = ref11->lpVtbl->GetPatchConstantParameterDesc(ref11, 0, &desc);
+    ok(hr == E_INVALIDARG, "GetPatchConstantParameterDesc failed, got %x, expected %x\n", hr, E_INVALIDARG);
+
+    /* GetIn/OutputParameterDesc */
+    for (i = 0; i < ARRAY_SIZE(test_reflection_desc_ps_resultin); ++i)
+    {
+        pdesc = &test_reflection_desc_ps_resultin[i];
+
+        hr = ref11->lpVtbl->GetInputParameterDesc(ref11, i, &desc);
+        ok(hr == S_OK, "GetInputParameterDesc(%u) failed, got %x, expected %x\n", i, hr, S_OK);
+
+        ok(!strcmp(desc.SemanticName, pdesc->SemanticName), "GetInputParameterDesc(%u) SemanticName failed, got \"%s\", expected \"%s\"\n",
+                i, desc.SemanticName, pdesc->SemanticName);
+        ok(desc.SemanticIndex == pdesc->SemanticIndex, "GetInputParameterDesc(%u) SemanticIndex failed, got %u, expected %u\n",
+                i, desc.SemanticIndex, pdesc->SemanticIndex);
+        ok(desc.Register == pdesc->Register, "GetInputParameterDesc(%u) Register failed, got %u, expected %u\n",
+                i, desc.Register, pdesc->Register);
+        ok(desc.SystemValueType == pdesc->SystemValueType, "GetInputParameterDesc(%u) SystemValueType failed, got %x, expected %x\n",
+                i, desc.SystemValueType, pdesc->SystemValueType);
+        ok(desc.ComponentType == pdesc->ComponentType, "GetInputParameterDesc(%u) ComponentType failed, got %x, expected %x\n",
+                i, desc.ComponentType, pdesc->ComponentType);
+        ok(desc.Mask == pdesc->Mask, "GetInputParameterDesc(%u) Mask failed, got %x, expected %x\n",
+                i, desc.Mask, pdesc->Mask);
+        ok(desc.ReadWriteMask == pdesc->ReadWriteMask, "GetInputParameterDesc(%u) ReadWriteMask failed, got %x, expected %x\n",
+                i, desc.ReadWriteMask, pdesc->ReadWriteMask);
+        ok(desc.Stream == pdesc->Stream, "GetInputParameterDesc(%u) Stream failed, got %u, expected %u\n",
+                i, desc.Stream, pdesc->ReadWriteMask);
+    }
+
+    for (i = 0; i < ARRAY_SIZE(test_reflection_desc_ps_resultout); ++i)
+    {
+        pdesc = &test_reflection_desc_ps_resultout[i];
+
+        hr = ref11->lpVtbl->GetOutputParameterDesc(ref11, i, &desc);
+        ok(hr == S_OK, "GetOutputParameterDesc(%u) failed, got %x, expected %x\n", i, hr, S_OK);
+
+        ok(!strcmp(desc.SemanticName, pdesc->SemanticName), "GetOutputParameterDesc(%u) SemanticName failed, got \"%s\", expected \"%s\"\n",
+                i, desc.SemanticName, pdesc->SemanticName);
+        ok(desc.SemanticIndex == pdesc->SemanticIndex, "GetOutputParameterDesc(%u) SemanticIndex failed, got %u, expected %u\n",
+                i, desc.SemanticIndex, pdesc->SemanticIndex);
+        ok(desc.Register == pdesc->Register, "GetOutputParameterDesc(%u) Register failed, got %u, expected %u\n",
+                i, desc.Register, pdesc->Register);
+        ok(desc.SystemValueType == pdesc->SystemValueType, "GetOutputParameterDesc(%u) SystemValueType failed, got %x, expected %x\n",
+                i, desc.SystemValueType, pdesc->SystemValueType);
+        ok(desc.ComponentType == pdesc->ComponentType, "GetOutputParameterDesc(%u) ComponentType failed, got %x, expected %x\n",
+                i, desc.ComponentType, pdesc->ComponentType);
+        ok(desc.Mask == pdesc->Mask, "GetOutputParameterDesc(%u) Mask failed, got %x, expected %x\n",
+                i, desc.Mask, pdesc->Mask);
+        ok(desc.ReadWriteMask == pdesc->ReadWriteMask, "GetOutputParameterDesc(%u) ReadWriteMask failed, got %x, expected %x\n",
+                i, desc.ReadWriteMask, pdesc->ReadWriteMask);
+        ok(desc.Stream == pdesc->Stream, "GetOutputParameterDesc(%u) Stream failed, got %u, expected %u\n",
+                i, desc.Stream, pdesc->ReadWriteMask);
+    }
+
+    count = ref11->lpVtbl->Release(ref11);
+    ok(count == 0, "Release failed %u\n", count);
+}
+
+/*
+ * fxc.exe /E PS /Tps_5_0 /Fx
+ */
+#if 0
+float4 PS() : SV_Target3
+{
+    float4 a = float4(1.2f, 1.0f, 0.2f, 0.0f);
+    return a;
+}
+#endif
+static const DWORD test_reflection_desc_ps_output_blob_0[] = {
+0x43425844, 0x3e7b77e6, 0xe4e920b7, 0x9cad0533, 0x240117cc, 0x00000001, 0x0000018c, 0x00000005,
+0x00000034, 0x0000008c, 0x0000009c, 0x000000d0, 0x00000110, 0x46454452, 0x00000050, 0x00000000,
+0x00000000, 0x00000000, 0x0000001c, 0xffff0400, 0x00000100, 0x0000001c, 0x7263694d, 0x666f736f,
+0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, 0x2e39322e,
+0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
+0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000003, 0x00000000, 0x00000003, 0x00000003,
+0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000038, 0x00000040, 0x0000000e,
+0x03000065, 0x001020f2, 0x00000003, 0x08000036, 0x001020f2, 0x00000003, 0x00004002, 0x3f99999a,
+0x3f800000, 0x3e4ccccd, 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x00000002, 0x00000000,
+0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000
+};
+
+/*
+ * fxc.exe /E PS /Tps_5_0 /Fx
+ */
+#if 0
+float PS() : SV_DepthLessEqual
+{
+    float a = 1.2f;
+    return a;
+}
+#endif
+static const DWORD test_reflection_desc_ps_output_blob_1[] = {
+0x43425844, 0xd8ead3ec, 0x61276ada, 0x70cdaa9e, 0x2cfd7f4c, 0x00000001, 0x000001c4, 0x00000005,
+0x00000034, 0x000000ac, 0x000000bc, 0x000000f8, 0x00000128, 0x46454452, 0x00000070, 0x00000000,
+0x00000000, 0x00000000, 0x0000003c, 0xffff0500, 0x00000100, 0x0000003c, 0x31314452, 0x0000003c,
+0x00000018, 0x00000020, 0x00000028, 0x00000024, 0x0000000c, 0x00000000, 0x7263694d, 0x666f736f,
+0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, 0x2e39322e,
+0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
+0x00000034, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0xffffffff,
+0x00000e01, 0x445f5653, 0x68747065, 0x7373654c, 0x61757145, 0xabab006c, 0x58454853, 0x00000028,
+0x00000050, 0x0000000a, 0x0100086a, 0x02000065, 0x00027001, 0x04000036, 0x00027001, 0x00004001,
+0x3f99999a, 0x0100003e, 0x54415453, 0x00000094, 0x00000002, 0x00000000, 0x00000000, 0x00000001,
+0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000,
+};
+
+/*
+ * fxc.exe /E PS /Tps_5_0 /Fx
+ */
+#if 0
+float PS() : SV_DepthGreaterEqual
+{
+    float a = 1.2f;
+    return a;
+}
+#endif
+static const DWORD test_reflection_desc_ps_output_blob_2[] = {
+0x43425844, 0x9f61c8df, 0x612cbb1f, 0x9e1d039e, 0xf925a074, 0x00000001, 0x000001c8, 0x00000005,
+0x00000034, 0x000000ac, 0x000000bc, 0x000000fc, 0x0000012c, 0x46454452, 0x00000070, 0x00000000,
+0x00000000, 0x00000000, 0x0000003c, 0xffff0500, 0x00000100, 0x0000003c, 0x31314452, 0x0000003c,
+0x00000018, 0x00000020, 0x00000028, 0x00000024, 0x0000000c, 0x00000000, 0x7263694d, 0x666f736f,
+0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, 0x2e39322e,
+0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
+0x00000038, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0xffffffff,
+0x00000e01, 0x445f5653, 0x68747065, 0x61657247, 0x45726574, 0x6c617571, 0xababab00, 0x58454853,
+0x00000028, 0x00000050, 0x0000000a, 0x0100086a, 0x02000065, 0x00026001, 0x04000036, 0x00026001,
+0x00004001, 0x3f99999a, 0x0100003e, 0x54415453, 0x00000094, 0x00000002, 0x00000000, 0x00000000,
+0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000,
+};
+
+/*
+ * fxc.exe /E PS /Tps_5_0 /Fx
+ */
+#if 0
+float PS() : sV_DePtH
+{
+    float a = 1.2f;
+    return a;
+}
+#endif
+static const DWORD test_reflection_desc_ps_output_blob_3[] = {
+0x43425844, 0x32cec0e6, 0x3873ed32, 0x2e86ffd0, 0x21bb00e8, 0x00000001, 0x000001bc, 0x00000005,
+0x00000034, 0x000000ac, 0x000000bc, 0x000000f0, 0x00000120, 0x46454452, 0x00000070, 0x00000000,
+0x00000000, 0x00000000, 0x0000003c, 0xffff0500, 0x00000100, 0x0000003c, 0x31314452, 0x0000003c,
+0x00000018, 0x00000020, 0x00000028, 0x00000024, 0x0000000c, 0x00000000, 0x7263694d, 0x666f736f,
+0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, 0x2e39322e,
+0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
+0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0xffffffff,
+0x00000e01, 0x445f5673, 0x48745065, 0xababab00, 0x58454853, 0x00000028, 0x00000050, 0x0000000a,
+0x0100086a, 0x02000065, 0x0000c001, 0x04000036, 0x0000c001, 0x00004001, 0x3f99999a, 0x0100003e,
+0x54415453, 0x00000094, 0x00000002, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000,
+0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+};
+
+/*
+ * fxc.exe /E PS /Tps_4_0 /Fx
+ */
+#if 0
+float PS() : SV_Depth
+{
+    float a = 1.2f;
+    return a;
+}
+#endif
+static const DWORD test_reflection_desc_ps_output_blob_4[] = {
+0x43425844, 0x7af34874, 0x975f09ad, 0xf6e50764, 0xdfb1255f, 0x00000001, 0x00000178, 0x00000005,
+0x00000034, 0x0000008c, 0x0000009c, 0x000000d0, 0x000000fc, 0x46454452, 0x00000050, 0x00000000,
+0x00000000, 0x00000000, 0x0000001c, 0xffff0400, 0x00000100, 0x0000001c, 0x7263694d, 0x666f736f,
+0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, 0x2e39322e,
+0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
+0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0xffffffff,
+0x00000e01, 0x445f5653, 0x68747065, 0xababab00, 0x52444853, 0x00000024, 0x00000040, 0x00000009,
+0x02000065, 0x0000c001, 0x04000036, 0x0000c001, 0x00004001, 0x3f99999a, 0x0100003e, 0x54415453,
+0x00000074, 0x00000002, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
+0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+};
+
+/*
+ * fxc.exe /E PS /Tps_4_0 /Fx
+ */
+#if 0
+bool PS() : SV_COVERAGE
+{
+    bool a = true;
+    return a;
+}
+#endif
+static const DWORD test_reflection_desc_ps_output_blob_5[] = {
+0x43425844, 0x40ae32a7, 0xe944bb1c, 0x1a2b1923, 0xea25962d, 0x00000001, 0x000001bc, 0x00000005,
+0x00000034, 0x000000ac, 0x000000bc, 0x000000f0, 0x00000120, 0x46454452, 0x00000070, 0x00000000,
+0x00000000, 0x00000000, 0x0000003c, 0xffff0500, 0x00000100, 0x0000003c, 0x31314452, 0x0000003c,
+0x00000018, 0x00000020, 0x00000028, 0x00000024, 0x0000000c, 0x00000000, 0x7263694d, 0x666f736f,
+0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, 0x2e39322e,
+0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
+0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000001, 0xffffffff,
+0x00000e01, 0x435f5653, 0x5245564f, 0x00454741, 0x58454853, 0x00000028, 0x00000050, 0x0000000a,
+0x0100086a, 0x02000065, 0x0000f000, 0x04000036, 0x0000f001, 0x00004001, 0xffffffff, 0x0100003e,
+0x54415453, 0x00000094, 0x00000002, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000,
+0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+};
+
+static const DWORD *test_reflection_desc_ps_output_blob[] = {
+    test_reflection_desc_ps_output_blob_0,
+    test_reflection_desc_ps_output_blob_1,
+    test_reflection_desc_ps_output_blob_2,
+    test_reflection_desc_ps_output_blob_3,
+    test_reflection_desc_ps_output_blob_4,
+    test_reflection_desc_ps_output_blob_5,
+};
+
+static const D3D11_SIGNATURE_PARAMETER_DESC test_reflection_desc_ps_output_result[] =
+{
+    {"SV_Target", 3, 3, D3D_NAME_TARGET, D3D_REGISTER_COMPONENT_FLOAT32, 0xf, 0, 0},
+    {"SV_DepthLessEqual", 0, 0xffffffff, D3D_NAME_DEPTH_LESS_EQUAL, D3D_REGISTER_COMPONENT_FLOAT32, 0x1, 0xe, 0},
+    {"SV_DepthGreaterEqual", 0, 0xffffffff, D3D11_NAME_DEPTH_GREATER_EQUAL, D3D_REGISTER_COMPONENT_FLOAT32, 0x1, 0xe, 0},
+    {"sV_DePtH", 0, 0xffffffff, D3D_NAME_DEPTH, D3D_REGISTER_COMPONENT_FLOAT32, 0x1, 0xe, 0},
+    {"SV_Depth", 0, 0xffffffff, D3D_NAME_DEPTH, D3D_REGISTER_COMPONENT_FLOAT32, 0x1, 0xe, 0},
+    {"SV_COVERAGE", 0, 0xffffffff, D3D_NAME_COVERAGE, D3D_REGISTER_COMPONENT_UINT32, 0x1, 0xe, 0},
+};
+
+static void test_reflection_desc_ps_output(void)
+{
+    HRESULT hr;
+    ULONG count;
+    ID3D11ShaderReflection *ref11;
+    D3D11_SIGNATURE_PARAMETER_DESC desc = {0};
+    const D3D11_SIGNATURE_PARAMETER_DESC *pdesc;
+    unsigned int i;
+
+    for (i = 0; i < ARRAY_SIZE(test_reflection_desc_ps_output_result); ++i)
+    {
+        hr = pD3DReflect(test_reflection_desc_ps_output_blob[i], test_reflection_desc_ps_output_blob[i][6], &IID_ID3D11ShaderReflection, (void **)&ref11);
+        ok(hr == S_OK, "(%u): D3DReflect failed %x\n", i, hr);
+
+        pdesc = &test_reflection_desc_ps_output_result[i];
+
+        hr = ref11->lpVtbl->GetOutputParameterDesc(ref11, 0, &desc);
+        ok(hr == S_OK, "(%u): GetOutputParameterDesc failed, got %x, expected %x\n", i, hr, S_OK);
+
+        ok(!strcmp(desc.SemanticName, pdesc->SemanticName), "(%u): GetOutputParameterDesc SemanticName failed, got \"%s\", expected \"%s\"\n",
+                i, desc.SemanticName, pdesc->SemanticName);
+        ok(desc.SemanticIndex == pdesc->SemanticIndex, "(%u): GetOutputParameterDesc SemanticIndex failed, got %u, expected %u\n",
+                i, desc.SemanticIndex, pdesc->SemanticIndex);
+        ok(desc.Register == pdesc->Register, "(%u): GetOutputParameterDesc Register failed, got %u, expected %u\n",
+                i, desc.Register, pdesc->Register);
+        ok(desc.SystemValueType == pdesc->SystemValueType, "(%u): GetOutputParameterDesc SystemValueType failed, got %x, expected %x\n",
+                i, desc.SystemValueType, pdesc->SystemValueType);
+        ok(desc.ComponentType == pdesc->ComponentType, "(%u): GetOutputParameterDesc ComponentType failed, got %x, expected %x\n",
+                i, desc.ComponentType, pdesc->ComponentType);
+        ok(desc.Mask == pdesc->Mask, "(%u): GetOutputParameterDesc Mask failed, got %x, expected %x\n",
+                i, desc.Mask, pdesc->Mask);
+        ok(desc.ReadWriteMask == pdesc->ReadWriteMask, "(%u): GetOutputParameterDesc ReadWriteMask failed, got %x, expected %x\n",
+                i, desc.ReadWriteMask, pdesc->ReadWriteMask);
+        ok(desc.Stream == pdesc->Stream, "(%u): GetOutputParameterDesc Stream failed, got %u, expected %u\n",
+                i, desc.Stream, pdesc->ReadWriteMask);
+
+        count = ref11->lpVtbl->Release(ref11);
+        ok(count == 0, "(%u): Release failed %u\n", i, count);
+    }
+}
+
+/*
+ * fxc.exe /E PS /Tps_4_0 /Fx
+ */
+#if 0
+Texture2D tex1;
+SamplerState sam
+{
+    Filter = MIN_MAG_MIP_LINEAR;
+    AddressU = Wrap;
+    AddressV = Wrap;
+};
+cbuffer c1
+{
+    float x;
+    float y[2];
+    int z;
+};
+cbuffer c2
+{
+    float t;
+};
+
+float4 PS(float2 uv : TEXCOORD0) : sv_target
+{
+    float4 q = tex1.Sample(sam, uv);
+    q.x = q.x + x;
+    q.w = q.w + y[0] + y[1] + t;
+    return q;
+}
+#endif
+static DWORD test_reflection_bound_resources_blob[] = {
+0x43425844, 0xe4af0279, 0x690268fc, 0x76bf6a72, 0xe5aff43b, 0x00000001, 0x000003f4, 0x00000005,
+0x00000034, 0x000001e8, 0x0000021c, 0x00000250, 0x00000378, 0x46454452, 0x000001ac, 0x00000002,
+0x000000ac, 0x00000004, 0x0000001c, 0xffff0400, 0x00000100, 0x0000017a, 0x0000009c, 0x00000003,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x000000a0, 0x00000002,
+0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000c, 0x000000a5, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x000000a8, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x006d6173, 0x31786574,
+0x00316300, 0xab003263, 0x000000a5, 0x00000003, 0x000000dc, 0x00000030, 0x00000000, 0x00000000,
+0x000000a8, 0x00000001, 0x00000160, 0x00000010, 0x00000000, 0x00000000, 0x00000124, 0x00000000,
+0x00000004, 0x00000002, 0x00000128, 0x00000000, 0x00000138, 0x00000010, 0x00000014, 0x00000002,
+0x0000013c, 0x00000000, 0x0000014c, 0x00000024, 0x00000004, 0x00000000, 0x00000150, 0x00000000,
+0xabab0078, 0x00030000, 0x00010001, 0x00000000, 0x00000000, 0xabab0079, 0x00030000, 0x00010001,
+0x00000002, 0x00000000, 0xabab007a, 0x00020000, 0x00010001, 0x00000000, 0x00000000, 0x00000178,
+0x00000000, 0x00000004, 0x00000002, 0x00000128, 0x00000000, 0x694d0074, 0x736f7263, 0x2074666f,
+0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39,
+0x31332e32, 0xab003131, 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000,
+0x00000000, 0x00000003, 0x00000000, 0x00000303, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f,
+0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
+0x0000000f, 0x745f7673, 0x65677261, 0xabab0074, 0x52444853, 0x00000120, 0x00000040, 0x00000048,
+0x04000059, 0x00208e46, 0x00000000, 0x00000003, 0x04000059, 0x00208e46, 0x00000001, 0x00000001,
+0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062,
+0x00101032, 0x00000000, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x09000045,
+0x001000f2, 0x00000000, 0x00101046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000,
+0x08000000, 0x00100082, 0x00000000, 0x0010003a, 0x00000000, 0x0020800a, 0x00000000, 0x00000001,
+0x08000000, 0x00100082, 0x00000000, 0x0010003a, 0x00000000, 0x0020800a, 0x00000000, 0x00000002,
+0x08000000, 0x00102082, 0x00000000, 0x0010003a, 0x00000000, 0x0020800a, 0x00000001, 0x00000000,
+0x08000000, 0x00102012, 0x00000000, 0x0010000a, 0x00000000, 0x0020800a, 0x00000000, 0x00000000,
+0x05000036, 0x00102062, 0x00000000, 0x00100656, 0x00000000, 0x0100003e, 0x54415453, 0x00000074,
+0x00000007, 0x00000001, 0x00000000, 0x00000002, 0x00000004, 0x00000000, 0x00000000, 0x00000001,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+};
+
+static const D3D11_SHADER_INPUT_BIND_DESC test_reflection_bound_resources_result[] =
+{
+    {"sam", D3D_SIT_SAMPLER, 0, 1, 0, 0, D3D_SRV_DIMENSION_UNKNOWN, 0},
+    {"tex1", D3D_SIT_TEXTURE, 0, 1, 12, D3D_RETURN_TYPE_FLOAT, D3D_SRV_DIMENSION_TEXTURE2D, 0xffffffff},
+    {"c1", D3D_SIT_CBUFFER, 0, 1, 0, 0, D3D_SRV_DIMENSION_UNKNOWN, 0},
+    {"c2", D3D_SIT_CBUFFER, 1, 1, 0, 0, D3D_SRV_DIMENSION_UNKNOWN, 0},
+};
+
+static void test_reflection_bound_resources(void)
+{
+    HRESULT hr;
+    ULONG count;
+    ID3D11ShaderReflection *ref11;
+    D3D11_SHADER_INPUT_BIND_DESC desc;
+    const D3D11_SHADER_INPUT_BIND_DESC *pdesc;
+    unsigned int i;
+
+    hr = pD3DReflect(test_reflection_bound_resources_blob, test_reflection_bound_resources_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11);
+    ok(hr == S_OK, "D3DReflect failed %x\n", hr);
+
+    /* check invalid cases */
+    hr = ref11->lpVtbl->GetResourceBindingDesc(ref11, 0, NULL);
+    ok(hr == E_INVALIDARG, "GetResourceBindingDesc failed, got %x, expected %x\n", hr, E_INVALIDARG);
+
+    hr = ref11->lpVtbl->GetResourceBindingDesc(ref11, 0xffffffff, &desc);
+    ok(hr == E_INVALIDARG, "GetResourceBindingDesc failed, got %x, expected %x\n", hr, E_INVALIDARG);
+
+    hr = ref11->lpVtbl->GetResourceBindingDescByName(ref11, NULL, &desc);
+    ok(hr == E_INVALIDARG, "GetResourceBindingDescByName failed, got %x, expected %x\n", hr, E_INVALIDARG);
+
+    hr = ref11->lpVtbl->GetResourceBindingDescByName(ref11, "sam", NULL);
+    ok(hr == E_INVALIDARG, "GetResourceBindingDescByName failed, got %x, expected %x\n", hr, E_INVALIDARG);
+
+    hr = ref11->lpVtbl->GetResourceBindingDescByName(ref11, "invalid", NULL);
+    ok(hr == E_INVALIDARG, "GetResourceBindingDescByName failed, got %x, expected %x\n", hr, E_INVALIDARG);
+
+    hr = ref11->lpVtbl->GetResourceBindingDescByName(ref11, "invalid", &desc);
+    ok(hr == E_INVALIDARG, "GetResourceBindingDescByName failed, got %x, expected %x\n", hr, E_INVALIDARG);
+
+    /* GetResourceBindingDesc */
+    for (i = 0; i < ARRAY_SIZE(test_reflection_bound_resources_result); ++i)
+    {
+        pdesc = &test_reflection_bound_resources_result[i];
+
+        hr = ref11->lpVtbl->GetResourceBindingDesc(ref11, i, &desc);
+        ok(hr == S_OK, "GetResourceBindingDesc(%u) failed, got %x, expected %x\n", i, hr, S_OK);
+
+        ok(!strcmp(desc.Name, pdesc->Name), "GetResourceBindingDesc(%u) Name failed, got \"%s\", expected \"%s\"\n",
+                i, desc.Name, pdesc->Name);
+        ok(desc.Type == pdesc->Type, "GetResourceBindingDesc(%u) Type failed, got %x, expected %x\n",
+                i, desc.Type, pdesc->Type);
+        ok(desc.BindPoint == pdesc->BindPoint, "GetResourceBindingDesc(%u) BindPoint failed, got %u, expected %u\n",
+                i, desc.BindPoint, pdesc->BindPoint);
+        ok(desc.BindCount == pdesc->BindCount, "GetResourceBindingDesc(%u) BindCount failed, got %u, expected %u\n",
+                i, desc.BindCount, pdesc->BindCount);
+        ok(desc.uFlags == pdesc->uFlags, "GetResourceBindingDesc(%u) uFlags failed, got %u, expected %u\n",
+                i, desc.uFlags, pdesc->uFlags);
+        ok(desc.ReturnType == pdesc->ReturnType, "GetResourceBindingDesc(%u) ReturnType failed, got %x, expected %x\n",
+                i, desc.ReturnType, pdesc->ReturnType);
+        ok(desc.Dimension == pdesc->Dimension, "GetResourceBindingDesc(%u) Dimension failed, got %x, expected %x\n",
+                i, desc.Dimension, pdesc->Dimension);
+        ok(desc.NumSamples == pdesc->NumSamples, "GetResourceBindingDesc(%u) NumSamples failed, got %u, expected %u\n",
+                i, desc.NumSamples, pdesc->NumSamples);
+    }
+
+    /* GetResourceBindingDescByName */
+    for (i = 0; i < ARRAY_SIZE(test_reflection_bound_resources_result); ++i)
+    {
+        pdesc = &test_reflection_bound_resources_result[i];
+
+        hr = ref11->lpVtbl->GetResourceBindingDescByName(ref11, pdesc->Name, &desc);
+        ok(hr == S_OK, "GetResourceBindingDescByName(%u) failed, got %x, expected %x\n", i, hr, S_OK);
+
+        ok(!strcmp(desc.Name, pdesc->Name), "GetResourceBindingDescByName(%u) Name failed, got \"%s\", expected \"%s\"\n",
+                i, desc.Name, pdesc->Name);
+        ok(desc.Type == pdesc->Type, "GetResourceBindingDescByName(%u) Type failed, got %x, expected %x\n",
+                i, desc.Type, pdesc->Type);
+        ok(desc.BindPoint == pdesc->BindPoint, "GetResourceBindingDescByName(%u) BindPoint failed, got %u, expected %u\n",
+                i, desc.BindPoint, pdesc->BindPoint);
+        ok(desc.BindCount == pdesc->BindCount, "GetResourceBindingDescByName(%u) BindCount failed, got %u, expected %u\n",
+                i, desc.BindCount, pdesc->BindCount);
+        ok(desc.uFlags == pdesc->uFlags, "GetResourceBindingDescByName(%u) uFlags failed, got %u, expected %u\n",
+                i, desc.uFlags, pdesc->uFlags);
+        ok(desc.ReturnType == pdesc->ReturnType, "GetResourceBindingDescByName(%u) ReturnType failed, got %x, expected %x\n",
+                i, desc.ReturnType, pdesc->ReturnType);
+        ok(desc.Dimension == pdesc->Dimension, "GetResourceBindingDescByName(%u) Dimension failed, got %x, expected %x\n",
+                i, desc.Dimension, pdesc->Dimension);
+        ok(desc.NumSamples == pdesc->NumSamples, "GetResourceBindingDescByName(%u) NumSamples failed, got %u, expected %u\n",
+                i, desc.NumSamples, pdesc->NumSamples);
+    }
+
+    count = ref11->lpVtbl->Release(ref11);
+    ok(count == 0, "Release failed %u\n", count);
+}
+
+/*
+ * fxc.exe /E PS /Tps_5_0 /Fx
+ */
+#if 0
+cbuffer c1
+{
+    float a;
+    float b[2];
+    int i;
+    struct s {
+        float a;
+        float b;
+    } t;
+};
+
+interface iTest
+{
+    float4 test(float2 vec);
+};
+
+class cTest : iTest
+{
+    bool m_on;
+    float4 test(float2 vec);
+};
+
+float4 cTest::test(float2 vec)
+{
+    float4 res;
+    if(m_on)
+        res = float4(vec.x, vec.y, vec.x+vec.y, 0);
+    else
+        res = 0;
+    return res;
+}
+
+iTest g_Test;
+
+
+float4 PS(float2 uv : TEXCOORD0) : sv_target
+{
+    float4 q = g_Test.test(uv);
+    q.x = q.x + t.a;
+    return q;
+}
+#endif
+static DWORD test_reflection_constant_buffer_blob[] = {
+0x43425844, 0xe6470e0d, 0x0d5698bb, 0x29373c30, 0x64a5d268, 0x00000001, 0x00000590, 0x00000006,
+0x00000038, 0x00000318, 0x0000034c, 0x00000380, 0x000003d8, 0x000004f4, 0x46454452, 0x000002d8,
+0x00000002, 0x00000060, 0x00000001, 0x0000003c, 0xffff0500, 0x00000100, 0x000002a4, 0x31314452,
+0x0000003c, 0x00000018, 0x00000020, 0x00000028, 0x00000024, 0x0000000c, 0x00000001, 0x0000005c,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0xab003163,
+0x00000090, 0x00000001, 0x000000a0, 0x00000010, 0x00000000, 0x00000002, 0x0000005c, 0x00000004,
+0x00000120, 0x00000040, 0x00000000, 0x00000000, 0x69685424, 0x696f5073, 0x7265746e, 0xababab00,
+0x000000c8, 0x00000000, 0x00000001, 0x00000006, 0x000000fc, 0x00000000, 0xffffffff, 0x00000000,
+0xffffffff, 0x00000000, 0x65545f67, 0x69007473, 0x74736554, 0xababab00, 0x00000006, 0x00000001,
+0x00000000, 0x000000d8, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000000cf, 0x00250007,
+0x00040001, 0x00000000, 0x00000000, 0x000000d8, 0x00000000, 0x00000000, 0x00000000, 0x000000cf,
+0x000001c0, 0x00000000, 0x00000004, 0x00000000, 0x000001c8, 0x00000000, 0xffffffff, 0x00000000,
+0xffffffff, 0x00000000, 0x000001ec, 0x00000010, 0x00000014, 0x00000000, 0x000001f0, 0x00000000,
+0xffffffff, 0x00000000, 0xffffffff, 0x00000000, 0x00000214, 0x00000024, 0x00000004, 0x00000000,
+0x0000021c, 0x00000000, 0xffffffff, 0x00000000, 0xffffffff, 0x00000000, 0x00000240, 0x00000030,
+0x00000008, 0x00000002, 0x00000280, 0x00000000, 0xffffffff, 0x00000000, 0xffffffff, 0x00000000,
+0x6c660061, 0x0074616f, 0x00030000, 0x00010001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x000001c2, 0xabab0062, 0x00030000, 0x00010001, 0x00000002, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000001c2, 0x6e690069, 0xabab0074, 0x00020000,
+0x00010001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000216,
+0x00730074, 0x00030000, 0x00010001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x000001c2, 0x000001c0, 0x00000244, 0x00000000, 0x000001ec, 0x00000244, 0x00000004,
+0x00000005, 0x00020001, 0x00020000, 0x00000268, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000242, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072,
+0x6c69706d, 0x39207265, 0x2e39322e, 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x0000002c,
+0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000303,
+0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020,
+0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x745f7673, 0x65677261, 0xabab0074,
+0x45434649, 0x00000050, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000040, 0x00000034,
+0x00000024, 0x00000000, 0x4e47534f, 0x00000001, 0x00000001, 0x00000040, 0x00000044, 0x00000048,
+0x00010000, 0x00000000, 0xabab0000, 0x00000000, 0x73655463, 0xabab0074, 0x58454853, 0x00000114,
+0x00000050, 0x00000045, 0x0100086a, 0x04000059, 0x00208e46, 0x00000000, 0x00000004, 0x03000091,
+0x00000000, 0x00000000, 0x05000092, 0x00000000, 0x00000000, 0x00010001, 0x00000000, 0x03001062,
+0x00101032, 0x00000000, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x07000000,
+0x00100042, 0x00000000, 0x0010101a, 0x00000000, 0x0010100a, 0x00000000, 0x05000036, 0x00100032,
+0x00000000, 0x00101046, 0x00000000, 0x05000036, 0x00100082, 0x00000000, 0x00004001, 0x00000000,
+0x05000036, 0x00100032, 0x00000001, 0x0011d516, 0x00000000, 0x0a000001, 0x001000f2, 0x00000000,
+0x00100e46, 0x00000000, 0x04a08006, 0x0010001a, 0x00000001, 0x0010000a, 0x00000001, 0x08000000,
+0x00102012, 0x00000000, 0x0010000a, 0x00000000, 0x0020800a, 0x00000000, 0x00000003, 0x05000036,
+0x001020e2, 0x00000000, 0x00100e56, 0x00000000, 0x0100003e, 0x54415453, 0x00000094, 0x00000008,
+0x00000002, 0x00000000, 0x00000002, 0x00000002, 0x00000000, 0x00000001, 0x00000001, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+};
+
+static const D3D11_SHADER_BUFFER_DESC test_reflection_constant_buffer_cb_result[] =
+{
+    {"$ThisPointer", D3D_CT_INTERFACE_POINTERS, 1, 16, 0},
+    {"c1", D3D_CT_CBUFFER, 4, 64, 0},
+};
+
+static const struct {
+    D3D11_SHADER_VARIABLE_DESC desc;
+    unsigned int type;
+} test_reflection_constant_buffer_variable_result[] =
+{
+    {{"g_Test", 0, 1, 6, 0}, 0},
+    {{"a", 0, 4, 0, 0}, 1},
+    {{"b", 16, 20, 0, 0}, 2},
+    {{"i", 36, 4, 0, 0}, 3},
+    {{"t", 48, 8, 2, 0}, 4},
+};
+
+static const D3D11_SHADER_TYPE_DESC test_reflection_constant_buffer_type_result[] =
+{
+    {D3D11_SVC_INTERFACE_POINTER, D3D11_SVT_INTERFACE_POINTER, 1, 4, 0, 1, 0, "iTest"},
+    {D3D_SVC_SCALAR, D3D_SVT_FLOAT, 1, 1, 0, 1, 0, "float"},
+    {D3D_SVC_SCALAR, D3D_SVT_FLOAT, 1, 1, 2, 1, 0, "float"},
+    {D3D_SVC_SCALAR, D3D_SVT_INT, 1, 1, 0, 1, 0, "int"},
+    {D3D_SVC_STRUCT, D3D_SVT_VOID, 1, 2, 0, 1, 0, "s"},
+};
+
+static void test_reflection_constant_buffer(void)
+{
+    HRESULT hr;
+    ULONG count;
+    ID3D11ShaderReflection *ref11;
+    ID3D11ShaderReflectionConstantBuffer *cb11, *cb11_dummy = NULL, *cb11_valid = NULL;
+    ID3D11ShaderReflectionVariable *v11, *v11_dummy = NULL, *v11_valid = NULL;
+    ID3D11ShaderReflectionType *t11, *t, *t2, *t11_dummy = NULL, *t11_valid = NULL;
+    D3D11_SHADER_BUFFER_DESC cbdesc = {0};
+    D3D11_SHADER_VARIABLE_DESC vdesc = {0};
+    D3D11_SHADER_TYPE_DESC tdesc = {0};
+    D3D11_SHADER_DESC sdesc = {0};
+    const D3D11_SHADER_BUFFER_DESC *pcbdesc;
+    const D3D11_SHADER_VARIABLE_DESC *pvdesc;
+    const D3D11_SHADER_TYPE_DESC *ptdesc;
+    unsigned int i;
+    LPCSTR string;
+
+    hr = pD3DReflect(test_reflection_constant_buffer_blob, test_reflection_constant_buffer_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11);
+    ok(hr == S_OK, "D3DReflect failed %x\n", hr);
+
+    hr = ref11->lpVtbl->GetDesc(ref11, &sdesc);
+    ok(hr == S_OK, "GetDesc failed %x\n", hr);
+
+    ok(sdesc.Version == 80, "GetDesc failed, got %u, expected %u\n", sdesc.Version, 80);
+    ok(strcmp(sdesc.Creator, (char*) shader_creator) == 0, "GetDesc failed, got \"%s\", expected \"%s\"\n", sdesc.Creator, (char*)shader_creator);
+    ok(sdesc.Flags == 256, "GetDesc failed, got %u, expected %u\n", sdesc.Flags, 256);
+    ok(sdesc.ConstantBuffers == 2, "GetDesc failed, got %u, expected %u\n", sdesc.ConstantBuffers, 2);
+    ok(sdesc.BoundResources == 1, "GetDesc failed, got %u, expected %u\n", sdesc.BoundResources, 1);
+    ok(sdesc.InputParameters == 1, "GetDesc failed, got %u, expected %u\n", sdesc.InputParameters, 1);
+    ok(sdesc.OutputParameters == 1, "GetDesc failed, got %u, expected %u\n", sdesc.OutputParameters, 1);
+    ok(sdesc.InstructionCount == 8, "GetDesc failed, got %u, expected %u\n", sdesc.InstructionCount, 8);
+    ok(sdesc.TempRegisterCount == 2, "GetDesc failed, got %u, expected %u\n", sdesc.TempRegisterCount, 2);
+    ok(sdesc.TempArrayCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc.TempArrayCount, 0);
+    ok(sdesc.DefCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc.DefCount, 0);
+    ok(sdesc.DclCount == 2, "GetDesc failed, got %u, expected %u\n", sdesc.DclCount, 2);
+    ok(sdesc.TextureNormalInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc.TextureNormalInstructions, 0);
+    ok(sdesc.TextureLoadInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc.TextureLoadInstructions, 0);
+    ok(sdesc.TextureCompInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc.TextureCompInstructions, 0);
+    ok(sdesc.TextureBiasInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc.TextureBiasInstructions, 0);
+    ok(sdesc.TextureGradientInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc.TextureGradientInstructions, 0);
+    ok(sdesc.FloatInstructionCount == 2, "GetDesc failed, got %u, expected %u\n", sdesc.FloatInstructionCount, 2);
+    ok(sdesc.IntInstructionCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc.IntInstructionCount, 0);
+    ok(sdesc.UintInstructionCount == 1, "GetDesc failed, got %u, expected %u\n", sdesc.UintInstructionCount, 1);
+    ok(sdesc.StaticFlowControlCount == 1, "GetDesc failed, got %u, expected %u\n", sdesc.StaticFlowControlCount, 1);
+    ok(sdesc.DynamicFlowControlCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc.DynamicFlowControlCount, 0);
+    ok(sdesc.MacroInstructionCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc.MacroInstructionCount, 0);
+    ok(sdesc.ArrayInstructionCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc.ArrayInstructionCount, 0);
+    ok(sdesc.CutInstructionCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc.CutInstructionCount, 0);
+    ok(sdesc.EmitInstructionCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc.EmitInstructionCount, 0);
+    ok(sdesc.GSOutputTopology == 0, "GetDesc failed, got %x, expected %x\n", sdesc.GSOutputTopology, 0);
+    ok(sdesc.GSMaxOutputVertexCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc.GSMaxOutputVertexCount, 0);
+    ok(sdesc.InputPrimitive == 0, "GetDesc failed, got %x, expected %x\n", sdesc.InputPrimitive, 0);
+    ok(sdesc.PatchConstantParameters == 0, "GetDesc failed, got %u, expected %u\n", sdesc.PatchConstantParameters, 0);
+    ok(sdesc.cGSInstanceCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc.cGSInstanceCount, 0);
+    ok(sdesc.cControlPoints == 0, "GetDesc failed, got %u, expected %u\n", sdesc.cControlPoints, 0);
+    ok(sdesc.HSOutputPrimitive == 0, "GetDesc failed, got %x, expected %x\n", sdesc.HSOutputPrimitive, 0);
+    ok(sdesc.HSPartitioning == 0, "GetDesc failed, got %x, expected %x\n", sdesc.HSPartitioning, 0);
+    ok(sdesc.TessellatorDomain == 0, "GetDesc failed, got %x, expected %x\n", sdesc.TessellatorDomain, 0);
+    ok(sdesc.cBarrierInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc.cBarrierInstructions, 0);
+    ok(sdesc.cInterlockedInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc.cInterlockedInstructions, 0);
+    ok(sdesc.cTextureStoreInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc.cTextureStoreInstructions, 0);
+
+    /* get the dummys for comparison */
+    cb11_dummy = ref11->lpVtbl->GetConstantBufferByIndex(ref11, 0xffffffff);
+    ok(cb11_dummy != NULL, "GetConstantBufferByIndex failed\n");
+
+    v11_dummy = cb11_dummy->lpVtbl->GetVariableByIndex(cb11_dummy, 0xffffffff);
+    ok(v11_dummy != NULL, "GetVariableByIndex failed\n");
+
+    t11_dummy = v11_dummy->lpVtbl->GetType(v11_dummy);
+    ok(t11_dummy != NULL, "GetType failed\n");
+
+    /* get the valid variables */
+    cb11_valid = ref11->lpVtbl->GetConstantBufferByIndex(ref11, 1);
+    ok(cb11_valid != cb11_dummy && cb11_valid, "GetConstantBufferByIndex failed\n");
+
+    v11_valid = cb11_valid->lpVtbl->GetVariableByIndex(cb11_valid, 0);
+    ok(v11_valid != v11_dummy && v11_valid, "GetVariableByIndex failed\n");
+
+    t11_valid = v11_valid->lpVtbl->GetType(v11_valid);
+    ok(t11_valid != t11_dummy && t11_valid, "GetType failed\n");
+
+    /* reflection calls */
+    cb11 = ref11->lpVtbl->GetConstantBufferByName(ref11, "invalid");
+    ok(cb11_dummy == cb11, "GetConstantBufferByName failed, got %p, expected %p\n", cb11, cb11_dummy);
+
+    cb11 = ref11->lpVtbl->GetConstantBufferByName(ref11, NULL);
+    ok(cb11_dummy == cb11, "GetConstantBufferByName failed, got %p, expected %p\n", cb11, cb11_dummy);
+
+    v11 = ref11->lpVtbl->GetVariableByName(ref11, NULL);
+    ok(v11_dummy == v11, "GetVariableByIndex failed, got %p, expected %p\n", v11, v11_dummy);
+
+    v11 = ref11->lpVtbl->GetVariableByName(ref11, "invalid");
+    ok(v11_dummy == v11, "GetVariableByName failed, got %p, expected %p\n", v11, v11_dummy);
+
+    v11 = ref11->lpVtbl->GetVariableByName(ref11, "a");
+    ok(v11_valid == v11, "GetVariableByName failed, got %p, expected %p\n", v11, v11_valid);
+
+    /* constant buffer calls */
+    v11 = cb11_dummy->lpVtbl->GetVariableByName(cb11_dummy, NULL);
+    ok(v11_dummy == v11, "GetVariableByName failed, got %p, expected %p\n", v11, v11_dummy);
+
+    v11 = cb11_dummy->lpVtbl->GetVariableByName(cb11_dummy, "invalid");
+    ok(v11_dummy == v11, "GetVariableByName failed, got %p, expected %p\n", v11, v11_dummy);
+
+    v11 = cb11_valid->lpVtbl->GetVariableByName(cb11_valid, NULL);
+    ok(v11_dummy == v11, "GetVariableByName failed, got %p, expected %p\n", v11, v11_dummy);
+
+    v11 = cb11_valid->lpVtbl->GetVariableByName(cb11_valid, "invalid");
+    ok(v11_dummy == v11, "GetVariableByName failed, got %p, expected %p\n", v11, v11_dummy);
+
+    v11 = cb11_valid->lpVtbl->GetVariableByName(cb11_valid, "a");
+    ok(v11_valid == v11, "GetVariableByName failed, got %p, expected %p\n", v11, v11_valid);
+
+    hr = cb11_dummy->lpVtbl->GetDesc(cb11_dummy, NULL);
+    ok(hr == E_FAIL, "GetDesc failed, got %x, expected %x\n", hr, E_FAIL);
+
+    hr = cb11_dummy->lpVtbl->GetDesc(cb11_dummy, &cbdesc);
+    ok(hr == E_FAIL, "GetDesc failed, got %x, expected %x\n", hr, E_FAIL);
+
+    hr = cb11_valid->lpVtbl->GetDesc(cb11_valid, NULL);
+    ok(hr == E_FAIL, "GetDesc failed, got %x, expected %x\n", hr, E_FAIL);
+
+    /* variable calls */
+    hr = v11_dummy->lpVtbl->GetDesc(v11_dummy, NULL);
+    ok(hr == E_FAIL, "GetDesc failed, got %x, expected %x\n", hr, E_FAIL);
+
+    hr = v11_dummy->lpVtbl->GetDesc(v11_dummy, &vdesc);
+    ok(hr == E_FAIL, "GetDesc failed, got %x, expected %x\n", hr, E_FAIL);
+
+    hr = v11_valid->lpVtbl->GetDesc(v11_valid, NULL);
+    ok(hr == E_FAIL, "GetDesc failed, got %x, expected %x\n", hr, E_FAIL);
+
+    /* type calls */
+    hr = t11_dummy->lpVtbl->GetDesc(t11_dummy, NULL);
+    ok(hr == E_FAIL, "GetDesc failed, got %x, expected %x\n", hr, E_FAIL);
+
+    hr = t11_dummy->lpVtbl->GetDesc(t11_dummy, &tdesc);
+    ok(hr == E_FAIL, "GetDesc failed, got %x, expected %x\n", hr, E_FAIL);
+
+    hr = t11_valid->lpVtbl->GetDesc(t11_valid, NULL);
+    ok(hr == E_FAIL, "GetDesc failed, got %x, expected %x\n", hr, E_FAIL);
+
+    string = t11_dummy->lpVtbl->GetMemberTypeName(t11_dummy, 0xffffffff);
+    ok(!strcmp(string, "$Invalid"), "GetMemberTypeName failed, got \"%s\", expected \"%s\"\n", string, "$Invalid");
+
+    string = t11_valid->lpVtbl->GetMemberTypeName(t11_valid, 0xffffffff);
+    ok(!string, "GetMemberTypeName failed, got \"%s\", expected NULL\n", string);
+
+    t11 = t11_dummy->lpVtbl->GetMemberTypeByIndex(t11_dummy, 0xffffffff);
+    ok(t11_dummy == t11, "GetMemberTypeByIndex failed, got %p, expected %p\n", t11, t11_dummy);
+
+    t11 = t11_valid->lpVtbl->GetMemberTypeByIndex(t11_valid, 0xffffffff);
+    ok(t11_dummy == t11, "GetMemberTypeByIndex failed, got %p, expected %p\n", t11, t11_dummy);
+
+    t11 = t11_dummy->lpVtbl->GetMemberTypeByName(t11_dummy, NULL);
+    ok(t11_dummy == t11, "GetMemberTypeByName failed, got %p, expected %p\n", t11, t11_dummy);
+
+    t11 = t11_dummy->lpVtbl->GetMemberTypeByName(t11_dummy, "invalid");
+    ok(t11_dummy == t11, "GetMemberTypeByName failed, got %p, expected %p\n", t11, t11_dummy);
+
+    t11 = t11_valid->lpVtbl->GetMemberTypeByName(t11_valid, NULL);
+    ok(t11_dummy == t11, "GetMemberTypeByName failed, got %p, expected %p\n", t11, t11_dummy);
+
+    t11 = t11_valid->lpVtbl->GetMemberTypeByName(t11_valid, "invalid");
+    ok(t11_dummy == t11, "GetMemberTypeByName failed, got %p, expected %p\n", t11, t11_dummy);
+
+    hr = t11_dummy->lpVtbl->IsEqual(t11_dummy, t11_dummy);
+    ok(hr == E_FAIL, "IsEqual failed, got %x, expected %x\n", hr, E_FAIL);
+
+    hr = t11_valid->lpVtbl->IsEqual(t11_valid, t11_dummy);
+    ok(hr == S_FALSE, "IsEqual failed, got %x, expected %x\n", hr, S_FALSE);
+
+    hr = t11_dummy->lpVtbl->IsEqual(t11_dummy, t11_valid);
+    ok(hr == E_FAIL, "IsEqual failed, got %x, expected %x\n", hr, E_FAIL);
+
+    hr = t11_valid->lpVtbl->IsEqual(t11_valid, t11_valid);
+    ok(hr == S_OK, "IsEqual failed, got %x, expected %x\n", hr, S_OK);
+
+    /* constant buffers */
+    for (i = 0; i < ARRAY_SIZE(test_reflection_constant_buffer_cb_result); ++i)
+    {
+        pcbdesc = &test_reflection_constant_buffer_cb_result[i];
+
+        cb11 = ref11->lpVtbl->GetConstantBufferByIndex(ref11, i);
+        ok(cb11_dummy != cb11, "GetConstantBufferByIndex(%u) failed\n", i);
+
+        hr = cb11->lpVtbl->GetDesc(cb11, &cbdesc);
+        ok(hr == S_OK, "GetDesc(%u) failed, got %x, expected %x\n", i, hr, S_OK);
+
+        ok(!strcmp(cbdesc.Name, pcbdesc->Name), "GetDesc(%u) Name failed, got \"%s\", expected \"%s\"\n",
+                i, cbdesc.Name, pcbdesc->Name);
+        ok(cbdesc.Type == pcbdesc->Type, "GetDesc(%u) Type failed, got %x, expected %x\n",
+                i, cbdesc.Type, pcbdesc->Type);
+        ok(cbdesc.Variables == pcbdesc->Variables, "GetDesc(%u) Variables failed, got %u, expected %u\n",
+                i, cbdesc.Variables, pcbdesc->Variables);
+        ok(cbdesc.Size == pcbdesc->Size, "GetDesc(%u) Size failed, got %u, expected %u\n",
+                i, cbdesc.Size, pcbdesc->Size);
+        ok(cbdesc.uFlags == pcbdesc->uFlags, "GetDesc(%u) uFlags failed, got %u, expected %u\n",
+                i, cbdesc.uFlags, pcbdesc->uFlags);
+    }
+
+    /* variables */
+    for (i = 0; i < ARRAY_SIZE(test_reflection_constant_buffer_variable_result); ++i)
+    {
+        pvdesc = &test_reflection_constant_buffer_variable_result[i].desc;
+
+        v11 = ref11->lpVtbl->GetVariableByName(ref11, pvdesc->Name);
+        ok(v11_dummy != v11, "GetVariableByName(%u) failed\n", i);
+
+        hr = v11->lpVtbl->GetDesc(v11, &vdesc);
+        ok(hr == S_OK, "GetDesc(%u) failed, got %x, expected %x\n", i, hr, S_OK);
+
+        ok(!strcmp(vdesc.Name, pvdesc->Name), "GetDesc(%u) Name failed, got \"%s\", expected \"%s\"\n",
+                i, vdesc.Name, pvdesc->Name);
+        ok(vdesc.StartOffset == pvdesc->StartOffset, "GetDesc(%u) StartOffset failed, got %u, expected %u\n",
+                i, vdesc.StartOffset, pvdesc->StartOffset);
+        ok(vdesc.Size == pvdesc->Size, "GetDesc(%u) Size failed, got %u, expected %u\n",
+                i, vdesc.Size, pvdesc->Size);
+        ok(vdesc.uFlags == pvdesc->uFlags, "GetDesc(%u) uFlags failed, got %u, expected %u\n",
+                i, vdesc.uFlags, pvdesc->uFlags);
+        ok(vdesc.DefaultValue == pvdesc->DefaultValue, "GetDesc(%u) DefaultValue failed\n", i);
+
+        /* types */
+        ptdesc = &test_reflection_constant_buffer_type_result[test_reflection_constant_buffer_variable_result[i].type];
+
+        t11 = v11->lpVtbl->GetType(v11);
+        ok(t11_dummy != t11, "GetType(%u) failed\n", i);
+
+        hr = t11->lpVtbl->GetDesc(t11, &tdesc);
+        ok(hr == S_OK, "GetDesc(%u) failed, got %x, expected %x\n", i, hr, S_OK);
+
+        ok(tdesc.Class == ptdesc->Class, "GetDesc(%u) Class failed, got %x, expected %x\n",
+                i, tdesc.Class, ptdesc->Class);
+        ok(tdesc.Type == ptdesc->Type, "GetDesc(%u) Type failed, got %x, expected %x\n",
+                i, tdesc.Type, ptdesc->Type);
+        ok(tdesc.Rows == ptdesc->Rows, "GetDesc(%u) Rows failed, got %x, expected %x\n",
+                i, tdesc.Rows, ptdesc->Rows);
+        ok(tdesc.Columns == ptdesc->Columns, "GetDesc(%u) Columns failed, got %u, expected %u\n",
+                i, tdesc.Columns, ptdesc->Columns);
+        ok(tdesc.Elements == ptdesc->Elements, "GetDesc(%u) Elements failed, got %u, expected %u\n",
+                i, tdesc.Elements, ptdesc->Elements);
+        ok(tdesc.Offset == ptdesc->Offset, "GetDesc(%u) Offset failed, got %u, expected %u\n",
+                i, tdesc.Offset, ptdesc->Offset);
+        ok(!strcmp(tdesc.Name, ptdesc->Name), "GetDesc(%u) Name failed, got %s, expected %s\n",
+                i, tdesc.Name, ptdesc->Name);
+    }
+
+    /* types */
+    v11 = ref11->lpVtbl->GetVariableByName(ref11, "t");
+    ok(v11_dummy != v11, "GetVariableByName failed\n");
+
+    t11 = v11->lpVtbl->GetType(v11);
+    ok(t11 != t11_dummy, "GetType failed\n");
+
+    t = t11->lpVtbl->GetMemberTypeByIndex(t11, 0);
+    ok(t != t11_dummy, "GetMemberTypeByIndex failed\n");
+
+    t2 = t11->lpVtbl->GetMemberTypeByName(t11, "a");
+    ok(t == t2, "GetMemberTypeByName failed, got %p, expected %p\n", t2, t);
+
+    string = t11->lpVtbl->GetMemberTypeName(t11, 0);
+    ok(!strcmp(string, "a"), "GetMemberTypeName failed, got \"%s\", expected \"%s\"\n", string, "a");
+
+    t = t11->lpVtbl->GetMemberTypeByIndex(t11, 1);
+    ok(t != t11_dummy, "GetMemberTypeByIndex failed\n");
+
+    t2 = t11->lpVtbl->GetMemberTypeByName(t11, "b");
+    ok(t == t2, "GetMemberTypeByName failed, got %p, expected %p\n", t2, t);
+
+    string = t11->lpVtbl->GetMemberTypeName(t11, 1);
+    ok(!strcmp(string, "b"), "GetMemberTypeName failed, got \"%s\", expected \"%s\"\n", string, "b");
+
+    /* float vs float (in struct) */
+    hr = t11->lpVtbl->IsEqual(t11, t11_valid);
+    ok(hr == S_FALSE, "IsEqual failed, got %x, expected %x\n", hr, S_FALSE);
+
+    hr = t11_valid->lpVtbl->IsEqual(t11_valid, t11);
+    ok(hr == S_FALSE, "IsEqual failed, got %x, expected %x\n", hr, S_FALSE);
+
+    /* float vs float */
+    t = t11->lpVtbl->GetMemberTypeByIndex(t11, 0);
+    ok(t != t11_dummy, "GetMemberTypeByIndex failed\n");
+
+    t2 = t11->lpVtbl->GetMemberTypeByIndex(t11, 1);
+    ok(t2 != t11_dummy, "GetMemberTypeByIndex failed\n");
+
+    hr = t->lpVtbl->IsEqual(t, t2);
+    ok(hr == S_OK, "IsEqual failed, got %x, expected %x\n", hr, S_OK);
+
+    count = ref11->lpVtbl->Release(ref11);
+    ok(count == 0, "Release failed %u\n", count);
+}
+
+static BOOL load_d3dcompiler(void)
+{
+    HMODULE module;
+
+    if (!(module = LoadLibraryA("d3dcompiler_43.dll"))) return FALSE;
+
+    pD3DReflect = (void*)GetProcAddress(module, "D3DReflect");
+    return TRUE;
+}
+
+START_TEST(reflection)
+{
+    if (!load_d3dcompiler())
+    {
+        win_skip("Could not load d3dcompiler_43.dll\n");
+        return;
+    }
+
+#ifndef __REACTOS__
+    test_reflection_references();
+#endif
+    test_reflection_desc_vs();
+    test_reflection_desc_ps();
+    test_reflection_desc_ps_output();
+    test_reflection_bound_resources();
+    test_reflection_constant_buffer();
+}
diff --git a/modules/rostests/winetests/d3dcompiler_43/testlist.c b/modules/rostests/winetests/d3dcompiler_43/testlist.c
new file mode 100644 (file)
index 0000000..9177e7f
--- /dev/null
@@ -0,0 +1,18 @@
+/* Automatically generated by make depend; DO NOT EDIT!! */
+
+#define STANDALONE
+#include <wine/test.h>
+
+extern void func_asm(void);
+extern void func_blob(void);
+extern void func_hlsl(void);
+extern void func_reflection(void);
+
+const struct test winetest_testlist[] =
+{
+    { "asm", func_asm },
+    { "blob", func_blob },
+    { "hlsl", func_hlsl },
+    { "reflection", func_reflection },
+    { 0, 0 }
+};