DXGL r51 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r50‎ | r51 | r52 >
Date:00:05, 28 December 2011
Author:admin
Status:new
Tags:
Comment:
Begin adding classes for IDirec3D7 and IDirect3DDevice7 (currently non-functional)
Modified paths:
  • /ddraw/ddraw.vcxproj (modified) (history)
  • /ddraw/ddraw.vcxproj.filters (modified) (history)
  • /ddraw/glDirect3D.cpp (added) (history)
  • /ddraw/glDirect3D.h (added) (history)
  • /ddraw/glDirect3DDevice.cpp (added) (history)
  • /ddraw/glDirect3DDevice.h (added) (history)
  • /ddraw/glDirectDraw.cpp (modified) (history)
  • /ddraw/glDirectDraw.h (modified) (history)
  • /ddraw/glDirectDrawSurface.h (modified) (history)
  • /dxgltest/Tests2D.cpp (modified) (history)
  • /dxgltest/Tests3D.cpp (added) (history)
  • /dxgltest/common.h (modified) (history)
  • /dxgltest/dxgltest.vcxproj (modified) (history)
  • /dxgltest/dxgltest.vcxproj.filters (modified) (history)
  • /dxgltest/misc.h (added) (history)
  • /dxgltest/tests.h (modified) (history)

Diff [purge]

Index: ddraw/ddraw.vcxproj
@@ -162,6 +162,8 @@
163163 <ClInclude Include="common.h" />
164164 <ClInclude Include="ddraw.h" />
165165 <ClInclude Include="glClassFactory.h" />
 166+ <ClInclude Include="glDirect3D.h" />
 167+ <ClInclude Include="glDirect3DDevice.h" />
166168 <ClInclude Include="glDirectDraw.h" />
167169 <ClInclude Include="glDirectDrawClipper.h" />
168170 <ClInclude Include="glDirectDrawPalette.h" />
@@ -199,6 +201,8 @@
200202 <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release no DXGL|Win32'">NotUsing</PrecompiledHeader>
201203 <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
202204 </ClCompile>
 205+ <ClCompile Include="glDirect3D.cpp" />
 206+ <ClCompile Include="glDirect3DDevice.cpp" />
203207 <ClCompile Include="glDirectDraw.cpp" />
204208 <ClCompile Include="glDirectDrawClipper.cpp" />
205209 <ClCompile Include="glDirectDrawPalette.cpp" />
Index: ddraw/ddraw.vcxproj.filters
@@ -74,6 +74,12 @@
7575 <ClInclude Include="glClassFactory.h">
7676 <Filter>Header Files</Filter>
7777 </ClInclude>
 78+ <ClInclude Include="glDirect3D.h">
 79+ <Filter>Header Files</Filter>
 80+ </ClInclude>
 81+ <ClInclude Include="glDirect3DDevice.h">
 82+ <Filter>Header Files</Filter>
 83+ </ClInclude>
7884 </ItemGroup>
7985 <ItemGroup>
8086 <ClCompile Include="ddraw.cpp">
@@ -112,6 +118,12 @@
113119 <ClCompile Include="glClassFactory.cpp">
114120 <Filter>Source Files</Filter>
115121 </ClCompile>
 122+ <ClCompile Include="glDirect3D.cpp">
 123+ <Filter>Source Files</Filter>
 124+ </ClCompile>
 125+ <ClCompile Include="glDirect3DDevice.cpp">
 126+ <Filter>Source Files</Filter>
 127+ </ClCompile>
