blob: e6b12073d86e2ec729962e0200aa3931813ac54b [file] [log] [blame]
Jakob Bornecrantz85e05722009-06-01 11:20:05 +01001/*
2 * Copyright 2009 VMware, Inc.
3 * All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * on the rights to use, copy, modify, merge, publish, distribute, sub
9 * license, and/or sell copies of the Software, and to permit persons to whom
10 * the Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
14 * Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
19 * VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
21 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
22 * USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25#include "pipe/p_compiler.h"
26#include "pipe/p_format.h"
27#include "util/u_memory.h"
28#include "util/u_debug.h"
29#include "util/u_network.h"
30
31#include "rbug/rbug.h"
32
33static void talk(rbug_context_t ctx, rbug_shader_t shdr)
34{
35 int c = u_socket_connect("localhost", 13370);
36 struct rbug_connection *con = rbug_from_socket(c);
37 struct rbug_header *header;
38
39 assert(c >= 0);
40 assert(con);
41 debug_printf("Connection get!\n");
42
43 rbug_send_shader_disable(con, ctx, shdr, true, NULL);
44
45 rbug_send_ping(con, NULL);
46
47 debug_printf("Sent waiting for reply\n");
48 header = rbug_get_message(con, NULL);
49
50 if (header->opcode != RBUG_OP_PING_REPLY)
51 debug_printf("Error\n");
52 else
53 debug_printf("Ok!\n");
54
55 rbug_free_header(header);
56 rbug_disconnect(con);
57}
58
59static void print_usage()
60{
61 printf("Usage shdr_disable <context> <shader>\n");
62 exit(-1);
63}
64
65int main(int argc, char** argv)
66{
67 long ctx;
68 long shdr;
69
70 if (argc < 3)
71 print_usage();
72
73 ctx = atol(argv[1]);
74 shdr = atol(argv[2]);
75
76 if (ctx <= 0 && ctx <= 0)
77 print_usage();
78
79 talk((uint64_t)ctx, (uint64_t)shdr);
80
81 return 0;
82}