D3D: Add geometry shader stereoscopy support.

This commit is contained in:
Jules Blok
2014-11-02 23:40:52 +01:00
parent d5ebdf7a97
commit 9253bb7d96
10 changed files with 112 additions and 73 deletions

View File

@ -57,7 +57,7 @@ FramebufferManager::FramebufferManager()
D3D11_TEXTURE2D_DESC texdesc;
HRESULT hr;
m_efb.slices = 1;
m_efb.slices = (g_ActiveConfig.iStereoMode > 0) ? 2 : 1;
// EFB color texture - primary render target
texdesc = CD3D11_TEXTURE2D_DESC(DXGI_FORMAT_R8G8B8A8_UNORM, target_width, target_height, m_efb.slices, 1, D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET, D3D11_USAGE_DEFAULT, 0, sample_desc.Count, sample_desc.Quality);

View File

@ -173,7 +173,7 @@ bool LineGeometryShader::SetShader(u32 components, float lineWidth,
static char buffer[16384];
ShaderCode code;
code.SetBuffer(buffer);
GenerateVSOutputStruct(code, API_D3D);
GenerateVSOutputStruct<ShaderCode>(code, API_D3D);
code.Write("\n%s", LINE_GS_COMMON);
std::stringstream numTexCoordsStream;

View File

@ -167,7 +167,7 @@ bool PointGeometryShader::SetShader(u32 components, float pointSize,
static char buffer[16384];
ShaderCode code;
code.SetBuffer(buffer);
GenerateVSOutputStruct(code, API_D3D);
GenerateVSOutputStruct<ShaderCode>(code, API_D3D);
code.Write("\n%s", POINT_GS_COMMON);
std::stringstream numTexCoordsStream;

View File

@ -214,10 +214,20 @@ void VertexManager::vFlush(bool useDstAlpha)
GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set pixel shader\n");});
return;
}
if (g_ActiveConfig.iStereoMode > 0)
{
if (!GeometryShaderCache::SetShader(components))
{
GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR, true, { printf("Fail to set pixel shader\n"); });
}
}
if (g_ActiveConfig.backend_info.bSupportsBBox && BoundingBox::active)
{
D3D::context->OMSetRenderTargetsAndUnorderedAccessViews(D3D11_KEEP_RENDER_TARGETS_AND_DEPTH_STENCIL, nullptr, nullptr, 2, 1, &BBox::GetUAV(), nullptr);
}
u32 stride = VertexLoaderManager::GetCurrentVertexFormat()->GetVertexStride();
PrepareDrawBuffers(stride);

View File

@ -79,7 +79,8 @@ void InitBackendInfo()
g_Config.backend_info.bSupportsDualSourceBlend = true;
g_Config.backend_info.bSupportsPrimitiveRestart = true;
g_Config.backend_info.bSupportsOversizedViewports = false;
g_Config.backend_info.bSupportsStereoscopy = false; // TODO: not implemented
g_Config.backend_info.bSupportsStereoscopy = true;
g_Config.backend_info.bSupportsGSInstancing = false;
IDXGIFactory* factory;
IDXGIAdapter* ad;