mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-05-01 12:58:59 +02:00
[vk, texture_cache] Preveting ARGB8 get misinterpretated with depth formats
This commit is contained in:
parent
567a203f56
commit
a96b601cb5
1 changed files with 7 additions and 1 deletions
|
|
@ -2263,6 +2263,12 @@ Sampler::Sampler(TextureCacheRuntime& runtime, const Tegra::Texture::TSCEntry& t
|
||||||
// Some games have samplers with garbage. Sanitize them here.
|
// Some games have samplers with garbage. Sanitize them here.
|
||||||
const f32 max_anisotropy = std::clamp(tsc.MaxAnisotropy(), 1.0f, 16.0f);
|
const f32 max_anisotropy = std::clamp(tsc.MaxAnisotropy(), 1.0f, 16.0f);
|
||||||
|
|
||||||
|
// Depth compare only works with depth formats. Disable if linear filtering is used (color sampler).
|
||||||
|
const bool likely_color_sampler =
|
||||||
|
tsc.mag_filter == Tegra::Texture::TextureFilter::Linear ||
|
||||||
|
tsc.min_filter == Tegra::Texture::TextureFilter::Linear;
|
||||||
|
const bool use_depth_compare = tsc.depth_compare_enabled && !likely_color_sampler;
|
||||||
|
|
||||||
const auto create_sampler = [&](const f32 anisotropy) {
|
const auto create_sampler = [&](const f32 anisotropy) {
|
||||||
return device.GetLogical().CreateSampler(VkSamplerCreateInfo{
|
return device.GetLogical().CreateSampler(VkSamplerCreateInfo{
|
||||||
.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO,
|
||||||
|
|
@ -2277,7 +2283,7 @@ Sampler::Sampler(TextureCacheRuntime& runtime, const Tegra::Texture::TSCEntry& t
|
||||||
.mipLodBias = tsc.LodBias(),
|
.mipLodBias = tsc.LodBias(),
|
||||||
.anisotropyEnable = static_cast<VkBool32>(anisotropy > 1.0f ? VK_TRUE : VK_FALSE),
|
.anisotropyEnable = static_cast<VkBool32>(anisotropy > 1.0f ? VK_TRUE : VK_FALSE),
|
||||||
.maxAnisotropy = anisotropy,
|
.maxAnisotropy = anisotropy,
|
||||||
.compareEnable = tsc.depth_compare_enabled,
|
.compareEnable = use_depth_compare,
|
||||||
.compareOp = MaxwellToVK::Sampler::DepthCompareFunction(tsc.depth_compare_func),
|
.compareOp = MaxwellToVK::Sampler::DepthCompareFunction(tsc.depth_compare_func),
|
||||||
.minLod = tsc.mipmap_filter == TextureMipmapFilter::None ? 0.0f : tsc.MinLod(),
|
.minLod = tsc.mipmap_filter == TextureMipmapFilter::None ? 0.0f : tsc.MinLod(),
|
||||||
.maxLod = tsc.mipmap_filter == TextureMipmapFilter::None ? 0.25f : tsc.MaxLod(),
|
.maxLod = tsc.mipmap_filter == TextureMipmapFilter::None ? 0.25f : tsc.MaxLod(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue