Hi Matteo,

please see the attached patch.

On 25.07.2013 16:13, Matteo Bruni wrote:
2013/7/24 Rico Schüller <kgbric...@web.de>:
---
  dlls/d3dx9_36/tests/shader.c | 308
+++++++++++++++++++++++++++++++++++++++++++
  1 file changed, 308 insertions(+)


This is okay, but as a followup can you add some tests with mixed-type
structs? Something like:

struct
{
     float f;
     int i;
     bool b;
};

If you have already written tests of this kind, I'd like to know what
does the compiler do in this case :)

Single variables could only have the tested types (I was not able to generate other conversions than bool->bool, int->int, int->float, bool->float, float->float). But I found a way to do it with structs and there I found some issues. Hence this has to be fixed in wine, too. Thanks for the nice question. :-)

Basically you got these for the struct:
1. D3DXRS_FLOAT4: if one variable is used as float or a float variable is used or an int variable is used as bool (the compiler may do some optimization), else #2 2. D3DXRS_BOOL: if a bool variable is used as bool (in an if clause), else #3
3. D3DXRS_INT4

It looks like you could only do it that way with unused variables. I'm not sure if this makes sense at all. Why would someone set an unused variable? Maybe I missed something? Do you know anything else?

Cheers
Rico
diff --git a/dlls/d3dx9_36/tests/shader.c b/dlls/d3dx9_36/tests/shader.c
index 42c1455..be4b9cd 100644
--- a/dlls/d3dx9_36/tests/shader.c
+++ b/dlls/d3dx9_36/tests/shader.c
@@ -5585,6 +5585,436 @@ static const struct registerset_test registerset_test_bigvec_float[] =
         0x42800123, 0x43200123, 0x43600123}},
 };
 
