DX11: Use D3DX11FilterTexture instead of ID3D11Context::GenerateMips.
Test if performance changed in any games by this change, please. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5731 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
91d540ad67
commit
e266347160
|
@ -297,7 +297,7 @@
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalOptions=""..\..\core\common\win32\debug\common.lib""
|
AdditionalOptions=""..\..\core\common\win32\debug\common.lib""
|
||||||
AdditionalDependencies="odbc32.lib d3dcompiler.lib odbccp32.lib comctl32.lib uuid.lib dxguid.lib d3dx11.lib d3d11.lib dxgi.lib Rpcrt4.lib winmm.lib vfw32.lib wxbase28ud.lib wxmsw28ud_core.lib"
|
AdditionalDependencies="odbc32.lib d3dcompiler.lib odbccp32.lib comctl32.lib uuid.lib dxguid.lib d3dx11d.lib d3d11.lib dxgi.lib Rpcrt4.lib winmm.lib vfw32.lib wxbase28ud.lib wxmsw28ud_core.lib"
|
||||||
OutputFile="..\..\..\Binary\Win32/Plugins\Plugin_VideoDX11D.dll"
|
OutputFile="..\..\..\Binary\Win32/Plugins\Plugin_VideoDX11D.dll"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
SuppressStartupBanner="true"
|
SuppressStartupBanner="true"
|
||||||
|
@ -393,7 +393,7 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies="odbc32.lib d3dcompiler.lib odbccp32.lib comctl32.lib uuid.lib dxguid.lib d3dx11.lib d3d11.lib dxgi.lib Rpcrt4.lib winmm.lib vfw32.lib"
|
AdditionalDependencies="odbc32.lib d3dcompiler.lib odbccp32.lib comctl32.lib uuid.lib dxguid.lib d3dx11d.lib d3d11.lib dxgi.lib Rpcrt4.lib winmm.lib vfw32.lib"
|
||||||
OutputFile="..\..\..\Binary\x64\Plugins\Plugin_VideoDX11D.dll"
|
OutputFile="..\..\..\Binary\x64\Plugins\Plugin_VideoDX11D.dll"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
SuppressStartupBanner="true"
|
SuppressStartupBanner="true"
|
||||||
|
@ -499,7 +499,7 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies="odbc32.lib d3dcompiler.lib odbccp32.lib comctl32.lib uuid.lib dxguid.lib d3dx11.lib d3d11.lib dxgi.lib Rpcrt4.lib winmm.lib vfw32.lib"
|
AdditionalDependencies="odbc32.lib d3dcompiler.lib odbccp32.lib comctl32.lib uuid.lib dxguid.lib d3dx11d.lib d3d11.lib dxgi.lib Rpcrt4.lib winmm.lib vfw32.lib"
|
||||||
OutputFile="..\..\..\Binary\Win32\Plugins\Plugin_VideoDX11DF.dll"
|
OutputFile="..\..\..\Binary\Win32\Plugins\Plugin_VideoDX11DF.dll"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
SuppressStartupBanner="true"
|
SuppressStartupBanner="true"
|
||||||
|
@ -608,7 +608,7 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies="odbc32.lib d3dcompiler.lib odbccp32.lib comctl32.lib uuid.lib dxguid.lib d3dx11.lib d3d11.lib dxgi.lib Rpcrt4.lib winmm.lib vfw32.lib"
|
AdditionalDependencies="odbc32.lib d3dcompiler.lib odbccp32.lib comctl32.lib uuid.lib dxguid.lib d3dx11d.lib d3d11.lib dxgi.lib Rpcrt4.lib winmm.lib vfw32.lib"
|
||||||
OutputFile="..\..\..\Binary\x64\Plugins\Plugin_VideoDX11DF.dll"
|
OutputFile="..\..\..\Binary\x64\Plugins\Plugin_VideoDX11DF.dll"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
SuppressStartupBanner="true"
|
SuppressStartupBanner="true"
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
// Official SVN repository and contact information can be found at
|
// Official SVN repository and contact information can be found at
|
||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
#include "d3dx11.h"
|
#include <d3dx11.h>
|
||||||
#include "D3DBase.h"
|
#include "D3DBase.h"
|
||||||
#include "D3DTexture.h"
|
#include "D3DTexture.h"
|
||||||
|
|
||||||
|
|
|
@ -269,18 +269,13 @@ TextureCache::TCacheEntry* TextureCache::Load(unsigned int stage, u32 address, u
|
||||||
ID3D11Texture2D* pTexture = NULL;
|
ID3D11Texture2D* pTexture = NULL;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
// possible optimization: Manually create the mipmaps, so that we don't need to bind the texture as render target
|
D3D11_TEXTURE2D_DESC texdesc = CD3D11_TEXTURE2D_DESC(d3d_fmt, width, height, 1, TexLevels, D3D11_BIND_SHADER_RESOURCE, usage);
|
||||||
// if we automatically generate the mipmaps we need to bind the texture as rendertarget as well
|
|
||||||
D3D11_BIND_FLAG bindflags = D3D11_BIND_SHADER_RESOURCE;
|
|
||||||
if (TexLevels == 0) bindflags = (D3D11_BIND_FLAG)(bindflags | D3D11_BIND_RENDER_TARGET);
|
|
||||||
D3D11_TEXTURE2D_DESC texdesc = CD3D11_TEXTURE2D_DESC(d3d_fmt, width, height, 1, TexLevels, bindflags, usage, 0, 1, 0, (TexLevels==0)?D3D11_RESOURCE_MISC_GENERATE_MIPS:0);
|
|
||||||
hr = D3D::device->CreateTexture2D(&texdesc, NULL, &pTexture);
|
hr = D3D::device->CreateTexture2D(&texdesc, NULL, &pTexture);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
PanicAlert("Failed to create texture at %s %d\n", __FILE__, __LINE__);
|
PanicAlert("Failed to create texture at %s %d\n", __FILE__, __LINE__);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
// we only need the shader resource view
|
|
||||||
entry.texture = new D3DTexture2D(pTexture, D3D11_BIND_SHADER_RESOURCE);
|
entry.texture = new D3DTexture2D(pTexture, D3D11_BIND_SHADER_RESOURCE);
|
||||||
D3D::SetDebugObjectName((ID3D11DeviceChild*)entry.texture->GetTex(), "a (static) texture of the TextureCache");
|
D3D::SetDebugObjectName((ID3D11DeviceChild*)entry.texture->GetTex(), "a (static) texture of the TextureCache");
|
||||||
D3D::SetDebugObjectName((ID3D11DeviceChild*)entry.texture->GetSRV(), "shader resource view of a (static) texture of the TextureCache");
|
D3D::SetDebugObjectName((ID3D11DeviceChild*)entry.texture->GetSRV(), "shader resource view of a (static) texture of the TextureCache");
|
||||||
|
@ -293,7 +288,7 @@ TextureCache::TCacheEntry* TextureCache::Load(unsigned int stage, u32 address, u
|
||||||
{
|
{
|
||||||
D3D::ReplaceTexture2D(entry.texture->GetTex(), temp, width, height, expandedWidth, d3d_fmt, pcfmt, 0, usage);
|
D3D::ReplaceTexture2D(entry.texture->GetTex(), temp, width, height, expandedWidth, d3d_fmt, pcfmt, 0, usage);
|
||||||
}
|
}
|
||||||
if (TexLevels == 0 && usage == D3D11_USAGE_DEFAULT) D3D::context->GenerateMips(entry.texture->GetSRV());
|
if (TexLevels == 0 && usage == D3D11_USAGE_DEFAULT) D3DX11FilterTexture(D3D::context, entry.texture->GetTex(), 0, D3DX11_DEFAULT);
|
||||||
else if (TexLevels > 1 && pcfmt != PC_TEX_FMT_NONE)
|
else if (TexLevels > 1 && pcfmt != PC_TEX_FMT_NONE)
|
||||||
{
|
{
|
||||||
unsigned int level = 1;
|
unsigned int level = 1;
|
||||||
|
|
Loading…
Reference in New Issue