* More init values when creating a texture

svn path=/trunk/; revision=36429
This commit is contained in:
Gregor Brunmar 2008-09-23 17:01:40 +00:00
parent ad277c0c6b
commit 931c14a8ea
9 changed files with 111 additions and 19 deletions

View file

@ -23,7 +23,9 @@
<file>d3d9_impl.c</file>
<file>d3d9_mipmap.c</file>
<file>d3d9_puredevice.c</file>
<file>d3d9_resource.c</file>
<file>d3d9_swapchain.c</file>
<file>d3d9_texture.c</file>
<file>adapter.c</file>
<file>device.c</file>
<file>format.c</file>

View file

@ -0,0 +1,43 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS ReactX
* FILE: dll/directx/d3d9/d3d9_basetexture.h
* PURPOSE: Work-around for gcc warning, DO NOT USE FOR ANYTHING ELSE!!!
* PROGRAMERS: Gregor Gullwi <gbrunmar (dot) ros (at) gmail (dot) com>
*/
#ifndef _D3D9_BASETEXTURE_H_
#define _D3D9_BASETEXTURE_H_
// Work-around for:
// "warning: 'FilterType' is narrower than values of its type"
#if __GNUC__ >=3
#pragma GCC system_header
#endif
struct IDirect3DBaseTexture9Vtbl;
#pragma pack(push)
#pragma pack(1)
typedef struct _Direct3DBaseTexture9_INT
{
/* 0x0000 */ IDirect3DBaseTexture9Vtbl* lpVtbl;
/* 0x0004 */ DWORD dwUnknown04;
/* 0x0008 */ Direct3DResource9_INT BaseResource;
/* 0x004c */ DWORD dwUnknown4c;
/* 0x0050 */ D3DFORMAT Format;
/* 0x0054 */ DWORD Usage;
/* 0x0058 */ WORD MipMapLevels;
union {
/* 0x005a */ D3DTEXTUREFILTERTYPE FilterType : 8;
struct
{
/* 0x005a */ DWORD dwFilterType : 8;
/* 0x005b */ BOOL bIsAutoGenMipMap : 8;
/* 0x005c */ DWORD MipMapLevels2 : 16;
};
};
/* 0x005e */ WORD wPaletteIndex;
} Direct3DBaseTexture9_INT;
#pragma pack(pop)
#endif

View file