+/*
+ * fxc.exe /Tvs_3_0
+ */
+#if 0
+struct {int n;  float f; bool b;} sb = {50, 7.6, 1};
+struct {bool b1; float f1; int n1;} sn = {1, 8.3, 51};
+struct {float f2; int n2; bool b2;} snb = {6.1, 53, 0};
+struct {float f3; bool b3; int n3;} sbn = {5.2, 1, 52};
+struct {bool b4; int n4; float f4;} sbnf = {1, 54, 4.3};
+struct {bool b5; int n5; float f5;} sbnf2 = {0, 55, 4.4};
+struct {float f6; bool b6; int n6;} sbnf3 = {8.7, 1, 56};
+float4 main(float4 pos : POSITION) : POSITION
+{
+    float4 tmp = 0;
+    int i;
+    if (sb.b) for (i = 0; i < sn.n1; i++) tmp.x += pos.z;
+    else if (snb.b2) for (i = 0; i < snb.n2; i++) tmp.y += pos.y;
+    else if (sbn.b3) for (i = 0; i < sbn.n3; i++) tmp.y += pos.y;
+    else if (sbnf.b4) for (i = 0; i < sbnf.n4; i++) tmp.y += pos.y * sbnf.f4;
+    else if (sbnf2.f5) for (i = 0; i < sbnf2.n5; i++) tmp.y += pos.y;
+    else if (sbnf3.n6)
+    {
+        tmp.y += pos.y;
+        for (i = 0; i < sbnf3.n6; i++) tmp.x += pos.x;
+    }
+    return tmp;
+}
+#endif
+static const DWORD registerset_blob_mixed_struct[] =
+{
+0xfffe0300, 0x0103fffe, 0x42415443, 0x0000001c, 0x000003d7, 0xfffe0300, 0x0000000a, 0x0000001c,
+0x00000100, 0x000003d0, 0x000000e4, 0x00000000, 0x00000003, 0x0000013c, 0x0000014c, 0x00000158,
+0x00060000, 0x00000003, 0x00000180, 0x0000014c, 0x00000190, 0x00000002, 0x00000003, 0x000001b8,
+0x000001c8, 0x00000190, 0x00090000, 0x00000002, 0x000001b8, 0x0000014c, 0x000001f8, 0x00030002,
+0x00000003, 0x00000220, 0x00000230, 0x000001f8, 0x00060001, 0x00000002, 0x00000220, 0x00000260,
+0x00000290, 0x00060002, 0x00000003, 0x000002b8, 0x000002c8, 0x00000290, 0x00030001, 0x00000003,
+0x000002b8, 0x000002f8, 0x00000328, 0x00000001, 0x00000003, 0x0000034c, 0x0000035c, 0x0000038c,
+0x00030000, 0x00000003, 0x000003b4, 0x000003c4, 0x6e006273, 0xababab00, 0x00020000, 0x00010001,
+0x00000001, 0x00000000, 0xabab0066, 0x00030000, 0x00010001, 0x00000001, 0x00000000, 0xabab0062,
+0x00010000, 0x00010001, 0x00000001, 0x00000000, 0x000000e7, 0x000000ec, 0x000000fc, 0x00000100,
+0x00000110, 0x00000114, 0x00000005, 0x00030001, 0x00030001, 0x00000124, 0xffffffff, 0xffffffff,
+0xffffffff, 0x006e6273, 0x62003366, 0x336e0033, 0xababab00, 0x0000015c, 0x00000100, 0x0000015f,
+0x00000114, 0x00000162, 0x000000ec, 0x00000005, 0x00030001, 0x00030001, 0x00000168, 0x666e6273,
+0x00346200, 0x6600346e, 0xabab0034, 0x00000195, 0x00000114, 0x00000198, 0x000000ec, 0x0000019b,
+0x00000100, 0x00000005, 0x00030001, 0x00030001, 0x000001a0, 0x3f800000, 0x00000000, 0x00000000,
+0x00000000, 0x42580000, 0x00000000, 0x00000000, 0x00000000, 0x4089999a, 0x00000000, 0x00000000,
+0x00000000, 0x666e6273, 0x35620032, 0x00356e00, 0xab003566, 0x000001fe, 0x00000114, 0x00000201,
+0x000000ec, 0x00000204, 0x00000100, 0x00000005, 0x00030001, 0x00030001, 0x00000208, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x425c0000, 0x00000000, 0x00000000, 0x00000000, 0x408ccccd,
+0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000037,
+0x00000000, 0x00000001, 0x00000000, 0x00000004, 0x00000000, 0x00000001, 0x00000000, 0x666e6273,
+0x36660033, 0x00366200, 0xab00366e, 0x00000296, 0x00000100, 0x00000299, 0x00000114, 0x0000029c,
+0x000000ec, 0x00000005, 0x00030001, 0x00030001, 0x000002a0, 0x410b3333, 0x00000000, 0x00000000,
+0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x42600000, 0x00000000, 0x00000000,
+0x00000000, 0x00000008, 0x00000000, 0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000001,
+0x00000000, 0x00000038, 0x00000000, 0x00000001, 0x00000000, 0x62006e73, 0x31660031, 0x00316e00,
+0x0000032b, 0x00000114, 0x0000032e, 0x00000100, 0x00000331, 0x000000ec, 0x00000005, 0x00030001,
+0x00030001, 0x00000334, 0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000008, 0x00000000,
+0x00000001, 0x00000000, 0x00000033, 0x00000000, 0x00000001, 0x00000000, 0x00626e73, 0x6e003266,
+0x32620032, 0xababab00, 0x00000390, 0x00000100, 0x00000393, 0x000000ec, 0x00000396, 0x00000114,
+0x00000005, 0x00030001, 0x00030001, 0x0000039c, 0xffffffff, 0xffffffff, 0x00000000, 0x335f7376,
+0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320,
+0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x05000051, 0xa00f0009, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x80000000,
+0xe00f0000, 0x01000028, 0xe0e40802, 0x02000001, 0x80010000, 0xa0000009, 0x01000026, 0xf0e40002,
+0x03000002, 0x80010000, 0x80000000, 0x90aa0000, 0x00000027, 0x02000001, 0x80020000, 0xa0000009,
+0x0000002a, 0x01000028, 0xe0e40805, 0x02000001, 0x80020000, 0xa0000009, 0x01000026, 0xe0e40804,
+0x03000002, 0x80020000, 0x80550000, 0x90550000, 0x00000027, 0x02000001, 0x80010000, 0xa0000009,
+0x0000002a, 0x01000028, 0xe0e40807, 0x02000001, 0x80020000, 0xa0000009, 0x01000026, 0xe0e40808,
+0x03000002, 0x80020000, 0x80550000, 0x90550000, 0x00000027, 0x02000001, 0x80010000, 0xa0000009,
+0x0000002a, 0x01000028, 0xe0e40809, 0x02000001, 0x80020000, 0xa0000009, 0x01000026, 0xe0e4080a,
+0x04000004, 0x80020000, 0x90550000, 0xa0000002, 0x80550000, 0x00000027, 0x02000001, 0x80010000,
+0xa0000009, 0x0000002a, 0x02000023, 0x80040000, 0xa0000005, 0x02040029, 0x81aa0000, 0x80aa0000,
+0x02000001, 0x80020000, 0xa0000009, 0x01000026, 0xf0e40007, 0x03000002, 0x80020000, 0x80550000,
+0x90550000, 0x00000027, 0x02000001, 0x80010000, 0xa0000009, 0x0000002a, 0x02000023, 0x80040000,
+0xa0000008, 0x02040029, 0x81aa0000, 0x80aa0000, 0x02000001, 0x80010000, 0xa0000009, 0x01000026,
+0xf0e40005, 0x03000002, 0x80010000, 0x80000000, 0x90000000, 0x00000027, 0x02000001, 0x80020000,
+0x90550000, 0x0000002a, 0x02000001, 0x80030000, 0xa0000009, 0x0000002b, 0x0000002b, 0x0000002b,
+0x0000002b, 0x0000002b, 0x0000002b, 0x02000001, 0xe0030000, 0x80e40000, 0x02000001, 0xe00c0000,
+0xa0000009, 0x0000ffff,
+};
+
+static const struct registerset_constants registerset_constants_mixed_struct_bool[] =
+{
+    {"sb",       {"sb",    D3DXRS_BOOL,   0, 3, D3DXPC_STRUCT, D3DXPT_VOID,  1, 3, 1, 3, 12, NULL},  83},
+    {"sb.n",     {"n",     D3DXRS_BOOL,   0, 1, D3DXPC_SCALAR, D3DXPT_INT,   1, 1, 1, 0,  4, NULL},  83},
+    {"sb.f",     {"f",     D3DXRS_BOOL,   1, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0,  4, NULL},  84},
+    {"sb.b",     {"b",     D3DXRS_BOOL,   2, 1, D3DXPC_SCALAR, D3DXPT_BOOL,  1, 1, 1, 0,  4, NULL},  85},
+};
+
+static const struct registerset_test registerset_test_mixed_struct_bool[] =
+{
+    {SetInt},
+    {SetBool},
+    {SetFloat},
+    {SetIntArray, 1, 0, 2},
+    {SetIntArray, 1, 3, REGISTER_OUTPUT_SIZE, 3, {0x00000002, 0x00000001, 0x00000001}},
+    {SetBoolArray, 1, 0, 2},
+    {SetBoolArray, 1, 3, REGISTER_OUTPUT_SIZE, 3, {0x00000001, 0x00000001, 0x00000004}},
+    {SetFloatArray, 0, 0, 2},
+    {SetFloatArray, 0, 3, REGISTER_OUTPUT_SIZE, 3, {0x00000001, 0x00000000, 0x00000001}},
+    {SetValue, 1, 0, 11},
+    {SetValue, 1, 12, REGISTER_OUTPUT_SIZE * 4, 3, {0x00000002, 0x00000003, 0x00000004}},
+    {SetVector, 0, 0, 0, 3, {0x00000001, 0x00000000, 0x00000001}},
+    {SetVectorArray},
+    {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 3, {0x00000001, 0x00000000, 0x00000001}},
+    {SetMatrix, 0, 0, 0, 3, {0x00000001, 0x00000000, 0x00000001}},
+    {SetMatrixArray},
+    {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 3, {0x00000001, 0x00000000, 0x00000001}},
+    {SetMatrixTranspose, 0, 0, 0, 3, {0x00000001, 0x00000001, 0x00000001}},
+    {SetMatrixTransposeArray},
+    {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 3, {0x00000001, 0x00000001, 0x00000001}},
+    {SetMatrixPointerArray},
+    {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 3, {0x00000001, 0x00000000, 0x00000001}},
+    {SetMatrixTransposePointerArray},
+    {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 3, {0x00000001, 0x00000001, 0x00000001}},
+};
+
+static const struct registerset_constants registerset_constants_mixed_struct_int[] =
+{
+    {"sn",       {"sn",    D3DXRS_INT4,   0, 3, D3DXPC_STRUCT, D3DXPT_VOID,  1, 3, 1, 3, 12, NULL}, 215},
+    {"sn.b1",    {"b1",    D3DXRS_INT4,   0, 1, D3DXPC_SCALAR, D3DXPT_BOOL,  1, 1, 1, 0,  4, NULL}, 215},
+    {"sn.f1",    {"f1",    D3DXRS_INT4,   1, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0,  4, NULL}, 219},
+    {"sn.n1",    {"n1",    D3DXRS_INT4,   2, 1, D3DXPC_SCALAR, D3DXPT_INT,   1, 1, 1, 0,  4, NULL}, 223},
+};
+
+static const struct registerset_test registerset_test_mixed_struct_int[] =
+{
+    {SetInt},
+    {SetBool},
+    {SetFloat},
+    {SetIntArray, 1, 0, 2},
+    {SetIntArray, 1, 3, REGISTER_OUTPUT_SIZE, 12,
+        {0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000,
+        0x00000004, 0x00000000, 0x00000001, 0x00000000}},
+    {SetBoolArray, 1, 0, 2},
+    {SetBoolArray, 1, 3, REGISTER_OUTPUT_SIZE, 12,
+        {0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
+        0x00000001, 0x00000000, 0x00000001, 0x00000000}},
+    {SetFloatArray, 0, 0, 2},
+    {SetFloatArray, 0, 3, REGISTER_OUTPUT_SIZE, 12,
+        {0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x00000004, 0x00000000, 0x00000001, 0x00000000}},
+    {SetValue, 1, 0, 11},
+    {SetValue, 1, 12, REGISTER_OUTPUT_SIZE * 4, 12,
+        {0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x00000004, 0x00000000, 0x00000001, 0x00000000}},
+    {SetVector, 0, 0, 0, 12,
+        {0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x00000004, 0x00000000, 0x00000001, 0x00000000}},
+    {SetVectorArray},
+    {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 12,
+        {0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x00000004, 0x00000000, 0x00000001, 0x00000000}},
+    {SetMatrix, 0, 0, 0, 12,
+        {0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x00000004, 0x00000000, 0x00000001, 0x00000000}},
+    {SetMatrixArray},
+    {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
+        {0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x00000004, 0x00000000, 0x00000001, 0x00000000}},
+    {SetMatrixTranspose, 0, 0, 0, 12,
+        {0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x00000000, 0x00000000, 0x00000001, 0x00000000}},
+    {SetMatrixTransposeArray},
+    {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
+        {0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x00000000, 0x00000000, 0x00000001, 0x00000000}},
+    {SetMatrixPointerArray},
+    {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
+        {0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x00000000, 0x00000000, 0x00000001, 0x00000000}},
+    {SetMatrixTransposePointerArray},
+    {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
+        {0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x00000000, 0x00000000, 0x00000001, 0x00000000}},
+};
+
+static const struct registerset_constants registerset_constants_mixed_struct_int_bool[] =
+{
+    {"snb",      {"snb",   D3DXRS_BOOL,   3, 3, D3DXPC_STRUCT, D3DXPT_VOID,  1, 3, 1, 3, 12, NULL}, 241},
+    {"snb.f2",   {"f2",    D3DXRS_BOOL,   3, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0,  4, NULL}, 241},
+    {"snb.n2",   {"n2",    D3DXRS_BOOL,   4, 1, D3DXPC_SCALAR, D3DXPT_INT,   1, 1, 1, 0,  4, NULL}, 242},
+    {"snb.b2",   {"b2",    D3DXRS_BOOL,   5, 1, D3DXPC_SCALAR, D3DXPT_BOOL,  1, 1, 1, 0,  4, NULL}, 243},
+};
+
+static const struct registerset_test registerset_test_mixed_struct_int_bool[] =
+{
+    {SetInt},
+    {SetBool},
+    {SetFloat},
+    {SetIntArray, 1, 0, 2},
+    {SetIntArray, 1, 3, REGISTER_OUTPUT_SIZE, 3, {0x00000001, 0x00000003, 0x00000001}},
+    {SetBoolArray, 1, 0, 2},
+    {SetBoolArray, 1, 3, REGISTER_OUTPUT_SIZE, 3, {0x00000001, 0x00000001, 0x00000004}},
+    {SetFloatArray, 0, 0, 2},
+    {SetFloatArray, 0, 3, REGISTER_OUTPUT_SIZE, 3, {0x40000123, 0x00000000, 0x00000001}},
+    {SetValue, 1, 0, 11},
+    {SetValue, 1, 12, REGISTER_OUTPUT_SIZE * 4, 3, {0x00000002, 0x00000003, 0x00000004}},
+    {SetVector, 0, 0, 0, 3, {0x40000123, 0x00000000, 0x00000001}},
+    {SetVectorArray},
+    {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 3, {0x40000123, 0x00000000, 0x00000001}},
+    {SetMatrix, 0, 0, 0, 3, {0x40000123, 0x00000000, 0x00000001}},
+    {SetMatrixArray},
+    {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 3, {0x40000123, 0x00000000, 0x00000001}},
+    {SetMatrixTranspose, 0, 0, 0, 3, {0x00000001, 0x00000001, 0x00000001}},
+    {SetMatrixTransposeArray},
+    {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 3, {0x00000001, 0x00000001, 0x00000001}},
+    {SetMatrixPointerArray},
+    {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 3, {0x00000001, 0x00000000, 0x00000001}},
+    {SetMatrixTransposePointerArray},
+    {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 3, {0x00000001, 0x00000001, 0x00000001}},
+};
+
+static const struct registerset_constants registerset_constants_mixed_struct_bool_int[] =
+{
+    {"sbn",      {"sbn",   D3DXRS_BOOL,   6, 3, D3DXPC_STRUCT, D3DXPT_VOID,  1, 3, 1, 3, 12, NULL},  83},
+    {"sbn.f3",   {"f3",    D3DXRS_BOOL,   6, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0,  4, NULL},  83},
+    {"sbn.b3",   {"b3",    D3DXRS_BOOL,   7, 1, D3DXPC_SCALAR, D3DXPT_BOOL,  1, 1, 1, 0,  4, NULL},  84},
+    {"sbn.n3",   {"n3",    D3DXRS_BOOL,   8, 1, D3DXPC_SCALAR, D3DXPT_INT,   1, 1, 1, 0,  4, NULL},  85},
+};
+
+static const struct registerset_test registerset_test_mixed_struct_bool_int[] =
+{
+    {SetInt},
+    {SetBool},
+    {SetFloat},
+    {SetIntArray, 1, 0, 2},
+    {SetIntArray, 1, 3, REGISTER_OUTPUT_SIZE, 3, {0x00000001, 0x00000001, 0x00000004}},
+    {SetBoolArray, 1, 0, 2},
+    {SetBoolArray, 1, 3, REGISTER_OUTPUT_SIZE, 3, {0x00000001, 0x00000003, 0x00000001}},
+    {SetFloatArray, 0, 0, 2},
+    {SetFloatArray, 0, 3, REGISTER_OUTPUT_SIZE, 3, {0x40000123, 0x00000000, 0x00000001}},
+    {SetValue, 1, 0, 11},
+    {SetValue, 1, 12, REGISTER_OUTPUT_SIZE * 4, 3, {0x00000002, 0x00000003, 0x00000004}},
+    {SetVector, 0, 0, 0, 3, {0x40000123, 0x00000000, 0x00000001}},
+    {SetVectorArray},
+    {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 3, {0x40000123, 0x00000000, 0x00000001}},
+    {SetMatrix, 0, 0, 0, 3, {0x40000123, 0x00000000, 0x00000001}},
+    {SetMatrixArray},
+    {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 3, {0x40000123, 0x00000000, 0x00000001}},
+    {SetMatrixTranspose, 0, 0, 0, 3, {0x00000001, 0x00000001, 0x00000001}},
+    {SetMatrixTransposeArray},
+    {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 3, {0x00000001, 0x00000001, 0x00000001}},
+    {SetMatrixPointerArray},
+    {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 3, {0x00000001, 0x00000000, 0x00000001}},
+    {SetMatrixTransposePointerArray},
+    {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 3, {0x00000001, 0x00000001, 0x00000001}},
+};
+
+static const struct registerset_constants registerset_constants_mixed_struct_bool_int_float[] =
+{
+    {"sbnf",     {"sbnf",  D3DXRS_FLOAT4, 0, 3, D3DXPC_STRUCT, D3DXPT_VOID,  1, 3, 1, 3, 12, NULL}, 114},
+    {"sbnf.b4",  {"b4",    D3DXRS_FLOAT4, 0, 1, D3DXPC_SCALAR, D3DXPT_BOOL,  1, 1, 1, 0,  4, NULL}, 114},
+    {"sbnf.n4",  {"n4",    D3DXRS_FLOAT4, 1, 1, D3DXPC_SCALAR, D3DXPT_INT,   1, 1, 1, 0,  4, NULL}, 118},
+    {"sbnf.f4",  {"f4",    D3DXRS_FLOAT4, 2, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0,  4, NULL}, 122},
+};
+
+static const struct registerset_test registerset_test_mixed_struct_bool_int_float[] =
+{
+    {SetInt},
+    {SetBool},
+    {SetFloat},
+    {SetIntArray, 1, 0, 2},
+    {SetIntArray, 1, 3, REGISTER_OUTPUT_SIZE, 12,
+        {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x40400000, 0x00000000, 0x00000000, 0x00000000,
+        0x40800000, 0x00000000, 0x00000000, 0x00000000}},
+    {SetBoolArray, 1, 0, 2},
+    {SetBoolArray, 1, 3, REGISTER_OUTPUT_SIZE, 12,
+        {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000,
+        0x3f800000, 0x00000000, 0x00000000, 0x00000000}},
+    {SetFloatArray, 0, 0, 2},
+    {SetFloatArray, 0, 3, REGISTER_OUTPUT_SIZE, 12,
+        {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x40800123, 0x00000000, 0x00000000, 0x00000000}},
+    {SetValue, 1, 0, 11},
+    {SetValue, 1, 12, REGISTER_OUTPUT_SIZE * 4, 12,
+        {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x40400000, 0x00000000, 0x00000000, 0x00000000,
+        0x00000004, 0x00000000, 0x00000000, 0x00000000}},
+    {SetVector, 0, 0, 0, 12,
+        {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x40800123, 0x00000000, 0x00000000, 0x00000000}},
+    {SetVectorArray},
+    {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 12,
+        {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x40800123, 0x00000000, 0x00000000, 0x00000000}},
+    {SetMatrix, 0, 0, 0, 12,
+        {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x40800123, 0x00000000, 0x00000000, 0x00000000}},
+    {SetMatrixArray},
+    {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
+        {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x40800123, 0x00000000, 0x00000000, 0x00000000}},
+    {SetMatrixTranspose, 0, 0, 0, 12,
+        {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x00000000, 0x00000000, 0x00000000, 0x00000000}},
+    {SetMatrixTransposeArray},
+    {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
+        {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x00000000, 0x00000000, 0x00000000, 0x00000000}},
+    {SetMatrixPointerArray},
+    {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
+        {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x00000000, 0x00000000, 0x00000000, 0x00000000}},
+    {SetMatrixTransposePointerArray},
+    {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
+        {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x00000000, 0x00000000, 0x00000000, 0x00000000}},
+};
+
+static const struct registerset_constants registerset_constants_mixed_struct_bool_int_float_2[] =
+{
+    {"sbnf2",    {"sbnf2", D3DXRS_FLOAT4, 3, 3, D3DXPC_STRUCT, D3DXPT_VOID,  1, 3, 1, 3, 12, NULL}, 140},
+    {"sbnf2.b5", {"b5",    D3DXRS_FLOAT4, 3, 1, D3DXPC_SCALAR, D3DXPT_BOOL,  1, 1, 1, 0,  4, NULL}, 140},
+    {"sbnf2.n5", {"n5",    D3DXRS_FLOAT4, 4, 1, D3DXPC_SCALAR, D3DXPT_INT,   1, 1, 1, 0,  4, NULL}, 144},
+    {"sbnf2.f5", {"f5",    D3DXRS_FLOAT4, 5, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0,  4, NULL}, 148},
+};
+
+static const struct registerset_test registerset_test_mixed_struct_bool_int_float_2[] =
+{
+    {SetInt},
+    {SetBool},
+    {SetFloat},
+    {SetIntArray, 1, 0, 2},
+    {SetIntArray, 1, 3, REGISTER_OUTPUT_SIZE, 12,
+        {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x40400000, 0x00000000, 0x00000000, 0x00000000,
+        0x40800000, 0x00000000, 0x00000000, 0x00000000}},
+    {SetBoolArray, 1, 0, 2},
+    {SetBoolArray, 1, 3, REGISTER_OUTPUT_SIZE, 12,
+        {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000,
+        0x3f800000, 0x00000000, 0x00000000, 0x00000000}},
+    {SetFloatArray, 0, 0, 2},
+    {SetFloatArray, 0, 3, REGISTER_OUTPUT_SIZE, 12,
+        {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x40800123, 0x00000000, 0x00000000, 0x00000000}},
+    {SetValue, 1, 0, 11},
+    {SetValue, 1, 12, REGISTER_OUTPUT_SIZE * 4, 12,
+        {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x40400000, 0x00000000, 0x00000000, 0x00000000,
+        0x00000004, 0x00000000, 0x00000000, 0x00000000}},
+    {SetVector, 0, 0, 0, 12,
+        {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x40800123, 0x00000000, 0x00000000, 0x00000000}},
+    {SetVectorArray},
+    {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 12,
+        {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x40800123, 0x00000000, 0x00000000, 0x00000000}},
+    {SetMatrix, 0, 0, 0, 12,
+        {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x40800123, 0x00000000, 0x00000000, 0x00000000}},
+    {SetMatrixArray},
+    {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
+        {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x40800123, 0x00000000, 0x00000000, 0x00000000}},
+    {SetMatrixTranspose, 0, 0, 0, 12,
+        {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x00000000, 0x00000000, 0x00000000, 0x00000000}},
+    {SetMatrixTransposeArray},
+    {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
+        {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x00000000, 0x00000000, 0x00000000, 0x00000000}},
+    {SetMatrixPointerArray},
+    {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
+        {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x00000000, 0x00000000, 0x00000000, 0x00000000}},
+    {SetMatrixTransposePointerArray},
+    {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
+        {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x00000000, 0x00000000, 0x00000000, 0x00000000}},
+};
+
+static const struct registerset_constants registerset_constants_mixed_struct_bool_int_float_3[] =
+{
+    {"sbnf3",    {"sbnf3", D3DXRS_FLOAT4, 6, 3, D3DXPC_STRUCT, D3DXPT_VOID,  1, 3, 1, 3, 12, NULL}, 178},
+    {"sbnf3.f6", {"f6",    D3DXRS_FLOAT4, 6, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0,  4, NULL}, 178},
+    {"sbnf3.b6", {"b6",    D3DXRS_FLOAT4, 7, 1, D3DXPC_SCALAR, D3DXPT_BOOL,  1, 1, 1, 0,  4, NULL}, 182},
+    {"sbnf3.n6", {"n6",    D3DXRS_FLOAT4, 8, 1, D3DXPC_SCALAR, D3DXPT_INT,   1, 1, 1, 0,  4, NULL}, 186},
+};
+
+static const struct registerset_test registerset_test_mixed_struct_bool_int_float_3[] =
+{
+    {SetInt},
+    {SetBool},
+    {SetFloat},
+    {SetIntArray, 1, 0, 2},
+    {SetIntArray, 1, 3, REGISTER_OUTPUT_SIZE, 12,
+        {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000,
+        0x40800000, 0x00000000, 0x00000000, 0x00000000}},
+    {SetBoolArray, 1, 0, 2},
+    {SetBoolArray, 1, 3, REGISTER_OUTPUT_SIZE, 12,
+        {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000,
+        0x3f800000, 0x00000000, 0x00000000, 0x00000000}},
+    {SetFloatArray, 0, 0, 2},
+    {SetFloatArray, 0, 3, REGISTER_OUTPUT_SIZE, 12,
+        {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x40800000, 0x00000000, 0x00000000, 0x00000000}},
+    {SetValue, 1, 0, 11},
+    {SetValue, 1, 12, REGISTER_OUTPUT_SIZE * 4, 12,
+        {0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000,
+        0x40800000, 0x00000000, 0x00000000, 0x00000000}},
+    {SetVector, 0, 0, 0, 12,
+        {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x40800000, 0x00000000, 0x00000000, 0x00000000}},
+    {SetVectorArray},
+    {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 12,
+        {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x40800000, 0x00000000, 0x00000000, 0x00000000}},
+    {SetMatrix, 0, 0, 0, 12,
+        {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x40800000, 0x00000000, 0x00000000, 0x00000000}},
+    {SetMatrixArray},
+    {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
+        {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x40800000, 0x00000000, 0x00000000, 0x00000000}},
+    {SetMatrixTranspose, 0, 0, 0, 12,
+        {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x00000000, 0x00000000, 0x00000000, 0x00000000}},
+    {SetMatrixTransposeArray},
+    {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
+        {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x00000000, 0x00000000, 0x00000000, 0x00000000}},
+    {SetMatrixPointerArray},
+    {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
+        {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x00000000, 0x00000000, 0x00000000, 0x00000000}},
+    {SetMatrixTransposePointerArray},
+    {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
+        {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x00000000, 0x00000000, 0x00000000, 0x00000000}},
+};
+
 static const struct
 {
     const char *name;
@@ -5856,6 +6286,38 @@ registerset_data[] =
         sizeof(registerset_test_bigvec_float) / sizeof(*registerset_test_bigvec_float),
         registerset_constants_bigvec_float,
         sizeof(registerset_constants_bigvec_float) / sizeof(*registerset_constants_bigvec_float)},
