summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorNeoBrainX <NeoBrainX@googlemail.com>2010-11-27 11:11:05 +0000
committerNeoBrainX <NeoBrainX@googlemail.com>2010-11-27 11:11:05 +0000
commit7698d85a8ef19cf5a6ea830b3909bcd9db4b5b5f (patch)
tree14b33b9dc12d08f8e9ead87144b3bed530b1468f /Source
parent5340b4cb9524990badefe40c71c7b3e1a8b746bd (diff)
DX11:
- Speed up MSAA by using custom resolve shaders instead of ID3D11DeviceContext::ResolveSubresource(). - Fix EFB access when MSAA is enabled. - Implement the "force linear filtering" option. - Compile shaders using shader model 4.1 or 5.0 if available. - Some minor cleanups. Who cares about DX9 and OGL anyway :P git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6481 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/VideoCommon/Src/VideoCommon.h2
-rw-r--r--Source/Plugins/Plugin_VideoDX11/Src/D3DBase.cpp20
-rw-r--r--Source/Plugins/Plugin_VideoDX11/Src/D3DUtil.cpp5
-rw-r--r--Source/Plugins/Plugin_VideoDX11/Src/FramebufferManager.cpp4
-rw-r--r--Source/Plugins/Plugin_VideoDX11/Src/PixelShaderCache.cpp138
-rw-r--r--Source/Plugins/Plugin_VideoDX11/Src/PixelShaderCache.h8
-rw-r--r--Source/Plugins/Plugin_VideoDX11/Src/Render.cpp18
-rw-r--r--Source/Plugins/Plugin_VideoDX11/Src/TextureCache.cpp6
-rw-r--r--Source/Plugins/Plugin_VideoDX11/Src/main.cpp5
-rw-r--r--Source/Plugins/Plugin_VideoDX9/Src/main.cpp5
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/main.cpp5
11 files changed, 156 insertions, 60 deletions
diff --git a/Source/Core/VideoCommon/Src/VideoCommon.h b/Source/Core/VideoCommon/Src/VideoCommon.h
index 43cac32e74..3dddf0420b 100644
--- a/Source/Core/VideoCommon/Src/VideoCommon.h
+++ b/Source/Core/VideoCommon/Src/VideoCommon.h
@@ -146,8 +146,6 @@ struct TargetRectangle : public MathUtil::Rectangle<int>
#define LOG_VTX()
-bool IsD3D();
-
typedef enum
{
API_OPENGL,
diff --git a/Source/Plugins/Plugin_VideoDX11/Src/D3DBase.cpp b/Source/Plugins/Plugin_VideoDX11/Src/D3DBase.cpp
index 81587fb526..802f093787 100644
--- a/Source/Plugins/Plugin_VideoDX11/Src/D3DBase.cpp
+++ b/Source/Plugins/Plugin_VideoDX11/Src/D3DBase.cpp
@@ -235,7 +235,6 @@ HRESULT Create(HWND wnd)
aa_modes.clear();
EnumAAModes(adapter, aa_modes);
- // this will need to be changed once multisampling gets implemented
DXGI_SWAP_CHAIN_DESC swap_chain_desc;
memset(&swap_chain_desc, 0, sizeof(swap_chain_desc));
swap_chain_desc.BufferCount = 1;
@@ -337,8 +336,19 @@ void Close()
}
/* just returning the 4_0 ones here */
-const char* VertexShaderVersionString() { return "vs_4_0"; }
-const char* PixelShaderVersionString() { return "ps_4_0"; }
+const char* VertexShaderVersionString()
+{
+ if(featlevel == D3D_FEATURE_LEVEL_11_0) return "vs_5_0";
+ else if(featlevel == D3D_FEATURE_LEVEL_10_1) return "vs_4_1";
+ else /*if(featlevel == D3D_FEATURE_LEVEL_10_0)*/ return "vs_4_0";
+}
+
+const char* PixelShaderVersionString()
+{
+ if(featlevel == D3D_FEATURE_LEVEL_11_0) return "ps_5_0";
+ else if(featlevel == D3D_FEATURE_LEVEL_10_1) return "ps_4_1";
+ else /*if(featlevel == D3D_FEATURE_LEVEL_10_0)*/ return "ps_4_0";
+}
D3DTexture2D* &GetBackBuffer() { return backbuf; }
unsigned int GetBackBufferWidth() { return xres; }
@@ -352,11 +362,11 @@ unsigned int GetMaxTextureSize()
switch (featlevel)
{
case D3D_FEATURE_LEVEL_11_0:
- return 16384;
+ return D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION;
case D3D_FEATURE_LEVEL_10_1:
case D3D_FEATURE_LEVEL_10_0:
- return 8192;
+ return D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION;
case D3D_FEATURE_LEVEL_9_3:
return 4096;
diff --git a/Source/Plugins/Plugin_VideoDX11/Src/D3DUtil.cpp b/Source/Plugins/Plugin_VideoDX11/Src/D3DUtil.cpp
index 9899d88461..dea7b3a3c9 100644
--- a/Source/Plugins/Plugin_VideoDX11/Src/D3DUtil.cpp
+++ b/Source/Plugins/Plugin_VideoDX11/Src/D3DUtil.cpp
@@ -299,7 +299,6 @@ int CD3DFont::Init()
CHECK(hr==S_OK, "Create font blend state");
D3D::SetDebugObjectName((ID3D11DeviceChild*)m_blendstate, "blend state of a CD3DFont object");
- // this might need to be changed when adding multisampling support
D3D11_RASTERIZER_DESC rastdesc = CD3D11_RASTERIZER_DESC(D3D11_FILL_SOLID, D3D11_CULL_NONE, false, 0, 0.f, 0.f, false, false, false, false);
hr = D3D::device->CreateRasterizerState(&rastdesc, &m_raststate);
CHECK(hr==S_OK, "Create font rasterizer state");
@@ -470,12 +469,12 @@ void InitUtils()
util_vbuf = new UtilVertexBuffer(0x4000);
float border[4] = { 0.f, 0.f, 0.f, 0.f };
- D3D11_SAMPLER_DESC samDesc = CD3D11_SAMPLER_DESC(D3D11_FILTER_MIN_MAG_MIP_POINT, D3D11_TEXTURE_ADDRESS_BORDER, D3D11_TEXTURE_ADDRESS_BORDER, D3D11_TEXTURE_ADDRESS_BORDER, 0.f, 1, D3D11_COMPARISON_ALWAYS, border, -D3D11_FLOAT32_MAX, D3D11_FLOAT32_MAX);
+ D3D11_SAMPLER_DESC samDesc = CD3D11_SAMPLER_DESC(D3D11_FILTER_MIN_MAG_MIP_POINT, D3D11_TEXTURE_ADDRESS_BORDER, D3D11_TEXTURE_ADDRESS_BORDER, D3D11_TEXTURE_ADDRESS_BORDER, 0.f, 1, D3D11_COMPARISON_ALWAYS, border, 0.f, 0.f);
HRESULT hr = D3D::device->CreateSamplerState(&samDesc, &point_copy_sampler);
if (FAILED(hr)) PanicAlert("Failed to create sampler state at %s %d\n", __FILE__, __LINE__);
else SetDebugObjectName((ID3D11DeviceChild*)point_copy_sampler, "point copy sampler state");
- samDesc = CD3D11_SAMPLER_DESC(D3D11_FILTER_MIN_MAG_MIP_LINEAR, D3D11_TEXTURE_ADDRESS_BORDER, D3D11_TEXTURE_ADDRESS_BORDER, D3D11_TEXTURE_ADDRESS_BORDER, 0.f, 1, D3D11_COMPARISON_ALWAYS, border, -D3D11_FLOAT32_MAX, D3D11_FLOAT32_MAX);
+ samDesc = CD3D11_SAMPLER_DESC(D3D11_FILTER_MIN_MAG_MIP_LINEAR, D3D11_TEXTURE_ADDRESS_BORDER, D3D11_TEXTURE_ADDRESS_BORDER, D3D11_TEXTURE_ADDRESS_BORDER, 0.f, 1, D3D11_COMPARISON_ALWAYS, border, 0.f, 0.f);
hr = D3D::device->CreateSamplerState(&samDesc, &linear_copy_sampler);
if (FAILED(hr)) PanicAlert("Failed to create sampler state at %s %d\n", __FILE__, __LINE__);
else SetDebugObjectName((ID3D11DeviceChild*)linear_copy_sampler, "linear copy sampler state");
diff --git a/Source/Plugins/Plugin_VideoDX11/Src/FramebufferManager.cpp b/Source/Plugins/Plugin_VideoDX11/Src/FramebufferManager.cpp
index 8d6efb673d..ca2c16d431 100644
--- a/Source/Plugins/Plugin_VideoDX11/Src/FramebufferManager.cpp
+++ b/Source/Plugins/Plugin_VideoDX11/Src/FramebufferManager.cpp
@@ -172,7 +172,7 @@ void XFBSource::Draw(const MathUtil::Rectangle<float> &sourcerc,
const MathUtil::Rectangle<float> &drawrc, int width, int height) const
{
D3D::drawShadedTexSubQuad(tex->GetSRV(), &sourcerc,
- texWidth, texHeight, &drawrc, PixelShaderCache::GetColorCopyProgram(),
+ texWidth, texHeight, &drawrc, PixelShaderCache::GetColorCopyProgram(false),
VertexShaderCache::GetSimpleVertexShader(), VertexShaderCache::GetSimpleInputLayout());
}
@@ -193,7 +193,7 @@ void XFBSource::CopyEFB()
D3D::drawShadedTexQuad(FramebufferManager::GetEFBColorTexture()->GetSRV(), sourceRc.AsRECT(),
Renderer::GetFullTargetWidth(), Renderer::GetFullTargetHeight(),
- PixelShaderCache::GetColorCopyProgram(), VertexShaderCache::GetSimpleVertexShader(),
+ PixelShaderCache::GetColorCopyProgram(true), VertexShaderCache::GetSimpleVertexShader(),
VertexShaderCache::GetSimpleInputLayout());
D3D::context->OMSetRenderTargets(1, &FramebufferManager::GetEFBColorTexture()->GetRTV(),
diff --git a/Source/Plugins/Plugin_VideoDX11/Src/PixelShaderCache.cpp b/Source/Plugins/Plugin_VideoDX11/Src/PixelShaderCache.cpp
index 4dd0338539..b3ad2e2fb2 100644
--- a/Source/Plugins/Plugin_VideoDX11/Src/PixelShaderCache.cpp
+++ b/Source/Plugins/Plugin_VideoDX11/Src/PixelShaderCache.cpp
@@ -40,9 +40,9 @@ const PixelShaderCache::PSCacheEntry* PixelShaderCache::last_entry;
LinearDiskCache<PIXELSHADERUID, u8> g_ps_disk_cache;
-ID3D11PixelShader* s_ColorMatrixProgram = NULL;
-ID3D11PixelShader* s_ColorCopyProgram = NULL;
-ID3D11PixelShader* s_DepthMatrixProgram = NULL;
+ID3D11PixelShader* s_ColorMatrixProgram[2] = {NULL};
+ID3D11PixelShader* s_ColorCopyProgram[2] = {NULL};
+ID3D11PixelShader* s_DepthMatrixProgram[2] = {NULL};
ID3D11PixelShader* s_ClearProgram = NULL;
const char clear_program_code[] = {
@@ -65,6 +65,23 @@ const char color_copy_program_code[] = {
"}\n"
};
+// TODO: Improve sampling algorithm!
+const char color_copy_program_code_msaa[] = {
+ "sampler samp0 : register(s0);\n"
+ "Texture2DMS<float4, %d> Tex0 : register(t0);\n"
+ "void main(\n"
+ "out float4 ocol0 : SV_Target,\n"
+ "in float4 pos : SV_Position,\n"
+ "in float2 uv0 : TEXCOORD0){\n"
+ "int width, height, samples;\n"
+ "Tex0.GetDimensions(width, height, samples);\n"
+ "ocol0 = 0;\n"
+ "for(int i = 0; i < samples; ++i)\n"
+ " ocol0 += Tex0.Load(int2(uv0.x*(width), uv0.y*(height)), i);\n"
+ "ocol0 /= samples;\n"
+ "}\n"
+};
+
const char color_matrix_program_code[] = {
"sampler samp0 : register(s0);\n"
"Texture2D Tex0 : register(t0);\n"
@@ -78,6 +95,24 @@ const char color_matrix_program_code[] = {
"}\n"
};
+const char color_matrix_program_code_msaa[] = {
+ "sampler samp0 : register(s0);\n"
+ "Texture2DMS<float4, %d> Tex0 : register(t0);\n"
+ "uniform float4 cColMatrix[5] : register(c0);\n"
+ "void main(\n"
+ "out float4 ocol0 : SV_Target,\n"
+ "in float4 pos : SV_Position,\n"
+ " in float2 uv0 : TEXCOORD0){\n"
+ "int width, height, samples;\n"
+ "Tex0.GetDimensions(width, height, samples);\n"
+ "float4 texcol = 0;\n"
+ "for(int i = 0; i < samples; ++i)\n"
+ " texcol += Tex0.Load(int2(uv0.x*(width), uv0.y*(height)), i);\n"
+ "texcol /= samples;\n"
+ "ocol0 = float4(dot(texcol,cColMatrix[0]),dot(texcol,cColMatrix[1]),dot(texcol,cColMatrix[2]),dot(texcol,cColMatrix[3])) + cColMatrix[4];\n"
+ "}\n"
+};
+
const char depth_matrix_program[] = {
"sampler samp0 : register(s0);\n"
"Texture2D Tex0 : register(t0);\n"
@@ -93,19 +128,69 @@ const char depth_matrix_program[] = {
"}\n"
};
-ID3D11PixelShader* PixelShaderCache::GetColorMatrixProgram()
+const char depth_matrix_program_msaa[] = {
+ "sampler samp0 : register(s0);\n"
+ "Texture2DMS<float4, %d> Tex0 : register(t0);\n"
+ "uniform float4 cColMatrix[5] : register(c0);\n"
+ "void main(\n"
+ "out float4 ocol0 : SV_Target,\n"
+ " in float4 pos : SV_Position,\n"
+ " in float2 uv0 : TEXCOORD0){\n"
+ "int width, height, samples;\n"
+ "Tex0.GetDimensions(width, height, samples);\n"
+ "float4 texcol = 0;\n"
+ "for(int i = 0; i < samples; ++i)\n"
+ " texcol += Tex0.Load(int2(uv0.x*(width), uv0.y*(height)), i);\n"
+ "texcol /= samples;\n"
+ "float4 EncodedDepth = frac((texcol.r * (16777215.0f/16777216.0f)) * float4(1.0f,255.0f,255.0f*255.0f,255.0f*255.0f*255.0f));\n"
+ "texcol = float4((EncodedDepth.rgb * (16777216.0f/16777215.0f)),1.0f);\n"
+ "ocol0 = float4(dot(texcol,cColMatrix[0]),dot(texcol,cColMatrix[1]),dot(texcol,cColMatrix[2]),dot(texcol,cColMatrix[3])) + cColMatrix[4];\n"
+ "}\n"
+};
+
+ID3D11PixelShader* PixelShaderCache::GetColorCopyProgram(bool multisampled)
{
- return s_ColorMatrixProgram;
+ if (!multisampled || s_ColorCopyProgram[1]) return s_ColorCopyProgram[multisampled];
+ else
+ {
+ // create MSAA shader for current AA mode
+ char buf[1024];
+ int l = sprintf_s(buf, 1024, color_copy_program_code_msaa, D3D::GetAAMode(g_ActiveConfig.iMultisampleMode));
+ s_ColorCopyProgram[1] = D3D::CompileAndCreatePixelShader(buf, l);
+ CHECK(s_ColorCopyProgram[1]!=NULL, "Create color copy MSAA pixel shader");
+ D3D::SetDebugObjectName((ID3D11DeviceChild*)s_ColorCopyProgram[1], "color copy MSAA pixel shader");
+ return s_ColorCopyProgram[1];
+ }
}
-ID3D11PixelShader* PixelShaderCache::GetDepthMatrixProgram()
+ID3D11PixelShader* PixelShaderCache::GetColorMatrixProgram(bool multisampled)
{
- return s_DepthMatrixProgram;
+ if (!multisampled || s_ColorMatrixProgram[1]) return s_ColorMatrixProgram[multisampled];
+ else
+ {
+ // create MSAA shader for current AA mode
+ char buf[1024];
+ int l = sprintf_s(buf, 1024, color_matrix_program_code_msaa, D3D::GetAAMode(g_ActiveConfig.iMultisampleMode));
+ s_ColorMatrixProgram[1] = D3D::CompileAndCreatePixelShader(buf, l);
+ CHECK(s_ColorMatrixProgram[1]!=NULL, "Create color matrix MSAA pixel shader");
+ D3D::SetDebugObjectName((ID3D11DeviceChild*)s_ColorMatrixProgram[1], "color matrix MSAA pixel shader");
+ return s_ColorMatrixProgram[1];
+ }
}
-ID3D11PixelShader* PixelShaderCache::GetColorCopyProgram()
+ID3D11PixelShader* PixelShaderCache::GetDepthMatrixProgram(bool multisampled)
{
- return s_ColorCopyProgram;
+ if (!multisampled || s_DepthMatrixProgram[1]) return s_DepthMatrixProgram[multisampled];
+ else
+ {
+ // create MSAA shader for current AA mode
+ char buf[1024];
+ int l = sprintf_s(buf, 1024, depth_matrix_program_msaa, D3D::GetAAMode(g_ActiveConfig.iMultisampleMode));
+ s_DepthMatrixProgram[1] = D3D::CompileAndCreatePixelShader(buf, l);
+ CHECK(s_DepthMatrixProgram[1]!=NULL, "Create depth matrix MSAA pixel shader");
+ D3D::SetDebugObjectName((ID3D11DeviceChild*)s_DepthMatrixProgram[1], "depth matrix MSAA pixel shader");
+ return s_DepthMatrixProgram[1];
+ }
}
ID3D11PixelShader* PixelShaderCache::GetClearProgram()
@@ -175,19 +260,19 @@ void PixelShaderCache::Init()
D3D::SetDebugObjectName((ID3D11DeviceChild*)s_ClearProgram, "clear pixel shader");
// used when copying/resolving the color buffer
- s_ColorCopyProgram = D3D::CompileAndCreatePixelShader(color_copy_program_code, sizeof(color_copy_program_code));
- CHECK(s_ColorCopyProgram!=NULL, "Create color copy pixel shader");
- D3D::SetDebugObjectName((ID3D11DeviceChild*)s_ClearProgram, "color copy pixel shader");
+ s_ColorCopyProgram[0] = D3D::CompileAndCreatePixelShader(color_copy_program_code, sizeof(color_copy_program_code));
+ CHECK(s_ColorCopyProgram[0]!=NULL, "Create color copy pixel shader");
+ D3D::SetDebugObjectName((ID3D11DeviceChild*)s_ColorCopyProgram[0], "color copy pixel shader");
// used for color conversion
- s_ColorMatrixProgram = D3D::CompileAndCreatePixelShader(color_matrix_program_code, sizeof(color_matrix_program_code));
- CHECK(s_ColorMatrixProgram!=NULL, "Create color matrix pixel shader");
- D3D::SetDebugObjectName((ID3D11DeviceChild*)s_ClearProgram, "color matrix pixel shader");
+ s_ColorMatrixProgram[0] = D3D::CompileAndCreatePixelShader(color_matrix_program_code, sizeof(color_matrix_program_code));
+ CHECK(s_ColorMatrixProgram[0]!=NULL, "Create color matrix pixel shader");
+ D3D::SetDebugObjectName((ID3D11DeviceChild*)s_ColorMatrixProgram[0], "color matrix pixel shader");
// used for depth copy
- s_DepthMatrixProgram = D3D::CompileAndCreatePixelShader(depth_matrix_program, sizeof(depth_matrix_program));
- CHECK(s_DepthMatrixProgram!=NULL, "Create depth matrix pixel shader");
- D3D::SetDebugObjectName((ID3D11DeviceChild*)s_ClearProgram, "depth matrix pixel shader");
+ s_DepthMatrixProgram[0] = D3D::CompileAndCreatePixelShader(depth_matrix_program, sizeof(depth_matrix_program));
+ CHECK(s_DepthMatrixProgram[0]!=NULL, "Create depth matrix pixel shader");
+ D3D::SetDebugObjectName((ID3D11DeviceChild*)s_DepthMatrixProgram[0], "depth matrix pixel shader");
Clear();
@@ -211,12 +296,23 @@ void PixelShaderCache::Clear()
PixelShaders.clear();
}
+// Used in Swap() when AA mode has changed
+void PixelShaderCache::InvalidateMSAAShaders()
+{
+ SAFE_RELEASE(s_ColorCopyProgram[1]);
+ SAFE_RELEASE(s_ColorMatrixProgram[1]);
+ SAFE_RELEASE(s_DepthMatrixProgram[1]);
+}
+
void PixelShaderCache::Shutdown()
{
- SAFE_RELEASE(s_ColorMatrixProgram);
- SAFE_RELEASE(s_ColorCopyProgram);
- SAFE_RELEASE(s_DepthMatrixProgram);
SAFE_RELEASE(s_ClearProgram);
+ for (int i = 0; i < 2; ++i)
+ {
+ SAFE_RELEASE(s_ColorCopyProgram[i]);
+ SAFE_RELEASE(s_ColorMatrixProgram[i]);
+ SAFE_RELEASE(s_DepthMatrixProgram[i]);
+ }
Clear();
g_ps_disk_cache.Sync();
diff --git a/Source/Plugins/Plugin_VideoDX11/Src/PixelShaderCache.h b/Source/Plugins/Plugin_VideoDX11/Src/PixelShaderCache.h
index 37c2b9155f..4eab0d8ecb 100644
--- a/Source/Plugins/Plugin_VideoDX11/Src/PixelShaderCache.h
+++ b/Source/Plugins/Plugin_VideoDX11/Src/PixelShaderCache.h
@@ -35,11 +35,13 @@ public:
static bool SetShader(DSTALPHA_MODE dstAlphaMode, u32 components);
static bool InsertByteCode(const PIXELSHADERUID &uid, const void* bytecode, unsigned int bytecodelen);
- static ID3D11PixelShader* GetColorMatrixProgram();
- static ID3D11PixelShader* GetColorCopyProgram();
- static ID3D11PixelShader* GetDepthMatrixProgram();
+ static ID3D11PixelShader* GetColorMatrixProgram(bool multisampled);
+ static ID3D11PixelShader* GetColorCopyProgram(bool multisampled);
+ static ID3D11PixelShader* GetDepthMatrixProgram(bool multisampled);
static ID3D11PixelShader* GetClearProgram();
+ static void InvalidateMSAAShaders();
+
private:
struct PSCacheEntry
{
diff --git a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp
index fc850dce83..36b30341a4 100644
--- a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp
+++ b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp
@@ -283,7 +283,6 @@ void SetupDeviceObjects()
CHECK(hr==S_OK, "Create depth state for Renderer::ResetAPIState");
D3D::SetDebugObjectName((ID3D11DeviceChild*)resetdepthstate, "depth stencil state for Renderer::ResetAPIState");
- // this might need to be changed once multisampling support gets added
D3D11_RASTERIZER_DESC rastdesc = CD3D11_RASTERIZER_DESC(D3D11_FILL_SOLID, D3D11_CULL_NONE, false, 0, 0.f, 0.f, false, false, false, false);
hr = D3D::device->CreateRasterizerState(&rastdesc, &resetraststate);
CHECK(hr==S_OK, "Create rasterizer state for Renderer::ResetAPIState");
@@ -546,11 +545,11 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
D3D::context->PSSetConstantBuffers(0, 1, &access_efb_cbuf);
D3D::context->OMSetRenderTargets(1, &FramebufferManager::GetEFBDepthReadTexture()->GetRTV(), NULL);
D3D::SetPointCopySampler();
- D3D::drawShadedTexQuad(FramebufferManager::GetResolvedEFBDepthTexture()->GetSRV(),
+ D3D::drawShadedTexQuad(FramebufferManager::GetEFBDepthTexture()->GetSRV(),
&RectToLock,
Renderer::GetFullTargetWidth(),
Renderer::GetFullTargetHeight(),
- PixelShaderCache::GetDepthMatrixProgram(),
+ PixelShaderCache::GetDepthMatrixProgram(true),
VertexShaderCache::GetSimpleVertexShader(),
VertexShaderCache::GetSimpleInputLayout());
@@ -815,7 +814,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
int Y = dst_rect.top;
int Width = dst_rect.right - dst_rect.left;
int Height = dst_rect.bottom - dst_rect.top;
-
+
if (X < 0) X = 0;
if (Y < 0) Y = 0;
if (X > s_backbuffer_width) X = s_backbuffer_width;
@@ -883,8 +882,10 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
else
{
TargetRectangle targetRc = Renderer::ConvertEFBRectangle(rc);
+
+ // TODO: Improve sampling algorithm for the pixel shader so that we can use the multisampled EFB texture as source
D3DTexture2D* read_texture = FramebufferManager::GetResolvedEFBColorTexture();
- D3D::drawShadedTexQuad(read_texture->GetSRV(), targetRc.AsRECT(), Renderer::GetFullTargetWidth(), Renderer::GetFullTargetHeight(), PixelShaderCache::GetColorCopyProgram(),VertexShaderCache::GetSimpleVertexShader(), VertexShaderCache::GetSimpleInputLayout());
+ D3D::drawShadedTexQuad(read_texture->GetSRV(), targetRc.AsRECT(), Renderer::GetFullTargetWidth(), Renderer::GetFullTargetHeight(), PixelShaderCache::GetColorCopyProgram(false),VertexShaderCache::GetSimpleVertexShader(), VertexShaderCache::GetSimpleInputLayout());
}
// done with drawing the game stuff, good moment to save a screenshot
if (s_bScreenshot)
@@ -964,6 +965,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
s_LastAA != g_ActiveConfig.iMultisampleMode)
{
s_LastAA = g_ActiveConfig.iMultisampleMode;
+ PixelShaderCache::InvalidateMSAAShaders();
// TODO: Aren't we still holding a reference to the back buffer right now?
D3D::Reset();
@@ -1079,7 +1081,11 @@ void Renderer::SetSamplerState(int stage, int texindex)
// TODO: Clarify whether these values are correct
// NOTE: since there's no "no filter" in DX11 we're using point filters in these cases
- if (tm0.min_filter & 4) // linear min filter
+ if (g_ActiveConfig.bForceFiltering)
+ {
+ D3D::gfxstate->SetSamplerFilter(stage, D3D11_FILTER_MIN_MAG_MIP_LINEAR);
+ }
+ else if (tm0.min_filter & 4) // linear min filter
{
if (tm0.mag_filter) // linear mag filter
{
diff --git a/Source/Plugins/Plugin_VideoDX11/Src/TextureCache.cpp b/Source/Plugins/Plugin_VideoDX11/Src/TextureCache.cpp
index 9411ecec7c..4de1b07f7d 100644
--- a/Source/Plugins/Plugin_VideoDX11/Src/TextureCache.cpp
+++ b/Source/Plugins/Plugin_VideoDX11/Src/TextureCache.cpp
@@ -139,11 +139,11 @@ void TextureCache::TCacheEntry::FromRenderTarget(bool bFromZBuffer, bool bScaleB
D3D::SetPointCopySampler();
D3D::context->OMSetRenderTargets(1, &texture->GetRTV(), NULL);
-
+
D3D::drawShadedTexQuad(
- (bFromZBuffer) ? FramebufferManager::GetResolvedEFBDepthTexture()->GetSRV() : FramebufferManager::GetResolvedEFBColorTexture()->GetSRV(),
+ (bFromZBuffer) ? FramebufferManager::GetEFBDepthTexture()->GetSRV() : FramebufferManager::GetEFBColorTexture()->GetSRV(),
&sourcerect, Renderer::GetFullTargetWidth(), Renderer::GetFullTargetHeight(),
- (bFromZBuffer) ? PixelShaderCache::GetDepthMatrixProgram() : PixelShaderCache::GetColorMatrixProgram(),
+ (bFromZBuffer) ? PixelShaderCache::GetDepthMatrixProgram(true) : PixelShaderCache::GetColorMatrixProgram(true),
VertexShaderCache::GetSimpleVertexShader(), VertexShaderCache::GetSimpleInputLayout());
D3D::context->OMSetRenderTargets(1, &FramebufferManager::GetEFBColorTexture()->GetRTV(), FramebufferManager::GetEFBDepthTexture()->GetDSV());
diff --git a/Source/Plugins/Plugin_VideoDX11/Src/main.cpp b/Source/Plugins/Plugin_VideoDX11/Src/main.cpp
index 957060d361..01f9702bba 100644
--- a/Source/Plugins/Plugin_VideoDX11/Src/main.cpp
+++ b/Source/Plugins/Plugin_VideoDX11/Src/main.cpp
@@ -57,11 +57,6 @@
HINSTANCE g_hInstance = NULL;
-bool IsD3D()
-{
- return true;
-}
-
// This is used for the functions right below here which use wxwidgets
#if defined(HAVE_WX) && HAVE_WX
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
diff --git a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp
index 07593552fe..7a4f5c1019 100644
--- a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp
+++ b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp
@@ -56,11 +56,6 @@
HINSTANCE g_hInstance = NULL;
-bool IsD3D()
-{
- return true;
-}
-
// This is used for the functions right below here which use wxwidgets
#if defined(HAVE_WX) && HAVE_WX
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp
index 3d5358787e..8cada14dfb 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp
@@ -101,11 +101,6 @@ int GLScissorX, GLScissorY, GLScissorW, GLScissorH;
static volatile u32 s_doStateRequested = FALSE;
#endif
-bool IsD3D()
-{
- return false;
-}
-
// This is used for the functions right below here which use wxwidgets
#if defined(HAVE_WX) && HAVE_WX
#ifdef _WIN32