DXGL r118 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r117‎ | r118 | r119 >
Date:20:02, 8 March 2012
Author:admin
Status:new
Tags:
Comment:
Add GetCaps, GetRenderTarget, and SetRenderTarget to IDirect3DDevice7 interface
Modified paths:
  • /ddraw/glDirect3D.h (modified) (history)
  • /ddraw/glDirect3DDevice.cpp (modified) (history)

Diff [purge]

Index: ddraw/glDirect3D.h
@@ -19,6 +19,7 @@
2020 #ifndef __GLDIRECT3D_H
2121 #define __GLDIRECT3D_H
2222
 23+extern D3DDEVICEDESC7 d3ddesc;
2324 class glDirectDraw7;
2425
2526 class glDirect3D7 : public IDirect3D7
Index: ddraw/glDirect3DDevice.cpp
@@ -477,8 +477,11 @@
478478 HRESULT WINAPI glDirect3DDevice7::GetCaps(LPD3DDEVICEDESC7 lpD3DDevDesc)
479479 {
480480 if(!this) return DDERR_INVALIDPARAMS;
481 - FIXME("glDirect3DDevice7::GetCaps: stub");
482 - ERR(DDERR_GENERIC);
 481+ D3DDEVICEDESC7 desc = d3ddesc;
 482+ desc.dwDevCaps |= D3DDEVCAPS_HWRASTERIZATION | D3DDEVCAPS_HWTRANSFORMANDLIGHT;
 483+ desc.deviceGUID = IID_IDirect3DTnLHalDevice;
 484+ memcpy(lpD3DDevDesc,&desc,sizeof(D3DDEVICEDESC7));
 485+ return D3D_OK;
483486 }
484487 HRESULT WINAPI glDirect3DDevice7::GetClipPlane(DWORD dwIndex, D3DVALUE *pPlaneEquation)
485488 {
@@ -536,8 +539,9 @@
537540 HRESULT WINAPI glDirect3DDevice7::GetRenderTarget(LPDIRECTDRAWSURFACE7 *lplpRenderTarget)
538541 {
539542 if(!this) return DDERR_INVALIDPARAMS;
540 - FIXME("glDirect3DDevice7::GetRenderTarget: stub");
541 - ERR(DDERR_GENERIC);
 543+ if(!lplpRenderTarget) return DDERR_INVALIDPARAMS;
 544+ *lplpRenderTarget = glDDS7;
 545+ return D3D_OK;
542546 }
543547 HRESULT WINAPI glDirect3DDevice7::GetStateData(DWORD dwState, LPVOID* lplpStateData)
544548 {
@@ -682,8 +686,16 @@
683687 HRESULT WINAPI glDirect3DDevice7::SetRenderTarget(LPDIRECTDRAWSURFACE7 lpNewRenderTarget, DWORD dwFlags)
684688 {
685689 if(!this) return DDERR_INVALIDPARAMS;
686 - FIXME("glDirect3DDevice7::SetRenderTarget: stub");
687 - ERR(DDERR_GENERIC);
 690+ if(!lpNewRenderTarget) return DDERR_INVALIDPARAMS;
 691+ if(dwFlags) return DDERR_INVALIDPARAMS;
 692+ DDSURFACEDESC2 ddsd;
 693+ ddsd.dwSize = sizeof(DDSURFACEDESC2);
 694+ lpNewRenderTarget->GetSurfaceDesc(&ddsd);
 695+ if(!(ddsd.ddsCaps.dwCaps & DDSCAPS_3DDEVICE)) return DDERR_INVALIDSURFACETYPE;
 696+ glDDS7->Release();
 697+ glDDS7 = (glDirectDrawSurface7*)lpNewRenderTarget;
 698+ glDDS7->AddRef();
 699+ return D3D_OK;
688700 }
689701 HRESULT WINAPI glDirect3DDevice7::SetStateData(DWORD dwState, LPVOID lpStateData)
690702 {