feat(gx): add initial d3d backend

This commit is contained in:
fallenoak 2023-03-05 11:55:12 -06:00 committed by GitHub
parent 1ab29701af
commit 2010aa8e4e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 226 additions and 3 deletions

View file

@ -0,0 +1,41 @@
#ifndef GX_D3D_C_GX_DEVICE_D3D_HPP
#define GX_D3D_C_GX_DEVICE_D3D_HPP
#include "gx/CGxDevice.hpp"
#include <cstdint>
#include <d3d9.h>
#include <windows.h>
class CGxDeviceD3d : public CGxDevice {
public:
// Static functions
static int32_t ILoadD3dLib(HINSTANCE& d3dLib, LPDIRECT3D9& d3d);
static void IUnloadD3dLib(HINSTANCE& d3dLib, LPDIRECT3D9& d3d);
static LRESULT WindowProcD3d(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
// Member variables
ATOM m_hwndClass;
int32_t m_ownhwnd;
HINSTANCE m_d3dLib;
LPDIRECT3D9 m_d3d;
LPDIRECT3DDEVICE9 m_d3dDevice;
D3DCAPS9 m_d3dCaps;
D3DDISPLAYMODE m_desktopDisplayMode;
// Virtual member functions
virtual void ITexMarkAsUpdated(CGxTex* texId);
virtual void IRsSendToHw(EGxRenderState rs);
virtual int32_t DeviceCreate(long (*windowProc)(void*, uint32_t, uint32_t, long), const CGxFormat& format);
virtual void CapsWindowSize(CRect& dst);
virtual void CapsWindowSizeInScreenCoords(CRect& dst);
virtual void PoolSizeSet(CGxPool* pool, uint32_t size);
virtual void IShaderCreate(CGxShader* shader);
virtual int32_t StereoEnabled();
// Member functions
int32_t ICreateD3d();
void IDestroyD3d();
void IDestroyD3dDevice();
};
#endif