Author: gbrunmar
Date: Tue Sep 16 14:21:02 2008
New Revision: 36271
URL:
http://svn.reactos.org/svn/reactos?rev=36271&view=rev
Log:
D3D9: Implemented part of IDirect3DDevice9::CreateTexture()
Added:
trunk/reactos/dll/directx/d3d9/d3d9_mipmap.c (with props)
trunk/reactos/dll/directx/d3d9/d3d9_mipmap.h (with props)
trunk/reactos/dll/directx/d3d9/d3d9_resource.h (with props)
trunk/reactos/dll/directx/d3d9/d3d9_texture.h (with props)
Modified:
trunk/reactos/dll/directx/d3d9/d3d9.rbuild
trunk/reactos/dll/directx/d3d9/d3d9_device.c
Modified: trunk/reactos/dll/directx/d3d9/d3d9.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9.rbui…
==============================================================================
--- trunk/reactos/dll/directx/d3d9/d3d9.rbuild [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/d3d9/d3d9.rbuild [iso-8859-1] Tue Sep 16 14:21:02 2008
@@ -21,6 +21,7 @@
<file>d3d9_haldevice.c</file>
<file>d3d9_helpers.c</file>
<file>d3d9_impl.c</file>
+ <file>d3d9_mipmap.c</file>
<file>d3d9_puredevice.c</file>
<file>d3d9_swapchain.c</file>
<file>adapter.c</file>
Modified: trunk/reactos/dll/directx/d3d9/d3d9_device.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9_devi…
==============================================================================
--- trunk/reactos/dll/directx/d3d9/d3d9_device.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/d3d9/d3d9_device.c [iso-8859-1] Tue Sep 16 14:21:02 2008
@@ -10,6 +10,7 @@
#include "adapter.h"
#include <debug.h>
#include "d3d9_create.h"
+#include "d3d9_mipmap.h"
#define LOCK_D3DDEVICE9() if (This->bLockDevice)
EnterCriticalSection(&This->CriticalSection);
#define UNLOCK_D3DDEVICE9() if (This->bLockDevice)
LeaveCriticalSection(&This->CriticalSection);
@@ -21,6 +22,13 @@
return NULL;
return (LPDIRECT3DDEVICE9_INT)((ULONG_PTR)iface - FIELD_OFFSET(DIRECT3DDEVICE9_INT,
lpVtbl));
+}
+
+static HRESULT InvalidCall(LPDIRECT3DDEVICE9_INT This, LPSTR ErrorMsg)
+{
+ DPRINT1(ErrorMsg);
+ UNLOCK_D3DDEVICE9();
+ return D3DERR_INVALIDCALL;
}
/* IDirect3DDevice9: IUnknown implementation */
@@ -448,11 +456,72 @@
UNIMPLEMENTED
}
+/*++
+* @name IDirect3DDevice9::CreateTexture
+* @implemented
+*
+* The function IDirect3DDevice9Base_CreateTexture creates a D3D9 texture.
+*
+* @param LPDIRECT3D iface
+* Pointer to the IDirect3DDevice9 object returned from IDirect3D9::CreateDevice()
+*
+* @param UINT Width
+* Desired width of the texture
+*
+* @param UINT Height
+* Desired height of the texture
+*
+* @param UINT Levels
+* Number of mip-maps. If Levels are zero, mip-maps down to size 1x1 will be generated.
+*
+* @param DWORD Usage
+* Valid combinations of the D3DUSAGE constants.
+*
+* @param D3DFORMAT Format
+* One of the D3DFORMAT enum members for the surface format.
+*
+* @param D3DPOOL Pool
+* One of the D3DPOOL enum members for where the texture should be placed.
+*
+* @param IDirect3DTexture9** ppTexture
+* Return parameter for the created texture
+*
+* @param HANDLE* pSharedHandle
+* Set to NULL, shared resources are not implemented yet
+*
+* @return HRESULT
+* Returns D3D_OK if everything went well.
+*
+*/
HRESULT WINAPI IDirect3DDevice9Base_CreateTexture(LPDIRECT3DDEVICE9 iface, UINT Width,
UINT Height, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DTexture9**
ppTexture, HANDLE* pSharedHandle)
{
- UNIMPLEMENTED
-
- return D3D_OK;
+ HRESULT hResult;
+ LPDIRECT3DDEVICE9_INT This = IDirect3DDevice9ToImpl(iface);
+ LOCK_D3DDEVICE9();
+
+ if (NULL == This)
+ return InvalidCall(This, "Invalid 'this' parameter
specified");
+
+ if (NULL == ppTexture)
+ return InvalidCall(This, "Invalid ppTexture parameter specified");
+
+ *ppTexture = NULL;
+
+ if (D3DFMT_UNKNOWN == Format)
+ return InvalidCall(This, "Invalid Format parameter specified, D3DFMT_UNKNOWN
is not a valid Format");
+
+ if (NULL == pSharedHandle)
+ {
+ UNIMPLEMENTED;
+ return InvalidCall(This, "Invalid pSharedHandle parameter specified, only
NULL is supported at the moment");
+ }
+
+ hResult = CreateD3D9MipMap(This, Width, Height, Levels, Usage, Format, Pool,
ppTexture);
+ if (FAILED(hResult))
+ DPRINT1("Failed to create texture");
+
+ UNLOCK_D3DDEVICE9();
+ return hResult;
}
HRESULT WINAPI IDirect3DDevice9Base_CreateVolumeTexture(LPDIRECT3DDEVICE9 iface, UINT
Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool,
IDirect3DVolumeTexture9** ppVolumeTexture, HANDLE* pSharedHandle)
Added: trunk/reactos/dll/directx/d3d9/d3d9_mipmap.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9_mipm…
==============================================================================
--- trunk/reactos/dll/directx/d3d9/d3d9_mipmap.c (added)
+++ trunk/reactos/dll/directx/d3d9/d3d9_mipmap.c [iso-8859-1] Tue Sep 16 14:21:02 2008
@@ -1,0 +1,17 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS ReactX
+ * FILE: dll/directx/d3d9/d3d9_mipmap.c
+ * PURPOSE: d3d9.dll internal mip map surface functions
+ * PROGRAMERS: Gregor Gullwi <gbrunmar (dot) ros (at) gmail (dot) com>
+ */
+#include "d3d9_mipmap.h"
+#include "debug.h"
+#include "d3d9_device.h"
+
+HRESULT CreateD3D9MipMap(DIRECT3DDEVICE9_INT* pDevice, UINT Width, UINT Height, UINT
Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DTexture9** ppTexture)
+{
+ UNIMPLEMENTED;
+ return D3D_OK;
+}
+
Propchange: trunk/reactos/dll/directx/d3d9/d3d9_mipmap.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/dll/directx/d3d9/d3d9_mipmap.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9_mipm…
==============================================================================
--- trunk/reactos/dll/directx/d3d9/d3d9_mipmap.h (added)
+++ trunk/reactos/dll/directx/d3d9/d3d9_mipmap.h [iso-8859-1] Tue Sep 16 14:21:02 2008
@@ -1,0 +1,26 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS ReactX
+ * FILE: dll/directx/d3d9/d3d9_mipmap.h
+ * PURPOSE: d3d9.dll internal mip map surface structures
+ * PROGRAMERS: Gregor Gullwi <gbrunmar (dot) ros (at) gmail (dot) com>
+ */
+#ifndef _D3D9_MIPMAP_H_
+#define _D3D9_MIPMAP_H_
+
+#include "d3d9_texture.h"
+
+struct _Direct3DDevice9_INT;
+
+typedef struct _D3D9MipMap
+{
+/* 0x0000 */ D3D9Texture BaseTexture;
+/* 0x0068 */ DWORD dwUnknown68;
+/* 0x006c */ DWORD dwUnknown6c;
+/* 0x0070 */ DWORD dwUnknown70;
+/* 0x0074 */ DWORD dwUnknown74;
+} D3D9MipMap;
+
+HRESULT CreateD3D9MipMap(struct _Direct3DDevice9_INT* pDevice, UINT Width, UINT Height,
UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DTexture9** ppTexture);
+
+#endif // _D3D9_MIPMAP_H_
Propchange: trunk/reactos/dll/directx/d3d9/d3d9_mipmap.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/dll/directx/d3d9/d3d9_resource.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9_reso…
==============================================================================
--- trunk/reactos/dll/directx/d3d9/d3d9_resource.h (added)
+++ trunk/reactos/dll/directx/d3d9/d3d9_resource.h [iso-8859-1] Tue Sep 16 14:21:02 2008
@@ -1,0 +1,27 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS ReactX
+ * FILE: dll/directx/d3d9/d3d9_mipmap.h
+ * PURPOSE: d3d9.dll internal resource structures
+ * PROGRAMERS: Gregor Gullwi <gbrunmar (dot) ros (at) gmail (dot) com>
+ */
+#ifndef _D3D9_RESOURCE_H_
+#define _D3D9_RESOURCE_H_
+
+#include "d3d9_baseobject.h"
+
+typedef struct _D3D9Resource
+{
+/* 0x0000 */ D3D9BaseObject BaseObject;
+/* 0x0020 */ DWORD dwUnknown20;
+/* 0x0024 */ DWORD dwUnknown24;
+/* 0x0028 */ DWORD dwUnknown28;
+/* 0x002c */ DWORD dwUnknown2c;
+/* 0x0030 */ DWORD dwUnknown30;
+/* 0x0034 */ DWORD dwUnknown34;
+/* 0x0038 */ DWORD dwUnknown38;
+/* 0x003c */ DWORD dwUnknown3c;
+/* 0x0040 */ DWORD dwUnknown40;
+} D3D9Resource;
+
+#endif // _D3D9_RESOURCE_H_
Propchange: trunk/reactos/dll/directx/d3d9/d3d9_resource.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/dll/directx/d3d9/d3d9_texture.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9_text…
==============================================================================
--- trunk/reactos/dll/directx/d3d9/d3d9_texture.h (added)
+++ trunk/reactos/dll/directx/d3d9/d3d9_texture.h [iso-8859-1] Tue Sep 16 14:21:02 2008
@@ -1,0 +1,27 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS ReactX
+ * FILE: dll/directx/d3d9/d3d9_texture.h
+ * PURPOSE: d3d9.dll internal texture surface structures
+ * PROGRAMERS: Gregor Gullwi <gbrunmar (dot) ros (at) gmail (dot) com>
+ */
+#ifndef _D3D9_TEXTURE_H_
+#define _D3D9_TEXTURE_H_
+
+#include "d3d9_resource.h"
+
+typedef struct _D3D9Texture
+{
+/* 0x0000 */ D3D9Resource BaseResource;
+/* 0x0044 */ DWORD dwUnknown44;
+/* 0x0048 */ DWORD dwUnknown48;
+/* 0x004c */ DWORD dwUnknown4c;
+/* 0x0050 */ DWORD dwUnknown50;
+/* 0x0054 */ DWORD dwUnknown54;
+/* 0x0058 */ DWORD dwUnknown58;
+/* 0x005c */ DWORD dwUnknown5c;
+/* 0x0060 */ DWORD dwUnknown60;
+/* 0x0064 */ DWORD dwUnknown64;
+} D3D9Texture;
+
+#endif // _D3D9_TEXTURE_H_
Propchange: trunk/reactos/dll/directx/d3d9/d3d9_texture.h
------------------------------------------------------------------------------
svn:eol-style = native