ReactOS  0.4.15-dev-499-g1f31905
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,
24  DWORD Usage,
25  UINT Levels,
27  D3DPOOL Pool,
28  struct _Direct3DDevice9_INT* pDevice,
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;
115  LOCK_D3DDEVICE9();
116 
117  MipMapLevels = This->MipMapLevels;
118 
120  return MipMapLevels;
121 }
DWORD WINAPI D3D9Texture_GetLevelCount(LPDIRECT3DBASETEXTURE9 iface)
Definition: d3d9_texture.c:111
IDirect3DBaseTexture9Vtbl * lpVtbl
_Must_inspect_result_ _In_ USAGE _In_ USHORT _In_ USAGE Usage
Definition: hidpi.h:382
#define D3DUSAGE_AUTOGENMIPMAP
Definition: d3d9types.h:113
enum _D3DPOOL D3DPOOL
DWORD WINAPI D3D9Texture_GetLOD(LPDIRECT3DBASETEXTURE9 iface)
Definition: d3d9_texture.c:84
D3DTEXTUREFILTERTYPE FilterType
smooth NULL
Definition: ftsmooth.c:416
enum _D3DFORMAT D3DFORMAT
#define LOCK_D3DDEVICE9()
Definition: d3d9_texture.c:10
#define WINAPI
Definition: msvc.h:6
Definition: bufpool.h:50
unsigned long DWORD
Definition: ntddk_ex.h:95
REF_TYPE
struct IDirect3DBaseTexture9 * LPDIRECT3DBASETEXTURE9
Definition: d3d9.h:157
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
unsigned int UINT
Definition: ndis.h:50
Direct3DBaseTexture9_INT * IDirect3DBaseTexture9ToImpl(LPDIRECT3DBASETEXTURE9 iface)
Definition: d3d9_texture.c:14
Direct3DResource9_INT BaseResource
enum _D3DTEXTUREFILTERTYPE D3DTEXTUREFILTERTYPE
void InitDirect3DResource9(Direct3DResource9_INT *pResource, D3DPOOL Pool, LPDIRECT3DDEVICE9_INT pBaseDevice, enum REF_TYPE RefType)
Definition: d3d9_resource.c:11
#define ULONG_PTR
Definition: config.h:101
D3DTEXTUREFILTERTYPE WINAPI D3D9Texture_GetAutoGenFilterType(LPDIRECT3DBASETEXTURE9 iface)
Definition: d3d9_texture.c:58
#define UNLOCK_D3DDEVICE9()
Definition: d3d9_texture.c:11
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char * Format
Definition: acpixf.h:1216
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