Skip to content

Commit

Permalink
[dxgi] Implement IDXGISwapChain3
Browse files Browse the repository at this point in the history
- Stub IDXGISwapChain3::ResizeBuffers1
  • Loading branch information
doitsujin committed Nov 15, 2018
1 parent 81bb561 commit c25483e
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 2 deletions.
42 changes: 41 additions & 1 deletion src/dxgi/dxgi_swapchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ namespace dxvk {
|| riid == __uuidof(IDXGIDeviceSubObject)
|| riid == __uuidof(IDXGISwapChain)
|| riid == __uuidof(IDXGISwapChain1)
|| riid == __uuidof(IDXGISwapChain2)) {
|| riid == __uuidof(IDXGISwapChain2)
|| riid == __uuidof(IDXGISwapChain3)) {
*ppvObject = ref(this);
return S_OK;
}
Expand All @@ -83,6 +84,11 @@ namespace dxvk {
HRESULT STDMETHODCALLTYPE DxgiSwapChain::GetBuffer(UINT Buffer, REFIID riid, void** ppSurface) {
return m_presenter->GetImage(Buffer, riid, ppSurface);
}


UINT STDMETHODCALLTYPE DxgiSwapChain::GetCurrentBackBufferIndex() {
return m_presenter->GetImageIndex();
}


HRESULT STDMETHODCALLTYPE DxgiSwapChain::GetContainingOutput(IDXGIOutput** ppOutput) {
Expand Down Expand Up @@ -302,6 +308,24 @@ namespace dxvk {
}


HRESULT STDMETHODCALLTYPE DxgiSwapChain::ResizeBuffers1(
UINT BufferCount,
UINT Width,
UINT Height,
DXGI_FORMAT Format,
UINT SwapChainFlags,
const UINT* pCreationNodeMask,
IUnknown* const* ppPresentQueue) {
static bool s_errorShown = false;

if (!std::exchange(s_errorShown, true))
Logger::warn("DxgiSwapChain::ResizeBuffers1: Stub");

return ResizeBuffers(BufferCount,
Width, Height, Format, SwapChainFlags);
}


HRESULT STDMETHODCALLTYPE DxgiSwapChain::ResizeTarget(const DXGI_MODE_DESC* pNewTargetParameters) {
std::lock_guard<std::mutex> lock(m_lockWindow);

Expand Down Expand Up @@ -448,6 +472,22 @@ namespace dxvk {
}


HRESULT STDMETHODCALLTYPE DxgiSwapChain::CheckColorSpaceSupport(
DXGI_COLOR_SPACE_TYPE ColorSpace,
UINT* pColorSpaceSupport) {
Logger::err("DxgiSwapChain::CheckColorSpaceSupport: Not implemented");

*pColorSpaceSupport = 0;
return E_NOTIMPL;
}


HRESULT DxgiSwapChain::SetColorSpace1(DXGI_COLOR_SPACE_TYPE ColorSpace) {
Logger::err("DxgiSwapChain::SetColorSpace1: Not implemented");
return E_NOTIMPL;
}


HRESULT DxgiSwapChain::SetGammaControl(const DXGI_GAMMA_CONTROL* pGammaControl) {
return m_presenter->SetGammaControl(DXGI_VK_GAMMA_CP_COUNT, pGammaControl->GammaCurve);
}
Expand Down
20 changes: 19 additions & 1 deletion src/dxgi/dxgi_swapchain.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace dxvk {
class DxgiFactory;
class DxgiOutput;

class DxgiSwapChain : public DxgiObject<IDXGISwapChain2> {
class DxgiSwapChain : public DxgiObject<IDXGISwapChain3> {

public:

Expand Down Expand Up @@ -49,6 +49,8 @@ namespace dxvk {
REFIID riid,
void** ppSurface) final;

UINT STDMETHODCALLTYPE GetCurrentBackBufferIndex() final;

HRESULT STDMETHODCALLTYPE GetContainingOutput(
IDXGIOutput** ppOutput) final;

Expand Down Expand Up @@ -105,6 +107,15 @@ namespace dxvk {
DXGI_FORMAT NewFormat,
UINT SwapChainFlags) final;

HRESULT STDMETHODCALLTYPE ResizeBuffers1(
UINT BufferCount,
UINT Width,
UINT Height,
DXGI_FORMAT Format,
UINT SwapChainFlags,
const UINT* pCreationNodeMask,
IUnknown* const* ppPresentQueue) final;

HRESULT STDMETHODCALLTYPE ResizeTarget(
const DXGI_MODE_DESC* pNewTargetParameters) final;

Expand Down Expand Up @@ -139,6 +150,13 @@ namespace dxvk {
HRESULT STDMETHODCALLTYPE SetSourceSize(
UINT Width,
UINT Height) final;

HRESULT STDMETHODCALLTYPE CheckColorSpaceSupport(
DXGI_COLOR_SPACE_TYPE ColorSpace,
UINT* pColorSpaceSupport) final;

HRESULT STDMETHODCALLTYPE SetColorSpace1(
DXGI_COLOR_SPACE_TYPE ColorSpace) final;

HRESULT SetGammaControl(
const DXGI_GAMMA_CONTROL* pGammaControl);
Expand Down

0 comments on commit c25483e

Please sign in to comment.