1
0
Fork 0
forked from suyu/suyu

image_info: adjust rescale thresholds and refactor constant use

This commit is contained in:
Liam 2023-06-08 17:46:40 -04:00
parent 9c6fc44a59
commit 05b66877d1

View file

@ -22,6 +22,9 @@ using Tegra::Texture::TICEntry;
using VideoCore::Surface::PixelFormat; using VideoCore::Surface::PixelFormat;
using VideoCore::Surface::SurfaceType; using VideoCore::Surface::SurfaceType;
constexpr u32 RescaleHeightThreshold = 288;
constexpr u32 DownscaleHeightThreshold = 512;
ImageInfo::ImageInfo(const TICEntry& config) noexcept { ImageInfo::ImageInfo(const TICEntry& config) noexcept {
forced_flushed = config.IsPitchLinear() && !Settings::values.use_reactive_flushing.GetValue(); forced_flushed = config.IsPitchLinear() && !Settings::values.use_reactive_flushing.GetValue();
dma_downloaded = forced_flushed; dma_downloaded = forced_flushed;
@ -113,8 +116,9 @@ 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;
rescaleable &= size.height > 256 || GetFormatType(format) != SurfaceType::ColorTexture; rescaleable &= size.height > RescaleHeightThreshold ||
downscaleable = size.height > 512; GetFormatType(format) != SurfaceType::ColorTexture;
downscaleable = size.height > DownscaleHeightThreshold;
} }
} }
@ -152,8 +156,8 @@ ImageInfo::ImageInfo(const Maxwell3D::Regs::RenderTargetConfig& ct,
size.depth = ct.depth; size.depth = ct.depth;
} else { } else {
rescaleable = block.depth == 0; rescaleable = block.depth == 0;
rescaleable &= size.height > 256; rescaleable &= size.height > RescaleHeightThreshold;
downscaleable = size.height > 512; downscaleable = size.height > DownscaleHeightThreshold;
type = ImageType::e2D; type = ImageType::e2D;
resources.layers = ct.depth; resources.layers = ct.depth;
} }
@ -232,8 +236,8 @@ ImageInfo::ImageInfo(const Fermi2D::Surface& config) noexcept {
.height = config.height, .height = config.height,
.depth = 1, .depth = 1,
}; };
rescaleable = block.depth == 0 && size.height > 256; rescaleable = block.depth == 0 && size.height > RescaleHeightThreshold;
downscaleable = size.height > 512; downscaleable = size.height > DownscaleHeightThreshold;
} }
} }
@ -275,8 +279,8 @@ ImageInfo::ImageInfo(const Tegra::DMA::ImageOperand& config) noexcept {
resources.layers = 1; resources.layers = 1;
layer_stride = CalculateLayerStride(*this); layer_stride = CalculateLayerStride(*this);
maybe_unaligned_layer_stride = CalculateLayerSize(*this); maybe_unaligned_layer_stride = CalculateLayerSize(*this);
rescaleable = block.depth == 0 && size.height > 256; rescaleable = block.depth == 0 && size.height > RescaleHeightThreshold;
downscaleable = size.height > 512; downscaleable = size.height > DownscaleHeightThreshold;
} }
} // namespace VideoCommon } // namespace VideoCommon