From 681241deb568974085d11ea6eff1580ce0eb3356 Mon Sep 17 00:00:00 2001 From: OV2 Date: Tue, 18 Dec 2012 21:17:08 +0100 Subject: [PATCH] win32: fall back to software vertex processing if d3d9 init fails --- gfx/d3d9/d3d9.cpp | 14 +++++++++++++- gfx/d3d9/render_chain.cpp | 4 ++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/gfx/d3d9/d3d9.cpp b/gfx/d3d9/d3d9.cpp index 08ab8db68d..4085f79971 100644 --- a/gfx/d3d9/d3d9.cpp +++ b/gfx/d3d9/d3d9.cpp @@ -119,7 +119,19 @@ void D3DVideo::init_base(const video_info_t &info) &d3dpp, &dev))) { - throw std::runtime_error("Failed to init device"); + RARCH_WARN("[D3D9]: Failed to init device with hardware vertex processing (code: 0x%x). Trying to fall back to software vertex processing.\n", + (unsigned)Callback::d3d_err); + + if (FAILED(Callback::d3d_err = g_pD3D->CreateDevice( + Monitor::cur_mon_id, + D3DDEVTYPE_HAL, + hWnd, + D3DCREATE_SOFTWARE_VERTEXPROCESSING, + &d3dpp, + &dev))) + { + throw std::runtime_error("Failed to init device"); + } } } diff --git a/gfx/d3d9/render_chain.cpp b/gfx/d3d9/render_chain.cpp index 40a869d63a..a5814325cb 100644 --- a/gfx/d3d9/render_chain.cpp +++ b/gfx/d3d9/render_chain.cpp @@ -101,7 +101,7 @@ void RenderChain::add_pass(const LinkInfo &info) if (FAILED(dev->CreateVertexBuffer( 4 * sizeof(Vertex), - 0, + dev->GetSoftwareVertexProcessing() ? D3DUSAGE_SOFTWAREPROCESSING : 0, FVF, D3DPOOL_DEFAULT, &pass.vertex_buf, @@ -279,7 +279,7 @@ void RenderChain::create_first_pass(const LinkInfo &info, PixelFormat fmt) if (FAILED(dev->CreateVertexBuffer( 4 * sizeof(Vertex), - 0, + dev->GetSoftwareVertexProcessing() ? D3DUSAGE_SOFTWAREPROCESSING : 0, FVF, D3DPOOL_DEFAULT, &prev.vertex_buf[i],