yuzu-emu
/
yuzu
Archived
1
0
Fork 0

Texture Cahe: Fix downscaling on SMO.

This commit is contained in:
Fernando Sahmkow 2021-10-15 22:59:16 +02:00
parent 0f14c9379e
commit b7ccc58f23
5 changed files with 11 additions and 0 deletions

View File

@ -109,10 +109,12 @@ float Volume() {
void UpdateRescalingInfo() { void UpdateRescalingInfo() {
const auto setup = values.resolution_setup.GetValue(); const auto setup = values.resolution_setup.GetValue();
auto& info = values.resolution_info; auto& info = values.resolution_info;
info.downscale = false;
switch (setup) { switch (setup) {
case ResolutionSetup::Res1_2X: case ResolutionSetup::Res1_2X:
info.up_scale = 1; info.up_scale = 1;
info.down_shift = 1; info.down_shift = 1;
info.downscale = true;
break; break;
case ResolutionSetup::Res1X: case ResolutionSetup::Res1X:
info.up_scale = 1; info.up_scale = 1;

View File

@ -72,6 +72,7 @@ struct ResolutionScalingInfo {
f32 up_factor{1.0f}; f32 up_factor{1.0f};
f32 down_factor{1.0f}; f32 down_factor{1.0f};
bool active{}; bool active{};
bool downscale{};
s32 ScaleUp(s32 value) const { s32 ScaleUp(s32 value) const {
if (value == 0) { if (value == 0) {

View File

@ -102,6 +102,7 @@ ImageInfo::ImageInfo(const TICEntry& config) noexcept {
layer_stride = CalculateLayerStride(*this); layer_stride = CalculateLayerStride(*this);
maybe_unaligned_layer_stride = CalculateLayerSize(*this); maybe_unaligned_layer_stride = CalculateLayerSize(*this);
rescaleable &= (block.depth == 0) && resources.levels == 1; rescaleable &= (block.depth == 0) && resources.levels == 1;
downscaleable = size.height > 512;
} }
} }
@ -135,6 +136,7 @@ ImageInfo::ImageInfo(const Tegra::Engines::Maxwell3D::Regs& regs, size_t index)
size.depth = rt.depth; size.depth = rt.depth;
} else { } else {
rescaleable = block.depth == 0 && size.height > 256; rescaleable = block.depth == 0 && size.height > 256;
downscaleable = size.height > 512;
type = ImageType::e2D; type = ImageType::e2D;
resources.layers = rt.depth; resources.layers = rt.depth;
} }
@ -164,6 +166,7 @@ ImageInfo::ImageInfo(const Tegra::Engines::Maxwell3D::Regs& regs) noexcept {
size.depth = regs.zeta_depth; size.depth = regs.zeta_depth;
} else { } else {
rescaleable = block.depth == 0 && size.height > 256; rescaleable = block.depth == 0 && size.height > 256;
downscaleable = size.height > 512;
type = ImageType::e2D; type = ImageType::e2D;
resources.layers = regs.zeta_depth; resources.layers = regs.zeta_depth;
} }
@ -197,6 +200,7 @@ ImageInfo::ImageInfo(const Tegra::Engines::Fermi2D::Surface& config) noexcept {
.depth = 1, .depth = 1,
}; };
rescaleable = block.depth == 0 && size.height > 256; rescaleable = block.depth == 0 && size.height > 256;
downscaleable = size.height > 512;
} }
} }

View File

@ -34,6 +34,7 @@ struct ImageInfo {
u32 num_samples = 1; u32 num_samples = 1;
u32 tile_width_spacing = 0; u32 tile_width_spacing = 0;
bool rescaleable = false; bool rescaleable = false;
bool downscaleable = false;
}; };
} // namespace VideoCommon } // namespace VideoCommon

View File

@ -798,6 +798,9 @@ bool TextureCache<P>::ImageCanRescale(ImageBase& image) {
if (!image.info.rescaleable || True(image.flags & ImageFlagBits::Blacklisted)) { if (!image.info.rescaleable || True(image.flags & ImageFlagBits::Blacklisted)) {
return false; return false;
} }
if (Settings::values.resolution_info.downscale && !image.info.downscaleable) {
return false;
}
if (True(image.flags & (ImageFlagBits::Rescaled | ImageFlagBits::CheckingRescalable))) { if (True(image.flags & (ImageFlagBits::Rescaled | ImageFlagBits::CheckingRescalable))) {
return true; return true;
} }