+    /* mixed struct */
+    {"mixed struct bool", "sb", 0, D3DXRS_BOOL, registerset_blob_mixed_struct, registerset_test_mixed_struct_bool,
+        sizeof(registerset_test_mixed_struct_bool) / sizeof(*registerset_test_mixed_struct_bool),
+        registerset_constants_mixed_struct_bool,
+        sizeof(registerset_constants_mixed_struct_bool) / sizeof(*registerset_constants_mixed_struct_bool)},
+    {"mixed struct int", "sn", 0, D3DXRS_INT4, registerset_blob_mixed_struct, registerset_test_mixed_struct_int,
+        sizeof(registerset_test_mixed_struct_int) / sizeof(*registerset_test_mixed_struct_int),
+        registerset_constants_mixed_struct_int,
+        sizeof(registerset_constants_mixed_struct_int) / sizeof(*registerset_constants_mixed_struct_int)},
+    {"mixed struct int bool", "snb", 3, D3DXRS_BOOL, registerset_blob_mixed_struct, registerset_test_mixed_struct_int_bool,
+        sizeof(registerset_test_mixed_struct_bool) / sizeof(*registerset_test_mixed_struct_bool),
+        registerset_constants_mixed_struct_int_bool,
+        sizeof(registerset_constants_mixed_struct_int_bool) / sizeof(*registerset_constants_mixed_struct_int_bool)},
+    {"mixed struct bool int", "sbn", 6, D3DXRS_BOOL, registerset_blob_mixed_struct, registerset_test_mixed_struct_bool_int,
+        sizeof(registerset_test_mixed_struct_bool) / sizeof(*registerset_test_mixed_struct_bool),
+        registerset_constants_mixed_struct_bool_int,
+        sizeof(registerset_constants_mixed_struct_bool_int) / sizeof(*registerset_constants_mixed_struct_bool_int)},
+    {"mixed struct bool int float", "sbnf", 0, D3DXRS_FLOAT4, registerset_blob_mixed_struct,
+        registerset_test_mixed_struct_bool_int_float,
+        sizeof(registerset_test_mixed_struct_bool_int_float) / sizeof(*registerset_test_mixed_struct_bool_int_float),
+        registerset_constants_mixed_struct_bool_int_float,
+        sizeof(registerset_constants_mixed_struct_bool_int_float) / sizeof(*registerset_constants_mixed_struct_bool_int_float)},
+    {"mixed struct bool int float 2", "sbnf2", 12, D3DXRS_FLOAT4, registerset_blob_mixed_struct,
+        registerset_test_mixed_struct_bool_int_float_2,
+        sizeof(registerset_test_mixed_struct_bool_int_float_2) / sizeof(*registerset_test_mixed_struct_bool_int_float_2),
+        registerset_constants_mixed_struct_bool_int_float_2,
+        sizeof(registerset_constants_mixed_struct_bool_int_float_2) / sizeof(*registerset_constants_mixed_struct_bool_int_float_2)},
+    {"mixed struct bool int float 3", "sbnf3", 24, D3DXRS_FLOAT4, registerset_blob_mixed_struct,
+        registerset_test_mixed_struct_bool_int_float_3,
+        sizeof(registerset_test_mixed_struct_bool_int_float_3) / sizeof(*registerset_test_mixed_struct_bool_int_float_3),
+        registerset_constants_mixed_struct_bool_int_float_3,
+        sizeof(registerset_constants_mixed_struct_bool_int_float_3) / sizeof(*registerset_constants_mixed_struct_bool_int_float_3)},
 };
 
 static void registerset_clear(IDirect3DDevice9 *device)
@@ -6289,6 +6751,18 @@ registerset_defaults_data[] =
         {0x00000000}},
     /* DefaultValue = NULL */
     {"big vector", registerset_blob_bigvec},
+    {"mixed struct", registerset_blob_mixed_struct, 36, 32, 11,
+        {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x42580000, 0x00000000, 0x00000000, 0x00000000,
+        0x4089999a, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+        0x425c0000, 0x00000000, 0x00000000, 0x00000000, 0x408ccccd, 0x00000000, 0x00000000, 0x00000000,
+        0x410b3333, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000,
+        0x42600000, 0x00000000, 0x00000000, 0x00000000},
+        {0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000008, 0x00000000, 0x00000001, 0x00000000,
+        0x00000033, 0x00000000, 0x00000001, 0x00000000, 0x00000008, 0x00000000, 0x00000001, 0x00000000,
+        0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000038, 0x00000000, 0x00000001, 0x00000000,
+        0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000037, 0x00000000, 0x00000001, 0x00000000},
+        {0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0xffffffff, 0xffffffff,
+        0xffffffff, 0xffffffff, 0xffffffff}},
 };
 
 static void test_registerset_defaults(void)


Reply via email to