profile.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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 <optional>
  7. #include <vector>
  8. #include "common/common_types.h"
  9. namespace Shader {
  10. enum class AttributeType : u8 {
  11. Float,
  12. SignedInt,
  13. UnsignedInt,
  14. Disabled,
  15. };
  16. enum class InputTopology {
  17. Points,
  18. Lines,
  19. LinesAdjacency,
  20. Triangles,
  21. TrianglesAdjacency,
  22. };
  23. enum class CompareFunction {
  24. Never,
  25. Less,
  26. Equal,
  27. LessThanEqual,
  28. Greater,
  29. NotEqual,
  30. GreaterThanEqual,
  31. Always,
  32. };
  33. enum class TessPrimitive {
  34. Isolines,
  35. Triangles,
  36. Quads,
  37. };
  38. enum class TessSpacing {
  39. Equal,
  40. FractionalOdd,
  41. FractionalEven,
  42. };
  43. struct TransformFeedbackVarying {
  44. u32 buffer{};
  45. u32 stride{};
  46. u32 offset{};
  47. u32 components{};
  48. };
  49. struct Profile {
  50. u32 supported_spirv{0x00010000};
  51. bool unified_descriptor_binding{};
  52. bool support_descriptor_aliasing{};
  53. bool support_int8{};
  54. bool support_int16{};
  55. bool support_vertex_instance_id{};
  56. bool support_float_controls{};
  57. bool support_separate_denorm_behavior{};
  58. bool support_separate_rounding_mode{};
  59. bool support_fp16_denorm_preserve{};
  60. bool support_fp32_denorm_preserve{};
  61. bool support_fp16_denorm_flush{};
  62. bool support_fp32_denorm_flush{};
  63. bool support_fp16_signed_zero_nan_preserve{};
  64. bool support_fp32_signed_zero_nan_preserve{};
  65. bool support_fp64_signed_zero_nan_preserve{};
  66. bool support_explicit_workgroup_layout{};
  67. bool support_vote{};
  68. bool support_viewport_index_layer_non_geometry{};
  69. bool support_viewport_mask{};
  70. bool support_typeless_image_loads{};
  71. bool support_demote_to_helper_invocation{};
  72. bool support_int64_atomics{};
  73. bool support_derivative_control{};
  74. bool support_gl_nv_gpu_shader_5{};
  75. bool support_gl_amd_gpu_shader_half_float{};
  76. bool support_gl_vertex_viewport_layer{};
  77. bool support_gl_texture_shadow_lod{};
  78. bool warp_size_potentially_larger_than_guest{};
  79. bool lower_left_origin_mode{};
  80. /// Fragment outputs have to be declared even if they are not written to avoid undefined values.
  81. /// See Ori and the Blind Forest's main menu for reference.
  82. bool need_declared_frag_colors{};
  83. /// OpFClamp is broken and OpFMax + OpFMin should be used instead
  84. bool has_broken_spirv_clamp{};
  85. /// Offset image operands with an unsigned type do not work
  86. bool has_broken_unsigned_image_offsets{};
  87. /// Signed instructions with unsigned data types are misinterpreted
  88. bool has_broken_signed_operations{};
  89. /// Dynamic vec4 indexing is broken on some OpenGL drivers
  90. bool has_gl_component_indexing_bug{};
  91. /// Ignores SPIR-V ordered vs unordered using GLSL semantics
  92. bool ignore_nan_fp_comparisons{};
  93. };
  94. struct RuntimeInfo {
  95. std::array<AttributeType, 32> generic_input_types{};
  96. bool convert_depth_mode{};
  97. bool force_early_z{};
  98. TessPrimitive tess_primitive{};
  99. TessSpacing tess_spacing{};
  100. bool tess_clockwise{};
  101. InputTopology input_topology{};
  102. std::optional<float> fixed_state_point_size;
  103. std::optional<CompareFunction> alpha_test_func;
  104. float alpha_test_reference{};
  105. // Static y negate value
  106. bool y_negate{};
  107. // Use storage buffers instead of global pointers on GLASM
  108. bool glasm_use_storage_buffers{};
  109. std::vector<TransformFeedbackVarying> xfb_varyings;
  110. };
  111. } // namespace Shader