1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-18 11:52:12 +01:00

[d3d11] Implement GetDC / ReleaseDC

This commit is contained in:
Philip Rebohle 2019-06-15 10:28:49 +02:00
parent 028633138a
commit e82c87dc52
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 24 additions and 15 deletions

View File

@ -1,4 +1,5 @@
#include "d3d11_device.h"
#include "d3d11_gdi.h"
#include "d3d11_texture.h"
namespace dxvk {
@ -279,6 +280,13 @@ namespace dxvk {
if (FAILED(DecodeSampleCount(pDesc->SampleDesc.Count, nullptr)))
return E_INVALIDARG;
if ((pDesc->MiscFlags & D3D11_RESOURCE_MISC_GDI_COMPATIBLE)
&& (pDesc->Usage == D3D11_USAGE_STAGING
|| (pDesc->Format != DXGI_FORMAT_B8G8R8A8_TYPELESS
&& pDesc->Format != DXGI_FORMAT_B8G8R8A8_UNORM
&& pDesc->Format != DXGI_FORMAT_B8G8R8A8_UNORM_SRGB)))
return E_INVALIDARG;
if ((pDesc->MiscFlags & D3D11_RESOURCE_MISC_GENERATE_MIPS)
&& (pDesc->BindFlags & (D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET))
!= (D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET))
@ -520,14 +528,17 @@ namespace dxvk {
D3D11DXGISurface::D3D11DXGISurface(
ID3D11Resource* pResource,
D3D11CommonTexture* pTexture)
: m_resource(pResource),
m_texture (pTexture) {
: m_resource (pResource),
m_texture (pTexture),
m_gdiSurface(nullptr) {
if (pTexture->Desc()->MiscFlags & D3D11_RESOURCE_MISC_GDI_COMPATIBLE)
m_gdiSurface = new D3D11GDISurface(m_resource, 0);
}
D3D11DXGISurface::~D3D11DXGISurface() {
if (m_gdiSurface)
delete m_gdiSurface;
}
@ -656,23 +667,19 @@ namespace dxvk {
HRESULT STDMETHODCALLTYPE D3D11DXGISurface::GetDC(
BOOL Discard,
HDC* phdc) {
static bool s_errorShown = false;
if (!std::exchange(s_errorShown, true))
Logger::err("D3D11DXGISurface::GetDC: Stub");
return E_NOTIMPL;
if (!m_gdiSurface)
return DXGI_ERROR_INVALID_CALL;
return m_gdiSurface->Acquire(Discard, phdc);
}
HRESULT STDMETHODCALLTYPE D3D11DXGISurface::ReleaseDC(
RECT* pDirtyRect) {
static bool s_errorShown = false;
if (!m_gdiSurface)
return DXGI_ERROR_INVALID_CALL;
if (!std::exchange(s_errorShown, true))
Logger::err("D3D11DXGISurface::ReleaseDC: Stub");
return E_NOTIMPL;
return m_gdiSurface->Release(pDirtyRect);
}

View File

@ -11,6 +11,7 @@
namespace dxvk {
class D3D11Device;
class D3D11GDISurface;
/**
* \brief Image memory mapping mode
@ -318,6 +319,7 @@ namespace dxvk {
ID3D11Resource* m_resource;
D3D11CommonTexture* m_texture;
D3D11GDISurface* m_gdiSurface;
};