116128 </ItemGroup>
117129 <ItemGroup>
118130 <ResourceCompile Include="ddraw.rc">
Index: ddraw/glDirect3D.cpp
@@ -0,0 +1,81 @@
 2+// DXGL
 3+// Copyright (C) 2011 William Feely
 4+
 5+// This library is free software; you can redistribute it and/or
 6+// modify it under the terms of the GNU Lesser General Public
 7+// License as published by the Free Software Foundation; either
 8+// version 2.1 of the License, or (at your option) any later version.
 9+
 10+// This library is distributed in the hope that it will be useful,
 11+// but WITHOUT ANY WARRANTY; without even the implied warranty of
 12+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 13+// Lesser General Public License for more details.
 14+
 15+// You should have received a copy of the GNU Lesser General Public
 16+// License along with this library; if not, write to the Free Software
 17+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 18+
 19+#include "common.h"
 20+#include "glDirect3D.h"
 21+#include "glDirect3DDevice.h"
 22+#include "glDirectDraw.h"
 23+#include "glDirectDrawSurface.h"
 24+
 25+glDirect3D7::glDirect3D7(glDirectDraw7 *glDD7)
 26+{
 27+ refcount=1;
 28+ this->glDD7 = glDD7;
 29+ glDD7->AddRef();
 30+}
 31+
 32+glDirect3D7::~glDirect3D7()
 33+{
 34+ glDD7->Release();
 35+}
 36+
 37+ULONG WINAPI glDirect3D7::AddRef()
 38+{
 39+ refcount++;
 40+ return refcount;
 41+}
 42+ULONG WINAPI glDirect3D7::Release()
 43+{
 44+ ULONG ret;
 45+ refcount--;
 46+ ret = refcount;
 47+ if(refcount == 0) delete this;
 48+ return ret;
 49+}
 50+
 51+HRESULT WINAPI glDirect3D7::QueryInterface(REFIID riid, void** ppvObj)
 52+{
 53+ FIXME("glDirect3D7::QueryInterface: stub");
 54+ return E_NOINTERFACE;
 55+}
 56+
 57+
 58+HRESULT WINAPI glDirect3D7::CreateDevice(REFCLSID rclsid, LPDIRECTDRAWSURFACE7 lpDDS, LPDIRECT3DDEVICE7 *lplpD3DDevice)
 59+{
 60+ FIXME("glDirect3D7::CreateDevice: stub");
 61+ return DDERR_GENERIC;
 62+}
 63+HRESULT WINAPI glDirect3D7::CreateVertexBuffer(LPD3DVERTEXBUFFERDESC lpVBDesc, LPDIRECT3DVERTEXBUFFER7* lplpD3DVertexBuffer, DWORD dwFlags)
 64+{
 65+ FIXME("glDirect3D7::CreateVertexBuffer: stub");
 66+ return DDERR_GENERIC;
 67+}
 68+HRESULT WINAPI glDirect3D7::EnumDevices(LPD3DENUMDEVICESCALLBACK7 lpEnumDevicesCallback, LPVOID lpUserArg)
 69+{
 70+ FIXME("glDirect3D7::EnumDevices: stub");
 71+ return DDERR_GENERIC;
 72+}
 73+HRESULT WINAPI glDirect3D7::EnumZBufferFormats(REFCLSID riidDevice, LPD3DENUMPIXELFORMATSCALLBACK lpEnumCallback, LPVOID lpContext)
 74+{
 75+ FIXME("glDirect3D7::EnumZBufferFormats: stub");
 76+ return DDERR_GENERIC;
 77+}
 78+HRESULT WINAPI glDirect3D7::EvictManagedTextures()
 79+{
 80+ FIXME("glDirect3D7::EvictManagedTextures: stub");
 81+ return DDERR_GENERIC;
 82+}
Index: ddraw/glDirect3D.h
@@ -0,0 +1,44 @@
 2+// DXGL
 3+// Copyright (C) 2011 William Feely
 4+
 5+// This library is free software; you can redistribute it and/or
 6+// modify it under the terms of the GNU Lesser General Public
 7+// License as published by the Free Software Foundation; either
 8+// version 2.1 of the License, or (at your option) any later version.
 9+
 10+// This library is distributed in the hope that it will be useful,
 11+// but WITHOUT ANY WARRANTY; without even the implied warranty of
 12+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 13+// Lesser General Public License for more details.
 14+
 15+// You should have received a copy of the GNU Lesser General Public
 16+// License along with this library; if not, write to the Free Software
 17+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 18+
 19+#pragma once
 20+#ifndef __GLDIRECT3D_H
 21+#define __GLDIRECT3D_H
 22+
 23+class glDirectDraw7;
 24+
 25+class glDirect3D7 : public IDirect3D7
 26+{
 27+public:
 28+ glDirect3D7(glDirectDraw7 *glDD7);
 29+ virtual ~glDirect3D7();
 30+ HRESULT WINAPI QueryInterface(REFIID riid, void** ppvObj);
 31+ ULONG WINAPI AddRef();
 32+ ULONG WINAPI Release();
 33+ HRESULT WINAPI CreateDevice(REFCLSID rclsid, LPDIRECTDRAWSURFACE7 lpDDS, LPDIRECT3DDEVICE7 *lplpD3DDevice);
 34+ HRESULT WINAPI CreateVertexBuffer(LPD3DVERTEXBUFFERDESC lpVBDesc, LPDIRECT3DVERTEXBUFFER7* lplpD3DVertexBuffer, DWORD dwFlags);
 35+ HRESULT WINAPI EnumDevices(LPD3DENUMDEVICESCALLBACK7 lpEnumDevicesCallback, LPVOID lpUserArg);
 36+ HRESULT WINAPI EnumZBufferFormats(REFCLSID riidDevice, LPD3DENUMPIXELFORMATSCALLBACK lpEnumCallback, LPVOID lpContext);
 37+ HRESULT WINAPI EvictManagedTextures();
 38+private:
 39+ glDirectDraw7 *glDD7;
 40+ ULONG refcount;
 41+};
 42+
 43+
 44+
 45+#endif //__GLDIRECT3D_H
