shader_info.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. // Copyright 2021 yuzu Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <array>
  6. #include "common/common_types.h"
  7. #include "shader_recompiler/frontend/ir/type.h"
  8. #include <boost/container/small_vector.hpp>
  9. #include <boost/container/static_vector.hpp>
  10. namespace Shader {
  11. enum class TextureType : u32 {
  12. Color1D,
  13. ColorArray1D,
  14. Color2D,
  15. ColorArray2D,
  16. Color3D,
  17. ColorCube,
  18. ColorArrayCube,
  19. Shadow1D,
  20. ShadowArray1D,
  21. Shadow2D,
  22. ShadowArray2D,
  23. Shadow3D,
  24. ShadowCube,
  25. ShadowArrayCube,
  26. };
  27. struct TextureDescriptor {
  28. TextureType type;
  29. u32 cbuf_index;
  30. u32 cbuf_offset;
  31. u32 count;
  32. };
  33. using TextureDescriptors = boost::container::small_vector<TextureDescriptor, 12>;
  34. struct ConstantBufferDescriptor {
  35. u32 index;
  36. u32 count;
  37. };
  38. struct StorageBufferDescriptor {
  39. u32 cbuf_index;
  40. u32 cbuf_offset;
  41. u32 count;
  42. };
  43. struct Info {
  44. static constexpr size_t MAX_CBUFS{18};
  45. static constexpr size_t MAX_SSBOS{16};
  46. bool uses_workgroup_id{};
  47. bool uses_local_invocation_id{};
  48. bool uses_fp16{};
  49. bool uses_fp64{};
  50. bool uses_fp16_denorms_flush{};
  51. bool uses_fp16_denorms_preserve{};
  52. bool uses_fp32_denorms_flush{};
  53. bool uses_fp32_denorms_preserve{};
  54. bool uses_int8{};
  55. bool uses_int16{};
  56. bool uses_int64{};
  57. bool uses_image_1d{};
  58. bool uses_sampled_1d{};
  59. bool uses_sparse_residency{};
  60. IR::Type used_constant_buffer_types{};
  61. u32 constant_buffer_mask{};
  62. boost::container::static_vector<ConstantBufferDescriptor, MAX_CBUFS>
  63. constant_buffer_descriptors;
  64. boost::container::static_vector<StorageBufferDescriptor, MAX_SSBOS> storage_buffers_descriptors;
  65. TextureDescriptors texture_descriptors;
  66. };
  67. } // namespace Shader