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.

ac_shader_args.h 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*
  2. * Copyright 2019 Valve Corporation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * on the rights to use, copy, modify, merge, publish, distribute, sub
  8. * license, and/or sell copies of the Software, and to permit persons to whom
  9. * the Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice (including the next
  12. * paragraph) shall be included in all copies or substantial portions of the
  13. * Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
  18. * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
  19. * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  20. * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  21. * USE OR OTHER DEALINGS IN THE SOFTWARE.
  22. */
  23. #ifndef AC_SHADER_ARGS_H
  24. #define AC_SHADER_ARGS_H
  25. #include <stdint.h>
  26. #include <stdbool.h>
  27. #define AC_MAX_INLINE_PUSH_CONSTS 8
  28. enum ac_arg_regfile {
  29. AC_ARG_SGPR,
  30. AC_ARG_VGPR,
  31. };
  32. enum ac_arg_type {
  33. AC_ARG_FLOAT,
  34. AC_ARG_INT,
  35. AC_ARG_CONST_PTR, /* Pointer to i8 array */
  36. AC_ARG_CONST_FLOAT_PTR, /* Pointer to f32 array */
  37. AC_ARG_CONST_PTR_PTR, /* Pointer to pointer to i8 array */
  38. AC_ARG_CONST_DESC_PTR, /* Pointer to v4i32 array */
  39. AC_ARG_CONST_IMAGE_PTR, /* Pointer to v8i32 array */
  40. };
  41. struct ac_arg {
  42. uint8_t arg_index;
  43. bool used;
  44. };
  45. #define AC_MAX_ARGS 64
  46. struct ac_shader_args {
  47. /* Info on how to declare arguments */
  48. struct {
  49. enum ac_arg_type type;
  50. enum ac_arg_regfile file;
  51. uint8_t offset;
  52. uint8_t size;
  53. } args[AC_MAX_ARGS];
  54. uint8_t arg_count;
  55. uint8_t sgpr_count;
  56. uint8_t num_sgprs_used;
  57. uint8_t num_vgprs_used;
  58. struct ac_arg base_vertex;
  59. struct ac_arg start_instance;
  60. struct ac_arg draw_id;
  61. struct ac_arg vertex_id;
  62. struct ac_arg instance_id;
  63. struct ac_arg tcs_patch_id;
  64. struct ac_arg tcs_rel_ids;
  65. struct ac_arg tes_patch_id;
  66. struct ac_arg gs_prim_id;
  67. struct ac_arg gs_invocation_id;
  68. /* PS */
  69. struct ac_arg frag_pos[4];
  70. struct ac_arg front_face;
  71. struct ac_arg ancillary;
  72. struct ac_arg sample_coverage;
  73. struct ac_arg prim_mask;
  74. struct ac_arg persp_sample;
  75. struct ac_arg persp_center;
  76. struct ac_arg persp_centroid;
  77. struct ac_arg linear_sample;
  78. struct ac_arg linear_center;
  79. struct ac_arg linear_centroid;
  80. /* CS */
  81. struct ac_arg local_invocation_ids;
  82. struct ac_arg num_work_groups;
  83. struct ac_arg workgroup_ids[3];
  84. struct ac_arg tg_size;
  85. /* Vulkan only */
  86. struct ac_arg push_constants;
  87. struct ac_arg inline_push_consts[AC_MAX_INLINE_PUSH_CONSTS];
  88. unsigned num_inline_push_consts;
  89. unsigned base_inline_push_consts;
  90. struct ac_arg view_index;
  91. };
  92. void ac_add_arg(struct ac_shader_args *info, enum ac_arg_regfile regfile,
  93. unsigned registers, enum ac_arg_type type,
  94. struct ac_arg *arg);
  95. #endif