\ No newline at end of file
Index: ddraw/glDirect3DDevice.cpp
@@ -0,0 +1,122 @@
 2+// DXGL
 3+// Copyright (C) 2011 William Feely
 4+
 5+// This library is free software; you can redistribute it and/or
 6+// modify it under the terms of the GNU Lesser General Public
 7+// License as published by the Free Software Foundation; either
 8+// version 2.1 of the License, or (at your option) any later version.
 9+
 10+// This library is distributed in the hope that it will be useful,
 11+// but WITHOUT ANY WARRANTY; without even the implied warranty of
 12+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 13+// Lesser General Public License for more details.
 14+
 15+// You should have received a copy of the GNU Lesser General Public
 16+// License along with this library; if not, write to the Free Software
 17+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 18+
 19+#include "common.h"
 20+#include "glDirect3D.h"
 21+#include "glDirectDrawSurface.h"
 22+#include "glDirect3DDevice.h"
 23+
 24+/*
 25+glDirect3DDevice7::glDirect3DDevice7(glDirect3D7 *glD3D7, glDirectDrawSurface7 *glDDS7)
 26+{
 27+ refcount = 1;
 28+ this->glD3D7 = glD3D7;
 29+ glD3D7->AddRef();
 30+ this->glDDS7 = glDDS7;
 31+ glDDS7->AddRef();
 32+}
 33+glDirect3DDevice7::~glDirect3DDevice7()
 34+{
 35+ glD3D7->Release();
 36+ glDDS7->Release();
 37+}
 38+
 39+HRESULT WINAPI glDirect3DDevice7::QueryInterface(REFIID riid, void** ppvObj)
 40+{
 41+ ERR(E_NOINTERFACE);
 42+}
 43+
 44+ULONG WINAPI glDirect3DDevice7::AddRef()
 45+{
 46+ refcount++;
 47+ return refcount;
 48+}
 49+ULONG WINAPI glDirect3DDevice7::Release()
 50+{
 51+ ULONG ret;
 52+ refcount--;
 53+ ret = refcount;
 54+ if(refcount == 0) delete this;
 55+ return ret;
 56+}
 57+
 58+HRESULT WINAPI glDirect3DDevice7::ApplyStateBlock(DWORD dwBlockHandle)
 59+{
 60+ FIXME("glDirect3DDevice7::ApplyStateBlock: stub");
 61+ ERR(DDERR_GENERIC);
 62+}
 63+HRESULT WINAPI glDirect3DDevice7::BeginScene()
 64+{
 65+ FIXME("glDirect3DDevice7::BeginScene: stub");
 66+ ERR(DDERR_GENERIC);
 67+}
 68+HRESULT WINAPI glDirect3DDevice7::BeginStateBlock()
 69+{
 70+ FIXME("glDirect3DDevice7::BeginStateBlock: stub");
 71+ ERR(DDERR_GENERIC);
 72+}
 73+HRESULT WINAPI glDirect3DDevice7::CaptureStateBlock(DWORD dwBlockHandle)
 74+{
 75+ FIXME("glDirectDraw::CaptureStateBlock: stub");
 76+ ERR(DDERR_GENERIC);
 77+}*/
 78+/*
 79+HRESULT WINAPI glDirect3DDevice7::CreateStateBlock(D3DSTATEBLOCKTYPE d3dsbtype, LPDWORD lpdwBlockHandle);
 80+HRESULT WINAPI glDirect3DDevice7::Clear(DWORD dwCount, LPD3DRECT lpRects, DWORD dwFlags, DWORD dwColor, D3DVALUE dvZ, DWORD dwStencil);
 81+HRESULT WINAPI glDirect3DDevice7::ComputeSphereVisibility(LPD3DVECTOR lpCenters, LPD3DVALUE lpRadii, DWORD dwNumSpheres, DWORD dwFlags, LPDWORD lpdwReturnValues);
 82+HRESULT WINAPI glDirect3DDevice7::DeleteStateBlock(DWORD dwBlockHandle);
 83+HRESULT WINAPI glDirect3DDevice7::DrawIndexedPrimitive(D3DPRIMITIVETYPE d3dptPrimitiveType, DWORD dwVertexTypeDesc, LPVOID lpvVertices, DWORD dwVertexCount, LPWORD lpwIndices, DWORD dwIndexCount, DWORD dwFlags);
 84+HRESULT WINAPI glDirect3DDevice7::DrawIndexedPrimitiveStrided(D3DPRIMITIVETYPE d3dptPrimitiveType, DWORD dwVertexTypeDesc, LPD3DDRAWPRIMITIVESTRIDEDDATA lpvVerticexArray, DWORD dwVertexCount, LPWORD lpwIndices, DWORD dwIndexCount, DWORD dwFlags);
 85+HRESULT WINAPI glDirect3DDevice7::DrawIndexedPrimitiveVB(D3DPRIMITIVETYPE d3dptPrimitiveType, LPDIRECT3DVERTEXBUFFER7 lpd3dVertexBuffer, DWORD dwStartVertex, DWORD dwNumVertices, LPWORD lpwIndices, DWORD dwIndexCount, DWORD dwFlags);
 86+HRESULT WINAPI glDirect3DDevice7::DrawPrimitive(D3DPRIMITIVETYPE dptPrimitiveType, DWORD dwVertexTypeDesc, LPVOID lpVertices, DWORD dwVertexCount, DWORD dwFlags);
 87+HRESULT WINAPI glDirect3DDevice7::DrawPrimitiveStrided(D3DPRIMITIVETYPE dptPrimitiveType, DWORD dwVertexTypeDesc, LPD3DDRAWPRIMITIVESTRIDEDDATA lpVertexArray, DWORD dwVertexCount, DWORD dwFlags);
 88+HRESULT WINAPI glDirect3DDevice7::DrawPrimitiveVB(D3DPRIMITIVETYPE d3dptPrimitiveType, LPDIRECT3DVERTEXBUFFER7 lpd3dVertexBuffer, DWORD dwStartVertex, DWORD dwNumVertices, DWORD dwFlags);
 89+HRESULT WINAPI glDirect3DDevice7::EndScene();
 90+HRESULT WINAPI glDirect3DDevice7::EndStateBlock(LPDWORD lpdwBlockHandle);
 91+HRESULT WINAPI glDirect3DDevice7::EnumTextureFormats(LPD3DENUMPIXELFORMATSCALLBACK lpd3dEnumPixelProc, LPVOID lpArg);
 92+HRESULT WINAPI glDirect3DDevice7::GetCaps(LPD3DDEVICEDESC7 lpD3DDevDesc);
 93+HRESULT WINAPI glDirect3DDevice7::GetClipPlane(DWORD dwIndex, D3DVALUE *pPlaneEquation);
 94+HRESULT WINAPI glDirect3DDevice7::GetClipStatus(LPD3DCLIPSTATUS lpD3DClipStatus);
 95+HRESULT WINAPI glDirect3DDevice7::GetDirect3D(LPDIRECT3D7 *lplpD3D);
 96+HRESULT WINAPI glDirect3DDevice7::GetInfo(DWORD dwDevInfoID, LPVOID pDevInfoStruct, DWORD dwSize);
 97+HRESULT WINAPI glDirect3DDevice7::GetLight(DWORD dwLightIndex, LPD3DLIGHT7 lpLight);
 98+HRESULT WINAPI glDirect3DDevice7::GetLightEnable(DWORD dwLightIndex, BOOL* pbEnable);
 99+HRESULT WINAPI glDirect3DDevice7::GetMaterial(LPD3DMATERIAL7 lpMaterial);
 100+HRESULT WINAPI glDirect3DDevice7::GetRenderState(D3DRENDERSTATETYPE dwRenderStateType, LPDWORD lpdwRenderState);
 101+HRESULT WINAPI glDirect3DDevice7::GetRenderTarget(LPDIRECTDRAWSURFACE7 lplpRenderTarget);
 102+HRESULT WINAPI glDirect3DDevice7::GetStateData(DWORD dwState, LPVOID* lplpStateData);
 103+HRESULT WINAPI glDirect3DDevice7::GetTexture(DWORD dwStage, LPDIRECTDRAWSURFACE7 *lplpTexture);
 104+HRESULT WINAPI glDirect3DDevice7::GetTextureStageState(DWORD dwStage, D3DTEXTURESTAGESTATETYPE dwState, LPDWORD lpdwValue);
 105+HRESULT WINAPI glDirect3DDevice7::GetTransform(D3DTRANSFORMSTATETYPE dtstTransformStateType, LPD3DMATRIX lpD3DMatrix);
 106+HRESULT WINAPI glDirect3DDevice7::GetViewport(LPD3DVIEWPORT7 lpViewport);
 107+HRESULT WINAPI glDirect3DDevice7::LightEnable(DWORD dwLightIndex, BOOL bEnable);
 108+HRESULT WINAPI glDirect3DDevice7::Load(LPDIRECTDRAWSURFACE7 lpDestTex, LPPOINT lpDestPoint, LPDIRECTDRAWSURFACE7 lpSrcTex, LPRECT lprcSrcRect, DWORD dwFlags);
 109+HRESULT WINAPI glDirect3DDevice7::MultiplyTransform(D3DTRANSFORMSTATETYPE dtstTransformStateType, LPD3DMATRIX lpD3DMatrix);
 110+HRESULT WINAPI glDirect3DDevice7::PreLoad(LPDIRECTDRAWSURFACE7 lpddsTexture);
 111+HRESULT WINAPI glDirect3DDevice7::SetClipPlane(DWORD dwIndex, D3DVALUE* pPlaneEquation);
 112+HRESULT WINAPI glDirect3DDevice7::SetClipStatus(LPD3DCLIPSTATUS lpD3DClipStatus);
 113+HRESULT WINAPI glDirect3DDevice7::SetLight(DWORD dwLightIndex, LPD3DLIGHT7 lpLight);
 114+HRESULT WINAPI glDirect3DDevice7::SetMaterial(LPD3DMATERIAL7 lpMaterial);
 115+HRESULT WINAPI glDirect3DDevice7::SetRenderState(D3DRENDERSTATETYPE dwRendStateType, DWORD dwRenderState);
 116+HRESULT WINAPI glDirect3DDevice7::SetRenderTarget(LPDIRECTDRAWSURFACE7 lpNewRenderTarget, DWORD dwFlags);
 117+HRESULT WINAPI glDirect3DDevice7::SetStateData(DWORD dwState, LPVOID lpStateData);
 118+HRESULT WINAPI glDirect3DDevice7::SetTexture(DWORD dwStage, LPDIRECTDRAWSURFACE7 lpTexture);
 119+HRESULT WINAPI glDirect3DDevice7::SetTextureStageState(DWORD dwStage, D3DTEXTURESTAGESTATETYPE dwState, DWORD dwValue);
 120+HRESULT WINAPI glDirect3DDevice7::SetTransform(D3DTRANSFORMSTATETYPE dtstTransformStateType, LPD3DMATRIX lpD3DMatrix);
 121+HRESULT WINAPI glDirect3DDevice7::SetViewport(LPD3DVIEWPORT7 lpViewport);
 122+HRESULT WINAPI glDirect3DDevice7::ValidateDevice(LPDWORD lpdwPasses);
 123+*/
