modifiers.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 { DontCare, Warp, Workgroup, Device, System };
  23. struct FpControl {
  24. bool no_contraction{false};
  25. FpRounding rounding{FpRounding::DontCare};
  26. FmzMode fmz_mode{FmzMode::DontCare};
  27. };
  28. static_assert(sizeof(FpControl) <= sizeof(u32));
  29. union TextureInstInfo {
  30. u32 raw;
  31. BitField<0, 8, TextureType> type;
  32. BitField<8, 1, u32> has_bias;
  33. BitField<9, 1, u32> has_lod_clamp;
  34. BitField<10, 1, u32> relaxed_precision;
  35. BitField<11, 2, u32> gather_component;
  36. BitField<13, 2, u32> num_derivates;
  37. };
  38. static_assert(sizeof(TextureInstInfo) <= sizeof(u32));
  39. } // namespace Shader::IR