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.

shdr_info.c 3.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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 shader_info(struct rbug_connection *con, rbug_context_t ctx)
  31. {
  32. struct rbug_header *header;
  33. struct rbug_proto_shader_list_reply *list;
  34. struct rbug_proto_shader_info_reply *info;
  35. int i;
  36. rbug_send_shader_list(con, ctx, NULL);
  37. header = rbug_get_message(con, NULL);
  38. assert(header->opcode == RBUG_OP_SHADER_LIST_REPLY);
  39. list = (struct rbug_proto_shader_list_reply *)header;
  40. debug_printf(" context | shader | disabled |\n");
  41. for (i = 0; i < list->shaders_len; i++) {
  42. rbug_send_shader_info(con, ctx, list->shaders[i], NULL);
  43. header = rbug_get_message(con, NULL);
  44. assert(header->opcode == RBUG_OP_SHADER_INFO_REPLY);
  45. info = (struct rbug_proto_shader_info_reply *)header;
  46. debug_printf("% 15llu |% 15llu |% 15u |\n",
  47. (unsigned long long)ctx,
  48. (unsigned long long)list->shaders[i],
  49. (unsigned)info->disabled);
  50. rbug_free_header(header);
  51. }
  52. rbug_free_header(&list->header);
  53. }
  54. static void talk()
  55. {
  56. int c = u_socket_connect("localhost", 13370);
  57. struct rbug_connection *con = rbug_from_socket(c);
  58. struct rbug_header *header;
  59. struct rbug_proto_context_list_reply *list;
  60. int i;
  61. assert(c >= 0);
  62. assert(con);
  63. debug_printf("Connection get!\n");
  64. debug_printf("Sending get contexts\n");
  65. rbug_send_context_list(con, NULL);
  66. debug_printf("Waiting for contexts\n");
  67. header = rbug_get_message(con, NULL);
  68. assert(header->opcode == RBUG_OP_CONTEXT_LIST_REPLY);
  69. list = (struct rbug_proto_context_list_reply *)header;
  70. debug_printf("Got contexts:\n");
  71. for (i = 0; i < list->contexts_len; i++) {
  72. shader_info(con, list->contexts[i]);
  73. }
  74. rbug_free_header(&list->header);
  75. rbug_disconnect(con);
  76. }
  77. int main(int argc, char** argv)
  78. {
  79. talk();
  80. return 0;
  81. }