1 | /*
|
---|
2 | * IWineD3DCubeTexture implementation
|
---|
3 | *
|
---|
4 | * Copyright 2002-2005 Jason Edmeades
|
---|
5 | * Copyright 2002-2005 Raphael Junqueira
|
---|
6 | * Copyright 2005 Oliver Stieber
|
---|
7 | * Copyright 2007-2008 Stefan Dösinger for CodeWeavers
|
---|
8 | *
|
---|
9 | * This library is free software; you can redistribute it and/or
|
---|
10 | * modify it under the terms of the GNU Lesser General Public
|
---|
11 | * License as published by the Free Software Foundation; either
|
---|
12 | * version 2.1 of the License, or (at your option) any later version.
|
---|
13 | *
|
---|
14 | * This library is distributed in the hope that it will be useful,
|
---|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
17 | * Lesser General Public License for more details.
|
---|
18 | *
|
---|
19 | * You should have received a copy of the GNU Lesser General Public
|
---|
20 | * License along with this library; if not, write to the Free Software
|
---|
21 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
---|
22 | */
|
---|
23 |
|
---|
24 | /*
|
---|
25 | * Sun LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
|
---|
26 | * other than GPL or LGPL is available it will apply instead, Sun elects to use only
|
---|
27 | * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
|
---|
28 | * a choice of LGPL license versions is made available with the language indicating
|
---|
29 | * that LGPLv2 or any later version may be used, or where a choice of which version
|
---|
30 | * of the LGPL is applied is otherwise unspecified.
|
---|
31 | */
|
---|
32 |
|
---|
33 | #include "config.h"
|
---|
34 | #include "wined3d_private.h"
|
---|
35 |
|
---|
36 | WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture);
|
---|
37 | #define GLINFO_LOCATION This->resource.wineD3DDevice->adapter->gl_info
|
---|
38 |
|
---|
39 | /* *******************************************
|
---|
40 | IWineD3DCubeTexture IUnknown parts follow
|
---|
41 | ******************************************* */
|
---|
42 | static HRESULT WINAPI IWineD3DCubeTextureImpl_QueryInterface(IWineD3DCubeTexture *iface, REFIID riid, LPVOID *ppobj)
|
---|
43 | {
|
---|
44 | IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
|
---|
45 | TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppobj);
|
---|
46 | if (IsEqualGUID(riid, &IID_IUnknown)
|
---|
47 | || IsEqualGUID(riid, &IID_IWineD3DBase)
|
---|
48 | || IsEqualGUID(riid, &IID_IWineD3DResource)
|
---|
49 | || IsEqualGUID(riid, &IID_IWineD3DBaseTexture)
|
---|
50 | || IsEqualGUID(riid, &IID_IWineD3DCubeTexture)) {
|
---|
51 | IUnknown_AddRef(iface);
|
---|
52 | *ppobj = This;
|
---|
53 | return S_OK;
|
---|
54 | }
|
---|
55 | *ppobj = NULL;
|
---|
56 | return E_NOINTERFACE;
|
---|
57 | }
|
---|
58 |
|
---|
59 | static ULONG WINAPI IWineD3DCubeTextureImpl_AddRef(IWineD3DCubeTexture *iface) {
|
---|
60 | IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
|
---|
61 | TRACE("(%p) : AddRef increasing from %d\n", This, This->resource.ref);
|
---|
62 | return InterlockedIncrement(&This->resource.ref);
|
---|
63 | }
|
---|
64 |
|
---|
65 | static ULONG WINAPI IWineD3DCubeTextureImpl_Release(IWineD3DCubeTexture *iface) {
|
---|
66 | IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
|
---|
67 | ULONG ref;
|
---|
68 | TRACE("(%p) : Releasing from %d\n", This, This->resource.ref);
|
---|
69 | ref = InterlockedDecrement(&This->resource.ref);
|
---|
70 | if (ref == 0) {
|
---|
71 | IWineD3DCubeTexture_Destroy(iface, D3DCB_DefaultDestroySurface);
|
---|
72 | }
|
---|
73 | return ref;
|
---|
74 | }
|
---|
75 |
|
---|
76 | /* ****************************************************
|
---|
77 | IWineD3DCubeTexture IWineD3DResource parts follow
|
---|
78 | **************************************************** */
|
---|
79 | static HRESULT WINAPI IWineD3DCubeTextureImpl_GetDevice(IWineD3DCubeTexture *iface, IWineD3DDevice** ppDevice) {
|
---|
80 | return resource_get_device((IWineD3DResource *)iface, ppDevice);
|
---|
81 | }
|
---|
82 |
|
---|
83 | static HRESULT WINAPI IWineD3DCubeTextureImpl_SetPrivateData(IWineD3DCubeTexture *iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
|
---|
84 | return resource_set_private_data((IWineD3DResource *)iface, refguid, pData, SizeOfData, Flags);
|
---|
85 | }
|
---|
86 |
|
---|
87 | static HRESULT WINAPI IWineD3DCubeTextureImpl_GetPrivateData(IWineD3DCubeTexture *iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
|
---|
88 | return resource_get_private_data((IWineD3DResource *)iface, refguid, pData, pSizeOfData);
|
---|
89 | }
|
---|
90 |
|
---|
91 | static HRESULT WINAPI IWineD3DCubeTextureImpl_FreePrivateData(IWineD3DCubeTexture *iface, REFGUID refguid) {
|
---|
92 | return resource_free_private_data((IWineD3DResource *)iface, refguid);
|
---|
93 | }
|
---|
94 |
|
---|
95 | static DWORD WINAPI IWineD3DCubeTextureImpl_SetPriority(IWineD3DCubeTexture *iface, DWORD PriorityNew) {
|
---|
96 | return resource_set_priority((IWineD3DResource *)iface, PriorityNew);
|
---|
97 | }
|
---|
98 |
|
---|
99 | static DWORD WINAPI IWineD3DCubeTextureImpl_GetPriority(IWineD3DCubeTexture *iface) {
|
---|
100 | return resource_get_priority((IWineD3DResource *)iface);
|
---|
101 | }
|
---|
102 |
|
---|
103 | static void WINAPI IWineD3DCubeTextureImpl_PreLoad(IWineD3DCubeTexture *iface) {
|
---|
104 | /* Override the IWineD3DResource Preload method */
|
---|
105 | unsigned int i,j;
|
---|
106 | IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
|
---|
107 | IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
|
---|
108 | BOOL srgb_mode = This->baseTexture.is_srgb;
|
---|
109 | BOOL srgb_was_toggled = FALSE;
|
---|
110 |
|
---|
111 | TRACE("(%p) : About to load texture: dirtified(%d)\n", This, This->baseTexture.dirty);
|
---|
112 |
|
---|
113 | /* We only have to activate a context for gl when we're not drawing. In most cases PreLoad will be called during draw
|
---|
114 | * and a context was activated at the beginning of drawPrimitive
|
---|
115 | */
|
---|
116 | if(!device->isInDraw) {
|
---|
117 | /* No danger of recursive calls, ActivateContext sets isInDraw to true when loading
|
---|
118 | * offscreen render targets into their texture
|
---|
119 | */
|
---|
120 | ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
|
---|
121 | } else if (GL_SUPPORT(EXT_TEXTURE_SRGB) && This->baseTexture.bindCount > 0) {
|
---|
122 | srgb_mode = device->stateBlock->samplerState[This->baseTexture.sampler][WINED3DSAMP_SRGBTEXTURE];
|
---|
123 | srgb_was_toggled = (This->baseTexture.is_srgb != srgb_mode);
|
---|
124 | This->baseTexture.is_srgb = srgb_mode;
|
---|
125 | }
|
---|
126 |
|
---|
127 | if (This->resource.format == WINED3DFMT_P8 || This->resource.format == WINED3DFMT_A8P8) {
|
---|
128 | for (i = 0; i < This->baseTexture.levels; i++) {
|
---|
129 | for (j = WINED3DCUBEMAP_FACE_POSITIVE_X; j <= WINED3DCUBEMAP_FACE_NEGATIVE_Z ; j++) {
|
---|
130 | if(palette9_changed((IWineD3DSurfaceImpl *)This->surfaces[j][i])) {
|
---|
131 | TRACE("Reloading surface because the d3d8/9 palette was changed\n");
|
---|
132 | /* TODO: This is not necessarily needed with hw palettized texture support */
|
---|
133 | IWineD3DSurface_LoadLocation(This->surfaces[j][i], SFLAG_INSYSMEM, NULL);
|
---|
134 | /* Make sure the texture is reloaded because of the palette change, this kills performance though :( */
|
---|
135 | IWineD3DSurface_ModifyLocation(This->surfaces[j][i], SFLAG_INTEXTURE, FALSE);
|
---|
136 | }
|
---|
137 | }
|
---|
138 | }
|
---|
139 | }
|
---|
140 | /* If the texture is marked dirty or the srgb sampler setting has changed since the last load then reload the surfaces */
|
---|
141 | if (This->baseTexture.dirty) {
|
---|
142 | for (i = 0; i < This->baseTexture.levels; i++) {
|
---|
143 | for (j = WINED3DCUBEMAP_FACE_POSITIVE_X; j <= WINED3DCUBEMAP_FACE_NEGATIVE_Z ; j++) {
|
---|
144 | IWineD3DSurface_LoadTexture(This->surfaces[j][i], srgb_mode);
|
---|
145 | }
|
---|
146 | }
|
---|
147 | } else if (srgb_was_toggled) {
|
---|
148 | /* Loop is repeated in the else block with the extra AddDirtyRect line to avoid the alternative of
|
---|
149 | * checking srgb_was_toggled in every iteration, even when the texture is just dirty
|
---|
150 | */
|
---|
151 | if (This->baseTexture.srgb_mode_change_count < 20)
|
---|
152 | ++This->baseTexture.srgb_mode_change_count;
|
---|
153 | else
|
---|
154 | FIXME("Cubetexture (%p) has been reloaded at least 20 times due to WINED3DSAMP_SRGBTEXTURE changes on it\'s sampler\n", This);
|
---|
155 |
|
---|
156 | for (i = 0; i < This->baseTexture.levels; i++) {
|
---|
157 | for (j = WINED3DCUBEMAP_FACE_POSITIVE_X; j <= WINED3DCUBEMAP_FACE_NEGATIVE_Z ; j++) {
|
---|
158 | IWineD3DSurface_AddDirtyRect(This->surfaces[j][i], NULL);
|
---|
159 | surface_force_reload(This->surfaces[j][i]);
|
---|
160 | IWineD3DSurface_LoadTexture(This->surfaces[j][i], srgb_mode);
|
---|
161 | }
|
---|
162 | }
|
---|
163 | } else {
|
---|
164 | TRACE("(%p) Texture not dirty, nothing to do\n" , iface);
|
---|
165 | }
|
---|
166 |
|
---|
167 | /* No longer dirty */
|
---|
168 | This->baseTexture.dirty = FALSE;
|
---|
169 | return ;
|
---|
170 | }
|
---|
171 |
|
---|
172 | static void WINAPI IWineD3DCubeTextureImpl_UnLoad(IWineD3DCubeTexture *iface) {
|
---|
173 | unsigned int i, j;
|
---|
174 | IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
|
---|
175 | TRACE("(%p)\n", This);
|
---|
176 |
|
---|
177 | /* Unload all the surfaces and reset the texture name. If UnLoad was called on the
|
---|
178 | * surface before, this one will be a NOP and vice versa. Unloading an unloaded
|
---|
179 | * surface is fine
|
---|
180 | */
|
---|
181 | for (i = 0; i < This->baseTexture.levels; i++) {
|
---|
182 | for (j = WINED3DCUBEMAP_FACE_POSITIVE_X; j <= WINED3DCUBEMAP_FACE_NEGATIVE_Z ; j++) {
|
---|
183 | IWineD3DSurface_UnLoad(This->surfaces[j][i]);
|
---|
184 | surface_set_texture_name(This->surfaces[j][i], 0);
|
---|
185 | }
|
---|
186 | }
|
---|
187 |
|
---|
188 | basetexture_unload((IWineD3DBaseTexture *)iface);
|
---|
189 | }
|
---|
190 |
|
---|
191 | static WINED3DRESOURCETYPE WINAPI IWineD3DCubeTextureImpl_GetType(IWineD3DCubeTexture *iface) {
|
---|
192 | return resource_get_type((IWineD3DResource *)iface);
|
---|
193 | }
|
---|
194 |
|
---|
195 | static HRESULT WINAPI IWineD3DCubeTextureImpl_GetParent(IWineD3DCubeTexture *iface, IUnknown **pParent) {
|
---|
196 | return resource_get_parent((IWineD3DResource *)iface, pParent);
|
---|
197 | }
|
---|
198 |
|
---|
199 | /* ******************************************************
|
---|
200 | IWineD3DCubeTexture IWineD3DBaseTexture parts follow
|
---|
201 | ****************************************************** */
|
---|
202 | static DWORD WINAPI IWineD3DCubeTextureImpl_SetLOD(IWineD3DCubeTexture *iface, DWORD LODNew) {
|
---|
203 | return basetexture_set_lod((IWineD3DBaseTexture *)iface, LODNew);
|
---|
204 | }
|
---|
205 |
|
---|
206 | static DWORD WINAPI IWineD3DCubeTextureImpl_GetLOD(IWineD3DCubeTexture *iface) {
|
---|
207 | return basetexture_get_lod((IWineD3DBaseTexture *)iface);
|
---|
208 | }
|
---|
209 |
|
---|
210 | static DWORD WINAPI IWineD3DCubeTextureImpl_GetLevelCount(IWineD3DCubeTexture *iface) {
|
---|
211 | return basetexture_get_level_count((IWineD3DBaseTexture *)iface);
|
---|
212 | }
|
---|
213 |
|
---|
214 | static HRESULT WINAPI IWineD3DCubeTextureImpl_SetAutoGenFilterType(IWineD3DCubeTexture *iface, WINED3DTEXTUREFILTERTYPE FilterType) {
|
---|
215 | return basetexture_set_autogen_filter_type((IWineD3DBaseTexture *)iface, FilterType);
|
---|
216 | }
|
---|
217 |
|
---|
218 | static WINED3DTEXTUREFILTERTYPE WINAPI IWineD3DCubeTextureImpl_GetAutoGenFilterType(IWineD3DCubeTexture *iface) {
|
---|
219 | return basetexture_get_autogen_filter_type((IWineD3DBaseTexture *)iface);
|
---|
220 | }
|
---|
221 |
|
---|
222 | static void WINAPI IWineD3DCubeTextureImpl_GenerateMipSubLevels(IWineD3DCubeTexture *iface) {
|
---|
223 | basetexture_generate_mipmaps((IWineD3DBaseTexture *)iface);
|
---|
224 | }
|
---|
225 |
|
---|
226 | /* Internal function, No d3d mapping */
|
---|
227 | static BOOL WINAPI IWineD3DCubeTextureImpl_SetDirty(IWineD3DCubeTexture *iface, BOOL dirty) {
|
---|
228 | return basetexture_set_dirty((IWineD3DBaseTexture *)iface, dirty);
|
---|
229 | }
|
---|
230 |
|
---|
231 | /* Internal function, No d3d mapping */
|
---|
232 | static BOOL WINAPI IWineD3DCubeTextureImpl_GetDirty(IWineD3DCubeTexture *iface) {
|
---|
233 | return basetexture_get_dirty((IWineD3DBaseTexture *)iface);
|
---|
234 | }
|
---|
235 |
|
---|
236 | static HRESULT WINAPI IWineD3DCubeTextureImpl_BindTexture(IWineD3DCubeTexture *iface) {
|
---|
237 | IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
|
---|
238 | BOOL set_gl_texture_desc = This->baseTexture.textureName == 0;
|
---|
239 | HRESULT hr;
|
---|
240 |
|
---|
241 | TRACE("(%p) : relay to BaseTexture\n", This);
|
---|
242 |
|
---|
243 | hr = basetexture_bind((IWineD3DBaseTexture *)iface);
|
---|
244 | if (set_gl_texture_desc && SUCCEEDED(hr)) {
|
---|
245 | UINT i, j;
|
---|
246 | for (i = 0; i < This->baseTexture.levels; ++i) {
|
---|
247 | for (j = WINED3DCUBEMAP_FACE_POSITIVE_X; j <= WINED3DCUBEMAP_FACE_NEGATIVE_Z; ++j) {
|
---|
248 | surface_set_texture_name(This->surfaces[j][i], This->baseTexture.textureName);
|
---|
249 | }
|
---|
250 | }
|
---|
251 | }
|
---|
252 |
|
---|
253 | return hr;
|
---|
254 | }
|
---|
255 |
|
---|
256 | static UINT WINAPI IWineD3DCubeTextureImpl_GetTextureDimensions(IWineD3DCubeTexture *iface){
|
---|
257 | IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
|
---|
258 | TRACE("(%p)\n", This);
|
---|
259 |
|
---|
260 | return GL_TEXTURE_CUBE_MAP_ARB;
|
---|
261 | }
|
---|
262 |
|
---|
263 | static BOOL WINAPI IWineD3DCubeTextureImpl_IsCondNP2(IWineD3DCubeTexture *iface) {
|
---|
264 | IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
|
---|
265 | TRACE("(%p)\n", This);
|
---|
266 |
|
---|
267 | return FALSE;
|
---|
268 | }
|
---|
269 |
|
---|
270 | static void WINAPI IWineD3DCubeTextureImpl_ApplyStateChanges(IWineD3DCubeTexture *iface,
|
---|
271 | const DWORD textureStates[WINED3D_HIGHEST_TEXTURE_STATE + 1],
|
---|
272 | const DWORD samplerStates[WINED3D_HIGHEST_SAMPLER_STATE + 1]) {
|
---|
273 | TRACE("(%p) : relay to BaseTexture\n", iface);
|
---|
274 | basetexture_apply_state_changes((IWineD3DBaseTexture *)iface, textureStates, samplerStates);
|
---|
275 | }
|
---|
276 |
|
---|
277 |
|
---|
278 | /* *******************************************
|
---|
279 | IWineD3DCubeTexture IWineD3DCubeTexture parts follow
|
---|
280 | ******************************************* */
|
---|
281 | static void WINAPI IWineD3DCubeTextureImpl_Destroy(IWineD3DCubeTexture *iface, D3DCB_DESTROYSURFACEFN D3DCB_DestroySurface) {
|
---|
282 | IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
|
---|
283 | unsigned int i,j;
|
---|
284 | TRACE("(%p) : Cleaning up\n",This);
|
---|
285 | for (i = 0; i < This->baseTexture.levels; i++) {
|
---|
286 | for (j = 0; j < 6; j++) {
|
---|
287 | if (This->surfaces[j][i] != NULL) {
|
---|
288 | IWineD3DSurface *surface = This->surfaces[j][i];
|
---|
289 | /* Clean out the texture name we gave to the surface so that the surface doesn't try and release it */
|
---|
290 | surface_set_texture_name(surface, 0);
|
---|
291 | surface_set_texture_target(surface, 0);
|
---|
292 | /* Cleanup the container */
|
---|
293 | IWineD3DSurface_SetContainer(This->surfaces[j][i], 0);
|
---|
294 | D3DCB_DestroySurface(This->surfaces[j][i]);
|
---|
295 | }
|
---|
296 | }
|
---|
297 | }
|
---|
298 | basetexture_cleanup((IWineD3DBaseTexture *)iface);
|
---|
299 | /* finally delete the object */
|
---|
300 | HeapFree(GetProcessHeap(), 0, This);
|
---|
301 | }
|
---|
302 |
|
---|
303 | static HRESULT WINAPI IWineD3DCubeTextureImpl_GetLevelDesc(IWineD3DCubeTexture *iface, UINT Level, WINED3DSURFACE_DESC* pDesc) {
|
---|
304 | IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
|
---|
305 |
|
---|
306 | if (Level < This->baseTexture.levels) {
|
---|
307 | TRACE("(%p) level (%d)\n", This, Level);
|
---|
308 | return IWineD3DSurface_GetDesc(This->surfaces[0][Level], pDesc);
|
---|
309 | }
|
---|
310 | FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->baseTexture.levels);
|
---|
311 | return WINED3DERR_INVALIDCALL;
|
---|
312 | }
|
---|
313 |
|
---|
314 | static HRESULT WINAPI IWineD3DCubeTextureImpl_GetCubeMapSurface(IWineD3DCubeTexture *iface, WINED3DCUBEMAP_FACES FaceType, UINT Level, IWineD3DSurface** ppCubeMapSurface) {
|
---|
315 | IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
|
---|
316 | HRESULT hr = WINED3DERR_INVALIDCALL;
|
---|
317 |
|
---|
318 | if (Level < This->baseTexture.levels && FaceType <= WINED3DCUBEMAP_FACE_NEGATIVE_Z) {
|
---|
319 | *ppCubeMapSurface = This->surfaces[FaceType][Level];
|
---|
320 | IWineD3DSurface_AddRef(*ppCubeMapSurface);
|
---|
321 |
|
---|
322 | hr = WINED3D_OK;
|
---|
323 | }
|
---|
324 | if (WINED3D_OK == hr) {
|
---|
325 | TRACE("(%p) -> faceType(%d) level(%d) returning surface@%p\n", This, FaceType, Level, This->surfaces[FaceType][Level]);
|
---|
326 | } else {
|
---|
327 | WARN("(%p) level(%d) overflow Levels(%d) Or FaceType(%d)\n", This, Level, This->baseTexture.levels, FaceType);
|
---|
328 | }
|
---|
329 |
|
---|
330 | return hr;
|
---|
331 | }
|
---|
332 |
|
---|
333 | static HRESULT WINAPI IWineD3DCubeTextureImpl_LockRect(IWineD3DCubeTexture *iface, WINED3DCUBEMAP_FACES FaceType, UINT Level, WINED3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) {
|
---|
334 | HRESULT hr = WINED3DERR_INVALIDCALL;
|
---|
335 | IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
|
---|
336 |
|
---|
337 | if (Level < This->baseTexture.levels && FaceType <= WINED3DCUBEMAP_FACE_NEGATIVE_Z) {
|
---|
338 | hr = IWineD3DSurface_LockRect(This->surfaces[FaceType][Level], pLockedRect, pRect, Flags);
|
---|
339 | }
|
---|
340 |
|
---|
341 | if (WINED3D_OK == hr) {
|
---|
342 | TRACE("(%p) -> faceType(%d) level(%d) returning memory@%p success(%u)\n", This, FaceType, Level, pLockedRect->pBits, hr);
|
---|
343 | } else {
|
---|
344 | WARN("(%p) level(%d) overflow Levels(%d) Or FaceType(%d)\n", This, Level, This->baseTexture.levels, FaceType);
|
---|
345 | }
|
---|
346 |
|
---|
347 | return hr;
|
---|
348 | }
|
---|
349 |
|
---|
350 | static HRESULT WINAPI IWineD3DCubeTextureImpl_UnlockRect(IWineD3DCubeTexture *iface, WINED3DCUBEMAP_FACES FaceType, UINT Level) {
|
---|
351 | HRESULT hr = WINED3DERR_INVALIDCALL;
|
---|
352 | IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
|
---|
353 |
|
---|
354 | if (Level < This->baseTexture.levels && FaceType <= WINED3DCUBEMAP_FACE_NEGATIVE_Z) {
|
---|
355 | hr = IWineD3DSurface_UnlockRect(This->surfaces[FaceType][Level]);
|
---|
356 | }
|
---|
357 |
|
---|
358 | if (WINED3D_OK == hr) {
|
---|
359 | TRACE("(%p) -> faceType(%d) level(%d) success(%u)\n", This, FaceType, Level, hr);
|
---|
360 | } else {
|
---|
361 | WARN("(%p) level(%d) overflow Levels(%d) Or FaceType(%d)\n", This, Level, This->baseTexture.levels, FaceType);
|
---|
362 | }
|
---|
363 | return hr;
|
---|
364 | }
|
---|
365 |
|
---|
366 | static HRESULT WINAPI IWineD3DCubeTextureImpl_AddDirtyRect(IWineD3DCubeTexture *iface, WINED3DCUBEMAP_FACES FaceType, CONST RECT* pDirtyRect) {
|
---|
367 | HRESULT hr = WINED3DERR_INVALIDCALL;
|
---|
368 | IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
|
---|
369 | This->baseTexture.dirty = TRUE;
|
---|
370 | TRACE("(%p) : dirtyfication of faceType(%d) Level (0)\n", This, FaceType);
|
---|
371 | if (FaceType <= WINED3DCUBEMAP_FACE_NEGATIVE_Z) {
|
---|
372 | hr = IWineD3DSurface_AddDirtyRect(This->surfaces[FaceType][0], pDirtyRect);
|
---|
373 | } else {
|
---|
374 | WARN("(%p) overflow FaceType(%d)\n", This, FaceType);
|
---|
375 | }
|
---|
376 | return hr;
|
---|
377 | }
|
---|
378 |
|
---|
379 |
|
---|
380 | const IWineD3DCubeTextureVtbl IWineD3DCubeTexture_Vtbl =
|
---|
381 | {
|
---|
382 | /* IUnknown */
|
---|
383 | IWineD3DCubeTextureImpl_QueryInterface,
|
---|
384 | IWineD3DCubeTextureImpl_AddRef,
|
---|
385 | IWineD3DCubeTextureImpl_Release,
|
---|
386 | /* IWineD3DResource */
|
---|
387 | IWineD3DCubeTextureImpl_GetParent,
|
---|
388 | IWineD3DCubeTextureImpl_GetDevice,
|
---|
389 | IWineD3DCubeTextureImpl_SetPrivateData,
|
---|
390 | IWineD3DCubeTextureImpl_GetPrivateData,
|
---|
391 | IWineD3DCubeTextureImpl_FreePrivateData,
|
---|
392 | IWineD3DCubeTextureImpl_SetPriority,
|
---|
393 | IWineD3DCubeTextureImpl_GetPriority,
|
---|
394 | IWineD3DCubeTextureImpl_PreLoad,
|
---|
395 | IWineD3DCubeTextureImpl_UnLoad,
|
---|
396 | IWineD3DCubeTextureImpl_GetType,
|
---|
397 | /* IWineD3DBaseTexture */
|
---|
398 | IWineD3DCubeTextureImpl_SetLOD,
|
---|
399 | IWineD3DCubeTextureImpl_GetLOD,
|
---|
400 | IWineD3DCubeTextureImpl_GetLevelCount,
|
---|
401 | IWineD3DCubeTextureImpl_SetAutoGenFilterType,
|
---|
402 | IWineD3DCubeTextureImpl_GetAutoGenFilterType,
|
---|
403 | IWineD3DCubeTextureImpl_GenerateMipSubLevels,
|
---|
404 | IWineD3DCubeTextureImpl_SetDirty,
|
---|
405 | IWineD3DCubeTextureImpl_GetDirty,
|
---|
406 | IWineD3DCubeTextureImpl_BindTexture,
|
---|
407 | IWineD3DCubeTextureImpl_GetTextureDimensions,
|
---|
408 | IWineD3DCubeTextureImpl_IsCondNP2,
|
---|
409 | IWineD3DCubeTextureImpl_ApplyStateChanges,
|
---|
410 | /* IWineD3DCubeTexture */
|
---|
411 | IWineD3DCubeTextureImpl_Destroy,
|
---|
412 | IWineD3DCubeTextureImpl_GetLevelDesc,
|
---|
413 | IWineD3DCubeTextureImpl_GetCubeMapSurface,
|
---|
414 | IWineD3DCubeTextureImpl_LockRect,
|
---|
415 | IWineD3DCubeTextureImpl_UnlockRect,
|
---|
416 | IWineD3DCubeTextureImpl_AddDirtyRect
|
---|
417 | };
|
---|