Merge pull request #9707 from unknownbrackets/softgpu-d3d9

SoftGPU: Fix rendering when using Direct3D 9
This commit is contained in:
Henrik Rydgård 2017-05-21 12:32:44 +02:00 committed by GitHub
commit 13e7dae72d
3 changed files with 13 additions and 16 deletions

View file

@ -169,7 +169,7 @@ void EmuScreen::bootGame(const std::string &filename) {
break;
case GPUBackend::VULKAN:
coreParam.gpuCore = GPUCORE_VULKAN;
if (g_Config.iRenderingMode != FB_NON_BUFFERED_MODE) {
if (g_Config.iRenderingMode != FB_NON_BUFFERED_MODE && !g_Config.bSoftwareRendering) {
#ifdef _WIN32
if (IDYES == MessageBox(MainWindow::GetHWND(), L"The Vulkan backend is not yet compatible with buffered rendering. Switch to non-buffered (WARNING: This will cause glitches with the other backends unless you switch back)", L"Vulkan Experimental Support", MB_ICONINFORMATION | MB_YESNO)) {
g_Config.iRenderingMode = FB_NON_BUFFERED_MODE;

View file

@ -925,23 +925,19 @@ void D3D9Context::Clear(int mask, uint32_t colorval, float depthVal, int stencil
}
void D3D9Context::SetScissorRect(int left, int top, int width, int height) {
RECT rc;
rc.left = left;
rc.top = top;
rc.right = left + width;
rc.bottom = top + height;
device_->SetScissorRect(&rc);
using namespace DX9;
dxstate.scissorRect.set(left, top, left + width, top + height);
}
void D3D9Context::SetViewports(int count, Viewport *viewports) {
D3DVIEWPORT9 vp;
vp.X = (DWORD)viewports[0].TopLeftX;
vp.Y = (DWORD)viewports[0].TopLeftY;
vp.Width = (DWORD)viewports[0].Width;
vp.Height = (DWORD)viewports[0].Height;
vp.MinZ = viewports[0].MinDepth;
vp.MaxZ = viewports[0].MaxDepth;
device_->SetViewport(&vp);
using namespace DX9;
int x = (int)viewports[0].TopLeftX;
int y = (int)viewports[0].TopLeftY;
int w = (int)viewports[0].Width;
int h = (int)viewports[0].Height;
dxstate.viewport.set(x, y, w, h, viewports[0].MinDepth, viewports[0].MaxDepth);
}
void D3D9Context::SetBlendFactor(float color[4]) {
@ -1193,4 +1189,4 @@ uint32_t D3D9Context::GetDataFormatSupport(DataFormat fmt) const {
}
} // namespace Draw
} // namespace Draw

View file

@ -1537,6 +1537,7 @@ void OpenGLContext::BindFramebufferAsRenderTarget(Framebuffer *fbo) {
// in ES 2.0 that actually separate them anyway of course, so doesn't matter.
fbo_bind_fb_target(false, fb->handle);
// Always restore viewport after render target binding
// TODO: Should we set viewports this way too?
glstate.viewport.restore();
CHECK_GL_ERROR_IF_DEBUG();
}