D3D: Add quad-buffer stereoscopy support.

This commit is contained in:
Jules Blok 2017-06-25 21:08:17 +02:00
parent 6863abb31d
commit 179602e921
4 changed files with 13 additions and 7 deletions

View File

@ -622,8 +622,8 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
szr_stereo->Add(new wxStaticText(page_enh, wxID_ANY, _("Stereoscopic 3D Mode:")), 0,
wxALIGN_CENTER_VERTICAL);
const wxString stereo_choices[] = {_("Off"), _("Side-by-Side"), _("Top-and-Bottom"),
_("Anaglyph"), _("Nvidia 3D Vision")};
const wxString stereo_choices[] = {_("Off"), _("Side-by-Side"), _("Top-and-Bottom"),
_("Anaglyph"), _("Quad-Buffer"), _("Nvidia 3D Vision")};
wxChoice* stereo_choice =
CreateChoice(page_enh, Config::GFX_STEREO_MODE, wxGetTranslation(stereo_3d_desc),
vconfig.backend_info.bSupports3DVision ? ArraySize(stereo_choices) :

View File

@ -303,6 +303,7 @@ HRESULT Create(HWND wnd)
swap_chain_desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
swap_chain_desc.Width = xres;
swap_chain_desc.Height = yres;
swap_chain_desc.Stereo = g_ActiveConfig.iStereoMode == STEREO_QUADBUFFER;
#if defined(_DEBUG) || defined(DEBUGFAST)
// Creating debug devices can sometimes fail if the user doesn't have the correct

View File

@ -1220,12 +1220,16 @@ void Renderer::BlitScreen(TargetRectangle src, TargetRectangle dst, D3DTexture2D
D3D11_VIEWPORT vp = CD3D11_VIEWPORT((float)dst.left, (float)dst.top, (float)dst.GetWidth(),
(float)dst.GetHeight());
D3D::context->RSSetViewports(1, &vp);
D3D::drawShadedTexQuad(src_texture->GetSRV(), src.AsRECT(), src_width, src_height,
(g_Config.iStereoMode == STEREO_ANAGLYPH) ?
PixelShaderCache::GetAnaglyphProgram() :
PixelShaderCache::GetColorCopyProgram(false),
ID3D11PixelShader* pixelShader = (g_Config.iStereoMode == STEREO_ANAGLYPH) ?
PixelShaderCache::GetAnaglyphProgram() :
PixelShaderCache::GetColorCopyProgram(false);
ID3D11GeometryShader* geomShader = (g_ActiveConfig.iStereoMode == STEREO_QUADBUFFER) ?
GeometryShaderCache::GetCopyGeometryShader() :
nullptr;
D3D::drawShadedTexQuad(src_texture->GetSRV(), src.AsRECT(), src_width, src_height, pixelShader,
VertexShaderCache::GetSimpleVertexShader(),
VertexShaderCache::GetSimpleInputLayout(), nullptr, Gamma);
VertexShaderCache::GetSimpleInputLayout(), geomShader, Gamma);
}
}

View File

@ -47,6 +47,7 @@ enum StereoMode
STEREO_SBS,
STEREO_TAB,
STEREO_ANAGLYPH,
STEREO_QUADBUFFER,
STEREO_3DVISION
};