diff options
| author | 2018-03-26 21:15:23 -0400 | |
|---|---|---|
| committer | 2018-03-26 21:15:23 -0400 | |
| commit | f934da0e4350b1ab98cfdd9a100e83b20d0d95d3 (patch) | |
| tree | 0b89c192c115f777f1d137062081e7c261db6639 /src/video_core/textures | |
| parent | Merge pull request #102 from N00byKing/master (diff) | |
| parent | GPU: Load the sampler info (TSC) when retrieving active textures. (diff) | |
| download | yuzu-f934da0e4350b1ab98cfdd9a100e83b20d0d95d3.tar.gz yuzu-f934da0e4350b1ab98cfdd9a100e83b20d0d95d3.tar.xz yuzu-f934da0e4350b1ab98cfdd9a100e83b20d0d95d3.zip | |
Merge pull request #283 from Subv/tsc
GPU: Added sampler information structures (TSC)
Diffstat (limited to 'src/video_core/textures')
| -rw-r--r-- | src/video_core/textures/texture.h | 84 |
1 files changed, 80 insertions, 4 deletions
diff --git a/src/video_core/textures/texture.h b/src/video_core/textures/texture.h index d969bcdd9..07936f8a3 100644 --- a/src/video_core/textures/texture.h +++ b/src/video_core/textures/texture.h | |||
| @@ -17,11 +17,32 @@ enum class TextureFormat : u32 { | |||
| 17 | DXT1 = 0x24, | 17 | DXT1 = 0x24, |
| 18 | }; | 18 | }; |
| 19 | 19 | ||
| 20 | enum class TextureType : u32 { | ||
| 21 | Texture1D = 0, | ||
| 22 | Texture2D = 1, | ||
| 23 | Texture3D = 2, | ||
| 24 | TextureCubemap = 3, | ||
| 25 | Texture1DArray = 4, | ||
| 26 | Texture2DArray = 5, | ||
| 27 | Texture1DBuffer = 6, | ||
| 28 | Texture2DNoMipmap = 7, | ||
| 29 | TextureCubeArray = 8, | ||
| 30 | }; | ||
| 31 | |||
| 32 | enum class TICHeaderVersion : u32 { | ||
| 33 | OneDBuffer = 0, | ||
| 34 | PitchColorKey = 1, | ||
| 35 | Pitch = 2, | ||
| 36 | BlockLinear = 3, | ||
| 37 | BlockLinearColorKey = 4, | ||
| 38 | }; | ||
| 39 | |||
| 20 | union TextureHandle { | 40 | union TextureHandle { |
| 21 | u32 raw; | 41 | u32 raw; |
| 22 | BitField<0, 20, u32> tic_id; | 42 | BitField<0, 20, u32> tic_id; |
| 23 | BitField<20, 12, u32> tsc_id; | 43 | BitField<20, 12, u32> tsc_id; |
| 24 | }; | 44 | }; |
| 45 | static_assert(sizeof(TextureHandle) == 4, "TextureHandle has wrong size"); | ||
| 25 | 46 | ||
| 26 | struct TICEntry { | 47 | struct TICEntry { |
| 27 | union { | 48 | union { |
| @@ -33,10 +54,15 @@ struct TICEntry { | |||
| 33 | BitField<16, 3, u32> a_type; | 54 | BitField<16, 3, u32> a_type; |
| 34 | }; | 55 | }; |
| 35 | u32 address_low; | 56 | u32 address_low; |
| 36 | u16 address_high; | 57 | union { |
| 37 | INSERT_PADDING_BYTES(6); | 58 | BitField<0, 16, u32> address_high; |
| 38 | u16 width_minus_1; | 59 | BitField<21, 3, TICHeaderVersion> header_version; |
| 39 | INSERT_PADDING_BYTES(2); | 60 | }; |
| 61 | INSERT_PADDING_BYTES(4); | ||
| 62 | union { | ||
| 63 | BitField<0, 16, u32> width_minus_1; | ||
| 64 | BitField<23, 4, TextureType> texture_type; | ||
| 65 | }; | ||
| 40 | u16 height_minus_1; | 66 | u16 height_minus_1; |
| 41 | INSERT_PADDING_BYTES(10); | 67 | INSERT_PADDING_BYTES(10); |
| 42 | 68 | ||
| @@ -54,6 +80,56 @@ struct TICEntry { | |||
| 54 | }; | 80 | }; |
| 55 | static_assert(sizeof(TICEntry) == 0x20, "TICEntry has wrong size"); | 81 | static_assert(sizeof(TICEntry) == 0x20, "TICEntry has wrong size"); |
| 56 | 82 | ||
| 83 | enum class WrapMode : u32 { | ||
| 84 | Wrap = 0, | ||
| 85 | Mirror = 1, | ||
| 86 | ClampToEdge = 2, | ||
| 87 | Border = 3, | ||
| 88 | ClampOGL = 4, | ||
| 89 | MirrorOnceClampToEdge = 5, | ||
| 90 | MirrorOnceBorder = 6, | ||
| 91 | MirrorOnceClampOGL = 7, | ||
| 92 | }; | ||
| 93 | |||
| 94 | enum class TextureFilter : u32 { | ||
| 95 | Nearest = 1, | ||
| 96 | Linear = 2, | ||
| 97 | }; | ||
| 98 | |||
| 99 | enum class TextureMipmapFilter : u32 { | ||
| 100 | None = 1, | ||
| 101 | Nearest = 2, | ||
| 102 | Linear = 3, | ||
| 103 | }; | ||
| 104 | |||
| 105 | struct TSCEntry { | ||
| 106 | union { | ||
| 107 | BitField<0, 3, WrapMode> wrap_u; | ||
| 108 | BitField<3, 3, WrapMode> wrap_v; | ||
| 109 | BitField<6, 3, WrapMode> wrap_p; | ||
| 110 | BitField<9, 1, u32> depth_compare_enabled; | ||
| 111 | BitField<10, 3, u32> depth_compare_func; | ||
| 112 | }; | ||
| 113 | union { | ||
| 114 | BitField<0, 2, TextureFilter> mag_filter; | ||
| 115 | BitField<4, 2, TextureFilter> min_filter; | ||
| 116 | BitField<6, 2, TextureMipmapFilter> mip_filter; | ||
| 117 | }; | ||
| 118 | INSERT_PADDING_BYTES(8); | ||
| 119 | u32 border_color_r; | ||
| 120 | u32 border_color_g; | ||
| 121 | u32 border_color_b; | ||
| 122 | u32 border_color_a; | ||
| 123 | }; | ||
| 124 | static_assert(sizeof(TSCEntry) == 0x20, "TSCEntry has wrong size"); | ||
| 125 | |||
| 126 | struct FullTextureInfo { | ||
| 127 | u32 index; | ||
| 128 | TICEntry tic; | ||
| 129 | TSCEntry tsc; | ||
| 130 | bool enabled; | ||
| 131 | }; | ||
| 132 | |||
| 57 | /// Returns the number of bytes per pixel of the input texture format. | 133 | /// Returns the number of bytes per pixel of the input texture format. |
| 58 | u32 BytesPerPixel(TextureFormat format); | 134 | u32 BytesPerPixel(TextureFormat format); |
| 59 | 135 | ||