mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-18 02:52:10 +01:00
[dxgi] Added DxgiSwapChain stub
This commit is contained in:
parent
90c3e21c17
commit
89a70b132d
@ -46,7 +46,17 @@ namespace dxvk {
|
||||
DXGI_SWAP_CHAIN_DESC* pDesc,
|
||||
IDXGISwapChain** ppSwapChain) {
|
||||
TRACE(this, pDevice, pDesc, ppSwapChain);
|
||||
return DXGI_ERROR_UNSUPPORTED;
|
||||
|
||||
if (ppSwapChain == nullptr || pDesc == nullptr)
|
||||
return E_INVALIDARG;
|
||||
|
||||
try {
|
||||
*ppSwapChain = ref(new DxgiSwapChain(this, pDevice, pDesc));
|
||||
return S_OK;
|
||||
} catch (const DxvkError& e) {
|
||||
Logger::err(e.message());
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,109 @@
|
||||
#include <dxvk_swapchain.h>
|
||||
|
||||
#include "dxgi_factory.h"
|
||||
#include "dxgi_swapchain.h"
|
||||
|
||||
namespace dxvk {
|
||||
|
||||
DxgiSwapChain::DxgiSwapChain(
|
||||
DxgiFactory* factory,
|
||||
IUnknown* pDevice,
|
||||
DXGI_SWAP_CHAIN_DESC* pDesc) {
|
||||
TRACE(this, factory, pDevice);
|
||||
}
|
||||
|
||||
|
||||
DxgiSwapChain::~DxgiSwapChain() {
|
||||
TRACE(this);
|
||||
}
|
||||
|
||||
|
||||
HRESULT DxgiSwapChain::QueryInterface(REFIID riid, void** ppvObject) {
|
||||
COM_QUERY_IFACE(riid, ppvObject, IDXGISwapChain);
|
||||
|
||||
Logger::warn("DxgiSwapChain::QueryInterface: Unknown interface query");
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
|
||||
HRESULT DxgiSwapChain::GetParent(REFIID riid, void** ppParent) {
|
||||
Logger::err("DxgiSwapChain::GetParent: Not implemented");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
||||
HRESULT DxgiSwapChain::GetDevice(REFIID riid, void** ppDevice) {
|
||||
Logger::err("DxgiSwapChain::GetDevice: Not implemented");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
||||
HRESULT DxgiSwapChain::GetBuffer(UINT Buffer, REFIID riid, void** ppSurface) {
|
||||
Logger::err("DxgiSwapChain::GetBuffer: Not implemented");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
||||
HRESULT DxgiSwapChain::GetContainingOutput(IDXGIOutput** ppOutput) {
|
||||
Logger::err("DxgiSwapChain::GetContainingOutput: Not implemented");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
||||
HRESULT DxgiSwapChain::GetDesc(DXGI_SWAP_CHAIN_DESC* pDesc) {
|
||||
Logger::err("DxgiSwapChain::GetDesc: Not implemented");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
||||
HRESULT DxgiSwapChain::GetFrameStatistics(DXGI_FRAME_STATISTICS* pStats) {
|
||||
Logger::err("DxgiSwapChain::GetFrameStatistics: Not implemented");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
||||
HRESULT DxgiSwapChain::GetFullscreenState(
|
||||
BOOL* pFullscreen,
|
||||
IDXGIOutput** ppTarget) {
|
||||
Logger::err("DxgiSwapChain::GetFullscreenState: Not implemented");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
||||
HRESULT DxgiSwapChain::GetLastPresentCount(UINT* pLastPresentCount) {
|
||||
Logger::err("DxgiSwapChain::GetLastPresentCount: Not implemented");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
||||
HRESULT DxgiSwapChain::Present(UINT SyncInterval, UINT Flags) {
|
||||
Logger::err("DxgiSwapChain::Present: Not implemented");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
||||
HRESULT DxgiSwapChain::ResizeBuffers(
|
||||
UINT BufferCount,
|
||||
UINT Width,
|
||||
UINT Height,
|
||||
DXGI_FORMAT NewFormat,
|
||||
UINT SwapChainFlags) {
|
||||
Logger::err("DxgiSwapChain::ResizeBuffers: Not implemented");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
||||
HRESULT DxgiSwapChain::ResizeTarget(const DXGI_MODE_DESC* pNewTargetParameters) {
|
||||
Logger::err("DxgiSwapChain::ResizeTarget: Not implemented");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
||||
HRESULT DxgiSwapChain::SetFullscreenState(
|
||||
BOOL Fullscreen,
|
||||
IDXGIOutput* pTarget) {
|
||||
Logger::err("DxgiSwapChain::SetFullscreenState: Not implemented");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
#include "dxgi_interfaces.h"
|
||||
#include "dxgi_object.h"
|
||||
|
||||
namespace dxvk {
|
||||
|
||||
class DxgiFactory;
|
||||
|
||||
class DxgiSwapChain : public DxgiObject<IDXGISwapChain> {
|
||||
|
||||
public:
|
||||
|
||||
DxgiSwapChain(
|
||||
DxgiFactory* factory,
|
||||
IUnknown* pDevice,
|
||||
DXGI_SWAP_CHAIN_DESC* pDesc);
|
||||
~DxgiSwapChain();
|
||||
|
||||
HRESULT QueryInterface(
|
||||
REFIID riid,
|
||||
void** ppvObject) final;
|
||||
|
||||
HRESULT GetParent(
|
||||
REFIID riid,
|
||||
void** ppParent) final;
|
||||
|
||||
HRESULT GetDevice(
|
||||
REFIID riid,
|
||||
void** ppDevice) final;
|
||||
|
||||
HRESULT GetBuffer(
|
||||
UINT Buffer,
|
||||
REFIID riid,
|
||||
void** ppSurface) final;
|
||||
|
||||
HRESULT GetContainingOutput(
|
||||
IDXGIOutput **ppOutput) final;
|
||||
|
||||
HRESULT GetDesc(
|
||||
DXGI_SWAP_CHAIN_DESC *pDesc) final;
|
||||
|
||||
HRESULT GetFrameStatistics(
|
||||
DXGI_FRAME_STATISTICS *pStats) final;
|
||||
|
||||
HRESULT GetFullscreenState(
|
||||
BOOL *pFullscreen,
|
||||
IDXGIOutput **ppTarget) final;
|
||||
|
||||
HRESULT GetLastPresentCount(
|
||||
UINT *pLastPresentCount) final;
|
||||
|
||||
HRESULT Present(
|
||||
UINT SyncInterval,
|
||||
UINT Flags) final;
|
||||
|
||||
HRESULT ResizeBuffers(
|
||||
UINT BufferCount,
|
||||
UINT Width,
|
||||
UINT Height,
|
||||
DXGI_FORMAT NewFormat,
|
||||
UINT SwapChainFlags) final;
|
||||
|
||||
HRESULT ResizeTarget(
|
||||
const DXGI_MODE_DESC *pNewTargetParameters) final;
|
||||
|
||||
HRESULT SetFullscreenState(
|
||||
BOOL Fullscreen,
|
||||
IDXGIOutput *pTarget) final;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
@ -28,6 +28,26 @@ public:
|
||||
|
||||
if (FAILED(status))
|
||||
throw DxvkError("Failed to create D3D11 device");
|
||||
|
||||
DXGI_SWAP_CHAIN_DESC swapDesc;
|
||||
swapDesc.BufferDesc.Width = 1024;
|
||||
swapDesc.BufferDesc.Height = 600;
|
||||
swapDesc.BufferDesc.RefreshRate = { 60, 0 };
|
||||
swapDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
swapDesc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
|
||||
swapDesc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
|
||||
swapDesc.SampleDesc.Count = 1;
|
||||
swapDesc.SampleDesc.Quality = 0;
|
||||
swapDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
|
||||
swapDesc.BufferCount = 1;
|
||||
swapDesc.OutputWindow = window;
|
||||
swapDesc.Windowed = true;
|
||||
swapDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
|
||||
swapDesc.Flags = 0;
|
||||
|
||||
if (FAILED(m_factory->CreateSwapChain(m_device.ptr(), &swapDesc, &m_swapChain)))
|
||||
throw DxvkError("Failed to create DXGI swap chain");
|
||||
|
||||
}
|
||||
|
||||
~TriangleApp() {
|
||||
@ -44,6 +64,7 @@ private:
|
||||
Com<IDXGIAdapter> m_adapter;
|
||||
Com<ID3D11Device> m_device;
|
||||
Com<ID3D11DeviceContext> m_context;
|
||||
Com<IDXGISwapChain> m_swapChain;
|
||||
|
||||
D3D_FEATURE_LEVEL m_featureLevel;
|
||||
|
||||
@ -84,9 +105,9 @@ int WINAPI WinMain(HINSTANCE hInstance,
|
||||
|
||||
MSG msg;
|
||||
|
||||
TriangleApp app(hInstance, hWnd);
|
||||
|
||||
try {
|
||||
TriangleApp app(hInstance, hWnd);
|
||||
|
||||
while (true) {
|
||||
if (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) {
|
||||
TranslateMessage(&msg);
|
||||
|
Loading…
x
Reference in New Issue
Block a user