ReactOS 0.4.17-dev-923-g4c9a150
async.c
Go to the documentation of this file.
1/*
2 * Copyright 2016 Andrey Gusev
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19#define COBJMACROS
20#include "d3d10_1.h"
21#include "d3dx10.h"
22#include "d3dcompiler.h"
23#include "dxhelpers.h"
24#include "winternl.h"
25
26#include "wine/debug.h"
27#include "wine/list.h"
28
30
32{
33 ID3DX10DataLoader ID3DX10DataLoader_iface;
34
35 union
36 {
37 struct
38 {
41 struct
42 {
44 HRSRC rsrc;
46 } u;
47 void *data;
49};
50
51static inline struct asyncdataloader *impl_from_ID3DX10DataLoader(ID3DX10DataLoader *iface)
52{
54}
55
56static HRESULT WINAPI memorydataloader_Load(ID3DX10DataLoader *iface)
57{
58 TRACE("iface %p.\n", iface);
59 return S_OK;
60}
61
62static HRESULT WINAPI memorydataloader_Decompress(ID3DX10DataLoader *iface, void **data, SIZE_T *size)
63{
65
66 TRACE("iface %p, data %p, size %p.\n", iface, data, size);
67
68 *data = loader->data;
69 *size = loader->size;
70
71 return S_OK;
72}
73
74static HRESULT WINAPI memorydataloader_Destroy(ID3DX10DataLoader *iface)
75{
77
78 TRACE("iface %p.\n", iface);
79
80 free(loader);
81 return S_OK;
82}
83
84static const ID3DX10DataLoaderVtbl memorydataloadervtbl =
85{
89};
90
92{
93 DWORD read_len;
95 BOOL ret;
96
101
103 *data = malloc(*size);
104 if (!*data)
105 {
107 return E_OUTOFMEMORY;
108 }
109
110 ret = ReadFile(file, *data, *size, &read_len, NULL);
112 if (!ret || read_len != *size)
113 {
114 WARN("Failed to read file contents.\n");
115 free(*data);
116 return E_FAIL;
117 }
118 return S_OK;
119}
120
121static HRESULT WINAPI filedataloader_Load(ID3DX10DataLoader *iface)
122{
124 void *data;
125 DWORD size;
126 HRESULT hr;
127
128 TRACE("iface %p.\n", iface);
129
130 /* Always buffer file contents, even if Load() was already called. */
131 if (FAILED((hr = load_file(loader->u.file.path, &data, &size))))
132 return hr;
133
134 free(loader->data);
135 loader->data = data;
136 loader->size = size;
137
138 return S_OK;
139}
140
141static HRESULT WINAPI filedataloader_Decompress(ID3DX10DataLoader *iface, void **data, SIZE_T *size)
142{
144
145 TRACE("iface %p, data %p, size %p.\n", iface, data, size);
146
147 if (!loader->data)
148 return E_FAIL;
149
150 *data = loader->data;
151 *size = loader->size;
152
153 return S_OK;
154}
155
156static HRESULT WINAPI filedataloader_Destroy(ID3DX10DataLoader *iface)
157{
159
160 TRACE("iface %p.\n", iface);
161
162 free(loader->u.file.path);
163 free(loader->data);
164 free(loader);
165
166 return S_OK;
167}
168
169static const ID3DX10DataLoaderVtbl filedataloadervtbl =
170{
174};
175
177{
178 if (!(*rsrc = FindResourceA(module, resource, (const char *)RT_RCDATA)))
179 *rsrc = FindResourceA(module, resource, (const char *)RT_BITMAP);
180 if (!*rsrc)
181 {
182 WARN("Failed to find resource.\n");
184 }
185 return S_OK;
186}
187
189{
190 if (!(*rsrc = FindResourceW(module, resource, (const WCHAR *)RT_RCDATA)))
192 if (!*rsrc)
193 {
194 WARN("Failed to find resource.\n");
196 }
197 return S_OK;
198}
199
201{
202 HGLOBAL hglobal;
203
204 if (!(*size = SizeofResource(module, rsrc)))
206 if (!(hglobal = LoadResource(module, rsrc)))
208 if (!(*data = LockResource(hglobal)))
210 return S_OK;
211}
212
214{
215 HRESULT hr;
216 HRSRC rsrc;
217
219 return hr;
220 return load_resource(module, rsrc, data, size);
221}
222
224{
225 HRESULT hr;
226 HRSRC rsrc;
227
229 return hr;
230 return load_resource(module, rsrc, data, size);
231}
232
233static HRESULT WINAPI resourcedataloader_Load(ID3DX10DataLoader *iface)
234{
236
237 TRACE("iface %p.\n", iface);
238
239 if (loader->data)
240 return S_OK;
241
242 return load_resource(loader->u.resource.module, loader->u.resource.rsrc,
243 &loader->data, &loader->size);
244}
245
246static HRESULT WINAPI resourcedataloader_Decompress(ID3DX10DataLoader *iface, void **data, SIZE_T *size)
247{
249
250 TRACE("iface %p, data %p, size %p.\n", iface, data, size);
251
252 if (!loader->data)
253 return E_FAIL;
254
255 *data = loader->data;
256 *size = loader->size;
257
258 return S_OK;
259}
260
261static HRESULT WINAPI resourcedataloader_Destroy(ID3DX10DataLoader *iface)
262{
264
265 TRACE("iface %p.\n", iface);
266
267 free(loader);
268
269 return S_OK;
270}
271
272static const ID3DX10DataLoaderVtbl resourcedataloadervtbl =
273{
277};
278
280{
281 ID3DX10DataProcessor ID3DX10DataProcessor_iface;
283};
284
285static inline struct texture_info_processor *impl_from_ID3DX10DataProcessor(ID3DX10DataProcessor *iface)
286{
288}
289
290static HRESULT WINAPI texture_info_processor_Process(ID3DX10DataProcessor *iface, void *data, SIZE_T size)
291{
293
294 TRACE("iface %p, data %p, size %Iu.\n", iface, data, size);
295 return get_image_info(data, size, processor->info);
296}
297
298static HRESULT WINAPI texture_info_processor_CreateDeviceObject(ID3DX10DataProcessor *iface, void **object)
299{
300 TRACE("iface %p, object %p.\n", iface, object);
301 return S_OK;
302}
303
304static HRESULT WINAPI texture_info_processor_Destroy(ID3DX10DataProcessor *iface)
305{
307
308 TRACE("iface %p.\n", iface);
309
310 free(processor);
311 return S_OK;
312}
313
314static ID3DX10DataProcessorVtbl texture_info_processor_vtbl =
315{
319};
320
322{
323 ID3DX10DataProcessor ID3DX10DataProcessor_iface;
327};
328
329static inline struct texture_processor *texture_processor_from_ID3DX10DataProcessor(ID3DX10DataProcessor *iface)
330{
332}
333
334static HRESULT WINAPI texture_processor_Process(ID3DX10DataProcessor *iface, void *data, SIZE_T size)
335{
337
338 TRACE("iface %p, data %p, size %Iu.\n", iface, data, size);
339
340 if (processor->resource_data)
341 {
342 WARN("Called multiple times.\n");
343 free(processor->resource_data);
344 processor->resource_data = NULL;
345 }
346 return load_texture_data(data, size, &processor->load_info, &processor->resource_data);
347}
348
349static HRESULT WINAPI texture_processor_CreateDeviceObject(ID3DX10DataProcessor *iface, void **object)
350{
352
353 TRACE("iface %p, object %p.\n", iface, object);
354
355 if (!processor->resource_data)
356 return E_FAIL;
357
358 return create_d3d_texture(processor->device, &processor->load_info,
359 processor->resource_data, (ID3D10Resource **)object);
360}
361
362static HRESULT WINAPI texture_processor_Destroy(ID3DX10DataProcessor *iface)
363{
365
366 TRACE("iface %p.\n", iface);
367
368 ID3D10Device_Release(processor->device);
369 free(processor->resource_data);
370 free(processor);
371 return S_OK;
372}
373
374static ID3DX10DataProcessorVtbl texture_processor_vtbl =
375{
379};
380
381HRESULT WINAPI D3DX10CompileFromMemory(const char *data, SIZE_T data_size, const char *filename,
382 const D3D10_SHADER_MACRO *defines, ID3D10Include *include, const char *entry_point,
383 const char *target, UINT sflags, UINT eflags, ID3DX10ThreadPump *pump, ID3D10Blob **shader,
385{
386 TRACE("data %s, data_size %Iu, filename %s, defines %p, include %p, entry_point %s, target %s, "
387 "sflags %#x, eflags %#x, pump %p, shader %p, error_messages %p, hresult %p.\n",
388 debugstr_an(data, data_size), data_size, debugstr_a(filename), defines, include,
389 debugstr_a(entry_point), debugstr_a(target), sflags, eflags, pump, shader,
390 error_messages, hresult);
391
392 if (pump)
393 FIXME("Unimplemented ID3DX10ThreadPump handling.\n");
394
395 return D3DCompile(data, data_size, filename, defines, include, entry_point, target,
397}
398
400 ID3D10Include *include, const char *profile, UINT hlslflags, UINT fxflags, ID3D10Device *device,
401 ID3DX10ThreadPump *pump, ID3D10EffectPool **effectpool, ID3D10Blob **errors, HRESULT *hresult)
402{
403 FIXME("filename %s, defines %p, include %p, profile %s, hlslflags %#x, fxflags %#x, device %p, "
404 "pump %p, effectpool %p, errors %p, hresult %p, stub!\n",
405 debugstr_a(filename), defines, include, debugstr_a(profile), hlslflags, fxflags, device,
406 pump, effectpool, errors, hresult);
407
408 return E_NOTIMPL;
409}
410
412 ID3D10Include *include, const char *profile, UINT hlslflags, UINT fxflags, ID3D10Device *device,
413 ID3DX10ThreadPump *pump, ID3D10EffectPool **effectpool, ID3D10Blob **errors, HRESULT *hresult)
414{
415 FIXME("filename %s, defines %p, include %p, profile %s, hlslflags %#x, fxflags %#x, device %p, "
416 "pump %p, effectpool %p, errors %p, hresult %p, stub!\n",
417 debugstr_w(filename), defines, include, debugstr_a(profile), hlslflags, fxflags, device,
418 pump, effectpool, errors, hresult);
419
420 return E_NOTIMPL;
421}
422
423HRESULT WINAPI D3DX10CreateAsyncMemoryLoader(const void *data, SIZE_T data_size, ID3DX10DataLoader **loader)
424{
425 struct asyncdataloader *object;
426
427 TRACE("data %p, data_size %Iu, loader %p.\n", data, data_size, loader);
428
429 if (!data || !loader)
430 return E_FAIL;
431
432 object = calloc(1, sizeof(*object));
433 if (!object)
434 return E_OUTOFMEMORY;
435
436 object->ID3DX10DataLoader_iface.lpVtbl = &memorydataloadervtbl;
437 object->data = (void *)data;
438 object->size = data_size;
439
440 *loader = &object->ID3DX10DataLoader_iface;
441
442 return S_OK;
443}
444
446{
447 WCHAR *filename_w;
448 HRESULT hr;
449 int len;
450
451 TRACE("filename %s, loader %p.\n", debugstr_a(filename), loader);
452
453 if (!filename || !loader)
454 return E_FAIL;
455
457 filename_w = malloc(len * sizeof(*filename_w));
458 MultiByteToWideChar(CP_ACP, 0, filename, -1, filename_w, len);
459
461
462 free(filename_w);
463
464 return hr;
465}
466
468{
469 struct asyncdataloader *object;
470
471 TRACE("filename %s, loader %p.\n", debugstr_w(filename), loader);
472
473 if (!filename || !loader)
474 return E_FAIL;
475
476 object = calloc(1, sizeof(*object));
477 if (!object)
478 return E_OUTOFMEMORY;
479
480 object->ID3DX10DataLoader_iface.lpVtbl = &filedataloadervtbl;
481 object->u.file.path = malloc((lstrlenW(filename) + 1) * sizeof(WCHAR));
482 if (!object->u.file.path)
483 {
484 free(object);
485 return E_OUTOFMEMORY;
486 }
487 lstrcpyW(object->u.file.path, filename);
488 object->data = NULL;
489 object->size = 0;
490
491 *loader = &object->ID3DX10DataLoader_iface;
492
493 return S_OK;
494}
495
497{
498 struct asyncdataloader *object;
499 HRSRC rsrc;
500 HRESULT hr;
501
502 TRACE("module %p, resource %s, loader %p.\n", module, debugstr_a(resource), loader);
503
504 if (!loader)
505 return E_FAIL;
506
507 object = calloc(1, sizeof(*object));
508 if (!object)
509 return E_OUTOFMEMORY;
510
512 {
513 free(object);
514 return hr;
515 }
516
517 object->ID3DX10DataLoader_iface.lpVtbl = &resourcedataloadervtbl;
518 object->u.resource.module = module;
519 object->u.resource.rsrc = rsrc;
520 object->data = NULL;
521 object->size = 0;
522
523 *loader = &object->ID3DX10DataLoader_iface;
524
525 return S_OK;
526}
527
529{
530 struct asyncdataloader *object;
531 HRSRC rsrc;
532 HRESULT hr;
533
534 TRACE("module %p, resource %s, loader %p.\n", module, debugstr_w(resource), loader);
535
536 if (!loader)
537 return E_FAIL;
538
539 object = calloc(1, sizeof(*object));
540 if (!object)
541 return E_OUTOFMEMORY;
542
544 {
545 free(object);
546 return hr;
547 }
548
549 object->ID3DX10DataLoader_iface.lpVtbl = &resourcedataloadervtbl;
550 object->u.resource.module = module;
551 object->u.resource.rsrc = rsrc;
552 object->data = NULL;
553 object->size = 0;
554
555 *loader = &object->ID3DX10DataLoader_iface;
556
557 return S_OK;
558}
559
561{
563
564 TRACE("info %p, processor %p.\n", info, processor);
565
566 if (!processor)
567 return E_INVALIDARG;
568
569 object = malloc(sizeof(*object));
570 if (!object)
571 return E_OUTOFMEMORY;
572
573 object->ID3DX10DataProcessor_iface.lpVtbl = &texture_info_processor_vtbl;
574 object->info = info;
575
576 *processor = &object->ID3DX10DataProcessor_iface;
577 return S_OK;
578}
579
581 D3DX10_IMAGE_LOAD_INFO *load_info, ID3DX10DataProcessor **processor)
582{
584
585 TRACE("device %p, load_info %p, processor %p.\n", device, load_info, processor);
586
587 if (!device || !processor)
588 return E_INVALIDARG;
589
590 object = calloc(1, sizeof(*object));
591 if (!object)
592 return E_OUTOFMEMORY;
593
594 object->ID3DX10DataProcessor_iface.lpVtbl = &texture_processor_vtbl;
595 object->device = device;
596 ID3D10Device_AddRef(device);
597 init_load_info(load_info, &object->load_info);
598
599 *processor = &object->ID3DX10DataProcessor_iface;
600 return S_OK;
601}
602
604{
605 struct list entry;
606
607 ID3DX10DataLoader *loader;
608 ID3DX10DataProcessor *processor;
610 void **object;
611};
612
613static inline void work_item_free(struct work_item *work_item, BOOL cancel)
614{
617 if (cancel && work_item->result)
620}
621
622#define THREAD_PUMP_EXITING UINT_MAX
624{
625 ID3DX10ThreadPump ID3DX10ThreadPump_iface;
627
629
630 SRWLOCK io_lock;
631 CONDITION_VARIABLE io_cv;
632 unsigned int io_count;
634
635 SRWLOCK proc_lock;
636 CONDITION_VARIABLE proc_cv;
637 unsigned int proc_count;
639
640 SRWLOCK device_lock;
641 unsigned int device_count;
643
644 unsigned int thread_count;
646};
647
648static inline struct thread_pump *impl_from_ID3DX10ThreadPump(ID3DX10ThreadPump *iface)
649{
651}
652
653static HRESULT WINAPI thread_pump_QueryInterface(ID3DX10ThreadPump *iface, REFIID riid, void **out)
654{
655 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
656
657 if (IsEqualGUID(riid, &IID_ID3DX10ThreadPump)
659 {
661 *out = iface;
662 return S_OK;
663 }
664
665 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
666 *out = NULL;
667 return E_NOINTERFACE;
668}
669
670static ULONG WINAPI thread_pump_AddRef(ID3DX10ThreadPump *iface)
671{
674
675 TRACE("%p increasing refcount to %lu.\n", iface, refcount);
676
677 return refcount;
678}
679
680static ULONG WINAPI thread_pump_Release(ID3DX10ThreadPump *iface)
681{
684 struct work_item *item, *next;
685 struct list list;
686 unsigned int i;
687
688 TRACE("%p decreasing refcount to %lu.\n", iface, refcount);
689
690 if (!refcount)
691 {
696
701
705
706 for (i = 0; i < thread_pump->thread_count; ++i)
707 {
708 if (!thread_pump->threads[i])
709 continue;
710
713 }
714
715 list_init(&list);
720 {
721 list_remove(&item->entry);
723 }
724
726 }
727
728 return refcount;
729}
730
731static HRESULT WINAPI thread_pump_AddWorkItem(ID3DX10ThreadPump *iface, ID3DX10DataLoader *loader,
732 ID3DX10DataProcessor *processor, HRESULT *result, void **object)
733{
735 struct work_item *work_item;
736
737 TRACE("iface %p, loader %p, processor %p, result %p, object %p.\n",
738 iface, loader, processor, result, object);
739
740 work_item = malloc(sizeof(*work_item));
741 if (!work_item)
742 return E_OUTOFMEMORY;
743
748
749 if (object)
750 *object = NULL;
751
758 return S_OK;
759}
760
761static UINT WINAPI thread_pump_GetWorkItemCount(ID3DX10ThreadPump *iface)
762{
764 UINT ret;
765
766 TRACE("iface %p.\n", iface);
767
771 return ret;
772}
773
774static HRESULT WINAPI thread_pump_WaitForAllItems(ID3DX10ThreadPump *iface)
775{
777 HRESULT hr;
778 LONG v;
779
780 TRACE("iface %p.\n", iface);
781
782 for (;;)
783 {
785 return hr;
786
789 {
791 continue;
792 }
795 if (!v)
796 break;
797
799 }
800
801 return S_OK;
802}
803
805{
807 struct work_item *work_item;
808 HRESULT hr;
809 UINT i;
810
811 TRACE("iface %p, count %u.\n", iface, count);
812
813 for (i = 0; i < count; ++i)
814 {
817 {
819 break;
820 }
821
826
828 if (work_item->result)
829 *work_item->result = hr;
831 }
832
833 return S_OK;
834}
835
836static void purge_list(struct list *list, LONG *count)
837{
838 struct work_item *work_item;
839
840 while (!list_empty(list))
841 {
845
848 }
849}
850
851static HRESULT WINAPI thread_pump_PurgeAllItems(ID3DX10ThreadPump *iface)
852{
854 LONG v;
855
856 TRACE("iface %p.\n", iface);
857
858 for (;;)
859 {
864
869
875 if (!v)
876 break;
877
879 }
880
881 return S_OK;
882}
883
884static HRESULT WINAPI thread_pump_GetQueueStatus(ID3DX10ThreadPump *iface,
885 UINT *io_queue, UINT *process_queue, UINT *device_queue)
886{
888
889 TRACE("iface %p, io_queue %p, process_queue %p, device_queue %p.\n",
890 iface, io_queue, process_queue, device_queue);
891
893 *process_queue = thread_pump->proc_count;
895 return S_OK;
896}
897
898static const ID3DX10ThreadPumpVtbl thread_pump_vtbl =
899{
909};
910
912{
913 struct thread_pump *thread_pump = arg;
914 struct work_item *work_item;
915 HRESULT hr;
916
917 TRACE("%p thread started.\n", thread_pump);
918
919 for (;;)
920 {
922
923 while (!thread_pump->io_count)
925
927 {
929 return 0;
930 }
931
936
938 {
939 if (work_item->result)
940 *work_item->result = hr;
944 continue;
945 }
946
949 {
952 return 0;
953 }
954
959 }
960 return 0;
961}
962
964{
965 struct thread_pump *thread_pump = arg;
966 struct work_item *work_item;
967 SIZE_T size;
968 void *data;
969 HRESULT hr;
970
971 TRACE("%p thread started.\n", thread_pump);
972
973 for (;;)
974 {
976
977 while (!thread_pump->proc_count)
979
981 {
983 return 0;
984 }
985
990
992 {
993 if (work_item->result)
994 *work_item->result = hr;
998 continue;
999 }
1000
1002 {
1004 return 0;
1005 }
1006
1008 {
1009 if (work_item->result)
1010 *work_item->result = hr;
1014 continue;
1015 }
1016
1019 {
1022 return 0;
1023 }
1024
1030 }
1031 return 0;
1032}
1033
1034HRESULT WINAPI D3DX10CreateThreadPump(UINT io_threads, UINT proc_threads, ID3DX10ThreadPump **pump)
1035{
1036 struct thread_pump *object;
1037 unsigned int i;
1038
1039 TRACE("io_threads %u, proc_threads %u, pump %p.\n", io_threads, proc_threads, pump);
1040
1041 if (io_threads >= 1024 || proc_threads >= 1024)
1042 return E_FAIL;
1043
1044 if (!io_threads)
1045 io_threads = 1;
1046 if (!proc_threads)
1047 {
1049
1051 proc_threads = info.dwNumberOfProcessors;
1052 }
1053
1054 if (!(object = calloc(1, FIELD_OFFSET(struct thread_pump, threads[io_threads + proc_threads]))))
1055 return E_OUTOFMEMORY;
1056
1057 object->ID3DX10ThreadPump_iface.lpVtbl = &thread_pump_vtbl;
1058 object->refcount = 1;
1059 InitializeSRWLock(&object->io_lock);
1061 list_init(&object->io_queue);
1062 InitializeSRWLock(&object->proc_lock);
1064 list_init(&object->proc_queue);
1065 InitializeSRWLock(&object->device_lock);
1066 list_init(&object->device_queue);
1067 object->thread_count = io_threads + proc_threads;
1068
1069 for (i = 0; i < object->thread_count; ++i)
1070 {
1071 object->threads[i] = CreateThread(NULL, 0, i < io_threads ? io_thread : proc_thread, object, 0, NULL);
1072 if (!object->threads[i])
1073 {
1074 ID3DX10ThreadPump_Release(&object->ID3DX10ThreadPump_iface);
1075 return E_FAIL;
1076 }
1077 }
1078
1079 *pump = &object->ID3DX10ThreadPump_iface;
1080 return S_OK;
1081}
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
static void list_remove(struct list_entry *entry)
Definition: list.h:90
static int list_empty(struct list_entry *head)
Definition: list.h:58
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
static void list_init(struct list_entry *head)
Definition: list.h:51
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
const GUID IID_IUnknown
Definition: list.h:39
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude * include
Definition: asm.c:31
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude UINT ID3DBlob ID3DBlob ** error_messages
Definition: asm.c:32
static SIZE_T const char const D3D_SHADER_MACRO * defines
Definition: asm.c:31
HRESULT WINAPI D3DCompile(const void *data, SIZE_T data_size, const char *filename, const D3D_SHADER_MACRO *defines, ID3DInclude *include, const char *entrypoint, const char *target, UINT sflags, UINT eflags, ID3DBlob **shader, ID3DBlob **error_messages)
Definition: compiler.c:639
@ D3DX10_ERR_INVALID_DATA
Definition: d3dx10.h:46
#define ID3DX10DataProcessor_CreateDeviceObject(p, a)
Definition: d3dx10core.h:108
#define ID3DX10ThreadPump_Release(p)
Definition: d3dx10core.h:139
#define ID3DX10DataLoader_Load(p)
Definition: d3dx10core.h:86
#define ID3DX10DataLoader_Decompress(p, a, b)
Definition: d3dx10core.h:87
#define ID3DX10DataProcessor_Process(p, a, b)
Definition: d3dx10core.h:107
#define ID3DX10DataLoader_Destroy(p)
Definition: d3dx10core.h:88
#define ID3DX10ThreadPump_AddRef(p)
Definition: d3dx10core.h:138
#define ID3DX10ThreadPump_ProcessDeviceWorkItems(p, a)
Definition: d3dx10core.h:144
#define ID3DX10DataProcessor_Destroy(p)
Definition: d3dx10core.h:109
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
HRESULT hr
Definition: delayimp.cpp:582
HRESULT WINAPI D3DX10CreateAsyncTextureProcessor(ID3D10Device *device, D3DX10_IMAGE_LOAD_INFO *load_info, ID3DX10DataProcessor **processor)
Definition: async.c:580
HRESULT WINAPI D3DX10CreateThreadPump(UINT io_threads, UINT proc_threads, ID3DX10ThreadPump **pump)
Definition: async.c:1034
static ID3DX10DataProcessorVtbl texture_processor_vtbl
Definition: async.c:374
HRESULT WINAPI D3DX10CreateEffectPoolFromFileW(const WCHAR *filename, const D3D10_SHADER_MACRO *defines, ID3D10Include *include, const char *profile, UINT hlslflags, UINT fxflags, ID3D10Device *device, ID3DX10ThreadPump *pump, ID3D10EffectPool **effectpool, ID3D10Blob **errors, HRESULT *hresult)
Definition: async.c:411
static HRESULT WINAPI filedataloader_Destroy(ID3DX10DataLoader *iface)
Definition: async.c:156
static struct asyncdataloader * impl_from_ID3DX10DataLoader(ID3DX10DataLoader *iface)
Definition: async.c:51
static HRESULT WINAPI texture_processor_Process(ID3DX10DataProcessor *iface, void *data, SIZE_T size)
Definition: async.c:334
static const ID3DX10ThreadPumpVtbl thread_pump_vtbl
Definition: async.c:898
static HRESULT WINAPI resourcedataloader_Destroy(ID3DX10DataLoader *iface)
Definition: async.c:261
HRESULT load_resourceA(HMODULE module, const char *resource, void **data, DWORD *size)
Definition: async.c:213
static const ID3DX10DataLoaderVtbl resourcedataloadervtbl
Definition: async.c:272
HRESULT WINAPI D3DX10CreateAsyncResourceLoaderA(HMODULE module, const char *resource, ID3DX10DataLoader **loader)
Definition: async.c:496
static HRESULT WINAPI memorydataloader_Load(ID3DX10DataLoader *iface)
Definition: async.c:56
static HRESULT WINAPI thread_pump_GetQueueStatus(ID3DX10ThreadPump *iface, UINT *io_queue, UINT *process_queue, UINT *device_queue)
Definition: async.c:884
static HRESULT load_resource_initA(HMODULE module, const char *resource, HRSRC *rsrc)
Definition: async.c:176
static HRESULT WINAPI texture_info_processor_Process(ID3DX10DataProcessor *iface, void *data, SIZE_T size)
Definition: async.c:290
static HRESULT WINAPI texture_processor_CreateDeviceObject(ID3DX10DataProcessor *iface, void **object)
Definition: async.c:349
static struct texture_processor * texture_processor_from_ID3DX10DataProcessor(ID3DX10DataProcessor *iface)
Definition: async.c:329
static HRESULT WINAPI thread_pump_ProcessDeviceWorkItems(ID3DX10ThreadPump *iface, UINT count)
Definition: async.c:804
static HRESULT WINAPI filedataloader_Decompress(ID3DX10DataLoader *iface, void **data, SIZE_T *size)
Definition: async.c:141
HRESULT WINAPI D3DX10CreateAsyncFileLoaderW(const WCHAR *filename, ID3DX10DataLoader **loader)
Definition: async.c:467
HRESULT WINAPI D3DX10CreateAsyncMemoryLoader(const void *data, SIZE_T data_size, ID3DX10DataLoader **loader)
Definition: async.c:423
HRESULT WINAPI D3DX10CreateAsyncFileLoaderA(const char *filename, ID3DX10DataLoader **loader)
Definition: async.c:445
static UINT WINAPI thread_pump_GetWorkItemCount(ID3DX10ThreadPump *iface)
Definition: async.c:761
static HRESULT WINAPI texture_info_processor_CreateDeviceObject(ID3DX10DataProcessor *iface, void **object)
Definition: async.c:298
static ID3DX10DataProcessorVtbl texture_info_processor_vtbl
Definition: async.c:314
#define THREAD_PUMP_EXITING
Definition: async.c:622
static void purge_list(struct list *list, LONG *count)
Definition: async.c:836
static HRESULT WINAPI texture_info_processor_Destroy(ID3DX10DataProcessor *iface)
Definition: async.c:304
static const ID3DX10DataLoaderVtbl memorydataloadervtbl
Definition: async.c:84
static HRESULT WINAPI memorydataloader_Decompress(ID3DX10DataLoader *iface, void **data, SIZE_T *size)
Definition: async.c:62
static void work_item_free(struct work_item *work_item, BOOL cancel)
Definition: async.c:613
static ULONG WINAPI thread_pump_AddRef(ID3DX10ThreadPump *iface)
Definition: async.c:670
HRESULT WINAPI D3DX10CreateEffectPoolFromFileA(const char *filename, const D3D10_SHADER_MACRO *defines, ID3D10Include *include, const char *profile, UINT hlslflags, UINT fxflags, ID3D10Device *device, ID3DX10ThreadPump *pump, ID3D10EffectPool **effectpool, ID3D10Blob **errors, HRESULT *hresult)
Definition: async.c:399
static DWORD WINAPI proc_thread(void *arg)
Definition: async.c:963
HRESULT WINAPI D3DX10CompileFromMemory(const char *data, SIZE_T data_size, const char *filename, const D3D10_SHADER_MACRO *defines, ID3D10Include *include, const char *entry_point, const char *target, UINT sflags, UINT eflags, ID3DX10ThreadPump *pump, ID3D10Blob **shader, ID3D10Blob **error_messages, HRESULT *hresult)
Definition: async.c:381
static HRESULT WINAPI memorydataloader_Destroy(ID3DX10DataLoader *iface)
Definition: async.c:74
static HRESULT load_resource_initW(HMODULE module, const WCHAR *resource, HRSRC *rsrc)
Definition: async.c:188
HRESULT load_file(const WCHAR *path, void **data, DWORD *size)
Definition: async.c:91
static HRESULT WINAPI thread_pump_PurgeAllItems(ID3DX10ThreadPump *iface)
Definition: async.c:851
static HRESULT WINAPI filedataloader_Load(ID3DX10DataLoader *iface)
Definition: async.c:121
HRESULT WINAPI D3DX10CreateAsyncTextureInfoProcessor(D3DX10_IMAGE_INFO *info, ID3DX10DataProcessor **processor)
Definition: async.c:560
static DWORD WINAPI io_thread(void *arg)
Definition: async.c:911
static HRESULT WINAPI thread_pump_QueryInterface(ID3DX10ThreadPump *iface, REFIID riid, void **out)
Definition: async.c:653
static struct thread_pump * impl_from_ID3DX10ThreadPump(ID3DX10ThreadPump *iface)
Definition: async.c:648
HRESULT load_resourceW(HMODULE module, const WCHAR *resource, void **data, DWORD *size)
Definition: async.c:223
static HRESULT WINAPI texture_processor_Destroy(ID3DX10DataProcessor *iface)
Definition: async.c:362
HRESULT WINAPI D3DX10CreateAsyncResourceLoaderW(HMODULE module, const WCHAR *resource, ID3DX10DataLoader **loader)
Definition: async.c:528
static HRESULT WINAPI resourcedataloader_Decompress(ID3DX10DataLoader *iface, void **data, SIZE_T *size)
Definition: async.c:246
static HRESULT WINAPI thread_pump_AddWorkItem(ID3DX10ThreadPump *iface, ID3DX10DataLoader *loader, ID3DX10DataProcessor *processor, HRESULT *result, void **object)
Definition: async.c:731
static struct texture_info_processor * impl_from_ID3DX10DataProcessor(ID3DX10DataProcessor *iface)
Definition: async.c:285
static const ID3DX10DataLoaderVtbl filedataloadervtbl
Definition: async.c:169
static HRESULT WINAPI thread_pump_WaitForAllItems(ID3DX10ThreadPump *iface)
Definition: async.c:774
static HRESULT WINAPI resourcedataloader_Load(ID3DX10DataLoader *iface)
Definition: async.c:233
static ULONG WINAPI thread_pump_Release(ID3DX10ThreadPump *iface)
Definition: async.c:680
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
#define CP_ACP
Definition: compat.h:109
#define OPEN_EXISTING
Definition: compat.h:775
#define ReadFile(a, b, c, d, e)
Definition: compat.h:742
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
static __inline const char * debugstr_an(const char *s, int n)
Definition: compat.h:55
#define GENERIC_READ
Definition: compat.h:135
#define CreateFileW
Definition: compat.h:741
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define lstrcpyW
Definition: compat.h:749
#define MultiByteToWideChar
Definition: compat.h:110
#define FILE_SHARE_READ
Definition: compat.h:136
#define lstrlenW
Definition: compat.h:750
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:331
VOID WINAPI GetSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
Definition: sysinfo.c:143
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
VOID WINAPI AcquireSRWLockExclusive(PSRWLOCK Lock)
Definition: sync.c:8
VOID WINAPI ReleaseSRWLockExclusive(PSRWLOCK Lock)
Definition: sync.c:36
VOID WINAPI InitializeSRWLock(PSRWLOCK Lock)
Definition: sync.c:29
VOID WINAPI WakeAllConditionVariable(PCONDITION_VARIABLE ConditionVariable)
Definition: sync.c:91
BOOL WINAPI SleepConditionVariableSRW(PCONDITION_VARIABLE ConditionVariable, PSRWLOCK Lock, DWORD Timeout, ULONG Flags)
Definition: sync.c:75
VOID WINAPI InitializeConditionVariable(PCONDITION_VARIABLE ConditionVariable)
Definition: sync.c:22
VOID WINAPI WakeConditionVariable(PCONDITION_VARIABLE ConditionVariable)
Definition: sync.c:98
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
#define UINT_MAX
Definition: limits.h:27
static void list_move_tail(struct list_head *list, struct list_head *head)
Definition: list.h:122
return ret
Definition: mutex.c:147
#define INFINITE
Definition: serial.h:102
HRESULT load_texture_data(const void *data, SIZE_T size, D3DX10_IMAGE_LOAD_INFO *load_info, D3D10_SUBRESOURCE_DATA **resource_data)
Definition: texture.c:822
HRESULT create_d3d_texture(ID3D10Device *device, D3DX10_IMAGE_LOAD_INFO *load_info, D3D10_SUBRESOURCE_DATA *resource_data, ID3D10Resource **texture)
Definition: texture.c:1027
HRESULT get_image_info(const void *data, SIZE_T size, D3DX10_IMAGE_INFO *img_info)
Definition: texture.c:426
void init_load_info(const D3DX10_IMAGE_LOAD_INFO *load_info, D3DX10_IMAGE_LOAD_INFO *out)
Definition: texture.c:730
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
const GLdouble * v
Definition: gl.h:2040
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLsizeiptr size
Definition: glext.h:5919
GLuint shader
Definition: glext.h:6030
GLuint64EXT * result
Definition: glext.h:11304
GLenum GLsizei len
Definition: glext.h:6722
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
unsigned int UINT
Definition: sysinfo.c:13
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
const char * filename
Definition: ioapi.h:137
uint32_t entry
Definition: isohybrid.c:63
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_a
Definition: kernel32.h:31
#define profile
Definition: kernel32.h:12
#define debugstr_w
Definition: kernel32.h:32
#define load_resource(a, b, c)
Definition: font.c:46
static HANDLE ULONG_PTR DWORD threads
Definition: process.c:83
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define RT_BITMAP
Definition: pedump.c:364
short WCHAR
Definition: pedump.c:58
#define RT_RCDATA
Definition: pedump.c:372
long LONG
Definition: pedump.c:60
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
static unsigned __int64 next
Definition: rand_nt.c:6
#define calloc
Definition: rosglue.h:14
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:242
#define TRACE(s)
Definition: solgame.cpp:4
DWORD size
Definition: async.c:48
struct asyncdataloader::@274::@276 resource
union asyncdataloader::@274 u
WCHAR * path
Definition: async.c:39
HRSRC rsrc
Definition: async.c:44
ID3DX10DataLoader ID3DX10DataLoader_iface
Definition: async.c:33
struct asyncdataloader::@274::@275 file
HMODULE module
Definition: async.c:43
void * data
Definition: async.c:47
Definition: devices.h:37
Definition: fci.c:123
Definition: list.h:15
Definition: loader.c:72
Definition: tools.h:99
ID3DX10DataProcessor ID3DX10DataProcessor_iface
Definition: async.c:281
D3DX10_IMAGE_INFO * info
Definition: async.c:282
D3DX10_IMAGE_LOAD_INFO load_info
Definition: async.c:325
ID3D10Device * device
Definition: async.c:324
ID3DX10DataProcessor ID3DX10DataProcessor_iface
Definition: async.c:323
D3D10_SUBRESOURCE_DATA * resource_data
Definition: async.c:326
SRWLOCK io_lock
Definition: async.c:630
ID3DX10ThreadPump ID3DX10ThreadPump_iface
Definition: async.c:625
CONDITION_VARIABLE proc_cv
Definition: async.c:636
LONG refcount
Definition: async.c:626
unsigned int device_count
Definition: async.c:641
struct list io_queue
Definition: async.c:633
LONG processing_count
Definition: async.c:628
struct list device_queue
Definition: async.c:642
SRWLOCK proc_lock
Definition: async.c:635
SRWLOCK device_lock
Definition: async.c:640
unsigned int thread_count
Definition: async.c:644
unsigned int io_count
Definition: async.c:632
CONDITION_VARIABLE io_cv
Definition: async.c:631
unsigned int proc_count
Definition: async.c:637
struct list proc_queue
Definition: async.c:638
HANDLE threads[1]
Definition: async.c:645
void ** object
Definition: async.c:610
struct list entry
Definition: async.c:605
ID3DX10DataLoader * loader
Definition: async.c:607
ID3DX10DataProcessor * processor
Definition: async.c:608
HRESULT * result
Definition: async.c:609
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define LIST_ENTRY(type)
Definition: queue.h:175
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
void * arg
Definition: msvc.h:10
#define WINAPI
Definition: msvc.h:6
NTSYSAPI NTSTATUS WINAPI RtlWaitOnAddress(const void *, const void *, SIZE_T, const LARGE_INTEGER *)
NTSYSAPI void WINAPI RtlWakeAddressAll(const void *)
#define S_FALSE
Definition: winerror.h:3451
#define E_NOINTERFACE
Definition: winerror.h:3479
#define D3D10_ERROR_FILE_NOT_FOUND
Definition: winerror.h:7117