Skip to content

Commit 6c8ec74

Browse files
committed
Revert "tile: Fix some tile thickness calculation errors. (shadps4-emu#2203)"
This reverts commit 2a4798c.
1 parent c39571d commit 6c8ec74

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/video_core/texture_cache/image_info.cpp

+7-6
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ void ImageInfo::UpdateSize() {
178178
case AmdGpu::TilingMode::Display_Linear: {
179179
std::tie(mip_info.pitch, mip_info.size) =
180180
ImageSizeLinearAligned(mip_w, mip_h, bpp, num_samples);
181+
mip_info.height = mip_h;
181182
break;
182183
}
183184
case AmdGpu::TilingMode::Texture_Volume:
@@ -187,7 +188,12 @@ void ImageInfo::UpdateSize() {
187188
case AmdGpu::TilingMode::Display_MicroTiled:
188189
case AmdGpu::TilingMode::Texture_MicroTiled: {
189190
std::tie(mip_info.pitch, mip_info.size) =
190-
ImageSizeMicroTiled(mip_w, mip_h, thickness, bpp, num_samples);
191+
ImageSizeMicroTiled(mip_w, mip_h, bpp, thickness, num_samples);
192+
mip_info.height = std::max(mip_h, 8u);
193+
if (props.is_block) {
194+
mip_info.pitch = std::max(mip_info.pitch * 4, 32u);
195+
mip_info.height = std::max(mip_info.height * 4, 32u);
196+
}
191197
break;
192198
}
193199
case AmdGpu::TilingMode::Display_MacroTiled:
@@ -202,11 +208,6 @@ void ImageInfo::UpdateSize() {
202208
UNREACHABLE();
203209
}
204210
}
205-
mip_info.height = mip_h;
206-
if (props.is_block) {
207-
mip_info.pitch = std::max(mip_info.pitch * 4, 32u);
208-
mip_info.height = std::max(mip_info.height * 4, 32u);
209-
}
210211
mip_info.size *= mip_d;
211212
mip_info.offset = guest_size;
212213
mips_layout.emplace_back(mip_info);

src/video_core/texture_cache/tile.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,8 @@ constexpr std::pair<u32, size_t> ImageSizeMicroTiled(u32 pitch, u32 height, u32
313313
const auto& [pitch_align, height_align] = micro_tile_extent;
314314
auto pitch_aligned = (pitch + pitch_align - 1) & ~(pitch_align - 1);
315315
const auto height_aligned = (height + height_align - 1) & ~(height_align - 1);
316-
size_t log_sz = (pitch_aligned * height_aligned * bpp * num_samples + 7) / 8;
317-
while ((log_sz * thickness) % 256) {
316+
size_t log_sz = (pitch_aligned * height_aligned * bpp * num_samples * thickness + 7) / 8;
317+
while (log_sz % 256) {
318318
pitch_aligned += pitch_align;
319319
log_sz = (pitch_aligned * height_aligned * bpp * num_samples + 7) / 8;
320320
}

0 commit comments

Comments
 (0)