Clone of mesa.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ctx_rule.c 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  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. #include "pipe/p_compiler.h"
  25. #include "pipe/p_format.h"
  26. #include "util/u_memory.h"
  27. #include "util/u_debug.h"
  28. #include "util/u_network.h"
  29. #include "rbug/rbug.h"
  30. static void talk(rbug_context_t ctx, rbug_shader_t shdr)
  31. {
  32. int c = u_socket_connect("localhost", 13370);
  33. struct rbug_connection *con;
  34. struct rbug_header *header;
  35. if (c < 0)
  36. c = u_socket_connect("localhost", 13370);
  37. con = rbug_from_socket(c);
  38. assert(c >= 0);
  39. assert(con);
  40. debug_printf("Connection get!\n");
  41. rbug_send_context_draw_rule(con, ctx, 0, shdr, 0, 0, RBUG_BLOCK_AFTER, NULL);
  42. rbug_send_ping(con, NULL);
  43. debug_printf("Sent waiting for reply\n");
  44. header = rbug_get_message(con, NULL);
  45. if (header->opcode != RBUG_OP_PING_REPLY)
  46. debug_printf("Error\n");
  47. else
  48. debug_printf("Ok!\n");
  49. rbug_free_header(header);
  50. rbug_disconnect(con);
  51. }
  52. static void print_usage()
  53. {
  54. printf("Usage ctx_rule <context> <fragment>\n");
  55. exit(-1);
  56. }
  57. int main(int argc, char** argv)
  58. {
  59. long ctx;
  60. long shdr;
  61. if (argc < 3)
  62. print_usage();
  63. ctx = atol(argv[1]);
  64. shdr = atol(argv[2]);
  65. if (ctx <= 0 && ctx <= 0)
  66. print_usage();
  67. talk((uint64_t)ctx, (uint64_t)shdr);
  68. return 0;
  69. }