diff options
| author | 2018-09-08 21:54:11 -0400 | |
|---|---|---|
| committer | 2018-09-17 17:42:43 -0400 | |
| commit | aac77bbd18f2b943b7259d8099241c4ec697b8f4 (patch) | |
| tree | bfe66b24714d358f9486c5f6115ff1d25bfe8dfc /src | |
| parent | Merge pull request #1311 from FernandoS27/fast-swizzle (diff) | |
| download | yuzu-aac77bbd18f2b943b7259d8099241c4ec697b8f4.tar.gz yuzu-aac77bbd18f2b943b7259d8099241c4ec697b8f4.tar.xz yuzu-aac77bbd18f2b943b7259d8099241c4ec697b8f4.zip | |
Implemented Control Codes
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/engines/shader_bytecode.h | 36 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 15 |
2 files changed, 51 insertions, 0 deletions
diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h index 6e555ea03..12229cf4c 100644 --- a/src/video_core/engines/shader_bytecode.h +++ b/src/video_core/engines/shader_bytecode.h | |||
| @@ -240,6 +240,41 @@ enum class FlowCondition : u64 { | |||
| 240 | Fcsm_Tr = 0x1C, // TODO(bunnei): What is this used for? | 240 | Fcsm_Tr = 0x1C, // TODO(bunnei): What is this used for? |
| 241 | }; | 241 | }; |
| 242 | 242 | ||
| 243 | enum class ControlCode : u64 { | ||
| 244 | F = 0, | ||
| 245 | LT = 1, | ||
| 246 | EQ = 2, | ||
| 247 | LE = 3, | ||
| 248 | GT = 4, | ||
| 249 | NE = 5, | ||
| 250 | GE = 6, | ||
| 251 | Num = 7, | ||
| 252 | Nan = 8, | ||
| 253 | LTU = 9, | ||
| 254 | EQU = 10, | ||
| 255 | LEU = 11, | ||
| 256 | GTU = 12, | ||
| 257 | NEU = 13, | ||
| 258 | GEU = 14, | ||
| 259 | // | ||
| 260 | OFF = 16, | ||
| 261 | LO = 17, | ||
| 262 | SFF = 18, | ||
| 263 | LS = 19, | ||
| 264 | HI = 20, | ||
| 265 | SFT = 21, | ||
| 266 | HS = 22, | ||
| 267 | OFT = 23, | ||
| 268 | CSM_TA = 24, | ||
| 269 | CSM_TR = 25, | ||
| 270 | CSM_MX = 26, | ||
| 271 | FCSM_TA = 27, | ||
| 272 | FCSM_TR = 28, | ||
| 273 | FCSM_MX = 29, | ||
| 274 | RLE = 30, | ||
| 275 | RGT = 31, | ||
| 276 | }; | ||
| 277 | |||
| 243 | enum class PredicateResultMode : u64 { | 278 | enum class PredicateResultMode : u64 { |
| 244 | None = 0x0, | 279 | None = 0x0, |
| 245 | NotZero = 0x3, | 280 | NotZero = 0x3, |
| @@ -735,6 +770,7 @@ union Instruction { | |||
| 735 | BitField<36, 5, u64> index; | 770 | BitField<36, 5, u64> index; |
| 736 | } cbuf36; | 771 | } cbuf36; |
| 737 | 772 | ||
| 773 | BitField<47, 1, u64> generates_cc; | ||
| 738 | BitField<61, 1, u64> is_b_imm; | 774 | BitField<61, 1, u64> is_b_imm; |
| 739 | BitField<60, 1, u64> is_b_gpr; | 775 | BitField<60, 1, u64> is_b_gpr; |
| 740 | BitField<59, 1, u64> is_c_gpr; | 776 | BitField<59, 1, u64> is_c_gpr; |
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 252ff18fc..34f9e57d4 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp | |||
| @@ -351,6 +351,15 @@ public: | |||
| 351 | shader.AddLine(dest + " = " + src + ';'); | 351 | shader.AddLine(dest + " = " + src + ';'); |
| 352 | } | 352 | } |
| 353 | 353 | ||
| 354 | std::string GetControlCode(const Tegra::Shader::ControlCode cc) { | ||
| 355 | u32 code = static_cast<u32>(cc); | ||
| 356 | return "controlCode_" + std::to_string(code); | ||
| 357 | } | ||
| 358 | |||
| 359 | void SetControlCode(const Tegra::Shader::ControlCode cc, const std::string& value) { | ||
| 360 | shader.AddLine(GetControlCode(cc) + " = " + value + ';'); | ||
| 361 | } | ||
| 362 | |||
| 354 | /** | 363 | /** |
| 355 | * Writes code that does a output attribute assignment to register operation. Output attributes | 364 | * Writes code that does a output attribute assignment to register operation. Output attributes |
| 356 | * are stored as floats, so this may require conversion. | 365 | * are stored as floats, so this may require conversion. |
| @@ -414,6 +423,12 @@ public: | |||
| 414 | } | 423 | } |
| 415 | declarations.AddNewLine(); | 424 | declarations.AddNewLine(); |
| 416 | 425 | ||
| 426 | for (u32 cc = 0; cc < 32; cc++) { | ||
| 427 | Tegra::Shader::ControlCode code = static_cast<Tegra::Shader::ControlCode>(cc); | ||
| 428 | declarations.AddLine("bool " + GetControlCode(code) + " = false;"); | ||
| 429 | } | ||
| 430 | declarations.AddNewLine(); | ||
| 431 | |||
| 417 | for (const auto element : declr_input_attribute) { | 432 | for (const auto element : declr_input_attribute) { |
| 418 | // TODO(bunnei): Use proper number of elements for these | 433 | // TODO(bunnei): Use proper number of elements for these |
| 419 | u32 idx = | 434 | u32 idx = |