mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-12-23 08:50:57 +01:00
Merge pull request #9691 from ameerj/msaa-texcache
texture_cache: Fix tracking of MSAA image views
This commit is contained in:
commit
a3aedcce65
2 changed files with 48 additions and 0 deletions
|
@ -100,6 +100,10 @@ ImageInfo::ImageInfo(const TICEntry& config) noexcept {
|
||||||
ASSERT_MSG(false, "Invalid texture_type={}", static_cast<int>(config.texture_type.Value()));
|
ASSERT_MSG(false, "Invalid texture_type={}", static_cast<int>(config.texture_type.Value()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (num_samples > 1) {
|
||||||
|
size.width *= NumSamplesX(config.msaa_mode);
|
||||||
|
size.height *= NumSamplesY(config.msaa_mode);
|
||||||
|
}
|
||||||
if (type != ImageType::Linear) {
|
if (type != ImageType::Linear) {
|
||||||
// FIXME: Call this without passing *this
|
// FIXME: Call this without passing *this
|
||||||
layer_stride = CalculateLayerStride(*this);
|
layer_stride = CalculateLayerStride(*this);
|
||||||
|
|
|
@ -51,4 +51,48 @@ namespace VideoCommon {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] inline int NumSamplesX(Tegra::Texture::MsaaMode msaa_mode) {
|
||||||
|
using Tegra::Texture::MsaaMode;
|
||||||
|
switch (msaa_mode) {
|
||||||
|
case MsaaMode::Msaa1x1:
|
||||||
|
return 1;
|
||||||
|
case MsaaMode::Msaa2x1:
|
||||||
|
case MsaaMode::Msaa2x1_D3D:
|
||||||
|
case MsaaMode::Msaa2x2:
|
||||||
|
case MsaaMode::Msaa2x2_VC4:
|
||||||
|
case MsaaMode::Msaa2x2_VC12:
|
||||||
|
return 2;
|
||||||
|
case MsaaMode::Msaa4x2:
|
||||||
|
case MsaaMode::Msaa4x2_D3D:
|
||||||
|
case MsaaMode::Msaa4x2_VC8:
|
||||||
|
case MsaaMode::Msaa4x2_VC24:
|
||||||
|
case MsaaMode::Msaa4x4:
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
ASSERT_MSG(false, "Invalid MSAA mode={}", static_cast<int>(msaa_mode));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] inline int NumSamplesY(Tegra::Texture::MsaaMode msaa_mode) {
|
||||||
|
using Tegra::Texture::MsaaMode;
|
||||||
|
switch (msaa_mode) {
|
||||||
|
case MsaaMode::Msaa1x1:
|
||||||
|
case MsaaMode::Msaa2x1:
|
||||||
|
case MsaaMode::Msaa2x1_D3D:
|
||||||
|
return 1;
|
||||||
|
case MsaaMode::Msaa2x2:
|
||||||
|
case MsaaMode::Msaa2x2_VC4:
|
||||||
|
case MsaaMode::Msaa2x2_VC12:
|
||||||
|
case MsaaMode::Msaa4x2:
|
||||||
|
case MsaaMode::Msaa4x2_D3D:
|
||||||
|
case MsaaMode::Msaa4x2_VC8:
|
||||||
|
case MsaaMode::Msaa4x2_VC24:
|
||||||
|
return 2;
|
||||||
|
case MsaaMode::Msaa4x4:
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
ASSERT_MSG(false, "Invalid MSAA mode={}", static_cast<int>(msaa_mode));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace VideoCommon
|
} // namespace VideoCommon
|
||||||
|
|
Loading…
Reference in a new issue