ReactOS 0.4.17-dev-966-gf06eace
device.c
Go to the documentation of this file.
1/*
2 * IDirect3DDevice8 implementation
3 *
4 * Copyright 2002-2004 Jason Edmeades
5 * Copyright 2004 Christian Costa
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 */
21
22#include "d3d8_private.h"
23
25
27
29{
31};
32
34{
35 BYTE *c = (BYTE *)&format;
36
37 /* Don't translate FOURCC formats */
38 if (isprint(c[0]) && isprint(c[1]) && isprint(c[2]) && isprint(c[3]))
39 return (D3DFORMAT)format;
40
41 switch(format)
42 {
52 case WINED3DFMT_A8_UNORM: return D3DFMT_A8;
58 case WINED3DFMT_P8_UINT: return D3DFMT_P8;
59 case WINED3DFMT_L8_UNORM: return D3DFMT_L8;
78 default:
79 FIXME("Unhandled wined3d format %#x.\n", format);
80 return D3DFMT_UNKNOWN;
81 }
82}
83
85{
86 BYTE *c = (BYTE *)&format;
87
88 /* Don't translate FOURCC formats */
89 if (isprint(c[0]) && isprint(c[1]) && isprint(c[2]) && isprint(c[3]))
90 return (enum wined3d_format_id)format;
91
92 switch(format)
93 {
103 case D3DFMT_A8: return WINED3DFMT_A8_UNORM;
109 case D3DFMT_P8: return WINED3DFMT_P8_UINT;
110 case D3DFMT_L8: return WINED3DFMT_L8_UNORM;
121 case D3DFMT_D32: return WINED3DFMT_D32_UNORM;
126 case D3DFMT_D16: return WINED3DFMT_D16_UNORM;
129 default:
130 FIXME("Unhandled D3DFORMAT %#x.\n", format);
131 return WINED3DFMT_UNKNOWN;
132 }
133}
134
135unsigned int wined3dmapflags_from_d3dmapflags(unsigned int flags, unsigned int usage)
136{
137 static const unsigned int handled = D3DLOCK_NOSYSLOCK
141 unsigned int wined3d_flags;
142
143 wined3d_flags = flags & handled;
145 wined3d_flags |= WINED3D_MAP_READ;
146 if (!(flags & D3DLOCK_READONLY))
147 wined3d_flags |= WINED3D_MAP_WRITE;
148 if (!(wined3d_flags & (WINED3D_MAP_READ | WINED3D_MAP_WRITE)))
149 wined3d_flags |= WINED3D_MAP_WRITE;
150 flags &= ~(handled | D3DLOCK_READONLY);
151
152 if (flags)
153 FIXME("Unhandled flags %#x.\n", flags);
154
155 return wined3d_flags;
156}
157
158static UINT vertex_count_from_primitive_count(D3DPRIMITIVETYPE primitive_type, UINT primitive_count)
159{
160 switch (primitive_type)
161 {
162 case D3DPT_POINTLIST:
163 return primitive_count;
164
165 case D3DPT_LINELIST:
166 return primitive_count * 2;
167
168 case D3DPT_LINESTRIP:
169 return primitive_count + 1;
170
172 return primitive_count * 3;
173
176 return primitive_count + 2;
177
178 default:
179 FIXME("Unhandled primitive type %#x.\n", primitive_type);
180 return 0;
181 }
182}
183
185{
186 switch (effect)
187 {
191 return D3DSWAPEFFECT_FLIP;
193 return D3DSWAPEFFECT_COPY;
196 default:
197 FIXME("Unhandled swap effect %#x.\n", effect);
198 return D3DSWAPEFFECT_FLIP;
199 }
200}
201
203 const struct wined3d_swapchain_desc *swapchain_desc, DWORD presentation_interval)
204{
205 present_parameters->BackBufferWidth = swapchain_desc->backbuffer_width;
206 present_parameters->BackBufferHeight = swapchain_desc->backbuffer_height;
207 present_parameters->BackBufferFormat = d3dformat_from_wined3dformat(swapchain_desc->backbuffer_format);
208 present_parameters->BackBufferCount = swapchain_desc->backbuffer_count;
209 present_parameters->MultiSampleType = d3dmultisample_type_from_wined3d(swapchain_desc->multisample_type);
210 present_parameters->SwapEffect = d3dswapeffect_from_wined3dswapeffect(swapchain_desc->swap_effect);
211 present_parameters->hDeviceWindow = swapchain_desc->device_window;
212 present_parameters->Windowed = swapchain_desc->windowed;
213 present_parameters->EnableAutoDepthStencil = swapchain_desc->enable_auto_depth_stencil;
214 present_parameters->AutoDepthStencilFormat
216 present_parameters->Flags = swapchain_desc->flags & D3DPRESENTFLAGS_MASK;
217 present_parameters->FullScreen_RefreshRateInHz = swapchain_desc->refresh_rate;
218 present_parameters->FullScreen_PresentationInterval = presentation_interval;
219}
220
222{
223 switch (effect)
224 {
233 default:
234 FIXME("Unhandled swap effect %#x.\n", effect);
236 }
237}
238
240{
241 switch (interval)
242 {
253 default:
254 FIXME("Unhandled presentation interval %#lx.\n", interval);
257 }
258}
259
261{
262 return (enum wined3d_multisample_type)type;
263}
264
266 struct wined3d_output *output, const D3DPRESENT_PARAMETERS *present_parameters)
267{
268 if (!present_parameters->SwapEffect || present_parameters->SwapEffect > D3DSWAPEFFECT_COPY_VSYNC)
269 {
270 WARN("Invalid swap effect %u passed.\n", present_parameters->SwapEffect);
271 return FALSE;
272 }
273 if (present_parameters->BackBufferCount > 3
274 || ((present_parameters->SwapEffect == D3DSWAPEFFECT_COPY
275 || present_parameters->SwapEffect == D3DSWAPEFFECT_COPY_VSYNC)
276 && present_parameters->BackBufferCount > 1))
277 {
278 WARN("Invalid backbuffer count %u.\n", present_parameters->BackBufferCount);
279 return FALSE;
280 }
281 switch (present_parameters->FullScreen_PresentationInterval)
282 {
289 break;
290 default:
291 WARN("Invalid presentation interval %#x.\n",
292 present_parameters->FullScreen_PresentationInterval);
293 return FALSE;
294 }
295
296 swapchain_desc->output = output;
297 swapchain_desc->backbuffer_width = present_parameters->BackBufferWidth;
298 swapchain_desc->backbuffer_height = present_parameters->BackBufferHeight;
299 swapchain_desc->backbuffer_format = wined3dformat_from_d3dformat(present_parameters->BackBufferFormat);
300 swapchain_desc->backbuffer_count = max(1, present_parameters->BackBufferCount);
302 swapchain_desc->multisample_type = wined3d_multisample_type_from_d3d(present_parameters->MultiSampleType);
303 swapchain_desc->multisample_quality = 0; /* d3d9 only */
304 swapchain_desc->swap_effect = wined3dswapeffect_from_d3dswapeffect(present_parameters->SwapEffect);
305 swapchain_desc->device_window = present_parameters->hDeviceWindow;
306 swapchain_desc->windowed = present_parameters->Windowed;
307 swapchain_desc->enable_auto_depth_stencil = present_parameters->EnableAutoDepthStencil;
308 swapchain_desc->auto_depth_stencil_format
310 swapchain_desc->flags
312 swapchain_desc->refresh_rate = present_parameters->FullScreen_RefreshRateInHz;
313 swapchain_desc->auto_restore_display_mode = TRUE;
314
315 if (present_parameters->Flags & ~D3DPRESENTFLAGS_MASK)
316 FIXME("Unhandled flags %#lx.\n", present_parameters->Flags & ~D3DPRESENTFLAGS_MASK);
317
318 return TRUE;
319}
320
322 unsigned int adapter_ordinal)
323{
325 caps->AdapterOrdinal = adapter_ordinal;
326 caps->Caps = wined3d_caps->Caps;
327 caps->Caps2 = wined3d_caps->Caps2;
328 caps->Caps3 = wined3d_caps->Caps3;
377
428 caps->LineCaps &= ~WINED3DLINECAPS_ANTIALIAS;
429 caps->StencilCaps &= ~WINED3DSTENCILCAPS_TWOSIDED;
433
434 /* D3D8 doesn't support SM 2.0 or higher, so clamp to 1.x */
435 if (caps->PixelShaderVersion)
436 caps->PixelShaderVersion = D3DPS_VERSION(1, 4);
437 else
438 caps->PixelShaderVersion = D3DPS_VERSION(0, 0);
439 if (caps->VertexShaderVersion)
441 else
444}
445
447{
448 return (enum wined3d_transform_state)state;
449}
450
452{
453 switch (state)
454 {
455 case D3DRS_ZBIAS:
459 default:
460 return (enum wined3d_render_state)state;
461 }
462}
463
465{
466 return (enum wined3d_primitive_type)type;
467}
468
469/* Handle table functions */
471{
472 struct d3d8_handle_entry *entry;
473
474 if (t->free_entries)
475 {
476 DWORD index = t->free_entries - t->entries;
477 /* Use a free handle */
478 entry = t->free_entries;
479 if (entry->type != D3D8_HANDLE_FREE)
480 {
481 ERR("Handle %lu(%p) is in the free list, but has type %#x.\n", index, entry, entry->type);
482 return D3D8_INVALID_HANDLE;
483 }
484 t->free_entries = entry->object;
485 entry->object = object;
486 entry->type = type;
487
488 return index;
489 }
490
491 if (!(t->entry_count < t->table_size))
492 {
493 /* Grow the table */
494 UINT new_size = t->table_size + (t->table_size >> 1);
495 struct d3d8_handle_entry *new_entries;
496
497 if (!(new_entries = realloc(t->entries, new_size * sizeof(*t->entries))))
498 {
499 ERR("Failed to grow the handle table.\n");
500 return D3D8_INVALID_HANDLE;
501 }
502 t->entries = new_entries;
503 t->table_size = new_size;
504 }
505
506 entry = &t->entries[t->entry_count];
507 entry->object = object;
508 entry->type = type;
509
510 return t->entry_count++;
511}
512
514{
515 struct d3d8_handle_entry *entry;
516 void *object;
517
518 if (handle == D3D8_INVALID_HANDLE || handle >= t->entry_count)
519 {
520 WARN("Invalid handle %lu passed.\n", handle);
521 return NULL;
522 }
523
524 entry = &t->entries[handle];
525 if (entry->type != type)
526 {
527 WARN("Handle %lu(%p) is not of type %#x.\n", handle, entry, type);
528 return NULL;
529 }
530
531 object = entry->object;
532 entry->object = t->free_entries;
533 entry->type = D3D8_HANDLE_FREE;
534 t->free_entries = entry;
535
536 return object;
537}
538
540{
541 struct d3d8_handle_entry *entry;
542
543 if (handle == D3D8_INVALID_HANDLE || handle >= t->entry_count)
544 {
545 WARN("Invalid handle %lu passed.\n", handle);
546 return NULL;
547 }
548
549 entry = &t->entries[handle];
550 if (entry->type != type)
551 {
552 WARN("Handle %lu(%p) is not of type %#x.\n", handle, entry, type);
553 return NULL;
554 }
555
556 return entry->object;
557}
558
560{
561 struct wined3d_viewport vp;
562 RECT rect;
563
564 wined3d_device_context_get_viewports(device->immediate_context, NULL, &vp);
568}
569
570static HRESULT WINAPI d3d8_device_QueryInterface(IDirect3DDevice8 *iface, REFIID riid, void **out)
571{
572 TRACE("iface %p, riid %s, out %p.\n",
573 iface, debugstr_guid(riid), out);
574
575 if (IsEqualGUID(riid, &IID_IDirect3DDevice8)
577 {
579 *out = iface;
580 return S_OK;
581 }
582
583 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
584
585 *out = NULL;
586 return E_NOINTERFACE;
587}
588
589static ULONG WINAPI d3d8_device_AddRef(IDirect3DDevice8 *iface)
590{
593
594 TRACE("%p increasing refcount to %lu.\n", iface, ref);
595
596 return ref;
597}
598
599static ULONG WINAPI d3d8_device_Release(IDirect3DDevice8 *iface)
600{
602 ULONG ref;
603
604 if (device->in_destruction)
605 return 0;
606
608
609 TRACE("%p decreasing refcount to %lu.\n", iface, ref);
610
611 if (!ref)
612 {
613 IDirect3D8 *parent = &device->d3d_parent->IDirect3D8_iface;
614 unsigned i;
615
616 TRACE("Releasing wined3d device %p.\n", device->wined3d_device);
617
619
620 device->in_destruction = TRUE;
621
622 for (i = 0; i < device->numConvertedDecls; ++i)
623 {
624 d3d8_vertex_declaration_destroy(device->decls[i].declaration);
625 }
626 free(device->decls);
627
630
631 if (device->recording)
634
635 wined3d_swapchain_decref(device->implicit_swapchain);
637 wined3d_device_decref(device->wined3d_device);
638 free(device->handle_table.entries);
639 free(device);
640
642
644 }
645 return ref;
646}
647
648static HRESULT WINAPI d3d8_device_TestCooperativeLevel(IDirect3DDevice8 *iface)
649{
651
652 TRACE("iface %p.\n", iface);
653
654 TRACE("device state: %#lx.\n", device->device_state);
655
656 switch (device->device_state)
657 {
658 default:
660 return D3D_OK;
662 return D3DERR_DEVICELOST;
665 }
666}
667
668static UINT WINAPI d3d8_device_GetAvailableTextureMem(IDirect3DDevice8 *iface)
669{
671 UINT ret;
672
673 TRACE("iface %p.\n", iface);
674
678
679 return ret;
680}
681
682static HRESULT WINAPI d3d8_device_ResourceManagerDiscardBytes(IDirect3DDevice8 *iface, DWORD byte_count)
683{
685
686 TRACE("iface %p, byte_count %lu.\n", iface, byte_count);
687
688 if (byte_count)
689 FIXME("Byte count ignored.\n");
690
694
695 return D3D_OK;
696}
697
698static HRESULT WINAPI d3d8_device_GetDirect3D(IDirect3DDevice8 *iface, IDirect3D8 **d3d8)
699{
701
702 TRACE("iface %p, d3d8 %p.\n", iface, d3d8);
703
704 if (!d3d8)
705 return D3DERR_INVALIDCALL;
706
707 return IDirect3D8_QueryInterface(&device->d3d_parent->IDirect3D8_iface, &IID_IDirect3D8,
708 (void **)d3d8);
709}
710
711static HRESULT WINAPI d3d8_device_GetDeviceCaps(IDirect3DDevice8 *iface, D3DCAPS8 *caps)
712{
715 HRESULT hr;
716
717 TRACE("iface %p, caps %p.\n", iface, caps);
718
719 if (!caps)
720 return D3DERR_INVALIDCALL;
721
725
726 d3dcaps_from_wined3dcaps(caps, &wined3d_caps, device->adapter_ordinal);
727
728 return hr;
729}
730
732{
734 struct wined3d_display_mode wined3d_mode;
735 HRESULT hr;
736
737 TRACE("iface %p, mode %p.\n", iface, mode);
738
740 hr = wined3d_device_get_display_mode(device->wined3d_device, 0, &wined3d_mode, NULL);
742
743 if (SUCCEEDED(hr))
744 {
745 mode->Width = wined3d_mode.width;
746 mode->Height = wined3d_mode.height;
747 mode->RefreshRate = wined3d_mode.refresh_rate;
748 mode->Format = d3dformat_from_wined3dformat(wined3d_mode.format_id);
749 }
750
751 return hr;
752}
753
754static HRESULT WINAPI d3d8_device_GetCreationParameters(IDirect3DDevice8 *iface,
756{
758
759 TRACE("iface %p, parameters %p.\n", iface, parameters);
760
765
766 parameters->AdapterOrdinal = device->adapter_ordinal;
767 return D3D_OK;
768}
769
770static HRESULT WINAPI d3d8_device_SetCursorProperties(IDirect3DDevice8 *iface,
771 UINT hotspot_x, UINT hotspot_y, IDirect3DSurface8 *bitmap)
772{
775 D3DSURFACE_DESC surface_desc;
777 HRESULT hr;
778
779 TRACE("iface %p, hotspot_x %u, hotspot_y %u, bitmap %p.\n",
780 iface, hotspot_x, hotspot_y, bitmap);
781
782 if (!bitmap)
783 {
784 WARN("No cursor bitmap, returning D3DERR_INVALIDCALL.\n");
785 return D3DERR_INVALIDCALL;
786 }
787
788 if (FAILED(hr = IDirect3DSurface8_GetDesc(bitmap, &surface_desc)))
789 {
790 WARN("Failed to get surface description, hr %#lx.\n", hr);
791 return hr;
792 }
793
794 if (FAILED(hr = IDirect3D8_GetAdapterDisplayMode(&device->d3d_parent->IDirect3D8_iface,
795 device->adapter_ordinal, &mode)))
796 {
797 WARN("Failed to get device display mode, hr %#lx.\n", hr);
798 return hr;
799 }
800
801 if (surface_desc.Width > mode.Width || surface_desc.Height > mode.Height)
802 {
803 WARN("Surface dimension %ux%u exceeds display mode %ux%u.\n", surface_desc.Width,
804 surface_desc.Height, mode.Width, mode.Height);
805 return D3DERR_INVALIDCALL;
806 }
807
810 hotspot_x, hotspot_y, bitmap_impl->wined3d_texture, bitmap_impl->sub_resource_idx);
812
813 return hr;
814}
815
816static void WINAPI d3d8_device_SetCursorPosition(IDirect3DDevice8 *iface, UINT x, UINT y, DWORD flags)
817{
819
820 TRACE("iface %p, x %u, y %u, flags %#lx.\n", iface, x, y, flags);
821
825}
826
827static BOOL WINAPI d3d8_device_ShowCursor(IDirect3DDevice8 *iface, BOOL show)
828{
830 BOOL ret;
831
832 TRACE("iface %p, show %#x.\n", iface, show);
833
835 ret = wined3d_device_show_cursor(device->wined3d_device, show);
837
838 return ret;
839}
840
842 D3DPRESENT_PARAMETERS *present_parameters, IDirect3DSwapChain8 **swapchain)
843{
846 struct d3d8_swapchain *object;
847 unsigned int swap_interval;
848 unsigned int output_idx;
849 unsigned int i, count;
850 HRESULT hr;
851
852 TRACE("iface %p, present_parameters %p, swapchain %p.\n",
853 iface, present_parameters, swapchain);
854
855 if (!present_parameters->Windowed)
856 {
857 WARN("Trying to create an additional fullscreen swapchain, returning D3DERR_INVALIDCALL.\n");
858 return D3DERR_INVALIDCALL;
859 }
860
863 for (i = 0; i < count; ++i)
864 {
866
869
870 if (!desc.windowed)
871 {
873 WARN("Trying to create an additional swapchain in fullscreen mode, returning D3DERR_INVALIDCALL.\n");
874 return D3DERR_INVALIDCALL;
875 }
876 }
878
879 output_idx = device->adapter_ordinal;
880 if (!wined3d_swapchain_desc_from_d3d8(&desc, device->d3d_parent->wined3d_outputs[output_idx],
881 present_parameters))
882 return D3DERR_INVALIDCALL;
885 *swapchain = &object->IDirect3DSwapChain8_iface;
887 &desc, present_parameters->FullScreen_PresentationInterval);
888
889 return hr;
890}
891
893{
895 struct d3d8_indexbuffer *index_buffer;
897 IDirect3DBaseTexture8 *texture;
898 struct d3d8_surface *surface;
900
902 if ((desc.access & WINED3D_RESOURCE_ACCESS_CPU) || (desc.usage & WINED3DUSAGE_MANAGED))
903 return D3D_OK;
904
905 if (desc.resource_type != WINED3D_RTYPE_TEXTURE_2D)
906 {
907 if (desc.bind_flags & WINED3D_BIND_VERTEX_BUFFER)
908 {
910 if (vertex_buffer && vertex_buffer->draw_buffer)
911 return D3D_OK;
912 }
913 if (desc.bind_flags & WINED3D_BIND_INDEX_BUFFER)
914 {
916 if (index_buffer && index_buffer->sysmem)
917 return D3D_OK;
918 }
919
920 WARN("Resource %p in pool D3DPOOL_DEFAULT blocks the Reset call.\n", resource);
921 return D3DERR_DEVICELOST;
922 }
923
925 if (parent && SUCCEEDED(IUnknown_QueryInterface(parent, &IID_IDirect3DBaseTexture8, (void **)&texture)))
926 {
928 WARN("Texture %p (resource %p) in pool D3DPOOL_DEFAULT blocks the Reset call.\n", texture, resource);
929 return D3DERR_DEVICELOST;
930 }
931
933 if (!surface || !surface->resource.refcount)
934 return D3D_OK;
935
936 WARN("Surface %p in pool D3DPOOL_DEFAULT blocks the Reset call.\n", surface);
937 return D3DERR_DEVICELOST;
938}
939
940static HRESULT WINAPI d3d8_device_Reset(IDirect3DDevice8 *iface,
941 D3DPRESENT_PARAMETERS *present_parameters)
942{
943 struct wined3d_swapchain_desc swapchain_desc, old_swapchain_desc;
945 struct d3d8_swapchain *implicit_swapchain;
946 unsigned int output_idx;
947 HRESULT hr;
948
949 TRACE("iface %p, present_parameters %p.\n", iface, present_parameters);
950
951 if (device->device_state == D3D8_DEVICE_STATE_LOST)
952 {
953 WARN("App not active, returning D3DERR_DEVICELOST.\n");
954 return D3DERR_DEVICELOST;
955 }
956 output_idx = device->adapter_ordinal;
957 if (!wined3d_swapchain_desc_from_d3d8(&swapchain_desc,
958 device->d3d_parent->wined3d_outputs[output_idx], present_parameters))
959 return D3DERR_INVALIDCALL;
960 swapchain_desc.flags |= WINED3D_SWAPCHAIN_IMPLICIT;
961
963
966
967 wined3d_swapchain_get_desc(device->implicit_swapchain, &old_swapchain_desc);
968
969 if (device->recording)
971 device->recording = NULL;
972 device->update_state = device->state;
974
975 /* wined3d_device_reset() may recreate swapchain textures.
976 * We do not need to remove the reference to the wined3d swapchain from the
977 * old d3d8 surfaces: we will fail the reset if they have 0 references,
978 * and therefore they are not actually holding a reference to the wined3d
979 * swapchain, and will not do anything with it when they are destroyed. */
980
981 if (SUCCEEDED(hr = wined3d_device_reset(device->wined3d_device, &swapchain_desc,
983 {
984 struct wined3d_rendertarget_view *rtv;
985 struct d3d8_surface *surface;
986 unsigned int i;
987
988 present_parameters->BackBufferCount = swapchain_desc.backbuffer_count;
989 implicit_swapchain = wined3d_swapchain_get_parent(device->implicit_swapchain);
990 implicit_swapchain->swap_interval
994 !!swapchain_desc.enable_auto_depth_stencil);
996
997 /* FIXME: This should be the new backbuffer count, but we don't support
998 * changing the backbuffer count in wined3d yet. */
999 for (i = 0; i < old_swapchain_desc.backbuffer_count; ++i)
1000 {
1001 struct wined3d_texture *backbuffer = wined3d_swapchain_get_back_buffer(device->implicit_swapchain, i);
1002
1003 if ((surface = d3d8_surface_create(backbuffer, 0, (IUnknown *)&device->IDirect3DDevice8_iface)))
1004 surface->parent_device = &device->IDirect3DDevice8_iface;
1005 }
1006
1007 if ((rtv = wined3d_device_context_get_depth_stencil_view(device->immediate_context)))
1008 {
1010
1012 (IUnknown *)&device->IDirect3DDevice8_iface)))
1013 surface->parent_device = &device->IDirect3DDevice8_iface;
1014 }
1015
1016 device->device_state = D3D8_DEVICE_STATE_OK;
1017 }
1018 else
1019 {
1020 device->device_state = D3D8_DEVICE_STATE_NOT_RESET;
1021 }
1023
1024 return hr;
1025}
1026
1027static HRESULT WINAPI d3d8_device_Present(IDirect3DDevice8 *iface, const RECT *src_rect,
1028 const RECT *dst_rect, HWND dst_window_override, const RGNDATA *dirty_region)
1029{
1031 struct d3d8_swapchain *implicit_swapchain;
1032
1033 TRACE("iface %p, src_rect %s, dst_rect %s, dst_window_override %p, dirty_region %p.\n",
1034 iface, wine_dbgstr_rect(src_rect), wine_dbgstr_rect(dst_rect), dst_window_override, dirty_region);
1035
1036 /* Fraps does not hook IDirect3DDevice8::Present regardless of the hotpatch
1037 * attribute. It only hooks IDirect3DSwapChain8::Present. Yet it properly
1038 * shows a framerate on Windows in applications that only call the device
1039 * method, like e.g. the dx8 sdk samples. The conclusion is that native
1040 * calls the swapchain's public method from the device. */
1041 implicit_swapchain = wined3d_swapchain_get_parent(device->implicit_swapchain);
1042 return IDirect3DSwapChain8_Present(&implicit_swapchain->IDirect3DSwapChain8_iface,
1043 src_rect, dst_rect, dst_window_override, dirty_region);
1044}
1045
1046static HRESULT WINAPI d3d8_device_GetBackBuffer(IDirect3DDevice8 *iface,
1047 UINT backbuffer_idx, D3DBACKBUFFER_TYPE backbuffer_type, IDirect3DSurface8 **backbuffer)
1048{
1051 struct d3d8_surface *surface_impl;
1052
1053 TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n",
1054 iface, backbuffer_idx, backbuffer_type, backbuffer);
1055
1056 /* backbuffer_type is ignored by native. */
1057
1058 /* No need to check for backbuffer == NULL, Windows crashes in that case. */
1060
1061 if (!(wined3d_texture = wined3d_swapchain_get_back_buffer(device->implicit_swapchain, backbuffer_idx)))
1062 {
1064 *backbuffer = NULL;
1065 return D3DERR_INVALIDCALL;
1066 }
1067
1069 *backbuffer = &surface_impl->IDirect3DSurface8_iface;
1070 IDirect3DSurface8_AddRef(*backbuffer);
1071
1073 return D3D_OK;
1074}
1075
1076static HRESULT WINAPI d3d8_device_GetRasterStatus(IDirect3DDevice8 *iface, D3DRASTER_STATUS *raster_status)
1077{
1079 HRESULT hr;
1080
1081 TRACE("iface %p, raster_status %p.\n", iface, raster_status);
1082
1084 hr = wined3d_device_get_raster_status(device->wined3d_device, 0, (struct wined3d_raster_status *)raster_status);
1086
1087 return hr;
1088}
1089
1090static void WINAPI d3d8_device_SetGammaRamp(IDirect3DDevice8 *iface, DWORD flags, const D3DGAMMARAMP *ramp)
1091{
1093
1094 TRACE("iface %p, flags %#lx, ramp %p.\n", iface, flags, ramp);
1095
1096 /* Note: D3DGAMMARAMP is compatible with struct wined3d_gamma_ramp. */
1098 wined3d_device_set_gamma_ramp(device->wined3d_device, 0, flags, (const struct wined3d_gamma_ramp *)ramp);
1100}
1101
1102static void WINAPI d3d8_device_GetGammaRamp(IDirect3DDevice8 *iface, D3DGAMMARAMP *ramp)
1103{
1105
1106 TRACE("iface %p, ramp %p.\n", iface, ramp);
1107
1108 /* Note: D3DGAMMARAMP is compatible with struct wined3d_gamma_ramp. */
1110 wined3d_device_get_gamma_ramp(device->wined3d_device, 0, (struct wined3d_gamma_ramp *)ramp);
1112}
1113
1114static HRESULT WINAPI d3d8_device_CreateTexture(IDirect3DDevice8 *iface,
1116 D3DPOOL pool, IDirect3DTexture8 **texture)
1117{
1119 struct d3d8_texture *object;
1120 unsigned int i;
1121 HRESULT hr;
1122
1123 TRACE("iface %p, width %u, height %u, levels %u, usage %#lx, format %#x, pool %#x, texture %p.\n",
1124 iface, width, height, levels, usage, format, pool, texture);
1125
1126 if (!format)
1127 return D3DERR_INVALIDCALL;
1128
1129 *texture = NULL;
1130 if (!(object = calloc(1, sizeof(*object))))
1132
1134 if (FAILED(hr))
1135 {
1136 WARN("Failed to initialize texture, hr %#lx.\n", hr);
1137 free(object);
1138 return hr;
1139 }
1140
1141 levels = wined3d_texture_get_level_count(object->wined3d_texture);
1142 for (i = 0; i < levels; ++i)
1143 {
1144 if (!d3d8_surface_create(object->wined3d_texture, i, (IUnknown *)&object->IDirect3DBaseTexture8_iface))
1145 {
1146 IDirect3DTexture8_Release(&object->IDirect3DBaseTexture8_iface);
1147 return E_OUTOFMEMORY;
1148 }
1149 }
1150
1151 TRACE("Created texture %p.\n", object);
1152 *texture = (IDirect3DTexture8 *)&object->IDirect3DBaseTexture8_iface;
1153
1154 return D3D_OK;
1155}
1156
1157static HRESULT WINAPI d3d8_device_CreateVolumeTexture(IDirect3DDevice8 *iface,
1159 D3DPOOL pool, IDirect3DVolumeTexture8 **texture)
1160{
1162 struct d3d8_texture *object;
1163 HRESULT hr;
1164
1165 TRACE("iface %p, width %u, height %u, depth %u, levels %u, usage %#lx, format %#x, pool %#x, texture %p.\n",
1167
1168 if (!format)
1169 return D3DERR_INVALIDCALL;
1170
1171 *texture = NULL;
1172 if (!(object = calloc(1, sizeof(*object))))
1174
1176 if (FAILED(hr))
1177 {
1178 WARN("Failed to initialize volume texture, hr %#lx.\n", hr);
1179 free(object);
1180 return hr;
1181 }
1182
1183 TRACE("Created volume texture %p.\n", object);
1184 *texture = (IDirect3DVolumeTexture8 *)&object->IDirect3DBaseTexture8_iface;
1185
1186 return D3D_OK;
1187}
1188
1189static HRESULT WINAPI d3d8_device_CreateCubeTexture(IDirect3DDevice8 *iface, UINT edge_length,
1190 UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool, IDirect3DCubeTexture8 **texture)
1191{
1193 struct d3d8_texture *object;
1194 unsigned int i;
1195 HRESULT hr;
1196
1197 TRACE("iface %p, edge_length %u, levels %u, usage %#lx, format %#x, pool %#x, texture %p.\n",
1198 iface, edge_length, levels, usage, format, pool, texture);
1199
1200 if (!format)
1201 return D3DERR_INVALIDCALL;
1202
1203 *texture = NULL;
1204 if (!(object = calloc(1, sizeof(*object))))
1206
1207 hr = d3d8_texture_cube_init(object, device, edge_length, levels, usage, format, pool);
1208 if (FAILED(hr))
1209 {
1210 WARN("Failed to initialize cube texture, hr %#lx.\n", hr);
1211 free(object);
1212 return hr;
1213 }
1214
1215 levels = wined3d_texture_get_level_count(object->wined3d_texture);
1216 for (i = 0; i < levels * 6; ++i)
1217 {
1218 if (!d3d8_surface_create(object->wined3d_texture, i, (IUnknown *)&object->IDirect3DBaseTexture8_iface))
1219 {
1220 IDirect3DTexture8_Release(&object->IDirect3DBaseTexture8_iface);
1221 return E_OUTOFMEMORY;
1222 }
1223 }
1224
1225 TRACE("Created cube texture %p.\n", object);
1226 *texture = (IDirect3DCubeTexture8 *)&object->IDirect3DBaseTexture8_iface;
1227
1228 return hr;
1229}
1230
1232 DWORD usage, DWORD fvf, D3DPOOL pool, IDirect3DVertexBuffer8 **buffer)
1233{
1235 struct d3d8_vertexbuffer *object;
1236 HRESULT hr;
1237
1238 TRACE("iface %p, size %u, usage %#lx, fvf %#lx, pool %#x, buffer %p.\n",
1239 iface, size, usage, fvf, pool, buffer);
1240
1241 if (!(object = calloc(1, sizeof(*object))))
1243
1244 hr = vertexbuffer_init(object, device, size, usage, fvf, pool);
1245 if (FAILED(hr))
1246 {
1247 WARN("Failed to initialize vertex buffer, hr %#lx.\n", hr);
1248 free(object);
1249 return hr;
1250 }
1251
1252 TRACE("Created vertex buffer %p.\n", object);
1253 *buffer = &object->IDirect3DVertexBuffer8_iface;
1254
1255 return D3D_OK;
1256}
1257
1258static HRESULT WINAPI d3d8_device_CreateIndexBuffer(IDirect3DDevice8 *iface, UINT size,
1259 DWORD usage, D3DFORMAT format, D3DPOOL pool, IDirect3DIndexBuffer8 **buffer)
1260{
1262 struct d3d8_indexbuffer *object;
1263 HRESULT hr;
1264
1265 TRACE("iface %p, size %u, usage %#lx, format %#x, pool %#x, buffer %p.\n",
1266 iface, size, usage, format, pool, buffer);
1267
1268 if (!(object = calloc(1, sizeof(*object))))
1270
1272 if (FAILED(hr))
1273 {
1274 WARN("Failed to initialize index buffer, hr %#lx.\n", hr);
1275 free(object);
1276 return hr;
1277 }
1278
1279 TRACE("Created index buffer %p.\n", object);
1280 *buffer = &object->IDirect3DIndexBuffer8_iface;
1281
1282 return D3D_OK;
1283}
1284
1286 enum wined3d_multisample_type multisample_type, unsigned int bind_flags, unsigned int access,
1287 unsigned int width, unsigned int height, IDirect3DSurface8 **surface)
1288{
1290 struct d3d8_surface *surface_impl;
1291 struct wined3d_texture *texture;
1292 HRESULT hr;
1293
1294 TRACE("device %p, format %#x, multisample_type %#x, bind_flags %#x, "
1295 "access %#x, width %u, height %u, surface %p.\n",
1296 device, format, multisample_type, bind_flags, access, width, height, surface);
1297
1298 desc.resource_type = WINED3D_RTYPE_TEXTURE_2D;
1299 desc.format = format;
1300 desc.multisample_type = multisample_type;
1301 desc.multisample_quality = 0;
1302 desc.usage = 0;
1303 desc.bind_flags = bind_flags;
1304 desc.access = access;
1305 desc.width = width;
1306 desc.height = height;
1307 desc.depth = 1;
1308 desc.size = 0;
1309
1311
1312 if (FAILED(hr = wined3d_texture_create(device->wined3d_device, &desc,
1314 {
1316 WARN("Failed to create texture, hr %#lx.\n", hr);
1317 return hr;
1318 }
1319
1320 if (!(surface_impl = d3d8_surface_create(texture, 0, NULL)))
1321 {
1324 return E_OUTOFMEMORY;
1325 }
1326 surface_impl->parent_device = &device->IDirect3DDevice8_iface;
1327 *surface = &surface_impl->IDirect3DSurface8_iface;
1328 IDirect3DSurface8_AddRef(*surface);
1330
1332
1333 return D3D_OK;
1334}
1335
1337 UINT height, D3DFORMAT format, D3DMULTISAMPLE_TYPE multisample_type, BOOL lockable,
1338 IDirect3DSurface8 **surface)
1339{
1341 unsigned int access = WINED3D_RESOURCE_ACCESS_GPU;
1342
1343 TRACE("iface %p, width %u, height %u, format %#x, multisample_type %#x, lockable %#x, surface %p.\n",
1344 iface, width, height, format, multisample_type, lockable, surface);
1345
1346 if (!format)
1347 return D3DERR_INVALIDCALL;
1348
1349 *surface = NULL;
1350 if (lockable)
1352
1354 wined3d_multisample_type_from_d3d(multisample_type),
1356}
1357
1360 IDirect3DSurface8 **surface)
1361{
1363
1364 TRACE("iface %p, width %u, height %u, format %#x, multisample_type %#x, surface %p.\n",
1365 iface, width, height, format, multisample_type, surface);
1366
1367 if (!format)
1368 return D3DERR_INVALIDCALL;
1369
1370 *surface = NULL;
1371
1375}
1376
1377/* IDirect3DDevice8Impl::CreateImageSurface returns surface with pool type SYSTEMMEM */
1379 UINT height, D3DFORMAT format, IDirect3DSurface8 **surface)
1380{
1382 unsigned int access = WINED3D_RESOURCE_ACCESS_CPU
1384
1385 TRACE("iface %p, width %u, height %u, format %#x, surface %p.\n",
1386 iface, width, height, format, surface);
1387
1388 *surface = NULL;
1389
1392}
1393
1394static HRESULT WINAPI d3d8_device_CopyRects(IDirect3DDevice8 *iface,
1395 IDirect3DSurface8 *src_surface, const RECT *src_rects, UINT rect_count,
1396 IDirect3DSurface8 *dst_surface, const POINT *dst_points)
1397{
1401 enum wined3d_format_id src_format, dst_format;
1402 struct wined3d_sub_resource_desc wined3d_desc;
1403 UINT src_w, src_h;
1404
1405 TRACE("iface %p, src_surface %p, src_rects %p, rect_count %u, dst_surface %p, dst_points %p.\n",
1406 iface, src_surface, src_rects, rect_count, dst_surface, dst_points);
1407
1409 wined3d_texture_get_sub_resource_desc(src->wined3d_texture, src->sub_resource_idx, &wined3d_desc);
1410 if (wined3d_desc.bind_flags & WINED3D_BIND_DEPTH_STENCIL)
1411 {
1412 WARN("Source %p is a depth stencil surface, returning D3DERR_INVALIDCALL.\n", src_surface);
1414 return D3DERR_INVALIDCALL;
1415 }
1416 src_format = wined3d_desc.format;
1417 src_w = wined3d_desc.width;
1418 src_h = wined3d_desc.height;
1419
1420 wined3d_texture_get_sub_resource_desc(dst->wined3d_texture, dst->sub_resource_idx, &wined3d_desc);
1421 if (wined3d_desc.bind_flags & WINED3D_BIND_DEPTH_STENCIL)
1422 {
1423 WARN("Destination %p is a depth stencil surface, returning D3DERR_INVALIDCALL.\n", dst_surface);
1425 return D3DERR_INVALIDCALL;
1426 }
1427 dst_format = wined3d_desc.format;
1428
1429 /* Check that the source and destination formats match */
1430 if (src_format != dst_format)
1431 {
1432 WARN("Source %p format must match the destination %p format, returning D3DERR_INVALIDCALL.\n",
1433 src_surface, dst_surface);
1435 return D3DERR_INVALIDCALL;
1436 }
1437
1438 /* Quick if complete copy ... */
1439 if (!rect_count && !src_rects && !dst_points)
1440 {
1441 RECT rect = {0, 0, src_w, src_h};
1442 wined3d_device_context_blt(device->immediate_context, dst->wined3d_texture, dst->sub_resource_idx, &rect,
1443 src->wined3d_texture, src->sub_resource_idx, &rect, 0, NULL, WINED3D_TEXF_POINT);
1444 }
1445 else
1446 {
1447 unsigned int i;
1448 /* Copy rect by rect */
1449 if (src_rects && dst_points)
1450 {
1451 for (i = 0; i < rect_count; ++i)
1452 {
1453 UINT w = src_rects[i].right - src_rects[i].left;
1454 UINT h = src_rects[i].bottom - src_rects[i].top;
1455 RECT dst_rect = {dst_points[i].x, dst_points[i].y,
1456 dst_points[i].x + w, dst_points[i].y + h};
1457
1458 wined3d_device_context_blt(device->immediate_context,
1459 dst->wined3d_texture, dst->sub_resource_idx, &dst_rect,
1460 src->wined3d_texture, src->sub_resource_idx, &src_rects[i], 0, NULL, WINED3D_TEXF_POINT);
1461 }
1462 }
1463 else
1464 {
1465 for (i = 0; i < rect_count; ++i)
1466 {
1467 UINT w = src_rects[i].right - src_rects[i].left;
1468 UINT h = src_rects[i].bottom - src_rects[i].top;
1469 RECT dst_rect = {0, 0, w, h};
1470
1471 wined3d_device_context_blt(device->immediate_context,
1472 dst->wined3d_texture, dst->sub_resource_idx, &dst_rect,
1473 src->wined3d_texture, src->sub_resource_idx, &src_rects[i], 0, NULL, WINED3D_TEXF_POINT);
1474 }
1475 }
1476 }
1478
1479 return WINED3D_OK;
1480}
1481
1482static HRESULT WINAPI d3d8_device_UpdateTexture(IDirect3DDevice8 *iface,
1483 IDirect3DBaseTexture8 *src_texture, IDirect3DBaseTexture8 *dst_texture)
1484{
1486 struct d3d8_texture *src_impl, *dst_impl;
1487 HRESULT hr;
1488
1489 TRACE("iface %p, src_texture %p, dst_texture %p.\n", iface, src_texture, dst_texture);
1490
1491 src_impl = unsafe_impl_from_IDirect3DBaseTexture8(src_texture);
1492 dst_impl = unsafe_impl_from_IDirect3DBaseTexture8(dst_texture);
1493
1494 if (src_impl->draw_texture || dst_impl->draw_texture)
1495 {
1496 WARN("Source or destination is managed; returning D3DERR_INVALIDCALL.\n");
1497 return D3DERR_INVALIDCALL;
1498 }
1499
1501 hr = wined3d_device_update_texture(device->wined3d_device,
1502 src_impl->wined3d_texture, dst_impl->wined3d_texture);
1504
1505 return hr;
1506}
1507
1508static HRESULT WINAPI d3d8_device_GetFrontBuffer(IDirect3DDevice8 *iface, IDirect3DSurface8 *dst_surface)
1509{
1511 struct d3d8_surface *dst_impl = unsafe_impl_from_IDirect3DSurface8(dst_surface);
1512 HRESULT hr;
1513
1514 TRACE("iface %p, dst_surface %p.\n", iface, dst_surface);
1515
1516 if (!dst_surface)
1517 {
1518 WARN("Invalid destination surface passed.\n");
1519 return D3DERR_INVALIDCALL;
1520 }
1521
1524 dst_impl->wined3d_texture, dst_impl->sub_resource_idx);
1526
1527 return hr;
1528}
1529
1530static HRESULT WINAPI d3d8_device_SetRenderTarget(IDirect3DDevice8 *iface,
1531 IDirect3DSurface8 *render_target, IDirect3DSurface8 *depth_stencil)
1532{
1534 struct d3d8_surface *rt_impl = unsafe_impl_from_IDirect3DSurface8(render_target);
1536 struct wined3d_rendertarget_view *original_dsv, *rtv;
1537 HRESULT hr = D3D_OK;
1538
1539 TRACE("iface %p, render_target %p, depth_stencil %p.\n", iface, render_target, depth_stencil);
1540
1541 if (rt_impl && d3d8_surface_get_device(rt_impl) != device)
1542 {
1543 WARN("Render target surface does not match device.\n");
1544 return D3DERR_INVALIDCALL;
1545 }
1546
1548
1549 if (ds_impl)
1550 {
1551 struct wined3d_sub_resource_desc ds_desc, rt_desc;
1552 struct wined3d_rendertarget_view *original_rtv;
1553 struct d3d8_surface *original_surface;
1554
1555 /* If no render target is passed in check the size against the current RT */
1556 if (!render_target)
1557 {
1558 if (!(original_rtv = wined3d_device_context_get_rendertarget_view(device->immediate_context, 0)))
1559 {
1561 return D3DERR_NOTFOUND;
1562 }
1563 original_surface = wined3d_rendertarget_view_get_sub_resource_parent(original_rtv);
1565 original_surface->sub_resource_idx, &rt_desc);
1566 }
1567 else
1569 rt_impl->sub_resource_idx, &rt_desc);
1570
1572
1573 if (ds_desc.width < rt_desc.width || ds_desc.height < rt_desc.height)
1574 {
1575 WARN("Depth stencil is smaller than the render target, returning D3DERR_INVALIDCALL\n");
1577 return D3DERR_INVALIDCALL;
1578 }
1579 if (ds_desc.multisample_type != rt_desc.multisample_type
1580 || ds_desc.multisample_quality != rt_desc.multisample_quality)
1581 {
1582 WARN("Multisample settings do not match, returning D3DERR_INVALIDCALL\n");
1584 return D3DERR_INVALIDCALL;
1585 }
1586 }
1587
1588 original_dsv = wined3d_device_context_get_depth_stencil_view(device->immediate_context);
1589 rtv = ds_impl ? d3d8_surface_acquire_rendertarget_view(ds_impl) : NULL;
1590 hr = wined3d_device_context_set_depth_stencil_view(device->immediate_context, rtv);
1592 if (SUCCEEDED(hr))
1593 {
1594 rtv = render_target ? d3d8_surface_acquire_rendertarget_view(rt_impl) : NULL;
1595 if (render_target)
1596 {
1598 0, 1, &rtv, TRUE)))
1600 else
1601 wined3d_device_context_set_depth_stencil_view(device->immediate_context, original_dsv);
1602 }
1605 }
1606
1608
1609 return hr;
1610}
1611
1612static HRESULT WINAPI d3d8_device_GetRenderTarget(IDirect3DDevice8 *iface, IDirect3DSurface8 **render_target)
1613{
1615 struct wined3d_rendertarget_view *wined3d_rtv;
1616 struct d3d8_surface *surface_impl;
1617 HRESULT hr;
1618
1619 TRACE("iface %p, render_target %p.\n", iface, render_target);
1620
1621 if (!render_target)
1622 return D3DERR_INVALIDCALL;
1623
1626 {
1627 /* We want the sub resource parent here, since the view itself may be
1628 * internal to wined3d and may not have a parent. */
1630 *render_target = &surface_impl->IDirect3DSurface8_iface;
1631 IDirect3DSurface8_AddRef(*render_target);
1632 hr = D3D_OK;
1633 }
1634 else
1635 {
1636 ERR("Failed to get wined3d render target.\n");
1637 *render_target = NULL;
1639 }
1641
1642 return hr;
1643}
1644
1645static HRESULT WINAPI d3d8_device_GetDepthStencilSurface(IDirect3DDevice8 *iface, IDirect3DSurface8 **depth_stencil)
1646{
1648 struct wined3d_rendertarget_view *wined3d_dsv;
1649 struct d3d8_surface *surface_impl;
1650 HRESULT hr = D3D_OK;
1651
1652 TRACE("iface %p, depth_stencil %p.\n", iface, depth_stencil);
1653
1654 if (!depth_stencil)
1655 return D3DERR_INVALIDCALL;
1656
1658 if ((wined3d_dsv = wined3d_device_context_get_depth_stencil_view(device->immediate_context)))
1659 {
1660 /* We want the sub resource parent here, since the view itself may be
1661 * internal to wined3d and may not have a parent. */
1662 surface_impl = wined3d_rendertarget_view_get_sub_resource_parent(wined3d_dsv);
1663 *depth_stencil = &surface_impl->IDirect3DSurface8_iface;
1665 }
1666 else
1667 {
1670 }
1672
1673 return hr;
1674}
1675
1676static HRESULT WINAPI d3d8_device_BeginScene(IDirect3DDevice8 *iface)
1677{
1679 HRESULT hr;
1680
1681 TRACE("iface %p.\n", iface);
1682
1684 hr = wined3d_device_begin_scene(device->wined3d_device);
1686
1687 return hr;
1688}
1689
1691{
1693 HRESULT hr;
1694
1695 TRACE("iface %p.\n", iface);
1696
1698 hr = wined3d_device_end_scene(device->wined3d_device);
1700
1701 return hr;
1702}
1703
1704static HRESULT WINAPI d3d8_device_Clear(IDirect3DDevice8 *iface, DWORD rect_count,
1705 const D3DRECT *rects, DWORD flags, D3DCOLOR color, float z, DWORD stencil)
1706{
1707 const struct wined3d_color c =
1708 {
1709 ((color >> 16) & 0xff) / 255.0f,
1710 ((color >> 8) & 0xff) / 255.0f,
1711 (color & 0xff) / 255.0f,
1712 ((color >> 24) & 0xff) / 255.0f,
1713 };
1715 HRESULT hr;
1716
1717 TRACE("iface %p, rect_count %lu, rects %p, flags %#lx, color 0x%08lx, z %.8e, stencil %lu.\n",
1718 iface, rect_count, rects, flags, color, z, stencil);
1719
1720 if (rect_count && !rects)
1721 {
1722 WARN("count %lu with NULL rects.\n", rect_count);
1723 rect_count = 0;
1724 }
1725
1727 wined3d_stateblock_apply_clear_state(device->state, device->wined3d_device);
1728 hr = wined3d_device_clear(device->wined3d_device, rect_count, (const RECT *)rects, flags, &c, z, stencil);
1730
1731 return hr;
1732}
1733
1734static HRESULT WINAPI d3d8_device_SetTransform(IDirect3DDevice8 *iface,
1736{
1738
1739 TRACE("iface %p, state %#x, matrix %p.\n", iface, state, matrix);
1740
1741 /* Note: D3DMATRIX is compatible with struct wined3d_matrix. */
1746
1747 return D3D_OK;
1748}
1749
1750static HRESULT WINAPI d3d8_device_GetTransform(IDirect3DDevice8 *iface,
1752{
1754
1755 TRACE("iface %p, state %#x, matrix %p.\n", iface, state, matrix);
1756
1757 /* Note: D3DMATRIX is compatible with struct wined3d_matrix. */
1759 memcpy(matrix, &device->stateblock_state->transforms[state], sizeof(*matrix));
1761
1762 return D3D_OK;
1763}
1764
1765static HRESULT WINAPI d3d8_device_MultiplyTransform(IDirect3DDevice8 *iface,
1767{
1769
1770 TRACE("iface %p, state %#x, matrix %p.\n", iface, state, matrix);
1771
1772 /* Note: D3DMATRIX is compatible with struct wined3d_matrix. */
1777
1778 return D3D_OK;
1779}
1780
1781static HRESULT WINAPI d3d8_device_SetViewport(IDirect3DDevice8 *iface, const D3DVIEWPORT8 *viewport)
1782{
1784 struct wined3d_sub_resource_desc rt_desc;
1785 struct wined3d_rendertarget_view *rtv;
1786 struct d3d8_surface *surface;
1787 struct wined3d_viewport vp;
1788
1789 TRACE("iface %p, viewport %p.\n", iface, viewport);
1790
1792 if (!(rtv = wined3d_device_context_get_rendertarget_view(device->immediate_context, 0)))
1793 {
1795 return D3DERR_NOTFOUND;
1796 }
1799
1800 if (viewport->X > rt_desc.width || viewport->Width > rt_desc.width - viewport->X
1801 || viewport->Y > rt_desc.height || viewport->Height > rt_desc.height - viewport->Y)
1802 {
1803 WARN("Invalid viewport, returning D3DERR_INVALIDCALL.\n");
1805 return D3DERR_INVALIDCALL;
1806 }
1807
1808 vp.x = viewport->X;
1809 vp.y = viewport->Y;
1810 vp.width = viewport->Width;
1811 vp.height = viewport->Height;
1812 vp.min_z = viewport->MinZ;
1813 vp.max_z = viewport->MaxZ;
1814
1815 wined3d_stateblock_set_viewport(device->update_state, &vp);
1817
1818 return D3D_OK;
1819}
1820
1821static HRESULT WINAPI d3d8_device_GetViewport(IDirect3DDevice8 *iface, D3DVIEWPORT8 *viewport)
1822{
1825
1826 TRACE("iface %p, viewport %p.\n", iface, viewport);
1827
1829 wined3d_viewport = device->stateblock_state->viewport;
1831
1832 viewport->X = wined3d_viewport.x;
1833 viewport->Y = wined3d_viewport.y;
1834 viewport->Width = wined3d_viewport.width;
1835 viewport->Height = wined3d_viewport.height;
1836 viewport->MinZ = wined3d_viewport.min_z;
1837 viewport->MaxZ = wined3d_viewport.max_z;
1838
1839 return D3D_OK;
1840}
1841
1842static HRESULT WINAPI d3d8_device_SetMaterial(IDirect3DDevice8 *iface, const D3DMATERIAL8 *material)
1843{
1845
1846 TRACE("iface %p, material %p.\n", iface, material);
1847
1848 /* Note: D3DMATERIAL8 is compatible with struct wined3d_material. */
1850 wined3d_stateblock_set_material(device->update_state, (const struct wined3d_material *)material);
1852
1853 return D3D_OK;
1854}
1855
1856static HRESULT WINAPI d3d8_device_GetMaterial(IDirect3DDevice8 *iface, D3DMATERIAL8 *material)
1857{
1859
1860 TRACE("iface %p, material %p.\n", iface, material);
1861
1862 /* Note: D3DMATERIAL8 is compatible with struct wined3d_material. */
1864 memcpy(material, &device->stateblock_state->material, sizeof(*material));
1866
1867 return D3D_OK;
1868}
1869
1870static HRESULT WINAPI d3d8_device_SetLight(IDirect3DDevice8 *iface, DWORD index, const D3DLIGHT8 *light)
1871{
1873 HRESULT hr;
1874
1875 TRACE("iface %p, index %lu, light %p.\n", iface, index, light);
1876
1877 /* Note: D3DLIGHT8 is compatible with struct wined3d_light. */
1879 hr = wined3d_stateblock_set_light(device->update_state, index, (const struct wined3d_light *)light);
1881
1882 return hr;
1883}
1884
1886{
1888 BOOL enabled;
1889 HRESULT hr;
1890
1891 TRACE("iface %p, index %lu, light %p.\n", iface, index, light);
1892
1893 /* Note: D3DLIGHT8 is compatible with struct wined3d_light. */
1897
1898 return hr;
1899}
1900
1902{
1904 HRESULT hr;
1905
1906 TRACE("iface %p, index %lu, enable %#x.\n", iface, index, enable);
1907
1911
1912 return hr;
1913}
1914
1916{
1918 struct wined3d_light light;
1919 HRESULT hr;
1920
1921 TRACE("iface %p, index %lu, enabled %p.\n", iface, index, enabled);
1922
1926
1927 return hr;
1928}
1929
1930static HRESULT WINAPI d3d8_device_SetClipPlane(IDirect3DDevice8 *iface, DWORD index, const float *plane)
1931{
1933 HRESULT hr;
1934
1935 TRACE("iface %p, index %lu, plane %p.\n", iface, index, plane);
1936
1938 hr = wined3d_stateblock_set_clip_plane(device->update_state, index, (const struct wined3d_vec4 *)plane);
1940
1941 return hr;
1942}
1943
1944static HRESULT WINAPI d3d8_device_GetClipPlane(IDirect3DDevice8 *iface, DWORD index, float *plane)
1945{
1947
1948 TRACE("iface %p, index %lu, plane %p.\n", iface, index, plane);
1949
1950 if (index >= device->max_user_clip_planes)
1951 {
1952 TRACE("Plane %lu requested, but only %u planes are supported.\n", index, device->max_user_clip_planes);
1954 }
1955
1957 memcpy(plane, &device->stateblock_state->clip_planes[index], sizeof(struct wined3d_vec4));
1959
1960 return D3D_OK;
1961}
1962
1964{
1965 const struct wined3d_stateblock_state *state = device->stateblock_state;
1966 struct wined3d_rendertarget_view *wined3d_dsv;
1967 struct wined3d_resource *dst_resource;
1968 struct wined3d_texture *dst_texture;
1970 struct d3d8_surface *d3d8_dsv;
1971
1972 if (!(dst_texture = state->textures[0]))
1973 return;
1974 dst_resource = wined3d_texture_get_resource(dst_texture);
1975 wined3d_resource_get_desc(dst_resource, &desc);
1977 && desc.format != WINED3DFMT_X8D24_UNORM
1978 && desc.format != WINED3DFMT_DF16
1979 && desc.format != WINED3DFMT_DF24
1980 && desc.format != WINED3DFMT_INTZ)
1981 return;
1982
1983 if (!(wined3d_dsv = wined3d_device_context_get_depth_stencil_view(device->immediate_context)))
1984 return;
1986
1987 wined3d_device_context_resolve_sub_resource(device->immediate_context, dst_resource, 0,
1988 wined3d_rendertarget_view_get_resource(wined3d_dsv), d3d8_dsv->sub_resource_idx, desc.format);
1989}
1990
1991static HRESULT WINAPI d3d8_device_SetRenderState(IDirect3DDevice8 *iface,
1993{
1995
1996 TRACE("iface %p, state %#x, value %#lx.\n", iface, state, value);
1997
2003
2004 return D3D_OK;
2005}
2006
2007static HRESULT WINAPI d3d8_device_GetRenderState(IDirect3DDevice8 *iface,
2009{
2012
2013 TRACE("iface %p, state %#x, value %p.\n", iface, state, value);
2014
2016 device_state = device->stateblock_state;
2017 switch (state)
2018 {
2019 case D3DRS_ZBIAS:
2021 break;
2022
2023 default:
2024 *value = device_state->rs[state];
2025 }
2027
2028 return D3D_OK;
2029}
2030
2031static HRESULT WINAPI d3d8_device_BeginStateBlock(IDirect3DDevice8 *iface)
2032{
2034 struct wined3d_stateblock *stateblock;
2035 HRESULT hr;
2036
2037 TRACE("iface %p.\n", iface);
2038
2040 if (device->recording)
2041 {
2043 WARN("Trying to begin a stateblock while recording, returning D3DERR_INVALIDCALL.\n");
2044 return D3DERR_INVALIDCALL;
2045 }
2046
2047 if (SUCCEEDED(hr = wined3d_stateblock_create(device->wined3d_device, NULL, WINED3D_SBT_RECORDED, &stateblock)))
2048 device->update_state = device->recording = stateblock;
2050
2051 return hr;
2052}
2053
2054static HRESULT WINAPI d3d8_device_EndStateBlock(IDirect3DDevice8 *iface, DWORD *token)
2055{
2057 struct wined3d_stateblock *stateblock;
2058
2059 TRACE("iface %p, token %p.\n", iface, token);
2060
2061 /* Tell wineD3D to endstateblock before anything else (in case we run out
2062 * of memory later and cause locking problems)
2063 */
2065 if (!device->recording)
2066 {
2068 WARN("Trying to end a stateblock, but no stateblock is being recorded.\n");
2069 return D3DERR_INVALIDCALL;
2070 }
2071 stateblock = device->recording;
2073 device->recording = NULL;
2074 device->update_state = device->state;
2075
2076 *token = d3d8_allocate_handle(&device->handle_table, stateblock, D3D8_HANDLE_SB);
2078
2079 if (*token == D3D8_INVALID_HANDLE)
2080 {
2081 ERR("Failed to create a handle\n");
2083 wined3d_stateblock_decref(stateblock);
2085 return E_FAIL;
2086 }
2087 ++*token;
2088
2089 TRACE("Returning %#lx (%p).\n", *token, stateblock);
2090
2091 return D3D_OK;
2092}
2093
2094static HRESULT WINAPI d3d8_device_ApplyStateBlock(IDirect3DDevice8 *iface, DWORD token)
2095{
2097 const struct wined3d_stateblock_state *state;
2099 struct wined3d_stateblock *stateblock;
2100 struct d3d8_indexbuffer *index_buffer;
2102 unsigned int i;
2103
2104 TRACE("iface %p, token %#lx.\n", iface, token);
2105
2106 if (!token)
2107 return D3D_OK;
2108
2110 if (device->recording)
2111 {
2113 WARN("Trying to apply stateblock while recording, returning D3DERR_INVALIDCALL.\n");
2114 return D3DERR_INVALIDCALL;
2115 }
2116 stateblock = d3d8_get_object(&device->handle_table, token - 1, D3D8_HANDLE_SB);
2117 if (!stateblock)
2118 {
2119 WARN("Invalid handle (%#lx) passed.\n", token);
2121 return D3DERR_INVALIDCALL;
2122 }
2123 wined3d_stateblock_apply(stateblock, device->state);
2124 device->sysmem_vb = 0;
2125 state = device->stateblock_state;
2126 for (i = 0; i < D3D8_MAX_STREAMS; ++i)
2127 {
2128 wined3d_buffer = state->streams[i].buffer;
2130 continue;
2131 if (vertex_buffer->draw_buffer)
2132 device->sysmem_vb |= 1u << i;
2133 }
2134 device->sysmem_ib = (wined3d_buffer = state->index_buffer)
2135 && (index_buffer = wined3d_buffer_get_parent(wined3d_buffer)) && index_buffer->sysmem;
2137
2138 return D3D_OK;
2139}
2140
2142{
2144 struct wined3d_stateblock *stateblock;
2145
2146 TRACE("iface %p, token %#lx.\n", iface, token);
2147
2149 if (device->recording)
2150 {
2152 WARN("Trying to capture stateblock while recording, returning D3DERR_INVALIDCALL.\n");
2153 return D3DERR_INVALIDCALL;
2154 }
2155 stateblock = d3d8_get_object(&device->handle_table, token - 1, D3D8_HANDLE_SB);
2156 if (!stateblock)
2157 {
2158 WARN("Invalid handle (%#lx) passed.\n", token);
2160 return D3DERR_INVALIDCALL;
2161 }
2162 wined3d_stateblock_capture(stateblock, device->state);
2164
2165 return D3D_OK;
2166}
2167
2169{
2171 struct wined3d_stateblock *stateblock;
2172
2173 TRACE("iface %p, token %#lx.\n", iface, token);
2174
2176 stateblock = d3d8_free_handle(&device->handle_table, token - 1, D3D8_HANDLE_SB);
2177
2178 if (!stateblock)
2179 {
2180 WARN("Invalid handle (%#lx) passed.\n", token);
2182 return D3DERR_INVALIDCALL;
2183 }
2184
2185 if (wined3d_stateblock_decref(stateblock))
2186 {
2187 ERR("Stateblock %p has references left, this shouldn't happen.\n", stateblock);
2188 }
2190
2191 return D3D_OK;
2192}
2193
2194static HRESULT WINAPI d3d8_device_CreateStateBlock(IDirect3DDevice8 *iface,
2196{
2198 struct wined3d_stateblock *stateblock;
2199 HRESULT hr;
2200
2201 TRACE("iface %p, type %#x, handle %p.\n", iface, type, handle);
2202
2203 if (type != D3DSBT_ALL
2206 {
2207 WARN("Unexpected stateblock type, returning D3DERR_INVALIDCALL\n");
2208 return D3DERR_INVALIDCALL;
2209 }
2210
2212 if (device->recording)
2213 {
2215 WARN("Trying to create a stateblock while recording, returning D3DERR_INVALIDCALL.\n");
2216 return D3DERR_INVALIDCALL;
2217 }
2218 hr = wined3d_stateblock_create(device->wined3d_device, device->state, (enum wined3d_stateblock_type)type, &stateblock);
2219 if (FAILED(hr))
2220 {
2222 ERR("Failed to create the state block, hr %#lx.\n", hr);
2223 return hr;
2224 }
2225
2226 *handle = d3d8_allocate_handle(&device->handle_table, stateblock, D3D8_HANDLE_SB);
2228
2230 {
2231 ERR("Failed to allocate a handle.\n");
2233 wined3d_stateblock_decref(stateblock);
2235 return E_FAIL;
2236 }
2237 ++*handle;
2238
2239 TRACE("Returning %#lx (%p).\n", *handle, stateblock);
2240
2241 return hr;
2242}
2243
2244static HRESULT WINAPI d3d8_device_SetClipStatus(IDirect3DDevice8 *iface, const D3DCLIPSTATUS8 *clip_status)
2245{
2247 HRESULT hr;
2248
2249 TRACE("iface %p, clip_status %p.\n", iface, clip_status);
2250 /* FIXME: Verify that D3DCLIPSTATUS8 ~= struct wined3d_clip_status. */
2251
2253 hr = wined3d_device_set_clip_status(device->wined3d_device, (const struct wined3d_clip_status *)clip_status);
2255
2256 return hr;
2257}
2258
2259static HRESULT WINAPI d3d8_device_GetClipStatus(IDirect3DDevice8 *iface, D3DCLIPSTATUS8 *clip_status)
2260{
2262 HRESULT hr;
2263
2264 TRACE("iface %p, clip_status %p.\n", iface, clip_status);
2265
2267 hr = wined3d_device_get_clip_status(device->wined3d_device, (struct wined3d_clip_status *)clip_status);
2269
2270 return hr;
2271}
2272
2273static HRESULT WINAPI d3d8_device_GetTexture(IDirect3DDevice8 *iface, DWORD stage, IDirect3DBaseTexture8 **texture)
2274{
2277 struct d3d8_texture *texture_impl;
2278
2279 TRACE("iface %p, stage %lu, texture %p.\n", iface, stage, texture);
2280
2281 if (!texture)
2282 return D3DERR_INVALIDCALL;
2283
2284 if (stage >= WINED3D_MAX_FRAGMENT_SAMPLERS)
2285 {
2286 WARN("Ignoring invalid stage %lu.\n", stage);
2287 *texture = NULL;
2288 return D3D_OK;
2289 }
2290
2292 if ((wined3d_texture = device->stateblock_state->textures[stage]))
2293 {
2295 *texture = &texture_impl->IDirect3DBaseTexture8_iface;
2297 }
2298 else
2299 {
2300 *texture = NULL;
2301 }
2303
2304 return D3D_OK;
2305}
2306
2307static HRESULT WINAPI d3d8_device_SetTexture(IDirect3DDevice8 *iface, DWORD stage, IDirect3DBaseTexture8 *texture)
2308{
2310 struct d3d8_texture *texture_impl;
2311
2312 TRACE("iface %p, stage %lu, texture %p.\n", iface, stage, texture);
2313
2315
2317 wined3d_stateblock_set_texture(device->update_state, stage,
2318 texture_impl ? d3d8_texture_get_draw_texture(texture_impl) : NULL);
2320
2321 return D3D_OK;
2322}
2323
2324static const struct tss_lookup
2325{
2327 union
2328 {
2331 } u;
2332}
2333tss_lookup[] =
2334{
2335 {FALSE, .u.texture_state = WINED3D_TSS_INVALID}, /* 0, unused */
2336 {FALSE, .u.texture_state = WINED3D_TSS_COLOR_OP}, /* 1, D3DTSS_COLOROP */
2337 {FALSE, .u.texture_state = WINED3D_TSS_COLOR_ARG1}, /* 2, D3DTSS_COLORARG1 */
2338 {FALSE, .u.texture_state = WINED3D_TSS_COLOR_ARG2}, /* 3, D3DTSS_COLORARG2 */
2339 {FALSE, .u.texture_state = WINED3D_TSS_ALPHA_OP}, /* 4, D3DTSS_ALPHAOP */
2340 {FALSE, .u.texture_state = WINED3D_TSS_ALPHA_ARG1}, /* 5, D3DTSS_ALPHAARG1 */
2341 {FALSE, .u.texture_state = WINED3D_TSS_ALPHA_ARG2}, /* 6, D3DTSS_ALPHAARG2 */
2342 {FALSE, .u.texture_state = WINED3D_TSS_BUMPENV_MAT00}, /* 7, D3DTSS_BUMPENVMAT00 */
2343 {FALSE, .u.texture_state = WINED3D_TSS_BUMPENV_MAT01}, /* 8, D3DTSS_BUMPENVMAT01 */
2344 {FALSE, .u.texture_state = WINED3D_TSS_BUMPENV_MAT10}, /* 9, D3DTSS_BUMPENVMAT10 */
2345 {FALSE, .u.texture_state = WINED3D_TSS_BUMPENV_MAT11}, /* 10, D3DTSS_BUMPENVMAT11 */
2346 {FALSE, .u.texture_state = WINED3D_TSS_TEXCOORD_INDEX}, /* 11, D3DTSS_TEXCOORDINDEX */
2347 {FALSE, .u.texture_state = WINED3D_TSS_INVALID}, /* 12, unused */
2348 {TRUE, .u.sampler_state = WINED3D_SAMP_ADDRESS_U}, /* 13, D3DTSS_ADDRESSU */
2349 {TRUE, .u.sampler_state = WINED3D_SAMP_ADDRESS_V}, /* 14, D3DTSS_ADDRESSV */
2350 {TRUE, .u.sampler_state = WINED3D_SAMP_BORDER_COLOR}, /* 15, D3DTSS_BORDERCOLOR */
2351 {TRUE, .u.sampler_state = WINED3D_SAMP_MAG_FILTER}, /* 16, D3DTSS_MAGFILTER */
2352 {TRUE, .u.sampler_state = WINED3D_SAMP_MIN_FILTER}, /* 17, D3DTSS_MINFILTER */
2353 {TRUE, .u.sampler_state = WINED3D_SAMP_MIP_FILTER}, /* 18, D3DTSS_MIPFILTER */
2354 {TRUE, .u.sampler_state = WINED3D_SAMP_MIPMAP_LOD_BIAS}, /* 19, D3DTSS_MIPMAPLODBIAS */
2355 {TRUE, .u.sampler_state = WINED3D_SAMP_MAX_MIP_LEVEL}, /* 20, D3DTSS_MAXMIPLEVEL */
2356 {TRUE, .u.sampler_state = WINED3D_SAMP_MAX_ANISOTROPY}, /* 21, D3DTSS_MAXANISOTROPY */
2357 {FALSE, .u.texture_state = WINED3D_TSS_BUMPENV_LSCALE}, /* 22, D3DTSS_BUMPENVLSCALE */
2358 {FALSE, .u.texture_state = WINED3D_TSS_BUMPENV_LOFFSET}, /* 23, D3DTSS_BUMPENVLOFFSET */
2359 {FALSE, .u.texture_state = WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS}, /* 24, D3DTSS_TEXTURETRANSFORMFLAGS */
2360 {TRUE, .u.sampler_state = WINED3D_SAMP_ADDRESS_W}, /* 25, D3DTSS_ADDRESSW */
2361 {FALSE, .u.texture_state = WINED3D_TSS_COLOR_ARG0}, /* 26, D3DTSS_COLORARG0 */
2362 {FALSE, .u.texture_state = WINED3D_TSS_ALPHA_ARG0}, /* 27, D3DTSS_ALPHAARG0 */
2363 {FALSE, .u.texture_state = WINED3D_TSS_RESULT_ARG}, /* 28, D3DTSS_RESULTARG */
2365
2366static HRESULT WINAPI d3d8_device_GetTextureStageState(IDirect3DDevice8 *iface,
2368{
2371 const struct tss_lookup *l;
2372
2373 TRACE("iface %p, stage %lu, state %#x, value %p.\n", iface, stage, state, value);
2374
2375 if (state >= ARRAY_SIZE(tss_lookup))
2376 {
2377 WARN("Invalid state %#x.\n", state);
2378 return D3D_OK;
2379 }
2380
2381 l = &tss_lookup[state];
2382
2384 device_state = device->stateblock_state;
2385 if (l->sampler_state)
2386 *value = device_state->sampler_states[stage][l->u.sampler_state];
2387 else
2388 *value = device_state->texture_states[stage][l->u.texture_state];
2390
2391 return D3D_OK;
2392}
2393
2394static HRESULT WINAPI d3d8_device_SetTextureStageState(IDirect3DDevice8 *iface,
2396{
2398 const struct tss_lookup *l;
2399
2400 TRACE("iface %p, stage %lu, state %#x, value %#lx.\n", iface, stage, type, value);
2401
2402 if (type >= ARRAY_SIZE(tss_lookup))
2403 {
2404 WARN("Invalid type %#x passed.\n", type);
2405 return D3D_OK;
2406 }
2407
2408 l = &tss_lookup[type];
2409
2411 if (l->sampler_state)
2412 wined3d_stateblock_set_sampler_state(device->update_state, stage, l->u.sampler_state, value);
2413 else
2414 wined3d_stateblock_set_texture_stage_state(device->update_state, stage, l->u.texture_state, value);
2416
2417 return D3D_OK;
2418}
2419
2420static HRESULT WINAPI d3d8_device_ValidateDevice(IDirect3DDevice8 *iface, DWORD *pass_count)
2421{
2423 HRESULT hr;
2424
2425 TRACE("iface %p, pass_count %p.\n", iface, pass_count);
2426
2428 hr = wined3d_device_validate_device(device->wined3d_device, device->stateblock_state, pass_count);
2430
2431 /* In d3d8, texture filters are not validated, so errors concerning
2432 * unsupported ones are ignored here. */
2434 {
2435 WARN("Ignoring invalid texture filter settings.\n");
2436 *pass_count = 1;
2437 return D3D_OK;
2438 }
2439
2440 return hr;
2441}
2442
2443static HRESULT WINAPI d3d8_device_GetInfo(IDirect3DDevice8 *iface,
2444 DWORD info_id, void *info, DWORD info_size)
2445{
2446 TRACE("iface %p, info_id %#lx, info %p, info_size %lu.\n", iface, info_id, info, info_size);
2447
2448 if (info_id < 4)
2449 return E_FAIL;
2450 return S_FALSE;
2451}
2452
2453static HRESULT WINAPI d3d8_device_SetPaletteEntries(IDirect3DDevice8 *iface,
2454 UINT palette_idx, const PALETTEENTRY *entries)
2455{
2456 WARN("iface %p, palette_idx %u, entries %p unimplemented\n", iface, palette_idx, entries);
2457
2458 /* GPUs stopped supporting palettized textures with the Shader Model 1 generation. Wined3d
2459 * does not have a d3d8/9-style palette API */
2460
2461 return D3D_OK;
2462}
2463
2464static HRESULT WINAPI d3d8_device_GetPaletteEntries(IDirect3DDevice8 *iface,
2465 UINT palette_idx, PALETTEENTRY *entries)
2466{
2467 FIXME("iface %p, palette_idx %u, entries %p unimplemented.\n", iface, palette_idx, entries);
2468
2469 return D3DERR_INVALIDCALL;
2470}
2471
2472static HRESULT WINAPI d3d8_device_SetCurrentTexturePalette(IDirect3DDevice8 *iface, UINT palette_idx)
2473{
2474 WARN("iface %p, palette_idx %u unimplemented.\n", iface, palette_idx);
2475
2476 return D3D_OK;
2477}
2478
2479static HRESULT WINAPI d3d8_device_GetCurrentTexturePalette(IDirect3DDevice8 *iface, UINT *palette_idx)
2480{
2481 FIXME("iface %p, palette_idx %p unimplemented.\n", iface, palette_idx);
2482
2483 return D3DERR_INVALIDCALL;
2484}
2485
2487 unsigned int start_vertex, unsigned int vertex_count)
2488{
2489 const struct wined3d_stateblock_state *state = device->stateblock_state;
2490 struct wined3d_vertex_declaration *wined3d_decl;
2491 struct wined3d_box box = {0, 0, 0, 1, 0, 1};
2492 const struct wined3d_stream_state *stream;
2493 struct d3d8_vertexbuffer *d3d8_buffer;
2494 struct wined3d_resource *dst_resource;
2495 struct d3d8_vertex_declaration *decl;
2496 struct wined3d_buffer *dst_buffer;
2498 unsigned int stride, map;
2499 HRESULT hr;
2500
2501 if (!device->sysmem_vb)
2502 return;
2503
2504 if (!(wined3d_decl = state->vertex_declaration))
2505 return;
2506
2507 decl = wined3d_vertex_declaration_get_parent(wined3d_decl);
2508 map = decl->stream_map & device->sysmem_vb;
2509 while (map)
2510 {
2511 stream = &state->streams[wined3d_bit_scan(&map)];
2512 dst_buffer = stream->buffer;
2513 stride = stream->stride;
2514
2515 d3d8_buffer = wined3d_buffer_get_parent(dst_buffer);
2516 dst_resource = wined3d_buffer_get_resource(dst_buffer);
2517 wined3d_resource_get_desc(dst_resource, &desc);
2518 box.left = stream->offset + start_vertex * stride;
2519 box.right = min(box.left + vertex_count * stride, desc.size);
2521 dst_resource, 0, box.left, 0, 0,
2522 wined3d_buffer_get_resource(d3d8_buffer->wined3d_buffer), 0, &box, 0)))
2523 ERR("Failed to update buffer.\n");
2524 }
2525}
2526
2528 unsigned int *start_idx, unsigned int idx_count)
2529{
2530 const struct wined3d_stateblock_state *state = device->stateblock_state;
2531 unsigned int src_offset, idx_size, buffer_size, pos;
2532 struct wined3d_resource_desc resource_desc;
2533 struct wined3d_resource *index_buffer;
2534 struct wined3d_map_desc map_desc;
2535 struct wined3d_box box;
2536 HRESULT hr;
2537
2538 if (!device->sysmem_ib)
2539 return S_OK;
2540
2541 index_buffer = wined3d_buffer_get_resource(state->index_buffer);
2542 wined3d_resource_get_desc(index_buffer, &resource_desc);
2543 idx_size = (state->index_format == WINED3DFMT_R16_UINT) ? 2 : 4;
2544
2545 src_offset = (*start_idx) * idx_size;
2546 buffer_size = min(idx_count * idx_size, resource_desc.size - src_offset);
2547
2548 wined3d_box_set(&box, src_offset, 0, buffer_size, 1, 0, 1);
2549 if (FAILED(hr = wined3d_resource_map(index_buffer, 0, &map_desc, &box, WINED3D_MAP_READ)))
2550 {
2551 ERR("Failed to map index buffer, hr %#lx.\n", hr);
2552 return hr;
2553 }
2554 wined3d_streaming_buffer_upload(device->wined3d_device, &device->index_buffer,
2555 map_desc.data, buffer_size, idx_size, &pos);
2556 wined3d_resource_unmap(index_buffer, 0);
2557
2559 device->index_buffer.buffer, state->index_format, pos);
2560 *start_idx = 0;
2561 return S_OK;
2562}
2563
2565{
2566 const struct wined3d_stateblock_state *state = device->stateblock_state;
2567 unsigned int i;
2568
2569 for (i = 0; i < WINED3D_MAX_FRAGMENT_SAMPLERS; ++i)
2570 {
2571 struct wined3d_texture *wined3d_texture = state->textures[i];
2572 struct d3d8_texture *d3d8_texture;
2573
2574 if (!wined3d_texture)
2575 continue;
2578 wined3d_device_update_texture(device->wined3d_device,
2580 }
2581}
2582
2583static HRESULT WINAPI d3d8_device_DrawPrimitive(IDirect3DDevice8 *iface,
2584 D3DPRIMITIVETYPE primitive_type, UINT start_vertex, UINT primitive_count)
2585{
2587 struct d3d8_vertexbuffer *vb;
2588 unsigned int vertex_count, i;
2589
2590 TRACE("iface %p, primitive_type %#x, start_vertex %u, primitive_count %u.\n",
2591 iface, primitive_type, start_vertex, primitive_count);
2592
2593 vertex_count = vertex_count_from_primitive_count(primitive_type, primitive_count);
2598 wined3d_primitive_type_from_d3d(primitive_type), 0);
2599 wined3d_device_apply_stateblock(device->wined3d_device, device->state);
2600 wined3d_device_context_draw(device->immediate_context, start_vertex, vertex_count, 0, 0);
2601
2602 for (i = 0; i < ARRAY_SIZE(device->stateblock_state->streams); ++i)
2603 {
2604 if (device->stateblock_state->streams[i].buffer)
2605 {
2606 vb = wined3d_buffer_get_parent(device->stateblock_state->streams[i].buffer);
2607 vb->discarded = false;
2608 }
2609 }
2610
2612
2613 return D3D_OK;
2614}
2615
2616static HRESULT WINAPI d3d8_device_DrawIndexedPrimitive(IDirect3DDevice8 *iface,
2617 D3DPRIMITIVETYPE primitive_type, UINT min_vertex_idx, UINT vertex_count,
2618 UINT start_idx, UINT primitive_count)
2619{
2621 struct d3d8_vertexbuffer *vb;
2622 struct d3d8_indexbuffer *ib;
2623 unsigned int index_count, i;
2624 int base_vertex_index;
2625 HRESULT hr;
2626
2627 TRACE("iface %p, primitive_type %#x, min_vertex_idx %u, vertex_count %u, start_idx %u, primitive_count %u.\n",
2628 iface, primitive_type, min_vertex_idx, vertex_count, start_idx, primitive_count);
2629
2630 index_count = vertex_count_from_primitive_count(primitive_type, primitive_count);
2632 if (!device->stateblock_state->index_buffer)
2633 {
2635 WARN("Index buffer not set, returning D3D_OK.\n");
2636 return D3D_OK;
2637 }
2638 base_vertex_index = device->stateblock_state->base_vertex_index;
2640 d3d8_device_upload_sysmem_vertex_buffers(device, base_vertex_index + min_vertex_idx, vertex_count);
2642 wined3d_primitive_type_from_d3d(primitive_type), 0);
2643 wined3d_device_apply_stateblock(device->wined3d_device, device->state);
2644 if (FAILED(hr = d3d8_device_upload_sysmem_index_buffer(device, &start_idx, index_count)))
2645 {
2647 return hr;
2648 }
2649 wined3d_device_context_draw_indexed(device->immediate_context, base_vertex_index, start_idx, index_count, 0, 0);
2650
2651 ib = wined3d_buffer_get_parent(device->stateblock_state->index_buffer);
2652 ib->discarded = false;
2653 for (i = 0; i < ARRAY_SIZE(device->stateblock_state->streams); ++i)
2654 {
2655 if (device->stateblock_state->streams[i].buffer)
2656 {
2657 vb = wined3d_buffer_get_parent(device->stateblock_state->streams[i].buffer);
2658 vb->discarded = false;
2659 }
2660 }
2661
2663
2664 return D3D_OK;
2665}
2666
2667static HRESULT WINAPI d3d8_device_DrawPrimitiveUP(IDirect3DDevice8 *iface,
2668 D3DPRIMITIVETYPE primitive_type, UINT primitive_count, const void *data,
2669 UINT stride)
2670{
2672 UINT vtx_count = vertex_count_from_primitive_count(primitive_type, primitive_count);
2673 UINT size = vtx_count * stride;
2674 unsigned int vb_pos;
2675 HRESULT hr;
2676
2677 TRACE("iface %p, primitive_type %#x, primitive_count %u, data %p, stride %u.\n",
2678 iface, primitive_type, primitive_count, data, stride);
2679
2680 if (!primitive_count || !stride)
2681 {
2682 WARN("primitive_count or stride is 0, returning D3D_OK.\n");
2683 return D3D_OK;
2684 }
2685
2687
2688 if (FAILED(hr = wined3d_streaming_buffer_upload(device->wined3d_device,
2689 &device->vertex_buffer, data, size, stride, &vb_pos)))
2690 goto done;
2691
2692 hr = wined3d_stateblock_set_stream_source(device->state, 0, device->vertex_buffer.buffer, 0, stride);
2693 if (FAILED(hr))
2694 goto done;
2695
2698 wined3d_primitive_type_from_d3d(primitive_type), 0);
2699 wined3d_device_apply_stateblock(device->wined3d_device, device->state);
2700 wined3d_device_context_draw(device->immediate_context, vb_pos / stride, vtx_count, 0, 0);
2702
2703done:
2705 return hr;
2706}
2707
2709 D3DPRIMITIVETYPE primitive_type, UINT min_vertex_idx, UINT vertex_count,
2710 UINT primitive_count, const void *index_data, D3DFORMAT index_format,
2711 const void *vertex_data, UINT vertex_stride)
2712{
2713 UINT idx_count = vertex_count_from_primitive_count(primitive_type, primitive_count);
2715 UINT idx_fmt_size = index_format == D3DFMT_INDEX16 ? 2 : 4;
2716 unsigned int base_vertex_idx, vb_pos, ib_pos;
2717 UINT vtx_size = vertex_count * vertex_stride;
2718 UINT idx_size = idx_count * idx_fmt_size;
2719 HRESULT hr;
2720
2721 TRACE("iface %p, primitive_type %#x, min_vertex_idx %u, vertex_count %u, primitive_count %u, "
2722 "index_data %p, index_format %#x, vertex_data %p, vertex_stride %u.\n",
2723 iface, primitive_type, min_vertex_idx, vertex_count, primitive_count,
2724 index_data, index_format, vertex_data, vertex_stride);
2725
2726 if (!primitive_count || !vertex_stride)
2727 {
2728 WARN("primitive_count or vertex_stride is 0, returning D3D_OK.\n");
2729 return D3D_OK;
2730 }
2731
2733
2734 if (FAILED(hr = wined3d_streaming_buffer_upload(device->wined3d_device, &device->vertex_buffer,
2735 (char *)vertex_data + min_vertex_idx * vertex_stride, vtx_size, vertex_stride, &vb_pos)))
2736 goto done;
2737
2738 if (FAILED(hr = wined3d_streaming_buffer_upload(device->wined3d_device, &device->index_buffer,
2739 index_data, idx_size, idx_fmt_size, &ib_pos)))
2740 goto done;
2741
2742 hr = wined3d_stateblock_set_stream_source(device->state, 0, device->vertex_buffer.buffer, 0, vertex_stride);
2743 if (FAILED(hr))
2744 goto done;
2745
2746 wined3d_stateblock_set_index_buffer(device->state, device->index_buffer.buffer,
2747 wined3dformat_from_d3dformat(index_format));
2748 base_vertex_idx = vb_pos / vertex_stride - min_vertex_idx;
2749 wined3d_stateblock_set_base_vertex_index(device->state, base_vertex_idx);
2750
2753 wined3d_primitive_type_from_d3d(primitive_type), 0);
2754 wined3d_device_apply_stateblock(device->wined3d_device, device->state);
2756 base_vertex_idx, ib_pos / idx_fmt_size, idx_count, 0, 0);
2757
2761
2762done:
2764 return hr;
2765}
2766
2767static HRESULT WINAPI d3d8_device_ProcessVertices(IDirect3DDevice8 *iface, UINT src_start_idx,
2768 UINT dst_idx, UINT vertex_count, IDirect3DVertexBuffer8 *dst_buffer, DWORD flags)
2769{
2772 const struct wined3d_stateblock_state *state;
2773 const struct wined3d_stream_state *stream;
2774 struct d3d8_vertexbuffer *d3d8_buffer;
2775 unsigned int i, map;
2776 HRESULT hr;
2777
2778 TRACE("iface %p, src_start_idx %u, dst_idx %u, vertex_count %u, dst_buffer %p, flags %#lx.\n",
2779 iface, src_start_idx, dst_idx, vertex_count, dst_buffer, flags);
2780
2782
2783 state = device->stateblock_state;
2784
2785 /* Note that an alternative approach would be to simply create these
2786 * buffers with WINED3D_RESOURCE_ACCESS_MAP_R and update them here like we
2787 * do for draws. In some regards that would be easier, but it seems less
2788 * than optimal to upload data to the GPU only to subsequently download it
2789 * again. */
2790 map = device->sysmem_vb;
2791 while (map)
2792 {
2794 stream = &state->streams[i];
2795
2796 d3d8_buffer = wined3d_buffer_get_parent(stream->buffer);
2798 i, d3d8_buffer->wined3d_buffer, stream->offset, stream->stride)))
2799 ERR("Failed to set stream source.\n");
2800 }
2801
2802 hr = wined3d_device_process_vertices(device->wined3d_device, device->state, src_start_idx, dst_idx,
2803 vertex_count, dst->wined3d_buffer, NULL, flags, dst->fvf);
2804
2805 map = device->sysmem_vb;
2806 while (map)
2807 {
2809 stream = &state->streams[i];
2810
2811 d3d8_buffer = wined3d_buffer_get_parent(stream->buffer);
2813 i, d3d8_buffer->draw_buffer, stream->offset, stream->stride)))
2814 ERR("Failed to set stream source.\n");
2815 }
2816
2818
2819 return hr;
2820}
2821
2822static HRESULT WINAPI d3d8_device_CreateVertexShader(IDirect3DDevice8 *iface,
2823 const DWORD *declaration, const DWORD *byte_code, DWORD *shader, DWORD usage)
2824{
2826 struct d3d8_vertex_shader *object;
2827 DWORD shader_handle;
2828 DWORD handle;
2829 HRESULT hr;
2830
2831 TRACE("iface %p, declaration %p, byte_code %p, shader %p, usage %#lx.\n",
2832 iface, declaration, byte_code, shader, usage);
2833
2834 if (!(object = calloc(1, sizeof(*object))))
2835 {
2836 *shader = 0;
2837 return E_OUTOFMEMORY;
2838 }
2839
2841 handle = d3d8_allocate_handle(&device->handle_table, object, D3D8_HANDLE_VS);
2844 {
2845 ERR("Failed to allocate vertex shader handle.\n");
2846 free(object);
2847 *shader = 0;
2848 return E_OUTOFMEMORY;
2849 }
2850
2851 shader_handle = handle + VS_HIGHESTFIXEDFXF + 1;
2852
2853 hr = d3d8_vertex_shader_init(object, device, declaration, byte_code, shader_handle, usage);
2854 if (FAILED(hr))
2855 {
2856 WARN("Failed to initialize vertex shader, hr %#lx.\n", hr);
2858 d3d8_free_handle(&device->handle_table, handle, D3D8_HANDLE_VS);
2860 free(object);
2861 *shader = 0;
2862 return hr;
2863 }
2864
2865 TRACE("Created vertex shader %p (handle %#lx).\n", object, shader_handle);
2866 *shader = shader_handle;
2867
2868 return D3D_OK;
2869}
2870
2872{
2873 struct d3d8_vertex_declaration *d3d8_declaration;
2874 struct FvfToDecl *convertedDecls = device->decls;
2875 int p, low, high; /* deliberately signed */
2876 HRESULT hr;
2877
2878 TRACE("Searching for declaration for fvf %#lx... ", fvf);
2879
2880 low = 0;
2881 high = device->numConvertedDecls - 1;
2882 while (low <= high)
2883 {
2884 p = (low + high) >> 1;
2885 TRACE("%d ", p);
2886
2887 if (convertedDecls[p].fvf == fvf)
2888 {
2889 TRACE("found %p\n", convertedDecls[p].declaration);
2890 return convertedDecls[p].declaration;
2891 }
2892
2893 if (convertedDecls[p].fvf < fvf)
2894 low = p + 1;
2895 else
2896 high = p - 1;
2897 }
2898 TRACE("not found. Creating and inserting at position %d.\n", low);
2899
2900 if (!(d3d8_declaration = malloc(sizeof(*d3d8_declaration))))
2901 return NULL;
2902
2903 if (FAILED(hr = d3d8_vertex_declaration_init_fvf(d3d8_declaration, device, fvf)))
2904 {
2905 WARN("Failed to initialize vertex declaration, hr %#lx.\n", hr);
2906 free(d3d8_declaration);
2907 return NULL;
2908 }
2909
2910 if (device->declArraySize == device->numConvertedDecls)
2911 {
2912 UINT grow = device->declArraySize / 2;
2913
2914 if (!(convertedDecls = realloc(convertedDecls,
2915 sizeof(*convertedDecls) * (device->numConvertedDecls + grow))))
2916 {
2917 d3d8_vertex_declaration_destroy(d3d8_declaration);
2918 return NULL;
2919 }
2920 device->decls = convertedDecls;
2921 device->declArraySize += grow;
2922 }
2923
2924 memmove(convertedDecls + low + 1, convertedDecls + low,
2925 sizeof(*convertedDecls) * (device->numConvertedDecls - low));
2926 convertedDecls[low].declaration = d3d8_declaration;
2927 convertedDecls[low].fvf = fvf;
2928 ++device->numConvertedDecls;
2929
2930 TRACE("Returning %p. %u decls in array.\n", d3d8_declaration, device->numConvertedDecls);
2931
2932 return d3d8_declaration;
2933}
2934
2936{
2938 struct d3d8_vertex_shader *shader_impl;
2939
2940 TRACE("iface %p, shader %#lx.\n", iface, shader);
2941
2943 {
2944 TRACE("Setting FVF, %#lx\n", shader);
2945
2951
2952 return D3D_OK;
2953 }
2954
2955 TRACE("Setting shader\n");
2956
2958 if (!(shader_impl = d3d8_get_object(&device->handle_table, shader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_VS)))
2959 {
2960 WARN("Invalid handle (%#lx) passed.\n", shader);
2962
2963 return D3DERR_INVALIDCALL;
2964 }
2965
2967 shader_impl->vertex_declaration->wined3d_vertex_declaration);
2968 wined3d_stateblock_set_vertex_shader(device->update_state, shader_impl->wined3d_shader);
2970
2971 return D3D_OK;
2972}
2973
2974static HRESULT WINAPI d3d8_device_GetVertexShader(IDirect3DDevice8 *iface, DWORD *shader)
2975{
2977 struct wined3d_vertex_declaration *wined3d_declaration;
2978 struct d3d8_vertex_declaration *d3d8_declaration;
2979
2980 TRACE("iface %p, shader %p.\n", iface, shader);
2981
2983 if ((wined3d_declaration = device->stateblock_state->vertex_declaration))
2984 {
2985 d3d8_declaration = wined3d_vertex_declaration_get_parent(wined3d_declaration);
2986 *shader = d3d8_declaration->shader_handle;
2987 }
2988 else
2989 {
2990 *shader = 0;
2991 }
2993
2994 TRACE("Returning %#lx.\n", *shader);
2995
2996 return D3D_OK;
2997}
2998
3000{
3002 struct d3d8_vertex_shader *shader_impl;
3003
3004 TRACE("iface %p, shader %#lx.\n", iface, shader);
3005
3007 if (!(shader_impl = d3d8_free_handle(&device->handle_table, shader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_VS)))
3008 {
3009 WARN("Invalid handle (%#lx) passed.\n", shader);
3011
3012 return D3DERR_INVALIDCALL;
3013 }
3014
3015 if (shader_impl->wined3d_shader
3016 && device->stateblock_state->vs == shader_impl->wined3d_shader)
3018
3020
3021 d3d8_vertex_shader_destroy(shader_impl);
3022
3023 return D3D_OK;
3024}
3025
3027 DWORD start_register, const void *data, DWORD count)
3028{
3030 HRESULT hr;
3031
3032 TRACE("iface %p, start_register %lu, data %p, count %lu.\n",
3033 iface, start_register, data, count);
3034
3035 if (start_register + count > D3D8_MAX_VERTEX_SHADER_CONSTANTF)
3036 {
3037 WARN("Trying to access %lu constants, but d3d8 only supports %u.\n",
3038 start_register + count, D3D8_MAX_VERTEX_SHADER_CONSTANTF);
3039 return D3DERR_INVALIDCALL;
3040 }
3041
3043 hr = wined3d_stateblock_set_vs_consts_f(device->update_state, start_register, count, data);
3045
3046 return hr;
3047}
3048
3050 DWORD start_idx, void *constants, DWORD count)
3051{
3053 HRESULT hr;
3054
3055 TRACE("iface %p, start_idx %lu, constants %p, count %lu.\n", iface, start_idx, constants, count);
3056
3060
3061 return hr;
3062}
3063
3065 DWORD shader, void *data, DWORD *data_size)
3066{
3069 struct d3d8_vertex_shader *shader_impl;
3070
3071 TRACE("iface %p, shader %#lx, data %p, data_size %p.\n", iface, shader, data, data_size);
3072
3074 shader_impl = d3d8_get_object(&device->handle_table, shader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_VS);
3076
3077 if (!shader_impl)
3078 {
3079 WARN("Invalid handle (%#lx) passed.\n", shader);
3080 return D3DERR_INVALIDCALL;
3081 }
3082 declaration = shader_impl->vertex_declaration;
3083
3084 if (!data)
3085 {
3086 *data_size = declaration->elements_size;
3087 return D3D_OK;
3088 }
3089
3090 /* MSDN claims that if *data_size is smaller than the required size
3091 * we should write the required size and return D3DERR_MOREDATA.
3092 * That's not actually true. */
3093 if (*data_size < declaration->elements_size)
3094 return D3DERR_INVALIDCALL;
3095
3096 memcpy(data, declaration->elements, declaration->elements_size);
3097
3098 return D3D_OK;
3099}
3100
3102 DWORD shader, void *data, DWORD *data_size)
3103{
3105 struct d3d8_vertex_shader *shader_impl = NULL;
3106 HRESULT hr;
3107
3108 TRACE("iface %p, shader %#lx, data %p, data_size %p.\n", iface, shader, data, data_size);
3109
3111 if (!(shader_impl = d3d8_get_object(&device->handle_table, shader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_VS)))
3112 {
3113 WARN("Invalid handle (%#lx) passed.\n", shader);
3115
3116 return D3DERR_INVALIDCALL;
3117 }
3118
3119 if (!shader_impl->wined3d_shader)
3120 {
3122 *data_size = 0;
3123 return D3D_OK;
3124 }
3125
3126 hr = wined3d_shader_get_byte_code(shader_impl->wined3d_shader, data, (unsigned int *)data_size);
3128
3129 return hr;
3130}
3131
3132static HRESULT WINAPI d3d8_device_SetIndices(IDirect3DDevice8 *iface,
3133 IDirect3DIndexBuffer8 *buffer, UINT base_vertex_idx)
3134{
3138
3139 TRACE("iface %p, buffer %p, base_vertex_idx %u.\n", iface, buffer, base_vertex_idx);
3140
3141 if (!ib)
3143 else
3145
3146 /* WineD3D takes an INT(due to d3d9), but d3d8 uses UINTs. Do I have to add a check here that
3147 * the UINT doesn't cause an overflow in the INT? It seems rather unlikely because such large
3148 * vertex buffers can't be created to address them with an index that requires the 32nd bit
3149 * (4 Byte minimum vertex size * 2^31-1 -> 8 gb buffer. The index sign would be the least
3150 * problem)
3151 */
3153 wined3d_stateblock_set_base_vertex_index(device->update_state, base_vertex_idx);
3155 if (!device->recording)
3156 device->sysmem_ib = ib && ib->sysmem;
3158
3159 return D3D_OK;
3160}
3161
3162static HRESULT WINAPI d3d8_device_GetIndices(IDirect3DDevice8 *iface,
3163 IDirect3DIndexBuffer8 **buffer, UINT *base_vertex_index)
3164{
3166 const struct wined3d_stateblock_state *state;
3168 struct d3d8_indexbuffer *buffer_impl;
3169
3170 TRACE("iface %p, buffer %p, base_vertex_index %p.\n", iface, buffer, base_vertex_index);
3171
3172 if (!buffer)
3173 return D3DERR_INVALIDCALL;
3174
3175 /* The case from UINT to INT is safe because d3d8 will never set negative values */
3177 state = device->stateblock_state;
3178 *base_vertex_index = state->base_vertex_index;
3179 if ((wined3d_buffer = state->index_buffer))
3180 {
3182 *buffer = &buffer_impl->IDirect3DIndexBuffer8_iface;
3184 }
3185 else
3186 {
3187 *buffer = NULL;
3188 }
3190
3191 return D3D_OK;
3192}
3193
3194static HRESULT WINAPI d3d8_device_CreatePixelShader(IDirect3DDevice8 *iface,
3195 const DWORD *byte_code, DWORD *shader)
3196{
3198 struct d3d8_pixel_shader *object;
3199 DWORD shader_handle;
3200 DWORD handle;
3201 HRESULT hr;
3202
3203 TRACE("iface %p, byte_code %p, shader %p.\n", iface, byte_code, shader);
3204
3205 if (!shader)
3206 return D3DERR_INVALIDCALL;
3207
3208 if (!(object = calloc(1, sizeof(*object))))
3209 return E_OUTOFMEMORY;
3210
3212 handle = d3d8_allocate_handle(&device->handle_table, object, D3D8_HANDLE_PS);
3215 {
3216 ERR("Failed to allocate pixel shader handle.\n");
3217 free(object);
3218 return E_OUTOFMEMORY;
3219 }
3220
3221 shader_handle = handle + VS_HIGHESTFIXEDFXF + 1;
3222
3223 hr = d3d8_pixel_shader_init(object, device, byte_code, shader_handle);
3224 if (FAILED(hr))
3225 {
3226 WARN("Failed to initialize pixel shader, hr %#lx.\n", hr);
3228 d3d8_free_handle(&device->handle_table, handle, D3D8_HANDLE_PS);
3230 free(object);
3231 *shader = 0;
3232 return hr;
3233 }
3234
3235 TRACE("Created pixel shader %p (handle %#lx).\n", object, shader_handle);
3236 *shader = shader_handle;
3237
3238 return D3D_OK;
3239}
3240
3241static HRESULT WINAPI d3d8_device_SetPixelShader(IDirect3DDevice8 *iface, DWORD shader)
3242{
3244 struct d3d8_pixel_shader *shader_impl;
3245
3246 TRACE("iface %p, shader %#lx.\n", iface, shader);
3247
3249
3250 if (!shader)
3251 {
3254 return D3D_OK;
3255 }
3256
3257 if (!(shader_impl = d3d8_get_object(&device->handle_table, shader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_PS)))
3258 {
3259 WARN("Invalid handle (%#lx) passed.\n", shader);
3261 return D3DERR_INVALIDCALL;
3262 }
3263
3264 TRACE("Setting shader %p.\n", shader_impl);
3265 wined3d_stateblock_set_pixel_shader(device->update_state, shader_impl->wined3d_shader);
3267
3268 return D3D_OK;
3269}
3270
3271static HRESULT WINAPI d3d8_device_GetPixelShader(IDirect3DDevice8 *iface, DWORD *shader)
3272{
3274 struct wined3d_shader *object;
3275
3276 TRACE("iface %p, shader %p.\n", iface, shader);
3277
3278 if (!shader)
3279 return D3DERR_INVALIDCALL;
3280
3282 if ((object = device->stateblock_state->ps))
3283 {
3284 struct d3d8_pixel_shader *d3d8_shader;
3285 d3d8_shader = wined3d_shader_get_parent(object);
3286 *shader = d3d8_shader->handle;
3287 }
3288 else
3289 {
3290 *shader = 0;
3291 }
3293
3294 TRACE("Returning %#lx.\n", *shader);
3295
3296 return D3D_OK;
3297}
3298
3300{
3302 struct d3d8_pixel_shader *shader_impl;
3303
3304 TRACE("iface %p, shader %#lx.\n", iface, shader);
3305
3307
3308 if (!(shader_impl = d3d8_free_handle(&device->handle_table, shader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_PS)))
3309 {
3310 WARN("Invalid handle (%#lx) passed.\n", shader);
3312 return D3DERR_INVALIDCALL;
3313 }
3314
3315 if (device->stateblock_state->ps == shader_impl->wined3d_shader)
3317
3319
3320 d3d8_pixel_shader_destroy(shader_impl);
3321
3322 return D3D_OK;
3323}
3324
3326 DWORD start_register, const void *data, DWORD count)
3327{
3329 HRESULT hr;
3330
3331 TRACE("iface %p, start_register %lu, data %p, count %lu.\n", iface, start_register, data, count);
3332
3334 hr = wined3d_stateblock_set_ps_consts_f(device->update_state, start_register, count, data);
3336
3337 return hr;
3338}
3339
3341 DWORD start_idx, void *constants, DWORD count)
3342{
3344 HRESULT hr;
3345
3346 TRACE("iface %p, start_idx %lu, constants %p, count %lu.\n", iface, start_idx, constants, count);
3347
3350
3354
3355 return hr;
3356}
3357
3359 DWORD shader, void *data, DWORD *data_size)
3360{
3362 struct d3d8_pixel_shader *shader_impl = NULL;
3363 HRESULT hr;
3364
3365 TRACE("iface %p, shader %#lx, data %p, data_size %p.\n", iface, shader, data, data_size);
3366
3368 if (!(shader_impl = d3d8_get_object(&device->handle_table, shader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_PS)))
3369 {
3370 WARN("Invalid handle (%#lx) passed.\n", shader);
3372
3373 return D3DERR_INVALIDCALL;
3374 }
3375
3376 hr = wined3d_shader_get_byte_code(shader_impl->wined3d_shader, data, (unsigned int *)data_size);
3378
3379 return hr;
3380}
3381
3382static HRESULT WINAPI d3d8_device_DrawRectPatch(IDirect3DDevice8 *iface, UINT handle,
3383 const float *segment_count, const D3DRECTPATCH_INFO *patch_info)
3384{
3385 FIXME("iface %p, handle %#x, segment_count %p, patch_info %p unimplemented.\n",
3386 iface, handle, segment_count, patch_info);
3387 return D3D_OK;
3388}
3389
3390static HRESULT WINAPI d3d8_device_DrawTriPatch(IDirect3DDevice8 *iface, UINT handle,
3391 const float *segment_count, const D3DTRIPATCH_INFO *patch_info)
3392{
3393 FIXME("iface %p, handle %#x, segment_count %p, patch_info %p unimplemented.\n",
3394 iface, handle, segment_count, patch_info);
3395 return D3D_OK;
3396}
3397
3398static HRESULT WINAPI d3d8_device_DeletePatch(IDirect3DDevice8 *iface, UINT handle)
3399{
3400 FIXME("iface %p, handle %#x unimplemented.\n", iface, handle);
3401 return D3DERR_INVALIDCALL;
3402}
3403
3404static HRESULT WINAPI d3d8_device_SetStreamSource(IDirect3DDevice8 *iface,
3405 UINT stream_idx, IDirect3DVertexBuffer8 *buffer, UINT stride)
3406{
3409 const struct wined3d_stateblock_state *state;
3411 HRESULT hr;
3412
3413 TRACE("iface %p, stream_idx %u, buffer %p, stride %u.\n",
3414 iface, stream_idx, buffer, stride);
3415
3416 if (stream_idx >= ARRAY_SIZE(state->streams))
3417 {
3418 WARN("Stream index %u out of range.\n", stream_idx);
3419 return D3DERR_INVALIDCALL;
3420 }
3421
3423
3424 if (!buffer_impl)
3425 {
3427 state = device->stateblock_state;
3428 stride = state->streams[stream_idx].stride;
3429 }
3430 else if (buffer_impl->draw_buffer)
3431 wined3d_buffer = buffer_impl->draw_buffer;
3432 else
3433 wined3d_buffer = buffer_impl->wined3d_buffer;
3434
3435 hr = wined3d_stateblock_set_stream_source(device->update_state, stream_idx, wined3d_buffer, 0, stride);
3436 if (SUCCEEDED(hr) && !device->recording)
3437 {
3438 if (buffer_impl && buffer_impl->draw_buffer)
3439 device->sysmem_vb |= (1u << stream_idx);
3440 else
3441 device->sysmem_vb &= ~(1u << stream_idx);
3442 }
3443
3445
3446 return hr;
3447}
3448
3449static HRESULT WINAPI d3d8_device_GetStreamSource(IDirect3DDevice8 *iface,
3450 UINT stream_idx, IDirect3DVertexBuffer8 **buffer, UINT *stride)
3451{
3453 const struct wined3d_stateblock_state *state;
3454 const struct wined3d_stream_state *stream;
3455 struct d3d8_vertexbuffer *buffer_impl;
3456
3457 TRACE("iface %p, stream_idx %u, buffer %p, stride %p.\n",
3458 iface, stream_idx, buffer, stride);
3459
3460 if (!buffer)
3461 return D3DERR_INVALIDCALL;
3462
3463 if (stream_idx >= ARRAY_SIZE(state->streams))
3464 {
3465 WARN("Stream index %u out of range.\n", stream_idx);
3466 return D3DERR_INVALIDCALL;
3467 }
3468
3470 state = device->stateblock_state;
3471 stream = &state->streams[stream_idx];
3472 if (stream->buffer)
3473 {
3474 buffer_impl = wined3d_buffer_get_parent(stream->buffer);
3475 *buffer = &buffer_impl->IDirect3DVertexBuffer8_iface;
3477 }
3478 else
3479 *buffer = NULL;
3480 *stride = stream->stride;
3482
3483 return D3D_OK;
3484}
3485
3486static const struct IDirect3DDevice8Vtbl d3d8_device_vtbl =
3487{
3585};
3586
3588{
3590}
3591
3593 struct wined3d_device *device)
3594{
3595 TRACE("device_parent %p, device %p\n", device_parent, device);
3596}
3597
3599{
3600 TRACE("device_parent %p.\n", device_parent);
3601}
3602
3604{
3606
3607 TRACE("device_parent %p, activate %#x.\n", device_parent, activate);
3608
3609 if (!activate)
3611 else
3613}
3614
3616 enum wined3d_resource_type type, struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx,
3617 void **parent, const struct wined3d_parent_ops **parent_ops)
3618{
3619 TRACE("device_parent %p, type %#x, wined3d_texture %p, sub_resource_idx %u, parent %p, parent_ops %p.\n",
3620 device_parent, type, wined3d_texture, sub_resource_idx, parent, parent_ops);
3621
3623 {
3624 struct d3d8_volume *d3d_volume;
3625
3626 if (!(d3d_volume = calloc(1, sizeof(*d3d_volume))))
3627 return E_OUTOFMEMORY;
3628
3629 volume_init(d3d_volume, wined3d_texture, sub_resource_idx, parent_ops);
3630 *parent = d3d_volume;
3631 TRACE("Created volume %p.\n", d3d_volume);
3632 }
3633 else if (type != WINED3D_RTYPE_TEXTURE_2D)
3634 {
3635 ERR("Unhandled resource type %#x.\n", type);
3636 return E_FAIL;
3637 }
3638
3639 return D3D_OK;
3640}
3641
3643{
3648};
3649
3650static void setup_fpu(void)
3651{
3652#if defined(__i386__) && defined(_MSC_VER)
3653 WORD cw;
3654 __asm fnstcw cw;
3655 cw = (cw & ~0xf3f) | 0x3f;
3656 __asm fldcw cw;
3657#elif defined(__i386__) || (defined(__x86_64__) && !defined(__arm64ec__) && (defined(__GNUC__) || defined(__clang__)))
3658 WORD cw;
3659 __asm__ volatile ("fnstcw %0" : "=m" (cw));
3660 cw = (cw & ~0xf3f) | 0x3f;
3661 __asm__ volatile ("fldcw %0" : : "m" (cw));
3662#else
3663 FIXME("FPU setup not implemented for this platform.\n");
3664#endif
3665}
3666
3669{
3670 struct wined3d_swapchain_desc swapchain_desc;
3674 struct d3d8_swapchain *d3d_swapchain;
3675 struct wined3d_caps caps;
3676 unsigned int output_idx;
3677 HRESULT hr;
3678
3679 static const enum wined3d_feature_level feature_levels[] =
3680 {
3685 };
3686
3687 output_idx = adapter;
3688 if (output_idx >= parent->wined3d_output_count)
3689 return D3DERR_INVALIDCALL;
3690
3691 device->IDirect3DDevice8_iface.lpVtbl = &d3d8_device_vtbl;
3692 device->device_parent.ops = &d3d8_wined3d_device_parent_ops;
3693 device->adapter_ordinal = adapter;
3694 device->ref = 1;
3695 if (!(device->handle_table.entries = calloc(D3D8_INITIAL_HANDLE_TABLE_SIZE,
3696 sizeof(*device->handle_table.entries))))
3697 {
3698 ERR("Failed to allocate handle table memory.\n");
3699 return E_OUTOFMEMORY;
3700 }
3701 device->handle_table.table_size = D3D8_INITIAL_HANDLE_TABLE_SIZE;
3702
3704
3706 wined3d_output = parent->wined3d_outputs[output_idx];
3709 focus_window, flags, 4, feature_levels, ARRAY_SIZE(feature_levels),
3710 &device->device_parent, &device->wined3d_device)))
3711 {
3712 WARN("Failed to create wined3d device, hr %#lx.\n", hr);
3714 free(device->handle_table.entries);
3715 return hr;
3716 }
3717
3718 device->immediate_context = wined3d_device_get_immediate_context(device->wined3d_device);
3720 device->max_user_clip_planes = caps.MaxUserClipPlanes;
3721 device->vs_uniform_count = caps.MaxVertexShaderConst;
3722
3723 if (FAILED(hr = wined3d_stateblock_create(device->wined3d_device, NULL, WINED3D_SBT_PRIMARY, &device->state)))
3724 {
3725 ERR("Failed to create primary stateblock, hr %#lx.\n", hr);
3726 wined3d_device_decref(device->wined3d_device);
3728 return hr;
3729 }
3730 device->stateblock_state = wined3d_stateblock_get_state(device->state);
3731 device->update_state = device->state;
3732
3735
3736 if (!parameters->Windowed)
3737 {
3738 if (!focus_window)
3739 focus_window = parameters->hDeviceWindow;
3740 if (FAILED(hr = wined3d_device_acquire_focus_window(device->wined3d_device, focus_window)))
3741 {
3742 ERR("Failed to acquire focus window, hr %#lx.\n", hr);
3743 wined3d_device_decref(device->wined3d_device);
3745 free(device->handle_table.entries);
3746 return hr;
3747 }
3748 }
3749
3752
3754 {
3756 wined3d_device_decref(device->wined3d_device);
3758 free(device->handle_table.entries);
3759 return D3DERR_INVALIDCALL;
3760 }
3761 swapchain_desc.flags |= WINED3D_SWAPCHAIN_IMPLICIT;
3762
3763 if (FAILED(hr = d3d8_swapchain_create(device, &swapchain_desc,
3764 wined3dswapinterval_from_d3d(parameters->FullScreen_PresentationInterval), &d3d_swapchain)))
3765 {
3766 WARN("Failed to create implicit swapchain, hr %#lx.\n", hr);
3768 wined3d_device_decref(device->wined3d_device);
3770 free(device->handle_table.entries);
3771 return hr;
3772 }
3773
3774 wined3d_swapchain = d3d_swapchain->wined3d_swapchain;
3777
3779 !!swapchain_desc.enable_auto_depth_stencil);
3783
3785 &swapchain_desc, parameters->FullScreen_PresentationInterval);
3786
3787 device->declArraySize = 16;
3788 if (!(device->decls = malloc(device->declArraySize * sizeof(*device->decls))))
3789 {
3790 ERR("Failed to allocate FVF vertex declaration map memory.\n");
3791 hr = E_OUTOFMEMORY;
3792 goto err;
3793 }
3794
3795 device->implicit_swapchain = wined3d_swapchain;
3796
3797 device->d3d_parent = parent;
3798 IDirect3D8_AddRef(&parent->IDirect3D8_iface);
3799
3800 return D3D_OK;
3801
3802err:
3806 wined3d_device_decref(device->wined3d_device);
3808 free(device->handle_table.entries);
3809 return hr;
3810}
#define DECLSPEC_HOTPATCH
Definition: _mingw.h:240
#define isprint(c)
Definition: acclib.h:73
static int state
Definition: maze.c:121
#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
#define index(s, c)
Definition: various.h:29
#define ARRAY_SIZE(A)
Definition: main.h:20
#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
r l[0]
Definition: byte_order.h:168
Definition: _map.h:48
RECT rect
Definition: combotst.c:67
#define D3DERR_INVALIDCALL
Definition: d3d10_private.h:42
struct d3d8_texture * unsafe_impl_from_IDirect3DBaseTexture8(IDirect3DBaseTexture8 *iface)
Definition: texture.c:1017
void volume_init(struct d3d8_volume *volume, struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, const struct wined3d_parent_ops **parent_ops)
Definition: volume.c:203
@ D3D8_DEVICE_STATE_OK
Definition: d3d8_private.h:102
@ D3D8_DEVICE_STATE_NOT_RESET
Definition: d3d8_private.h:104
@ D3D8_DEVICE_STATE_LOST
Definition: d3d8_private.h:103
void d3d8_vertex_declaration_destroy(struct d3d8_vertex_declaration *declaration)
#define VS_HIGHESTFIXEDFXF
Definition: d3d8_private.h:47
#define D3D8_INVALID_HANDLE
Definition: d3d8_private.h:70
HRESULT d3d8_vertex_shader_init(struct d3d8_vertex_shader *shader, struct d3d8_device *device, const DWORD *declaration, const DWORD *byte_code, DWORD shader_handle, DWORD usage)
Definition: shader.c:78
HRESULT d3d8_texture_3d_init(struct d3d8_texture *texture, struct d3d8_device *device, unsigned int width, unsigned int height, unsigned int depth, unsigned int levels, DWORD usage, D3DFORMAT format, D3DPOOL pool)
Definition: texture.c:1168
#define D3D8_RESZ_CODE
Definition: d3d8_private.h:44
struct d3d8_surface * unsafe_impl_from_IDirect3DSurface8(IDirect3DSurface8 *iface)
Definition: surface.c:412
#define D3D8_MAX_STREAMS
Definition: d3d8_private.h:41
HRESULT d3d8_vertex_declaration_init_fvf(struct d3d8_vertex_declaration *declaration, struct d3d8_device *device, DWORD fvf)
struct d3d8_device * d3d8_surface_get_device(const struct d3d8_surface *surface)
Definition: surface.c:372
#define D3D8_MAX_PIXEL_SHADER_CONSTANTF
Definition: d3d8_private.h:40
#define D3D8_INITIAL_HANDLE_TABLE_SIZE
Definition: d3d8_private.h:69
struct wined3d_rendertarget_view * d3d8_surface_acquire_rendertarget_view(struct d3d8_surface *surface)
Definition: surface.c:379
static enum wined3d_device_type wined3d_device_type_from_d3d(D3DDEVTYPE type)
Definition: d3d8_private.h:392
HRESULT d3d8_texture_cube_init(struct d3d8_texture *texture, struct d3d8_device *device, unsigned int edge_length, unsigned int level_count, DWORD usage, D3DFORMAT format, D3DPOOL pool)
Definition: texture.c:1141
static D3DMULTISAMPLE_TYPE d3dmultisample_type_from_wined3d(enum wined3d_multisample_type type)
Definition: d3d8_private.h:387
#define D3DPRESENTFLAGS_MASK
Definition: d3d8_private.h:37
struct d3d8_surface * d3d8_surface_create(struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, IUnknown *container)
Definition: surface.c:318
#define D3D8_MAX_VERTEX_SHADER_CONSTANTF
Definition: d3d8_private.h:39
HRESULT d3d8_texture_2d_init(struct d3d8_texture *texture, struct d3d8_device *device, unsigned int width, unsigned int height, unsigned int level_count, DWORD usage, D3DFORMAT format, D3DPOOL pool)
Definition: texture.c:1114
void d3d8_vertex_shader_destroy(struct d3d8_vertex_shader *shader)
Definition: shader.c:31
static struct wined3d_texture * d3d8_texture_get_draw_texture(struct d3d8_texture *texture)
Definition: d3d8_private.h:257
static struct d3d8_device * impl_from_IDirect3DDevice8(IDirect3DDevice8 *iface)
Definition: d3d8_private.h:144
HRESULT d3d8_pixel_shader_init(struct d3d8_pixel_shader *shader, struct d3d8_device *device, const DWORD *byte_code, DWORD shader_handle)
Definition: shader.c:156
void d3d8_pixel_shader_destroy(struct d3d8_pixel_shader *shader)
Definition: shader.c:142
HRESULT d3d8_swapchain_create(struct d3d8_device *device, struct wined3d_swapchain_desc *desc, unsigned int swap_interval, struct d3d8_swapchain **swapchain)
Definition: swapchain.c:193
void d3d8_surface_release_rendertarget_view(struct d3d8_surface *surface, struct wined3d_rendertarget_view *rtv)
Definition: surface.c:405
d3d8_handle_type
Definition: d3d8_private.h:73
@ D3D8_HANDLE_PS
Definition: d3d8_private.h:76
@ D3D8_HANDLE_VS
Definition: d3d8_private.h:75
@ D3D8_HANDLE_SB
Definition: d3d8_private.h:77
@ D3D8_HANDLE_FREE
Definition: d3d8_private.h:74
@ D3DRS_EDGEANTIALIAS
Definition: d3d8types.h:752
@ D3DRS_ZBIAS
Definition: d3d8types.h:753
@ D3DRS_POINTSIZE
Definition: d3d8types.h:786
enum _D3DTEXTURESTAGESTATETYPE D3DTEXTURESTAGESTATETYPE
enum _D3DBACKBUFFER_TYPE D3DBACKBUFFER_TYPE
#define D3DPS_VERSION(major, minor)
Definition: d3d8types.h:474
enum _D3DDEVTYPE D3DDEVTYPE
#define D3DLOCK_DISCARD
Definition: d3d8types.h:72
@ D3DFMT_L6V5U5
Definition: d3d8types.h:625
@ D3DFMT_A1R5G5B5
Definition: d3d8types.h:608
@ D3DFMT_A8P8
Definition: d3d8types.h:617
@ D3DFMT_D16
Definition: d3d8types.h:644
@ D3DFMT_X1R5G5B5
Definition: d3d8types.h:607
@ D3DFMT_W11V11U10
Definition: d3d8types.h:629
@ D3DFMT_D16_LOCKABLE
Definition: d3d8types.h:640
@ D3DFMT_R8G8B8
Definition: d3d8types.h:603
@ D3DFMT_R3G3B2
Definition: d3d8types.h:610
@ D3DFMT_A8L8
Definition: d3d8types.h:621
@ D3DFMT_V16U16
Definition: d3d8types.h:628
@ D3DFMT_A8R8G8B8
Definition: d3d8types.h:604
@ D3DFMT_A2B10G10R10
Definition: d3d8types.h:614
@ D3DFMT_X8L8V8U8
Definition: d3d8types.h:626
@ D3DFMT_INDEX16
Definition: d3d8types.h:649
@ D3DFMT_A8
Definition: d3d8types.h:611
@ D3DFMT_X4R4G4B4
Definition: d3d8types.h:613
@ D3DFMT_R5G6B5
Definition: d3d8types.h:606
@ D3DFMT_A8R3G3B2
Definition: d3d8types.h:612
@ D3DFMT_V8U8
Definition: d3d8types.h:624
@ D3DFMT_A4R4G4B4
Definition: d3d8types.h:609
@ D3DFMT_D24S8
Definition: d3d8types.h:643
@ D3DFMT_D32
Definition: d3d8types.h:641
@ D3DFMT_D24X8
Definition: d3d8types.h:645
@ D3DFMT_P8
Definition: d3d8types.h:618
@ D3DFMT_INDEX32
Definition: d3d8types.h:650
@ D3DFMT_UNKNOWN
Definition: d3d8types.h:601
@ D3DFMT_X8R8G8B8
Definition: d3d8types.h:605
@ D3DFMT_L8
Definition: d3d8types.h:620
@ D3DFMT_G16R16
Definition: d3d8types.h:615
@ D3DFMT_A2W10V10U10
Definition: d3d8types.h:630
@ D3DFMT_Q8W8V8U8
Definition: d3d8types.h:627
@ D3DFMT_D15S1
Definition: d3d8types.h:642
@ D3DFMT_D24X4S4
Definition: d3d8types.h:646
@ D3DFMT_A4L4
Definition: d3d8types.h:622
#define D3DUSAGE_WRITEONLY
Definition: d3d8types.h:93
enum _D3DSWAPEFFECT D3DSWAPEFFECT
#define D3DLOCK_NO_DIRTY_UPDATE
Definition: d3d8types.h:73
enum _D3DPOOL D3DPOOL
@ D3DSWAPEFFECT_FLIP
Definition: d3d8types.h:852
@ D3DSWAPEFFECT_DISCARD
Definition: d3d8types.h:851
@ D3DSWAPEFFECT_COPY
Definition: d3d8types.h:853
@ D3DSWAPEFFECT_COPY_VSYNC
Definition: d3d8types.h:854
#define D3DLOCK_NOOVERWRITE
Definition: d3d8types.h:71
@ D3DPT_LINELIST
Definition: d3d8types.h:719
@ D3DPT_POINTLIST
Definition: d3d8types.h:718
@ D3DPT_TRIANGLELIST
Definition: d3d8types.h:721
@ D3DPT_LINESTRIP
Definition: d3d8types.h:720
@ D3DPT_TRIANGLEFAN
Definition: d3d8types.h:723
@ D3DPT_TRIANGLESTRIP
Definition: d3d8types.h:722
@ D3DSBT_PIXELSTATE
Definition: d3d8types.h:831
@ D3DSBT_ALL
Definition: d3d8types.h:830
@ D3DSBT_VERTEXSTATE
Definition: d3d8types.h:832
enum _D3DTRANSFORMSTATETYPE D3DTRANSFORMSTATETYPE
#define D3DLOCK_NOSYSLOCK
Definition: d3d8types.h:70
#define D3DVS_VERSION(major, minor)
Definition: d3d8types.h:475
enum _D3DFORMAT D3DFORMAT
enum _D3DMULTISAMPLE_TYPE D3DMULTISAMPLE_TYPE
enum _D3DSTATEBLOCKTYPE D3DSTATEBLOCKTYPE
#define D3DLOCK_READONLY
Definition: d3d8types.h:69
#define D3D_OK
Definition: d3d.h:106
D3DPRIMITIVETYPE
Definition: d3dtypes.h:822
D3DRENDERSTATETYPE
Definition: d3dtypes.h:874
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_FAIL
Definition: ddrawi.h:102
#define realloc
Definition: debug_ros.c:6
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
HRESULT hr
Definition: delayimp.cpp:582
device_type
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static void CDECL device_parent_mode_changed(struct wined3d_device_parent *device_parent)
Definition: device.c:7692
static void CDECL device_parent_activate(struct wined3d_device_parent *device_parent, BOOL activate)
Definition: device.c:7697
static HRESULT CDECL device_parent_texture_sub_resource_created(struct wined3d_device_parent *device_parent, enum wined3d_resource_type type, struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, void **parent, const struct wined3d_parent_ops **parent_ops)
Definition: device.c:7702
static void CDECL device_parent_wined3d_device_created(struct wined3d_device_parent *device_parent, struct wined3d_device *wined3d_device)
Definition: device.c:7658
struct d3d8_indexbuffer * unsafe_impl_from_IDirect3DIndexBuffer8(IDirect3DIndexBuffer8 *iface)
Definition: buffer.c:653
struct d3d8_vertexbuffer * unsafe_impl_from_IDirect3DVertexBuffer8(IDirect3DVertexBuffer8 *iface)
Definition: buffer.c:345
HRESULT indexbuffer_init(struct d3d8_indexbuffer *buffer, struct d3d8_device *device, UINT size, DWORD usage, D3DFORMAT format, D3DPOOL pool)
Definition: buffer.c:605
HRESULT vertexbuffer_init(struct d3d8_vertexbuffer *buffer, struct d3d8_device *device, UINT size, DWORD usage, DWORD fvf, D3DPOOL pool)
Definition: buffer.c:284
static D3DSWAPEFFECT d3dswapeffect_from_wined3dswapeffect(enum wined3d_swap_effect effect)
Definition: device.c:184
static HRESULT WINAPI d3d8_device_SetStreamSource(IDirect3DDevice8 *iface, UINT stream_idx, IDirect3DVertexBuffer8 *buffer, UINT stride)
Definition: device.c:3404
static HRESULT WINAPI d3d8_device_BeginScene(IDirect3DDevice8 *iface)
Definition: device.c:1676
static HRESULT WINAPI d3d8_device_GetClipPlane(IDirect3DDevice8 *iface, DWORD index, float *plane)
Definition: device.c:1944
static HRESULT WINAPI d3d8_device_SetPixelShader(IDirect3DDevice8 *iface, DWORD shader)
Definition: device.c:3241
static HRESULT WINAPI d3d8_device_GetTextureStageState(IDirect3DDevice8 *iface, DWORD stage, D3DTEXTURESTAGESTATETYPE state, DWORD *value)
Definition: device.c:2366
static HRESULT WINAPI d3d8_device_Clear(IDirect3DDevice8 *iface, DWORD rect_count, const D3DRECT *rects, DWORD flags, D3DCOLOR color, float z, DWORD stencil)
Definition: device.c:1704
static enum wined3d_transform_state wined3d_transform_state_from_d3d(D3DTRANSFORMSTATETYPE state)
Definition: device.c:446
static HRESULT WINAPI d3d8_device_DrawRectPatch(IDirect3DDevice8 *iface, UINT handle, const float *segment_count, const D3DRECTPATCH_INFO *patch_info)
Definition: device.c:3382
static HRESULT WINAPI d3d8_device_SetVertexShaderConstant(IDirect3DDevice8 *iface, DWORD start_register, const void *data, DWORD count)
Definition: device.c:3026
static HRESULT WINAPI d3d8_device_SetPaletteEntries(IDirect3DDevice8 *iface, UINT palette_idx, const PALETTEENTRY *entries)
Definition: device.c:2453
static HRESULT WINAPI d3d8_device_LightEnable(IDirect3DDevice8 *iface, DWORD index, BOOL enable)
Definition: device.c:1901
static HRESULT WINAPI d3d8_device_DrawIndexedPrimitiveUP(IDirect3DDevice8 *iface, D3DPRIMITIVETYPE primitive_type, UINT min_vertex_idx, UINT vertex_count, UINT primitive_count, const void *index_data, D3DFORMAT index_format, const void *vertex_data, UINT vertex_stride)
Definition: device.c:2708
static HRESULT WINAPI d3d8_device_CopyRects(IDirect3DDevice8 *iface, IDirect3DSurface8 *src_surface, const RECT *src_rects, UINT rect_count, IDirect3DSurface8 *dst_surface, const POINT *dst_points)
Definition: device.c:1394
static HRESULT WINAPI d3d8_device_GetLightEnable(IDirect3DDevice8 *iface, DWORD index, BOOL *enabled)
Definition: device.c:1915
static void d3d8_device_upload_managed_textures(struct d3d8_device *device)
Definition: device.c:2564
static void STDMETHODCALLTYPE d3d8_null_wined3d_object_destroyed(void *parent)
Definition: device.c:26
static HRESULT WINAPI d3d8_device_SetCursorProperties(IDirect3DDevice8 *iface, UINT hotspot_x, UINT hotspot_y, IDirect3DSurface8 *bitmap)
Definition: device.c:770
static struct d3d8_device * device_from_device_parent(struct wined3d_device_parent *device_parent)
Definition: device.c:3587
static HRESULT WINAPI d3d8_device_CreateTexture(IDirect3DDevice8 *iface, UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool, IDirect3DTexture8 **texture)
Definition: device.c:1114
static HRESULT WINAPI d3d8_device_TestCooperativeLevel(IDirect3DDevice8 *iface)
Definition: device.c:648
static HRESULT WINAPI d3d8_device_SetClipPlane(IDirect3DDevice8 *iface, DWORD index, const float *plane)
Definition: device.c:1930
static HRESULT WINAPI d3d8_device_GetFrontBuffer(IDirect3DDevice8 *iface, IDirect3DSurface8 *dst_surface)
Definition: device.c:1508
static enum wined3d_swap_interval wined3dswapinterval_from_d3d(DWORD interval)
Definition: device.c:239
static HRESULT WINAPI d3d8_device_DeletePixelShader(IDirect3DDevice8 *iface, DWORD shader)
Definition: device.c:3299
static HRESULT WINAPI d3d8_device_GetRenderTarget(IDirect3DDevice8 *iface, IDirect3DSurface8 **render_target)
Definition: device.c:1612
static HRESULT WINAPI d3d8_device_GetDeviceCaps(IDirect3DDevice8 *iface, D3DCAPS8 *caps)
Definition: device.c:711
static BOOL WINAPI d3d8_device_ShowCursor(IDirect3DDevice8 *iface, BOOL show)
Definition: device.c:827
static HRESULT WINAPI d3d8_device_GetPaletteEntries(IDirect3DDevice8 *iface, UINT palette_idx, PALETTEENTRY *entries)
Definition: device.c:2464
static HRESULT CDECL reset_enum_callback(struct wined3d_resource *resource)
Definition: device.c:892
static ULONG WINAPI d3d8_device_AddRef(IDirect3DDevice8 *iface)
Definition: device.c:589
static HRESULT WINAPI d3d8_device_CreateStateBlock(IDirect3DDevice8 *iface, D3DSTATEBLOCKTYPE type, DWORD *handle)
Definition: device.c:2194
static HRESULT WINAPI d3d8_device_UpdateTexture(IDirect3DDevice8 *iface, IDirect3DBaseTexture8 *src_texture, IDirect3DBaseTexture8 *dst_texture)
Definition: device.c:1482
static enum wined3d_multisample_type wined3d_multisample_type_from_d3d(D3DMULTISAMPLE_TYPE type)
Definition: device.c:260
static HRESULT WINAPI d3d8_device_ApplyStateBlock(IDirect3DDevice8 *iface, DWORD token)
Definition: device.c:2094
static HRESULT WINAPI d3d8_device_SetMaterial(IDirect3DDevice8 *iface, const D3DMATERIAL8 *material)
Definition: device.c:1842
static HRESULT WINAPI d3d8_device_GetMaterial(IDirect3DDevice8 *iface, D3DMATERIAL8 *material)
Definition: device.c:1856
static HRESULT WINAPI d3d8_device_SetClipStatus(IDirect3DDevice8 *iface, const D3DCLIPSTATUS8 *clip_status)
Definition: device.c:2244
static void * d3d8_get_object(struct d3d8_handle_table *t, DWORD handle, enum d3d8_handle_type type)
Definition: device.c:539
static UINT WINAPI d3d8_device_GetAvailableTextureMem(IDirect3DDevice8 *iface)
Definition: device.c:668
static BOOL wined3d_swapchain_desc_from_d3d8(struct wined3d_swapchain_desc *swapchain_desc, struct wined3d_output *output, const D3DPRESENT_PARAMETERS *present_parameters)
Definition: device.c:265
static HRESULT WINAPI d3d8_device_CreateImageSurface(IDirect3DDevice8 *iface, UINT width, UINT height, D3DFORMAT format, IDirect3DSurface8 **surface)
Definition: device.c:1378
static const struct wined3d_device_parent_ops d3d8_wined3d_device_parent_ops
Definition: device.c:3642
static HRESULT WINAPI d3d8_device_SetPixelShaderConstant(IDirect3DDevice8 *iface, DWORD start_register, const void *data, DWORD count)
Definition: device.c:3325
static HRESULT WINAPI d3d8_device_SetViewport(IDirect3DDevice8 *iface, const D3DVIEWPORT8 *viewport)
Definition: device.c:1781
static HRESULT WINAPI d3d8_device_Present(IDirect3DDevice8 *iface, const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, const RGNDATA *dirty_region)
Definition: device.c:1027
static HRESULT WINAPI d3d8_device_CreateIndexBuffer(IDirect3DDevice8 *iface, UINT size, DWORD usage, D3DFORMAT format, D3DPOOL pool, IDirect3DIndexBuffer8 **buffer)
Definition: device.c:1258
static DWORD d3d8_allocate_handle(struct d3d8_handle_table *t, void *object, enum d3d8_handle_type type)
Definition: device.c:470
static HRESULT WINAPI d3d8_device_CreateDepthStencilSurface(IDirect3DDevice8 *iface, UINT width, UINT height, D3DFORMAT format, D3DMULTISAMPLE_TYPE multisample_type, IDirect3DSurface8 **surface)
Definition: device.c:1358
static const struct IDirect3DDevice8Vtbl d3d8_device_vtbl
Definition: device.c:3486
static UINT vertex_count_from_primitive_count(D3DPRIMITIVETYPE primitive_type, UINT primitive_count)
Definition: device.c:158
HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wined3d *wined3d, UINT adapter, D3DDEVTYPE device_type, HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters)
Definition: device.c:3667
D3DFORMAT d3dformat_from_wined3dformat(enum wined3d_format_id format)
Definition: device.c:33
static HRESULT WINAPI d3d8_device_MultiplyTransform(IDirect3DDevice8 *iface, D3DTRANSFORMSTATETYPE state, const D3DMATRIX *matrix)
Definition: device.c:1765
static HRESULT d3d8_device_create_surface(struct d3d8_device *device, enum wined3d_format_id format, enum wined3d_multisample_type multisample_type, unsigned int bind_flags, unsigned int access, unsigned int width, unsigned int height, IDirect3DSurface8 **surface)
Definition: device.c:1285
static void device_reset_viewport_state(struct d3d8_device *device)
Definition: device.c:559
static HRESULT WINAPI d3d8_device_GetCreationParameters(IDirect3DDevice8 *iface, D3DDEVICE_CREATION_PARAMETERS *parameters)
Definition: device.c:754
static HRESULT WINAPI d3d8_device_GetVertexShaderFunction(IDirect3DDevice8 *iface, DWORD shader, void *data, DWORD *data_size)
Definition: device.c:3101
static HRESULT WINAPI d3d8_device_ResourceManagerDiscardBytes(IDirect3DDevice8 *iface, DWORD byte_count)
Definition: device.c:682
static HRESULT WINAPI d3d8_device_ProcessVertices(IDirect3DDevice8 *iface, UINT src_start_idx, UINT dst_idx, UINT vertex_count, IDirect3DVertexBuffer8 *dst_buffer, DWORD flags)
Definition: device.c:2767
static HRESULT WINAPI d3d8_device_GetVertexShaderConstant(IDirect3DDevice8 *iface, DWORD start_idx, void *constants, DWORD count)
Definition: device.c:3049
static HRESULT WINAPI d3d8_device_GetPixelShader(IDirect3DDevice8 *iface, DWORD *shader)
Definition: device.c:3271
static HRESULT WINAPI d3d8_device_SetCurrentTexturePalette(IDirect3DDevice8 *iface, UINT palette_idx)
Definition: device.c:2472
static HRESULT WINAPI d3d8_device_GetDisplayMode(IDirect3DDevice8 *iface, D3DDISPLAYMODE *mode)
Definition: device.c:731
static HRESULT WINAPI d3d8_device_SetIndices(IDirect3DDevice8 *iface, IDirect3DIndexBuffer8 *buffer, UINT base_vertex_idx)
Definition: device.c:3132
static HRESULT WINAPI d3d8_device_CreatePixelShader(IDirect3DDevice8 *iface, const DWORD *byte_code, DWORD *shader)
Definition: device.c:3194
static HRESULT d3d8_device_upload_sysmem_index_buffer(struct d3d8_device *device, unsigned int *start_idx, unsigned int idx_count)
Definition: device.c:2527
static HRESULT WINAPI d3d8_device_EndStateBlock(IDirect3DDevice8 *iface, DWORD *token)
Definition: device.c:2054
static HRESULT WINAPI d3d8_device_Reset(IDirect3DDevice8 *iface, D3DPRESENT_PARAMETERS *present_parameters)
Definition: device.c:940
static HRESULT WINAPI d3d8_device_CreateCubeTexture(IDirect3DDevice8 *iface, UINT edge_length, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool, IDirect3DCubeTexture8 **texture)
Definition: device.c:1189
static HRESULT WINAPI d3d8_device_GetPixelShaderFunction(IDirect3DDevice8 *iface, DWORD shader, void *data, DWORD *data_size)
Definition: device.c:3358
static HRESULT WINAPI d3d8_device_GetDirect3D(IDirect3DDevice8 *iface, IDirect3D8 **d3d8)
Definition: device.c:698
static HRESULT WINAPI d3d8_device_GetLight(IDirect3DDevice8 *iface, DWORD index, D3DLIGHT8 *light)
Definition: device.c:1885
static void * d3d8_free_handle(struct d3d8_handle_table *t, DWORD handle, enum d3d8_handle_type type)
Definition: device.c:513
static struct d3d8_vertex_declaration * d3d8_device_get_fvf_declaration(struct d3d8_device *device, DWORD fvf)
Definition: device.c:2871
static HRESULT WINAPI d3d8_device_GetClipStatus(IDirect3DDevice8 *iface, D3DCLIPSTATUS8 *clip_status)
Definition: device.c:2259
void d3dcaps_from_wined3dcaps(D3DCAPS8 *caps, const struct wined3d_caps *wined3d_caps, unsigned int adapter_ordinal)
Definition: device.c:321
static HRESULT WINAPI d3d8_device_SetRenderState(IDirect3DDevice8 *iface, D3DRENDERSTATETYPE state, DWORD value)
Definition: device.c:1991
static HRESULT WINAPI d3d8_device_DrawPrimitive(IDirect3DDevice8 *iface, D3DPRIMITIVETYPE primitive_type, UINT start_vertex, UINT primitive_count)
Definition: device.c:2583
static void d3d8_device_upload_sysmem_vertex_buffers(struct d3d8_device *device, unsigned int start_vertex, unsigned int vertex_count)
Definition: device.c:2486
static HRESULT WINAPI d3d8_device_GetTexture(IDirect3DDevice8 *iface, DWORD stage, IDirect3DBaseTexture8 **texture)
Definition: device.c:2273
static HRESULT WINAPI d3d8_device_QueryInterface(IDirect3DDevice8 *iface, REFIID riid, void **out)
Definition: device.c:570
static void resolve_depth_buffer(struct d3d8_device *device)
Definition: device.c:1963
static HRESULT WINAPI d3d8_device_GetRasterStatus(IDirect3DDevice8 *iface, D3DRASTER_STATUS *raster_status)
Definition: device.c:1076
static HRESULT WINAPI d3d8_device_CreateVolumeTexture(IDirect3DDevice8 *iface, UINT width, UINT height, UINT depth, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool, IDirect3DVolumeTexture8 **texture)
Definition: device.c:1157
static HRESULT WINAPI d3d8_device_GetStreamSource(IDirect3DDevice8 *iface, UINT stream_idx, IDirect3DVertexBuffer8 **buffer, UINT *stride)
Definition: device.c:3449
static HRESULT WINAPI d3d8_device_GetVertexShaderDeclaration(IDirect3DDevice8 *iface, DWORD shader, void *data, DWORD *data_size)
Definition: device.c:3064
static enum wined3d_primitive_type wined3d_primitive_type_from_d3d(D3DPRIMITIVETYPE type)
Definition: device.c:464
static void setup_fpu(void)
Definition: device.c:3650
static HRESULT WINAPI d3d8_device_DeleteStateBlock(IDirect3DDevice8 *iface, DWORD token)
Definition: device.c:2168
static HRESULT WINAPI d3d8_device_GetTransform(IDirect3DDevice8 *iface, D3DTRANSFORMSTATETYPE state, D3DMATRIX *matrix)
Definition: device.c:1750
static HRESULT WINAPI d3d8_device_DeletePatch(IDirect3DDevice8 *iface, UINT handle)
Definition: device.c:3398
static HRESULT WINAPI d3d8_device_GetInfo(IDirect3DDevice8 *iface, DWORD info_id, void *info, DWORD info_size)
Definition: device.c:2443
static HRESULT WINAPI d3d8_device_GetViewport(IDirect3DDevice8 *iface, D3DVIEWPORT8 *viewport)
Definition: device.c:1821
static HRESULT WINAPI d3d8_device_GetRenderState(IDirect3DDevice8 *iface, D3DRENDERSTATETYPE state, DWORD *value)
Definition: device.c:2007
static HRESULT WINAPI d3d8_device_SetVertexShader(IDirect3DDevice8 *iface, DWORD shader)
Definition: device.c:2935
static HRESULT WINAPI d3d8_device_GetDepthStencilSurface(IDirect3DDevice8 *iface, IDirect3DSurface8 **depth_stencil)
Definition: device.c:1645
static HRESULT WINAPI d3d8_device_BeginStateBlock(IDirect3DDevice8 *iface)
Definition: device.c:2031
static void WINAPI d3d8_device_SetGammaRamp(IDirect3DDevice8 *iface, DWORD flags, const D3DGAMMARAMP *ramp)
Definition: device.c:1090
static HRESULT WINAPI d3d8_device_DeleteVertexShader(IDirect3DDevice8 *iface, DWORD shader)
Definition: device.c:2999
static HRESULT WINAPI d3d8_device_CreateVertexShader(IDirect3DDevice8 *iface, const DWORD *declaration, const DWORD *byte_code, DWORD *shader, DWORD usage)
Definition: device.c:2822
static HRESULT WINAPI d3d8_device_GetVertexShader(IDirect3DDevice8 *iface, DWORD *shader)
Definition: device.c:2974
const struct wined3d_parent_ops d3d8_null_wined3d_parent_ops
Definition: device.c:28
static HRESULT WINAPI d3d8_device_GetIndices(IDirect3DDevice8 *iface, IDirect3DIndexBuffer8 **buffer, UINT *base_vertex_index)
Definition: device.c:3162
static enum wined3d_render_state wined3d_render_state_from_d3d(D3DRENDERSTATETYPE state)
Definition: device.c:451
static HRESULT WINAPI d3d8_device_CreateVertexBuffer(IDirect3DDevice8 *iface, UINT size, DWORD usage, DWORD fvf, D3DPOOL pool, IDirect3DVertexBuffer8 **buffer)
Definition: device.c:1231
static HRESULT WINAPI DECLSPEC_HOTPATCH d3d8_device_EndScene(IDirect3DDevice8 *iface)
Definition: device.c:1690
static HRESULT WINAPI d3d8_device_SetLight(IDirect3DDevice8 *iface, DWORD index, const D3DLIGHT8 *light)
Definition: device.c:1870
unsigned int wined3dmapflags_from_d3dmapflags(unsigned int flags, unsigned int usage)
Definition: device.c:135
static HRESULT WINAPI d3d8_device_SetTexture(IDirect3DDevice8 *iface, DWORD stage, IDirect3DBaseTexture8 *texture)
Definition: device.c:2307
static HRESULT WINAPI d3d8_device_GetBackBuffer(IDirect3DDevice8 *iface, UINT backbuffer_idx, D3DBACKBUFFER_TYPE backbuffer_type, IDirect3DSurface8 **backbuffer)
Definition: device.c:1046
static ULONG WINAPI d3d8_device_Release(IDirect3DDevice8 *iface)
Definition: device.c:599
static HRESULT WINAPI d3d8_device_SetTransform(IDirect3DDevice8 *iface, D3DTRANSFORMSTATETYPE state, const D3DMATRIX *matrix)
Definition: device.c:1734
static HRESULT WINAPI d3d8_device_SetTextureStageState(IDirect3DDevice8 *iface, DWORD stage, D3DTEXTURESTAGESTATETYPE type, DWORD value)
Definition: device.c:2394
static HRESULT WINAPI d3d8_device_DrawPrimitiveUP(IDirect3DDevice8 *iface, D3DPRIMITIVETYPE primitive_type, UINT primitive_count, const void *data, UINT stride)
Definition: device.c:2667
static enum wined3d_swap_effect wined3dswapeffect_from_d3dswapeffect(D3DSWAPEFFECT effect)
Definition: device.c:221
static HRESULT WINAPI d3d8_device_SetRenderTarget(IDirect3DDevice8 *iface, IDirect3DSurface8 *render_target, IDirect3DSurface8 *depth_stencil)
Definition: device.c:1530
static HRESULT WINAPI d3d8_device_DrawTriPatch(IDirect3DDevice8 *iface, UINT handle, const float *segment_count, const D3DTRIPATCH_INFO *patch_info)
Definition: device.c:3390
static HRESULT WINAPI d3d8_device_GetPixelShaderConstant(IDirect3DDevice8 *iface, DWORD start_idx, void *constants, DWORD count)
Definition: device.c:3340
static HRESULT WINAPI d3d8_device_CreateAdditionalSwapChain(IDirect3DDevice8 *iface, D3DPRESENT_PARAMETERS *present_parameters, IDirect3DSwapChain8 **swapchain)
Definition: device.c:841
static HRESULT WINAPI d3d8_device_CreateRenderTarget(IDirect3DDevice8 *iface, UINT width, UINT height, D3DFORMAT format, D3DMULTISAMPLE_TYPE multisample_type, BOOL lockable, IDirect3DSurface8 **surface)
Definition: device.c:1336
static void present_parameters_from_wined3d_swapchain_desc(D3DPRESENT_PARAMETERS *present_parameters, const struct wined3d_swapchain_desc *swapchain_desc, DWORD presentation_interval)
Definition: device.c:202
static HRESULT WINAPI d3d8_device_CaptureStateBlock(IDirect3DDevice8 *iface, DWORD token)
Definition: device.c:2141
static HRESULT WINAPI d3d8_device_DrawIndexedPrimitive(IDirect3DDevice8 *iface, D3DPRIMITIVETYPE primitive_type, UINT min_vertex_idx, UINT vertex_count, UINT start_idx, UINT primitive_count)
Definition: device.c:2616
enum wined3d_format_id wined3dformat_from_d3dformat(D3DFORMAT format)
Definition: device.c:84
static void WINAPI d3d8_device_GetGammaRamp(IDirect3DDevice8 *iface, D3DGAMMARAMP *ramp)
Definition: device.c:1102
static HRESULT WINAPI d3d8_device_ValidateDevice(IDirect3DDevice8 *iface, DWORD *pass_count)
Definition: device.c:2420
static HRESULT WINAPI d3d8_device_GetCurrentTexturePalette(IDirect3DDevice8 *iface, UINT *palette_idx)
Definition: device.c:2479
static void WINAPI d3d8_device_SetCursorPosition(IDirect3DDevice8 *iface, UINT x, UINT y, DWORD flags)
Definition: device.c:816
HRESULT CDECL wined3d_streaming_buffer_upload(struct wined3d_device *device, struct wined3d_streaming_buffer *buffer, const void *data, unsigned int size, unsigned int stride, unsigned int *ret_pos)
Definition: buffer.c:1422
void *CDECL wined3d_buffer_get_parent(const struct wined3d_buffer *buffer)
Definition: buffer.c:476
struct wined3d_resource *CDECL wined3d_buffer_get_resource(struct wined3d_buffer *buffer)
Definition: buffer.c:520
void CDECL wined3d_device_context_draw(struct wined3d_device_context *context, unsigned int start_vertex, unsigned int vertex_count, unsigned int start_instance, unsigned int instance_count)
Definition: device.c:2635
void CDECL wined3d_device_context_set_primitive_type(struct wined3d_device_context *context, enum wined3d_primitive_type primitive_type, unsigned int patch_vertex_count)
Definition: device.c:3779
void CDECL wined3d_device_get_creation_parameters(const struct wined3d_device *device, struct wined3d_device_creation_parameters *parameters)
Definition: device.c:5274
HRESULT CDECL wined3d_device_acquire_focus_window(struct wined3d_device *device, HWND window)
Definition: device.c:1133
HRESULT CDECL wined3d_device_get_clip_status(const struct wined3d_device *device, struct wined3d_clip_status *clip_status)
Definition: device.c:1820
void CDECL wined3d_device_context_resolve_sub_resource(struct wined3d_device_context *context, struct wined3d_resource *dst_resource, unsigned int dst_sub_resource_idx, struct wined3d_resource *src_resource, unsigned int src_sub_resource_idx, enum wined3d_format_id format_id)
Definition: device.c:4417
HRESULT CDECL wined3d_device_context_set_rendertarget_views(struct wined3d_device_context *context, unsigned int start_idx, unsigned int count, struct wined3d_rendertarget_view *const *views, BOOL set_viewport)
Definition: device.c:2377
void CDECL wined3d_device_set_cursor_position(struct wined3d_device *device, int x_screen_space, int y_screen_space, uint32_t flags)
Definition: device.c:4845
void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device)
Definition: device.c:4923
struct wined3d_rendertarget_view *CDECL wined3d_device_context_get_depth_stencil_view(const struct wined3d_device_context *context)
Definition: device.c:4676
HRESULT CDECL wined3d_device_set_clip_status(struct wined3d_device *device, const struct wined3d_clip_status *clip_status)
Definition: device.c:1809
HRESULT CDECL wined3d_device_context_copy_sub_resource_region(struct wined3d_device_context *context, struct wined3d_resource *dst_resource, unsigned int dst_sub_resource_idx, unsigned int dst_x, unsigned int dst_y, unsigned int dst_z, struct wined3d_resource *src_resource, unsigned int src_sub_resource_idx, const struct wined3d_box *src_box, unsigned int flags)
Definition: device.c:4220
UINT CDECL wined3d_device_get_available_texture_mem(const struct wined3d_device *device)
Definition: device.c:1754
ULONG CDECL wined3d_device_decref(struct wined3d_device *device)
Definition: device.c:251
void CDECL wined3d_device_context_get_scissor_rects(const struct wined3d_device_context *context, unsigned int *rect_count, RECT *rects)
Definition: device.c:1890
HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, unsigned int rect_count, const RECT *rects, uint32_t flags, const struct wined3d_color *color, float depth, unsigned int stencil)
Definition: device.c:3729
HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, const struct wined3d_swapchain_desc *swapchain_desc, const struct wined3d_display_mode *mode, wined3d_device_reset_cb callback, BOOL reset_state)
Definition: device.c:4970
HRESULT CDECL wined3d_device_set_cursor_properties(struct wined3d_device *device, UINT x_hotspot, UINT y_hotspot, struct wined3d_texture *texture, unsigned int sub_resource_idx)
Definition: device.c:4752
HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, struct wined3d_texture *src_texture, struct wined3d_texture *dst_texture)
Definition: device.c:3808
struct wined3d_rendertarget_view *CDECL wined3d_device_context_get_rendertarget_view(const struct wined3d_device_context *context, unsigned int view_idx)
Definition: device.c:4659
void CDECL wined3d_device_set_multithreaded(struct wined3d_device *device)
Definition: device.c:1746
void CDECL wined3d_device_set_gamma_ramp(const struct wined3d_device *device, UINT swapchain_idx, uint32_t flags, const struct wined3d_gamma_ramp *ramp)
Definition: device.c:5289
HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device)
Definition: device.c:3715
void CDECL wined3d_device_context_get_viewports(const struct wined3d_device_context *context, unsigned int *viewport_count, struct wined3d_viewport *viewports)
Definition: device.c:1844
struct wined3d_device_context *CDECL wined3d_device_get_immediate_context(struct wined3d_device *device)
Definition: device.c:1969
BOOL CDECL wined3d_device_show_cursor(struct wined3d_device *device, BOOL show)
Definition: device.c:4874
void CDECL wined3d_device_release_focus_window(struct wined3d_device *device)
Definition: device.c:1154
HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device, const struct wined3d_stateblock_state *state, DWORD *num_passes)
Definition: device.c:3963
struct wined3d_swapchain *CDECL wined3d_device_get_swapchain(const struct wined3d_device *device, UINT swapchain_idx)
Definition: device.c:501
void CDECL wined3d_device_context_draw_indexed(struct wined3d_device_context *context, int base_vertex_index, unsigned int start_index, unsigned int index_count, unsigned int start_instance, unsigned int instance_count)
Definition: device.c:2649
HRESULT CDECL wined3d_device_get_device_caps(const struct wined3d_device *device, struct wined3d_caps *caps)
Definition: device.c:3679
void CDECL wined3d_device_get_gamma_ramp(const struct wined3d_device *device, UINT swapchain_idx, struct wined3d_gamma_ramp *ramp)
Definition: device.c:5301
HRESULT CDECL wined3d_device_get_display_mode(const struct wined3d_device *device, UINT swapchain_idx, struct wined3d_display_mode *mode, enum wined3d_display_rotation *rotation)
Definition: device.c:3686
UINT CDECL wined3d_device_get_swapchain_count(const struct wined3d_device *device)
Definition: device.c:494
HRESULT CDECL wined3d_device_begin_scene(struct wined3d_device *device)
Definition: device.c:3700
HRESULT CDECL wined3d_device_context_set_depth_stencil_view(struct wined3d_device_context *context, struct wined3d_rendertarget_view *view)
Definition: device.c:2453
HRESULT CDECL wined3d_device_get_raster_status(const struct wined3d_device *device, UINT swapchain_idx, struct wined3d_raster_status *raster_status)
Definition: device.c:4055
HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, struct wined3d_stateblock *stateblock, UINT src_start_idx, UINT dst_idx, UINT vertex_count, struct wined3d_buffer *dst_buffer, const struct wined3d_vertex_declaration *declaration, uint32_t flags, uint32_t dst_fvf)
Definition: device.c:3598
void CDECL wined3d_device_context_set_index_buffer(struct wined3d_device_context *context, struct wined3d_buffer *buffer, enum wined3d_format_id format_id, unsigned int offset)
Definition: device.c:2557
HRESULT CDECL wined3d_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx)
Definition: resource.c:304
void *CDECL wined3d_resource_get_parent(const struct wined3d_resource *resource)
Definition: resource.c:269
void CDECL wined3d_resource_get_desc(const struct wined3d_resource *resource, struct wined3d_resource_desc *desc)
Definition: resource.c:280
HRESULT CDECL wined3d_resource_map(struct wined3d_resource *resource, unsigned int sub_resource_idx, struct wined3d_map_desc *map_desc, const struct wined3d_box *box, uint32_t flags)
Definition: resource.c:295
void *CDECL wined3d_shader_get_parent(const struct wined3d_shader *shader)
Definition: shader.c:2605
HRESULT CDECL wined3d_shader_get_byte_code(const struct wined3d_shader *shader, void *byte_code, UINT *byte_code_size)
Definition: shader.c:2612
void *CDECL wined3d_texture_get_parent(const struct wined3d_texture *texture)
Definition: texture.c:1690
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:4055
struct wined3d_texture *__cdecl wined3d_texture_from_resource(struct wined3d_resource *resource)
Definition: texture.c:3343
HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct wined3d_resource_desc *desc, UINT layer_count, UINT level_count, uint32_t flags, const struct wined3d_sub_resource_data *data, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_texture **texture)
Definition: texture.c:4158
void *CDECL wined3d_texture_get_sub_resource_parent(struct wined3d_texture *texture, unsigned int sub_resource_idx)
Definition: texture.c:4033
struct wined3d_resource *CDECL wined3d_texture_get_resource(struct wined3d_texture *texture)
Definition: texture.c:1649
ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture)
Definition: texture.c:1606
UINT CDECL wined3d_texture_get_level_count(const struct wined3d_texture *texture)
Definition: texture.c:1746
HRESULT CDECL wined3d_device_context_blt(struct wined3d_device_context *context, struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, const RECT *dst_rect, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx, const RECT *src_rect, unsigned int flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
Definition: texture.c:3854
void *CDECL wined3d_rendertarget_view_get_sub_resource_parent(const struct wined3d_rendertarget_view *view)
Definition: view.c:407
struct wined3d_resource *CDECL wined3d_rendertarget_view_get_resource(const struct wined3d_rendertarget_view *view)
Definition: view.c:430
#define CDECL
Definition: compat.h:29
return ret
Definition: mutex.c:147
r parent
Definition: btrfs.c:3010
#define D3DPRASTERCAPS_ANTIALIASEDGES
Definition: d3d8caps.h:77
#define D3DCAPS2_RESERVED
Definition: d3d8caps.h:23
#define D3DPRESENT_INTERVAL_THREE
Definition: d3d8caps.h:31
#define D3DPTEXTURECAPS_CUBEMAP_POW2
Definition: d3d8caps.h:126
#define D3DPBLENDCAPS_SRCCOLOR
Definition: d3d8caps.h:98
#define D3DVTXPCAPS_LOCALVIEWER
Definition: d3d8caps.h:185
#define D3DPTEXTURECAPS_PROJECTED
Definition: d3d8caps.h:120
#define D3DPRASTERCAPS_WBUFFER
Definition: d3d8caps.h:83
#define D3DPBLENDCAPS_DESTCOLOR
Definition: d3d8caps.h:104
#define D3DPMISCCAPS_CULLNONE
Definition: d3d8caps.h:58
#define D3DPTFILTERCAPS_MAGFAFLATCUBIC
Definition: d3d8caps.h:136
#define D3DPTFILTERCAPS_MIPFLINEAR
Definition: d3d8caps.h:132
#define D3DPMISCCAPS_CLIPTLVERTS
Definition: d3d8caps.h:63
#define D3DPMISCCAPS_CULLCW
Definition: d3d8caps.h:59
#define D3DPBLENDCAPS_INVSRCCOLOR
Definition: d3d8caps.h:99
#define D3DPBLENDCAPS_ZERO
Definition: d3d8caps.h:96
#define D3DCAPS2_CANRENDERWINDOWED
Definition: d3d8caps.h:21
#define D3DPRASTERCAPS_STRETCHBLTMULTISAMPLE
Definition: d3d8caps.h:87
#define D3DPTFILTERCAPS_MINFANISOTROPIC
Definition: d3d8caps.h:130
#define D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE
Definition: d3d8caps.h:117
#define D3DPBLENDCAPS_INVDESTCOLOR
Definition: d3d8caps.h:105
#define D3DPBLENDCAPS_INVDESTALPHA
Definition: d3d8caps.h:103
#define D3DVTXPCAPS_MATERIALSOURCE7
Definition: d3d8caps.h:182
#define D3DPMISCCAPS_COLORWRITEENABLE
Definition: d3d8caps.h:61
#define D3DPTFILTERCAPS_MINFLINEAR
Definition: d3d8caps.h:129
#define D3DPTEXTURECAPS_SQUAREONLY
Definition: d3d8caps.h:116
#define D3DPTFILTERCAPS_MAGFANISOTROPIC
Definition: d3d8caps.h:135
#define D3DPTEXTURECAPS_ALPHAPALETTE
Definition: d3d8caps.h:118
#define D3DPMISCCAPS_NULLREFERENCE
Definition: d3d8caps.h:66
#define D3DPRASTERCAPS_ZBUFFERLESSHSR
Definition: d3d8caps.h:80
#define D3DPBLENDCAPS_SRCALPHASAT
Definition: d3d8caps.h:106
#define D3DPBLENDCAPS_BOTHSRCALPHA
Definition: d3d8caps.h:107
#define D3DPMISCCAPS_CLIPPLANESCALEDPOINTS
Definition: d3d8caps.h:62
#define D3DPRASTERCAPS_WFOG
Definition: d3d8caps.h:84
#define D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD
Definition: d3d8caps.h:27
#define D3DVTXPCAPS_NO_VSDT_UBYTE4
Definition: d3d8caps.h:187
#define D3DPRESENT_INTERVAL_TWO
Definition: d3d8caps.h:30
#define D3DPTEXTURECAPS_ALPHA
Definition: d3d8caps.h:115
#define D3DPMISCCAPS_BLENDOP
Definition: d3d8caps.h:65
#define D3DPMISCCAPS_CULLCCW
Definition: d3d8caps.h:60
#define D3DPMISCCAPS_LINEPATTERNREP
Definition: d3d8caps.h:57
#define D3DPTEXTURECAPS_VOLUMEMAP
Definition: d3d8caps.h:122
#define D3DPRESENT_INTERVAL_FOUR
Definition: d3d8caps.h:32
#define D3DPTEXTURECAPS_VOLUMEMAP_POW2
Definition: d3d8caps.h:127
#define D3DPRESENT_INTERVAL_IMMEDIATE
Definition: d3d8caps.h:33
#define D3DPRASTERCAPS_ANISOTROPY
Definition: d3d8caps.h:82
#define D3DVTXPCAPS_DIRECTIONALLIGHTS
Definition: d3d8caps.h:183
#define D3DPRASTERCAPS_COLORPERSPECTIVE
Definition: d3d8caps.h:86
#define D3DPBLENDCAPS_INVSRCALPHA
Definition: d3d8caps.h:101
#define D3DCAPS2_CANCALIBRATEGAMMA
Definition: d3d8caps.h:22
#define D3DPRASTERCAPS_ZFOG
Definition: d3d8caps.h:85
#define D3DPBLENDCAPS_DESTALPHA
Definition: d3d8caps.h:102
#define D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC
Definition: d3d8caps.h:137
#define D3DPTEXTURECAPS_NONPOW2CONDITIONAL
Definition: d3d8caps.h:119
#define D3DPRESENT_INTERVAL_ONE
Definition: d3d8caps.h:29
#define D3DCAPS3_RESERVED
Definition: d3d8caps.h:26
#define D3DPRASTERCAPS_PAT
Definition: d3d8caps.h:73
#define D3DPRASTERCAPS_FOGRANGE
Definition: d3d8caps.h:81
#define D3DPTEXTURECAPS_PERSPECTIVE
Definition: d3d8caps.h:113
#define D3DPBLENDCAPS_SRCALPHA
Definition: d3d8caps.h:100
#define D3DVTXPCAPS_TWEENING
Definition: d3d8caps.h:186
#define D3DPBLENDCAPS_ONE
Definition: d3d8caps.h:97
#define D3DPRASTERCAPS_FOGVERTEX
Definition: d3d8caps.h:75
#define D3DPMISCCAPS_TSSARGTEMP
Definition: d3d8caps.h:64
#define D3DPTFILTERCAPS_MAGFLINEAR
Definition: d3d8caps.h:134
#define D3DCAPS2_NO2DDURING3DSCENE
Definition: d3d8caps.h:19
#define D3DPTFILTERCAPS_MINFPOINT
Definition: d3d8caps.h:128
#define D3DPTEXTURECAPS_CUBEMAP
Definition: d3d8caps.h:121
#define D3DVTXPCAPS_TEXGEN
Definition: d3d8caps.h:181
#define D3DCAPS2_DYNAMICTEXTURES
Definition: d3d8caps.h:25
#define D3DPBLENDCAPS_BOTHINVSRCALPHA
Definition: d3d8caps.h:108
#define D3DPRASTERCAPS_FOGTABLE
Definition: d3d8caps.h:76
#define D3DCAPS2_CANMANAGERESOURCE
Definition: d3d8caps.h:24
#define D3DPTEXTURECAPS_MIPCUBEMAP
Definition: d3d8caps.h:125
#define D3DPTFILTERCAPS_MIPFPOINT
Definition: d3d8caps.h:131
#define D3DPMISCCAPS_MASKZ
Definition: d3d8caps.h:56
#define D3DPRASTERCAPS_ZTEST
Definition: d3d8caps.h:74
#define D3DVTXPCAPS_POSITIONALLIGHTS
Definition: d3d8caps.h:184
#define D3DPRASTERCAPS_ZBIAS
Definition: d3d8caps.h:79
#define D3DCAPS2_FULLSCREENGAMMA
Definition: d3d8caps.h:20
#define D3DPTEXTURECAPS_MIPMAP
Definition: d3d8caps.h:123
#define D3DPTEXTURECAPS_POW2
Definition: d3d8caps.h:114
#define D3DPRESENT_INTERVAL_DEFAULT
Definition: d3d8caps.h:28
#define D3DPTFILTERCAPS_MAGFPOINT
Definition: d3d8caps.h:133
#define D3DPRASTERCAPS_MIPMAPLODBIAS
Definition: d3d8caps.h:78
#define D3DPTEXTURECAPS_MIPVOLUMEMAP
Definition: d3d8caps.h:124
#define D3DPRASTERCAPS_DITHER
Definition: d3d8caps.h:72
size_t const new_size
Definition: expand.cpp:66
static void depth_stencil(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:766
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
return adapter
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLdouble GLdouble t
Definition: gl.h:2047
GLint GLint GLsizei width
Definition: gl.h:1546
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: glext.h:7750
GLenum GLuint texture
Definition: glext.h:6295
GLsizei stride
Definition: glext.h:5848
GLenum src
Definition: glext.h:6340
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
GLuint color
Definition: glext.h:6243
const GLubyte * c
Definition: glext.h:8905
GLuint shader
Definition: glext.h:6030
GLuint index
Definition: glext.h:6031
GLuint GLenum matrix
Definition: glext.h:9407
GLenum mode
Definition: glext.h:6217
GLenum GLenum dst
Definition: glext.h:6340
GLbitfield flags
Definition: glext.h:7161
GLsizei levels
Definition: glext.h:7884
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
GLfloat GLfloat p
Definition: glext.h:8902
GLboolean enable
Definition: glext.h:11120
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
GLint GLfloat GLint stencil
Definition: glext.h:6260
GLdouble GLdouble z
Definition: glext.h:5874
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
Definition: glfuncs.h:210
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint GLenum GLenum GLenum GLint GLuint GLenum GLenum GLfloat GLenum GLfloat GLenum GLint const GLfloat GLenum GLint const GLushort GLint GLint GLsizei GLsizei GLenum GLsizei GLsizei GLenum GLenum const GLvoid GLenum plane
Definition: glfuncs.h:270
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum light
Definition: glfuncs.h:170
unsigned int UINT
Definition: sysinfo.c:13
static D3D_DRIVER_TYPE HMODULE UINT const D3D_FEATURE_LEVEL * feature_levels
Definition: hlsl_d3d11.c:28
REFIID riid
Definition: atlbase.h:39
#define InterlockedCompareExchange
Definition: interlocked.h:119
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
uint32_t entry
Definition: isohybrid.c:63
#define debugstr_guid
Definition: kernel32.h:35
if(dx< 0)
Definition: linetemp.h:194
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1683
int vertex_count
Definition: d3drm.c:3528
static const char * dst_format
Definition: dib.c:1339
static const BYTE ramp[17]
Definition: dib.c:2957
constants
Definition: resource.c:30
static BYTE parameters[]
Definition: asn.c:558
#define min(a, b)
Definition: monoChain.cc:55
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
__asm__(".p2align 4, 0x90\n" ".seh_proc __seh2_global_filter_func\n" "__seh2_global_filter_func:\n" "\tsub %rbp, %rax\n" "\tpush %rbp\n" "\t.seh_pushreg %rbp\n" "\tpush %rbx\n" "\t.seh_pushreg %rbx\n" "\tpush %rdi\n" "\t.seh_pushreg %rdi\n" "\tpush %rsi\n" "\t.seh_pushreg %rsi\n" "\tpush %r12\n" "\t.seh_pushreg %r12\n" "\tpush %r13\n" "\t.seh_pushreg %r13\n" "\tpush %r14\n" "\t.seh_pushreg %r14\n" "\tpush %r15\n" "\t.seh_pushreg %r15\n" "\tsub $40, %rsp\n" "\t.seh_stackalloc 40\n" "\t.seh_endprologue\n" "\tsub %rax, %rdx\n" "\tmov %rdx, %rbp\n" "\tjmp *%r8\n" "__seh2_global_filter_func_exit:\n" "\t.p2align 4\n" "\tadd $40, %rsp\n" "\tpop %r15\n" "\tpop %r14\n" "\tpop %r13\n" "\tpop %r12\n" "\tpop %rsi\n" "\tpop %rdi\n" "\tpop %rbx\n" "\tpop %rbp\n" "\tret\n" "\t.seh_endproc")
#define err(...)
#define calloc
Definition: rosglue.h:14
#define IDirect3DSurface8_GetDesc(p, a)
Definition: d3d8.h:313
#define IDirect3D8_Release(p)
Definition: d3d8.h:157
#define IDirect3DSwapChain8_Release(p)
Definition: d3d8.h:266
#define IDirect3DBaseTexture8_AddRef(p)
Definition: d3d8.h:541
#define IDirect3DSwapChain8_Present(p, a, b, c, d)
Definition: d3d8.h:268
#define IDirect3DTexture8_Release(p)
Definition: d3d8.h:695
#define D3DCREATE_MULTITHREADED
Definition: d3d8.h:38
#define IDirect3D8_QueryInterface(p, a, b)
Definition: d3d8.h:155
#define IDirect3DSurface8_AddRef(p)
Definition: d3d8.h:305
#define IDirect3DDevice8_SetVertexShader(p, a)
Definition: d3d8.h:1019
#define D3DERR_DEVICENOTRESET
Definition: d3d8.h:79
#define IDirect3DIndexBuffer8_AddRef(p)
Definition: d3d8.h:477
#define D3DCREATE_FPU_PRESERVE
Definition: d3d8.h:37
#define D3DERR_OUTOFVIDEOMEMORY
Definition: d3d8.h:81
#define IDirect3DVertexBuffer8_AddRef(p)
Definition: d3d8.h:413
#define D3DERR_DEVICELOST
Definition: d3d8.h:78
#define IDirect3DDevice8_AddRef(p)
Definition: d3d8.h:943
#define IDirect3DBaseTexture8_Release(p)
Definition: d3d8.h:542
#define D3DERR_NOTFOUND
Definition: d3d8.h:76
#define IDirect3D8_GetAdapterDisplayMode(p, a, b)
Definition: d3d8.h:164
#define IDirect3DDevice8_SetPixelShader(p, a)
Definition: d3d8.h:1031
#define IDirect3D8_AddRef(p)
Definition: d3d8.h:156
#define TRACE(s)
Definition: solgame.cpp:4
wchar_t const *const size_t const buffer_size
Definition: stat.cpp:95
struct d3d8_vertex_declaration * declaration
Definition: d3d8_private.h:97
DWORD fvf
Definition: d3d8_private.h:96
long y
Definition: dcommon.idl:24
long x
Definition: dcommon.idl:24
Definition: dcommon.idl:28
long bottom
Definition: dcommon.idl:29
long right
Definition: dcommon.idl:29
long left
Definition: dcommon.idl:29
long top
Definition: dcommon.idl:29
DWORD PresentationIntervals
Definition: d3d8caps.h:196
DWORD MaxVertexIndex
Definition: d3d8caps.h:237
DWORD PixelShaderVersion
Definition: d3d8caps.h:242
UINT AdapterOrdinal
Definition: d3d8caps.h:192
DWORD CursorCaps
Definition: d3d8caps.h:197
DWORD MaxTextureAspectRatio
Definition: d3d8caps.h:217
DWORD DestBlendCaps
Definition: d3d8caps.h:203
DWORD MaxPrimitiveCount
Definition: d3d8caps.h:236
DWORD LineCaps
Definition: d3d8caps.h:212
DWORD TextureAddressCaps
Definition: d3d8caps.h:210
DWORD MaxTextureWidth
Definition: d3d8caps.h:213
DWORD MaxAnisotropy
Definition: d3d8caps.h:218
DWORD TextureOpCaps
Definition: d3d8caps.h:227
DWORD VolumeTextureAddressCaps
Definition: d3d8caps.h:211
DWORD RasterCaps
Definition: d3d8caps.h:200
D3DDEVTYPE DeviceType
Definition: d3d8caps.h:191
DWORD MaxTextureRepeat
Definition: d3d8caps.h:216
DWORD ZCmpCaps
Definition: d3d8caps.h:201
DWORD MaxTextureHeight
Definition: d3d8caps.h:214
DWORD MaxStreams
Definition: d3d8caps.h:238
DWORD Caps3
Definition: d3d8caps.h:195
DWORD StencilCaps
Definition: d3d8caps.h:225
DWORD Caps2
Definition: d3d8caps.h:194
float MaxPointSize
Definition: d3d8caps.h:235
float GuardBandBottom
Definition: d3d8caps.h:223
float MaxVertexW
Definition: d3d8caps.h:219
DWORD MaxVertexShaderConst
Definition: d3d8caps.h:241
DWORD VertexProcessingCaps
Definition: d3d8caps.h:230
DWORD FVFCaps
Definition: d3d8caps.h:226
DWORD VertexShaderVersion
Definition: d3d8caps.h:240
DWORD Caps
Definition: d3d8caps.h:193
DWORD MaxSimultaneousTextures
Definition: d3d8caps.h:229
DWORD MaxTextureBlendStages
Definition: d3d8caps.h:228
DWORD MaxVolumeExtent
Definition: d3d8caps.h:215
DWORD TextureCaps
Definition: d3d8caps.h:206
DWORD DevCaps
Definition: d3d8caps.h:198
float ExtentsAdjust
Definition: d3d8caps.h:224
DWORD TextureFilterCaps
Definition: d3d8caps.h:207
DWORD AlphaCmpCaps
Definition: d3d8caps.h:204
DWORD MaxActiveLights
Definition: d3d8caps.h:231
DWORD PrimitiveMiscCaps
Definition: d3d8caps.h:199
DWORD ShadeCaps
Definition: d3d8caps.h:205
DWORD CubeTextureFilterCaps
Definition: d3d8caps.h:208
DWORD MaxStreamStride
Definition: d3d8caps.h:239
DWORD SrcBlendCaps
Definition: d3d8caps.h:202
float GuardBandTop
Definition: d3d8caps.h:221
float MaxPixelShaderValue
Definition: d3d8caps.h:243
float GuardBandRight
Definition: d3d8caps.h:222
float GuardBandLeft
Definition: d3d8caps.h:220
DWORD VolumeTextureFilterCaps
Definition: d3d8caps.h:209
DWORD MaxVertexBlendMatrices
Definition: d3d8caps.h:233
DWORD MaxUserClipPlanes
Definition: d3d8caps.h:232
DWORD MaxVertexBlendMatrixIndex
Definition: d3d8caps.h:234
D3DSWAPEFFECT SwapEffect
Definition: d3d8types.h:1128
D3DMULTISAMPLE_TYPE MultiSampleType
Definition: d3d8types.h:1126
D3DFORMAT BackBufferFormat
Definition: d3d8types.h:1123
UINT FullScreen_PresentationInterval
Definition: d3d8types.h:1136
D3DFORMAT AutoDepthStencilFormat
Definition: d3d8types.h:1132
Definition: uimain.c:89
Definition: palette.c:466
struct wined3d_device_parent device_parent
Definition: d3d8_private.h:111
Definition: d3d8_private.h:81
void * object
Definition: d3d8_private.h:82
struct wined3d_buffer * wined3d_buffer
Definition: d3d8_private.h:229
enum wined3d_format_id format
Definition: d3d8_private.h:231
IDirect3DIndexBuffer8 IDirect3DIndexBuffer8_iface
Definition: d3d8_private.h:227
struct wined3d_shader * wined3d_shader
Definition: d3d8_private.h:292
IDirect3DDevice8 * parent_device
Definition: d3d8_private.h:196
unsigned int sub_resource_idx
Definition: d3d8_private.h:193
struct wined3d_rendertarget_view * wined3d_rtv
Definition: d3d8_private.h:195
IDirect3DSurface8 IDirect3DSurface8_iface
Definition: d3d8_private.h:190
struct d3d8_resource resource
Definition: d3d8_private.h:191
struct wined3d_texture * wined3d_texture
Definition: d3d8_private.h:192
unsigned int swap_interval
Definition: d3d8_private.h:182
IDirect3DSwapChain8 IDirect3DSwapChain8_iface
Definition: d3d8_private.h:177
struct wined3d_swapchain * wined3d_swapchain
Definition: d3d8_private.h:179
struct wined3d_texture * wined3d_texture
Definition: d3d8_private.h:245
IDirect3DBaseTexture8 IDirect3DBaseTexture8_iface
Definition: d3d8_private.h:243
struct wined3d_texture * draw_texture
Definition: d3d8_private.h:245
struct wined3d_shader * wined3d_shader
Definition: d3d8_private.h:282
struct d3d8_vertex_declaration * vertex_declaration
Definition: d3d8_private.h:281
IDirect3DVertexBuffer8 IDirect3DVertexBuffer8_iface
Definition: d3d8_private.h:212
struct wined3d_buffer * draw_buffer
Definition: d3d8_private.h:216
struct wined3d_buffer * wined3d_buffer
Definition: d3d8_private.h:214
unsigned int sub_resource_idx
Definition: d3d8_private.h:168
Definition: devices.h:37
Definition: send.c:48
Definition: parse.h:23
union tss_lookup::@266 u
enum wined3d_texture_stage_state texture_state
Definition: device.c:2329
enum wined3d_sampler_state sampler_state
Definition: device.c:2330
BOOL sampler_state
Definition: device.c:2326
DWORD MaxVertexBlendMatrices
Definition: wined3d.h:1967
DWORD MaxTextureBlendStages
Definition: wined3d.h:1961
DWORD VolumeTextureAddressCaps
Definition: wined3d.h:1940
float GuardBandTop
Definition: wined3d.h:1952
float PixelShader1xMaxValue
Definition: wined3d.h:1981
DWORD FVFCaps
Definition: wined3d.h:1959
DWORD PrimitiveMiscCaps
Definition: wined3d.h:1928
DWORD MaxVertexBlendMatrixIndex
Definition: wined3d.h:1968
DWORD VertexProcessingCaps
Definition: wined3d.h:1964
DWORD TextureAddressCaps
Definition: wined3d.h:1939
DWORD TextureCaps
Definition: wined3d.h:1935
DWORD ShadeCaps
Definition: wined3d.h:1934
DWORD TextureOpCaps
Definition: wined3d.h:1960
DWORD MaxTextureRepeat
Definition: wined3d.h:1946
DWORD MaxAnisotropy
Definition: wined3d.h:1948
DWORD MaxVolumeExtent
Definition: wined3d.h:1945
float ExtentsAdjust
Definition: wined3d.h:1956
float GuardBandLeft
Definition: wined3d.h:1951
DWORD VolumeTextureFilterCaps
Definition: wined3d.h:1938
DWORD DevCaps
Definition: wined3d.h:1927
DWORD ZCmpCaps
Definition: wined3d.h:1930
DWORD MaxTextureHeight
Definition: wined3d.h:1944
DWORD CursorCaps
Definition: wined3d.h:1926
DWORD Caps
Definition: wined3d.h:1922
DWORD Caps3
Definition: wined3d.h:1924
DWORD MaxStreams
Definition: wined3d.h:1974
DWORD AlphaCmpCaps
Definition: wined3d.h:1933
DWORD DestBlendCaps
Definition: wined3d.h:1932
DWORD RasterCaps
Definition: wined3d.h:1929
float MaxVertexW
Definition: wined3d.h:1949
float MaxPointSize
Definition: wined3d.h:1970
DWORD Caps2
Definition: wined3d.h:1923
DWORD MaxPrimitiveCount
Definition: wined3d.h:1972
DWORD VertexShaderVersion
Definition: wined3d.h:1977
enum wined3d_device_type DeviceType
Definition: wined3d.h:1920
DWORD MaxTextureWidth
Definition: wined3d.h:1943
DWORD LineCaps
Definition: wined3d.h:1941
DWORD MaxUserClipPlanes
Definition: wined3d.h:1966
DWORD PixelShaderVersion
Definition: wined3d.h:1980
float GuardBandBottom
Definition: wined3d.h:1954
float GuardBandRight
Definition: wined3d.h:1953
DWORD MaxVertexIndex
Definition: wined3d.h:1973
DWORD CubeTextureFilterCaps
Definition: wined3d.h:1937
DWORD MaxTextureAspectRatio
Definition: wined3d.h:1947
DWORD MaxStreamStride
Definition: wined3d.h:1975
DWORD MaxSimultaneousTextures
Definition: wined3d.h:1962
DWORD MaxActiveLights
Definition: wined3d.h:1965
DWORD StencilCaps
Definition: wined3d.h:1957
DWORD SrcBlendCaps
Definition: wined3d.h:1931
DWORD TextureFilterCaps
Definition: wined3d.h:1936
DWORD MaxVertexShaderConst
Definition: wined3d.h:1978
enum wined3d_format_id format_id
Definition: wined3d.h:1614
unsigned int size
Definition: wined3d.h:1801
enum wined3d_format_id format
Definition: wined3d.h:1806
unsigned int multisample_quality
Definition: wined3d.h:1808
unsigned int bind_flags
Definition: wined3d.h:1810
enum wined3d_multisample_type multisample_type
Definition: wined3d.h:1807
unsigned int multisample_quality
Definition: wined3d.h:1778
unsigned int backbuffer_height
Definition: wined3d.h:1773
BOOL auto_restore_display_mode
Definition: wined3d.h:1786
enum wined3d_multisample_type multisample_type
Definition: wined3d.h:1777
enum wined3d_format_id auto_depth_stencil_format
Definition: wined3d.h:1783
struct wined3d_output * output
Definition: wined3d.h:1771
unsigned int backbuffer_width
Definition: wined3d.h:1772
unsigned int backbuffer_count
Definition: wined3d.h:1775
enum wined3d_format_id backbuffer_format
Definition: wined3d.h:1774
enum wined3d_swap_effect swap_effect
Definition: wined3d.h:1779
BOOL enable_auto_depth_stencil
Definition: wined3d.h:1782
unsigned int refresh_rate
Definition: wined3d.h:1785
unsigned int backbuffer_bind_flags
Definition: wined3d.h:1776
unsigned int swap_interval
#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
Definition: pdh_main.c:64
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
#define WINAPI
Definition: msvc.h:6
struct wined3d_adapter *CDECL wined3d_output_get_adapter(const struct wined3d_output *output)
Definition: directx.c:1508
HRESULT CDECL wined3d_get_device_caps(const struct wined3d_adapter *adapter, enum wined3d_device_type device_type, struct wined3d_caps *caps)
Definition: directx.c:2366
HRESULT CDECL wined3d_device_create(struct wined3d *wined3d, struct wined3d_adapter *adapter, enum wined3d_device_type device_type, HWND focus_window, uint32_t flags, BYTE surface_alignment, const enum wined3d_feature_level *feature_levels, unsigned int feature_level_count, struct wined3d_device_parent *device_parent, struct wined3d_device **device)
Definition: directx.c:2777
HRESULT CDECL wined3d_stateblock_set_vs_consts_f(struct wined3d_stateblock *stateblock, unsigned int start_idx, unsigned int count, const struct wined3d_vec4 *constants)
Definition: stateblock.c:1360
void CDECL wined3d_stateblock_set_vertex_declaration(struct wined3d_stateblock *stateblock, struct wined3d_vertex_declaration *declaration)
Definition: stateblock.c:1571
HRESULT CDECL wined3d_stateblock_create(struct wined3d_device *device, const struct wined3d_stateblock *device_state, enum wined3d_stateblock_type type, struct wined3d_stateblock **stateblock)
Definition: stateblock.c:2508
void CDECL wined3d_stateblock_set_material(struct wined3d_stateblock *stateblock, const struct wined3d_material *material)
Definition: stateblock.c:1891
void CDECL wined3d_stateblock_reset(struct wined3d_stateblock *stateblock)
Definition: stateblock.c:2534
void CDECL wined3d_stateblock_set_texture(struct wined3d_stateblock *stateblock, UINT stage, struct wined3d_texture *texture)
Definition: stateblock.c:1816
void CDECL wined3d_stateblock_init_contained_states(struct wined3d_stateblock *stateblock)
Definition: stateblock.c:393
HRESULT CDECL wined3d_stateblock_set_light(struct wined3d_stateblock *stateblock, UINT light_idx, const struct wined3d_light *light)
Definition: stateblock.c:1996
void CDECL wined3d_stateblock_depth_buffer_changed(struct wined3d_stateblock *stateblock)
Definition: stateblock.c:4043
HRESULT CDECL wined3d_stateblock_set_clip_plane(struct wined3d_stateblock *stateblock, UINT plane_idx, const struct wined3d_vec4 *plane)
Definition: stateblock.c:1875
HRESULT CDECL wined3d_stateblock_set_light_enable(struct wined3d_stateblock *stateblock, UINT light_idx, BOOL enable)
Definition: stateblock.c:2042
void CDECL wined3d_stateblock_set_pixel_shader(struct wined3d_stateblock *stateblock, struct wined3d_shader *shader)
Definition: stateblock.c:1460
HRESULT CDECL wined3d_stateblock_get_vs_consts_f(struct wined3d_stateblock *stateblock, unsigned int start_idx, unsigned int count, struct wined3d_vec4 *constants)
Definition: stateblock.c:1416
HRESULT CDECL wined3d_stateblock_set_ps_consts_f(struct wined3d_stateblock *stateblock, unsigned int start_idx, unsigned int count, const struct wined3d_vec4 *constants)
Definition: stateblock.c:1473
void CDECL wined3d_stateblock_set_sampler_state(struct wined3d_stateblock *stateblock, UINT sampler_idx, enum wined3d_sampler_state state, unsigned int value)
Definition: stateblock.c:1702
void CDECL wined3d_stateblock_set_vertex_shader(struct wined3d_stateblock *stateblock, struct wined3d_shader *shader)
Definition: stateblock.c:1319
const struct wined3d_stateblock_state *CDECL wined3d_stateblock_get_state(const struct wined3d_stateblock *stateblock)
Definition: stateblock.c:2064
ULONG CDECL wined3d_stateblock_decref(struct wined3d_stateblock *stateblock)
Definition: stateblock.c:670
void CDECL wined3d_stateblock_set_transform(struct wined3d_stateblock *stateblock, enum wined3d_transform_state d3dts, const struct wined3d_matrix *matrix)
Definition: stateblock.c:1840
void CDECL wined3d_stateblock_multiply_transform(struct wined3d_stateblock *stateblock, enum wined3d_transform_state d3dts, const struct wined3d_matrix *matrix)
Definition: stateblock.c:1859
void CDECL wined3d_stateblock_set_index_buffer(struct wined3d_stateblock *stateblock, struct wined3d_buffer *buffer, enum wined3d_format_id format_id)
Definition: stateblock.c:1918
void CDECL wined3d_stateblock_set_render_state(struct wined3d_stateblock *stateblock, enum wined3d_render_state state, unsigned int value)
Definition: stateblock.c:1623
void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock, struct wined3d_stateblock *device_state)
Definition: stateblock.c:1156
void CDECL wined3d_stateblock_set_scissor_rect(struct wined3d_stateblock *stateblock, const RECT *rect)
Definition: stateblock.c:1910
void CDECL wined3d_stateblock_apply_clear_state(struct wined3d_stateblock *stateblock, struct wined3d_device *device)
Definition: stateblock.c:2917
void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock, const struct wined3d_stateblock *device_state)
Definition: stateblock.c:893
HRESULT CDECL wined3d_stateblock_get_ps_consts_f(struct wined3d_stateblock *stateblock, unsigned int start_idx, unsigned int count, struct wined3d_vec4 *constants)
Definition: stateblock.c:1529
void CDECL wined3d_stateblock_set_base_vertex_index(struct wined3d_stateblock *stateblock, INT base_index)
Definition: stateblock.c:1932
HRESULT CDECL wined3d_stateblock_set_stream_source(struct wined3d_stateblock *stateblock, UINT stream_idx, struct wined3d_buffer *buffer, UINT offset, UINT stride)
Definition: stateblock.c:1939
HRESULT CDECL wined3d_stateblock_get_light(const struct wined3d_stateblock *stateblock, UINT light_idx, struct wined3d_light *light, BOOL *enabled)
Definition: stateblock.c:2069
void CDECL wined3d_stateblock_set_texture_stage_state(struct wined3d_stateblock *stateblock, UINT stage, enum wined3d_texture_stage_state state, unsigned int value)
Definition: stateblock.c:1718
void CDECL wined3d_stateblock_set_viewport(struct wined3d_stateblock *stateblock, const struct wined3d_viewport *viewport)
Definition: stateblock.c:1900
void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, struct wined3d_stateblock *stateblock)
Definition: stateblock.c:3038
struct wined3d_texture *CDECL wined3d_swapchain_get_back_buffer(const struct wined3d_swapchain *swapchain, UINT back_buffer_idx)
Definition: swapchain.c:256
void CDECL wined3d_swapchain_get_desc(const struct wined3d_swapchain *swapchain, struct wined3d_swapchain_desc *desc)
Definition: swapchain.c:345
void *CDECL wined3d_swapchain_get_parent(const struct wined3d_swapchain *swapchain)
Definition: swapchain.c:170
ULONG CDECL wined3d_swapchain_decref(struct wined3d_swapchain *swapchain)
Definition: swapchain.c:144
ULONG CDECL wined3d_swapchain_incref(struct wined3d_swapchain *swapchain)
Definition: swapchain.c:135
HRESULT CDECL wined3d_swapchain_get_front_buffer_data(const struct wined3d_swapchain *swapchain, struct wined3d_texture *dst_texture, unsigned int sub_resource_idx)
Definition: swapchain.c:235
void *CDECL wined3d_vertex_declaration_get_parent(const struct wined3d_vertex_declaration *declaration)
#define WINED3DERR_UNSUPPORTEDTEXTUREFILTER
Definition: wined3d.h:41
wined3d_stateblock_type
Definition: wined3d.h:786
@ WINED3D_SBT_PRIMARY
Definition: wined3d.h:791
@ WINED3D_SBT_RECORDED
Definition: wined3d.h:790
wined3d_multisample_type
Definition: wined3d.h:572
@ WINED3D_MULTISAMPLE_NONE
Definition: wined3d.h:573
wined3d_swap_interval
Definition: wined3d.h:544
@ WINED3D_SWAP_INTERVAL_TWO
Definition: wined3d.h:547
@ WINED3D_SWAP_INTERVAL_FOUR
Definition: wined3d.h:549
@ WINED3D_SWAP_INTERVAL_ONE
Definition: wined3d.h:546
@ WINED3D_SWAP_INTERVAL_DEFAULT
Definition: wined3d.h:550
@ WINED3D_SWAP_INTERVAL_THREE
Definition: wined3d.h:548
@ WINED3D_SWAP_INTERVAL_IMMEDIATE
Definition: wined3d.h:545
wined3d_render_state
Definition: wined3d.h:288
@ WINED3D_RS_ZENABLE
Definition: wined3d.h:293
@ WINED3D_RS_ANTIALIASEDLINEENABLE
Definition: wined3d.h:383
@ WINED3D_RS_DEPTHBIAS
Definition: wined3d.h:401
@ WINED3D_RS_POINTSIZE_MIN
Definition: wined3d.h:363
#define WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH
Definition: wined3d.h:897
wined3d_primitive_type
Definition: wined3d.h:74
static int wined3d_bit_scan(unsigned int *x)
Definition: wined3d.h:2982
#define WINED3D_OK
Definition: wined3d.h:33
#define WINED3D_SWAPCHAIN_IMPLICIT
Definition: wined3d.h:901
wined3d_swap_effect
Definition: wined3d.h:533
@ WINED3D_SWAP_EFFECT_COPY
Definition: wined3d.h:538
@ WINED3D_SWAP_EFFECT_SEQUENTIAL
Definition: wined3d.h:535
@ WINED3D_SWAP_EFFECT_DISCARD
Definition: wined3d.h:534
@ WINED3D_SWAP_EFFECT_COPY_VSYNC
Definition: wined3d.h:539
#define WINED3D_BIND_VERTEX_BUFFER
Definition: wined3d.h:909
wined3d_sampler_state
Definition: wined3d.h:554
@ WINED3D_SAMP_MAX_ANISOTROPY
Definition: wined3d.h:564
@ WINED3D_SAMP_MIPMAP_LOD_BIAS
Definition: wined3d.h:562
@ WINED3D_SAMP_MIN_FILTER
Definition: wined3d.h:560
@ WINED3D_SAMP_MIP_FILTER
Definition: wined3d.h:561
@ WINED3D_SAMP_MAG_FILTER
Definition: wined3d.h:559
@ WINED3D_SAMP_BORDER_COLOR
Definition: wined3d.h:558
@ WINED3D_SAMP_ADDRESS_V
Definition: wined3d.h:556
@ WINED3D_SAMP_ADDRESS_U
Definition: wined3d.h:555
@ WINED3D_SAMP_ADDRESS_W
Definition: wined3d.h:557
@ WINED3D_SAMP_MAX_MIP_LEVEL
Definition: wined3d.h:563
#define WINED3D_RESOURCE_ACCESS_GPU
Definition: wined3d.h:51
#define WINED3D_RESOURCE_ACCESS_CPU
Definition: wined3d.h:52
wined3d_resource_type
Definition: wined3d.h:716
@ WINED3D_RTYPE_TEXTURE_2D
Definition: wined3d.h:720
@ WINED3D_RTYPE_TEXTURE_3D
Definition: wined3d.h:721
static void wined3d_streaming_buffer_init(struct wined3d_streaming_buffer *buffer, unsigned int bind_flags)
Definition: wined3d.h:2937
#define WINED3D_MAX_FRAGMENT_SAMPLERS
Definition: wined3d.h:1598
@ WINED3D_TEXF_POINT
Definition: wined3d.h:706
wined3d_texture_stage_state
Definition: wined3d.h:593
@ WINED3D_TSS_COLOR_ARG2
Definition: wined3d.h:596
@ WINED3D_TSS_BUMPENV_LOFFSET
Definition: wined3d.h:606
@ WINED3D_TSS_ALPHA_OP
Definition: wined3d.h:597
@ WINED3D_TSS_BUMPENV_MAT11
Definition: wined3d.h:603
@ WINED3D_TSS_COLOR_OP
Definition: wined3d.h:594
@ WINED3D_TSS_INVALID
Definition: wined3d.h:612
@ WINED3D_TSS_BUMPENV_MAT10
Definition: wined3d.h:602
@ WINED3D_TSS_TEXCOORD_INDEX
Definition: wined3d.h:604
@ WINED3D_TSS_ALPHA_ARG2
Definition: wined3d.h:599
@ WINED3D_TSS_BUMPENV_MAT01
Definition: wined3d.h:601
@ WINED3D_TSS_ALPHA_ARG0
Definition: wined3d.h:609
@ WINED3D_TSS_BUMPENV_LSCALE
Definition: wined3d.h:605
@ WINED3D_TSS_COLOR_ARG0
Definition: wined3d.h:608
@ WINED3D_TSS_COLOR_ARG1
Definition: wined3d.h:595
@ WINED3D_TSS_ALPHA_ARG1
Definition: wined3d.h:598
@ WINED3D_TSS_RESULT_ARG
Definition: wined3d.h:610
@ WINED3D_TSS_BUMPENV_MAT00
Definition: wined3d.h:600
@ WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS
Definition: wined3d.h:607
#define WINED3D_MAP_READ
Definition: wined3d.h:957
wined3d_format_id
Definition: wined3d.h:126
@ WINED3DFMT_B2G3R3_UNORM
Definition: wined3d.h:131
@ WINED3DFMT_DF16
Definition: wined3d.h:280
@ WINED3DFMT_INTZ
Definition: wined3d.h:274
@ WINED3DFMT_B4G4R4A4_UNORM
Definition: wined3d.h:130
@ WINED3DFMT_R16G16_UNORM
Definition: wined3d.h:192
@ WINED3DFMT_X8D24_UNORM
Definition: wined3d.h:151
@ WINED3DFMT_R10G10B10A2_UNORM
Definition: wined3d.h:179
@ WINED3DFMT_R16G16_SNORM
Definition: wined3d.h:194
@ WINED3DFMT_B8G8R8A8_UNORM
Definition: wined3d.h:244
@ WINED3DFMT_R8G8B8A8_SNORM
Definition: wined3d.h:188
@ WINED3DFMT_D16_LOCKABLE
Definition: wined3d.h:148
@ WINED3DFMT_R10G11B11_SNORM
Definition: wined3d.h:143
@ WINED3DFMT_S1_UINT_D15_UNORM
Definition: wined3d.h:150
@ WINED3DFMT_B2G3R3A8_UNORM
Definition: wined3d.h:132
@ WINED3DFMT_L8A8_UNORM
Definition: wined3d.h:139
@ WINED3DFMT_L4A4_UNORM
Definition: wined3d.h:140
@ WINED3DFMT_B8G8R8X8_UNORM
Definition: wined3d.h:245
@ WINED3DFMT_B5G5R5X1_UNORM
Definition: wined3d.h:129
@ WINED3DFMT_D16_UNORM
Definition: wined3d.h:212
@ WINED3DFMT_L8_UNORM
Definition: wined3d.h:138
@ WINED3DFMT_R8G8_SNORM
Definition: wined3d.h:208
@ WINED3DFMT_UNKNOWN
Definition: wined3d.h:127
@ WINED3DFMT_R5G5_SNORM_L6_UNORM
Definition: wined3d.h:141
@ WINED3DFMT_B8G8R8_UNORM
Definition: wined3d.h:128
@ WINED3DFMT_R32_UINT
Definition: wined3d.h:199
@ WINED3DFMT_B5G5R5A1_UNORM
Definition: wined3d.h:243
@ WINED3DFMT_R10G10B10_SNORM_A2_UNORM
Definition: wined3d.h:147
@ WINED3DFMT_D32_UNORM
Definition: wined3d.h:149
@ WINED3DFMT_R8G8_SNORM_L8X8_UNORM
Definition: wined3d.h:142
@ WINED3DFMT_B5G6R5_UNORM
Definition: wined3d.h:242
@ WINED3DFMT_S4X4_UINT_D24_UNORM
Definition: wined3d.h:152
@ WINED3DFMT_P8_UINT
Definition: wined3d.h:137
@ WINED3DFMT_R16_UINT
Definition: wined3d.h:214
@ WINED3DFMT_DF24
Definition: wined3d.h:281
@ WINED3DFMT_A8_UNORM
Definition: wined3d.h:222
@ WINED3DFMT_B4G4R4X4_UNORM
Definition: wined3d.h:133
@ WINED3DFMT_D24_UNORM_S8_UINT
Definition: wined3d.h:202
@ WINED3DFMT_P8_UINT_A8_UNORM
Definition: wined3d.h:136
#define WINED3D_BIND_DEPTH_STENCIL
Definition: wined3d.h:915
#define WINED3DLINECAPS_ANTIALIAS
Definition: wined3d.h:1073
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:3006
#define WINED3D_RESOURCE_ACCESS_MAP_R
Definition: wined3d.h:53
#define WINED3DUSAGE_MANAGED
Definition: wined3d.h:938
#define WINED3DPRASTERCAPS_DEPTHBIAS
Definition: wined3d.h:1222
static bool wined3d_bound_range(unsigned int start, unsigned int count, unsigned int limit)
Definition: wined3d.h:2995
#define WINED3D_MAP_WRITE
Definition: wined3d.h:956
wined3d_feature_level
Definition: wined3d.h:98
@ WINED3D_FEATURE_LEVEL_8
Definition: wined3d.h:103
@ WINED3D_FEATURE_LEVEL_7
Definition: wined3d.h:102
@ WINED3D_FEATURE_LEVEL_6
Definition: wined3d.h:101
@ WINED3D_FEATURE_LEVEL_5
Definition: wined3d.h:100
#define WINED3D_BIND_RENDER_TARGET
Definition: wined3d.h:914
static void wined3d_streaming_buffer_cleanup(struct wined3d_streaming_buffer *buffer)
Definition: wined3d.h:2943
wined3d_transform_state
Definition: wined3d.h:666
#define WINED3DERR_INVALIDCALL
Definition: wined3d.h:44
#define WINED3D_BIND_INDEX_BUFFER
Definition: wined3d.h:910
#define WINED3D_RESOURCE_ACCESS_MAP_W
Definition: wined3d.h:54
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:544
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:539
#define S_FALSE
Definition: winerror.h:3451
#define E_NOINTERFACE
Definition: winerror.h:3479
unsigned char BYTE
Definition: xxhash.c:193