mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-28 19:26:16 +00:00
D3D9: Implemented part of IDirect3DDevice9::CreateTexture()
svn path=/trunk/; revision=36271
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
@@ -23,6 +24,13 @@ LPDIRECT3DDEVICE9_INT IDirect3DDevice9ToImpl(LPDIRECT3DDEVICE9 iface)
|
||||
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 */
|
||||
HRESULT WINAPI IDirect3DDevice9Base_QueryInterface(LPDIRECT3DDEVICE9 iface, REFIID riid, void** ppvObject)
|
||||
{
|
||||
@@ -448,11 +456,72 @@ VOID WINAPI IDirect3DDevice9Base_GetGammaRamp(LPDIRECT3DDEVICE9 iface, UINT iSwa
|
||||
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
|
||||
HRESULT hResult;
|
||||
LPDIRECT3DDEVICE9_INT This = IDirect3DDevice9ToImpl(iface);
|
||||
LOCK_D3DDEVICE9();
|
||||
|
||||
return D3D_OK;
|
||||
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)
|
||||
|
||||
@@ -0,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;
|
||||
}
|
||||
|
||||
@@ -0,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_
|
||||
@@ -0,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_
|
||||
@@ -0,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_
|
||||
Reference in New Issue
Block a user