From 84d82f360b53ab98478f61e333c7e402666fb56c Mon Sep 17 00:00:00 2001 From: Flyinghead Date: Sun, 24 Sep 2023 11:04:24 +0200 Subject: [PATCH] dx11: black screen with full fb emu when scaling. dx9: fb render fix dx11: black screen when full framebuffer emulation is enabled if scaling is on (480 -> 240p) Fixes Mr.Driller. Issue #1067 dx9: wrong stretching when rendering the dc framebuffer if aspect ratio different from 4:3 --- core/rend/dx11/dx11_renderer.cpp | 5 +++-- core/rend/dx9/d3d_renderer.cpp | 4 +--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/core/rend/dx11/dx11_renderer.cpp b/core/rend/dx11/dx11_renderer.cpp index d38473133..994f34d85 100644 --- a/core/rend/dx11/dx11_renderer.cpp +++ b/core/rend/dx11/dx11_renderer.cpp @@ -1258,9 +1258,10 @@ void DX11Renderer::writeFramebufferToVRAM() viewDesc.Texture2D.MipLevels = 1; device->CreateShaderResourceView(fbScaledTexture, &viewDesc, &fbScaledTextureView.get()); } + deviceContext->OMSetRenderTargets(1, &fbScaledRenderTarget.get(), nullptr); D3D11_VIEWPORT vp{}; - vp.Width = (FLOAT)width; - vp.Height = (FLOAT)height; + vp.Width = (FLOAT)scaledW; + vp.Height = (FLOAT)scaledH; vp.MinDepth = 0.f; vp.MaxDepth = 1.f; deviceContext->RSSetViewports(1, &vp); diff --git a/core/rend/dx9/d3d_renderer.cpp b/core/rend/dx9/d3d_renderer.cpp index 0e2cc762d..82679e7b2 100644 --- a/core/rend/dx9/d3d_renderer.cpp +++ b/core/rend/dx9/d3d_renderer.cpp @@ -296,9 +296,7 @@ void D3DRenderer::RenderFramebuffer(const FramebufferInfo& info) devCache.SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE); device->ColorFill(framebufferSurface, 0, D3DCOLOR_ARGB(255, info.vo_border_col._red, info.vo_border_col._green, info.vo_border_col._blue)); - u32 bar = (this->width - this->height * 640 / 480) / 2; - RECT rd{ (LONG)bar, 0, (LONG)(this->width - bar), (LONG)this->height }; - device->StretchRect(dcfbSurface, nullptr, framebufferSurface, &rd, D3DTEXF_LINEAR); + device->StretchRect(dcfbSurface, nullptr, framebufferSurface, nullptr, D3DTEXF_LINEAR); aspectRatio = getDCFramebufferAspectRatio(); displayFramebuffer();