\ No newline at end of file
Index: ddraw/glDirect3DDevice.h
@@ -0,0 +1,95 @@
 2+// DXGL
 3+// Copyright (C) 2011 William Feely
 4+
 5+// This library is free software; you can redistribute it and/or
 6+// modify it under the terms of the GNU Lesser General Public
 7+// License as published by the Free Software Foundation; either
 8+// version 2.1 of the License, or (at your option) any later version.
 9+
 10+// This library is distributed in the hope that it will be useful,
 11+// but WITHOUT ANY WARRANTY; without even the implied warranty of
 12+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 13+// Lesser General Public License for more details.
 14+
 15+// You should have received a copy of the GNU Lesser General Public
 16+// License along with this library; if not, write to the Free Software
 17+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 18+
 19+#pragma once
 20+#ifndef __GLDIRECT3DDEVICE_H
 21+#define __GLDIRECT3DDEVICE_H
 22+
 23+class glDirectDrawSurface7;
 24+class glDirect3DDevice7 : public IDirect3DDevice7
 25+{
 26+public:
 27+ glDirect3DDevice7(glDirect3D7 *glD3D7, glDirectDrawSurface7 *glDDS7);
 28+ virtual ~glDirect3DDevice7();
 29+ HRESULT WINAPI QueryInterface(REFIID riid, void** ppvObj);
 30+ ULONG WINAPI AddRef();
 31+ ULONG WINAPI Release();
 32+ HRESULT WINAPI ApplyStateBlock(DWORD dwBlockHandle);
 33+ HRESULT WINAPI BeginScene();
 34+ HRESULT WINAPI BeginStateBlock();
 35+ HRESULT WINAPI CaptureStateBlock(DWORD dwBlockHandle);
 36+ HRESULT WINAPI CreateStateBlock(D3DSTATEBLOCKTYPE d3dsbtype, LPDWORD lpdwBlockHandle);
 37+ HRESULT WINAPI Clear(DWORD dwCount, LPD3DRECT lpRects, DWORD dwFlags, DWORD dwColor, D3DVALUE dvZ, DWORD dwStencil);
 38+ HRESULT WINAPI ComputeSphereVisibility(LPD3DVECTOR lpCenters, LPD3DVALUE lpRadii, DWORD dwNumSpheres,
 39+ DWORD dwFlags, LPDWORD lpdwReturnValues);
 40+ HRESULT WINAPI DeleteStateBlock(DWORD dwBlockHandle);
 41+ HRESULT WINAPI DrawIndexedPrimitive(D3DPRIMITIVETYPE d3dptPrimitiveType, DWORD dwVertexTypeDesc,
 42+ LPVOID lpvVertices, DWORD dwVertexCount, LPWORD lpwIndices, DWORD dwIndexCount, DWORD dwFlags);
 43+ HRESULT WINAPI DrawIndexedPrimitiveStrided(D3DPRIMITIVETYPE d3dptPrimitiveType, DWORD dwVertexTypeDesc,
 44+ LPD3DDRAWPRIMITIVESTRIDEDDATA lpvVerticexArray, DWORD dwVertexCount, LPWORD lpwIndices, DWORD dwIndexCount, DWORD dwFlags);
 45+ HRESULT WINAPI DrawIndexedPrimitiveVB(D3DPRIMITIVETYPE d3dptPrimitiveType, LPDIRECT3DVERTEXBUFFER7 lpd3dVertexBuffer,
 46+ DWORD dwStartVertex, DWORD dwNumVertices, LPWORD lpwIndices, DWORD dwIndexCount, DWORD dwFlags);
 47+ HRESULT WINAPI DrawPrimitive(D3DPRIMITIVETYPE dptPrimitiveType, DWORD dwVertexTypeDesc, LPVOID lpVertices,
 48+ DWORD dwVertexCount, DWORD dwFlags);
 49+ HRESULT WINAPI DrawPrimitiveStrided(D3DPRIMITIVETYPE dptPrimitiveType, DWORD dwVertexTypeDesc,
 50+ LPD3DDRAWPRIMITIVESTRIDEDDATA lpVertexArray, DWORD dwVertexCount, DWORD dwFlags);
 51+ HRESULT WINAPI DrawPrimitiveVB(D3DPRIMITIVETYPE d3dptPrimitiveType, LPDIRECT3DVERTEXBUFFER7 lpd3dVertexBuffer,
 52+ DWORD dwStartVertex, DWORD dwNumVertices, DWORD dwFlags);
 53+ HRESULT WINAPI EndScene();
 54+ HRESULT WINAPI EndStateBlock(LPDWORD lpdwBlockHandle);
 55+ HRESULT WINAPI EnumTextureFormats(LPD3DENUMPIXELFORMATSCALLBACK lpd3dEnumPixelProc, LPVOID lpArg);
 56+ HRESULT WINAPI GetCaps(LPD3DDEVICEDESC7 lpD3DDevDesc);
 57+ HRESULT WINAPI GetClipPlane(DWORD dwIndex, D3DVALUE *pPlaneEquation);
 58+ HRESULT WINAPI GetClipStatus(LPD3DCLIPSTATUS lpD3DClipStatus);
 59+ HRESULT WINAPI GetDirect3D(LPDIRECT3D7 *lplpD3D);
 60+ HRESULT WINAPI GetInfo(DWORD dwDevInfoID, LPVOID pDevInfoStruct, DWORD dwSize);
 61+ HRESULT WINAPI GetLight(DWORD dwLightIndex, LPD3DLIGHT7 lpLight);
 62+ HRESULT WINAPI GetLightEnable(DWORD dwLightIndex, BOOL* pbEnable);
 63+ HRESULT WINAPI GetMaterial(LPD3DMATERIAL7 lpMaterial);
 64+ HRESULT WINAPI GetRenderState(D3DRENDERSTATETYPE dwRenderStateType, LPDWORD lpdwRenderState);
 65+ HRESULT WINAPI GetRenderTarget(LPDIRECTDRAWSURFACE7 lplpRenderTarget);
 66+ HRESULT WINAPI GetStateData(DWORD dwState, LPVOID* lplpStateData);
 67+ HRESULT WINAPI GetTexture(DWORD dwStage, LPDIRECTDRAWSURFACE7 *lplpTexture);
 68+ HRESULT WINAPI GetTextureStageState(DWORD dwStage, D3DTEXTURESTAGESTATETYPE dwState, LPDWORD lpdwValue);
 69+ HRESULT WINAPI GetTransform(D3DTRANSFORMSTATETYPE dtstTransformStateType, LPD3DMATRIX lpD3DMatrix);
 70+ HRESULT WINAPI GetViewport(LPD3DVIEWPORT7 lpViewport);
 71+ HRESULT WINAPI LightEnable(DWORD dwLightIndex, BOOL bEnable);
 72+ HRESULT WINAPI Load(LPDIRECTDRAWSURFACE7 lpDestTex, LPPOINT lpDestPoint, LPDIRECTDRAWSURFACE7 lpSrcTex,
 73+ LPRECT lprcSrcRect, DWORD dwFlags);
 74+ HRESULT WINAPI MultiplyTransform(D3DTRANSFORMSTATETYPE dtstTransformStateType, LPD3DMATRIX lpD3DMatrix);
 75+ HRESULT WINAPI PreLoad(LPDIRECTDRAWSURFACE7 lpddsTexture);
 76+ HRESULT WINAPI SetClipPlane(DWORD dwIndex, D3DVALUE* pPlaneEquation);
 77+ HRESULT WINAPI SetClipStatus(LPD3DCLIPSTATUS lpD3DClipStatus);
 78+ HRESULT WINAPI SetLight(DWORD dwLightIndex, LPD3DLIGHT7 lpLight);
 79+ HRESULT WINAPI SetMaterial(LPD3DMATERIAL7 lpMaterial);
 80+ HRESULT WINAPI SetRenderState(D3DRENDERSTATETYPE dwRendStateType, DWORD dwRenderState);
 81+ HRESULT WINAPI SetRenderTarget(LPDIRECTDRAWSURFACE7 lpNewRenderTarget, DWORD dwFlags);
 82+ HRESULT WINAPI SetStateData(DWORD dwState, LPVOID lpStateData);
 83+ HRESULT WINAPI SetTexture(DWORD dwStage, LPDIRECTDRAWSURFACE7 lpTexture);
 84+ HRESULT WINAPI SetTextureStageState(DWORD dwStage, D3DTEXTURESTAGESTATETYPE dwState, DWORD dwValue);
 85+ HRESULT WINAPI SetTransform(D3DTRANSFORMSTATETYPE dtstTransformStateType, LPD3DMATRIX lpD3DMatrix);
 86+ HRESULT WINAPI SetViewport(LPD3DVIEWPORT7 lpViewport);
 87+ HRESULT WINAPI ValidateDevice(LPDWORD lpdwPasses);
 88+
 89+private:
 90+ glDirect3D7 *glD3D7;
 91+ glDirectDrawSurface7 *glDDS7;
 92+ ULONG refcount;
 93+
 94+};
 95+
 96+#endif //__GLDIRECT3DDEVICE_H
