2019-12-16 04:28:01 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "d3d9_subresource.h"
|
|
|
|
|
|
|
|
#include "d3d9_common_texture.h"
|
|
|
|
|
|
|
|
#include "../util/util_gdi.h"
|
|
|
|
|
2020-01-09 04:29:58 +01:00
|
|
|
#include <algorithm>
|
|
|
|
|
2019-12-16 04:28:01 +01:00
|
|
|
namespace dxvk {
|
|
|
|
|
|
|
|
using D3D9GDIDesc = D3DKMT_DESTROYDCFROMMEMORY;
|
|
|
|
|
|
|
|
using D3D9SurfaceBase = D3D9Subresource<IDirect3DSurface9>;
|
|
|
|
class D3D9Surface final : public D3D9SurfaceBase {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
D3D9Surface(
|
|
|
|
D3D9DeviceEx* pDevice,
|
2020-04-13 02:42:04 +02:00
|
|
|
const D3D9_COMMON_TEXTURE_DESC* pDesc,
|
|
|
|
IUnknown* pContainer);
|
2019-12-16 04:28:01 +01:00
|
|
|
|
|
|
|
D3D9Surface(
|
|
|
|
D3D9DeviceEx* pDevice,
|
|
|
|
D3D9CommonTexture* pTexture,
|
|
|
|
UINT Face,
|
|
|
|
UINT MipLevel,
|
2020-04-13 02:42:04 +02:00
|
|
|
IDirect3DBaseTexture9* pBaseTexture);
|
2019-12-16 04:28:01 +01:00
|
|
|
|
2020-04-18 21:40:49 +02:00
|
|
|
void AddRefPrivate(bool swapchain = false);
|
2019-12-16 04:28:01 +01:00
|
|
|
|
2020-04-18 21:40:49 +02:00
|
|
|
void ReleasePrivate(bool swapchain = false);
|
2019-12-16 04:28:01 +01:00
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
|
|
|
|
|
|
|
|
D3DRESOURCETYPE STDMETHODCALLTYPE GetType() final;
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE GetDesc(D3DSURFACE_DESC *pDesc) final;
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE LockRect(D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) final;
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE UnlockRect() final;
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE GetDC(HDC *phDC) final;
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE ReleaseDC(HDC hDC) final;
|
|
|
|
|
2020-01-09 04:29:58 +01:00
|
|
|
inline VkExtent2D GetSurfaceExtent() const {
|
|
|
|
const auto* desc = m_texture->Desc();
|
|
|
|
|
|
|
|
return VkExtent2D {
|
|
|
|
std::max(1u, desc->Width >> GetMipLevel()),
|
|
|
|
std::max(1u, desc->Height >> GetMipLevel())
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2019-12-16 04:28:01 +01:00
|
|
|
private:
|
|
|
|
|
|
|
|
D3D9GDIDesc m_dcDesc;
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|