port: GrpScreen verbatim 40250 (2d draws via UIRender, D3D8 shim device-lost/Present/ID3DXMesh)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-09-30 14:40:57 +09:00
co-authored by Claude Opus 5.5
parent d73f5ea4bd
commit b5d413afa6
7 changed files with 1125 additions and 323 deletions
+11
View File
@@ -505,6 +505,9 @@ typedef enum _D3DVERTEXBLENDFLAGS {
#define D3DFVF_RESERVED2 0xE000
// d3d8.h
#define D3D_OK S_OK
// d3d8.h device-lost results (MAKE_D3DHRESULT(2152), (2153)).
#define D3DERR_DEVICELOST ((HRESULT)0x88760868L)
#define D3DERR_DEVICENOTRESET ((HRESULT)0x88760869L)
// d3d8types.h vertex shader declaration tokens
typedef enum _D3DVSD_TOKENTYPE
@@ -801,6 +804,10 @@ struct IDirect3DIndexBuffer8 : IDirect3DResource8
virtual HRESULT Unlock() = 0;
};
// wingdi.h region data; Present's dirty region is only ever NULL here.
struct _RGNDATA;
typedef struct _RGNDATA RGNDATA;
// The device methods the ported code calls (CStateManager), with D3D8's signatures. The platform
// implements it (platform/EterLib/RecordingDevice.h) as a device that records draw calls.
struct IDirect3DDevice8
@@ -813,6 +820,9 @@ struct IDirect3DDevice8
virtual HRESULT SetViewport(const D3DVIEWPORT8* pViewport) = 0;
virtual UINT GetAvailableTextureMem() = 0;
virtual void SetGammaRamp(DWORD Flags, const D3DGAMMARAMP* pRamp) = 0;
virtual HRESULT TestCooperativeLevel() = 0;
virtual HRESULT Reset(D3DPRESENT_PARAMETERS* pPresentationParameters) = 0;
virtual HRESULT Present(const RECT* pSourceRect, const RECT* pDestRect, HWND hDestWindowOverride, const RGNDATA* pDirtyRegion) = 0;
virtual HRESULT BeginScene() = 0;
virtual HRESULT EndScene() = 0;
virtual HRESULT SetTransform(D3DTRANSFORMSTATETYPE State, const D3DMATRIX* pMatrix) = 0;
@@ -834,6 +844,7 @@ struct IDirect3DDevice8
virtual HRESULT CreateVertexShader(const DWORD* pDeclaration, const DWORD* pFunction, DWORD* pHandle, DWORD Usage) = 0;
virtual HRESULT DeleteVertexShader(DWORD Handle) = 0;
virtual HRESULT SetVertexShader(DWORD Handle) = 0;
virtual HRESULT GetVertexShader(DWORD* pHandle) = 0;
virtual HRESULT SetPixelShader(DWORD Handle) = 0;
virtual HRESULT SetVertexShaderConstant(DWORD Register, const void* pConstantData, DWORD ConstantCount) = 0;
virtual HRESULT SetPixelShaderConstant(DWORD Register, const void* pConstantData, DWORD ConstantCount) = 0;
+11 -1
View File
@@ -24,7 +24,17 @@ inline HRESULT D3DXAssembleShader(const void*, UINT, DWORD, LPD3DXBUFFER* ppCons
return E_FAIL;
}
struct ID3DXMesh;
// d3dx8mesh.h ID3DXMesh: the members CScreen::RenderD3DXMesh reads.
struct ID3DXMesh
{
virtual ~ID3DXMesh() = default;
virtual ULONG Release() = 0;
virtual DWORD GetNumFaces() = 0;
virtual DWORD GetNumVertices() = 0;
virtual DWORD GetFVF() = 0;
virtual HRESULT GetVertexBuffer(LPDIRECT3DVERTEXBUFFER8* ppVB) = 0;
virtual HRESULT GetIndexBuffer(LPDIRECT3DINDEXBUFFER8* ppIB) = 0;
};
typedef ID3DXMesh* LPD3DXMESH;
struct ID3DXMatrixStack;
typedef ID3DXMatrixStack* LPD3DXMATRIXSTACK;