\ No newline at end of file
Index: ddraw/glDirectDraw.cpp
@@ -18,6 +18,7 @@
1919 #include "common.h"
2020 #include "shaders.h"
2121 #include "ddraw.h"
 22+#include "glDirect3D.h"
2223 #include "glDirectDraw.h"
2324 #include "glDirectDrawClipper.h"
2425 #include "glDirectDrawSurface.h"
@@ -563,6 +564,7 @@
564565
565566 glDirectDraw7::~glDirectDraw7()
566567 {
 568+ if(glD3D7) glD3D7->Release();
567569 RestoreDisplayMode();
568570 if(clippers)
569571 {
@@ -627,8 +629,9 @@
628630 }
629631 if(riid == IID_IDirect3D7)
630632 {
631 - FIXME("Add IDirect3D Interfaces\n");
632 - ERR(DDERR_GENERIC);
 633+ this->AddRef();
 634+ *ppvObj = new glDirect3D7(this);
 635+ return DD_OK;
633636 }
634637 if(riid == IID_IDirectDrawGammaControl)
635638 {
@@ -839,6 +842,7 @@
840843 if(initialized) return DDERR_ALREADYINITIALIZED;
841844 hDC = NULL;
842845 hRC = NULL;
 846+ glD3D7 = NULL;
843847 hRenderWnd = NULL;
844848 primary = NULL;
845849 fullscreen = false;
Index: ddraw/glDirectDraw.h
@@ -21,6 +21,7 @@
2222
2323 class glDirectDrawSurface7;
2424 class glDirectDrawClipper;
 25+class glDirect3D7;
2526
2627 LRESULT CALLBACK RenderWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
2728
@@ -117,6 +118,7 @@
118119 GLCAPS gl_caps;
119120 DEVMODE oldmode;
120121 bool initialized;
 122+ glDirect3D7 *glD3D7;
121123 };
122124
123125 class glDirectDraw1 : public IDirectDraw
Index: ddraw/glDirectDrawSurface.h
@@ -28,6 +28,7 @@
2929 DDCOLORKEY key;
3030 } CKEY;
3131
 32+class glDirectDrawClipper;
