- beginning of implementation of Direct3D2 (DX 5.0) and associated classes
[wine/multimedia.git] / graphics / d3dtexture.c
blobf79ba1565998be5e7c982bc6d1abe3d0ea7a7912
1 /* Direct3D Texture
2 (c) 1998 Lionel ULMER
4 This files contains the implementation of interface Direct3DTexture2. */
7 #include "config.h"
8 #include "windows.h"
9 #include "wintypes.h"
10 #include "winerror.h"
11 #include "interfaces.h"
12 #include "heap.h"
13 #include "ddraw.h"
14 #include "d3d.h"
15 #include "debug.h"
17 #include "d3d_private.h"
19 #ifdef HAVE_MESAGL
21 static IDirect3DTexture2_VTable texture2_vtable;
22 static IDirect3DTexture_VTable texture_vtable;
24 /*******************************************************************************
25 * Texture2 Creation functions
27 LPDIRECT3DTEXTURE2 d3dtexture2_create(LPDIRECTDRAWSURFACE3 surf)
29 LPDIRECT3DTEXTURE2 mat;
31 mat = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DTexture2));
32 mat->ref = 1;
33 mat->lpvtbl = &texture2_vtable;
34 mat->surface = surf;
36 return mat;
39 /*******************************************************************************
40 * Texture Creation functions
42 LPDIRECT3DTEXTURE d3dtexture_create(LPDIRECTDRAWSURFACE3 surf)
44 LPDIRECT3DTEXTURE mat;
46 mat = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DTexture));
47 mat->ref = 1;
48 mat->lpvtbl = (IDirect3DTexture2_VTable*) &texture_vtable;
49 mat->surface = surf;
51 return mat;
55 /*******************************************************************************
56 * IDirect3DTexture2 methods
59 static HRESULT WINAPI IDirect3DTexture2_QueryInterface(LPDIRECT3DTEXTURE2 this,
60 REFIID riid,
61 LPVOID* ppvObj)
63 char xrefiid[50];
65 WINE_StringFromCLSID((LPCLSID)riid,xrefiid);
66 FIXME(ddraw, "(%p)->(%s,%p): stub\n", this, xrefiid,ppvObj);
68 return S_OK;
73 static ULONG WINAPI IDirect3DTexture2_AddRef(LPDIRECT3DTEXTURE2 this)
75 TRACE(ddraw, "(%p)->()incrementing from %lu.\n", this, this->ref );
77 return ++(this->ref);
82 static ULONG WINAPI IDirect3DTexture2_Release(LPDIRECT3DTEXTURE2 this)
84 FIXME( ddraw, "(%p)->() decrementing from %lu.\n", this, this->ref );
86 if (!--(this->ref)) {
87 HeapFree(GetProcessHeap(),0,this);
88 return 0;
91 return this->ref;
94 /*** IDirect3DTexture methods ***/
95 static HRESULT WINAPI IDirect3DTexture_GetHandle(LPDIRECT3DTEXTURE this,
96 LPDIRECT3DDEVICE lpD3DDevice,
97 LPD3DTEXTUREHANDLE lpHandle)
99 FIXME(ddraw, "(%p)->(%p,%p): stub\n", this, lpD3DDevice, lpHandle);
101 *lpHandle = (DWORD) this->surface;
103 return DD_OK;
106 static HRESULT WINAPI IDirect3DTexture_Initialize(LPDIRECT3DTEXTURE this,
107 LPDIRECT3DDEVICE lpD3DDevice,
108 LPDIRECTDRAWSURFACE lpSurface)
110 TRACE(ddraw, "(%p)->(%p,%p)\n", this, lpD3DDevice, lpSurface);
112 return DDERR_ALREADYINITIALIZED;
115 static HRESULT WINAPI IDirect3DTexture_Unload(LPDIRECT3DTEXTURE this)
117 FIXME(ddraw, "(%p)->(): stub\n", this);
119 return DD_OK;
122 /*** IDirect3DTexture2 methods ***/
123 static HRESULT WINAPI IDirect3DTexture2_GetHandle(LPDIRECT3DTEXTURE2 this,
124 LPDIRECT3DDEVICE2 lpD3DDevice2,
125 LPD3DTEXTUREHANDLE lpHandle)
127 FIXME(ddraw, "(%p)->(%p,%p): stub\n", this, lpD3DDevice2, lpHandle);
129 *lpHandle = (DWORD) this->surface; /* lpD3DDevice2->store_texture(this); */
131 return DD_OK;
134 /* Common methods */
135 static HRESULT WINAPI IDirect3DTexture2_PaletteChanged(LPDIRECT3DTEXTURE2 this,
136 DWORD dwStart,
137 DWORD dwCount)
139 FIXME(ddraw, "(%p)->(%8ld,%8ld): stub\n", this, dwStart, dwCount);
141 return DD_OK;
144 static HRESULT WINAPI IDirect3DTexture2_Load(LPDIRECT3DTEXTURE2 this,
145 LPDIRECT3DTEXTURE2 lpD3DTexture2)
147 FIXME(ddraw, "(%p)->(%p): stub\n", this, lpD3DTexture2);
149 /* Hack ? */
150 FIXME(ddraw, "Sthis %p / Sload %p\n", this->surface, lpD3DTexture2->surface);
151 this->surface->s.surface_desc.ddsCaps.dwCaps &= ~DDSCAPS_ALLOCONLOAD;
153 return DD_OK;
157 /*******************************************************************************
158 * IDirect3DTexture2 VTable
160 static IDirect3DTexture2_VTable texture2_vtable = {
161 /*** IUnknown methods ***/
162 IDirect3DTexture2_QueryInterface,
163 IDirect3DTexture2_AddRef,
164 IDirect3DTexture2_Release,
165 /*** IDirect3DTexture methods ***/
166 IDirect3DTexture2_GetHandle,
167 IDirect3DTexture2_PaletteChanged,
168 IDirect3DTexture2_Load
171 /*******************************************************************************
172 * IDirect3DTexture VTable
174 static IDirect3DTexture_VTable texture_vtable = {
175 /*** IUnknown methods ***/
176 IDirect3DTexture2_QueryInterface,
177 IDirect3DTexture2_AddRef,
178 IDirect3DTexture2_Release,
179 /*** IDirect3DTexture methods ***/
180 IDirect3DTexture_Initialize,
181 IDirect3DTexture_GetHandle,
182 IDirect3DTexture2_PaletteChanged,
183 IDirect3DTexture2_Load,
184 IDirect3DTexture_Unload
187 #else /* HAVE_MESAGL */
189 /* These function should never be called if MesaGL is not present */
190 LPDIRECT3DTEXTURE2 d3dtexture2_create(LPDIRECTDRAWSURFACE3 surf) {
191 ERR(ddraw, "Should not be called...\n");
192 return NULL;
195 LPDIRECT3DTEXTURE d3dtexture_create(LPDIRECTDRAWSURFACE3 surf) {
196 ERR(ddraw, "Should not be called...\n");
197 return NULL;
200 #endif /* HAVE_MESAGL */