2021-02-03 19:43:04 +00:00
|
|
|
// Copyright 2021 yuzu Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2021-03-08 21:31:53 +00:00
|
|
|
#include "common/bit_field.h"
|
2021-02-20 06:30:13 +00:00
|
|
|
#include "common/common_types.h"
|
2021-03-08 21:31:53 +00:00
|
|
|
#include "shader_recompiler/shader_info.h"
|
2021-02-20 06:30:13 +00:00
|
|
|
|
2021-02-03 19:43:04 +00:00
|
|
|
namespace Shader::IR {
|
|
|
|
|
2021-02-15 01:46:40 +00:00
|
|
|
enum class FmzMode : u8 {
|
2021-02-20 06:30:13 +00:00
|
|
|
DontCare, // Not specified for this instruction
|
|
|
|
FTZ, // Flush denorms to zero, NAN is propagated (D3D11, NVN, GL, VK)
|
|
|
|
FMZ, // Flush denorms to zero, x * 0 == 0 (D3D9)
|
|
|
|
None, // Denorms are not flushed, NAN is propagated (nouveau)
|
2021-02-03 19:43:04 +00:00
|
|
|
};
|
|
|
|
|
2021-02-15 01:46:40 +00:00
|
|
|
enum class FpRounding : u8 {
|
2021-02-20 06:30:13 +00:00
|
|
|
DontCare, // Not specified for this instruction
|
|
|
|
RN, // Round to nearest even,
|
|
|
|
RM, // Round towards negative infinity
|
|
|
|
RP, // Round towards positive infinity
|
|
|
|
RZ, // Round towards zero
|
2021-02-03 19:43:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct FpControl {
|
|
|
|
bool no_contraction{false};
|
2021-02-20 06:30:13 +00:00
|
|
|
FpRounding rounding{FpRounding::DontCare};
|
|
|
|
FmzMode fmz_mode{FmzMode::DontCare};
|
2021-02-03 19:43:04 +00:00
|
|
|
};
|
2021-02-15 01:46:40 +00:00
|
|
|
static_assert(sizeof(FpControl) <= sizeof(u32));
|
2021-02-20 06:30:13 +00:00
|
|
|
|
2021-03-08 21:31:53 +00:00
|
|
|
union TextureInstInfo {
|
|
|
|
u32 raw;
|
|
|
|
BitField<0, 8, TextureType> type;
|
|
|
|
BitField<8, 1, u32> has_bias;
|
2021-03-15 07:54:43 +00:00
|
|
|
BitField<9, 1, u32> has_lod_clamp;
|
|
|
|
BitField<10, 1, u32> relaxed_precision;
|
2021-03-08 21:31:53 +00:00
|
|
|
};
|
|
|
|
static_assert(sizeof(TextureInstInfo) <= sizeof(u32));
|
|
|
|
|
2021-02-03 19:43:04 +00:00
|
|
|
} // namespace Shader::IR
|