ReactOS 0.4.16-dev-197-g92996da
texture.c
Go to the documentation of this file.
1/*
2 * Copyright 2002-2005 Jason Edmeades
3 * Copyright 2002-2005 Raphael Junqueira
4 * Copyright 2005 Oliver Stieber
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#include "config.h"
22#include "d3d9_private.h"
23
25
26static inline struct d3d9_texture *impl_from_IDirect3DTexture9(IDirect3DTexture9 *iface)
27{
28 return CONTAINING_RECORD((IDirect3DBaseTexture9 *)iface, struct d3d9_texture, IDirect3DBaseTexture9_iface);
29}
30
31static inline struct d3d9_texture *impl_from_IDirect3DCubeTexture9(IDirect3DCubeTexture9 *iface)
32{
33 return CONTAINING_RECORD((IDirect3DBaseTexture9 *)iface, struct d3d9_texture, IDirect3DBaseTexture9_iface);
34}
35
36static inline struct d3d9_texture *impl_from_IDirect3DVolumeTexture9(IDirect3DVolumeTexture9 *iface)
37{
38 return CONTAINING_RECORD((IDirect3DBaseTexture9 *)iface, struct d3d9_texture, IDirect3DBaseTexture9_iface);
39}
40
42{
43 struct d3d9_texture *texture = parent;
44
45 texture->wined3d_srv = NULL;
46}
47
49{
51};
52
53/* wined3d critical section must be taken by the caller. */
55{
56 struct wined3d_sub_resource_desc sr_desc;
58 HRESULT hr;
59
60 if (texture->wined3d_srv)
61 return texture->wined3d_srv;
62
63 wined3d_texture_get_sub_resource_desc(texture->wined3d_texture, 0, &sr_desc);
64 desc.format_id = sr_desc.format;
65 desc.flags = 0;
66 desc.u.texture.level_idx = 0;
67 desc.u.texture.level_count = wined3d_texture_get_level_count(texture->wined3d_texture);
68 desc.u.texture.layer_idx = 0;
69 desc.u.texture.layer_count = sr_desc.usage & WINED3DUSAGE_LEGACY_CUBEMAP ? 6 : 1;
72 &d3d9_srv_wined3d_parent_ops, &texture->wined3d_srv)))
73 {
74 ERR("Failed to create shader resource view, hr %#x.\n", hr);
75 return NULL;
76 }
77
78 return texture->wined3d_srv;
79}
80
82{
83 IDirect3DDevice9Ex *parent_device = texture->parent_device;
84 struct d3d9_surface *surface;
85
87 if (texture->wined3d_srv)
89 LIST_FOR_EACH_ENTRY(surface, &texture->rtv_list, struct d3d9_surface, rtv_entry)
91 wined3d_texture_decref(texture->wined3d_texture);
93
94 /* Release the device last, as it may cause the device to be destroyed. */
96}
97
98/* wined3d critical section must be taken by the caller. */
100{
101 if (!(texture->flags & D3D9_TEXTURE_MIPMAP_DIRTY))
102 return;
105 texture->flags &= ~D3D9_TEXTURE_MIPMAP_DIRTY;
106}
107
109{
110 if (texture->usage & D3DUSAGE_AUTOGENMIPMAP)
112}
113
114static HRESULT WINAPI d3d9_texture_2d_QueryInterface(IDirect3DTexture9 *iface, REFIID riid, void **out)
115{
116 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
117
118 if (IsEqualGUID(riid, &IID_IDirect3DTexture9)
119 || IsEqualGUID(riid, &IID_IDirect3DBaseTexture9)
120 || IsEqualGUID(riid, &IID_IDirect3DResource9)
122 {
124 *out = iface;
125 return S_OK;
126 }
127
128 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
129
130 *out = NULL;
131 return E_NOINTERFACE;
132}
133
134static ULONG WINAPI d3d9_texture_2d_AddRef(IDirect3DTexture9 *iface)
135{
137 ULONG ref = InterlockedIncrement(&texture->resource.refcount);
138
139 TRACE("%p increasing refcount to %u.\n", iface, ref);
140
141 if (ref == 1)
142 {
143 struct d3d9_surface *surface;
144
145 IDirect3DDevice9Ex_AddRef(texture->parent_device);
147 LIST_FOR_EACH_ENTRY(surface, &texture->rtv_list, struct d3d9_surface, rtv_entry)
148 {
150 }
151 wined3d_texture_incref(texture->wined3d_texture);
153 }
154
155 return ref;
156}
157
158static ULONG WINAPI d3d9_texture_2d_Release(IDirect3DTexture9 *iface)
159{
161 ULONG ref = InterlockedDecrement(&texture->resource.refcount);
162
163 TRACE("%p decreasing refcount to %u.\n", iface, ref);
164
165 if (!ref)
167 return ref;
168}
169
170static HRESULT WINAPI d3d9_texture_2d_GetDevice(IDirect3DTexture9 *iface, IDirect3DDevice9 **device)
171{
173
174 TRACE("iface %p, device %p.\n", iface, device);
175
176 *device = (IDirect3DDevice9 *)texture->parent_device;
178
179 TRACE("Returning device %p.\n", *device);
180
181 return D3D_OK;
182}
183
184static HRESULT WINAPI d3d9_texture_2d_SetPrivateData(IDirect3DTexture9 *iface,
185 REFGUID guid, const void *data, DWORD data_size, DWORD flags)
186{
188 TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n",
189 iface, debugstr_guid(guid), data, data_size, flags);
190
191 return d3d9_resource_set_private_data(&texture->resource, guid, data, data_size, flags);
192}
193
194static HRESULT WINAPI d3d9_texture_2d_GetPrivateData(IDirect3DTexture9 *iface,
195 REFGUID guid, void *data, DWORD *data_size)
196{
198 TRACE("iface %p, guid %s, data %p, data_size %p.\n",
199 iface, debugstr_guid(guid), data, data_size);
200
201 return d3d9_resource_get_private_data(&texture->resource, guid, data, data_size);
202}
203
205{
207 TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
208
209 return d3d9_resource_free_private_data(&texture->resource, guid);
210}
211
212static DWORD WINAPI d3d9_texture_2d_SetPriority(IDirect3DTexture9 *iface, DWORD priority)
213{
216 DWORD ret;
217
218 TRACE("iface %p, priority %u.\n", iface, priority);
219
224
225 return ret;
226}
227
228static DWORD WINAPI d3d9_texture_2d_GetPriority(IDirect3DTexture9 *iface)
229{
231 const struct wined3d_resource *resource;
232 DWORD ret;
233
234 TRACE("iface %p.\n", iface);
235
240
241 return ret;
242}
243
244static void WINAPI d3d9_texture_2d_PreLoad(IDirect3DTexture9 *iface)
245{
247
248 TRACE("iface %p.\n", iface);
249
253}
254
255static D3DRESOURCETYPE WINAPI d3d9_texture_2d_GetType(IDirect3DTexture9 *iface)
256{
257 TRACE("iface %p.\n", iface);
258
259 return D3DRTYPE_TEXTURE;
260}
261
262static DWORD WINAPI d3d9_texture_2d_SetLOD(IDirect3DTexture9 *iface, DWORD lod)
263{
265 DWORD ret;
266
267 TRACE("iface %p, lod %u.\n", iface, lod);
268
270 ret = wined3d_texture_set_lod(texture->wined3d_texture, lod);
272
273 return ret;
274}
275
276static DWORD WINAPI d3d9_texture_2d_GetLOD(IDirect3DTexture9 *iface)
277{
279 DWORD ret;
280
281 TRACE("iface %p.\n", iface);
282
284 ret = wined3d_texture_get_lod(texture->wined3d_texture);
286
287 return ret;
288}
289
290static DWORD WINAPI d3d9_texture_2d_GetLevelCount(IDirect3DTexture9 *iface)
291{
293 DWORD ret;
294
295 TRACE("iface %p.\n", iface);
296
297 if (texture->usage & D3DUSAGE_AUTOGENMIPMAP)
298 return 1;
299
301 ret = wined3d_texture_get_level_count(texture->wined3d_texture);
303
304 return ret;
305}
306
307static HRESULT WINAPI d3d9_texture_2d_SetAutoGenFilterType(IDirect3DTexture9 *iface, D3DTEXTUREFILTERTYPE filter_type)
308{
310
311 TRACE("iface %p, filter_type %#x.\n", iface, filter_type);
312
313 if (filter_type == D3DTEXF_NONE)
314 {
315 WARN("Invalid filter type D3DTEXF_NONE specified.\n");
316 return D3DERR_INVALIDCALL;
317 }
318 if (!(texture->usage & D3DUSAGE_AUTOGENMIPMAP))
319 WARN("Called on a texture without the D3DUSAGE_AUTOGENMIPMAP flag.\n");
320 else if (filter_type != D3DTEXF_LINEAR)
321 FIXME("Unsupported filter type %u.\n", filter_type);
322
323 texture->autogen_filter_type = filter_type;
324 return D3D_OK;
325}
326
328{
330
331 TRACE("iface %p.\n", iface);
332
333 if (!(texture->usage & D3DUSAGE_AUTOGENMIPMAP))
334 WARN("Called on a texture without the D3DUSAGE_AUTOGENMIPMAP flag.\n");
335
336 return texture->autogen_filter_type;
337}
338
339static void WINAPI d3d9_texture_2d_GenerateMipSubLevels(IDirect3DTexture9 *iface)
340{
342
343 TRACE("iface %p.\n", iface);
344
348}
349
351{
353 struct wined3d_sub_resource_desc wined3d_desc;
354 HRESULT hr;
355
356 TRACE("iface %p, level %u, desc %p.\n", iface, level, desc);
357
358 if (texture->usage & D3DUSAGE_AUTOGENMIPMAP && level)
359 {
360 WARN("D3DUSAGE_AUTOGENMIPMAP textures have only one accessible level.\n");
361 return D3DERR_INVALIDCALL;
362 }
363
365 if (SUCCEEDED(hr = wined3d_texture_get_sub_resource_desc(texture->wined3d_texture, level, &wined3d_desc)))
366 {
367 desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
368 desc->Type = D3DRTYPE_SURFACE;
369 desc->Usage = texture->usage;
370 desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
371 desc->MultiSampleType = wined3d_desc.multisample_type;
372 desc->MultiSampleQuality = wined3d_desc.multisample_quality;
373 desc->Width = wined3d_desc.width;
374 desc->Height = wined3d_desc.height;
375 }
377
378 return hr;
379}
380
381static HRESULT WINAPI d3d9_texture_2d_GetSurfaceLevel(IDirect3DTexture9 *iface,
382 UINT level, IDirect3DSurface9 **surface)
383{
385 struct d3d9_surface *surface_impl;
386
387 TRACE("iface %p, level %u, surface %p.\n", iface, level, surface);
388
389 if (texture->usage & D3DUSAGE_AUTOGENMIPMAP && level)
390 {
391 WARN("D3DUSAGE_AUTOGENMIPMAP textures have only one accessible level.\n");
392 return D3DERR_INVALIDCALL;
393 }
394
396 if (!(surface_impl = wined3d_texture_get_sub_resource_parent(texture->wined3d_texture, level)))
397 {
399 return D3DERR_INVALIDCALL;
400 }
401
402 *surface = &surface_impl->IDirect3DSurface9_iface;
403 IDirect3DSurface9_AddRef(*surface);
405
406 return D3D_OK;
407}
408
409static HRESULT WINAPI d3d9_texture_2d_LockRect(IDirect3DTexture9 *iface,
410 UINT level, D3DLOCKED_RECT *locked_rect, const RECT *rect, DWORD flags)
411{
413 struct d3d9_surface *surface_impl;
414 HRESULT hr;
415
416 TRACE("iface %p, level %u, locked_rect %p, rect %p, flags %#x.\n",
417 iface, level, locked_rect, rect, flags);
418
419 if (texture->usage & D3DUSAGE_AUTOGENMIPMAP && level)
420 {
421 WARN("D3DUSAGE_AUTOGENMIPMAP textures have only one accessible level.\n");
422 return D3DERR_INVALIDCALL;
423 }
424
426 if (!(surface_impl = wined3d_texture_get_sub_resource_parent(texture->wined3d_texture, level)))
428 else
429 hr = IDirect3DSurface9_LockRect(&surface_impl->IDirect3DSurface9_iface, locked_rect, rect, flags);
431
432 return hr;
433}
434
435static HRESULT WINAPI d3d9_texture_2d_UnlockRect(IDirect3DTexture9 *iface, UINT level)
436{
438 struct d3d9_surface *surface_impl;
439 HRESULT hr;
440
441 TRACE("iface %p, level %u.\n", iface, level);
442
443 if (texture->usage & D3DUSAGE_AUTOGENMIPMAP && level)
444 {
445 WARN("D3DUSAGE_AUTOGENMIPMAP textures have only one accessible level.\n");
446 return D3DERR_INVALIDCALL;
447 }
448
450 if (!(surface_impl = wined3d_texture_get_sub_resource_parent(texture->wined3d_texture, level)))
452 else
455
456 return hr;
457}
458
459static HRESULT WINAPI d3d9_texture_2d_AddDirtyRect(IDirect3DTexture9 *iface, const RECT *dirty_rect)
460{
462 HRESULT hr;
463
464 TRACE("iface %p, dirty_rect %s.\n",
465 iface, wine_dbgstr_rect(dirty_rect));
466
468 if (!dirty_rect)
469 hr = wined3d_texture_add_dirty_region(texture->wined3d_texture, 0, NULL);
470 else
471 {
472 struct wined3d_box dirty_region;
473
474 wined3d_box_set(&dirty_region, dirty_rect->left, dirty_rect->top, dirty_rect->right, dirty_rect->bottom, 0, 1);
475 hr = wined3d_texture_add_dirty_region(texture->wined3d_texture, 0, &dirty_region);
476 }
478
479 return hr;
480}
481
482static const IDirect3DTexture9Vtbl d3d9_texture_2d_vtbl =
483{
484 /* IUnknown */
488 /* IDirect3DResource9 */
497 /* IDirect3dBaseTexture9 */
504 /* IDirect3DTexture9 */
510};
511
512static HRESULT WINAPI d3d9_texture_cube_QueryInterface(IDirect3DCubeTexture9 *iface, REFIID riid, void **out)
513{
514 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
515
516 if (IsEqualGUID(riid, &IID_IDirect3DCubeTexture9)
517 || IsEqualGUID(riid, &IID_IDirect3DBaseTexture9)
518 || IsEqualGUID(riid, &IID_IDirect3DResource9)
520 {
522 *out = iface;
523 return S_OK;
524 }
525
526 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
527
528 *out = NULL;
529 return E_NOINTERFACE;
530}
531
532static ULONG WINAPI d3d9_texture_cube_AddRef(IDirect3DCubeTexture9 *iface)
533{
535 ULONG ref = InterlockedIncrement(&texture->resource.refcount);
536
537 TRACE("%p increasing refcount to %u.\n", iface, ref);
538
539 if (ref == 1)
540 {
541 struct d3d9_surface *surface;
542
543 IDirect3DDevice9Ex_AddRef(texture->parent_device);
545 LIST_FOR_EACH_ENTRY(surface, &texture->rtv_list, struct d3d9_surface, rtv_entry)
546 {
548 }
549 wined3d_texture_incref(texture->wined3d_texture);
551 }
552
553 return ref;
554}
555
556static ULONG WINAPI d3d9_texture_cube_Release(IDirect3DCubeTexture9 *iface)
557{
559 ULONG ref = InterlockedDecrement(&texture->resource.refcount);
560
561 TRACE("%p decreasing refcount to %u.\n", iface, ref);
562
563 if (!ref)
565 return ref;
566}
567
568static HRESULT WINAPI d3d9_texture_cube_GetDevice(IDirect3DCubeTexture9 *iface, IDirect3DDevice9 **device)
569{
571
572 TRACE("iface %p, device %p.\n", iface, device);
573
574 *device = (IDirect3DDevice9 *)texture->parent_device;
576
577 TRACE("Returning device %p.\n", *device);
578
579 return D3D_OK;
580}
581
582static HRESULT WINAPI d3d9_texture_cube_SetPrivateData(IDirect3DCubeTexture9 *iface,
583 REFGUID guid, const void *data, DWORD data_size, DWORD flags)
584{
586 TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n",
587 iface, debugstr_guid(guid), data, data_size, flags);
588
589 return d3d9_resource_set_private_data(&texture->resource, guid, data, data_size, flags);
590}
591
592static HRESULT WINAPI d3d9_texture_cube_GetPrivateData(IDirect3DCubeTexture9 *iface,
593 REFGUID guid, void *data, DWORD *data_size)
594{
596 TRACE("iface %p, guid %s, data %p, data_size %p.\n",
597 iface, debugstr_guid(guid), data, data_size);
598
599 return d3d9_resource_get_private_data(&texture->resource, guid, data, data_size);
600}
601
602static HRESULT WINAPI d3d9_texture_cube_FreePrivateData(IDirect3DCubeTexture9 *iface, REFGUID guid)
603{
605 TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
606
607 return d3d9_resource_free_private_data(&texture->resource, guid);
608}
609
610static DWORD WINAPI d3d9_texture_cube_SetPriority(IDirect3DCubeTexture9 *iface, DWORD priority)
611{
614 DWORD ret;
615
616 TRACE("iface %p, priority %u.\n", iface, priority);
617
622
623 return ret;
624}
625
626static DWORD WINAPI d3d9_texture_cube_GetPriority(IDirect3DCubeTexture9 *iface)
627{
629 const struct wined3d_resource *resource;
630 DWORD ret;
631
632 TRACE("iface %p.\n", iface);
633
638
639 return ret;
640}
641
642static void WINAPI d3d9_texture_cube_PreLoad(IDirect3DCubeTexture9 *iface)
643{
645
646 TRACE("iface %p.\n", iface);
647
651}
652
653static D3DRESOURCETYPE WINAPI d3d9_texture_cube_GetType(IDirect3DCubeTexture9 *iface)
654{
655 TRACE("iface %p.\n", iface);
656
658}
659
660static DWORD WINAPI d3d9_texture_cube_SetLOD(IDirect3DCubeTexture9 *iface, DWORD lod)
661{
663 DWORD ret;
664
665 TRACE("iface %p, lod %u.\n", iface, lod);
666
668 ret = wined3d_texture_set_lod(texture->wined3d_texture, lod);
670
671 return ret;
672}
673
674static DWORD WINAPI d3d9_texture_cube_GetLOD(IDirect3DCubeTexture9 *iface)
675{
677 DWORD ret;
678
679 TRACE("iface %p.\n", iface);
680
682 ret = wined3d_texture_get_lod(texture->wined3d_texture);
684
685 return ret;
686}
687
688static DWORD WINAPI d3d9_texture_cube_GetLevelCount(IDirect3DCubeTexture9 *iface)
689{
691 DWORD ret;
692
693 TRACE("iface %p.\n", iface);
694
695 if (texture->usage & D3DUSAGE_AUTOGENMIPMAP)
696 return 1;
697
699 ret = wined3d_texture_get_level_count(texture->wined3d_texture);
701
702 return ret;
703}
704
705static HRESULT WINAPI d3d9_texture_cube_SetAutoGenFilterType(IDirect3DCubeTexture9 *iface,
706 D3DTEXTUREFILTERTYPE filter_type)
707{
709
710 TRACE("iface %p, filter_type %#x.\n", iface, filter_type);
711
712 if (filter_type == D3DTEXF_NONE)
713 {
714 WARN("Invalid filter type D3DTEXF_NONE specified.\n");
715 return D3DERR_INVALIDCALL;
716 }
717 if (!(texture->usage & D3DUSAGE_AUTOGENMIPMAP))
718 WARN("Called on a texture without the D3DUSAGE_AUTOGENMIPMAP flag.\n");
719 else if (filter_type != D3DTEXF_LINEAR)
720 FIXME("Unsupported filter type %u.\n", filter_type);
721
722 texture->autogen_filter_type = filter_type;
723 return D3D_OK;
724}
725
727{
729
730 TRACE("iface %p.\n", iface);
731
732 if (!(texture->usage & D3DUSAGE_AUTOGENMIPMAP))
733 WARN("Called on a texture without the D3DUSAGE_AUTOGENMIPMAP flag.\n");
734
735 return texture->autogen_filter_type;
736}
737
738static void WINAPI d3d9_texture_cube_GenerateMipSubLevels(IDirect3DCubeTexture9 *iface)
739{
741
742 TRACE("iface %p.\n", iface);
743
747}
748
750{
752 struct wined3d_sub_resource_desc wined3d_desc;
753 DWORD level_count;
754 HRESULT hr;
755
756 TRACE("iface %p, level %u, desc %p.\n", iface, level, desc);
757
758 if (texture->usage & D3DUSAGE_AUTOGENMIPMAP && level)
759 {
760 WARN("D3DUSAGE_AUTOGENMIPMAP textures have only one accessible level.\n");
761 return D3DERR_INVALIDCALL;
762 }
763
765 level_count = wined3d_texture_get_level_count(texture->wined3d_texture);
766 if (level >= level_count)
767 {
769 return D3DERR_INVALIDCALL;
770 }
771
772 if (SUCCEEDED(hr = wined3d_texture_get_sub_resource_desc(texture->wined3d_texture, level, &wined3d_desc)))
773 {
774 desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
775 desc->Type = D3DRTYPE_SURFACE;
776 desc->Usage = texture->usage;
777 desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
778 desc->MultiSampleType = wined3d_desc.multisample_type;
779 desc->MultiSampleQuality = wined3d_desc.multisample_quality;
780 desc->Width = wined3d_desc.width;
781 desc->Height = wined3d_desc.height;
782 }
784
785 return hr;
786}
787
788static HRESULT WINAPI d3d9_texture_cube_GetCubeMapSurface(IDirect3DCubeTexture9 *iface,
789 D3DCUBEMAP_FACES face, UINT level, IDirect3DSurface9 **surface)
790{
792 struct d3d9_surface *surface_impl;
794 DWORD level_count;
795
796 TRACE("iface %p, face %#x, level %u, surface %p.\n", iface, face, level, surface);
797
798 if (texture->usage & D3DUSAGE_AUTOGENMIPMAP && level)
799 {
800 WARN("D3DUSAGE_AUTOGENMIPMAP textures have only one accessible level.\n");
801 return D3DERR_INVALIDCALL;
802 }
803
805 level_count = wined3d_texture_get_level_count(texture->wined3d_texture);
806 if (level >= level_count)
807 {
809 return D3DERR_INVALIDCALL;
810 }
811
812 sub_resource_idx = level_count * face + level;
813 if (!(surface_impl = wined3d_texture_get_sub_resource_parent(texture->wined3d_texture, sub_resource_idx)))
814 {
816 return D3DERR_INVALIDCALL;
817 }
818
819 *surface = &surface_impl->IDirect3DSurface9_iface;
820 IDirect3DSurface9_AddRef(*surface);
822
823 return D3D_OK;
824}
825
826static HRESULT WINAPI d3d9_texture_cube_LockRect(IDirect3DCubeTexture9 *iface,
827 D3DCUBEMAP_FACES face, UINT level, D3DLOCKED_RECT *locked_rect, const RECT *rect,
828 DWORD flags)
829{
831 struct d3d9_surface *surface_impl;
833 HRESULT hr;
834
835 TRACE("iface %p, face %#x, level %u, locked_rect %p, rect %p, flags %#x.\n",
836 iface, face, level, locked_rect, rect, flags);
837
838 if (texture->usage & D3DUSAGE_AUTOGENMIPMAP && level)
839 {
840 WARN("D3DUSAGE_AUTOGENMIPMAP textures have only one accessible level.\n");
841 return D3DERR_INVALIDCALL;
842 }
843
846 if (!(surface_impl = wined3d_texture_get_sub_resource_parent(texture->wined3d_texture, sub_resource_idx)))
848 else
849 hr = IDirect3DSurface9_LockRect(&surface_impl->IDirect3DSurface9_iface, locked_rect, rect, flags);
851
852 return hr;
853}
854
855static HRESULT WINAPI d3d9_texture_cube_UnlockRect(IDirect3DCubeTexture9 *iface,
857{
859 struct d3d9_surface *surface_impl;
861 HRESULT hr;
862
863 TRACE("iface %p, face %#x, level %u.\n", iface, face, level);
864
865 if (texture->usage & D3DUSAGE_AUTOGENMIPMAP && level)
866 {
867 WARN("D3DUSAGE_AUTOGENMIPMAP textures have only one accessible level.\n");
868 return D3DERR_INVALIDCALL;
869 }
870
873 if (!(surface_impl = wined3d_texture_get_sub_resource_parent(texture->wined3d_texture, sub_resource_idx)))
875 else
878
879 return hr;
880}
881
882static HRESULT WINAPI d3d9_texture_cube_AddDirtyRect(IDirect3DCubeTexture9 *iface,
883 D3DCUBEMAP_FACES face, const RECT *dirty_rect)
884{
886 HRESULT hr;
887
888 TRACE("iface %p, face %#x, dirty_rect %s.\n",
889 iface, face, wine_dbgstr_rect(dirty_rect));
890
892 if (!dirty_rect)
894 else
895 {
896 struct wined3d_box dirty_region;
897
898 wined3d_box_set(&dirty_region, dirty_rect->left, dirty_rect->top, dirty_rect->right, dirty_rect->bottom, 0, 1);
899 hr = wined3d_texture_add_dirty_region(texture->wined3d_texture, face, &dirty_region);
900 }
902
903 return hr;
904}
905
906static const IDirect3DCubeTexture9Vtbl d3d9_texture_cube_vtbl =
907{
908 /* IUnknown */
912 /* IDirect3DResource9 */
921 /* IDirect3DBaseTexture9 */
928 /* IDirect3DCubeTexture9 */
934};
935
936static HRESULT WINAPI d3d9_texture_3d_QueryInterface(IDirect3DVolumeTexture9 *iface, REFIID riid, void **out)
937{
938 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
939
940 if (IsEqualGUID(riid, &IID_IDirect3DVolumeTexture9)
941 || IsEqualGUID(riid, &IID_IDirect3DBaseTexture9)
942 || IsEqualGUID(riid, &IID_IDirect3DResource9)
944 {
946 *out = iface;
947 return S_OK;
948 }
949
950 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
951
952 *out = NULL;
953 return E_NOINTERFACE;
954}
955
956static ULONG WINAPI d3d9_texture_3d_AddRef(IDirect3DVolumeTexture9 *iface)
957{
959 ULONG ref = InterlockedIncrement(&texture->resource.refcount);
960
961 TRACE("%p increasing refcount to %u.\n", iface, ref);
962
963 if (ref == 1)
964 {
965 IDirect3DDevice9Ex_AddRef(texture->parent_device);
967 wined3d_texture_incref(texture->wined3d_texture);
969 }
970
971 return ref;
972}
973
974static ULONG WINAPI d3d9_texture_3d_Release(IDirect3DVolumeTexture9 *iface)
975{
977 ULONG ref = InterlockedDecrement(&texture->resource.refcount);
978
979 TRACE("%p decreasing refcount to %u.\n", iface, ref);
980
981 if (!ref)
983 return ref;
984}
985
986static HRESULT WINAPI d3d9_texture_3d_GetDevice(IDirect3DVolumeTexture9 *iface, IDirect3DDevice9 **device)
987{
989
990 TRACE("iface %p, device %p.\n", iface, device);
991
992 *device = (IDirect3DDevice9 *)texture->parent_device;
994
995 TRACE("Returning device %p.\n", *device);
996
997 return D3D_OK;
998}
999
1000static HRESULT WINAPI d3d9_texture_3d_SetPrivateData(IDirect3DVolumeTexture9 *iface,
1001 REFGUID guid, const void *data, DWORD data_size, DWORD flags)
1002{
1004 TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n",
1005 iface, debugstr_guid(guid), data, data_size, flags);
1006
1007 return d3d9_resource_set_private_data(&texture->resource, guid, data, data_size, flags);
1008}
1009
1010static HRESULT WINAPI d3d9_texture_3d_GetPrivateData(IDirect3DVolumeTexture9 *iface,
1011 REFGUID guid, void *data, DWORD *data_size)
1012{
1014 TRACE("iface %p, guid %s, data %p, data_size %p.\n",
1015 iface, debugstr_guid(guid), data, data_size);
1016
1017 return d3d9_resource_get_private_data(&texture->resource, guid, data, data_size);
1018}
1019
1020static HRESULT WINAPI d3d9_texture_3d_FreePrivateData(IDirect3DVolumeTexture9 *iface, REFGUID guid)
1021{
1023 TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
1024
1025 return d3d9_resource_free_private_data(&texture->resource, guid);
1026}
1027
1028static DWORD WINAPI d3d9_texture_3d_SetPriority(IDirect3DVolumeTexture9 *iface, DWORD priority)
1029{
1031 struct wined3d_resource *resource;
1032 DWORD ret;
1033
1034 TRACE("iface %p, priority %u.\n", iface, priority);
1035
1037 resource = wined3d_texture_get_resource(texture->wined3d_texture);
1040
1041 return ret;
1042}
1043
1044static DWORD WINAPI d3d9_texture_3d_GetPriority(IDirect3DVolumeTexture9 *iface)
1045{
1047 const struct wined3d_resource *resource;
1048 DWORD ret;
1049
1050 TRACE("iface %p.\n", iface);
1051
1053 resource = wined3d_texture_get_resource(texture->wined3d_texture);
1056
1057 return ret;
1058}
1059
1060static void WINAPI d3d9_texture_3d_PreLoad(IDirect3DVolumeTexture9 *iface)
1061{
1063
1064 TRACE("iface %p.\n", iface);
1065
1069}
1070
1071static D3DRESOURCETYPE WINAPI d3d9_texture_3d_GetType(IDirect3DVolumeTexture9 *iface)
1072{
1073 TRACE("iface %p.\n", iface);
1074
1076}
1077
1078static DWORD WINAPI d3d9_texture_3d_SetLOD(IDirect3DVolumeTexture9 *iface, DWORD lod)
1079{
1081 DWORD ret;
1082
1083 TRACE("iface %p, lod %u.\n", iface, lod);
1084
1086 ret = wined3d_texture_set_lod(texture->wined3d_texture, lod);
1088
1089 return ret;
1090}
1091
1092static DWORD WINAPI d3d9_texture_3d_GetLOD(IDirect3DVolumeTexture9 *iface)
1093{
1095 DWORD ret;
1096
1097 TRACE("iface %p.\n", iface);
1098
1100 ret = wined3d_texture_get_lod(texture->wined3d_texture);
1102
1103 return ret;
1104}
1105
1106static DWORD WINAPI d3d9_texture_3d_GetLevelCount(IDirect3DVolumeTexture9 *iface)
1107{
1109 DWORD ret;
1110
1111 TRACE("iface %p.\n", iface);
1112
1114 ret = wined3d_texture_get_level_count(texture->wined3d_texture);
1116
1117 return ret;
1118}
1119
1120static HRESULT WINAPI d3d9_texture_3d_SetAutoGenFilterType(IDirect3DVolumeTexture9 *iface,
1121 D3DTEXTUREFILTERTYPE filter_type)
1122{
1123 TRACE("iface %p, filter_type %#x.\n", iface, filter_type);
1124
1125 return D3DERR_INVALIDCALL;
1126}
1127
1129{
1130 TRACE("iface %p.\n", iface);
1131
1132 return D3DTEXF_NONE;
1133}
1134
1135static void WINAPI d3d9_texture_3d_GenerateMipSubLevels(IDirect3DVolumeTexture9 *iface)
1136{
1137 TRACE("iface %p.\n", iface);
1138}
1139
1141{
1143 struct wined3d_sub_resource_desc wined3d_desc;
1144 HRESULT hr;
1145
1146 TRACE("iface %p, level %u, desc %p.\n", iface, level, desc);
1147
1149 if (SUCCEEDED(hr = wined3d_texture_get_sub_resource_desc(texture->wined3d_texture, level, &wined3d_desc)))
1150 {
1151 desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
1152 desc->Type = D3DRTYPE_VOLUME;
1153 desc->Usage = texture->usage;
1154 desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
1155 desc->Width = wined3d_desc.width;
1156 desc->Height = wined3d_desc.height;
1157 desc->Depth = wined3d_desc.depth;
1158 }
1160
1161 return hr;
1162}
1163
1164static HRESULT WINAPI d3d9_texture_3d_GetVolumeLevel(IDirect3DVolumeTexture9 *iface,
1165 UINT level, IDirect3DVolume9 **volume)
1166{
1168 struct d3d9_volume *volume_impl;
1169
1170 TRACE("iface %p, level %u, volume %p.\n", iface, level, volume);
1171
1173 if (!(volume_impl = wined3d_texture_get_sub_resource_parent(texture->wined3d_texture, level)))
1174 {
1176 return D3DERR_INVALIDCALL;
1177 }
1178
1179 *volume = &volume_impl->IDirect3DVolume9_iface;
1182
1183 return D3D_OK;
1184}
1185
1186static HRESULT WINAPI d3d9_texture_3d_LockBox(IDirect3DVolumeTexture9 *iface,
1187 UINT level, D3DLOCKED_BOX *locked_box, const D3DBOX *box, DWORD flags)
1188{
1190 struct d3d9_volume *volume_impl;
1191 HRESULT hr;
1192
1193 TRACE("iface %p, level %u, locked_box %p, box %p, flags %#x.\n",
1194 iface, level, locked_box, box, flags);
1195
1197 if (!(volume_impl = wined3d_texture_get_sub_resource_parent(texture->wined3d_texture, level)))
1199 else
1200 hr = IDirect3DVolume9_LockBox(&volume_impl->IDirect3DVolume9_iface, locked_box, box, flags);
1202
1203 return hr;
1204}
1205
1206static HRESULT WINAPI d3d9_texture_3d_UnlockBox(IDirect3DVolumeTexture9 *iface, UINT level)
1207{
1209 struct d3d9_volume *volume_impl;
1210 HRESULT hr;
1211
1212 TRACE("iface %p, level %u.\n", iface, level);
1213
1215 if (!(volume_impl = wined3d_texture_get_sub_resource_parent(texture->wined3d_texture, level)))
1217 else
1220
1221 return hr;
1222}
1223
1224static HRESULT WINAPI d3d9_texture_3d_AddDirtyBox(IDirect3DVolumeTexture9 *iface, const D3DBOX *dirty_box)
1225{
1227 HRESULT hr;
1228
1229 TRACE("iface %p, dirty_box %p.\n", iface, dirty_box);
1230
1232 hr = wined3d_texture_add_dirty_region(texture->wined3d_texture, 0, (const struct wined3d_box *)dirty_box);
1234
1235 return hr;
1236}
1237
1238
1239static const IDirect3DVolumeTexture9Vtbl d3d9_texture_3d_vtbl =
1240{
1241 /* IUnknown */
1245 /* IDirect3DResource9 */
1254 /* IDirect3DBaseTexture9 */
1261 /* IDirect3DVolumeTexture9 */
1267};
1268
1269struct d3d9_texture *unsafe_impl_from_IDirect3DBaseTexture9(IDirect3DBaseTexture9 *iface)
1270{
1271 if (!iface)
1272 return NULL;
1273
1274 if (iface->lpVtbl != (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_2d_vtbl
1275 && iface->lpVtbl != (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_cube_vtbl
1276 && iface->lpVtbl != (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_3d_vtbl)
1277 {
1278 WARN("%p is not a valid IDirect3DBaseTexture9 interface.\n", iface);
1279 return NULL;
1280 }
1281
1283}
1284
1286{
1287 struct d3d9_texture *texture = parent;
1288 d3d9_resource_cleanup(&texture->resource);
1290}
1291
1293{
1295};
1296
1299{
1301 DWORD flags = 0;
1302 HRESULT hr;
1303
1304 texture->IDirect3DBaseTexture9_iface.lpVtbl = (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_2d_vtbl;
1305 d3d9_resource_init(&texture->resource);
1306 list_init(&texture->rtv_list);
1307 texture->usage = usage;
1308
1309 desc.resource_type = WINED3D_RTYPE_TEXTURE_2D;
1311 desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
1312 desc.multisample_quality = 0;
1314 desc.usage |= WINED3DUSAGE_TEXTURE;
1315 if (pool == D3DPOOL_SCRATCH)
1316 desc.usage |= WINED3DUSAGE_SCRATCH;
1319 desc.width = width;
1320 desc.height = height;
1321 desc.depth = 1;
1322 desc.size = 0;
1323
1326
1329
1331 {
1332 if (pool == D3DPOOL_SYSTEMMEM)
1333 {
1334 WARN("D3DUSAGE_AUTOGENMIPMAP texture can't be in D3DPOOL_SYSTEMMEM, returning D3DERR_INVALIDCALL.\n");
1335 return D3DERR_INVALIDCALL;
1336 }
1337 if (levels && levels != 1)
1338 {
1339 WARN("D3DUSAGE_AUTOGENMIPMAP texture with %u levels, returning D3DERR_INVALIDCALL.\n", levels);
1340 return D3DERR_INVALIDCALL;
1341 }
1343 texture->autogen_filter_type = D3DTEXF_LINEAR;
1344 levels = 0;
1345 }
1346 else
1347 {
1348 texture->autogen_filter_type = D3DTEXF_NONE;
1349 }
1350 if (!levels)
1352
1354 hr = wined3d_texture_create(device->wined3d_device, &desc, 1, levels, flags,
1355 NULL, texture, &d3d9_texture_wined3d_parent_ops, &texture->wined3d_texture);
1357 if (FAILED(hr))
1358 {
1359 WARN("Failed to create wined3d texture, hr %#x.\n", hr);
1360 return hr;
1361 }
1362
1363 texture->parent_device = &device->IDirect3DDevice9Ex_iface;
1364 IDirect3DDevice9Ex_AddRef(texture->parent_device);
1365
1366 return D3D_OK;
1367}
1368
1371{
1373 DWORD flags = 0;
1374 HRESULT hr;
1375
1376 texture->IDirect3DBaseTexture9_iface.lpVtbl = (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_cube_vtbl;
1377 d3d9_resource_init(&texture->resource);
1378 list_init(&texture->rtv_list);
1379 texture->usage = usage;
1380
1381 desc.resource_type = WINED3D_RTYPE_TEXTURE_2D;
1383 desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
1384 desc.multisample_quality = 0;
1387 if (pool == D3DPOOL_SCRATCH)
1388 desc.usage |= WINED3DUSAGE_SCRATCH;
1391 desc.width = edge_length;
1392 desc.height = edge_length;
1393 desc.depth = 1;
1394 desc.size = 0;
1395
1398
1401
1403 {
1404 if (pool == D3DPOOL_SYSTEMMEM)
1405 {
1406 WARN("D3DUSAGE_AUTOGENMIPMAP texture can't be in D3DPOOL_SYSTEMMEM, returning D3DERR_INVALIDCALL.\n");
1407 return D3DERR_INVALIDCALL;
1408 }
1409 if (levels && levels != 1)
1410 {
1411 WARN("D3DUSAGE_AUTOGENMIPMAP texture with %u levels, returning D3DERR_INVALIDCALL.\n", levels);
1412 return D3DERR_INVALIDCALL;
1413 }
1415 texture->autogen_filter_type = D3DTEXF_LINEAR;
1416 levels = 0;
1417 }
1418 else
1419 {
1420 texture->autogen_filter_type = D3DTEXF_NONE;
1421 }
1422 if (!levels)
1423 levels = wined3d_log2i(edge_length) + 1;
1424
1426 hr = wined3d_texture_create(device->wined3d_device, &desc, 6, levels, flags,
1427 NULL, texture, &d3d9_texture_wined3d_parent_ops, &texture->wined3d_texture);
1429 if (FAILED(hr))
1430 {
1431 WARN("Failed to create wined3d cube texture, hr %#x.\n", hr);
1432 return hr;
1433 }
1434
1435 texture->parent_device = &device->IDirect3DDevice9Ex_iface;
1436 IDirect3DDevice9Ex_AddRef(texture->parent_device);
1437
1438 return D3D_OK;
1439}
1440
1443{
1445 HRESULT hr;
1446
1447 texture->IDirect3DBaseTexture9_iface.lpVtbl = (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_3d_vtbl;
1448 d3d9_resource_init(&texture->resource);
1449 list_init(&texture->rtv_list);
1450 texture->usage = usage;
1451
1452 desc.resource_type = WINED3D_RTYPE_TEXTURE_3D;
1454 desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
1455 desc.multisample_quality = 0;
1457 desc.usage |= WINED3DUSAGE_TEXTURE;
1458 if (pool == D3DPOOL_SCRATCH)
1459 desc.usage |= WINED3DUSAGE_SCRATCH;
1461 desc.width = width;
1462 desc.height = height;
1463 desc.depth = depth;
1464 desc.size = 0;
1465
1467 {
1468 WARN("D3DUSAGE_AUTOGENMIPMAP volume texture is not supported, returning D3DERR_INVALIDCALL.\n");
1469 return D3DERR_INVALIDCALL;
1470 }
1471 if (!levels)
1473
1475 hr = wined3d_texture_create(device->wined3d_device, &desc, 1, levels, 0,
1476 NULL, texture, &d3d9_texture_wined3d_parent_ops, &texture->wined3d_texture);
1478 if (FAILED(hr))
1479 {
1480 WARN("Failed to create wined3d volume texture, hr %#x.\n", hr);
1481 return hr;
1482 }
1483
1484 texture->parent_device = &device->IDirect3DDevice9Ex_iface;
1485 IDirect3DDevice9Ex_AddRef(texture->parent_device);
1486
1487 return D3D_OK;
1488}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
static void list_init(struct list_entry *head)
Definition: list.h:51
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
const GUID IID_IUnknown
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
enum wined3d_format_id wined3dformat_from_d3dformat(D3DFORMAT format) DECLSPEC_HIDDEN
Definition: device.c:94
D3DFORMAT d3dformat_from_wined3dformat(enum wined3d_format_id format) DECLSPEC_HIDDEN
Definition: device.c:44
static unsigned int wined3daccess_from_d3dpool(D3DPOOL pool, unsigned int usage)
Definition: d3d8_private.h:301
static D3DPOOL d3dpool_from_wined3daccess(unsigned int access, unsigned int usage)
Definition: d3d8_private.h:285
@ D3DTEXF_NONE
Definition: d3d8types.h:870
@ D3DTEXF_LINEAR
Definition: d3d8types.h:872
enum _D3DRESOURCETYPE D3DRESOURCETYPE
#define D3DUSAGE_DYNAMIC
Definition: d3d8types.h:99
@ D3DRTYPE_TEXTURE
Definition: d3d8types.h:812
@ D3DRTYPE_VOLUMETEXTURE
Definition: d3d8types.h:813
@ D3DRTYPE_CUBETEXTURE
Definition: d3d8types.h:814
@ D3DRTYPE_VOLUME
Definition: d3d8types.h:811
@ D3DRTYPE_SURFACE
Definition: d3d8types.h:810
enum _D3DPOOL D3DPOOL
@ D3DPOOL_SCRATCH
Definition: d3d8types.h:712
@ D3DPOOL_DEFAULT
Definition: d3d8types.h:709
@ D3DPOOL_SYSTEMMEM
Definition: d3d8types.h:711
enum _D3DFORMAT D3DFORMAT
enum _D3DCUBEMAP_FACES D3DCUBEMAP_FACES
enum _D3DTEXTUREFILTERTYPE D3DTEXTUREFILTERTYPE
#define IDirect3DVolume9_AddRef(p)
Definition: d3d9.h:382
#define IDirect3DCubeTexture9_AddRef(p)
Definition: d3d9.h:918
#define IDirect3DTexture9_AddRef(p)
Definition: d3d9.h:1013
#define IDirect3DSurface9_LockRect(p, a, b, c)
Definition: d3d9.h:635
#define IDirect3DVolume9_UnlockBox(p)
Definition: d3d9.h:392
#define IDirect3DVolume9_LockBox(p, a, b, c)
Definition: d3d9.h:391
#define IDirect3DDevice9Ex_Release(p)
Definition: d3d9.h:1917
#define IDirect3DSurface9_AddRef(p)
Definition: d3d9.h:621
#define IDirect3DDevice9Ex_AddRef(p)
Definition: d3d9.h:1916
#define IDirect3DSurface9_UnlockRect(p)
Definition: d3d9.h:636
#define IDirect3DDevice9_AddRef(p)
Definition: d3d9.h:1507
#define IDirect3DVolumeTexture9_AddRef(p)
Definition: d3d9.h:1108
void d3d9_resource_init(struct d3d9_resource *resource)
Definition: d3d9_main.c:216
HRESULT d3d9_resource_free_private_data(struct d3d9_resource *resource, const GUID *guid)
Definition: d3d9_main.c:160
HRESULT d3d9_resource_set_private_data(struct d3d9_resource *resource, const GUID *guid, const void *data, DWORD data_size, DWORD flags)
Definition: d3d9_main.c:222
void d3d9_resource_cleanup(struct d3d9_resource *resource)
Definition: d3d9_main.c:155
HRESULT d3d9_resource_get_private_data(struct d3d9_resource *resource, const GUID *guid, void *data, DWORD *data_size)
Definition: d3d9_main.c:178
#define D3DUSAGE_AUTOGENMIPMAP
Definition: d3d9types.h:113
#define D3D_OK
Definition: d3d.h:106
#define D3DERR_INVALIDCALL
#define NULL
Definition: types.h:112
HRESULT volumetexture_init(struct d3d8_texture *texture, struct d3d8_device *device, UINT width, UINT height, UINT depth, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool)
Definition: texture.c:1190
HRESULT cubetexture_init(struct d3d8_texture *texture, struct d3d8_device *device, UINT edge_length, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool)
Definition: texture.c:1142
HRESULT texture_init(struct d3d8_texture *texture, struct d3d8_device *device, UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool)
Definition: texture.c:1094
static HRESULT WINAPI d3d9_texture_2d_GetPrivateData(IDirect3DTexture9 *iface, REFGUID guid, void *data, DWORD *data_size)
Definition: texture.c:194
static HRESULT WINAPI d3d9_texture_2d_UnlockRect(IDirect3DTexture9 *iface, UINT level)
Definition: texture.c:435
static HRESULT WINAPI d3d9_texture_2d_LockRect(IDirect3DTexture9 *iface, UINT level, D3DLOCKED_RECT *locked_rect, const RECT *rect, DWORD flags)
Definition: texture.c:409
static void WINAPI d3d9_texture_3d_GenerateMipSubLevels(IDirect3DVolumeTexture9 *iface)
Definition: texture.c:1135
static HRESULT WINAPI d3d9_texture_cube_AddDirtyRect(IDirect3DCubeTexture9 *iface, D3DCUBEMAP_FACES face, const RECT *dirty_rect)
Definition: texture.c:882
static D3DTEXTUREFILTERTYPE WINAPI d3d9_texture_3d_GetAutoGenFilterType(IDirect3DVolumeTexture9 *iface)
Definition: texture.c:1128
static DWORD WINAPI d3d9_texture_cube_SetLOD(IDirect3DCubeTexture9 *iface, DWORD lod)
Definition: texture.c:660
static HRESULT WINAPI d3d9_texture_cube_GetLevelDesc(IDirect3DCubeTexture9 *iface, UINT level, D3DSURFACE_DESC *desc)
Definition: texture.c:749
static HRESULT WINAPI d3d9_texture_cube_GetDevice(IDirect3DCubeTexture9 *iface, IDirect3DDevice9 **device)
Definition: texture.c:568
static DWORD WINAPI d3d9_texture_2d_GetLOD(IDirect3DTexture9 *iface)
Definition: texture.c:276
static HRESULT WINAPI d3d9_texture_2d_GetSurfaceLevel(IDirect3DTexture9 *iface, UINT level, IDirect3DSurface9 **surface)
Definition: texture.c:381
static ULONG WINAPI d3d9_texture_3d_Release(IDirect3DVolumeTexture9 *iface)
Definition: texture.c:974
static HRESULT WINAPI d3d9_texture_2d_SetPrivateData(IDirect3DTexture9 *iface, REFGUID guid, const void *data, DWORD data_size, DWORD flags)
Definition: texture.c:184
static const IDirect3DVolumeTexture9Vtbl d3d9_texture_3d_vtbl
Definition: texture.c:1239
static DWORD WINAPI d3d9_texture_3d_GetLevelCount(IDirect3DVolumeTexture9 *iface)
Definition: texture.c:1106
static DWORD WINAPI d3d9_texture_2d_GetPriority(IDirect3DTexture9 *iface)
Definition: texture.c:228
static const IDirect3DTexture9Vtbl d3d9_texture_2d_vtbl
Definition: texture.c:482
static DWORD WINAPI d3d9_texture_3d_SetPriority(IDirect3DVolumeTexture9 *iface, DWORD priority)
Definition: texture.c:1028
static HRESULT WINAPI d3d9_texture_cube_SetPrivateData(IDirect3DCubeTexture9 *iface, REFGUID guid, const void *data, DWORD data_size, DWORD flags)
Definition: texture.c:582
static ULONG WINAPI d3d9_texture_3d_AddRef(IDirect3DVolumeTexture9 *iface)
Definition: texture.c:956
static void d3d9_texture_cleanup(struct d3d9_texture *texture)
Definition: texture.c:81
static ULONG WINAPI d3d9_texture_2d_AddRef(IDirect3DTexture9 *iface)
Definition: texture.c:134
static HRESULT WINAPI d3d9_texture_3d_GetPrivateData(IDirect3DVolumeTexture9 *iface, REFGUID guid, void *data, DWORD *data_size)
Definition: texture.c:1010
struct d3d9_texture * unsafe_impl_from_IDirect3DBaseTexture9(IDirect3DBaseTexture9 *iface)
Definition: texture.c:1269
static const struct wined3d_parent_ops d3d9_srv_wined3d_parent_ops
Definition: texture.c:48
static DWORD WINAPI d3d9_texture_3d_GetLOD(IDirect3DVolumeTexture9 *iface)
Definition: texture.c:1092
void d3d9_texture_gen_auto_mipmap(struct d3d9_texture *texture)
Definition: texture.c:99
static DWORD WINAPI d3d9_texture_cube_GetLevelCount(IDirect3DCubeTexture9 *iface)
Definition: texture.c:688
static void WINAPI d3d9_texture_2d_GenerateMipSubLevels(IDirect3DTexture9 *iface)
Definition: texture.c:339
static void WINAPI d3d9_texture_2d_PreLoad(IDirect3DTexture9 *iface)
Definition: texture.c:244
static struct d3d9_texture * impl_from_IDirect3DTexture9(IDirect3DTexture9 *iface)
Definition: texture.c:26
static void STDMETHODCALLTYPE d3d9_texture_wined3d_object_destroyed(void *parent)
Definition: texture.c:1285
static D3DRESOURCETYPE WINAPI d3d9_texture_2d_GetType(IDirect3DTexture9 *iface)
Definition: texture.c:255
static HRESULT WINAPI d3d9_texture_cube_QueryInterface(IDirect3DCubeTexture9 *iface, REFIID riid, void **out)
Definition: texture.c:512
void d3d9_texture_flag_auto_gen_mipmap(struct d3d9_texture *texture)
Definition: texture.c:108
static void WINAPI d3d9_texture_cube_PreLoad(IDirect3DCubeTexture9 *iface)
Definition: texture.c:642
static DWORD WINAPI d3d9_texture_3d_SetLOD(IDirect3DVolumeTexture9 *iface, DWORD lod)
Definition: texture.c:1078
static HRESULT WINAPI d3d9_texture_3d_GetDevice(IDirect3DVolumeTexture9 *iface, IDirect3DDevice9 **device)
Definition: texture.c:986
static HRESULT WINAPI d3d9_texture_3d_AddDirtyBox(IDirect3DVolumeTexture9 *iface, const D3DBOX *dirty_box)
Definition: texture.c:1224
static HRESULT WINAPI d3d9_texture_2d_GetLevelDesc(IDirect3DTexture9 *iface, UINT level, D3DSURFACE_DESC *desc)
Definition: texture.c:350
static HRESULT WINAPI d3d9_texture_3d_SetPrivateData(IDirect3DVolumeTexture9 *iface, REFGUID guid, const void *data, DWORD data_size, DWORD flags)
Definition: texture.c:1000
static HRESULT WINAPI d3d9_texture_3d_FreePrivateData(IDirect3DVolumeTexture9 *iface, REFGUID guid)
Definition: texture.c:1020
static HRESULT WINAPI d3d9_texture_3d_GetLevelDesc(IDirect3DVolumeTexture9 *iface, UINT level, D3DVOLUME_DESC *desc)
Definition: texture.c:1140
static HRESULT WINAPI d3d9_texture_3d_SetAutoGenFilterType(IDirect3DVolumeTexture9 *iface, D3DTEXTUREFILTERTYPE filter_type)
Definition: texture.c:1120
static DWORD WINAPI d3d9_texture_2d_SetLOD(IDirect3DTexture9 *iface, DWORD lod)
Definition: texture.c:262
static ULONG WINAPI d3d9_texture_cube_Release(IDirect3DCubeTexture9 *iface)
Definition: texture.c:556
static HRESULT WINAPI d3d9_texture_3d_UnlockBox(IDirect3DVolumeTexture9 *iface, UINT level)
Definition: texture.c:1206
static void WINAPI d3d9_texture_3d_PreLoad(IDirect3DVolumeTexture9 *iface)
Definition: texture.c:1060
static D3DTEXTUREFILTERTYPE WINAPI d3d9_texture_cube_GetAutoGenFilterType(IDirect3DCubeTexture9 *iface)
Definition: texture.c:726
static HRESULT WINAPI d3d9_texture_cube_UnlockRect(IDirect3DCubeTexture9 *iface, D3DCUBEMAP_FACES face, UINT level)
Definition: texture.c:855
static HRESULT WINAPI d3d9_texture_cube_SetAutoGenFilterType(IDirect3DCubeTexture9 *iface, D3DTEXTUREFILTERTYPE filter_type)
Definition: texture.c:705
static HRESULT WINAPI d3d9_texture_2d_SetAutoGenFilterType(IDirect3DTexture9 *iface, D3DTEXTUREFILTERTYPE filter_type)
Definition: texture.c:307
static DWORD WINAPI d3d9_texture_cube_SetPriority(IDirect3DCubeTexture9 *iface, DWORD priority)
Definition: texture.c:610
static HRESULT WINAPI d3d9_texture_2d_AddDirtyRect(IDirect3DTexture9 *iface, const RECT *dirty_rect)
Definition: texture.c:459
static DWORD WINAPI d3d9_texture_cube_GetPriority(IDirect3DCubeTexture9 *iface)
Definition: texture.c:626
static DWORD WINAPI d3d9_texture_2d_SetPriority(IDirect3DTexture9 *iface, DWORD priority)
Definition: texture.c:212
static HRESULT WINAPI d3d9_texture_3d_GetVolumeLevel(IDirect3DVolumeTexture9 *iface, UINT level, IDirect3DVolume9 **volume)
Definition: texture.c:1164
static struct d3d9_texture * impl_from_IDirect3DVolumeTexture9(IDirect3DVolumeTexture9 *iface)
Definition: texture.c:36
static ULONG WINAPI d3d9_texture_2d_Release(IDirect3DTexture9 *iface)
Definition: texture.c:158
static HRESULT WINAPI d3d9_texture_2d_GetDevice(IDirect3DTexture9 *iface, IDirect3DDevice9 **device)
Definition: texture.c:170
static DWORD WINAPI d3d9_texture_2d_GetLevelCount(IDirect3DTexture9 *iface)
Definition: texture.c:290
static HRESULT WINAPI d3d9_texture_2d_QueryInterface(IDirect3DTexture9 *iface, REFIID riid, void **out)
Definition: texture.c:114
static const struct wined3d_parent_ops d3d9_texture_wined3d_parent_ops
Definition: texture.c:1292
static struct wined3d_shader_resource_view * d3d9_texture_acquire_shader_resource_view(struct d3d9_texture *texture)
Definition: texture.c:54
static HRESULT WINAPI d3d9_texture_3d_LockBox(IDirect3DVolumeTexture9 *iface, UINT level, D3DLOCKED_BOX *locked_box, const D3DBOX *box, DWORD flags)
Definition: texture.c:1186
static DWORD WINAPI d3d9_texture_3d_GetPriority(IDirect3DVolumeTexture9 *iface)
Definition: texture.c:1044
static void STDMETHODCALLTYPE srv_wined3d_object_destroyed(void *parent)
Definition: texture.c:41
static D3DRESOURCETYPE WINAPI d3d9_texture_3d_GetType(IDirect3DVolumeTexture9 *iface)
Definition: texture.c:1071
static HRESULT WINAPI d3d9_texture_cube_GetCubeMapSurface(IDirect3DCubeTexture9 *iface, D3DCUBEMAP_FACES face, UINT level, IDirect3DSurface9 **surface)
Definition: texture.c:788
static DWORD WINAPI d3d9_texture_cube_GetLOD(IDirect3DCubeTexture9 *iface)
Definition: texture.c:674
static ULONG WINAPI d3d9_texture_cube_AddRef(IDirect3DCubeTexture9 *iface)
Definition: texture.c:532
static HRESULT WINAPI d3d9_texture_cube_GetPrivateData(IDirect3DCubeTexture9 *iface, REFGUID guid, void *data, DWORD *data_size)
Definition: texture.c:592
static D3DTEXTUREFILTERTYPE WINAPI d3d9_texture_2d_GetAutoGenFilterType(IDirect3DTexture9 *iface)
Definition: texture.c:327
static HRESULT WINAPI d3d9_texture_cube_FreePrivateData(IDirect3DCubeTexture9 *iface, REFGUID guid)
Definition: texture.c:602
static const IDirect3DCubeTexture9Vtbl d3d9_texture_cube_vtbl
Definition: texture.c:906
static HRESULT WINAPI d3d9_texture_2d_FreePrivateData(IDirect3DTexture9 *iface, REFGUID guid)
Definition: texture.c:204
static struct d3d9_texture * impl_from_IDirect3DCubeTexture9(IDirect3DCubeTexture9 *iface)
Definition: texture.c:31
static D3DRESOURCETYPE WINAPI d3d9_texture_cube_GetType(IDirect3DCubeTexture9 *iface)
Definition: texture.c:653
static void WINAPI d3d9_texture_cube_GenerateMipSubLevels(IDirect3DCubeTexture9 *iface)
Definition: texture.c:738
static HRESULT WINAPI d3d9_texture_3d_QueryInterface(IDirect3DVolumeTexture9 *iface, REFIID riid, void **out)
Definition: texture.c:936
static HRESULT WINAPI d3d9_texture_cube_LockRect(IDirect3DCubeTexture9 *iface, D3DCUBEMAP_FACES face, UINT level, D3DLOCKED_RECT *locked_rect, const RECT *rect, DWORD flags)
Definition: texture.c:826
void CDECL wined3d_resource_preload(struct wined3d_resource *resource)
Definition: resource.c:482
DWORD CDECL wined3d_resource_set_priority(struct wined3d_resource *resource, DWORD priority)
Definition: resource.c:263
DWORD CDECL wined3d_resource_get_priority(const struct wined3d_resource *resource)
Definition: resource.c:279
DWORD CDECL wined3d_texture_set_lod(struct wined3d_texture *texture, DWORD lod)
Definition: texture.c:1186
HRESULT CDECL wined3d_texture_get_sub_resource_desc(const struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_sub_resource_desc *desc)
Definition: texture.c:3480
DWORD CDECL wined3d_texture_get_lod(const struct wined3d_texture *texture)
Definition: texture.c:1221
HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture, UINT layer, const struct wined3d_box *dirty_region)
Definition: texture.c:1677
HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct wined3d_resource_desc *desc, UINT layer_count, UINT level_count, DWORD flags, const struct wined3d_sub_resource_data *data, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_texture **texture)
Definition: texture.c:3511
void *CDECL wined3d_texture_get_sub_resource_parent(struct wined3d_texture *texture, unsigned int sub_resource_idx)
Definition: texture.c:3449
struct wined3d_resource *CDECL wined3d_texture_get_resource(struct wined3d_texture *texture)
Definition: texture.c:1052
ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture)
Definition: texture.c:1023
ULONG CDECL wined3d_texture_incref(struct wined3d_texture *texture)
Definition: texture.c:994
DWORD CDECL wined3d_texture_get_level_count(const struct wined3d_texture *texture)
Definition: texture.c:1228
HRESULT CDECL wined3d_shader_resource_view_create(const struct wined3d_view_desc *desc, struct wined3d_resource *resource, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_shader_resource_view **view)
Definition: view.c:781
void CDECL wined3d_shader_resource_view_generate_mipmaps(struct wined3d_shader_resource_view *view)
Definition: view.c:917
ULONG CDECL wined3d_rendertarget_view_incref(struct wined3d_rendertarget_view *view)
Definition: view.c:318
ULONG CDECL wined3d_rendertarget_view_decref(struct wined3d_rendertarget_view *view)
Definition: view.c:348
ULONG CDECL wined3d_shader_resource_view_decref(struct wined3d_shader_resource_view *view)
Definition: view.c:671
r parent
Definition: btrfs.c:3010
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
GLint level
Definition: gl.h:1546
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLenum GLuint texture
Definition: glext.h:6295
GLint lod
Definition: glext.h:7795
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
GLbitfield flags
Definition: glext.h:7161
GLsizei levels
Definition: glext.h:7884
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define resource
Definition: kernel32.h:9
#define debugstr_guid
Definition: kernel32.h:35
const GUID * guid
static const WCHAR desc[]
Definition: protectdata.c:36
static int priority
Definition: timer.c:163
unsigned int UINT
Definition: ndis.h:50
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
static FILE * out
Definition: regtests2xml.c:44
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
& rect
Definition: startmenu.cpp:1413
Definition: scsiwmi.h:51
Definition: palette.c:468
IDirect3DDevice9Ex * parent_device
Definition: d3d9_private.h:165
struct list rtv_entry
Definition: d3d9_private.h:163
IDirect3DSurface9 IDirect3DSurface9_iface
Definition: d3d9_private.h:159
struct wined3d_rendertarget_view * wined3d_rtv
Definition: d3d9_private.h:164
unsigned int sub_resource_idx
Definition: d3d9_private.h:162
IDirect3DBaseTexture9 IDirect3DBaseTexture9_iface
Definition: d3d9_private.h:206
IDirect3DVolume9 IDirect3DVolume9_iface
Definition: d3d9_private.h:136
Definition: devices.h:37
Definition: format.c:58
Definition: send.c:48
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
enum wined3d_format_id format
Definition: wined3d.h:1766
unsigned int multisample_quality
Definition: wined3d.h:1768
enum wined3d_multisample_type multisample_type
Definition: wined3d.h:1767
#define max(a, b)
Definition: svc.c:63
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
int ret
#define WINAPI
Definition: msvc.h:6
#define D3D9_TEXTURE_MIPMAP_DIRTY
Definition: d3d9_private.h:48
BOOL is_gdi_compat_wined3dformat(enum wined3d_format_id format) DECLSPEC_HIDDEN
Definition: device.c:1389
static DWORD wined3dusage_from_d3dusage(unsigned int usage)
Definition: d3d9_private.h:334
static unsigned int wined3d_log2i(unsigned int x)
Definition: wined3d.h:2759
@ WINED3D_MULTISAMPLE_NONE
Definition: wined3d.h:554
#define WINED3DUSAGE_LEGACY_CUBEMAP
Definition: wined3d.h:917
@ WINED3D_RTYPE_TEXTURE_2D
Definition: wined3d.h:700
@ WINED3D_RTYPE_TEXTURE_3D
Definition: wined3d.h:701
#define WINED3D_TEXTURE_CREATE_MAPPABLE
Definition: wined3d.h:1558
static void wined3d_box_set(struct wined3d_box *box, unsigned int left, unsigned int top, unsigned int right, unsigned int bottom, unsigned int front, unsigned int back)
Definition: wined3d.h:2789
#define WINED3D_RESOURCE_ACCESS_MAP_R
Definition: wined3d.h:57
#define WINED3DUSAGE_SCRATCH
Definition: wined3d.h:915
#define WINED3D_TEXTURE_CREATE_GET_DC
Definition: wined3d.h:1561
#define WINED3DUSAGE_TEXTURE
Definition: wined3d.h:918
#define WINED3D_TEXTURE_CREATE_GENERATE_MIPMAPS
Definition: wined3d.h:1562
#define WINED3D_RESOURCE_ACCESS_MAP_W
Definition: wined3d.h:58
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368
#define E_NOINTERFACE
Definition: winerror.h:2364