mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-12 13:13:43 +00:00
d3d12: Enable buffer flip
This commit is contained in:
parent
0b5816d6d6
commit
4f708ab9ee
@ -38,8 +38,19 @@ D3D12GSRender::D3D12GSRender()
|
||||
check(m_device->CreateCommandQueue(©QueueDesc, IID_PPV_ARGS(&m_commandQueueCopy)));
|
||||
check(m_device->CreateCommandQueue(&graphicQueueDesc, IID_PPV_ARGS(&m_commandQueueGraphic)));
|
||||
|
||||
GSFrameBase2 *tmp = GetGSFrame();
|
||||
tmp->Show();
|
||||
m_frame = GetGSFrame();
|
||||
|
||||
DXGI_SWAP_CHAIN_DESC swapChain = {};
|
||||
swapChain.BufferCount = 2;
|
||||
swapChain.Windowed = true;
|
||||
swapChain.OutputWindow = m_frame->getHandle();
|
||||
swapChain.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
swapChain.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
|
||||
swapChain.SampleDesc.Count = 1;
|
||||
swapChain.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
|
||||
swapChain.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
|
||||
|
||||
check(dxgiFactory->CreateSwapChain(m_commandQueueGraphic, &swapChain, (IDXGISwapChain**)&m_swapChain));
|
||||
}
|
||||
|
||||
D3D12GSRender::~D3D12GSRender()
|
||||
@ -48,13 +59,14 @@ D3D12GSRender::~D3D12GSRender()
|
||||
m_commandQueueGraphic->Release();
|
||||
m_commandQueueCopy->Release();
|
||||
m_device->Release();
|
||||
m_swapChain->Release();
|
||||
}
|
||||
|
||||
void D3D12GSRender::Close()
|
||||
{
|
||||
m_frame->Hide();
|
||||
}
|
||||
|
||||
|
||||
void D3D12GSRender::InitDrawBuffers()
|
||||
{
|
||||
if (!m_fbo.IsCreated() || RSXThread::m_width != m_lastWidth || RSXThread::m_height != m_lastHeight || m_lastDepth != m_surface_depth_format)
|
||||
@ -221,6 +233,7 @@ void D3D12GSRender::InitDrawBuffers()
|
||||
|
||||
void D3D12GSRender::OnInit()
|
||||
{
|
||||
m_frame->Show();
|
||||
}
|
||||
|
||||
void D3D12GSRender::OnInitThread()
|
||||
@ -606,4 +619,5 @@ void D3D12GSRender::ExecCMD()
|
||||
|
||||
void D3D12GSRender::Flip()
|
||||
{
|
||||
check(m_swapChain->Present(1, 0));
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
virtual void SetCurrent(void* ctx) = 0;
|
||||
virtual void DeleteContext(void* ctx) = 0;
|
||||
virtual void Flip(void* ctx) = 0;
|
||||
|
||||
virtual HWND getHandle() const = 0;
|
||||
};
|
||||
|
||||
typedef GSFrameBase2*(*GetGSFrameCb2)();
|
||||
@ -65,13 +65,14 @@ private:
|
||||
ID3D12Device* m_device;
|
||||
ID3D12CommandQueue *m_commandQueueCopy;
|
||||
ID3D12CommandQueue *m_commandQueueGraphic;
|
||||
struct IDXGISwapChain3 *m_swapChain;
|
||||
|
||||
size_t m_lastWidth, m_lastHeight, m_lastDepth;
|
||||
|
||||
void* m_context;
|
||||
|
||||
public:
|
||||
// GSFrameBase* m_frame;
|
||||
GSFrameBase2 *m_frame;
|
||||
u32 m_draw_frames;
|
||||
u32 m_skip_frames;
|
||||
|
||||
|
@ -92,4 +92,9 @@ void D3DGSFrame::SetViewport(int x, int y, u32 w, u32 h)
|
||||
|
||||
glViewport(vx + x, vy + y, viewport.GetWidth(), viewport.GetHeight());
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
HWND D3DGSFrame::getHandle() const
|
||||
{
|
||||
return canvas->GetHandle();
|
||||
}
|
||||
|
@ -24,7 +24,8 @@ struct D3DGSFrame : public GSFrame, public GSFrameBase2
|
||||
|
||||
wxWindow* GetCanvas() const { return canvas; }
|
||||
|
||||
virtual void SetViewport(int x, int y, u32 w, u32 h);
|
||||
virtual void SetViewport(int x, int y, u32 w, u32 h) override;
|
||||
virtual HWND getHandle() const override;
|
||||
|
||||
private:
|
||||
virtual void OnSize(wxSizeEvent& event);
|
||||
|
Loading…
x
Reference in New Issue
Block a user