yuzu-emu
/
yuzu
Archived
1
0
Fork 0

Implemented Control Codes

This commit is contained in:
FernandoS27 2018-09-08 21:54:11 -04:00
parent a94b623dfb
commit aac77bbd18
2 changed files with 51 additions and 0 deletions

View File

@ -240,6 +240,41 @@ enum class FlowCondition : u64 {
Fcsm_Tr = 0x1C, // TODO(bunnei): What is this used for? Fcsm_Tr = 0x1C, // TODO(bunnei): What is this used for?
}; };
enum class ControlCode : u64 {
F = 0,
LT = 1,
EQ = 2,
LE = 3,
GT = 4,
NE = 5,
GE = 6,
Num = 7,
Nan = 8,
LTU = 9,
EQU = 10,
LEU = 11,
GTU = 12,
NEU = 13,
GEU = 14,
//
OFF = 16,
LO = 17,
SFF = 18,
LS = 19,
HI = 20,
SFT = 21,
HS = 22,
OFT = 23,
CSM_TA = 24,
CSM_TR = 25,
CSM_MX = 26,
FCSM_TA = 27,
FCSM_TR = 28,
FCSM_MX = 29,
RLE = 30,
RGT = 31,
};
enum class PredicateResultMode : u64 { enum class PredicateResultMode : u64 {
None = 0x0, None = 0x0,
NotZero = 0x3, NotZero = 0x3,
@ -735,6 +770,7 @@ union Instruction {
BitField<36, 5, u64> index; BitField<36, 5, u64> index;
} cbuf36; } cbuf36;
BitField<47, 1, u64> generates_cc;
BitField<61, 1, u64> is_b_imm; BitField<61, 1, u64> is_b_imm;
BitField<60, 1, u64> is_b_gpr; BitField<60, 1, u64> is_b_gpr;
BitField<59, 1, u64> is_c_gpr; BitField<59, 1, u64> is_c_gpr;

View File

@ -351,6 +351,15 @@ public:
shader.AddLine(dest + " = " + src + ';'); shader.AddLine(dest + " = " + src + ';');
} }
std::string GetControlCode(const Tegra::Shader::ControlCode cc) {
u32 code = static_cast<u32>(cc);
return "controlCode_" + std::to_string(code);
}
void SetControlCode(const Tegra::Shader::ControlCode cc, const std::string& value) {
shader.AddLine(GetControlCode(cc) + " = " + value + ';');
}
/** /**
* Writes code that does a output attribute assignment to register operation. Output attributes * Writes code that does a output attribute assignment to register operation. Output attributes
* are stored as floats, so this may require conversion. * are stored as floats, so this may require conversion.
@ -414,6 +423,12 @@ public:
} }
declarations.AddNewLine(); declarations.AddNewLine();
for (u32 cc = 0; cc < 32; cc++) {
Tegra::Shader::ControlCode code = static_cast<Tegra::Shader::ControlCode>(cc);
declarations.AddLine("bool " + GetControlCode(code) + " = false;");
}
declarations.AddNewLine();
for (const auto element : declr_input_attribute) { for (const auto element : declr_input_attribute) {
// TODO(bunnei): Use proper number of elements for these // TODO(bunnei): Use proper number of elements for these
u32 idx = u32 idx =