mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 22:29:39 -06:00
Merge pull request #3672 from EmptyChaos/d3d-anisotropy
Fix D3D Forced Anisotropy
This commit is contained in:
30
Source/Core/VideoCommon/SamplerCommon.h
Normal file
30
Source/Core/VideoCommon/SamplerCommon.h
Normal file
@ -0,0 +1,30 @@
|
||||
// Copyright 2016 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace SamplerCommon
|
||||
{
|
||||
|
||||
// Helper for checking if a BPMemory TexMode0 register is set to Point
|
||||
// Filtering modes. This is used to decide whether Anisotropic enhancements
|
||||
// are (mostly) safe in the VideoBackends.
|
||||
// If both the minification and magnification filters are set to POINT modes
|
||||
// then applying anisotropic filtering is equivalent to forced filtering. Point
|
||||
// mode textures are usually some sort of 2D UI billboard which will end up
|
||||
// misaligned from the correct pixels when filtered anisotropically.
|
||||
template<class T>
|
||||
constexpr bool IsBpTexMode0PointFiltering(const T& tm0)
|
||||
{
|
||||
return tm0.min_filter < 4 && !tm0.mag_filter;
|
||||
}
|
||||
|
||||
// Check if the minification filter has mipmap based filtering modes enabled.
|
||||
template<class T>
|
||||
constexpr bool AreBpTexMode0MipmapsEnabled(const T& tm0)
|
||||
{
|
||||
return (tm0.min_filter & 3) != 0;
|
||||
}
|
||||
|
||||
}
|
@ -26,6 +26,7 @@
|
||||
#include "VideoCommon/FramebufferManagerBase.h"
|
||||
#include "VideoCommon/HiresTextures.h"
|
||||
#include "VideoCommon/RenderBase.h"
|
||||
#include "VideoCommon/SamplerCommon.h"
|
||||
#include "VideoCommon/Statistics.h"
|
||||
#include "VideoCommon/TextureCacheBase.h"
|
||||
#include "VideoCommon/TextureDecoder.h"
|
||||
@ -440,7 +441,7 @@ TextureCacheBase::TCacheEntryBase* TextureCacheBase::Load(const u32 stage)
|
||||
const int texformat = tex.texImage0[id].format;
|
||||
const u32 tlutaddr = tex.texTlut[id].tmem_offset << 9;
|
||||
const u32 tlutfmt = tex.texTlut[id].tlut_format;
|
||||
const bool use_mipmaps = (tex.texMode0[id].min_filter & 3) != 0;
|
||||
const bool use_mipmaps = SamplerCommon::AreBpTexMode0MipmapsEnabled(tex.texMode0[id]);
|
||||
u32 tex_levels = use_mipmaps ? ((tex.texMode1[id].max_lod + 0xf) / 0x10 + 1) : 1;
|
||||
const bool from_tmem = tex.texImage1[id].image_type != 0;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
@ -133,6 +133,7 @@
|
||||
<ClInclude Include="PixelShaderManager.h" />
|
||||
<ClInclude Include="PostProcessing.h" />
|
||||
<ClInclude Include="RenderBase.h" />
|
||||
<ClInclude Include="SamplerCommon.h" />
|
||||
<ClInclude Include="ShaderGenCommon.h" />
|
||||
<ClInclude Include="Statistics.h" />
|
||||
<ClInclude Include="GeometryShaderGen.h" />
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Base">
|
||||
@ -302,8 +302,11 @@
|
||||
<ClInclude Include="GeometryShaderManager.h">
|
||||
<Filter>Shader Managers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SamplerCommon.h">
|
||||
<Filter>Util</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="CMakeLists.txt" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
Reference in New Issue
Block a user