#if 0
float f[8184];
float4 main(float4 pos : POSITION) : POSITION
{
    float4 tmp = 0.0f;
    tmp.x = f[8183] * pos.x;
    return tmp;
}
#endif
static const DWORD test_blob[] =
{
0xfffe0300, 0x0020fffe, 0x42415443, 0x0000001c, 0x0000004b, 0xfffe0300, 0x00000001, 0x0000001c,
0x00000100, 0x00000044, 0x00000030, 0x00000002, 0x00001ff8, 0x00000034, 0x00000000, 0xabab0066,
0x00030000, 0x00010001, 0x00001ff8, 0x00000000, 0x335f7376, 0x4d00305f, 0x6f726369, 0x74666f73,
0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932,
0x332e3235, 0x00313131, 0x05000051, 0xd00f0ff8, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x80000000, 0xe00f0000, 0x03000005, 0xe0010000,
0xd0000ff7, 0x90000000, 0x02000001, 0xe00e0000, 0xd0000ff8, 0x0000ffff,
};

#define D3DX_SIZE 150 /* max ~15500 */

static void test_get_shader_constant_variables3(void)
{
    ID3DXConstantTable *ctable[D3DX_SIZE];
    HRESULT hr;
    ULONG count;
    D3DXCONSTANT_DESC desc;
    UINT nr;
    UINT i;
    const char *name = "f";
    UINT handlecount = 0;
    char *name2;

    name2 = HeapAlloc(GetProcessHeap(), 0, 2);
    memcpy(name2, name, 2);

    for (i = 0; i < D3DX_SIZE; ++i)
    {
        hr = D3DXGetShaderConstantTable(test_blob, &ctable[i]);
        ok(hr == D3D_OK, "D3DXGetShaderConstantTable failed, got %08x, expected %08x\n", hr, D3D_OK);
        ok(ctable != NULL, "D3DXGetShaderConstantTable failed\n");

        hr = ID3DXConstantTable_GetConstantDesc(ctable[i], name2, &desc, &nr);
        ok(hr == D3D_OK, "GetConstantDesc failed, got %x, expected %08x\n", hr, D3D_OK);
        ok(8184 == desc.Elements, "GetConstantDesc failed, got %x, expected %x\n", desc.Elements, 8184);
        handlecount += 8184;
    }

    ok(handlecount < (UINT)name2, "handlecount 0x%08x (%u), %p (%u)\n", handlecount, handlecount, name2, (UINT)name2);
    HeapFree(GetProcessHeap(), 0, name2);

    for (i = 0; i < D3DX_SIZE; ++i)
    {
        count = ID3DXConstantTable_Release(ctable[i]);
        ok(count == 0, "Release failed, got %u, expected %u\n", count, 0);
    }
}