diff options
| author | 2018-08-19 12:46:35 -0500 | |
|---|---|---|
| committer | 2018-08-19 12:57:51 -0500 | |
| commit | 73b937b190d2c9747af2bafd65b0e47b78dbc2e4 (patch) | |
| tree | 319ce2107485860db6bdb9d8732dbfc840e98040 /src | |
| parent | Shaders: Added decodings for TLD4 and TLD4S (diff) | |
| download | yuzu-73b937b190d2c9747af2bafd65b0e47b78dbc2e4.tar.gz yuzu-73b937b190d2c9747af2bafd65b0e47b78dbc2e4.tar.xz yuzu-73b937b190d2c9747af2bafd65b0e47b78dbc2e4.zip | |
Shader: Added bitfields for the texture type of the various sampling instructions.
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/engines/shader_bytecode.h | 66 |
1 files changed, 65 insertions, 1 deletions
diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h index 7a21fba25..569225ad7 100644 --- a/src/video_core/engines/shader_bytecode.h +++ b/src/video_core/engines/shader_bytecode.h | |||
| @@ -222,6 +222,13 @@ enum class PredicateResultMode : u64 { | |||
| 222 | NotZero = 0x3, | 222 | NotZero = 0x3, |
| 223 | }; | 223 | }; |
| 224 | 224 | ||
| 225 | enum class TextureType : u64 { | ||
| 226 | Texture1D = 0, | ||
| 227 | Texture2D = 1, | ||
| 228 | Texture3D = 2, | ||
| 229 | TextureCube = 3, | ||
| 230 | }; | ||
| 231 | |||
| 225 | union Instruction { | 232 | union Instruction { |
| 226 | Instruction& operator=(const Instruction& instr) { | 233 | Instruction& operator=(const Instruction& instr) { |
| 227 | value = instr.value; | 234 | value = instr.value; |
| @@ -429,6 +436,8 @@ union Instruction { | |||
| 429 | } conversion; | 436 | } conversion; |
| 430 | 437 | ||
| 431 | union { | 438 | union { |
| 439 | BitField<28, 1, u64> array; | ||
| 440 | BitField<29, 2, TextureType> texture_type; | ||
| 432 | BitField<31, 4, u64> component_mask; | 441 | BitField<31, 4, u64> component_mask; |
| 433 | 442 | ||
| 434 | bool IsComponentEnabled(size_t component) const { | 443 | bool IsComponentEnabled(size_t component) const { |
| @@ -437,9 +446,39 @@ union Instruction { | |||
| 437 | } tex; | 446 | } tex; |
| 438 | 447 | ||
| 439 | union { | 448 | union { |
| 440 | BitField<50, 3, u64> component_mask_selector; | 449 | BitField<28, 1, u64> array; |
| 450 | BitField<29, 2, TextureType> texture_type; | ||
| 451 | BitField<56, 2, u64> component; | ||
| 452 | } tld4; | ||
| 453 | |||
| 454 | union { | ||
| 455 | BitField<52, 2, u64> component; | ||
| 456 | } tld4s; | ||
| 457 | |||
| 458 | union { | ||
| 441 | BitField<0, 8, Register> gpr0; | 459 | BitField<0, 8, Register> gpr0; |
| 442 | BitField<28, 8, Register> gpr28; | 460 | BitField<28, 8, Register> gpr28; |
| 461 | BitField<50, 3, u64> component_mask_selector; | ||
| 462 | BitField<53, 4, u64> texture_info; | ||
| 463 | |||
| 464 | TextureType GetTextureType() const { | ||
| 465 | // The TEXS instruction has a weird encoding for the texture type. | ||
| 466 | if (texture_info == 0) | ||
| 467 | return TextureType::Texture1D; | ||
| 468 | if (texture_info >= 1 && texture_info <= 9) | ||
| 469 | return TextureType::Texture2D; | ||
| 470 | if (texture_info >= 10 && texture_info <= 11) | ||
| 471 | return TextureType::Texture3D; | ||
| 472 | if (texture_info >= 12 && texture_info <= 13) | ||
| 473 | return TextureType::TextureCube; | ||
| 474 | |||
| 475 | UNIMPLEMENTED(); | ||
| 476 | } | ||
| 477 | |||
| 478 | bool IsArrayTexture() const { | ||
| 479 | // TEXS only supports Texture2D arrays. | ||
| 480 | return texture_info >= 7 && texture_info <= 9; | ||
| 481 | } | ||
| 443 | 482 | ||
| 444 | bool HasTwoDestinations() const { | 483 | bool HasTwoDestinations() const { |
| 445 | return gpr28.Value() != Register::ZeroIndex; | 484 | return gpr28.Value() != Register::ZeroIndex; |
| @@ -460,6 +499,31 @@ union Instruction { | |||
| 460 | } texs; | 499 | } texs; |
| 461 | 500 | ||
| 462 | union { | 501 | union { |
| 502 | BitField<53, 4, u64> texture_info; | ||
| 503 | |||
| 504 | TextureType GetTextureType() const { | ||
| 505 | // The TLDS instruction has a weird encoding for the texture type. | ||
| 506 | if (texture_info >= 0 && texture_info <= 1) { | ||
| 507 | return TextureType::Texture1D; | ||
| 508 | } | ||
| 509 | if (texture_info == 2 || texture_info == 8 || texture_info == 12 || | ||
| 510 | texture_info >= 4 && texture_info <= 6) { | ||
| 511 | return TextureType::Texture2D; | ||
| 512 | } | ||
| 513 | if (texture_info == 7) { | ||
| 514 | return TextureType::Texture3D; | ||
| 515 | } | ||
| 516 | |||
| 517 | UNIMPLEMENTED(); | ||
| 518 | } | ||
| 519 | |||
| 520 | bool IsArrayTexture() const { | ||
| 521 | // TEXS only supports Texture2D arrays. | ||
| 522 | return texture_info == 8; | ||
| 523 | } | ||
| 524 | } tlds; | ||
| 525 | |||
| 526 | union { | ||
| 463 | BitField<20, 24, u64> target; | 527 | BitField<20, 24, u64> target; |
| 464 | BitField<5, 1, u64> constant_buffer; | 528 | BitField<5, 1, u64> constant_buffer; |
| 465 | 529 | ||