summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/video_core/engines/fermi_2d.cpp4
-rw-r--r--src/video_core/morton.cpp25
-rw-r--r--src/video_core/morton.h6
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp12
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h13
-rw-r--r--src/video_core/textures/decoders.cpp22
-rw-r--r--src/video_core/textures/decoders.h7
-rw-r--r--src/video_core/textures/texture.h2
8 files changed, 55 insertions, 36 deletions
diff --git a/src/video_core/engines/fermi_2d.cpp b/src/video_core/engines/fermi_2d.cpp
index 8d0700d13..e7721a2be 100644
--- a/src/video_core/engines/fermi_2d.cpp
+++ b/src/video_core/engines/fermi_2d.cpp
@@ -73,13 +73,13 @@ void Fermi2D::HandleSurfaceCopy() {
73 Texture::CopySwizzledData(regs.src.width, regs.src.height, regs.src.depth, 73 Texture::CopySwizzledData(regs.src.width, regs.src.height, regs.src.depth,
74 src_bytes_per_pixel, dst_bytes_per_pixel, src_buffer, 74 src_bytes_per_pixel, dst_bytes_per_pixel, src_buffer,
75 dst_buffer, true, regs.src.BlockHeight(), 75 dst_buffer, true, regs.src.BlockHeight(),
76 regs.src.BlockDepth()); 76 regs.src.BlockDepth(), 0);
77 } else { 77 } else {
78 // If the input is linear and the output is tiled, swizzle the input and copy it over. 78 // If the input is linear and the output is tiled, swizzle the input and copy it over.
79 Texture::CopySwizzledData(regs.src.width, regs.src.height, regs.src.depth, 79 Texture::CopySwizzledData(regs.src.width, regs.src.height, regs.src.depth,
80 src_bytes_per_pixel, dst_bytes_per_pixel, dst_buffer, 80 src_bytes_per_pixel, dst_bytes_per_pixel, dst_buffer,
81 src_buffer, false, regs.dst.BlockHeight(), 81 src_buffer, false, regs.dst.BlockHeight(),
82 regs.dst.BlockDepth()); 82 regs.dst.BlockDepth(), 0);
83 } 83 }
84 } 84 }
85} 85}
diff --git a/src/video_core/morton.cpp b/src/video_core/morton.cpp
index 8c3b97463..a310491a8 100644
--- a/src/video_core/morton.cpp
+++ b/src/video_core/morton.cpp
@@ -16,12 +16,12 @@ namespace VideoCore {
16using Surface::GetBytesPerPixel; 16using Surface::GetBytesPerPixel;
17using Surface::PixelFormat; 17using Surface::PixelFormat;
18 18
19using MortonCopyFn = void (*)(u32, u32, u32, u32, u32, u8*, std::size_t, VAddr); 19using MortonCopyFn = void (*)(u32, u32, u32, u32, u32, u32, u8*, std::size_t, VAddr);
20using ConversionArray = std::array<MortonCopyFn, Surface::MaxPixelFormat>; 20using ConversionArray = std::array<MortonCopyFn, Surface::MaxPixelFormat>;
21 21
22template <bool morton_to_linear, PixelFormat format> 22template <bool morton_to_linear, PixelFormat format>
23static void MortonCopy(u32 stride, u32 block_height, u32 height, u32 block_depth, u32 depth, 23static void MortonCopy(u32 stride, u32 block_height, u32 height, u32 block_depth, u32 depth,
24 u8* buffer, std::size_t buffer_size, VAddr addr) { 24 u32 tile_width_spacing, u8* buffer, std::size_t buffer_size, VAddr addr) {
25 constexpr u32 bytes_per_pixel = GetBytesPerPixel(format); 25 constexpr u32 bytes_per_pixel = GetBytesPerPixel(format);
26 26
27 // With the BCn formats (DXT and DXN), each 4x4 tile is swizzled instead of just individual 27 // With the BCn formats (DXT and DXN), each 4x4 tile is swizzled instead of just individual
@@ -31,12 +31,13 @@ static void MortonCopy(u32 stride, u32 block_height, u32 height, u32 block_depth
31 31
32 if constexpr (morton_to_linear) { 32 if constexpr (morton_to_linear) {
33 Tegra::Texture::UnswizzleTexture(buffer, addr, tile_size_x, tile_size_y, bytes_per_pixel, 33 Tegra::Texture::UnswizzleTexture(buffer, addr, tile_size_x, tile_size_y, bytes_per_pixel,
34 stride, height, depth, block_height, block_depth); 34 stride, height, depth, block_height, block_depth,
35 tile_width_spacing);
35 } else { 36 } else {
36 Tegra::Texture::CopySwizzledData((stride + tile_size_x - 1) / tile_size_x, 37 Tegra::Texture::CopySwizzledData(
37 (height + tile_size_y - 1) / tile_size_y, depth, 38 (stride + tile_size_x - 1) / tile_size_x, (height + tile_size_y - 1) / tile_size_y,
38 bytes_per_pixel, bytes_per_pixel, Memory::GetPointer(addr), 39 depth, bytes_per_pixel, bytes_per_pixel, Memory::GetPointer(addr), buffer, false,
39 buffer, false, block_height, block_depth); 40 block_height, block_depth, tile_width_spacing);
40 } 41 }
41} 42}
42 43
@@ -326,11 +327,11 @@ static u32 GetMortonOffset128(u32 x, u32 y, u32 bytes_per_pixel) {
326} 327}
327 328
328void MortonSwizzle(MortonSwizzleMode mode, Surface::PixelFormat format, u32 stride, 329void MortonSwizzle(MortonSwizzleMode mode, Surface::PixelFormat format, u32 stride,
329 u32 block_height, u32 height, u32 block_depth, u32 depth, u8* buffer, 330 u32 block_height, u32 height, u32 block_depth, u32 depth, u32 tile_width_spacing,
330 std::size_t buffer_size, VAddr addr) { 331 u8* buffer, std::size_t buffer_size, VAddr addr) {
331 332
332 GetSwizzleFunction(mode, format)(stride, block_height, height, block_depth, depth, buffer, 333 GetSwizzleFunction(mode, format)(stride, block_height, height, block_depth, depth,
333 buffer_size, addr); 334 tile_width_spacing, buffer, buffer_size, addr);
334} 335}
335 336
336void MortonCopyPixels128(u32 width, u32 height, u32 bytes_per_pixel, u32 linear_bytes_per_pixel, 337void MortonCopyPixels128(u32 width, u32 height, u32 bytes_per_pixel, u32 linear_bytes_per_pixel,
@@ -351,4 +352,4 @@ void MortonCopyPixels128(u32 width, u32 height, u32 bytes_per_pixel, u32 linear_
351 } 352 }
352} 353}
353 354
354} // namespace VideoCore \ No newline at end of file 355} // namespace VideoCore
diff --git a/src/video_core/morton.h b/src/video_core/morton.h
index b9b9eca86..065f59ce3 100644
--- a/src/video_core/morton.h
+++ b/src/video_core/morton.h
@@ -12,10 +12,10 @@ namespace VideoCore {
12enum class MortonSwizzleMode { MortonToLinear, LinearToMorton }; 12enum class MortonSwizzleMode { MortonToLinear, LinearToMorton };
13 13
14void MortonSwizzle(MortonSwizzleMode mode, VideoCore::Surface::PixelFormat format, u32 stride, 14void MortonSwizzle(MortonSwizzleMode mode, VideoCore::Surface::PixelFormat format, u32 stride,
15 u32 block_height, u32 height, u32 block_depth, u32 depth, u8* buffer, 15 u32 block_height, u32 height, u32 block_depth, u32 depth, u32 tile_width_spacing,
16 std::size_t buffer_size, VAddr addr); 16 u8* buffer, std::size_t buffer_size, VAddr addr);
17 17
18void MortonCopyPixels128(u32 width, u32 height, u32 bytes_per_pixel, u32 linear_bytes_per_pixel, 18void MortonCopyPixels128(u32 width, u32 height, u32 bytes_per_pixel, u32 linear_bytes_per_pixel,
19 u8* morton_data, u8* linear_data, bool morton_to_linear); 19 u8* morton_data, u8* linear_data, bool morton_to_linear);
20 20
21} // namespace VideoCore \ No newline at end of file 21} // namespace VideoCore
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index d458f77e4..dde2f468d 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -97,6 +97,7 @@ std::size_t SurfaceParams::InnerMemorySize(bool force_gl, bool layer_only,
97 params.block_width = params.is_tiled ? config.tic.BlockWidth() : 0, 97 params.block_width = params.is_tiled ? config.tic.BlockWidth() : 0,
98 params.block_height = params.is_tiled ? config.tic.BlockHeight() : 0, 98 params.block_height = params.is_tiled ? config.tic.BlockHeight() : 0,
99 params.block_depth = params.is_tiled ? config.tic.BlockDepth() : 0, 99 params.block_depth = params.is_tiled ? config.tic.BlockDepth() : 0,
100 params.tile_width_spacing = params.is_tiled ? (1 << config.tic.tile_width_spacing.Value()) : 1;
100 params.srgb_conversion = config.tic.IsSrgbConversionEnabled(); 101 params.srgb_conversion = config.tic.IsSrgbConversionEnabled();
101 params.pixel_format = PixelFormatFromTextureFormat(config.tic.format, config.tic.r_type.Value(), 102 params.pixel_format = PixelFormatFromTextureFormat(config.tic.format, config.tic.r_type.Value(),
102 params.srgb_conversion); 103 params.srgb_conversion);
@@ -162,6 +163,7 @@ std::size_t SurfaceParams::InnerMemorySize(bool force_gl, bool layer_only,
162 params.block_width = 1 << config.memory_layout.block_width; 163 params.block_width = 1 << config.memory_layout.block_width;
163 params.block_height = 1 << config.memory_layout.block_height; 164 params.block_height = 1 << config.memory_layout.block_height;
164 params.block_depth = 1 << config.memory_layout.block_depth; 165 params.block_depth = 1 << config.memory_layout.block_depth;
166 params.tile_width_spacing = 1;
165 params.pixel_format = PixelFormatFromRenderTargetFormat(config.format); 167 params.pixel_format = PixelFormatFromRenderTargetFormat(config.format);
166 params.srgb_conversion = config.format == Tegra::RenderTargetFormat::BGRA8_SRGB || 168 params.srgb_conversion = config.format == Tegra::RenderTargetFormat::BGRA8_SRGB ||
167 config.format == Tegra::RenderTargetFormat::RGBA8_SRGB; 169 config.format == Tegra::RenderTargetFormat::RGBA8_SRGB;
@@ -197,6 +199,7 @@ std::size_t SurfaceParams::InnerMemorySize(bool force_gl, bool layer_only,
197 params.block_width = 1 << std::min(block_width, 5U); 199 params.block_width = 1 << std::min(block_width, 5U);
198 params.block_height = 1 << std::min(block_height, 5U); 200 params.block_height = 1 << std::min(block_height, 5U);
199 params.block_depth = 1 << std::min(block_depth, 5U); 201 params.block_depth = 1 << std::min(block_depth, 5U);
202 params.tile_width_spacing = 1;
200 params.pixel_format = PixelFormatFromDepthFormat(format); 203 params.pixel_format = PixelFormatFromDepthFormat(format);
201 params.component_type = ComponentTypeFromDepthFormat(format); 204 params.component_type = ComponentTypeFromDepthFormat(format);
202 params.type = GetFormatType(params.pixel_format); 205 params.type = GetFormatType(params.pixel_format);
@@ -223,6 +226,7 @@ std::size_t SurfaceParams::InnerMemorySize(bool force_gl, bool layer_only,
223 params.block_width = params.is_tiled ? std::min(config.BlockWidth(), 32U) : 0, 226 params.block_width = params.is_tiled ? std::min(config.BlockWidth(), 32U) : 0,
224 params.block_height = params.is_tiled ? std::min(config.BlockHeight(), 32U) : 0, 227 params.block_height = params.is_tiled ? std::min(config.BlockHeight(), 32U) : 0,
225 params.block_depth = params.is_tiled ? std::min(config.BlockDepth(), 32U) : 0, 228 params.block_depth = params.is_tiled ? std::min(config.BlockDepth(), 32U) : 0,
229 params.tile_width_spacing = 1;
226 params.pixel_format = PixelFormatFromRenderTargetFormat(config.format); 230 params.pixel_format = PixelFormatFromRenderTargetFormat(config.format);
227 params.srgb_conversion = config.format == Tegra::RenderTargetFormat::BGRA8_SRGB || 231 params.srgb_conversion = config.format == Tegra::RenderTargetFormat::BGRA8_SRGB ||
228 config.format == Tegra::RenderTargetFormat::RGBA8_SRGB; 232 config.format == Tegra::RenderTargetFormat::RGBA8_SRGB;
@@ -387,8 +391,8 @@ void SwizzleFunc(const MortonSwizzleMode& mode, const SurfaceParams& params,
387 for (u32 i = 0; i < params.depth; i++) { 391 for (u32 i = 0; i < params.depth; i++) {
388 MortonSwizzle(mode, params.pixel_format, params.MipWidth(mip_level), 392 MortonSwizzle(mode, params.pixel_format, params.MipWidth(mip_level),
389 params.MipBlockHeight(mip_level), params.MipHeight(mip_level), 393 params.MipBlockHeight(mip_level), params.MipHeight(mip_level),
390 params.MipBlockDepth(mip_level), 1, gl_buffer.data() + offset_gl, gl_size, 394 params.MipBlockDepth(mip_level), params.tile_width_spacing, 1,
391 params.addr + offset); 395 gl_buffer.data() + offset_gl, gl_size, params.addr + offset);
392 offset += layer_size; 396 offset += layer_size;
393 offset_gl += gl_size; 397 offset_gl += gl_size;
394 } 398 }
@@ -396,8 +400,8 @@ void SwizzleFunc(const MortonSwizzleMode& mode, const SurfaceParams& params,
396 const u64 offset = params.GetMipmapLevelOffset(mip_level); 400 const u64 offset = params.GetMipmapLevelOffset(mip_level);
397 MortonSwizzle(mode, params.pixel_format, params.MipWidth(mip_level), 401 MortonSwizzle(mode, params.pixel_format, params.MipWidth(mip_level),
398 params.MipBlockHeight(mip_level), params.MipHeight(mip_level), 402 params.MipBlockHeight(mip_level), params.MipHeight(mip_level),
399 params.MipBlockDepth(mip_level), depth, gl_buffer.data(), gl_buffer.size(), 403 params.MipBlockDepth(mip_level), depth, params.tile_width_spacing,
400 params.addr + offset); 404 gl_buffer.data(), gl_buffer.size(), params.addr + offset);
401 } 405 }
402} 406}
403 407
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
index 9ac79c5a4..c710aa245 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
@@ -196,9 +196,15 @@ struct SurfaceParams {
196 196
197 /// Checks if surfaces are compatible for caching 197 /// Checks if surfaces are compatible for caching
198 bool IsCompatibleSurface(const SurfaceParams& other) const { 198 bool IsCompatibleSurface(const SurfaceParams& other) const {
199 return std::tie(pixel_format, type, width, height, target, depth) == 199 if (std::tie(pixel_format, type, width, height, target, depth, is_tiled) ==
200 std::tie(other.pixel_format, other.type, other.width, other.height, other.target, 200 std::tie(other.pixel_format, other.type, other.width, other.height, other.target,
201 other.depth); 201 other.depth, other.is_tiled)) {
202 if (!is_tiled)
203 return true;
204 return std::tie(block_height, block_depth, tile_width_spacing) ==
205 std::tie(other.block_height, other.block_depth, other.tile_width_spacing);
206 }
207 return false;
202 } 208 }
203 209
204 /// Initializes parameters for caching, should be called after everything has been initialized 210 /// Initializes parameters for caching, should be called after everything has been initialized
@@ -208,6 +214,7 @@ struct SurfaceParams {
208 u32 block_width; 214 u32 block_width;
209 u32 block_height; 215 u32 block_height;
210 u32 block_depth; 216 u32 block_depth;
217 u32 tile_width_spacing;
211 PixelFormat pixel_format; 218 PixelFormat pixel_format;
212 ComponentType component_type; 219 ComponentType component_type;
213 SurfaceType type; 220 SurfaceType type;
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp
index 7eabd34f1..bbae9285f 100644
--- a/src/video_core/textures/decoders.cpp
+++ b/src/video_core/textures/decoders.cpp
@@ -127,7 +127,8 @@ void FastProcessBlock(u8* const swizzled_data, u8* const unswizzled_data, const
127template <bool fast> 127template <bool fast>
128void SwizzledData(u8* const swizzled_data, u8* const unswizzled_data, const bool unswizzle, 128void SwizzledData(u8* const swizzled_data, u8* const unswizzled_data, const bool unswizzle,
129 const u32 width, const u32 height, const u32 depth, const u32 bytes_per_pixel, 129 const u32 width, const u32 height, const u32 depth, const u32 bytes_per_pixel,
130 const u32 out_bytes_per_pixel, const u32 block_height, const u32 block_depth) { 130 const u32 out_bytes_per_pixel, const u32 block_height, const u32 block_depth,
131 const u32 width_spacing) {
131 auto div_ceil = [](const u32 x, const u32 y) { return ((x + y - 1) / y); }; 132 auto div_ceil = [](const u32 x, const u32 y) { return ((x + y - 1) / y); };
132 const u32 stride_x = width * out_bytes_per_pixel; 133 const u32 stride_x = width * out_bytes_per_pixel;
133 const u32 layer_z = height * stride_x; 134 const u32 layer_z = height * stride_x;
@@ -137,7 +138,8 @@ void SwizzledData(u8* const swizzled_data, u8* const unswizzled_data, const bool
137 const u32 block_x_elements = gob_elements_x; 138 const u32 block_x_elements = gob_elements_x;
138 const u32 block_y_elements = gob_elements_y * block_height; 139 const u32 block_y_elements = gob_elements_y * block_height;
139 const u32 block_z_elements = gob_elements_z * block_depth; 140 const u32 block_z_elements = gob_elements_z * block_depth;
140 const u32 blocks_on_x = div_ceil(width, block_x_elements); 141 const u32 aligned_width = Common::AlignUp(width, gob_elements_x * width_spacing);
142 const u32 blocks_on_x = div_ceil(aligned_width, block_x_elements);
141 const u32 blocks_on_y = div_ceil(height, block_y_elements); 143 const u32 blocks_on_y = div_ceil(height, block_y_elements);
142 const u32 blocks_on_z = div_ceil(depth, block_z_elements); 144 const u32 blocks_on_z = div_ceil(depth, block_z_elements);
143 const u32 xy_block_size = gob_size * block_height; 145 const u32 xy_block_size = gob_size * block_height;
@@ -169,13 +171,15 @@ void SwizzledData(u8* const swizzled_data, u8* const unswizzled_data, const bool
169 171
170void CopySwizzledData(u32 width, u32 height, u32 depth, u32 bytes_per_pixel, 172void CopySwizzledData(u32 width, u32 height, u32 depth, u32 bytes_per_pixel,
171 u32 out_bytes_per_pixel, u8* const swizzled_data, u8* const unswizzled_data, 173 u32 out_bytes_per_pixel, u8* const swizzled_data, u8* const unswizzled_data,
172 bool unswizzle, u32 block_height, u32 block_depth) { 174 bool unswizzle, u32 block_height, u32 block_depth, u32 width_spacing) {
173 if (bytes_per_pixel % 3 != 0 && (width * bytes_per_pixel) % fast_swizzle_align == 0) { 175 if (bytes_per_pixel % 3 != 0 && (width * bytes_per_pixel) % fast_swizzle_align == 0) {
174 SwizzledData<true>(swizzled_data, unswizzled_data, unswizzle, width, height, depth, 176 SwizzledData<true>(swizzled_data, unswizzled_data, unswizzle, width, height, depth,
175 bytes_per_pixel, out_bytes_per_pixel, block_height, block_depth); 177 bytes_per_pixel, out_bytes_per_pixel, block_height, block_depth,
178 width_spacing);
176 } else { 179 } else {
177 SwizzledData<false>(swizzled_data, unswizzled_data, unswizzle, width, height, depth, 180 SwizzledData<false>(swizzled_data, unswizzled_data, unswizzle, width, height, depth,
178 bytes_per_pixel, out_bytes_per_pixel, block_height, block_depth); 181 bytes_per_pixel, out_bytes_per_pixel, block_height, block_depth,
182 width_spacing);
179 } 183 }
180} 184}
181 185
@@ -228,19 +232,19 @@ u32 BytesPerPixel(TextureFormat format) {
228 232
229void UnswizzleTexture(u8* const unswizzled_data, VAddr address, u32 tile_size_x, u32 tile_size_y, 233void UnswizzleTexture(u8* const unswizzled_data, VAddr address, u32 tile_size_x, u32 tile_size_y,
230 u32 bytes_per_pixel, u32 width, u32 height, u32 depth, u32 block_height, 234 u32 bytes_per_pixel, u32 width, u32 height, u32 depth, u32 block_height,
231 u32 block_depth) { 235 u32 block_depth, u32 width_spacing) {
232 CopySwizzledData((width + tile_size_x - 1) / tile_size_x, 236 CopySwizzledData((width + tile_size_x - 1) / tile_size_x,
233 (height + tile_size_y - 1) / tile_size_y, depth, bytes_per_pixel, 237 (height + tile_size_y - 1) / tile_size_y, depth, bytes_per_pixel,
234 bytes_per_pixel, Memory::GetPointer(address), unswizzled_data, true, 238 bytes_per_pixel, Memory::GetPointer(address), unswizzled_data, true,
235 block_height, block_depth); 239 block_height, block_depth, width_spacing);
236} 240}
237 241
238std::vector<u8> UnswizzleTexture(VAddr address, u32 tile_size_x, u32 tile_size_y, 242std::vector<u8> UnswizzleTexture(VAddr address, u32 tile_size_x, u32 tile_size_y,
239 u32 bytes_per_pixel, u32 width, u32 height, u32 depth, 243 u32 bytes_per_pixel, u32 width, u32 height, u32 depth,
240 u32 block_height, u32 block_depth) { 244 u32 block_height, u32 block_depth, u32 width_spacing) {
241 std::vector<u8> unswizzled_data(width * height * depth * bytes_per_pixel); 245 std::vector<u8> unswizzled_data(width * height * depth * bytes_per_pixel);
242 UnswizzleTexture(unswizzled_data.data(), address, tile_size_x, tile_size_y, bytes_per_pixel, 246 UnswizzleTexture(unswizzled_data.data(), address, tile_size_x, tile_size_y, bytes_per_pixel,
243 width, height, depth, block_height, block_depth); 247 width, height, depth, block_height, block_depth, width_spacing);
244 return unswizzled_data; 248 return unswizzled_data;
245} 249}
246 250
diff --git a/src/video_core/textures/decoders.h b/src/video_core/textures/decoders.h
index f4ef7c73e..85b7e9f7b 100644
--- a/src/video_core/textures/decoders.h
+++ b/src/video_core/textures/decoders.h
@@ -22,19 +22,20 @@ inline std::size_t GetGOBSize() {
22void UnswizzleTexture(u8* unswizzled_data, VAddr address, u32 tile_size_x, u32 tile_size_y, 22void UnswizzleTexture(u8* unswizzled_data, VAddr address, u32 tile_size_x, u32 tile_size_y,
23 u32 bytes_per_pixel, u32 width, u32 height, u32 depth, 23 u32 bytes_per_pixel, u32 width, u32 height, u32 depth,
24 u32 block_height = TICEntry::DefaultBlockHeight, 24 u32 block_height = TICEntry::DefaultBlockHeight,
25 u32 block_depth = TICEntry::DefaultBlockHeight); 25 u32 block_depth = TICEntry::DefaultBlockHeight, u32 width_spacing = 0);
26/** 26/**
27 * Unswizzles a swizzled texture without changing its format. 27 * Unswizzles a swizzled texture without changing its format.
28 */ 28 */
29std::vector<u8> UnswizzleTexture(VAddr address, u32 tile_size_x, u32 tile_size_y, 29std::vector<u8> UnswizzleTexture(VAddr address, u32 tile_size_x, u32 tile_size_y,
30 u32 bytes_per_pixel, u32 width, u32 height, u32 depth, 30 u32 bytes_per_pixel, u32 width, u32 height, u32 depth,
31 u32 block_height = TICEntry::DefaultBlockHeight, 31 u32 block_height = TICEntry::DefaultBlockHeight,
32 u32 block_depth = TICEntry::DefaultBlockHeight); 32 u32 block_depth = TICEntry::DefaultBlockHeight,
33 u32 width_spacing = 0);
33 34
34/// Copies texture data from a buffer and performs swizzling/unswizzling as necessary. 35/// Copies texture data from a buffer and performs swizzling/unswizzling as necessary.
35void CopySwizzledData(u32 width, u32 height, u32 depth, u32 bytes_per_pixel, 36void CopySwizzledData(u32 width, u32 height, u32 depth, u32 bytes_per_pixel,
36 u32 out_bytes_per_pixel, u8* swizzled_data, u8* unswizzled_data, 37 u32 out_bytes_per_pixel, u8* swizzled_data, u8* unswizzled_data,
37 bool unswizzle, u32 block_height, u32 block_depth); 38 bool unswizzle, u32 block_height, u32 block_depth, u32 width_spacing);
38 39
39/** 40/**
40 * Decodes an unswizzled texture into a A8R8G8B8 texture. 41 * Decodes an unswizzled texture into a A8R8G8B8 texture.
diff --git a/src/video_core/textures/texture.h b/src/video_core/textures/texture.h
index ffa08f5c1..e7c78bee2 100644
--- a/src/video_core/textures/texture.h
+++ b/src/video_core/textures/texture.h
@@ -166,6 +166,8 @@ struct TICEntry {
166 BitField<3, 3, u32> block_height; 166 BitField<3, 3, u32> block_height;
167 BitField<6, 3, u32> block_depth; 167 BitField<6, 3, u32> block_depth;
168 168
169 BitField<10, 3, u32> tile_width_spacing;
170
169 // High 16 bits of the pitch value 171 // High 16 bits of the pitch value
170 BitField<0, 16, u32> pitch_high; 172 BitField<0, 16, u32> pitch_high;
171 BitField<26, 1, u32> use_header_opt_control; 173 BitField<26, 1, u32> use_header_opt_control;