ReactOS 0.4.16-dev-338-g34e76ad
d3d9_texture.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS ReactX
4 * FILE: dll/directx/d3d9/d3d9_texture.c
5 * PURPOSE: d3d9.dll internal texture surface functions
6 * PROGRAMERS: Gregor Gullwi <gbrunmar (dot) ros (at) gmail (dot) com>
7 */
8#include "d3d9_texture.h"
9
10#define LOCK_D3DDEVICE9() D3D9BaseObject_LockDevice(&This->BaseResource.BaseObject)
11#define UNLOCK_D3DDEVICE9() D3D9BaseObject_UnlockDevice(&This->BaseResource.BaseObject)
12
13/* Convert a IDirect3DBaseTexture9 pointer safely to the internal implementation struct */
15{
16 if (NULL == iface)
17 return NULL;
18
20}
21
23 IDirect3DBaseTexture9Vtbl* pVtbl,
29 enum REF_TYPE RefType)
30{
31 InitDirect3DResource9(&pBaseTexture->BaseResource, Pool, pDevice, RefType);
32
33 pBaseTexture->lpVtbl = pVtbl;
34 pBaseTexture->Format = Format;
35 pBaseTexture->wPaletteIndex = 0xFFFF;
36 pBaseTexture->Usage = Usage;
37 pBaseTexture->MipMapLevels = Levels;
38 pBaseTexture->MipMapLevels2 = Levels;
39
40 pBaseTexture->FilterType = D3DTEXF_LINEAR;
41 pBaseTexture->bIsAutoGenMipMap = (Usage & D3DUSAGE_AUTOGENMIPMAP) != 0;
42}
43
44/*++
45* @name IDirect3DBaseTexture9::GetAutoGenFilterType
46* @implemented
47*
48* The function D3D9Texture_GetAutoGenFilterType returns filter type
49* that is used when automated mipmaping is set.
50*
51* @param LPDIRECT3DBASETEXTURE9 iface
52* Pointer to a IDirect3DBaseTexture9 interface
53*
54* @return D3DTEXTUREFILTERTYPE
55* Filter type used when automated mipmaping is set for the specified texture.
56*
57*/
59{
60 D3DTEXTUREFILTERTYPE FilterType;
63
64 FilterType = This->dwFilterType;
65
67 return FilterType;
68}
69
70/*++
71* @name IDirect3DBaseTexture9::GetLOD
72* @implemented
73*
74* The function D3D9Texture_GetLOD returns the number
75* max LODs for the specified texture, if it's managed.
76*
77* @param LPDIRECT3DBASETEXTURE9 iface
78* Pointer to a IDirect3DBaseTexture9 interface
79*
80* @return DWORD
81* Returns the number of LODs in the specified texture if it's managed.
82*
83*/
85{
86 DWORD MaxLOD = 0;
89
90 if (This->BaseResource.bIsManaged)
91 MaxLOD = This->MaxLOD;
92
94 return MaxLOD;
95}
96
97/*++
98* @name IDirect3DBaseTexture9::GetLevelCount
99* @implemented
100*
101* The function D3D9Texture_GetLevelCount returns the number of mip map levels
102* in the specified texture.
103*
104* @param LPDIRECT3DBASETEXTURE9 iface
105* Pointer to a IDirect3DBaseTexture9 interface
106*
107* @return DWORD
108* Returns the number of levels in the specified texture.
109*
110*/
112{
113 DWORD MipMapLevels;
116
117 MipMapLevels = This->MipMapLevels;
118
120 return MipMapLevels;
121}
Definition: bufpool.h:50
@ D3DTEXF_LINEAR
Definition: d3d8types.h:872
enum _D3DPOOL D3DPOOL
enum _D3DFORMAT D3DFORMAT
enum _D3DTEXTUREFILTERTYPE D3DTEXTUREFILTERTYPE
struct IDirect3DBaseTexture9 * LPDIRECT3DBASETEXTURE9
Definition: d3d9.h:157
REF_TYPE
void InitDirect3DResource9(Direct3DResource9_INT *pResource, D3DPOOL Pool, LPDIRECT3DDEVICE9_INT pBaseDevice, enum REF_TYPE RefType)
Definition: d3d9_resource.c:11
void InitDirect3DBaseTexture9(Direct3DBaseTexture9_INT *pBaseTexture, IDirect3DBaseTexture9Vtbl *pVtbl, DWORD Usage, UINT Levels, D3DFORMAT Format, D3DPOOL Pool, struct _Direct3DDevice9_INT *pDevice, enum REF_TYPE RefType)
Definition: d3d9_texture.c:22
#define UNLOCK_D3DDEVICE9()
Definition: d3d9_texture.c:11
#define LOCK_D3DDEVICE9()
Definition: d3d9_texture.c:10
Direct3DBaseTexture9_INT * IDirect3DBaseTexture9ToImpl(LPDIRECT3DBASETEXTURE9 iface)
Definition: d3d9_texture.c:14
DWORD WINAPI D3D9Texture_GetLOD(LPDIRECT3DBASETEXTURE9 iface)
Definition: d3d9_texture.c:84
DWORD WINAPI D3D9Texture_GetLevelCount(LPDIRECT3DBASETEXTURE9 iface)
Definition: d3d9_texture.c:111
D3DTEXTUREFILTERTYPE WINAPI D3D9Texture_GetAutoGenFilterType(LPDIRECT3DBASETEXTURE9 iface)
Definition: d3d9_texture.c:58
#define D3DUSAGE_AUTOGENMIPMAP
Definition: d3d9types.h:113
#define NULL
Definition: types.h:112
#define ULONG_PTR
Definition: config.h:101
unsigned long DWORD
Definition: ntddk_ex.h:95
FxDevice * pDevice
_Must_inspect_result_ _In_ USAGE _In_ USHORT _In_ USAGE Usage
Definition: hidpi.h:384
unsigned int UINT
Definition: ndis.h:50
Direct3DResource9_INT BaseResource
IDirect3DBaseTexture9Vtbl * lpVtbl
D3DTEXTUREFILTERTYPE FilterType
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define WINAPI
Definition: msvc.h:6