3233 class glDirectDrawPalette;
3334 class glDirectDrawSurface1;
3435 class glDirectDrawSurface2;
Index: dxgltest/Tests2D.cpp
@@ -20,22 +20,13 @@
2121 #include "surfacegen.h"
2222 #include "MultiDD.h"
2323 #include "timer.h"
24 -#include <time.h>
 24+#include "misc.h"
2525
2626 void InitTest(int test);
2727 void RunTestTimed(int test);
2828 void RunTestLooped(int test);
2929 void RunTestMouse(int test, UINT Msg, WPARAM wParam, LPARAM lParam);
30 -inline unsigned int rand32(unsigned int &n)
31 -{
32 - return n=(((unsigned int) 1103515245 * n) + (unsigned int) 12345) %
33 - (unsigned int) 0xFFFFFFFF;
34 -}
3530
36 -inline float randfloat(float multiple)
37 -{
38 - return ((float)rand() / (float)RAND_MAX)*multiple;
39 -}
4031
4132 MultiDirectDraw *ddinterface;
4233 MultiDirectDrawSurface *ddsurface;
Index: dxgltest/Tests3D.cpp
@@ -0,0 +1,22 @@
 2+// DXGL
 3+// Copyright (C) 2011 William Feely
 4+
 5+// This library is free software; you can redistribute it and/or
 6+// modify it under the terms of the GNU Lesser General Public
 7+// License as published by the Free Software Foundation; either
 8+// version 2.1 of the License, or (at your option) any later version.
 9+
 10+// This library is distributed in the hope that it will be useful,
 11+// but WITHOUT ANY WARRANTY; without even the implied warranty of
 12+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 13+// Lesser General Public License for more details.
 14+
 15+// You should have received a copy of the GNU Lesser General Public
 16+// License along with this library; if not, write to the Free Software
 17+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 18+
 19+#include "common.h"
 20+#include "tests.h"
 21+#include "surfacegen.h"
 22+#include "timer.h"
 23+#include "misc.h"