@ -510,7 +510,7 @@ HRESULT WINAPI IDirect3DDevice9Base_CreateTexture(LPDIRECT3DDEVICE9 iface, UINT
if (D3DFMT_UNKNOWN == Format)
return InvalidCall(This, "Invalid Format parameter specified, D3DFMT_UNKNOWN is not a valid Format");
if (NULL == pSharedHandle)
if (NULL != pSharedHandle)
{
UNIMPLEMENTED;
return InvalidCall(This, "Invalid pSharedHandle parameter specified, only NULL is supported at the moment");

View file

@ -246,13 +246,16 @@ HRESULT CreateD3D9MipMap(DIRECT3DDEVICE9_INT* pDevice, UINT Width, UINT Height,
return E_OUTOFMEMORY;
}
InitDirect3DBaseTexture9(&pThisTexture->BaseTexture, (IDirect3DBaseTexture9Vtbl*)&D3D9MipMap_Vtbl, Usage, Levels, Format, Pool, pDevice, RT_EXTERNAL);
pThisTexture->lpVtbl = &D3D9MipMap_Vtbl;
pThisTexture->Usage = Usage;
pThisTexture->dwWidth = Width;
pThisTexture->dwHeight = Height;
pThisTexture->Format = Format;
*ppTexture = (IDirect3DTexture9*)pThisTexture->lpVtbl;
*ppTexture = (IDirect3DTexture9*)&pThisTexture->lpVtbl;
UNIMPLEMENTED;
return D3D_OK;

View file

@ -19,7 +19,7 @@ typedef struct _D3D9MipMap
/* 0x0064 */ LPDWORD dwUnknown64;
/* 0x0068 */ D3DFORMAT Format;
/* 0x006c */ DWORD dwUnknown6c;
/* 0x0070 */ DWORD dwUnknown70;
/* 0x0070 */ DWORD Usage;
/* 0x0074 */ DWORD dwUnknown74;
/* 0x0078 */ DWORD dwUnknown78;
/* 0x007c */ DWORD dwUnknown7c;

View file

@ -0,0 +1,16 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS ReactX
* FILE: dll/directx/d3d9/d3d9_resource.c
* PURPOSE: d3d9.dll internal resource functions
* PROGRAMERS: Gregor Gullwi <gbrunmar (dot) ros (at) gmail (dot) com>
*/
#include "d3d9_resource.h"
#include "d3d9_device.h"
void InitDirect3DResource9(Direct3DResource9_INT* pResource, D3DPOOL Pool, LPDIRECT3DDEVICE9_INT pBaseDevice, enum REF_TYPE RefType)
{
InitD3D9BaseObject(&pResource->BaseObject, RefType, (IUnknown*)&pBaseDevice->lpVtbl);
pResource->Pool = Pool;
}

View file

@ -1,7 +1,7 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS ReactX
* FILE: dll/directx/d3d9/d3d9_mipmap.h
* FILE: dll/directx/d3d9/d3d9_resource.h
* PURPOSE: d3d9.dll internal resource structures
* PROGRAMERS: Gregor Gullwi <gbrunmar (dot) ros (at) gmail (dot) com>
*/
@ -20,10 +20,10 @@ typedef struct _Direct3DResource9_INT
/* 0x0030 */ DWORD dwUnknown30;
/* 0x0034 */ DWORD dwUnknown34;
/* 0x0038 */ D3DPOOL Pool;
/* 0x003c */ DWORD dwUnknown3c;
/* 0x003c */ LPDWORD dwUnknown3c;
/* 0x0040 */ LPDWORD dwUnknown40;
} Direct3DResource9_INT;
void InitDirect3DResource9(Direct3DResource9_INT* pResource, D3DPOOL Pool, struct _Direct3DDevice9_INT* pDevice, enum REF_TYPE RefType);
#endif // _D3D9_RESOURCE_H_

View file

@ -0,0 +1,30 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS ReactX
* FILE: dll/directx/d3d9/d3d9_texture.c
* PURPOSE: d3d9.dll internal texture surface functions
* PROGRAMERS: Gregor Gullwi <gbrunmar (dot) ros (at) gmail (dot) com>
*/
#include "d3d9_texture.h"
void InitDirect3DBaseTexture9(Direct3DBaseTexture9_INT* pBaseTexture,
IDirect3DBaseTexture9Vtbl* pVtbl,
DWORD Usage,
UINT Levels,
D3DFORMAT Format,
D3DPOOL Pool,
struct _Direct3DDevice9_INT* pDevice,
enum REF_TYPE RefType)
{
InitDirect3DResource9(&pBaseTexture->BaseResource, Pool, pDevice, RefType);
pBaseTexture->lpVtbl = pVtbl;
pBaseTexture->Format = Format;
pBaseTexture->wPaletteIndex = 0xFFFF;
pBaseTexture->Usage = Usage;
pBaseTexture->MipMapLevels =
pBaseTexture->MipMapLevels2 = (WORD)Levels;
pBaseTexture->FilterType = D3DTEXF_LINEAR;
pBaseTexture->bIsAutoGenMipMap = (Usage & D3DUSAGE_AUTOGENMIPMAP) != 0;
}

View file

@ -9,19 +9,17 @@
#define _D3D9_TEXTURE_H_
#include "d3d9_resource.h"
#include "d3d9_basetexture.h"
typedef struct _Direct3DBaseTexture9_INT
{
/* 0x0000 */ struct IDirect3DBaseTexture9Vtbl* lpVtbl;
/* 0x0004 */ DWORD dwUnknown04;
/* 0x0008 */ Direct3DResource9_INT BaseResource;
/* 0x004c */ DWORD dwUnknown4c;
/* 0x0050 */ DWORD dwUnknown50;
/* 0x0054 */ DWORD Usage;
/* 0x0058 */ WORD MipMapLevels;
/* 0x005a */ WORD dUnknown5a;
/* 0x005c */ WORD MipMapLevels2;
/* 0x005e */ WORD dUnknown5e;
} Direct3DBaseTexture9_INT;
struct IDirect3DBaseTexture9Vtbl;
void InitDirect3DBaseTexture9(Direct3DBaseTexture9_INT* pBaseTexture,
IDirect3DBaseTexture9Vtbl* pVtbl,
DWORD Usage,
UINT Levels,
D3DFORMAT Format,
D3DPOOL Pool,
struct _Direct3DDevice9_INT* pDevice,
enum REF_TYPE RefType);
#endif // _D3D9_TEXTURE_H_