modifiers.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 "common/bit_field.h"
  6. #include "common/common_types.h"
  7. #include "shader_recompiler/shader_info.h"
  8. namespace Shader::IR {
  9. enum class FmzMode : u8 {
  10. DontCare, // Not specified for this instruction
  11. FTZ, // Flush denorms to zero, NAN is propagated (D3D11, NVN, GL, VK)
  12. FMZ, // Flush denorms to zero, x * 0 == 0 (D3D9)
  13. None, // Denorms are not flushed, NAN is propagated (nouveau)
  14. };
  15. enum class FpRounding : u8 {
  16. DontCare, // Not specified for this instruction
  17. RN, // Round to nearest even,
  18. RM, // Round towards negative infinity
  19. RP, // Round towards positive infinity
  20. RZ, // Round towards zero
  21. };
  22. enum class MemoryScope : u32 {
  23. DontCare,
  24. Warp,
  25. Workgroup,
  26. Device,
  27. System
  28. };
  29. struct FpControl {
  30. bool no_contraction{false};
  31. FpRounding rounding{FpRounding::DontCare};
  32. FmzMode fmz_mode{FmzMode::DontCare};
  33. };
  34. static_assert(sizeof(FpControl) <= sizeof(u32));
  35. union BarrierInstInfo {
  36. u32 raw;
  37. BitField<0, 3, MemoryScope> scope;
  38. };
  39. union TextureInstInfo {
  40. u32 raw;
  41. BitField<0, 8, TextureType> type;
  42. BitField<8, 1, u32> has_bias;
  43. BitField<9, 1, u32> has_lod_clamp;
  44. BitField<10, 1, u32> relaxed_precision;
  45. BitField<11, 2, u32> gather_component;
  46. BitField<13, 2, u32> num_derivates;
  47. };
  48. static_assert(sizeof(TextureInstInfo) <= sizeof(u32));
  49. } // namespace Shader::IR