Index: dxgltest/common.h
@@ -43,6 +43,7 @@
4444 #include <memory.h>
4545 #include <tchar.h>
4646 #include <math.h>
 47+#include <time.h>
4748 #include <string>
4849 #ifdef _DEBUG
4950 #include <crtdbg.h>
Index: dxgltest/dxgltest.vcxproj
@@ -164,6 +164,7 @@
165165 <ItemGroup>
166166 <ClInclude Include="common.h" />
167167 <ClInclude Include="dxgltest.h" />
 168+ <ClInclude Include="misc.h" />
168169 <ClInclude Include="MultiDD.h" />
169170 <ClInclude Include="palette.h" />
170171 <ClInclude Include="Resource.h" />
@@ -189,6 +190,7 @@
190191 <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
191192 </ClCompile>
192193 <ClCompile Include="surfacegen.cpp" />
 194+ <ClCompile Include="Tests3D.cpp" />
193195 <ClCompile Include="timer.cpp" />
194196 </ItemGroup>
195197 <ItemGroup>
Index: dxgltest/dxgltest.vcxproj.filters
@@ -42,6 +42,9 @@
4343 <ClInclude Include="timer.h">
4444 <Filter>Header Files</Filter>
4545 </ClInclude>
 46+ <ClInclude Include="misc.h">
 47+ <Filter>Header Files</Filter>
 48+ </ClInclude>
