profile.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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_texture_shadow_lod{};
  77. bool support_gl_warp_intrinsics{};
  78. bool support_gl_variable_aoffi{};
  79. bool support_gl_sparse_textures{};
  80. bool warp_size_potentially_larger_than_guest{};
  81. bool lower_left_origin_mode{};
  82. /// Fragment outputs have to be declared even if they are not written to avoid undefined values.
  83. /// See Ori and the Blind Forest's main menu for reference.
  84. bool need_declared_frag_colors{};
  85. /// OpFClamp is broken and OpFMax + OpFMin should be used instead
  86. bool has_broken_spirv_clamp{};
  87. /// Offset image operands with an unsigned type do not work
  88. bool has_broken_unsigned_image_offsets{};
  89. /// Signed instructions with unsigned data types are misinterpreted
  90. bool has_broken_signed_operations{};
  91. /// Dynamic vec4 indexing is broken on some OpenGL drivers
  92. bool has_gl_component_indexing_bug{};
  93. /// The precise type qualifier is broken in the fragment stage of some drivers
  94. bool has_gl_precise_bug{};
  95. /// Ignores SPIR-V ordered vs unordered using GLSL semantics
  96. bool ignore_nan_fp_comparisons{};
  97. };
  98. struct RuntimeInfo {
  99. std::array<AttributeType, 32> generic_input_types{};
  100. bool convert_depth_mode{};
  101. bool force_early_z{};
  102. TessPrimitive tess_primitive{};
  103. TessSpacing tess_spacing{};
  104. bool tess_clockwise{};
  105. InputTopology input_topology{};
  106. std::optional<float> fixed_state_point_size;
  107. std::optional<CompareFunction> alpha_test_func;
  108. float alpha_test_reference{};
  109. // Static y negate value
  110. bool y_negate{};
  111. // Use storage buffers instead of global pointers on GLASM
  112. bool glasm_use_storage_buffers{};
  113. std::vector<TransformFeedbackVarying> xfb_varyings;
  114. };
  115. } // namespace Shader