modifiers.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #pragma once
  4. #include "common/bit_field.h"
  5. #include "common/common_types.h"
  6. #include "shader_recompiler/shader_info.h"
  7. namespace Shader::IR {
  8. enum class FmzMode : u8 {
  9. DontCare, // Not specified for this instruction
  10. FTZ, // Flush denorms to zero, NAN is propagated (D3D11, NVN, GL, VK)
  11. FMZ, // Flush denorms to zero, x * 0 == 0 (D3D9)
  12. None, // Denorms are not flushed, NAN is propagated (nouveau)
  13. };
  14. enum class FpRounding : u8 {
  15. DontCare, // Not specified for this instruction
  16. RN, // Round to nearest even,
  17. RM, // Round towards negative infinity
  18. RP, // Round towards positive infinity
  19. RZ, // Round towards zero
  20. };
  21. struct FpControl {
  22. bool no_contraction{false};
  23. FpRounding rounding{FpRounding::DontCare};
  24. FmzMode fmz_mode{FmzMode::DontCare};
  25. };
  26. static_assert(sizeof(FpControl) <= sizeof(u32));
  27. union TextureInstInfo {
  28. u32 raw;
  29. BitField<0, 16, u32> descriptor_index;
  30. BitField<16, 3, TextureType> type;
  31. BitField<19, 1, u32> is_depth;
  32. BitField<20, 1, u32> has_bias;
  33. BitField<21, 1, u32> has_lod_clamp;
  34. BitField<22, 1, u32> relaxed_precision;
  35. BitField<23, 2, u32> gather_component;
  36. BitField<25, 2, u32> num_derivates;
  37. BitField<27, 3, ImageFormat> image_format;
  38. BitField<30, 1, u32> ndv_is_active;
  39. };
  40. static_assert(sizeof(TextureInstInfo) <= sizeof(u32));
  41. } // namespace Shader::IR