4649 </ItemGroup>
4750 <ItemGroup>
4851 <ClCompile Include="dxgltest.cpp">
@@ -68,6 +71,9 @@
6972 <ClCompile Include="dxguid.cpp">
7073 <Filter>Source Files</Filter>
7174 </ClCompile>
 75+ <ClCompile Include="Tests3D.cpp">
 76+ <Filter>Source Files</Filter>
 77+ </ClCompile>
7278 </ItemGroup>
7379 <ItemGroup>
7480 <ResourceCompile Include="dxgltest.rc">
Index: dxgltest/misc.h
@@ -0,0 +1,33 @@
 2+// DXGL
 3+// Copyright (C) 2011 William Feely
 4+
 5+// This library is free software; you can redistribute it and/or
 6+// modify it under the terms of the GNU Lesser General Public
 7+// License as published by the Free Software Foundation; either
 8+// version 2.1 of the License, or (at your option) any later version.
 9+
 10+// This library is distributed in the hope that it will be useful,
 11+// but WITHOUT ANY WARRANTY; without even the implied warranty of
 12+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 13+// Lesser General Public License for more details.
 14+
 15+// You should have received a copy of the GNU Lesser General Public
 16+// License along with this library; if not, write to the Free Software
 17+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 18+
 19+#pragma once
 20+#ifndef _MISC_H
 21+#define _MISC_H
 22+
 23+inline unsigned int rand32(unsigned int &n)
 24+{
 25+ return n=(((unsigned int) 1103515245 * n) + (unsigned int) 12345) %
 26+ (unsigned int) 0xFFFFFFFF;
 27+}
 28+
 29+inline float randfloat(float multiple)
 30+{
 31+ return ((float)rand() / (float)RAND_MAX)*multiple;
 32+}
 33+
 34+#endif //_MISC_H
\ No newline at end of file
Index: dxgltest/tests.h
@@ -23,4 +23,7 @@
2424 void RunTest2D(int testnum, int width, int height, int bpp, int refresh, int backbuffers, int apiver,
2525 double fps, bool fullscreen, bool resizable);
2626
 27+void RunTest3D(int testnum, int width, int height, int bpp, int refresh, int backbuffers, int filter,
 28+ int msaa, double fps, bool fullscreen, bool resizable);
 29+
2730 #endif //_TESTS_H