diff options
| author | 2018-04-15 19:52:25 -0500 | |
|---|---|---|
| committer | 2018-04-18 11:38:39 -0500 | |
| commit | db5f2bfa7ef522a56101776248e7cd0daea6d266 (patch) | |
| tree | 4f14fdf1755aa5f76a0950179c5bb346dec11e7e /src | |
| parent | Merge pull request #346 from bunnei/misc-gpu-improvements (diff) | |
| download | yuzu-db5f2bfa7ef522a56101776248e7cd0daea6d266.tar.gz yuzu-db5f2bfa7ef522a56101776248e7cd0daea6d266.tar.xz yuzu-db5f2bfa7ef522a56101776248e7cd0daea6d266.zip | |
GPU/TIC: Added the pitch and block height fields to the TIC structure.
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/textures/texture.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/video_core/textures/texture.h b/src/video_core/textures/texture.h index 9d443ea90..58cbb2115 100644 --- a/src/video_core/textures/texture.h +++ b/src/video_core/textures/texture.h | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include "common/assert.h" | ||
| 7 | #include "common/bit_field.h" | 8 | #include "common/bit_field.h" |
| 8 | #include "common/common_funcs.h" | 9 | #include "common/common_funcs.h" |
| 9 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| @@ -57,6 +58,8 @@ union TextureHandle { | |||
| 57 | static_assert(sizeof(TextureHandle) == 4, "TextureHandle has wrong size"); | 58 | static_assert(sizeof(TextureHandle) == 4, "TextureHandle has wrong size"); |
| 58 | 59 | ||
| 59 | struct TICEntry { | 60 | struct TICEntry { |
| 61 | static constexpr u32 DefaultBlockHeight = 16; | ||
| 62 | |||
| 60 | union { | 63 | union { |
| 61 | u32 raw; | 64 | u32 raw; |
| 62 | BitField<0, 7, TextureFormat> format; | 65 | BitField<0, 7, TextureFormat> format; |
| @@ -70,7 +73,12 @@ struct TICEntry { | |||
| 70 | BitField<0, 16, u32> address_high; | 73 | BitField<0, 16, u32> address_high; |
| 71 | BitField<21, 3, TICHeaderVersion> header_version; | 74 | BitField<21, 3, TICHeaderVersion> header_version; |
| 72 | }; | 75 | }; |
| 73 | INSERT_PADDING_BYTES(4); | 76 | union { |
| 77 | BitField<3, 3, u32> block_height; | ||
| 78 | |||
| 79 | // High 16 bits of the pitch value | ||
| 80 | BitField<0, 16, u32> pitch_high; | ||
| 81 | }; | ||
| 74 | union { | 82 | union { |
| 75 | BitField<0, 16, u32> width_minus_1; | 83 | BitField<0, 16, u32> width_minus_1; |
| 76 | BitField<23, 4, TextureType> texture_type; | 84 | BitField<23, 4, TextureType> texture_type; |
| @@ -82,6 +90,13 @@ struct TICEntry { | |||
| 82 | return static_cast<GPUVAddr>((static_cast<GPUVAddr>(address_high) << 32) | address_low); | 90 | return static_cast<GPUVAddr>((static_cast<GPUVAddr>(address_high) << 32) | address_low); |
| 83 | } | 91 | } |
| 84 | 92 | ||
| 93 | u32 Pitch() const { | ||
| 94 | ASSERT(header_version == TICHeaderVersion::Pitch || | ||
| 95 | header_version == TICHeaderVersion::PitchColorKey); | ||
| 96 | // The pitch value is 21 bits, and is 32B aligned. | ||
| 97 | return pitch_high << 5; | ||
| 98 | } | ||
| 99 | |||
| 85 | u32 Width() const { | 100 | u32 Width() const { |
| 86 | return width_minus_1 + 1; | 101 | return width_minus_1 + 1; |
| 87 | } | 102 | } |