ReactOS 0.4.17-dev-966-gf06eace
cs.c
Go to the documentation of this file.
1/*
2 * Copyright 2013 Henri Verbeet for CodeWeavers
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#include "wined3d_private.h"
20#include "wined3d_gl.h"
21
27
28static NTSTATUS (WINAPI *pNtAlertThreadByThreadId)(HANDLE tid);
29static NTSTATUS (WINAPI *pNtWaitForAlertByThreadId)(void *addr, const LARGE_INTEGER *timeout);
30
31#define WINED3D_INITIAL_CS_SIZE 4096
32
34{
36 unsigned int sub_resource_idx;
37 struct wined3d_bo *bo;
41};
42
44{
46 unsigned int flags;
47};
48
50{
52
54
56 void *data;
57
60
63
66
67 /* List of command lists queued for execution on this command list. We might
68 * be the only thing holding a pointer to another command list, so we need
69 * to hold a reference here (and in wined3d_deferred_context) as well. */
72
75};
76
78{
79 struct wined3d_client_resource *client = &resource->client;
80
81 client->addr.buffer_object = CLIENT_BO_DISCARDED;
82 client->addr.addr = NULL;
83}
84
86{
87 struct wined3d_client_resource *client = &resource->client;
88
89 memset(&client->addr, 0, sizeof(client->addr));
90}
91
93{
145};
146
148{
149 size_t size;
151};
152
154{
156};
157
159{
165 unsigned int swap_interval;
167};
168
170{
173 unsigned int rt_count;
177 float depth;
179 unsigned int rect_count;
181};
182
184{
187 unsigned int sub_resource_idx;
190};
191
193{
196};
197
199{
202 unsigned int patch_vertex_count;
204};
205
207{
209};
210
212{
216};
217
219{
221 unsigned int viewport_count;
223};
224
226{
228 unsigned int rect_count;
230};
231
233{
235 unsigned int start_idx;
236 unsigned int count;
238};
239
241{
244};
245
247{
250};
251
253{
255 unsigned int start_idx;
256 unsigned int count;
258};
259
261{
264};
265
267{
271 unsigned int offset;
272};
273
275{
278 unsigned int start_idx;
279 unsigned int count;
281};
282
284{
287 unsigned int bind_index;
289};
290
292{
298};
299
301{
304 unsigned int start_idx;
305 unsigned int count;
307};
308
310{
313 unsigned int start_idx;
314 unsigned int count;
315 struct
316 {
318 unsigned int initial_count;
319 } uavs[1];
320};
321
323{
326 unsigned int start_idx;
327 unsigned int count;
329};
330
332{
336};
337
339{
343 unsigned int sample_mask;
344};
345
347{
350 unsigned int stencil_ref;
351};
352
354{
357};
358
360{
362 bool enable;
364};
365
367{
371};
372
374{
379};
380
382{
386};
387
389{
393};
394
396{
399};
400
402{
404 unsigned int idx;
406};
407
409{
412};
413
415{
418 unsigned int start_idx;
419 unsigned int count;
421};
422
424{
427};
428
430{
433 void *object;
434};
435
437{
441};
442
444{
447};
448
450{
453};
454
456{
459 unsigned int sub_resource_idx;
460 void **map_ptr;
461 const struct wined3d_box *box;
464};
465
467{
470 unsigned int sub_resource_idx;
472};
473
475{
478 size_t size;
480};
481
483{
494};
495
497{
500 unsigned int sub_resource_idx;
502 struct upload_bo bo;
503 unsigned int row_pitch, slice_pitch;
504};
505
507{
510 unsigned int layer;
511};
512
514{
518 bool fp;
519};
520
522{
525 unsigned int offset;
527};
528
530{
533};
534
536{
539};
540
542{
544};
545
547 size_t size, enum wined3d_cs_queue_id queue_id)
548{
549 return context->ops->require_space(context, size, queue_id);
550}
551
553 enum wined3d_cs_queue_id queue_id)
554{
555 context->ops->submit(context, queue_id);
556}
557
559 enum wined3d_cs_queue_id queue_id)
560{
561 context->ops->finish(context, queue_id);
562}
563
566{
567 context->ops->reference_resource(context, resource);
568}
569
571{
572 return CONTAINING_RECORD(context, struct wined3d_cs, c);
573}
574
575static const char *debug_cs_op(enum wined3d_cs_op op)
576{
577 switch (op)
578 {
579#define WINED3D_TO_STR(type) case type: return #type
631#undef WINED3D_TO_STR
632 }
633 return wine_dbg_sprintf("UNKNOWN_OP(%#x)", op);
634}
635
637{
638 struct wined3d_cs_packet *packet = (struct wined3d_cs_packet *)&data[*offset & mask];
639
640 *offset += offsetof(struct wined3d_cs_packet, data[packet->size]);
641
642 return packet;
643}
644
645static void wined3d_cs_exec_nop(struct wined3d_cs *cs, const void *data)
646{
647}
648
649static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
650{
651 static LARGE_INTEGER freq;
652
653 struct wined3d_texture *logo_texture, *cursor_texture, *back_buffer;
654 struct wined3d_rendertarget_view *dsv = cs->state.fb.depth_stencil;
655 const struct wined3d_cs_present *op = data;
656 const struct wined3d_swapchain_desc *desc;
657 struct wined3d_swapchain *swapchain;
658 LONGLONG elapsed_time;
660
661 if (!freq.QuadPart)
663
664 swapchain = op->swapchain;
665 desc = &swapchain->state.desc;
666 back_buffer = swapchain->back_buffers[0];
667 wined3d_swapchain_set_window(swapchain, op->dst_window_override);
668
669 if ((logo_texture = swapchain->device->logo_texture))
670 {
671 RECT rect = {0, 0, logo_texture->resource.width, logo_texture->resource.height};
672
673 /* Blit the logo into the upper left corner of the back-buffer. */
674 wined3d_device_context_blt(&cs->c, back_buffer, 0, &rect, logo_texture, 0,
676 }
677
678 if ((cursor_texture = swapchain->device->cursor_texture)
679 && swapchain->device->bCursorVisible && !swapchain->device->hardwareCursor)
680 {
681 RECT dst_rect =
682 {
683 swapchain->device->xScreenSpace - swapchain->device->xHotSpot,
684 swapchain->device->yScreenSpace - swapchain->device->yHotSpot,
685 swapchain->device->xScreenSpace + swapchain->device->cursorWidth - swapchain->device->xHotSpot,
686 swapchain->device->yScreenSpace + swapchain->device->cursorHeight - swapchain->device->yHotSpot,
687 };
688 RECT src_rect =
689 {
690 0, 0, cursor_texture->resource.width, cursor_texture->resource.height
691 };
692 const RECT clip_rect = {0, 0, back_buffer->resource.width, back_buffer->resource.height};
693
694 TRACE("Rendering the software cursor.\n");
695
696 if (desc->windowed)
697 MapWindowPoints(NULL, swapchain->win_handle, (POINT *)&dst_rect, 2);
698 if (wined3d_clip_blit(&clip_rect, &dst_rect, &src_rect))
699 wined3d_device_context_blt(&cs->c, back_buffer, 0, &dst_rect, cursor_texture, 0,
701 }
702
703 swapchain->swapchain_ops->swapchain_present(swapchain, &op->src_rect, &op->dst_rect, op->swap_interval, op->flags);
704
705 /* Discard buffers if the swap effect allows it. */
706 back_buffer = swapchain->back_buffers[desc->backbuffer_count - 1];
707 if (desc->swap_effect == WINED3D_SWAP_EFFECT_DISCARD || desc->swap_effect == WINED3D_SWAP_EFFECT_FLIP_DISCARD)
709
710 if (dsv && dsv->resource->type != WINED3D_RTYPE_BUFFER)
711 {
713
716 }
717
718 if (TRACE_ON(frametime))
719 {
721 if (swapchain->last_present_time.QuadPart)
722 {
723 elapsed_time = time.QuadPart - swapchain->last_present_time.QuadPart;
724 TRACE_(frametime)("Frame duration %u μs.\n", (unsigned int)(elapsed_time * 1000000 / freq.QuadPart));
725 }
726 swapchain->last_present_time = time;
727 }
728 if (TRACE_ON(fps))
729 {
731 ++swapchain->frames;
732
733 /* every 1.5 seconds */
734 if (time - swapchain->prev_time > 1500)
735 {
736 TRACE_(fps)("%p @ approx %.2ffps\n",
737 swapchain, 1000.0 * swapchain->frames / (time - swapchain->prev_time));
738 swapchain->prev_time = time;
739 swapchain->frames = 0;
740 }
741 }
742
743 InterlockedDecrement(&cs->pending_presents);
744 if (InterlockedCompareExchange(&cs->waiting_for_present, FALSE, TRUE))
745 SetEvent(cs->present_event);
746}
747
749 const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override,
750 unsigned int swap_interval, uint32_t flags)
751{
752 struct wined3d_cs_present *op;
753 unsigned int i;
754 LONG pending;
755
757
759 op->opcode = WINED3D_CS_OP_PRESENT;
760 op->dst_window_override = dst_window_override;
761 op->swapchain = swapchain;
762 op->src_rect = *src_rect;
763 op->dst_rect = *dst_rect;
764 op->swap_interval = swap_interval;
765 op->flags = flags;
766
767 pending = InterlockedIncrement(&cs->pending_presents);
768
769 wined3d_resource_reference(&swapchain->front_buffer->resource);
770 for (i = 0; i < swapchain->state.desc.backbuffer_count; ++i)
771 {
772 wined3d_resource_reference(&swapchain->back_buffers[i]->resource);
773 }
774
776
777 /* Limit input latency by limiting the number of presents that we can get
778 * ahead of the worker thread. */
779 while (pending >= swapchain->max_frame_latency)
780 {
781 InterlockedExchange(&cs->waiting_for_present, TRUE);
782
783 pending = InterlockedCompareExchange(&cs->pending_presents, 0, 0);
784 if (pending >= swapchain->max_frame_latency || !InterlockedCompareExchange(&cs->waiting_for_present, FALSE, TRUE))
785 {
786 TRACE_(d3d_perf)("Reached latency limit (%u frames), blocking to wait.\n", swapchain->max_frame_latency);
788 WaitForSingleObject(cs->present_event, INFINITE);
790 TRACE_(d3d_perf)("Woken up from the wait.\n");
791 }
792 }
793}
794
795static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
796{
797 struct wined3d_device *device = cs->c.device;
798 const struct wined3d_cs_clear *op = data;
799
800 device->blitter->ops->blitter_clear(device->blitter, device, op->rt_count, &op->fb,
801 op->rect_count, op->rects, &op->draw_rect, op->flags, &op->color, op->depth, op->stencil);
802}
803
805 uint32_t flags, const struct wined3d_color *color, float depth, DWORD stencil)
806{
807 const struct wined3d_state *state = cs->c.state;
808 const struct wined3d_viewport *vp = &state->viewports[0];
810 struct wined3d_cs_clear *op;
811 unsigned int rt_count, i;
812
813 rt_count = flags & WINED3DCLEAR_TARGET ? cs->c.device->adapter->d3d_info.limits.max_rt_count : 0;
814
817 op->opcode = WINED3D_CS_OP_CLEAR;
819 op->rt_count = rt_count;
820 op->fb = state->fb;
821 SetRect(&op->draw_rect, vp->x, vp->y, vp->x + vp->width, vp->y + vp->height);
822 if (state->rasterizer_state && state->rasterizer_state->desc.scissor)
823 IntersectRect(&op->draw_rect, &op->draw_rect, &state->scissor_rects[0]);
824 op->color = *color;
825 op->depth = depth;
826 op->stencil = stencil;
827 op->rect_count = rect_count;
828 memcpy(op->rects, rects, sizeof(*rects) * rect_count);
829
830 for (i = 0; i < rt_count; ++i)
831 {
832 if ((view = state->fb.render_targets[i]))
834 }
836 {
837 view = state->fb.depth_stencil;
839 }
840
842}
843
845 struct wined3d_rendertarget_view *view, const RECT *rect, unsigned int flags,
846 const struct wined3d_color *color, float depth, unsigned int stencil)
847{
848 struct wined3d_cs_clear *op;
849 size_t size;
850
853
854 op->opcode = WINED3D_CS_OP_CLEAR;
857 {
858 op->rt_count = 1;
859 op->fb.render_targets[0] = view;
860 op->fb.depth_stencil = NULL;
861 op->color = *color;
862 }
863 else
864 {
865 op->rt_count = 0;
866 op->fb.render_targets[0] = NULL;
867 op->fb.depth_stencil = view;
868 op->depth = depth;
869 op->stencil = stencil;
870 }
871 SetRect(&op->draw_rect, 0, 0, view->width, view->height);
872 op->rect_count = 1;
873 op->rects[0] = *rect;
874
876
880}
881
883{
885 struct wined3d_box box;
886
887 box.left = op->rect.left;
888 box.right = op->rect.right;
889 box.top = op->rect.top;
890 box.bottom = op->rect.bottom;
891 box.front = 0;
892 box.back = 1;
893 cpu_blitter_clear_texture(op->texture, op->sub_resource_idx, &box, &op->color);
894}
895
897 struct wined3d_texture *texture, unsigned int sub_resource_idx, const RECT *rect,
898 unsigned int flags, const struct wined3d_color *color)
899{
901
902 TRACE("context %p, texture %p, sub_resource_idx %u, rect %s, flags %#x, color %s.\n",
904
905 if (rect)
906 {
907 struct wined3d_box b = {rect->left, rect->top, rect->right, rect->bottom, 0, 1};
908 HRESULT hr;
909
910 if (FAILED(hr = wined3d_resource_check_box_dimensions(&texture->resource, sub_resource_idx, &b)))
911 return hr;
912 }
913
915
918 op->texture = texture;
919 op->sub_resource_idx = sub_resource_idx;
920 op->color = *color;
921
922 if (rect)
923 {
924 op->rect = *rect;
925 }
926 else
927 {
928 unsigned int level_idx = sub_resource_idx % texture->level_count;
929
930 op->rect.left = 0;
931 op->rect.top = 0;
932 op->rect.right = wined3d_texture_get_level_width(texture, level_idx);
933 op->rect.bottom = wined3d_texture_get_level_height(texture, level_idx);
934 }
935
937
941
943 return S_OK;
944}
945
946static void reference_shader_resources(struct wined3d_device_context *context, unsigned int shader_mask)
947{
948 const struct wined3d_state *state = context->state;
951 struct wined3d_shader *shader;
952 unsigned int i, j;
953
954 for (i = 0; i < WINED3D_SHADER_TYPE_COUNT; ++i)
955 {
956 if (!(shader_mask & (1u << i)))
957 continue;
958
959 if (!(shader = state->shader[i]))
960 {
962 {
963 for (j = 0; j < WINED3D_MAX_FFP_TEXTURES; ++j)
964 {
965 if ((view = state->shader_resource_view[WINED3D_SHADER_TYPE_PIXEL][j]))
967 }
968 }
969 continue;
970 }
971
972 for (j = 0; j < WINED3D_MAX_CBS; ++j)
973 {
974 if (state->cb[i][j].buffer)
976 }
977
978 for (j = 0; j < shader->reg_maps.sampler_map.count; ++j)
979 {
980 entry = &shader->reg_maps.sampler_map.entries[j];
981
982 if (!(view = state->shader_resource_view[i][entry->resource_idx]))
983 continue;
984
986 }
987 }
988}
989
991 const struct wined3d_shader *shader, struct wined3d_unordered_access_view * const *views)
992{
993 unsigned int i;
994
995 if (!shader)
996 return;
997
998 for (i = 0; i < MAX_UNORDERED_ACCESS_VIEWS; ++i)
999 {
1000 if (!shader->reg_maps.uav_resource_info[i].type)
1001 continue;
1002
1003 if (!views[i])
1004 continue;
1005
1007 }
1008}
1009
1010static void wined3d_cs_exec_dispatch(struct wined3d_cs *cs, const void *data)
1011{
1012 const struct wined3d_cs_dispatch *op = data;
1013 struct wined3d_state *state = &cs->state;
1014
1015 if (!state->shader[WINED3D_SHADER_TYPE_COMPUTE])
1016 WARN("No compute shader bound, skipping dispatch.\n");
1017 else
1018 cs->c.device->adapter->adapter_ops->adapter_dispatch_compute(cs->c.device, state, &op->parameters);
1019}
1020
1022{
1023 const struct wined3d_state *state = context->state;
1024
1027 state->unordered_access_view[WINED3D_PIPELINE_COMPUTE]);
1028}
1029
1031 unsigned int group_count_x, unsigned int group_count_y, unsigned int group_count_z)
1032{
1033 struct wined3d_cs_dispatch *op;
1034
1037 op->opcode = WINED3D_CS_OP_DISPATCH;
1038 op->parameters.indirect = FALSE;
1039 op->parameters.u.direct.group_count_x = group_count_x;
1040 op->parameters.u.direct.group_count_y = group_count_y;
1041 op->parameters.u.direct.group_count_z = group_count_z;
1042
1044
1047}
1048
1050 struct wined3d_buffer *buffer, unsigned int offset)
1051{
1052 struct wined3d_cs_dispatch *op;
1053
1056 op->opcode = WINED3D_CS_OP_DISPATCH;
1057 op->parameters.indirect = TRUE;
1058 op->parameters.u.indirect.buffer = buffer;
1059 op->parameters.u.indirect.offset = offset;
1060
1063
1066}
1067
1068static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
1069{
1070 const struct wined3d_d3d_info *d3d_info = &cs->c.device->adapter->d3d_info;
1071 const struct wined3d_shader *geometry_shader;
1072 struct wined3d_device *device = cs->c.device;
1073 int base_vertex_idx, load_base_vertex_idx;
1074 struct wined3d_state *state = &cs->state;
1075 const struct wined3d_cs_draw *op = data;
1076 unsigned int i;
1077
1078 base_vertex_idx = 0;
1079 if (!op->parameters.indirect)
1080 {
1081 const struct wined3d_direct_draw_parameters *direct = &op->parameters.u.direct;
1082
1083 if (op->parameters.indexed && d3d_info->draw_base_vertex_offset)
1085 else if (!op->parameters.indexed)
1086 base_vertex_idx = direct->start_idx;
1087 }
1088
1089 /* ARB_draw_indirect always supports a base vertex offset. */
1090 if (!op->parameters.indirect && !d3d_info->draw_base_vertex_offset)
1091 load_base_vertex_idx = op->parameters.u.direct.base_vertex_idx;
1092 else
1093 load_base_vertex_idx = 0;
1094
1095 if (state->base_vertex_index != base_vertex_idx)
1096 {
1097 state->base_vertex_index = base_vertex_idx;
1098 for (i = 0; i < device->context_count; ++i)
1099 device->contexts[i]->constant_update_mask |= WINED3D_SHADER_CONST_BASE_VERTEX_ID;
1100 }
1101
1102 if (state->load_base_vertex_index != load_base_vertex_idx)
1103 {
1104 state->load_base_vertex_index = load_base_vertex_idx;
1106 }
1107
1108 if (state->primitive_type != op->primitive_type)
1109 {
1110 if ((geometry_shader = state->shader[WINED3D_SHADER_TYPE_GEOMETRY]) && !geometry_shader->function)
1112 if (state->primitive_type == WINED3D_PT_POINTLIST || op->primitive_type == WINED3D_PT_POINTLIST)
1113 {
1116 }
1117 state->primitive_type = op->primitive_type;
1118 for (i = 0; i < device->context_count; ++i)
1119 device->contexts[i]->update_primitive_type = 1;
1120 }
1121 if (state->patch_vertex_count != op->patch_vertex_count)
1122 {
1123 for (i = 0; i < device->context_count; ++i)
1124 device->contexts[i]->update_patch_vertex_count = 1;
1125 }
1126 state->patch_vertex_count = op->patch_vertex_count;
1127
1128 cs->c.device->adapter->adapter_ops->adapter_draw_primitive(cs->c.device, state, &op->parameters);
1129}
1130
1132 BOOL indexed, const struct wined3d_d3d_info *d3d_info)
1133{
1134 const struct wined3d_state *state = context->state;
1135 unsigned int i;
1136
1137 if (indexed)
1138 wined3d_device_context_reference_resource(context, &state->index_buffer->resource);
1139 for (i = 0; i < ARRAY_SIZE(state->streams); ++i)
1140 {
1141 if (state->streams[i].buffer)
1142 wined3d_device_context_reference_resource(context, &state->streams[i].buffer->resource);
1143 }
1144 for (i = 0; i < ARRAY_SIZE(state->stream_output); ++i)
1145 {
1146 if (state->stream_output[i].buffer)
1147 wined3d_device_context_reference_resource(context, &state->stream_output[i].buffer->resource);
1148 }
1149 for (i = 0; i < d3d_info->limits.max_rt_count; ++i)
1150 {
1151 if (state->fb.render_targets[i])
1152 wined3d_device_context_reference_resource(context, state->fb.render_targets[i]->resource);
1153 }
1154 for (i = 0; i < WINED3D_PUSH_CONSTANTS_COUNT; ++i)
1155 {
1156 if (context->device->push_constants[i])
1157 wined3d_device_context_reference_resource(context, &context->device->push_constants[i]->resource);
1158 }
1159 if (state->fb.depth_stencil)
1160 wined3d_device_context_reference_resource(context, state->fb.depth_stencil->resource);
1163 state->unordered_access_view[WINED3D_PIPELINE_GRAPHICS]);
1164}
1165
1167 enum wined3d_primitive_type primitive_type, unsigned int patch_vertex_count, int base_vertex_idx,
1168 unsigned int start_idx, unsigned int index_count, unsigned int start_instance, unsigned int instance_count,
1169 bool indexed)
1170{
1171 const struct wined3d_d3d_info *d3d_info = &context->device->adapter->d3d_info;
1172 struct wined3d_cs_draw *op;
1173
1175 op->opcode = WINED3D_CS_OP_DRAW;
1176 op->primitive_type = primitive_type;
1177 op->patch_vertex_count = patch_vertex_count;
1178 op->parameters.indirect = FALSE;
1179 op->parameters.u.direct.base_vertex_idx = base_vertex_idx;
1180 op->parameters.u.direct.start_idx = start_idx;
1181 op->parameters.u.direct.index_count = index_count;
1182 op->parameters.u.direct.start_instance = start_instance;
1183 op->parameters.u.direct.instance_count = instance_count;
1184 op->parameters.indexed = indexed;
1185
1187
1189}
1190
1192 struct wined3d_buffer *buffer, unsigned int offset, bool indexed)
1193{
1194 const struct wined3d_d3d_info *d3d_info = &context->device->adapter->d3d_info;
1195 const struct wined3d_state *state = context->state;
1196 struct wined3d_cs_draw *op;
1197
1200 op->opcode = WINED3D_CS_OP_DRAW;
1201 op->primitive_type = state->primitive_type;
1202 op->patch_vertex_count = state->patch_vertex_count;
1203 op->parameters.indirect = TRUE;
1204 op->parameters.u.indirect.buffer = buffer;
1205 op->parameters.u.indirect.offset = offset;
1206 op->parameters.indexed = indexed;
1207
1210
1213}
1214
1215static void wined3d_cs_exec_flush(struct wined3d_cs *cs, const void *data)
1216{
1217 struct wined3d_context *context;
1218
1219 TRACE_(d3d_perf)("Flushing adapter.\n");
1220 context = context_acquire(cs->c.device, NULL, 0);
1221 cs->c.device->adapter->adapter_ops->adapter_flush_context(context);
1223}
1224
1226{
1228 struct wined3d_cs_flush *op;
1229
1231 op->opcode = WINED3D_CS_OP_FLUSH;
1232
1234 cs->queries_flushed = TRUE;
1235}
1236
1237static void wined3d_cs_exec_set_predication(struct wined3d_cs *cs, const void *data)
1238{
1239 const struct wined3d_cs_set_predication *op = data;
1240
1241 cs->state.predicate = op->predicate;
1242 cs->state.predicate_value = op->value;
1243}
1244
1247{
1249
1252 op->predicate = predicate;
1253 op->value = value;
1254
1256}
1257
1258static void wined3d_cs_exec_set_viewports(struct wined3d_cs *cs, const void *data)
1259{
1260 const struct wined3d_cs_set_viewports *op = data;
1261
1262 if (op->viewport_count)
1263 memcpy(cs->state.viewports, op->viewports, op->viewport_count * sizeof(*op->viewports));
1264 else
1265 memset(cs->state.viewports, 0, sizeof(*cs->state.viewports));
1266 cs->state.viewport_count = op->viewport_count;
1268}
1269
1271 const struct wined3d_viewport *viewports)
1272{
1274
1278 memcpy(op->viewports, viewports, viewport_count * sizeof(*viewports));
1279 op->viewport_count = viewport_count;
1280
1282}
1283
1284static void wined3d_cs_exec_set_scissor_rects(struct wined3d_cs *cs, const void *data)
1285{
1286 const struct wined3d_cs_set_scissor_rects *op = data;
1287
1288 if (op->rect_count)
1289 memcpy(cs->state.scissor_rects, op->rects, op->rect_count * sizeof(*op->rects));
1290 else
1291 SetRectEmpty(cs->state.scissor_rects);
1292 cs->state.scissor_rect_count = op->rect_count;
1294}
1295
1297 unsigned int rect_count, const RECT *rects)
1298{
1300
1304 memcpy(op->rects, rects, rect_count * sizeof(*rects));
1305 op->rect_count = rect_count;
1306
1308}
1309
1311{
1313 struct wined3d_device *device = cs->c.device;
1314 unsigned int i;
1315
1316 for (i = 0; i < op->count; ++i)
1317 {
1318 struct wined3d_rendertarget_view *prev = cs->state.fb.render_targets[op->start_idx + i];
1319 struct wined3d_rendertarget_view *view = op->views[i];
1320 bool prev_alpha_swizzle, curr_alpha_swizzle;
1321 bool prev_srgb_write, curr_srgb_write;
1322
1323 cs->state.fb.render_targets[op->start_idx + i] = view;
1324
1325 prev_alpha_swizzle = prev && prev->format->id == WINED3DFMT_A8_UNORM;
1326 curr_alpha_swizzle = view && view->format->id == WINED3DFMT_A8_UNORM;
1327 if (prev_alpha_swizzle != curr_alpha_swizzle)
1329
1330 if (!(device->adapter->d3d_info.wined3d_creation_flags & WINED3D_SRGB_READ_WRITE_CONTROL)
1331 || cs->state.render_states[WINED3D_RS_SRGBWRITEENABLE])
1332 {
1333 prev_srgb_write = prev && prev->format_caps & WINED3D_FORMAT_CAP_SRGB_WRITE;
1334 curr_srgb_write = view && view->format_caps & WINED3D_FORMAT_CAP_SRGB_WRITE;
1335 if (prev_srgb_write != curr_srgb_write)
1337 }
1338 }
1339
1341}
1342
1344 unsigned int start_idx, unsigned int count, struct wined3d_rendertarget_view *const *views)
1345{
1347
1351 op->start_idx = start_idx;
1352 op->count = count;
1353 memcpy(op->views, views, count * sizeof(*views));
1354
1356}
1357
1359{
1361 struct wined3d_device *device = cs->c.device;
1362 struct wined3d_rendertarget_view *prev;
1363
1364 if ((prev = cs->state.fb.depth_stencil) && prev->resource->type != WINED3D_RTYPE_BUFFER)
1365 {
1366 struct wined3d_texture *prev_texture = texture_from_resource(prev->resource);
1367
1368 if (device->swapchains[0]->state.desc.flags & WINED3D_SWAPCHAIN_DISCARD_DEPTHSTENCIL
1369 || prev_texture->flags & WINED3D_TEXTURE_DISCARD)
1372 }
1373
1374 cs->state.fb.depth_stencil = op->view;
1375
1376 if (!prev != !op->view)
1377 {
1378 /* Swapping NULL / non NULL depth stencil affects the depth and tests */
1382 }
1383 else if (prev)
1384 {
1385 if (prev->format->depth_bias_scale != op->view->format->depth_bias_scale)
1387 if (prev->format->stencil_size != op->view->format->stencil_size)
1389 }
1390
1392}
1393
1396{
1398
1401 op->view = view;
1402
1404}
1405
1407{
1409
1410 cs->state.vertex_declaration = op->declaration;
1412}
1413
1416{
1418
1421 op->declaration = declaration;
1422
1424}
1425
1426static void wined3d_cs_exec_set_stream_sources(struct wined3d_cs *cs, const void *data)
1427{
1428 const struct wined3d_cs_set_stream_sources *op = data;
1429 unsigned int i;
1430
1431 for (i = 0; i < op->count; ++i)
1432 {
1433 struct wined3d_buffer *prev = cs->state.streams[op->start_idx + i].buffer;
1434 struct wined3d_buffer *buffer = op->streams[i].buffer;
1435
1436 if (buffer)
1437 ++buffer->resource.bind_count;
1438 if (prev)
1439 --prev->resource.bind_count;
1440 }
1441
1442 memcpy(&cs->state.streams[op->start_idx], op->streams, op->count * sizeof(*op->streams));
1444}
1445
1447 unsigned int start_idx, unsigned int count, const struct wined3d_stream_state *streams)
1448{
1450
1454 op->start_idx = start_idx;
1455 op->count = count;
1456 memcpy(op->streams, streams, count * sizeof(*streams));
1457
1459}
1460
1461static void wined3d_cs_exec_set_stream_outputs(struct wined3d_cs *cs, const void *data)
1462{
1463 const struct wined3d_cs_set_stream_outputs *op = data;
1464 unsigned int i;
1465
1466 for (i = 0; i < WINED3D_MAX_STREAM_OUTPUT_BUFFERS; ++i)
1467 {
1468 struct wined3d_buffer *prev = cs->state.stream_output[i].buffer;
1469 struct wined3d_buffer *buffer = op->outputs[i].buffer;
1470
1471 if (buffer)
1472 ++buffer->resource.bind_count;
1473 if (prev)
1474 --prev->resource.bind_count;
1475 }
1476
1477 memcpy(cs->state.stream_output, op->outputs, sizeof(op->outputs));
1479}
1480
1483{
1485
1488 memcpy(op->outputs, outputs, sizeof(op->outputs));
1489
1491}
1492
1493static void wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void *data)
1494{
1495 const struct wined3d_cs_set_index_buffer *op = data;
1496 struct wined3d_buffer *prev;
1497
1498 prev = cs->state.index_buffer;
1499 cs->state.index_buffer = op->buffer;
1500 cs->state.index_format = op->format_id;
1501 cs->state.index_offset = op->offset;
1502
1503 if (op->buffer)
1504 ++op->buffer->resource.bind_count;
1505 if (prev)
1506 --prev->resource.bind_count;
1507
1509}
1510
1512 enum wined3d_format_id format_id, unsigned int offset)
1513{
1515
1518 op->buffer = buffer;
1519 op->format_id = format_id;
1520 op->offset = offset;
1521
1523}
1524
1526{
1527 const struct wined3d_cs_set_constant_buffers *op = data;
1528 unsigned int i;
1529
1530 for (i = 0; i < op->count; ++i)
1531 {
1532 struct wined3d_buffer *prev = cs->state.cb[op->type][op->start_idx + i].buffer;
1533 struct wined3d_buffer *buffer = op->buffers[i].buffer;
1534
1535 cs->state.cb[op->type][op->start_idx + i] = op->buffers[i];
1536
1537 if (buffer)
1538 ++buffer->resource.bind_count;
1539 if (prev)
1540 --prev->resource.bind_count;
1541 }
1542
1544}
1545
1547 enum wined3d_shader_type type, unsigned int start_idx, unsigned int count,
1549{
1551
1555 op->type = type;
1556 op->start_idx = start_idx;
1557 op->count = count;
1558 memcpy(op->buffers, buffers, count * sizeof(*buffers));
1559
1561}
1562
1564 struct wined3d_shader_resource_view *prev, const struct wined3d_d3d_info *d3d_info)
1565{
1566 unsigned int old_usage, new_usage, old_caps, new_caps;
1567 const struct wined3d_format *old_format, *new_format;
1568
1569 if (!prev)
1570 return true;
1571
1572 /* 1.x pixel shaders need to be recompiled based on the resource type. */
1573 old_usage = prev->resource->usage;
1574 new_usage = view->resource->usage;
1575 if (view->resource->type != prev->resource->type
1576 || ((old_usage & WINED3DUSAGE_LEGACY_CUBEMAP) != (new_usage & WINED3DUSAGE_LEGACY_CUBEMAP)))
1577 return true;
1578
1579 old_format = prev->resource->format;
1580 new_format = view->resource->format;
1581 old_caps = prev->resource->format_caps;
1582 new_caps = view->resource->format_caps;
1583 if ((old_caps & WINED3D_FORMAT_CAP_SHADOW) != (new_caps & WINED3D_FORMAT_CAP_SHADOW))
1584 return true;
1585
1586 if (is_same_fixup(old_format->color_fixup, new_format->color_fixup))
1587 return false;
1588
1589 if (can_use_texture_swizzle(d3d_info, new_format) && can_use_texture_swizzle(d3d_info, old_format))
1590 return false;
1591
1592 return true;
1593}
1594
1595static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data)
1596{
1597 const struct wined3d_d3d_info *d3d_info = &cs->c.device->adapter->d3d_info;
1598 const struct wined3d_cs_set_texture *op = data;
1599 struct wined3d_shader_resource_view *prev;
1600
1601 prev = cs->state.shader_resource_view[op->shader_type][op->bind_index];
1602 cs->state.shader_resource_view[op->shader_type][op->bind_index] = op->view;
1603
1604 if (op->view)
1605 {
1606 ++op->view->resource->bind_count;
1607
1608 if (op->shader_type == WINED3D_SHADER_TYPE_PIXEL)
1609 {
1610 if (texture_binding_might_invalidate_ps(op->view, prev, d3d_info))
1612 }
1613 }
1614
1615 if (prev)
1616 --prev->resource->bind_count;
1617
1619}
1620
1622 enum wined3d_shader_type shader_type, unsigned int bind_index, struct wined3d_shader_resource_view *view)
1623{
1624 struct wined3d_cs_set_texture *op;
1625
1627 op->opcode = WINED3D_CS_OP_SET_TEXTURE;
1628 op->shader_type = shader_type;
1629 op->bind_index = bind_index;
1630 op->view = view;
1631
1633}
1634
1636{
1638 unsigned int i;
1639
1640 for (i = 0; i < op->count; ++i)
1641 {
1642 struct wined3d_shader_resource_view *prev = cs->state.shader_resource_view[op->type][op->start_idx + i];
1643 struct wined3d_shader_resource_view *view = op->views[i];
1644
1645 cs->state.shader_resource_view[op->type][op->start_idx + i] = view;
1646
1647 if (view)
1648 ++view->resource->bind_count;
1649 if (prev)
1650 --prev->resource->bind_count;
1651 }
1652
1653 if (op->type != WINED3D_SHADER_TYPE_COMPUTE)
1655 else
1657}
1658
1660 enum wined3d_shader_type type, unsigned int start_idx, unsigned int count,
1661 struct wined3d_shader_resource_view *const *views)
1662{
1664
1668 op->type = type;
1669 op->start_idx = start_idx;
1670 op->count = count;
1671 memcpy(op->views, views, count * sizeof(*views));
1672
1674}
1675
1677{
1679 unsigned int i;
1680
1681 for (i = 0; i < op->count; ++i)
1682 {
1683 struct wined3d_unordered_access_view *prev = cs->state.unordered_access_view[op->pipeline][op->start_idx + i];
1684 struct wined3d_unordered_access_view *view = op->uavs[i].view;
1685 unsigned int initial_count = op->uavs[i].initial_count;
1686
1687 cs->state.unordered_access_view[op->pipeline][op->start_idx + i] = view;
1688
1689 if (view)
1690 ++view->resource->bind_count;
1691 if (prev)
1692 --prev->resource->bind_count;
1693
1694 if (view && initial_count != ~0u)
1696 }
1697
1699}
1700
1702 enum wined3d_pipeline pipeline, unsigned int start_idx, unsigned int count,
1703 struct wined3d_unordered_access_view *const *views, const unsigned int *initial_counts)
1704{
1706 unsigned int i;
1707
1711 op->pipeline = pipeline;
1712 op->start_idx = start_idx;
1713 op->count = count;
1714 for (i = 0; i < count; ++i)
1715 {
1716 op->uavs[i].view = views[i];
1717 op->uavs[i].initial_count = initial_counts ? initial_counts[i] : ~0u;
1718 }
1719
1721}
1722
1723static void wined3d_cs_exec_set_samplers(struct wined3d_cs *cs, const void *data)
1724{
1725 const struct wined3d_cs_set_samplers *op = data;
1726 unsigned int i;
1727
1728 for (i = 0; i < op->count; ++i)
1729 cs->state.sampler[op->type][op->start_idx + i] = op->samplers[i];
1730
1733 else
1735}
1736
1738 unsigned int start_idx, unsigned int count, struct wined3d_sampler *const *samplers)
1739{
1741
1745 op->type = type;
1746 op->start_idx = start_idx;
1747 op->count = count;
1748 memcpy(op->samplers, samplers, count * sizeof(*samplers));
1749
1751}
1752
1753static void wined3d_cs_exec_set_shader(struct wined3d_cs *cs, const void *data)
1754{
1755 const struct wined3d_cs_set_shader *op = data;
1756
1757 /* CB binding may have been skipped earlier if the shader wasn't set, so make it happen. */
1758 if (!cs->state.shader[op->type] && op->shader)
1760 cs->state.shader[op->type] = op->shader;
1761 device_invalidate_state(cs->c.device, STATE_SHADER(op->type));
1762 if (op->type != WINED3D_SHADER_TYPE_COMPUTE)
1764 else
1766}
1767
1770{
1771 struct wined3d_cs_set_shader *op;
1772
1774 op->opcode = WINED3D_CS_OP_SET_SHADER;
1775 op->type = type;
1776 op->shader = shader;
1777
1779}
1780
1781static void wined3d_cs_exec_set_blend_state(struct wined3d_cs *cs, const void *data)
1782{
1783 const struct wined3d_cs_set_blend_state *op = data;
1784 struct wined3d_device *device = cs->c.device;
1785 struct wined3d_state *state = &cs->state;
1786
1787 if (state->blend_state != op->state)
1788 {
1789 state->blend_state = op->state;
1791 }
1792 state->blend_factor = op->factor;
1794 state->sample_mask = op->sample_mask;
1796 for (unsigned int i = 0; i < device->context_count; ++i)
1797 device->contexts[i]->update_multisample_state = 1;
1798}
1799
1801 struct wined3d_blend_state *state, const struct wined3d_color *blend_factor, unsigned int sample_mask)
1802{
1804
1807 op->state = state;
1808 op->factor = *blend_factor;
1809 op->sample_mask = sample_mask;
1810
1812}
1813
1815{
1817 struct wined3d_state *state = &cs->state;
1818
1819 if (state->depth_stencil_state != op->state)
1820 {
1821 state->depth_stencil_state = op->state;
1823 }
1824 state->stencil_ref = op->stencil_ref;
1826}
1827
1829 struct wined3d_depth_stencil_state *state, unsigned int stencil_ref)
1830{
1832
1835 op->state = state;
1836 op->stencil_ref = stencil_ref;
1837
1839}
1840
1842{
1843 const struct wined3d_cs_set_rasterizer_state *op = data;
1844
1845 cs->state.rasterizer_state = op->state;
1847}
1848
1850 struct wined3d_rasterizer_state *rasterizer_state)
1851{
1853
1856 op->state = rasterizer_state;
1857
1859}
1860
1861static void wined3d_cs_exec_set_depth_bounds(struct wined3d_cs *cs, const void *data)
1862{
1863 const struct wined3d_cs_set_depth_bounds *op = data;
1864
1865 cs->state.depth_bounds_enable = op->enable;
1866 cs->state.depth_bounds_min = op->min_depth;
1867 cs->state.depth_bounds_max = op->max_depth;
1869}
1870
1872 bool enable, float min_depth, float max_depth)
1873{
1875
1878 op->enable = enable;
1879 op->min_depth = min_depth;
1880 op->max_depth = max_depth;
1881
1883}
1884
1885static void wined3d_cs_exec_set_render_state(struct wined3d_cs *cs, const void *data)
1886{
1887 const struct wined3d_cs_set_render_state *op = data;
1888
1889 cs->state.render_states[op->state] = op->value;
1890 device_invalidate_state(cs->c.device, STATE_RENDER(op->state));
1891}
1892
1894 enum wined3d_render_state state, unsigned int value)
1895{
1897
1900 op->state = state;
1901 op->value = value;
1902
1904}
1905
1906static void wined3d_cs_exec_set_texture_state(struct wined3d_cs *cs, const void *data)
1907{
1908 const struct wined3d_cs_set_texture_state *op = data;
1909
1910 cs->state.texture_states[op->stage][op->state] = op->value;
1911 device_invalidate_state(cs->c.device, STATE_TEXTURESTAGE(op->stage, op->state));
1912}
1913
1915 enum wined3d_texture_stage_state state, unsigned int value)
1916{
1918
1921 op->stage = stage;
1922 op->state = state;
1923 op->value = value;
1924
1926}
1927
1928static void wined3d_cs_exec_set_transform(struct wined3d_cs *cs, const void *data)
1929{
1930 const struct wined3d_cs_set_transform *op = data;
1931
1932 cs->state.transforms[op->state] = op->matrix;
1933 /* Fog behaviour depends on the projection matrix. */
1934 if (op->state == WINED3D_TS_PROJECTION
1935 && cs->state.render_states[WINED3D_RS_FOGENABLE]
1936 && cs->state.render_states[WINED3D_RS_FOGTABLEMODE] != WINED3D_FOG_NONE)
1938}
1939
1942{
1944
1947 op->state = state;
1948 op->matrix = *matrix;
1949
1951}
1952
1953static void wined3d_cs_exec_set_clip_plane(struct wined3d_cs *cs, const void *data)
1954{
1955 const struct wined3d_cs_set_clip_plane *op = data;
1956
1957 cs->state.clip_planes[op->plane_idx] = op->plane;
1958 device_invalidate_state(cs->c.device, STATE_CLIPPLANE(op->plane_idx));
1959}
1960
1962 unsigned int plane_idx, const struct wined3d_vec4 *plane)
1963{
1965
1968 op->plane_idx = plane_idx;
1969 op->plane = *plane;
1970
1972}
1973
1974static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *data)
1975{
1976 const struct wined3d_cs_set_color_key *op = data;
1977 struct wined3d_texture *texture = op->texture;
1978
1979 if (op->set)
1980 {
1981 switch (op->flags)
1982 {
1984 texture->async.dst_blt_color_key = op->color_key;
1985 texture->async.color_key_flags |= WINED3D_CKEY_DST_BLT;
1986 break;
1987
1989 texture->async.dst_overlay_color_key = op->color_key;
1990 texture->async.color_key_flags |= WINED3D_CKEY_DST_OVERLAY;
1991 break;
1992
1994 if (texture == wined3d_state_get_ffp_texture(&cs->state, 0))
1995 {
1996 if (!(texture->async.color_key_flags & WINED3D_CKEY_SRC_BLT))
1998 }
1999
2000 texture->async.src_blt_color_key = op->color_key;
2001 texture->async.color_key_flags |= WINED3D_CKEY_SRC_BLT;
2002 break;
2003
2005 texture->async.src_overlay_color_key = op->color_key;
2006 texture->async.color_key_flags |= WINED3D_CKEY_SRC_OVERLAY;
2007 break;
2008 }
2009 }
2010 else
2011 {
2012 switch (op->flags)
2013 {
2015 texture->async.color_key_flags &= ~WINED3D_CKEY_DST_BLT;
2016 break;
2017
2019 texture->async.color_key_flags &= ~WINED3D_CKEY_DST_OVERLAY;
2020 break;
2021
2023 if (texture == wined3d_state_get_ffp_texture(&cs->state, 0)
2024 && texture->async.color_key_flags & WINED3D_CKEY_SRC_BLT)
2026
2027 texture->async.color_key_flags &= ~WINED3D_CKEY_SRC_BLT;
2028 break;
2029
2031 texture->async.color_key_flags &= ~WINED3D_CKEY_SRC_OVERLAY;
2032 break;
2033 }
2034 }
2035}
2036
2038 WORD flags, const struct wined3d_color_key *color_key)
2039{
2041
2044 op->texture = texture;
2045 op->flags = flags;
2046 if (color_key)
2047 {
2048 op->color_key = *color_key;
2049 op->set = 1;
2050 }
2051 else
2052 op->set = 0;
2053
2055}
2056
2057static void wined3d_cs_exec_set_light(struct wined3d_cs *cs, const void *data)
2058{
2059 const struct wined3d_cs_set_light *op = data;
2060 struct wined3d_light_info *light_info;
2061 unsigned int light_idx;
2062
2063 light_idx = op->light.OriginalIndex;
2064
2065 if (!(light_info = wined3d_light_state_get_light(&cs->state.light_state, light_idx)))
2066 {
2067 TRACE("Adding new light.\n");
2068 if (!(light_info = calloc(1, sizeof(*light_info))))
2069 {
2070 ERR("Failed to allocate light info.\n");
2071 return;
2072 }
2073
2074 light_info->glIndex = -1;
2075 light_info->OriginalIndex = light_idx;
2076 rb_put(&cs->state.light_state.lights_tree, (void *)(ULONG_PTR)light_idx, &light_info->entry);
2077 }
2078
2079 light_info->OriginalParms = op->light.OriginalParms;
2080 light_info->constants = op->light.constants;
2081}
2082
2084 const struct wined3d_light_info *light)
2085{
2086 struct wined3d_cs_set_light *op;
2087
2089 op->opcode = WINED3D_CS_OP_SET_LIGHT;
2090 op->light = *light;
2091
2093}
2094
2095static void wined3d_cs_exec_set_light_enable(struct wined3d_cs *cs, const void *data)
2096{
2097 const struct wined3d_cs_set_light_enable *op = data;
2098 struct wined3d_device *device = cs->c.device;
2099 struct wined3d_light_info *light_info;
2100
2101 if (!(light_info = wined3d_light_state_get_light(&cs->state.light_state, op->idx)))
2102 {
2103 ERR("Light doesn't exist.\n");
2104 return;
2105 }
2106
2107 wined3d_light_state_enable_light(&cs->state.light_state, &device->adapter->d3d_info, light_info, op->enable);
2108}
2109
2111{
2113
2116 op->idx = idx;
2117 op->enable = enable;
2118
2120}
2121
2122static void wined3d_cs_exec_set_feature_level(struct wined3d_cs *cs, const void *data)
2123{
2124 const struct wined3d_cs_set_feature_level *op = data;
2125
2126 cs->state.feature_level = op->level;
2127}
2128
2131{
2133
2136 op->level = level;
2137
2139}
2140
2141static const struct push_constant_info
2142{
2143 size_t size;
2144 unsigned int max_count;
2146}
2148{
2158
2160{
2162 struct wined3d_device *device = context->device;
2163 bool gpu = device->adapter->d3d_info.gpu_push_constants;
2164 HRESULT hr;
2165
2166 struct wined3d_buffer_desc desc =
2167 {
2168 .byte_width = info->max_count * info->size,
2169 .bind_flags = 0,
2171 };
2172
2173 if (gpu)
2174 {
2177 }
2178
2179 if (!device->push_constants[type] && FAILED(hr = wined3d_buffer_create(device,
2180 &desc, NULL, NULL, &wined3d_null_parent_ops, &device->push_constants[type])))
2181 {
2182 ERR("Failed to create push constant buffer, hr %#lx.\n", hr);
2183 return false;
2184 }
2185
2186 return true;
2187}
2188
2189static void wined3d_cs_exec_push_constants(struct wined3d_cs *cs, const void *data)
2190{
2191 const struct wined3d_cs_push_constants *op = data;
2192 struct wined3d_device *device = cs->c.device;
2193 unsigned int ffp_start_idx, ffp_end_idx;
2194 unsigned int context_count, i;
2195
2196 /* The constant buffers were already updated; this op is just to mark the
2197 * constants as invalid in the device state. */
2198
2199 ffp_start_idx = op->start_idx / sizeof(struct wined3d_vec4);
2200 ffp_end_idx = (op->start_idx + op->count + sizeof(struct wined3d_vec4)) / sizeof(struct wined3d_vec4);
2201
2202 if (op->type == WINED3D_PUSH_CONSTANTS_VS_F)
2203 device->shader_backend->shader_update_float_vertex_constants(device, op->start_idx, op->count);
2204 else if (op->type == WINED3D_PUSH_CONSTANTS_PS_F)
2205 device->shader_backend->shader_update_float_pixel_constants(device, op->start_idx, op->count);
2206 else if (op->type == WINED3D_PUSH_CONSTANTS_VS_FFP)
2207 device->shader_backend->shader_update_float_vertex_constants(device, ffp_start_idx, ffp_end_idx - ffp_start_idx);
2208 else if (op->type == WINED3D_PUSH_CONSTANTS_PS_FFP)
2209 device->shader_backend->shader_update_float_pixel_constants(device, ffp_start_idx, ffp_end_idx - ffp_start_idx);
2210
2211 for (i = 0, context_count = device->context_count; i < context_count; ++i)
2212 device->contexts[i]->constant_update_mask |= op->update_mask;
2213}
2214
2216 enum wined3d_push_constants type, uint32_t update_mask, unsigned int start_idx, unsigned int count)
2217{
2220
2223 op->type = type;
2224 op->update_mask = update_mask;
2225 op->start_idx = start_idx;
2226 op->count = count;
2227
2229}
2230
2233 unsigned int count, const void *constants)
2234{
2236 unsigned int byte_offset = start_idx * info->size;
2237 unsigned int byte_size = count * info->size;
2238 struct wined3d_box box;
2239
2241 return;
2242
2243 wined3d_box_set(&box, byte_offset, 0, byte_offset + byte_size, 1, 0, 1);
2245 &context->device->push_constants[type]->resource, 0, &box, constants, byte_size, byte_size);
2247}
2248
2249static void wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data)
2250{
2251 const struct wined3d_device *device = cs->c.device;
2252 const struct wined3d_cs_reset_state *op = data;
2253 const struct wined3d_state_entry *state_table;
2254 unsigned int state;
2255
2256 state_cleanup(&cs->state);
2257 wined3d_state_reset(&cs->state, &device->adapter->d3d_info);
2258 if (op->invalidate)
2259 {
2260 state_table = device->state_table;
2261 for (state = 0; state <= STATE_HIGHEST; ++state)
2262 {
2265 }
2266 }
2267}
2268
2270{
2271 struct wined3d_cs_reset_state *op;
2272
2274 op->opcode = WINED3D_CS_OP_RESET_STATE;
2275 op->invalidate = invalidate;
2276
2278}
2279
2280static void wined3d_cs_exec_callback(struct wined3d_cs *cs, const void *data)
2281{
2282 const struct wined3d_cs_callback *op = data;
2283
2284 op->callback(op->object);
2285}
2286
2287static void wined3d_cs_emit_callback(struct wined3d_cs *cs, void (*callback)(void *object), void *object)
2288{
2289 struct wined3d_cs_callback *op;
2290
2292 op->opcode = WINED3D_CS_OP_CALLBACK;
2293 op->callback = callback;
2294 op->object = object;
2295
2297}
2298
2299void wined3d_cs_destroy_object(struct wined3d_cs *cs, void (*callback)(void *object), void *object)
2300{
2302}
2303
2304void wined3d_cs_init_object(struct wined3d_cs *cs, void (*callback)(void *object), void *object)
2305{
2307}
2308
2309static void wined3d_cs_exec_query_issue(struct wined3d_cs *cs, const void *data)
2310{
2311 const struct wined3d_cs_query_issue *op = data;
2312 struct wined3d_query *query = op->query;
2313 BOOL poll;
2314
2315 poll = query->query_ops->query_issue(query, op->flags);
2316
2317 if (!query->poll_in_cs)
2318 {
2319 if (op->flags & WINED3DISSUE_END)
2320 InterlockedIncrement(&query->counter_retrieved);
2321 return;
2322 }
2323
2324 if (poll && list_empty(&query->poll_list_entry))
2325 {
2326 if (query->buffer_object)
2327 InterlockedIncrement(&query->counter_retrieved);
2328 else
2329 list_add_tail(&cs->query_poll_list, &query->poll_list_entry);
2330 return;
2331 }
2332
2333 /* This can happen if occlusion queries are restarted. This discards the
2334 * old result, since polling it could result in a GL error. */
2335 if ((op->flags & WINED3DISSUE_BEGIN) && !poll && !list_empty(&query->poll_list_entry))
2336 {
2337 list_remove(&query->poll_list_entry);
2338 list_init(&query->poll_list_entry);
2339 InterlockedIncrement(&query->counter_retrieved);
2340 return;
2341 }
2342
2343 /* This can happen when an occlusion query is ended without being started,
2344 * in which case we don't want to poll, but still have to counter-balance
2345 * the increment of the main counter.
2346 *
2347 * This can also happen if an event query is re-issued before the first
2348 * fence was reached. In this case the query is already in the list and
2349 * the poll function will check the new fence. We have to counter-balance
2350 * the discarded increment. */
2351 if (op->flags & WINED3DISSUE_END)
2352 InterlockedIncrement(&query->counter_retrieved);
2353}
2354
2356 struct wined3d_query *query, unsigned int flags)
2357{
2359 struct wined3d_cs_query_issue *op;
2360
2361 if (flags & WINED3DISSUE_END)
2362 ++query->counter_main;
2363
2365 op->opcode = WINED3D_CS_OP_QUERY_ISSUE;
2366 op->query = query;
2367 op->flags = flags;
2368
2370 cs->queries_flushed = FALSE;
2371
2373 query->state = QUERY_BUILDING;
2374 else
2375 query->state = QUERY_SIGNALLED;
2376}
2377
2379{
2381 SIZE_T i;
2382
2383 if (list->query_count)
2384 {
2385 cs->queries_flushed = FALSE;
2386
2387 for (i = 0; i < list->query_count; ++i)
2388 {
2389 if (list->queries[i].flags & WINED3DISSUE_END)
2390 {
2391 list->queries[i].query->counter_main++;
2392 list->queries[i].query->state = QUERY_SIGNALLED;
2393 }
2394 else
2395 {
2396 list->queries[i].query->state = QUERY_BUILDING;
2397 }
2398 }
2399 }
2400
2401 for (i = 0; i < list->resource_count; ++i)
2402 wined3d_resource_reference(list->resources[i]);
2403
2404 for (i = 0; i < list->command_list_count; ++i)
2406
2407 for (i = 0; i < list->upload_count; ++i)
2408 invalidate_client_address(list->uploads[i].resource);
2409}
2410
2411static void wined3d_cs_exec_preload_resource(struct wined3d_cs *cs, const void *data)
2412{
2413 const struct wined3d_cs_preload_resource *op = data;
2414 struct wined3d_resource *resource = op->resource;
2415
2416 resource->resource_ops->resource_preload(resource);
2417}
2418
2420{
2422
2425 op->resource = resource;
2426
2428
2430}
2431
2432static void wined3d_cs_exec_unload_resource(struct wined3d_cs *cs, const void *data)
2433{
2434 const struct wined3d_cs_unload_resource *op = data;
2435 struct wined3d_resource *resource = op->resource;
2436
2437 resource->resource_ops->resource_unload(resource);
2438}
2439
2441{
2443
2445
2448 op->resource = resource;
2449
2451
2453}
2454
2456 struct wined3d_resource *resource, unsigned int sub_resource_idx, const struct wined3d_box *box,
2457 const struct upload_bo *bo, unsigned int row_pitch, unsigned int slice_pitch)
2458{
2460
2461 TRACE("context %p, resource %p, sub_resource_idx %u, box %s, bo %s, flags %#x, row_pitch %u, slice_pitch %u.\n",
2464
2467 op->resource = resource;
2468 op->sub_resource_idx = sub_resource_idx;
2469 op->box = *box;
2470 op->bo = *bo;
2471 op->row_pitch = row_pitch;
2472 op->slice_pitch = slice_pitch;
2473
2475
2477}
2478
2479static void wined3d_cs_exec_map(struct wined3d_cs *cs, const void *data)
2480{
2481 const struct wined3d_cs_map *op = data;
2482 struct wined3d_resource *resource = op->resource;
2483
2484 *op->hr = resource->resource_ops->resource_sub_resource_map(resource,
2485 op->sub_resource_idx, op->map_ptr, op->box, op->flags);
2486}
2487
2489 struct wined3d_resource *resource, unsigned int sub_resource_idx,
2490 struct wined3d_map_desc *map_desc, const struct wined3d_box *box, unsigned int flags)
2491{
2492 struct wined3d_cs_map *op;
2493 HRESULT hr;
2494
2495 /* Mapping resources from the worker thread isn't an issue by itself, but
2496 * increasing the map count would be visible to applications. */
2497 wined3d_not_from_cs(context->device->cs);
2498
2500 && context->ops->map_upload_bo(context, resource, sub_resource_idx, map_desc, box, flags))
2501 {
2502 TRACE("Returning map pointer %p, row pitch %u, slice pitch %u.\n",
2503 map_desc->data, map_desc->row_pitch, map_desc->slice_pitch);
2504 return WINED3D_OK;
2505 }
2506
2507 TRACE_(d3d_perf)("Mapping resource %p (type %u), flags %#x through the CS.\n", resource, resource->type, flags);
2508
2510
2511 /* We might end up invalidating the resource on the CS thread. */
2513
2515 return E_OUTOFMEMORY;
2516 op->opcode = WINED3D_CS_OP_MAP;
2517 op->resource = resource;
2518 op->sub_resource_idx = sub_resource_idx;
2519 op->map_ptr = &map_desc->data;
2520 op->box = box;
2521 op->flags = flags;
2522 op->hr = &hr;
2523
2526
2527 if (SUCCEEDED(hr))
2529 &map_desc->row_pitch, &map_desc->slice_pitch);
2530 return hr;
2531}
2532
2533static void wined3d_cs_exec_unmap(struct wined3d_cs *cs, const void *data)
2534{
2535 const struct wined3d_cs_unmap *op = data;
2536 struct wined3d_resource *resource = op->resource;
2537
2538 *op->hr = resource->resource_ops->resource_sub_resource_unmap(resource, op->sub_resource_idx);
2539}
2540
2542 struct wined3d_resource *resource, unsigned int sub_resource_idx)
2543{
2544 struct wined3d_cs_unmap *op;
2545 struct wined3d_box box;
2546 struct upload_bo bo;
2547 HRESULT hr;
2548
2549 if (context->ops->unmap_upload_bo(context, resource, sub_resource_idx, &box, &bo))
2550 {
2551 unsigned int row_pitch, slice_pitch;
2552
2553 wined3d_resource_get_sub_resource_map_pitch(resource, sub_resource_idx, &row_pitch, &slice_pitch);
2555 wined3d_device_context_upload_bo(context, resource, sub_resource_idx, &box, &bo, row_pitch, slice_pitch);
2556 return WINED3D_OK;
2557 }
2558
2559 wined3d_not_from_cs(context->device->cs);
2560
2561 TRACE_(d3d_perf)("Unmapping resource %p (type %u) through the CS.\n", resource, resource->type);
2562
2564 return E_OUTOFMEMORY;
2565 op->opcode = WINED3D_CS_OP_UNMAP;
2566 op->resource = resource;
2567 op->sub_resource_idx = sub_resource_idx;
2568 op->hr = &hr;
2569
2572
2573 return hr;
2574}
2575
2576static void wined3d_cs_exec_map_bo_address(struct wined3d_cs *cs, const void *data)
2577{
2578 const struct wined3d_cs_map_bo_address *op = data;
2579 struct wined3d_context *context;
2580
2581 context = context_acquire(cs->c.device, NULL, 0);
2582 wined3d_context_map_bo_address(context, &op->addr, op->size, op->flags);
2584}
2585
2587 struct wined3d_bo_address *addr, size_t size, unsigned int flags)
2588{
2589 struct wined3d_device_context *context = &cs->c;
2591
2594 op->addr = *addr;
2595 op->size = size;
2596 op->flags = flags;
2599}
2600
2601static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void *data)
2602{
2603 const struct wined3d_cs_blt_sub_resource *op = data;
2604
2605 if (op->dst_resource->type == WINED3D_RTYPE_BUFFER)
2606 {
2607 wined3d_buffer_copy(buffer_from_resource(op->dst_resource), op->dst_box.left,
2608 buffer_from_resource(op->src_resource), op->src_box.left,
2609 op->src_box.right - op->src_box.left);
2610 }
2611 else if (op->dst_resource->type == WINED3D_RTYPE_TEXTURE_3D)
2612 {
2613 struct wined3d_texture *src_texture, *dst_texture;
2614 unsigned int level, update_w, update_h, update_d;
2615 unsigned int row_pitch, slice_pitch;
2616 struct wined3d_context *context;
2617 struct wined3d_bo_address addr;
2618 unsigned int location;
2619
2620 if (op->flags & ~WINED3D_BLT_RAW)
2621 {
2622 FIXME("Flags %#x not implemented for %s resources.\n",
2623 op->flags, debug_d3dresourcetype(op->dst_resource->type));
2624 return;
2625 }
2626
2627 if (!(op->flags & WINED3D_BLT_RAW) && op->src_resource->format != op->dst_resource->format)
2628 {
2629 FIXME("Format conversion not implemented for %s resources.\n",
2630 debug_d3dresourcetype(op->dst_resource->type));
2631 return;
2632 }
2633
2634 update_w = op->dst_box.right - op->dst_box.left;
2635 update_h = op->dst_box.bottom - op->dst_box.top;
2636 update_d = op->dst_box.back - op->dst_box.front;
2637 if (op->src_box.right - op->src_box.left != update_w
2638 || op->src_box.bottom - op->src_box.top != update_h
2639 || op->src_box.back - op->src_box.front != update_d)
2640 {
2641 FIXME("Stretching not implemented for %s resources.\n",
2642 debug_d3dresourcetype(op->dst_resource->type));
2643 return;
2644 }
2645
2646 dst_texture = texture_from_resource(op->dst_resource);
2647 src_texture = texture_from_resource(op->src_resource);
2648
2649 context = context_acquire(cs->c.device, NULL, 0);
2650
2651 location = src_texture->resource.map_binding;
2653 && wined3d_texture_can_use_pbo(src_texture, &context->device->adapter->d3d_info))
2655
2656 if (!wined3d_texture_load_location(src_texture, op->src_sub_resource_idx,
2657 context, location))
2658 {
2659 ERR("Failed to load source sub-resource into %s.\n",
2662 return;
2663 }
2664
2665 level = op->dst_sub_resource_idx % dst_texture->level_count;
2666 if (update_w == wined3d_texture_get_level_width(dst_texture, level)
2667 && update_h == wined3d_texture_get_level_height(dst_texture, level)
2668 && update_d == wined3d_texture_get_level_depth(dst_texture, level))
2669 {
2670 wined3d_texture_prepare_location(dst_texture, op->dst_sub_resource_idx,
2672 }
2673 else if (!wined3d_texture_load_location(dst_texture, op->dst_sub_resource_idx,
2675 {
2676 ERR("Failed to load destination sub-resource.\n");
2678 return;
2679 }
2680
2681 wined3d_texture_get_bo_address(src_texture, op->src_sub_resource_idx, &addr, location);
2682 wined3d_texture_get_pitch(src_texture, op->src_sub_resource_idx % src_texture->level_count,
2683 &row_pitch, &slice_pitch);
2684
2685 dst_texture->texture_ops->texture_upload_data(context, wined3d_const_bo_address(&addr),
2686 dst_texture->resource.format, &op->src_box, row_pitch, slice_pitch, dst_texture,
2687 op->dst_sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB,
2688 op->dst_box.left, op->dst_box.top, op->dst_box.front);
2689 wined3d_texture_validate_location(dst_texture, op->dst_sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB);
2690 wined3d_texture_invalidate_location(dst_texture, op->dst_sub_resource_idx, ~WINED3D_LOCATION_TEXTURE_RGB);
2691
2693 }
2694 else
2695 {
2696 if (FAILED(texture2d_blt(texture_from_resource(op->dst_resource), op->dst_sub_resource_idx,
2697 &op->dst_box, texture_from_resource(op->src_resource), op->src_sub_resource_idx,
2698 &op->src_box, op->flags, &op->fx, op->filter)))
2699 FIXME("Blit failed.\n");
2700 }
2701}
2702
2704 struct wined3d_resource *dst_resource, unsigned int dst_sub_resource_idx, const struct wined3d_box *dst_box,
2705 struct wined3d_resource *src_resource, unsigned int src_sub_resource_idx, const struct wined3d_box *src_box,
2706 unsigned int flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
2707{
2709
2710 /* If we are replacing the whole resource, the CS thread might discard and
2711 * rename the buffer object, in which case ours is no longer valid. */
2712 if (dst_resource->type == WINED3D_RTYPE_BUFFER && dst_box->right - dst_box->left == dst_resource->size)
2714
2717 op->dst_resource = dst_resource;
2718 op->dst_sub_resource_idx = dst_sub_resource_idx;
2719 op->dst_box = *dst_box;
2720 op->src_resource = src_resource;
2721 op->src_sub_resource_idx = src_sub_resource_idx;
2722 op->src_box = *src_box;
2723 op->flags = flags;
2724 if (fx)
2725 op->fx = *fx;
2726 else
2727 memset(&op->fx, 0, sizeof(op->fx));
2728 op->filter = filter;
2729
2731 if (src_resource)
2733
2737}
2738
2740{
2741 const struct wined3d_cs_update_sub_resource *op = data;
2742 struct wined3d_resource *resource = op->resource;
2743 const struct wined3d_box *box = &op->box;
2744 struct wined3d_context *context;
2745
2746 context = context_acquire(cs->c.device, NULL, 0);
2747
2748 if (resource->type == WINED3D_RTYPE_BUFFER)
2750 context, &op->bo, box->left, box->right - box->left);
2751 else
2753 op->sub_resource_idx, context, &op->bo, box, op->row_pitch, op->slice_pitch);
2754
2756
2757 if (op->bo.flags & UPLOAD_BO_FREE_ON_UNMAP)
2758 {
2759 if (op->bo.addr.buffer_object)
2760 FIXME("Free BO address %s.\n", debug_const_bo_address(&op->bo.addr));
2761 else
2762 free((void *)op->bo.addr.addr);
2763 }
2764}
2765
2767 struct wined3d_resource *resource, unsigned int sub_resource_idx, const struct wined3d_box *box,
2768 const void *data, unsigned int row_pitch, unsigned int slice_pitch)
2769{
2771 struct wined3d_map_desc map_desc;
2772 struct wined3d_box dummy_box;
2773 struct upload_bo bo;
2774
2775 /* If we are replacing the whole resource, the CS thread might discard and
2776 * rename the buffer object, in which case ours is no longer valid. */
2777 if (resource->type == WINED3D_RTYPE_BUFFER && box->right - box->left == resource->size)
2779
2780 if (context->ops->map_upload_bo(context, resource, sub_resource_idx, &map_desc, box, WINED3D_MAP_WRITE))
2781 {
2782 wined3d_format_copy_data(resource->format, data, row_pitch, slice_pitch, map_desc.data, map_desc.row_pitch,
2783 map_desc.slice_pitch, box->right - box->left, box->bottom - box->top, box->back - box->front);
2784 context->ops->unmap_upload_bo(context, resource, sub_resource_idx, &dummy_box, &bo);
2786 box, &bo, map_desc.row_pitch, map_desc.slice_pitch);
2787 return;
2788 }
2789
2791
2794 op->resource = resource;
2795 op->sub_resource_idx = sub_resource_idx;
2796 op->box = *box;
2797 op->bo.addr.buffer_object = 0;
2798 op->bo.addr.addr = data;
2799 op->bo.flags = 0;
2800 op->row_pitch = row_pitch;
2801 op->slice_pitch = slice_pitch;
2802
2804 /* The data pointer may go away, so we need to wait until it is read.
2805 * Copying the data may be faster if it's small. */
2807}
2808
2810{
2812 struct wined3d_texture *texture = op->texture;
2813 unsigned int sub_resource_idx, i;
2814 struct wined3d_context *context;
2815
2816 context = context_acquire(cs->c.device, NULL, 0);
2817 sub_resource_idx = op->layer * texture->level_count;
2818 for (i = 0; i < texture->level_count; ++i, ++sub_resource_idx)
2819 {
2822 else
2823 ERR("Failed to load location %s.\n", wined3d_debug_location(texture->resource.map_binding));
2824 }
2826}
2827
2829 struct wined3d_texture *texture, unsigned int layer)
2830{
2832
2835 op->texture = texture;
2836 op->layer = layer;
2837
2839
2841}
2842
2844{
2846 struct wined3d_unordered_access_view *view = op->view;
2847 struct wined3d_context *context;
2848
2849 context = context_acquire(cs->c.device, NULL, 0);
2850 cs->c.device->adapter->adapter_ops->adapter_clear_uav(context, view, &op->clear_value, op->fp);
2852}
2853
2855 struct wined3d_unordered_access_view *view, const struct wined3d_uvec4 *clear_value, bool fp)
2856{
2858
2861 op->view = view;
2862 op->clear_value = *clear_value;
2863 op->fp = fp;
2864
2866
2868}
2869
2870static void wined3d_cs_exec_copy_uav_counter(struct wined3d_cs *cs, const void *data)
2871{
2872 const struct wined3d_cs_copy_uav_counter *op = data;
2873 struct wined3d_unordered_access_view *view = op->view;
2874 struct wined3d_context *context;
2875
2876 context = context_acquire(cs->c.device, NULL, 0);
2879}
2880
2882 struct wined3d_buffer *dst_buffer, unsigned int offset, struct wined3d_unordered_access_view *uav)
2883{
2885
2888 op->buffer = dst_buffer;
2889 op->offset = offset;
2890 op->view = uav;
2891
2893
2895}
2896
2897static void wined3d_cs_exec_generate_mipmaps(struct wined3d_cs *cs, const void *data)
2898{
2899 const struct wined3d_cs_generate_mipmaps *op = data;
2900 struct wined3d_shader_resource_view *view = op->view;
2901 struct wined3d_context *context;
2902
2903 context = context_acquire(cs->c.device, NULL, 0);
2904 cs->c.device->adapter->adapter_ops->adapter_generate_mipmap(context, view);
2906}
2907
2910{
2912
2915 op->view = view;
2916
2918
2920}
2921
2923{
2924 struct wined3d_cs_stop *op;
2925
2927 op->opcode = WINED3D_CS_OP_STOP;
2928
2931}
2932
2934{
2936}
2937
2938static void wined3d_cs_exec_execute_command_list(struct wined3d_cs *cs, const void *data);
2939
2940static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
2941{
2942 /* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop,
2943 /* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present,
2944 /* WINED3D_CS_OP_CLEAR */ wined3d_cs_exec_clear,
2945 /* WINED3D_CS_OP_DISPATCH */ wined3d_cs_exec_dispatch,
2946 /* WINED3D_CS_OP_DRAW */ wined3d_cs_exec_draw,
2947 /* WINED3D_CS_OP_FLUSH */ wined3d_cs_exec_flush,
2948 /* WINED3D_CS_OP_SET_PREDICATION */ wined3d_cs_exec_set_predication,
2949 /* WINED3D_CS_OP_SET_VIEWPORTS */ wined3d_cs_exec_set_viewports,
2950 /* WINED3D_CS_OP_SET_SCISSOR_RECTS */ wined3d_cs_exec_set_scissor_rects,
2951 /* WINED3D_CS_OP_SET_RENDERTARGET_VIEWS */ wined3d_cs_exec_set_rendertarget_views,
2952 /* WINED3D_CS_OP_SET_DEPTH_STENCIL_VIEW */ wined3d_cs_exec_set_depth_stencil_view,
2953 /* WINED3D_CS_OP_SET_VERTEX_DECLARATION */ wined3d_cs_exec_set_vertex_declaration,
2954 /* WINED3D_CS_OP_SET_STREAM_SOURCES */ wined3d_cs_exec_set_stream_sources,
2955 /* WINED3D_CS_OP_SET_STREAM_OUTPUTS */ wined3d_cs_exec_set_stream_outputs,
2956 /* WINED3D_CS_OP_SET_INDEX_BUFFER */ wined3d_cs_exec_set_index_buffer,
2957 /* WINED3D_CS_OP_SET_CONSTANT_BUFFERS */ wined3d_cs_exec_set_constant_buffers,
2958 /* WINED3D_CS_OP_SET_TEXTURE */ wined3d_cs_exec_set_texture,
2959 /* WINED3D_CS_OP_SET_SHADER_RESOURCE_VIEWS */ wined3d_cs_exec_set_shader_resource_views,
2960 /* WINED3D_CS_OP_SET_UNORDERED_ACCESS_VIEWS */ wined3d_cs_exec_set_unordered_access_views,
2961 /* WINED3D_CS_OP_SET_SAMPLERS */ wined3d_cs_exec_set_samplers,
2962 /* WINED3D_CS_OP_SET_SHADER */ wined3d_cs_exec_set_shader,
2963 /* WINED3D_CS_OP_SET_BLEND_STATE */ wined3d_cs_exec_set_blend_state,
2964 /* WINED3D_CS_OP_SET_DEPTH_STENCIL_STATE */ wined3d_cs_exec_set_depth_stencil_state,
2965 /* WINED3D_CS_OP_SET_RASTERIZER_STATE */ wined3d_cs_exec_set_rasterizer_state,
2966 /* WINED3D_CS_OP_SET_DEPTH_BOUNDS */ wined3d_cs_exec_set_depth_bounds,
2967 /* WINED3D_CS_OP_SET_RENDER_STATE */ wined3d_cs_exec_set_render_state,
2968 /* WINED3D_CS_OP_SET_TEXTURE_STATE */ wined3d_cs_exec_set_texture_state,
2969 /* WINED3D_CS_OP_SET_TRANSFORM */ wined3d_cs_exec_set_transform,
2970 /* WINED3D_CS_OP_SET_CLIP_PLANE */ wined3d_cs_exec_set_clip_plane,
2971 /* WINED3D_CS_OP_SET_COLOR_KEY */ wined3d_cs_exec_set_color_key,
2972 /* WINED3D_CS_OP_SET_LIGHT */ wined3d_cs_exec_set_light,
2973 /* WINED3D_CS_OP_SET_LIGHT_ENABLE */ wined3d_cs_exec_set_light_enable,
2974 /* WINED3D_CS_OP_SET_FEATURE_LEVEL */ wined3d_cs_exec_set_feature_level,
2975 /* WINED3D_CS_OP_PUSH_CONSTANTS */ wined3d_cs_exec_push_constants,
2976 /* WINED3D_CS_OP_RESET_STATE */ wined3d_cs_exec_reset_state,
2977 /* WINED3D_CS_OP_CALLBACK */ wined3d_cs_exec_callback,
2978 /* WINED3D_CS_OP_QUERY_ISSUE */ wined3d_cs_exec_query_issue,
2979 /* WINED3D_CS_OP_PRELOAD_RESOURCE */ wined3d_cs_exec_preload_resource,
2980 /* WINED3D_CS_OP_UNLOAD_RESOURCE */ wined3d_cs_exec_unload_resource,
2981 /* WINED3D_CS_OP_MAP */ wined3d_cs_exec_map,
2982 /* WINED3D_CS_OP_UNMAP */ wined3d_cs_exec_unmap,
2983 /* WINED3D_CS_OP_MAP_BO_ADDRESS */ wined3d_cs_exec_map_bo_address,
2984 /* WINED3D_CS_OP_BLT_SUB_RESOURCE */ wined3d_cs_exec_blt_sub_resource,
2985 /* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource,
2986 /* WINED3D_CS_OP_ADD_DIRTY_TEXTURE_REGION */ wined3d_cs_exec_add_dirty_texture_region,
2987 /* WINED3D_CS_OP_CLEAR_SYSMEM_TEXTURE */ wined3d_cs_exec_clear_sysmem_texture,
2988 /* WINED3D_CS_OP_CLEAR_UNORDERED_ACCESS_VIEW */ wined3d_cs_exec_clear_unordered_access_view,
2989 /* WINED3D_CS_OP_COPY_UAV_COUNTER */ wined3d_cs_exec_copy_uav_counter,
2990 /* WINED3D_CS_OP_GENERATE_MIPMAPS */ wined3d_cs_exec_generate_mipmaps,
2991 /* WINED3D_CS_OP_EXECUTE_COMMAND_LIST */ wined3d_cs_exec_execute_command_list,
2992};
2993
2995 struct wined3d_command_list *list, bool restore_state)
2996{
2998
3001 op->list = list;
3002
3003 context->ops->reference_command_list(context, list);
3004
3006
3007 if (restore_state)
3009 else
3011}
3012
3014 size_t size, enum wined3d_cs_queue_id queue_id)
3015{
3017
3018 if (size > (cs->data_size - cs->end))
3019 {
3020 size_t new_size;
3021 void *new_data;
3022
3023 new_size = max(size, cs->data_size * 2);
3024 if (!cs->end)
3025 new_data = realloc(cs->data, new_size);
3026 else
3027 new_data = malloc(new_size);
3028 if (!new_data)
3029 return NULL;
3030
3031 cs->data_size = new_size;
3032 cs->start = cs->end = 0;
3033 cs->data = new_data;
3034 }
3035
3036 cs->end += size;
3037
3038 return (BYTE *)cs->data + cs->start;
3039}
3040
3042{
3044 enum wined3d_cs_op opcode;
3045 size_t start;
3046 BYTE *data;
3047
3048 data = cs->data;
3049 start = cs->start;
3050 cs->start = cs->end;
3051
3052 opcode = *(const enum wined3d_cs_op *)&data[start];
3053 if (opcode >= WINED3D_CS_OP_STOP)
3054 ERR("Invalid opcode %#x.\n", opcode);
3055 else
3056 wined3d_cs_op_handlers[opcode](cs, &data[start]);
3057
3058 if (cs->data == data)
3059 cs->start = cs->end = start;
3060 else if (!start)
3061 free(data);
3062}
3063
3065{
3066}
3067
3068static void get_map_pitch(const struct wined3d_format *format, const struct wined3d_box *box,
3069 struct wined3d_map_desc *map_desc, size_t *size)
3070{
3071 unsigned int height = box->bottom - box->top;
3072 unsigned int width = box->right - box->left;
3073 unsigned int depth = box->back - box->front;
3074
3076
3077 *size = (depth - 1) * map_desc->slice_pitch
3078 + ((height - 1) / format->block_height) * map_desc->row_pitch
3079 + ((width + format->block_width - 1) / format->block_width) * format->block_byte_count;
3080}
3081
3083 unsigned int sub_resource_idx, struct wined3d_map_desc *map_desc, const struct wined3d_box *box, uint32_t flags)
3084{
3085 struct wined3d_client_resource *client = &resource->client;
3086 const struct wined3d_format *format = resource->format;
3087 size_t size;
3088
3090 {
3091 struct wined3d_device *device = context->device;
3092 struct wined3d_bo_address addr;
3093 struct wined3d_bo *bo;
3095
3096 if (resource->pin_sysmem)
3097 {
3098 TRACE("Not allocating an upload buffer because system memory is pinned for this resource.\n");
3099 return false;
3100 }
3101
3102 if ((flags & WINED3D_MAP_NOOVERWRITE) && client->addr.buffer_object == CLIENT_BO_DISCARDED)
3103 flags = (flags & ~WINED3D_MAP_NOOVERWRITE) | WINED3D_MAP_DISCARD;
3104
3106 {
3107 if (!device->adapter->adapter_ops->adapter_alloc_bo(device, resource, sub_resource_idx, &addr))
3108 return false;
3109
3110 /* Limit NOOVERWRITE maps to buffers for now; there are too many
3111 * ways that a texture can be invalidated to even count. */
3112 if (resource->type == WINED3D_RTYPE_BUFFER)
3113 client->addr = addr;
3114 }
3115 else
3116 {
3117 addr = client->addr;
3118 }
3119
3120 map_ptr = NULL;
3121 if ((bo = addr.buffer_object))
3122 {
3124 if ((map_ptr = bo->map_ptr))
3125 ++bo->client_map_count;
3127
3128 if (!map_ptr)
3129 {
3130 /* adapter_alloc_bo() should have given us a mapped BO if we are
3131 * discarding. */
3133 WARN_(d3d_perf)("Not accelerating a NOOVERWRITE map because the BO is not mapped.\n");
3134 return false;
3135 }
3136 }
3137 map_ptr += (uintptr_t)addr.addr;
3138
3139 if (!map_ptr)
3140 {
3142 WARN_(d3d_perf)("Not accelerating a NOOVERWRITE map because the sub-resource has no valid address.\n");
3143 return false;
3144 }
3145
3147 &map_desc->row_pitch, &map_desc->slice_pitch);
3148
3149 client->mapped_upload.addr = *wined3d_const_bo_address(&addr);
3150 client->mapped_upload.flags = 0;
3151 if (bo)
3152 {
3153 map_ptr += bo->memory_offset;
3154 /* If we are not mapping all buffers persistently, use
3155 * UPDATE_SUB_RESOURCE as a means of telling the CS thread to try
3156 * to unmap the resource, so that we can free VA space. */
3157 if (!bo->coherent || !wined3d_map_persistent())
3158 client->mapped_upload.flags |= UPLOAD_BO_UPLOAD_ON_UNMAP;
3159 }
3160 map_desc->data = resource_offset_map_pointer(resource, sub_resource_idx, map_ptr, box);
3161
3164
3165 client->mapped_box = *box;
3166
3167 TRACE("Returning bo %s, flags %#x.\n", debug_const_bo_address(&client->mapped_upload.addr),
3168 client->mapped_upload.flags);
3169 return true;
3170 }
3171
3172 get_map_pitch(format, box, map_desc, &size);
3173
3174 if (!(map_desc->data = malloc(size)))
3175 {
3176 WARN_(d3d_perf)("Failed to allocate a heap memory buffer.\n");
3177 return false;
3178 }
3179 client->mapped_upload.addr.buffer_object = 0;
3180 client->mapped_upload.addr.addr = map_desc->data;
3182 client->mapped_box = *box;
3183 return true;
3184}
3185
3187{
3188 return !addr->buffer_object && !addr->addr;
3189}
3190
3192 unsigned int sub_resource_idx, struct wined3d_box *box, struct upload_bo *upload_bo)
3193{
3194 struct wined3d_client_resource *client = &resource->client;
3195 struct wined3d_device *device = context->device;
3196 struct wined3d_bo *bo;
3197
3198 if (wined3d_bo_address_is_null(&client->mapped_upload.addr))
3199 return false;
3200
3201 if ((bo = client->mapped_upload.addr.buffer_object))
3202 {
3204 --bo->client_map_count;
3206 }
3207
3208 *upload_bo = client->mapped_upload;
3209 *box = client->mapped_box;
3210 memset(&client->mapped_upload, 0, sizeof(client->mapped_upload));
3211 memset(&client->mapped_box, 0, sizeof(client->mapped_box));
3212 return true;
3213}
3214
3216{
3226};
3227
3229{
3231 return *(volatile ULONG *)&queue->head == queue->tail;
3232}
3233
3235{
3236 struct wined3d_cs_packet *packet;
3237 size_t packet_size;
3238
3239 packet = (struct wined3d_cs_packet *)&queue->data[queue->head & WINED3D_CS_QUEUE_MASK];
3240 TRACE("Queuing op %s at %p.\n", debug_cs_op(*(const enum wined3d_cs_op *)packet->data), packet);
3241 packet_size = FIELD_OFFSET(struct wined3d_cs_packet, data[packet->size]);
3242 InterlockedExchange((LONG *)&queue->head, queue->head + packet_size);
3243
3244 if (InterlockedCompareExchange(&cs->waiting_for_event, FALSE, TRUE))
3245 {
3246 if (pNtAlertThreadByThreadId)
3247 pNtAlertThreadByThreadId((HANDLE)(ULONG_PTR)cs->thread_id);
3248 else
3249 SetEvent(cs->event);
3250 }
3251}
3252
3254{
3256
3257 if (cs->thread_id == GetCurrentThreadId())
3258 return wined3d_cs_st_submit(context, queue_id);
3259
3260 wined3d_cs_queue_submit(&cs->queue[queue_id], cs);
3261}
3262
3264{
3265 size_t queue_size = ARRAY_SIZE(queue->data);
3266 size_t header_size, packet_size, remaining;
3267 struct wined3d_cs_packet *packet;
3269
3270 header_size = FIELD_OFFSET(struct wined3d_cs_packet, data[0]);
3271 packet_size = FIELD_OFFSET(struct wined3d_cs_packet, data[size]);
3272 packet_size = (packet_size + header_size - 1) & ~(header_size - 1);
3273 size = packet_size - header_size;
3274 if (packet_size >= WINED3D_CS_QUEUE_SIZE)
3275 {
3276 ERR("Packet size %Iu >= queue size %u.\n", packet_size, WINED3D_CS_QUEUE_SIZE);
3277 return NULL;
3278 }
3279
3280 remaining = queue_size - head;
3281 if (remaining < packet_size)
3282 {
3283 size_t nop_size = remaining - header_size;
3284 struct wined3d_cs_nop *nop;
3285
3286 TRACE("Inserting a nop for %Iu + %Iu bytes.\n", header_size, nop_size);
3287
3288 nop = wined3d_cs_queue_require_space(queue, nop_size, cs);
3289 if (nop_size)
3291
3294 assert(!head);
3295 }
3296
3297 for (;;)
3298 {
3299 ULONG tail = (*(volatile ULONG *)&queue->tail) & WINED3D_CS_QUEUE_MASK;
3300 ULONG new_pos;
3301
3302 /* Empty. */
3303 if (head == tail)
3304 break;
3305 new_pos = (head + packet_size) & WINED3D_CS_QUEUE_MASK;
3306 /* Head ahead of tail. We checked the remaining size above, so we only
3307 * need to make sure we don't make head equal to tail. */
3308 if (head > tail && (new_pos != tail))
3309 break;
3310 /* Tail ahead of head. Make sure the new head is before the tail as
3311 * well. Note that new_pos is 0 when it's at the end of the queue. */
3312 if (new_pos < tail && new_pos)
3313 break;
3314
3315 TRACE_(d3d_perf)("Waiting for free space. Head %lu, tail %lu, packet size %Iu.\n",
3316 head, tail, packet_size);
3317 }
3318
3319 packet = (struct wined3d_cs_packet *)&queue->data[head];
3320 packet->size = size;
3321 return packet->data;
3322}
3323
3325 size_t size, enum wined3d_cs_queue_id queue_id)
3326{
3328
3329 if (cs->thread_id == GetCurrentThreadId())
3330 return wined3d_cs_st_require_space(context, size, queue_id);
3331
3332 return wined3d_cs_queue_require_space(&cs->queue[queue_id], size, cs);
3333}
3334
3336{
3338 unsigned int spin_count = 0;
3339
3340 if (cs->thread_id == GetCurrentThreadId())
3341 return wined3d_cs_st_finish(context, queue_id);
3342
3343 TRACE_(d3d_perf)("Waiting for queue %u to be empty.\n", queue_id);
3344 while (cs->queue[queue_id].head != *(volatile ULONG *)&cs->queue[queue_id].tail)
3345 wined3d_pause(&spin_count);
3346 TRACE_(d3d_perf)("Queue is now empty.\n");
3347}
3348
3350{
3360};
3361
3362static void poll_queries(struct wined3d_cs *cs)
3363{
3364 struct wined3d_query *query, *cursor;
3365
3367 {
3368 if (!query->query_ops->query_poll(query, 0))
3369 continue;
3370
3371 list_remove(&query->poll_list_entry);
3372 list_init(&query->poll_list_entry);
3373 InterlockedIncrement(&query->counter_retrieved);
3374 }
3375}
3376
3378{
3379 static const LARGE_INTEGER query_timeout = {.QuadPart = WINED3D_CS_COMMAND_WAIT_WITH_QUERIES_TIMEOUT * -10};
3380 const LARGE_INTEGER *timeout = NULL;
3381
3382 if (!list_empty(&cs->query_poll_list))
3383 timeout = &query_timeout;
3384
3385 InterlockedExchange(&cs->waiting_for_event, TRUE);
3386
3387 /* The main thread might have enqueued a command and blocked on it after
3388 * the CS thread decided to enter wined3d_cs_wait_event(), but before
3389 * "waiting_for_event" was set.
3390 *
3391 * Likewise, we can race with the main thread when resetting
3392 * "waiting_for_event", in which case we would need to call
3393 * WaitForSingleObject() because the main thread called SetEvent(). */
3396 && InterlockedCompareExchange(&cs->waiting_for_event, FALSE, TRUE))
3397 return;
3398
3399 if (pNtWaitForAlertByThreadId)
3400 pNtWaitForAlertByThreadId(NULL, timeout);
3401 else
3403}
3404
3405static void wined3d_cs_command_lock(const struct wined3d_cs *cs)
3406{
3407 if (cs->serialize_commands)
3409}
3410
3411static void wined3d_cs_command_unlock(const struct wined3d_cs *cs)
3412{
3413 if (cs->serialize_commands)
3415}
3416
3417static inline bool wined3d_cs_execute_next(struct wined3d_cs *cs, struct wined3d_cs_queue *queue)
3418{
3419 struct wined3d_cs_packet *packet;
3420 enum wined3d_cs_op opcode;
3421 SIZE_T tail;
3422
3423 tail = queue->tail;
3425
3426 if (packet->size)
3427 {
3428 opcode = *(const enum wined3d_cs_op *)packet->data;
3429
3430 TRACE("Executing %s at %p.\n", debug_cs_op(opcode), packet);
3431 if (opcode >= WINED3D_CS_OP_STOP)
3432 {
3433 if (opcode > WINED3D_CS_OP_STOP)
3434 ERR("Invalid opcode %#x.\n", opcode);
3435 return false;
3436 }
3437
3439 wined3d_cs_op_handlers[opcode](cs, packet->data);
3441 TRACE("%s at %p executed.\n", debug_cs_op(opcode), packet);
3442 }
3443
3444 InterlockedExchange((LONG *)&queue->tail, tail);
3445 return true;
3446}
3447
3449{
3450 const struct wined3d_cs_execute_command_list *op = data;
3451 SIZE_T start = 0, end = op->list->data_size;
3452 const BYTE *cs_data = op->list->data;
3453 struct wined3d_cs_queue *queue;
3454
3455 TRACE("Executing command list %p.\n", op->list);
3456
3457 queue = &cs->queue[WINED3D_CS_QUEUE_MAP];
3458 while (start < end)
3459 {
3460 const struct wined3d_cs_packet *packet;
3461 enum wined3d_cs_op opcode;
3462
3465
3467 opcode = *(const enum wined3d_cs_op *)packet->data;
3468
3469 if (opcode >= WINED3D_CS_OP_STOP)
3470 ERR("Invalid opcode %#x.\n", opcode);
3471 else
3472 wined3d_cs_op_handlers[opcode](cs, packet->data);
3473 TRACE("%s executed.\n", debug_cs_op(opcode));
3474 }
3475}
3476
3478{
3479 struct wined3d_cs_queue *queue;
3480 unsigned int spin_count = 0;
3481 struct wined3d_cs *cs = ctx;
3483 unsigned int poll = 0;
3484 bool run = true;
3485
3486 TRACE("Started.\n");
3487 SetThreadDescription(GetCurrentThread(), L"wined3d_cs");
3488
3489 /* Copy the module handle to a local variable to avoid racing with the
3490 * thread freeing "cs" before the FreeLibraryAndExitThread() call. */
3491 wined3d_module = cs->wined3d_module;
3492
3493 list_init(&cs->query_poll_list);
3494 cs->thread_id = GetCurrentThreadId();
3495 while (run)
3496 {
3498 {
3502 poll = 0;
3503 }
3504
3505 queue = &cs->queue[WINED3D_CS_QUEUE_MAP];
3507 {
3510 {
3512 if (++spin_count >= WINED3D_CS_SPIN_COUNT)
3513 {
3514 if (poll)
3516 else
3518 }
3519 continue;
3520 }
3521 }
3522 spin_count = 0;
3523
3525 }
3526
3527 cs->queue[WINED3D_CS_QUEUE_MAP].tail = cs->queue[WINED3D_CS_QUEUE_MAP].head;
3528 cs->queue[WINED3D_CS_QUEUE_DEFAULT].tail = cs->queue[WINED3D_CS_QUEUE_DEFAULT].head;
3529 TRACE("Stopped.\n");
3531}
3532
3534 struct wined3d_buffer *buffer)
3535{
3536 struct wined3d_client_resource *client = &buffer->resource.client;
3537
3538 /* d3d9 applications can draw from a mapped dynamic buffer.
3539 * Castlevania 2 depends on this behaviour.
3540 * This means that we need to upload a pending discard bo, without actually
3541 * unmapping it. */
3542
3543 assert(context == &context->device->cs->c);
3544
3545 if (wined3d_bo_address_is_null(&client->mapped_upload.addr))
3546 return;
3547
3548 if (client->mapped_upload.flags & UPLOAD_BO_UPLOAD_ON_UNMAP)
3550 &client->mapped_box, &client->mapped_upload, buffer->resource.size, buffer->resource.size);
3551
3552 if (client->mapped_upload.flags & UPLOAD_BO_RENAME_ON_UNMAP)
3553 {
3554 client->mapped_upload.flags &= ~UPLOAD_BO_RENAME_ON_UNMAP;
3555 /* This logic matches wined3d_cs_map_upload_bo(). */
3556 if (client->mapped_upload.addr.buffer_object->coherent && wined3d_map_persistent())
3557 client->mapped_upload.flags &= ~UPLOAD_BO_UPLOAD_ON_UNMAP;
3558 }
3559}
3560
3562 const enum wined3d_feature_level *levels, unsigned int level_count)
3563{
3564 const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info;
3565 struct wined3d_cs *cs;
3566
3567 if (!(cs = calloc(1, sizeof(*cs))))
3568 return NULL;
3569
3570 if (FAILED(wined3d_state_create(device, levels, level_count, &cs->c.state)))
3571 {
3572 free(cs);
3573 return NULL;
3574 }
3575
3576 cs->c.ops = &wined3d_cs_st_ops;
3577 cs->c.device = device;
3578 cs->serialize_commands = TRACE_ON(d3d_sync) || wined3d_settings.cs_multithreaded & WINED3D_CSMT_SERIALIZE;
3579
3580 if (cs->serialize_commands)
3581 ERR_(d3d_sync)("Forcing serialization of all command streams.\n");
3582
3583 state_init(&cs->state, d3d_info, WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT, cs->c.state->feature_level);
3584
3585 cs->data_size = WINED3D_INITIAL_CS_SIZE;
3586 if (!(cs->data = malloc(cs->data_size)))
3587 goto fail;
3588
3590 {
3591 if (!d3d_info->fences)
3592 {
3593 WARN("Disabling CSMT, adapter doesn't support fences.\n");
3594 wined3d_settings.cs_multithreaded &= ~WINED3D_CSMT_ENABLE;
3595 }
3596 }
3597
3600 {
3601 cs->c.ops = &wined3d_cs_mt_ops;
3602
3603 if (!pNtAlertThreadByThreadId)
3604 {
3605 HANDLE ntdll = GetModuleHandleW(L"ntdll.dll");
3606
3607 pNtAlertThreadByThreadId = (void *)GetProcAddress(ntdll, "NtAlertThreadByThreadId");
3608 pNtWaitForAlertByThreadId = (void *)GetProcAddress(ntdll, "NtWaitForAlertByThreadId");
3609 }
3610
3611 if (!pNtAlertThreadByThreadId && !(cs->event = CreateEventW(NULL, FALSE, FALSE, NULL)))
3612 {
3613 ERR("Failed to create command stream event.\n");
3614 free(cs->data);
3615 goto fail;
3616 }
3617 if (!(cs->present_event = CreateEventW(NULL, FALSE, FALSE, NULL)))
3618 {
3619 ERR("Failed to create command stream present event.\n");
3620 free(cs->data);
3621 goto fail;
3622 }
3623
3624 if (!(GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
3625 (const WCHAR *)wined3d_cs_run, &cs->wined3d_module)))
3626 {
3627 ERR("Failed to get wined3d module handle.\n");
3628 CloseHandle(cs->present_event);
3629 if (cs->event)
3630 CloseHandle(cs->event);
3631 free(cs->data);
3632 goto fail;
3633 }
3634
3635 if (!(cs->thread = CreateThread(NULL, 0, wined3d_cs_run, cs, 0, NULL)))
3636 {
3637 ERR("Failed to create wined3d command stream thread.\n");
3638 FreeLibrary(cs->wined3d_module);
3639 CloseHandle(cs->present_event);
3640 if (cs->event)
3641 CloseHandle(cs->event);
3642 free(cs->data);
3643 goto fail;
3644 }
3645 }
3646
3647 TRACE("Created command stream %p.\n", cs);
3648 return cs;
3649
3650fail:
3651 wined3d_state_destroy(cs->c.state);
3652 state_cleanup(&cs->state);
3653 free(cs);
3654 return NULL;
3655}
3656
3658{
3659 if (cs->thread)
3660 {
3662 CloseHandle(cs->thread);
3663 if (!CloseHandle(cs->present_event))
3664 ERR("Closing present event failed.\n");
3665 if (cs->event && !CloseHandle(cs->event))
3666 ERR("Closing event failed.\n");
3667 }
3668
3669 wined3d_state_destroy(cs->c.state);
3670 state_cleanup(&cs->state);
3671 free(cs->data);
3672 free(cs);
3673}
3674
3676{
3677 enum wined3d_cs_op opcode = *(const enum wined3d_cs_op *)packet->data;
3678 unsigned int i;
3679
3680 switch (opcode)
3681 {
3683 {
3684 struct wined3d_cs_set_samplers *op = (struct wined3d_cs_set_samplers *)packet->data;
3685
3686 for (i = 0; i < op->count; ++i)
3687 {
3688 if (op->samplers[i])
3689 wined3d_sampler_decref(op->samplers[i]);
3690 }
3691 break;
3692 }
3693
3695 {
3696 struct wined3d_cs_set_shader *op = (struct wined3d_cs_set_shader *)packet->data;
3697
3698 if (op->shader)
3699 wined3d_shader_decref(op->shader);
3700 break;
3701 }
3702
3704 {
3706
3708 if (op->state)
3710 break;
3711 }
3712
3714 {
3716
3717 op = (struct wined3d_cs_set_rasterizer_state *)packet->data;
3718 if (op->state)
3720 break;
3721 }
3722
3724 {
3726
3727 op = (struct wined3d_cs_set_blend_state *)packet->data;
3728 if (op->state)
3730 break;
3731 }
3732
3734 {
3736
3738 for (i = 0; i < op->count; ++i)
3739 {
3740 if (op->views[i])
3742 }
3743 break;
3744 }
3745
3747 {
3749
3751 for (i = 0; i < op->count; ++i)
3752 {
3753 if (op->views[i])
3755 }
3756 break;
3757 }
3758
3760 {
3762
3764 for (i = 0; i < op->count; ++i)
3765 {
3766 if (op->uavs[i].view)
3768 }
3769 break;
3770 }
3771
3773 {
3775
3777 if (op->view)
3779 break;
3780 }
3781
3783 {
3785
3786 op = (struct wined3d_cs_set_constant_buffers *)packet->data;
3787 for (i = 0; i < op->count; ++i)
3788 {
3789 if (op->buffers[i].buffer)
3790 wined3d_buffer_decref(op->buffers[i].buffer);
3791 }
3792 break;
3793 }
3794
3796 {
3798
3801 break;
3802 }
3803
3805 {
3806 struct wined3d_cs_clear *op = (struct wined3d_cs_clear *)packet->data;
3807
3808 for (i = 0; i < op->rt_count; ++i)
3809 {
3810 if (op->fb.render_targets[i])
3811 wined3d_rendertarget_view_decref(op->fb.render_targets[i]);
3812 }
3813 if (op->fb.depth_stencil)
3814 wined3d_rendertarget_view_decref(op->fb.depth_stencil);
3815 break;
3816 }
3817
3819 {
3821
3822 wined3d_texture_decref(op->texture);
3823 break;
3824 }
3825
3827 {
3828 struct wined3d_cs_dispatch *op = (struct wined3d_cs_dispatch *)packet->data;
3829
3830 if (op->parameters.indirect)
3831 wined3d_buffer_decref(op->parameters.u.indirect.buffer);
3832 break;
3833 }
3834
3835 case WINED3D_CS_OP_DRAW:
3836 {
3837 struct wined3d_cs_draw *op = (struct wined3d_cs_draw *)packet->data;
3838
3839 if (op->parameters.indirect)
3840 wined3d_buffer_decref(op->parameters.u.indirect.buffer);
3841 break;
3842 }
3843
3845 {
3847
3848 op = (struct wined3d_cs_set_index_buffer *)packet->data;
3849 if (op->buffer)
3850 wined3d_buffer_decref(op->buffer);
3851 break;
3852 }
3853
3855 {
3857
3858 op = (struct wined3d_cs_set_stream_outputs *)packet->data;
3859 for (i = 0; i < ARRAY_SIZE(op->outputs); ++i)
3860 {
3861 if (op->outputs[i].buffer)
3862 wined3d_buffer_decref(op->outputs[i].buffer);
3863 }
3864 break;
3865 }
3866
3868 {
3870
3871 op = (struct wined3d_cs_set_stream_sources *)packet->data;
3872 for (i = 0; i < op->count; ++i)
3873 {
3874 if (op->streams[i].buffer)
3875 wined3d_buffer_decref(op->streams[i].buffer);
3876 }
3877 break;
3878 }
3879
3881 {
3883
3884 op = (struct wined3d_cs_update_sub_resource *)packet->data;
3885 wined3d_resource_decref(op->resource);
3886 break;
3887 }
3888
3890 {
3892
3893 op = (struct wined3d_cs_blt_sub_resource *)packet->data;
3894 if (op->src_resource)
3895 wined3d_resource_decref(op->src_resource);
3896 wined3d_resource_decref(op->dst_resource);
3897 break;
3898 }
3899
3901 {
3903
3904 op = (struct wined3d_cs_copy_uav_counter *)packet->data;
3905 wined3d_buffer_decref(op->buffer);
3907 break;
3908 }
3909
3911 {
3913
3914 op = (struct wined3d_cs_generate_mipmaps *)packet->data;
3916 break;
3917 }
3918
3919 default:
3920 break;
3921 }
3922}
3923
3925{
3926 enum wined3d_cs_op opcode = *(const enum wined3d_cs_op *)packet->data;
3927 unsigned int i;
3928
3929 switch (opcode)
3930 {
3932 {
3933 struct wined3d_cs_set_samplers *op = (struct wined3d_cs_set_samplers *)packet->data;
3934
3935 for (i = 0; i < op->count; ++i)
3936 {
3937 if (op->samplers[i])
3938 wined3d_sampler_incref(op->samplers[i]);
3939 }
3940 break;
3941 }
3942
3944 {
3945 struct wined3d_cs_set_shader *op = (struct wined3d_cs_set_shader *)packet->data;
3946
3947 if (op->shader)
3948 wined3d_shader_incref(op->shader);
3949 break;
3950 }
3951
3953 {
3955
3957 if (op->state)
3959 break;
3960 }
3961
3963 {
3965
3966 op = (struct wined3d_cs_set_rasterizer_state *)packet->data;
3967 if (op->state)
3969 break;
3970 }
3971
3973 {
3975
3976 op = (struct wined3d_cs_set_blend_state *)packet->data;
3977 if (op->state)
3979 break;
3980 }
3981
3983 {
3985
3987 for (i = 0; i < op->count; ++i)
3988 {
3989 if (op->views[i])
3991 }
3992 break;
3993 }
3994
3996 {
3998
4000 for (i = 0; i < op->count; ++i)
4001 {
4002 if (op->views[i])
4004 }
4005 break;
4006 }
4007
4009 {
4011
4013 for (i = 0; i < op->count; ++i)
4014 {
4015 if (op->uavs[i].view)
4017 }
4018 break;
4019 }
4020
4022 {
4024
4026 if (op->view)
4028 break;
4029 }
4030
4032 {
4034
4035 op = (struct wined3d_cs_set_constant_buffers *)packet->data;
4036 for (i = 0; i < op->count; ++i)
4037 {
4038 if (op->buffers[i].buffer)
4039 wined3d_buffer_incref(op->buffers[i].buffer);
4040 }
4041 break;
4042 }
4043
4045 {
4047
4050 break;
4051 }
4052
4054 {
4055 struct wined3d_cs_clear *op = (struct wined3d_cs_clear *)packet->data;
4056
4057 for (i = 0; i < op->rt_count; ++i)
4058 {
4059 if (op->fb.render_targets[i])
4060 wined3d_rendertarget_view_incref(op->fb.render_targets[i]);
4061 }
4062 if (op->fb.depth_stencil)
4063 wined3d_rendertarget_view_incref(op->fb.depth_stencil);
4064 break;
4065 }
4066
4068 {
4070
4071 wined3d_texture_incref(op->texture);
4072 break;
4073 }
4074
4076 {
4077 struct wined3d_cs_dispatch *op = (struct wined3d_cs_dispatch *)packet->data;
4078
4079 if (op->parameters.indirect)
4080 wined3d_buffer_incref(op->parameters.u.indirect.buffer);
4081 break;
4082 }
4083
4084 case WINED3D_CS_OP_DRAW:
4085 {
4086 struct wined3d_cs_draw *op = (struct wined3d_cs_draw *)packet->data;
4087
4088 if (op->parameters.indirect)
4089 wined3d_buffer_incref(op->parameters.u.indirect.buffer);
4090 break;
4091 }
4092
4094 {
4096
4097 op = (struct wined3d_cs_set_index_buffer *)packet->data;
4098 if (op->buffer)
4099 wined3d_buffer_incref(op->buffer);
4100 break;
4101 }
4102
4104 {
4106
4107 op = (struct wined3d_cs_set_stream_outputs *)packet->data;
4108 for (i = 0; i < ARRAY_SIZE(op->outputs); ++i)
4109 {
4110 if (op->outputs[i].buffer)
4111 wined3d_buffer_incref(op->outputs[i].buffer);
4112 }
4113 break;
4114 }
4115
4117 {
4119
4120 op = (struct wined3d_cs_set_stream_sources *)packet->data;
4121 for (i = 0; i < op->count; ++i)
4122 {
4123 if (op->streams[i].buffer)
4124 wined3d_buffer_incref(op->streams[i].buffer);
4125 }
4126 break;
4127 }
4128
4130 {
4132
4133 op = (struct wined3d_cs_update_sub_resource *)packet->data;
4134 wined3d_resource_incref(op->resource);
4135 break;
4136 }
4137
4139 {
4141
4142 op = (struct wined3d_cs_blt_sub_resource *)packet->data;
4143 if (op->src_resource)
4144 wined3d_resource_incref(op->src_resource);
4145 wined3d_resource_incref(op->dst_resource);
4146 break;
4147 }
4148
4150 {
4152
4153 op = (struct wined3d_cs_copy_uav_counter *)packet->data;
4154 wined3d_buffer_incref(op->buffer);
4156 break;
4157 }
4158
4160 {
4162
4163 op = (struct wined3d_cs_generate_mipmaps *)packet->data;
4165 break;
4166 }
4167
4168 default:
4169 break;
4170 }
4171}
4172
4174{
4176
4178 void *data;
4179
4182
4185
4188
4189 /* List of command lists queued for execution on this context. A command
4190 * list can be the only thing holding a pointer to another command list, so
4191 * we need to hold a reference here and in wined3d_command_list as well. */
4194
4197};
4198
4200{
4202}
4203
4205 size_t size, enum wined3d_cs_queue_id queue_id)
4206{
4208 struct wined3d_cs_packet *packet;
4209 size_t header_size, packet_size;
4210
4211 if (queue_id != WINED3D_CS_QUEUE_DEFAULT)
4212 return NULL;
4213
4214 header_size = offsetof(struct wined3d_cs_packet, data[0]);
4215 packet_size = offsetof(struct wined3d_cs_packet, data[size]);
4216 packet_size = (packet_size + header_size - 1) & ~(header_size - 1);
4217
4218 if (!wined3d_array_reserve(&deferred->data, &deferred->data_capacity, deferred->data_size + packet_size, 1))
4219 return NULL;
4220
4221 packet = (struct wined3d_cs_packet *)((BYTE *)deferred->data + deferred->data_size);
4222 TRACE("size was %Iu, adding %Iu\n", (size_t)deferred->data_size, packet_size);
4223 packet->size = packet_size - header_size;
4224 return &packet->data;
4225}
4226
4228{
4230 struct wined3d_cs_packet *packet;
4231
4232 assert(queue_id == WINED3D_CS_QUEUE_DEFAULT);
4233 packet = wined3d_next_cs_packet(deferred->data, &deferred->data_size, ~(SIZE_T)0);
4235}
4236
4238{
4239 /* This should not happen; we cannot meaningfully finish a deferred context. */
4240 ERR("Ignoring finish() on a deferred context.\n");
4241}
4242
4244 struct wined3d_resource *resource, unsigned int sub_resource_idx)
4245{
4246 SIZE_T i = deferred->upload_count;
4247
4248 while (i--)
4249 {
4250 struct wined3d_deferred_upload *upload = &deferred->uploads[i];
4251
4252 if (upload->resource == resource && upload->sub_resource_idx == sub_resource_idx)
4253 return upload;
4254 }
4255
4256 return NULL;
4257}
4258
4260 struct wined3d_resource *resource, unsigned int sub_resource_idx,
4261 struct wined3d_map_desc *map_desc, const struct wined3d_box *box, uint32_t flags)
4262{
4264 const struct wined3d_format *format = resource->format;
4265 struct wined3d_device *device = context->device;
4266 struct wined3d_deferred_upload *upload;
4267 struct wined3d_bo_address addr;
4268 uint8_t *sysmem;
4269 size_t size;
4270
4271 get_map_pitch(format, box, map_desc, &size);
4272
4273 if (!(flags & WINED3D_MAP_WRITE))
4274 {
4275 WARN("Flags %#x are not valid on a deferred context.\n", flags);
4276 return false;
4277 }
4278
4280 {
4281 FIXME("Unhandled flags %#x.\n", flags);
4282 return false;
4283 }
4284
4286 {
4287 if (!(upload = deferred_context_get_upload(deferred, resource, sub_resource_idx)))
4288 return false;
4289
4290 upload->upload_flags = 0;
4291 map_desc->data = upload->map_ptr;
4292 return true;
4293 }
4294
4295 if (!wined3d_array_reserve((void **)&deferred->uploads, &deferred->uploads_capacity,
4296 deferred->upload_count + 1, sizeof(*deferred->uploads)))
4297 return false;
4298
4299 upload = &deferred->uploads[deferred->upload_count++];
4300
4302 && device->adapter->adapter_ops->adapter_alloc_bo(device, resource, sub_resource_idx, &addr))
4303 {
4304 upload->bo = addr.buffer_object;
4305 upload->sysmem = NULL;
4306
4307 TRACE("Allocated BO %s.\n", debug_bo_address(&addr));
4308
4310 upload->map_ptr = addr.buffer_object->map_ptr;
4312 upload->map_ptr += addr.buffer_object->memory_offset;
4313 assert(upload->map_ptr);
4314 }
4315 else
4316 {
4317 if (!deferred->upload_heap)
4318 {
4319 if (!(deferred->upload_heap = HeapCreate(0, 0, 0)))
4320 {
4321 ERR("Failed to create upload heap.\n");
4322 return false;
4323 }
4324
4325 if (!(deferred->upload_heap_refcount = malloc(sizeof(*deferred->upload_heap_refcount))))
4326 {
4327 HeapDestroy(deferred->upload_heap);
4328 deferred->upload_heap = 0;
4329 return false;
4330 }
4331
4332 *deferred->upload_heap_refcount = 1;
4333 }
4334
4335 if (!(sysmem = HeapAlloc(deferred->upload_heap, 0, size + RESOURCE_ALIGNMENT - 1)))
4336 return false;
4337
4338 upload->bo = NULL;
4339 upload->sysmem = sysmem;
4340 upload->map_ptr = (void *)align((size_t)upload->sysmem, RESOURCE_ALIGNMENT);
4341 }
4342
4344 upload->resource = resource;
4346 upload->sub_resource_idx = sub_resource_idx;
4347 upload->box = *box;
4348
4349 map_desc->data = upload->map_ptr;
4350 return true;
4351}
4352
4354 struct wined3d_resource *resource, unsigned int sub_resource_idx, struct wined3d_box *box, struct upload_bo *bo)
4355{
4357 struct wined3d_deferred_upload *upload;
4358
4359 if ((upload = deferred_context_get_upload(deferred, resource, sub_resource_idx)))
4360 {
4361 *box = upload->box;
4362 if ((bo->addr.buffer_object = upload->bo))
4363 bo->addr.addr = NULL;
4364 else
4365 bo->addr.addr = upload->map_ptr;
4366 bo->flags = upload->upload_flags;
4367 upload->upload_flags = 0;
4368 return true;
4369 }
4370
4371 return false;
4372}
4373
4375 struct wined3d_query *query, unsigned int flags)
4376{
4378 struct wined3d_cs_query_issue *op;
4379
4381 op->opcode = WINED3D_CS_OP_QUERY_ISSUE;
4382 op->query = query;
4383 op->flags = flags;
4384
4386
4387 if (!wined3d_array_reserve((void **)&deferred->queries, &deferred->queries_capacity,
4388 deferred->query_count + 1, sizeof(*deferred->queries)))
4389 {
4390 ERR("Failed to reserve memory.\n");
4391 return;
4392 }
4393
4394 deferred->queries[deferred->query_count].flags = flags;
4395 wined3d_query_incref(deferred->queries[deferred->query_count++].query = query);
4396}
4397
4399{
4400 FIXME("context %p, stub!\n", context);
4401}
4402
4404 struct wined3d_resource *resource)
4405{
4407
4408 if (!wined3d_array_reserve((void **)&deferred->resources, &deferred->resources_capacity,
4409 deferred->resource_count + 1, sizeof(*deferred->resources)))
4410 return;
4411
4412 deferred->resources[deferred->resource_count++] = resource;
4414}
4415
4417 struct wined3d_command_list *list)
4418{
4420
4421 /* Grab a reference to the command list. Note that this implicitly prevents
4422 * any dependent command lists or resources from being freed as well. */
4423 if (!wined3d_array_reserve((void **)&deferred->command_lists, &deferred->command_lists_capacity,
4424 deferred->command_list_count + 1, sizeof(*deferred->command_lists)))
4425 return;
4426
4428}
4429
4431{
4441};
4442
4444{
4446 HRESULT hr;
4447
4448 TRACE("device %p, context %p.\n", device, context);
4449
4450 if (!(object = calloc(1, sizeof(*object))))
4451 return E_OUTOFMEMORY;
4452
4453 if (FAILED(hr = wined3d_state_create(device, &device->cs->c.state->feature_level, 1, &object->c.state)))
4454 {
4455 free(object);
4456 return hr;
4457 }
4458
4459 object->c.ops = &wined3d_deferred_context_ops;
4460 object->c.device = device;
4461
4462 /* Make sure the first command list gets the state reset when executed.
4463 * Resets for subsequent command lists are encoded in wined3d_deferred_context_record_command_list(). */
4465
4466 TRACE("Created deferred context %p.\n", object);
4467 *context = &object->c;
4468
4469 return S_OK;
4470}
4471
4473{
4475 const struct wined3d_cs_packet *packet;
4476 SIZE_T i, offset = 0;
4477
4478 TRACE("context %p.\n", context);
4479
4480 for (i = 0; i < deferred->resource_count; ++i)
4482 free(deferred->resources);
4483
4484 for (i = 0; i < deferred->upload_count; ++i)
4485 {
4486 wined3d_resource_decref(deferred->uploads[i].resource);
4487 HeapFree(deferred->upload_heap, 0, deferred->uploads[i].resource);
4488 }
4489
4490 if (deferred->upload_heap)
4491 {
4493 {
4494 HeapDestroy(deferred->upload_heap);
4495 free(deferred->upload_heap_refcount);
4496 }
4497 }
4498
4499 free(deferred->uploads);
4500
4501 for (i = 0; i < deferred->command_list_count; ++i)
4503 free(deferred->command_lists);
4504
4505 for (i = 0; i < deferred->query_count; ++i)
4506 wined3d_query_decref(deferred->queries[i].query);
4507 free(deferred->queries);
4508
4509 while (offset < deferred->data_size)
4510 {
4511 packet = wined3d_next_cs_packet(deferred->data, &offset, ~(SIZE_T)0);
4513 }
4514
4515 wined3d_state_destroy(deferred->c.state);
4516 free(deferred->data);
4517 free(deferred);
4518}
4519
4521 bool restore, struct wined3d_command_list **list)
4522{
4525 void *memory;
4526
4527 TRACE("context %p, list %p.\n", context, list);
4528
4530 memory = malloc(sizeof(*object) + deferred->resource_count * sizeof(*object->resources)
4531 + deferred->upload_count * sizeof(*object->uploads)
4532 + deferred->command_list_count * sizeof(*object->command_lists)
4533 + deferred->query_count * sizeof(*object->queries)
4534 + deferred->data_size);
4535
4536 if (!memory)
4537 {
4539 return E_OUTOFMEMORY;
4540 }
4541
4542 object = memory;
4543 memory = &object[1];
4544 memset(object, 0, sizeof(*object));
4545 object->refcount = 1;
4546 object->device = deferred->c.device;
4547
4548 object->resources = memory;
4549 memory = &object->resources[deferred->resource_count];
4550 object->resource_count = deferred->resource_count;
4551 memcpy(object->resources, deferred->resources, deferred->resource_count * sizeof(*object->resources));
4552 /* Transfer our references to the resources to the command list. */
4553
4554 object->uploads = memory;
4555 memory = &object->uploads[deferred->upload_count];
4556 object->upload_count = deferred->upload_count;
4557 memcpy(object->uploads, deferred->uploads, deferred->upload_count * sizeof(*object->uploads));
4558 /* Transfer our references to the resources to the command list. */
4559
4560 object->command_lists = memory;
4561 memory = &object->command_lists[deferred->command_list_count];
4562 object->command_list_count = deferred->command_list_count;
4563 memcpy(object->command_lists, deferred->command_lists,
4564 deferred->command_list_count * sizeof(*object->command_lists));
4565 /* Transfer our references to the command lists to the command list. */
4566
4567 object->queries = memory;
4568 memory = &object->queries[deferred->query_count];
4569 object->query_count = deferred->query_count;
4570 memcpy(object->queries, deferred->queries, deferred->query_count * sizeof(*object->queries));
4571 /* Transfer our references to the queries to the command list. */
4572
4573 object->data = memory;
4574 object->data_size = deferred->data_size;
4575 memcpy(object->data, deferred->data, deferred->data_size);
4576
4577 deferred->data_size = 0;
4578 deferred->resource_count = 0;
4579 deferred->upload_count = 0;
4580 deferred->command_list_count = 0;
4581 deferred->query_count = 0;
4582
4583 object->upload_heap = deferred->upload_heap;
4584 if ((object->upload_heap_refcount = deferred->upload_heap_refcount))
4585 InterlockedIncrement(object->upload_heap_refcount);
4586
4587 /* This is in fact recorded into a subsequent command list. */
4588 if (restore)
4589 wined3d_device_context_set_state(&deferred->c, deferred->c.state);
4590 else
4592
4593 TRACE("Created command list %p.\n", object);
4594 *list = object;
4596
4597 return S_OK;
4598}
4599
4601{
4603 struct wined3d_context *context;
4604 unsigned int i;
4605
4606 TRACE("list %p.\n", list);
4607
4608 context = context_acquire(list->device, NULL, 0);
4609
4610 for (i = 0; i < list->upload_count; ++i)
4611 {
4612 struct wined3d_bo *bo;
4613
4614 if ((bo = list->uploads[i].bo))
4615 {
4616 if (!--bo->refcount)
4617 {
4619 free(bo);
4620 }
4621 }
4622 else
4623 {
4624 HeapFree(list->upload_heap, 0, list->uploads[i].sysmem);
4625 }
4626 }
4627
4629
4630 if (list->upload_heap)
4631 {
4632 if (!InterlockedDecrement(list->upload_heap_refcount))
4633 {
4634 HeapDestroy(list->upload_heap);
4635 free(list->upload_heap_refcount);
4636 }
4637 }
4638
4639 free(list);
4640}
4641
4643{
4644 unsigned int refcount = InterlockedIncrement(&list->refcount);
4645
4646 TRACE("%p increasing refcount to %u.\n", list, refcount);
4647
4648 return refcount;
4649}
4650
4652{
4653 unsigned int refcount = InterlockedDecrement(&list->refcount);
4654 struct wined3d_device *device = list->device;
4655 const struct wined3d_cs_packet *packet;
4656 SIZE_T i, offset;
4657
4658 TRACE("%p decreasing refcount to %u.\n", list, refcount);
4659
4660 if (!refcount)
4661 {
4662 for (i = 0; i < list->command_list_count; ++i)
4663 wined3d_command_list_decref(list->command_lists[i]);
4664 for (i = 0; i < list->resource_count; ++i)
4665 wined3d_resource_decref(list->resources[i]);
4666 for (i = 0; i < list->upload_count; ++i)
4667 wined3d_resource_decref(list->uploads[i].resource);
4668 for (i = 0; i < list->query_count; ++i)
4669 wined3d_query_decref(list->queries[i].query);
4670
4671 offset = 0;
4672 while (offset < list->data_size)
4673 {
4676 }
4677
4681 }
4682
4683 return refcount;
4684}
HRESULT WINAPI DECLSPEC_HOTPATCH SetThreadDescription(_In_ HANDLE hThread, _In_ PCWSTR lpThreadDescription)
struct outqueuenode * tail
Definition: adnsresfilter.c:66
struct outqueuenode * head
Definition: adnsresfilter.c:66
static int state
Definition: maze.c:121
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedExchange
Definition: armddk.h:54
#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 ARRAY_SIZE(A)
Definition: main.h:20
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
#define ERR(fmt,...)
Definition: precomp.h:57
Definition: list.h:39
RECT rect
Definition: combotst.c:67
static void wined3d_cs_exec_unload_resource(struct wined3d_cs *cs, const void *data)
Definition: cs.c:2432
static void wined3d_cs_reference_resource(struct wined3d_device_context *context, struct wined3d_resource *resource)
Definition: cs.c:2933
static bool wined3d_deferred_context_unmap_upload_bo(struct wined3d_device_context *context, struct wined3d_resource *resource, unsigned int sub_resource_idx, struct wined3d_box *box, struct upload_bo *bo)
Definition: cs.c:4353
void wined3d_device_context_emit_set_light(struct wined3d_device_context *context, const struct wined3d_light_info *light)
Definition: cs.c:2083
void wined3d_device_context_emit_set_shader_resource_views(struct wined3d_device_context *context, enum wined3d_shader_type type, unsigned int start_idx, unsigned int count, struct wined3d_shader_resource_view *const *views)
Definition: cs.c:1659
ULONG CDECL wined3d_command_list_incref(struct wined3d_command_list *list)
Definition: cs.c:4642
void wined3d_cs_destroy(struct wined3d_cs *cs)
Definition: cs.c:3657
static const struct push_constant_info wined3d_cs_push_constant_info[]
static void wined3d_device_context_submit(struct wined3d_device_context *context, enum wined3d_cs_queue_id queue_id)
Definition: cs.c:552
static BOOL wined3d_cs_queue_is_empty(const struct wined3d_cs *cs, const struct wined3d_cs_queue *queue)
Definition: cs.c:3228
static const LARGE_INTEGER * timeout
Definition: cs.c:29
static DWORD WINAPI wined3d_cs_run(void *ctx)
Definition: cs.c:3477
static void wined3d_cs_exec_clear_sysmem_texture(struct wined3d_cs *cs, const void *data)
Definition: cs.c:882
void wined3d_device_context_emit_copy_uav_counter(struct wined3d_device_context *context, struct wined3d_buffer *dst_buffer, unsigned int offset, struct wined3d_unordered_access_view *uav)
Definition: cs.c:2881
static void * wined3d_cs_st_require_space(struct wined3d_device_context *context, size_t size, enum wined3d_cs_queue_id queue_id)
Definition: cs.c:3013
static void wined3d_cs_exec_set_texture_state(struct wined3d_cs *cs, const void *data)
Definition: cs.c:1906
static void wined3d_cs_exec_set_constant_buffers(struct wined3d_cs *cs, const void *data)
Definition: cs.c:1525
static void poll_queries(struct wined3d_cs *cs)
Definition: cs.c:3362
static void wined3d_cs_exec_push_constants(struct wined3d_cs *cs, const void *data)
Definition: cs.c:2189
static void wined3d_cs_exec_set_vertex_declaration(struct wined3d_cs *cs, const void *data)
Definition: cs.c:1406
static void wined3d_cs_exec_preload_resource(struct wined3d_cs *cs, const void *data)
Definition: cs.c:2411
void wined3d_device_context_push_constants(struct wined3d_device_context *context, enum wined3d_push_constants type, uint32_t update_mask, unsigned int start_idx, unsigned int count, const void *constants)
Definition: cs.c:2231
static void invalidate_client_address(struct wined3d_resource *resource)
Definition: cs.c:85
static void wined3d_cs_mt_finish(struct wined3d_device_context *context, enum wined3d_cs_queue_id queue_id)
Definition: cs.c:3335
static bool prepare_push_constant_buffer(struct wined3d_device_context *context, enum wined3d_push_constants type)
Definition: cs.c:2159
static void wined3d_device_context_finish(struct wined3d_device_context *context, enum wined3d_cs_queue_id queue_id)
Definition: cs.c:558
static void wined3d_cs_queue_submit(struct wined3d_cs_queue *queue, struct wined3d_cs *cs)
Definition: cs.c:3234
wined3d_cs_op
Definition: cs.c:93
@ WINED3D_CS_OP_MAP
Definition: cs.c:133
@ WINED3D_CS_OP_SET_SAMPLERS
Definition: cs.c:113
@ WINED3D_CS_OP_SET_FEATURE_LEVEL
Definition: cs.c:126
@ WINED3D_CS_OP_CLEAR_UNORDERED_ACCESS_VIEW
Definition: cs.c:140
@ WINED3D_CS_OP_COPY_UAV_COUNTER
Definition: cs.c:141
@ WINED3D_CS_OP_SET_TEXTURE_STATE
Definition: cs.c:120
@ WINED3D_CS_OP_ADD_DIRTY_TEXTURE_REGION
Definition: cs.c:138
@ WINED3D_CS_OP_SET_STREAM_OUTPUTS
Definition: cs.c:107
@ WINED3D_CS_OP_SET_LIGHT
Definition: cs.c:124
@ WINED3D_CS_OP_SET_DEPTH_STENCIL_VIEW
Definition: cs.c:104
@ WINED3D_CS_OP_STOP
Definition: cs.c:144
@ WINED3D_CS_OP_SET_STREAM_SOURCES
Definition: cs.c:106
@ WINED3D_CS_OP_SET_INDEX_BUFFER
Definition: cs.c:108
@ WINED3D_CS_OP_SET_SHADER_RESOURCE_VIEWS
Definition: cs.c:111
@ WINED3D_CS_OP_SET_VERTEX_DECLARATION
Definition: cs.c:105
@ WINED3D_CS_OP_SET_CONSTANT_BUFFERS
Definition: cs.c:109
@ WINED3D_CS_OP_SET_UNORDERED_ACCESS_VIEWS
Definition: cs.c:112
@ WINED3D_CS_OP_CLEAR
Definition: cs.c:96
@ WINED3D_CS_OP_NOP
Definition: cs.c:94
@ WINED3D_CS_OP_QUERY_ISSUE
Definition: cs.c:130
@ WINED3D_CS_OP_SET_LIGHT_ENABLE
Definition: cs.c:125
@ WINED3D_CS_OP_SET_TEXTURE
Definition: cs.c:110
@ WINED3D_CS_OP_PUSH_CONSTANTS
Definition: cs.c:127
@ WINED3D_CS_OP_SET_SCISSOR_RECTS
Definition: cs.c:102
@ WINED3D_CS_OP_UPDATE_SUB_RESOURCE
Definition: cs.c:137
@ WINED3D_CS_OP_RESET_STATE
Definition: cs.c:128
@ WINED3D_CS_OP_MAP_BO_ADDRESS
Definition: cs.c:135
@ WINED3D_CS_OP_UNMAP
Definition: cs.c:134
@ WINED3D_CS_OP_PRELOAD_RESOURCE
Definition: cs.c:131
@ WINED3D_CS_OP_SET_RENDER_STATE
Definition: cs.c:119
@ WINED3D_CS_OP_SET_RASTERIZER_STATE
Definition: cs.c:117
@ WINED3D_CS_OP_EXECUTE_COMMAND_LIST
Definition: cs.c:143
@ WINED3D_CS_OP_BLT_SUB_RESOURCE
Definition: cs.c:136
@ WINED3D_CS_OP_DRAW
Definition: cs.c:98
@ WINED3D_CS_OP_SET_DEPTH_STENCIL_STATE
Definition: cs.c:116
@ WINED3D_CS_OP_SET_BLEND_STATE
Definition: cs.c:115
@ WINED3D_CS_OP_SET_VIEWPORTS
Definition: cs.c:101
@ WINED3D_CS_OP_FLUSH
Definition: cs.c:99
@ WINED3D_CS_OP_SET_CLIP_PLANE
Definition: cs.c:122
@ WINED3D_CS_OP_PRESENT
Definition: cs.c:95
@ WINED3D_CS_OP_SET_PREDICATION
Definition: cs.c:100
@ WINED3D_CS_OP_SET_DEPTH_BOUNDS
Definition: cs.c:118
@ WINED3D_CS_OP_GENERATE_MIPMAPS
Definition: cs.c:142
@ WINED3D_CS_OP_SET_SHADER
Definition: cs.c:114
@ WINED3D_CS_OP_CLEAR_SYSMEM_TEXTURE
Definition: cs.c:139
@ WINED3D_CS_OP_DISPATCH
Definition: cs.c:97
@ WINED3D_CS_OP_SET_RENDERTARGET_VIEWS
Definition: cs.c:103
@ WINED3D_CS_OP_UNLOAD_RESOURCE
Definition: cs.c:132
@ WINED3D_CS_OP_SET_COLOR_KEY
Definition: cs.c:123
@ WINED3D_CS_OP_SET_TRANSFORM
Definition: cs.c:121
@ WINED3D_CS_OP_CALLBACK
Definition: cs.c:129
static void wined3d_cs_emit_stop(struct wined3d_cs *cs)
Definition: cs.c:2922
static void wined3d_deferred_context_issue_query(struct wined3d_device_context *context, struct wined3d_query *query, unsigned int flags)
Definition: cs.c:4374
static void wined3d_cs_reference_command_list(struct wined3d_device_context *context, struct wined3d_command_list *list)
Definition: cs.c:2378
static void wined3d_cs_exec_set_samplers(struct wined3d_cs *cs, const void *data)
Definition: cs.c:1723
void CDECL wined3d_device_context_dispatch_indirect(struct wined3d_device_context *context, struct wined3d_buffer *buffer, unsigned int offset)
Definition: cs.c:1049
static void wined3d_command_list_destroy_object(void *object)
Definition: cs.c:4600
void wined3d_device_context_emit_set_unordered_access_views(struct wined3d_device_context *context, enum wined3d_pipeline pipeline, unsigned int start_idx, unsigned int count, struct wined3d_unordered_access_view *const *views, const unsigned int *initial_counts)
Definition: cs.c:1701
static void wined3d_device_context_reference_resource(struct wined3d_device_context *context, struct wined3d_resource *resource)
Definition: cs.c:564
static void wined3d_cs_exec_map(struct wined3d_cs *cs, const void *data)
Definition: cs.c:2479
void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain, const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, unsigned int swap_interval, uint32_t flags)
Definition: cs.c:748
HRESULT CDECL wined3d_device_context_clear_sysmem_texture(struct wined3d_device_context *context, struct wined3d_texture *texture, unsigned int sub_resource_idx, const RECT *rect, unsigned int flags, const struct wined3d_color *color)
Definition: cs.c:896
static void wined3d_deferred_context_flush(struct wined3d_device_context *context)
Definition: cs.c:4398
static void * wined3d_deferred_context_require_space(struct wined3d_device_context *context, size_t size, enum wined3d_cs_queue_id queue_id)
Definition: cs.c:4204
static void wined3d_device_context_upload_bo(struct wined3d_device_context *context, struct wined3d_resource *resource, unsigned int sub_resource_idx, const struct wined3d_box *box, const struct upload_bo *bo, unsigned int row_pitch, unsigned int slice_pitch)
Definition: cs.c:2455
static void wined3d_cs_exec_set_render_state(struct wined3d_cs *cs, const void *data)
Definition: cs.c:1885
static void wined3d_cs_exec_set_scissor_rects(struct wined3d_cs *cs, const void *data)
Definition: cs.c:1284
static void wined3d_cs_exec_set_viewports(struct wined3d_cs *cs, const void *data)
Definition: cs.c:1258
void CDECL wined3d_deferred_context_destroy(struct wined3d_device_context *context)
Definition: cs.c:4472
static void * wined3d_cs_queue_require_space(struct wined3d_cs_queue *queue, size_t size, struct wined3d_cs *cs)
Definition: cs.c:3263
void CDECL wined3d_device_context_draw_indirect(struct wined3d_device_context *context, struct wined3d_buffer *buffer, unsigned int offset, bool indexed)
Definition: cs.c:1191
static void wined3d_cs_exec_set_predication(struct wined3d_cs *cs, const void *data)
Definition: cs.c:1237
static void wined3d_cs_command_lock(const struct wined3d_cs *cs)
Definition: cs.c:3405
static void discard_client_address(struct wined3d_resource *resource)
Definition: cs.c:77
static const struct wined3d_device_context_ops wined3d_deferred_context_ops
Definition: cs.c:4430
void wined3d_device_context_emit_generate_mipmaps(struct wined3d_device_context *context, struct wined3d_shader_resource_view *view)
Definition: cs.c:2908
static void wined3d_cs_wait_event(struct wined3d_cs *cs)
Definition: cs.c:3377
static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const void *data)
Definition: cs.c:1358
static void wined3d_cs_issue_query(struct wined3d_device_context *context, struct wined3d_query *query, unsigned int flags)
Definition: cs.c:2355
static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *data)
Definition: cs.c:1974
static void wined3d_device_context_emit_push_constants(struct wined3d_device_context *context, enum wined3d_push_constants type, uint32_t update_mask, unsigned int start_idx, unsigned int count)
Definition: cs.c:2215
static void wined3d_cs_exec_flush(struct wined3d_cs *cs, const void *data)
Definition: cs.c:1215
static void wined3d_cs_exec_set_light_enable(struct wined3d_cs *cs, const void *data)
Definition: cs.c:2095
static void wined3d_cs_exec_nop(struct wined3d_cs *cs, const void *data)
Definition: cs.c:645
static bool texture_binding_might_invalidate_ps(struct wined3d_shader_resource_view *view, struct wined3d_shader_resource_view *prev, const struct wined3d_d3d_info *d3d_info)
Definition: cs.c:1563
static void wined3d_cs_st_finish(struct wined3d_device_context *context, enum wined3d_cs_queue_id queue_id)
Definition: cs.c:3064
static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
Definition: cs.c:1068
static void * wined3d_cs_mt_require_space(struct wined3d_device_context *context, size_t size, enum wined3d_cs_queue_id queue_id)
Definition: cs.c:3324
static bool wined3d_cs_unmap_upload_bo(struct wined3d_device_context *context, struct wined3d_resource *resource, unsigned int sub_resource_idx, struct wined3d_box *box, struct upload_bo *upload_bo)
Definition: cs.c:3191
void wined3d_device_context_emit_set_rendertarget_views(struct wined3d_device_context *context, unsigned int start_idx, unsigned int count, struct wined3d_rendertarget_view *const *views)
Definition: cs.c:1343
void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource)
Definition: cs.c:2419
static void wined3d_cs_exec_set_rendertarget_views(struct wined3d_cs *cs, const void *data)
Definition: cs.c:1310
static void reference_compute_pipeline_resources(struct wined3d_device_context *context)
Definition: cs.c:1021
static void wined3d_cs_exec_add_dirty_texture_region(struct wined3d_cs *cs, const void *data)
Definition: cs.c:2809
void wined3d_device_context_emit_set_vertex_declaration(struct wined3d_device_context *context, struct wined3d_vertex_declaration *declaration)
Definition: cs.c:1414
static bool wined3d_bo_address_is_null(struct wined3d_const_bo_address *addr)
Definition: cs.c:3186
void wined3d_device_context_set_depth_bounds(struct wined3d_device_context *context, bool enable, float min_depth, float max_depth)
Definition: cs.c:1871
static void reference_graphics_pipeline_resources(struct wined3d_device_context *context, BOOL indexed, const struct wined3d_d3d_info *d3d_info)
Definition: cs.c:1131
static void wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void *data)
Definition: cs.c:1493
void wined3d_cs_emit_add_dirty_texture_region(struct wined3d_cs *cs, struct wined3d_texture *texture, unsigned int layer)
Definition: cs.c:2828
void CDECL wined3d_device_context_dispatch(struct wined3d_device_context *context, unsigned int group_count_x, unsigned int group_count_y, unsigned int group_count_z)
Definition: cs.c:1030
static void wined3d_cs_command_unlock(const struct wined3d_cs *cs)
Definition: cs.c:3411
#define WINED3D_INITIAL_CS_SIZE
Definition: cs.c:31
static void wined3d_cs_exec_set_shader(struct wined3d_cs *cs, const void *data)
Definition: cs.c:1753
static void reference_unordered_access_resources(struct wined3d_device_context *context, const struct wined3d_shader *shader, struct wined3d_unordered_access_view *const *views)
Definition: cs.c:990
static void wined3d_cs_exec_set_shader_resource_views(struct wined3d_cs *cs, const void *data)
Definition: cs.c:1635
void wined3d_device_context_emit_clear_uav(struct wined3d_device_context *context, struct wined3d_unordered_access_view *view, const struct wined3d_uvec4 *clear_value, bool fp)
Definition: cs.c:2854
static bool wined3d_cs_execute_next(struct wined3d_cs *cs, struct wined3d_cs_queue *queue)
Definition: cs.c:3417
static void wined3d_cs_exec_set_stream_sources(struct wined3d_cs *cs, const void *data)
Definition: cs.c:1426
static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void *data)
Definition: cs.c:2601
void wined3d_device_context_emit_update_sub_resource(struct wined3d_device_context *context, struct wined3d_resource *resource, unsigned int sub_resource_idx, const struct wined3d_box *box, const void *data, unsigned int row_pitch, unsigned int slice_pitch)
Definition: cs.c:2766
void wined3d_device_context_emit_set_texture_state(struct wined3d_device_context *context, unsigned int stage, enum wined3d_texture_stage_state state, unsigned int value)
Definition: cs.c:1914
static const char * debug_cs_op(enum wined3d_cs_op op)
Definition: cs.c:575
static void wined3d_cs_exec_set_unordered_access_views(struct wined3d_cs *cs, const void *data)
Definition: cs.c:1676
static void reference_shader_resources(struct wined3d_device_context *context, unsigned int shader_mask)
Definition: cs.c:946
static void wined3d_cs_exec_clear_unordered_access_view(struct wined3d_cs *cs, const void *data)
Definition: cs.c:2843
static void wined3d_cs_exec_copy_uav_counter(struct wined3d_cs *cs, const void *data)
Definition: cs.c:2870
void wined3d_device_context_emit_set_stream_outputs(struct wined3d_device_context *context, const struct wined3d_stream_output outputs[WINED3D_MAX_STREAM_OUTPUT_BUFFERS])
Definition: cs.c:1481
static void get_map_pitch(const struct wined3d_format *format, const struct wined3d_box *box, struct wined3d_map_desc *map_desc, size_t *size)
Definition: cs.c:3068
static const struct wined3d_device_context_ops wined3d_cs_st_ops
Definition: cs.c:3215
static void wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data)
Definition: cs.c:2249
static void wined3d_cs_emit_callback(struct wined3d_cs *cs, void(*callback)(void *object), void *object)
Definition: cs.c:2287
void wined3d_device_context_emit_set_clip_plane(struct wined3d_device_context *context, unsigned int plane_idx, const struct wined3d_vec4 *plane)
Definition: cs.c:1961
void wined3d_device_context_emit_set_feature_level(struct wined3d_device_context *context, enum wined3d_feature_level level)
Definition: cs.c:2129
static void wined3d_cs_exec_set_clip_plane(struct wined3d_cs *cs, const void *data)
Definition: cs.c:1953
void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource)
Definition: cs.c:2440
void wined3d_device_context_emit_draw(struct wined3d_device_context *context, enum wined3d_primitive_type primitive_type, unsigned int patch_vertex_count, int base_vertex_idx, unsigned int start_idx, unsigned int index_count, unsigned int start_instance, unsigned int instance_count, bool indexed)
Definition: cs.c:1166
void wined3d_device_context_emit_set_transform(struct wined3d_device_context *context, enum wined3d_transform_state state, const struct wined3d_matrix *matrix)
Definition: cs.c:1940
void wined3d_device_context_emit_set_rasterizer_state(struct wined3d_device_context *context, struct wined3d_rasterizer_state *rasterizer_state)
Definition: cs.c:1849
void wined3d_device_context_emit_set_depth_stencil_state(struct wined3d_device_context *context, struct wined3d_depth_stencil_state *state, unsigned int stencil_ref)
Definition: cs.c:1828
static struct wined3d_cs_packet * wined3d_next_cs_packet(const uint8_t *data, SIZE_T *offset, SIZE_T mask)
Definition: cs.c:636
static void wined3d_cs_exec_unmap(struct wined3d_cs *cs, const void *data)
Definition: cs.c:2533
void CDECL wined3d_device_context_flush_mapped_buffer(struct wined3d_device_context *context, struct wined3d_buffer *buffer)
Definition: cs.c:3533
static void wined3d_cs_exec_set_rasterizer_state(struct wined3d_cs *cs, const void *data)
Definition: cs.c:1841
static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data)
Definition: cs.c:1595
static void wined3d_deferred_context_finish(struct wined3d_device_context *context, enum wined3d_cs_queue_id queue_id)
Definition: cs.c:4237
static void wined3d_cs_exec_set_feature_level(struct wined3d_cs *cs, const void *data)
Definition: cs.c:2122
void wined3d_device_context_emit_set_render_state(struct wined3d_device_context *context, enum wined3d_render_state state, unsigned int value)
Definition: cs.c:1893
static void wined3d_cs_exec_callback(struct wined3d_cs *cs, const void *data)
Definition: cs.c:2280
static void wined3d_cs_exec_execute_command_list(struct wined3d_cs *cs, const void *data)
Definition: cs.c:3448
void wined3d_device_context_emit_blt_sub_resource(struct wined3d_device_context *context, struct wined3d_resource *dst_resource, unsigned int dst_sub_resource_idx, const struct wined3d_box *dst_box, struct wined3d_resource *src_resource, unsigned int src_sub_resource_idx, const struct wined3d_box *src_box, unsigned int flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
Definition: cs.c:2703
void wined3d_cs_destroy_object(struct wined3d_cs *cs, void(*callback)(void *object), void *object)
Definition: cs.c:2299
static void wined3d_cs_mt_submit(struct wined3d_device_context *context, enum wined3d_cs_queue_id queue_id)
Definition: cs.c:3253
static void wined3d_deferred_context_submit(struct wined3d_device_context *context, enum wined3d_cs_queue_id queue_id)
Definition: cs.c:4227
static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
Definition: cs.c:795
void wined3d_device_context_emit_set_light_enable(struct wined3d_device_context *context, unsigned int idx, BOOL enable)
Definition: cs.c:2110
void wined3d_device_context_emit_set_stream_sources(struct wined3d_device_context *context, unsigned int start_idx, unsigned int count, const struct wined3d_stream_state *streams)
Definition: cs.c:1446
void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects, uint32_t flags, const struct wined3d_color *color, float depth, DWORD stencil)
Definition: cs.c:804
void wined3d_device_context_emit_set_index_buffer(struct wined3d_device_context *context, struct wined3d_buffer *buffer, enum wined3d_format_id format_id, unsigned int offset)
Definition: cs.c:1511
void wined3d_device_context_emit_set_constant_buffers(struct wined3d_device_context *context, enum wined3d_shader_type type, unsigned int start_idx, unsigned int count, const struct wined3d_constant_buffer_state *buffers)
Definition: cs.c:1546
static void wined3d_cs_exec_set_depth_bounds(struct wined3d_cs *cs, const void *data)
Definition: cs.c:1861
static void wined3d_cs_packet_decref_objects(const struct wined3d_cs_packet *packet)
Definition: cs.c:3675
void wined3d_device_context_emit_set_texture(struct wined3d_device_context *context, enum wined3d_shader_type shader_type, unsigned int bind_index, struct wined3d_shader_resource_view *view)
Definition: cs.c:1621
static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const void *data)
Definition: cs.c:2739
void wined3d_device_context_emit_set_viewports(struct wined3d_device_context *context, unsigned int viewport_count, const struct wined3d_viewport *viewports)
Definition: cs.c:1270
void wined3d_device_context_emit_clear_rendertarget_view(struct wined3d_device_context *context, struct wined3d_rendertarget_view *view, const RECT *rect, unsigned int flags, const struct wined3d_color *color, float depth, unsigned int stencil)
Definition: cs.c:844
static struct wined3d_cs * wined3d_cs_from_context(struct wined3d_device_context *context)
Definition: cs.c:570
static void wined3d_cs_exec_dispatch(struct wined3d_cs *cs, const void *data)
Definition: cs.c:1010
HRESULT wined3d_device_context_emit_unmap(struct wined3d_device_context *context, struct wined3d_resource *resource, unsigned int sub_resource_idx)
Definition: cs.c:2541
void wined3d_device_context_emit_set_predication(struct wined3d_device_context *context, struct wined3d_query *predicate, BOOL value)
Definition: cs.c:1245
void wined3d_device_context_emit_reset_state(struct wined3d_device_context *context, bool invalidate)
Definition: cs.c:2269
static const struct wined3d_device_context_ops wined3d_cs_mt_ops
Definition: cs.c:3349
void wined3d_cs_init_object(struct wined3d_cs *cs, void(*callback)(void *object), void *object)
Definition: cs.c:2304
static void wined3d_cs_exec_set_stream_outputs(struct wined3d_cs *cs, const void *data)
Definition: cs.c:1461
static struct wined3d_deferred_upload * deferred_context_get_upload(struct wined3d_deferred_context *deferred, struct wined3d_resource *resource, unsigned int sub_resource_idx)
Definition: cs.c:4243
void wined3d_device_context_emit_set_blend_state(struct wined3d_device_context *context, struct wined3d_blend_state *state, const struct wined3d_color *blend_factor, unsigned int sample_mask)
Definition: cs.c:1800
static void * wined3d_device_context_require_space(struct wined3d_device_context *context, size_t size, enum wined3d_cs_queue_id queue_id)
Definition: cs.c:546
void wined3d_device_context_emit_set_depth_stencil_view(struct wined3d_device_context *context, struct wined3d_rendertarget_view *view)
Definition: cs.c:1394
static bool wined3d_cs_map_upload_bo(struct wined3d_device_context *context, struct wined3d_resource *resource, unsigned int sub_resource_idx, struct wined3d_map_desc *map_desc, const struct wined3d_box *box, uint32_t flags)
Definition: cs.c:3082
ULONG CDECL wined3d_command_list_decref(struct wined3d_command_list *list)
Definition: cs.c:4651
static void wined3d_cs_exec_generate_mipmaps(struct wined3d_cs *cs, const void *data)
Definition: cs.c:2897
static bool wined3d_deferred_context_map_upload_bo(struct wined3d_device_context *context, struct wined3d_resource *resource, unsigned int sub_resource_idx, struct wined3d_map_desc *map_desc, const struct wined3d_box *box, uint32_t flags)
Definition: cs.c:4259
static void wined3d_cs_exec_set_transform(struct wined3d_cs *cs, const void *data)
Definition: cs.c:1928
HRESULT CDECL wined3d_deferred_context_create(struct wined3d_device *device, struct wined3d_device_context **context)
Definition: cs.c:4443
static void wined3d_cs_exec_set_depth_stencil_state(struct wined3d_cs *cs, const void *data)
Definition: cs.c:1814
static void wined3d_deferred_context_reference_resource(struct wined3d_device_context *context, struct wined3d_resource *resource)
Definition: cs.c:4403
struct wined3d_cs * wined3d_cs_create(struct wined3d_device *device, const enum wined3d_feature_level *levels, unsigned int level_count)
Definition: cs.c:3561
HRESULT wined3d_device_context_emit_map(struct wined3d_device_context *context, struct wined3d_resource *resource, unsigned int sub_resource_idx, struct wined3d_map_desc *map_desc, const struct wined3d_box *box, unsigned int flags)
Definition: cs.c:2488
static void wined3d_cs_packet_incref_objects(struct wined3d_cs_packet *packet)
Definition: cs.c:3924
static void wined3d_cs_st_submit(struct wined3d_device_context *context, enum wined3d_cs_queue_id queue_id)
Definition: cs.c:3041
static void(*const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data)
Definition: cs.c:2940
static void wined3d_cs_exec_set_light(struct wined3d_cs *cs, const void *data)
Definition: cs.c:2057
static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
Definition: cs.c:649
void wined3d_device_context_emit_set_shader(struct wined3d_device_context *context, enum wined3d_shader_type type, struct wined3d_shader *shader)
Definition: cs.c:1768
static void wined3d_cs_exec_map_bo_address(struct wined3d_cs *cs, const void *data)
Definition: cs.c:2576
static struct wined3d_deferred_context * wined3d_deferred_context_from_context(struct wined3d_device_context *context)
Definition: cs.c:4199
static void wined3d_deferred_context_reference_command_list(struct wined3d_device_context *context, struct wined3d_command_list *list)
Definition: cs.c:4416
static void wined3d_cs_exec_set_blend_state(struct wined3d_cs *cs, const void *data)
Definition: cs.c:1781
HRESULT CDECL wined3d_deferred_context_record_command_list(struct wined3d_device_context *context, bool restore, struct wined3d_command_list **list)
Definition: cs.c:4520
static void wined3d_cs_exec_query_issue(struct wined3d_cs *cs, const void *data)
Definition: cs.c:2309
void wined3d_device_context_emit_set_scissor_rects(struct wined3d_device_context *context, unsigned int rect_count, const RECT *rects)
Definition: cs.c:1296
void wined3d_device_context_emit_set_samplers(struct wined3d_device_context *context, enum wined3d_shader_type type, unsigned int start_idx, unsigned int count, struct wined3d_sampler *const *samplers)
Definition: cs.c:1737
#define WINED3D_TO_STR(type)
void wined3d_device_context_emit_execute_command_list(struct wined3d_device_context *context, struct wined3d_command_list *list, bool restore_state)
Definition: cs.c:2994
void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture *texture, WORD flags, const struct wined3d_color_key *color_key)
Definition: cs.c:2037
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#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
void state_init(void *ipp)
Definition: dhclient.c:210
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
UINT32 uint32_t
Definition: types.h:75
UINT op
Definition: effect.c:235
static const struct @282 state_table[]
void wined3d_buffer_update_sub_resource(struct wined3d_buffer *buffer, struct wined3d_context *context, const struct upload_bo *upload_bo, unsigned int offset, unsigned int size)
Definition: buffer.c:827
HRESULT CDECL wined3d_buffer_create(struct wined3d_device *device, const struct wined3d_buffer_desc *desc, const struct wined3d_sub_resource_data *data, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_buffer **buffer)
Definition: buffer.c:1329
ULONG CDECL wined3d_buffer_incref(struct wined3d_buffer *buffer)
Definition: buffer.c:248
ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer)
Definition: buffer.c:459
void wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_offset, struct wined3d_buffer *src_buffer, unsigned int src_offset, unsigned int size)
Definition: buffer.c:808
ULONG CDECL wined3d_blend_state_incref(struct wined3d_blend_state *state)
Definition: device.c:268
ULONG CDECL wined3d_depth_stencil_state_decref(struct wined3d_depth_stencil_state *state)
Definition: device.c:359
void device_invalidate_state(const struct wined3d_device *device, unsigned int state_id)
Definition: device.c:5565
ULONG CDECL wined3d_blend_state_decref(struct wined3d_blend_state *state)
Definition: device.c:284
ULONG CDECL wined3d_rasterizer_state_incref(struct wined3d_rasterizer_state *state)
Definition: device.c:430
ULONG CDECL wined3d_depth_stencil_state_incref(struct wined3d_depth_stencil_state *state)
Definition: device.c:343
ULONG CDECL wined3d_rasterizer_state_decref(struct wined3d_rasterizer_state *state)
Definition: device.c:446
void CDECL wined3d_device_context_set_state(struct wined3d_device_context *context, struct wined3d_state *state)
Definition: device.c:1915
void CDECL wined3d_device_context_reset_state(struct wined3d_device_context *context)
Definition: device.c:1904
ULONG CDECL wined3d_query_incref(struct wined3d_query *query)
Definition: query.c:413
ULONG CDECL wined3d_query_decref(struct wined3d_query *query)
Definition: query.c:432
HRESULT wined3d_resource_check_box_dimensions(struct wined3d_resource *resource, unsigned int sub_resource_idx, const struct wined3d_box *box)
Definition: resource.c:488
void * resource_offset_map_pointer(struct wined3d_resource *resource, unsigned int sub_resource_idx, uint8_t *base_memory, const struct wined3d_box *box)
Definition: resource.c:574
ULONG CDECL wined3d_shader_incref(struct wined3d_shader *shader)
Definition: shader.c:2535
ULONG CDECL wined3d_shader_decref(struct wined3d_shader *shader)
Definition: shader.c:2588
HRESULT texture2d_blt(struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, const struct wined3d_box *dst_box, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx, const struct wined3d_box *src_box, uint32_t flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
Definition: surface.c:1342
void cpu_blitter_clear_texture(struct wined3d_texture *texture, unsigned int sub_resource_idx, const struct wined3d_box *box, const struct wined3d_color *colour)
Definition: surface.c:1128
void wined3d_texture_invalidate_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, uint32_t location)
Definition: texture.c:702
ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture)
Definition: texture.c:1606
ULONG CDECL wined3d_texture_incref(struct wined3d_texture *texture)
Definition: texture.c:1516
void wined3d_texture_validate_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, uint32_t location)
Definition: texture.c:678
BOOL wined3d_texture_can_use_pbo(const struct wined3d_texture *texture, const struct wined3d_d3d_info *d3d_info)
Definition: texture.c:59
BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, unsigned int location)
Definition: texture.c:2116
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 wined3d_texture_update_sub_resource(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, const struct upload_bo *upload_bo, const struct wined3d_box *box, unsigned int row_pitch, unsigned int slice_pitch)
Definition: texture.c:4440
BOOL wined3d_texture_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, uint32_t location)
Definition: texture.c:770
void wined3d_texture_get_bo_address(const struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_bo_address *data, uint32_t location)
Definition: texture.c:727
void CDECL wined3d_texture_get_pitch(const struct wined3d_texture *texture, unsigned int level, unsigned int *row_pitch, unsigned int *slice_pitch)
Definition: texture.c:1697
const char * debug_box(const struct wined3d_box *box)
Definition: utils.c:4552
const char * wined3d_debug_location(uint32_t location)
Definition: utils.c:6588
unsigned int idx
Definition: utils.c:40
const char * debug_const_bo_address(const struct wined3d_const_bo_address *address)
Definition: utils.c:4593
BOOL wined3d_clip_blit(const RECT *clip_rect, RECT *clipped, RECT *other)
Definition: utils.c:6672
const char * debug_d3dresourcetype(enum wined3d_resource_type resource_type)
Definition: utils.c:4992
void wined3d_format_copy_data(const struct wined3d_format *format, const uint8_t *src, unsigned int src_row_pitch, unsigned int src_slice_pitch, uint8_t *dst, unsigned int dst_row_pitch, unsigned int dst_slice_pitch, unsigned int w, unsigned int h, unsigned int d)
Definition: utils.c:6080
BOOL wined3d_array_reserve(void **elements, SIZE_T *capacity, SIZE_T count, SIZE_T size)
Definition: utils.c:6740
const char * debug_bo_address(const struct wined3d_bo_address *address)
Definition: utils.c:4600
void wined3d_format_calculate_pitch(const struct wined3d_format *format, unsigned int alignment, unsigned int width, unsigned int height, unsigned int *row_pitch, unsigned int *slice_pitch)
Definition: utils.c:4489
const char * debug_color(const struct wined3d_color *color)
Definition: utils.c:4561
void wined3d_unordered_access_view_copy_counter(struct wined3d_unordered_access_view *view, struct wined3d_buffer *buffer, unsigned int offset, struct wined3d_context *context)
Definition: view.c:1739
void wined3d_rendertarget_view_validate_location(struct wined3d_rendertarget_view *view, uint32_t location)
Definition: view.c:495
ULONG CDECL wined3d_unordered_access_view_decref(struct wined3d_unordered_access_view *view)
Definition: view.c:1536
ULONG CDECL wined3d_shader_resource_view_incref(struct wined3d_shader_resource_view *view)
Definition: view.c:965
ULONG CDECL wined3d_rendertarget_view_incref(struct wined3d_rendertarget_view *view)
Definition: view.c:365
ULONG CDECL wined3d_unordered_access_view_incref(struct wined3d_unordered_access_view *view)
Definition: view.c:1522
ULONG CDECL wined3d_rendertarget_view_decref(struct wined3d_rendertarget_view *view)
Definition: view.c:379
void wined3d_unordered_access_view_set_counter(struct wined3d_unordered_access_view *view, unsigned int value)
Definition: view.c:1714
ULONG CDECL wined3d_shader_resource_view_decref(struct wined3d_shader_resource_view *view)
Definition: view.c:990
#define NTSTATUS
Definition: precomp.h:19
const char * wine_dbg_sprintf(const char *format,...)
Definition: compat.c:296
#define CDECL
Definition: compat.h:29
#define CloseHandle
Definition: compat.h:739
#define TRACE_(x)
Definition: compat.h:76
#define GetProcAddress(x, y)
Definition: compat.h:753
#define HeapAlloc
Definition: compat.h:733
#define FreeLibrary(x)
Definition: compat.h:748
#define TRACE_ON(x)
Definition: compat.h:75
#define HeapFree(x, y, z)
Definition: compat.h:735
#define WINE_DECLARE_DEBUG_CHANNEL(x)
Definition: compat.h:45
PPEB Peb
Definition: dllmain.c:27
BOOL WINAPI GetModuleHandleExW(IN DWORD dwFlags, IN LPCWSTR lpwModuleName OPTIONAL, OUT HMODULE *phModule)
Definition: loader.c:866
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
VOID WINAPI FreeLibraryAndExitThread(HMODULE hLibModule, DWORD dwExitCode)
Definition: loader.c:507
BOOL WINAPI QueryPerformanceFrequency(OUT PLARGE_INTEGER lpFrequency)
Definition: perfcnt.c:45
BOOL WINAPI QueryPerformanceCounter(OUT PLARGE_INTEGER lpPerformanceCount)
Definition: perfcnt.c:23
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
ULONG WINAPI DECLSPEC_HOTPATCH GetTickCount(void)
Definition: sync.c:182
#define assert(_expr)
Definition: assert.h:32
unsigned int uintptr_t
Definition: corecrt.h:185
unsigned char uint8_t
Definition: stdint.h:33
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define L(x)
Definition: resources.c:13
switch(r->id)
Definition: btrfs.c:3046
#define INFINITE
Definition: serial.h:102
size_t const new_size
Definition: expand.cpp:66
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint start
Definition: gl.h:1545
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
GLint level
Definition: gl.h:1546
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
GLuint GLuint end
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLint GLint GLsizei width
Definition: gl.h:1546
GLenum GLuint texture
Definition: glext.h:6295
GLuint * samplers
Definition: glext.h:7280
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
GLintptr offset
Definition: glext.h:5920
GLuint color
Definition: glext.h:6243
const GLubyte * c
Definition: glext.h:8905
GLuint shader
Definition: glext.h:6030
GLenum GLint GLuint mask
Definition: glext.h:6028
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLuint GLenum matrix
Definition: glext.h:9407
GLbitfield flags
Definition: glext.h:7161
GLenum const GLvoid * addr
Definition: glext.h:9621
GLsizei levels
Definition: glext.h:7884
GLboolean enable
Definition: glext.h:11120
GLenum GLuint GLint GLint layer
Definition: glext.h:7007
const GLuint * buffers
Definition: glext.h:5916
GLint GLfloat GLint stencil
Definition: glext.h:6260
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 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 * u
Definition: glfuncs.h:240
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 j
Definition: glfuncs.h:250
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
HANDLE WINAPI HeapCreate(DWORD flOptions, SIZE_T dwInitialSize, SIZE_T dwMaximumSize)
Definition: heapmem.c:45
BOOL WINAPI HeapDestroy(HANDLE hHeap)
Definition: heapmem.c:85
#define ds
Definition: i386-dis.c:443
#define cs
Definition: i386-dis.c:442
const char cursor[]
Definition: icontest.c:13
static TfClientId tid
#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
#define NtCurrentTeb
uint32_t entry
Definition: isohybrid.c:63
#define resource
Definition: kernel32.h:9
#define location(file, line)
Definition: kmtest.h:18
if(dx< 0)
Definition: linetemp.h:194
__u16 time
Definition: mkdosfs.c:8
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static IPrintDialogCallback callback
Definition: printdlg.c:325
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1683
static HMODULE ntdll
Definition: debugger.c:59
static char memory[1024 *256]
Definition: process.c:122
constants
Definition: resource.c:30
static UINT format_id
Definition: clipboard.c:1455
NTSYSAPI LOGICAL NTAPI RtlIsCriticalSectionLockedByThread(_In_ PRTL_CRITICAL_SECTION CriticalSection)
#define BOOL
Definition: nt_native.h:43
NTSYSAPI NTSTATUS NTAPI NtWaitForSingleObject(IN HANDLE hObject, IN BOOLEAN bAlertable, IN PLARGE_INTEGER Timeout)
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
BOOL WINAPI IntersectRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
for(i=0;i< sizeof(testsuite)/sizeof(testsuite[0]);++i) ok(call_test(testsuite[i].func)
#define calloc
Definition: rosglue.h:14
#define list
Definition: rosglue.h:35
ULONG CDECL wined3d_sampler_incref(struct wined3d_sampler *sampler)
Definition: sampler.c:26
ULONG CDECL wined3d_sampler_decref(struct wined3d_sampler *sampler)
Definition: sampler.c:35
#define offsetof(TYPE, MEMBER)
#define ERR_(ch,...)
Definition: debug.h:156
#define WARN_(ch,...)
Definition: debug.h:157
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:242
static int rb_put(struct rb_tree *tree, const void *key, struct rb_entry *entry)
Definition: rbtree.h:204
#define YieldProcessor
Definition: ke.h:48
#define memset(x, y, z)
Definition: compat.h:39
static FILE * client
Definition: client.c:37
#define TRACE(s)
Definition: solgame.cpp:4
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
PVOID LoaderLock
Definition: ntddk_ex.h:295
Definition: palette.c:466
Definition: http.c:7252
Definition: devices.h:37
Definition: filter.c:165
Definition: dhcpd.h:135
unsigned int max_count
Definition: cs.c:2144
size_t size
Definition: cs.c:2143
enum wined3d_shader_type shader_type
Definition: cs.c:2145
Definition: queue.c:179
size_t size
Definition: utils.c:170
Definition: dhcpd.h:248
uint32_t flags
enum view_type type
size_t memory_offset
uint8_t refcount
unsigned int client_map_count
struct wined3d_resource resource
LONG * upload_heap_refcount
Definition: cs.c:65
struct wined3d_resource ** resources
Definition: cs.c:59
HANDLE upload_heap
Definition: cs.c:64
SIZE_T data_size
Definition: cs.c:55
struct wined3d_deferred_upload * uploads
Definition: cs.c:62
SIZE_T query_count
Definition: cs.c:73
SIZE_T resource_count
Definition: cs.c:58
struct wined3d_deferred_query_issue * queries
Definition: cs.c:74
struct wined3d_command_list ** command_lists
Definition: cs.c:71
LONG refcount
Definition: cs.c:51
SIZE_T upload_count
Definition: cs.c:61
SIZE_T command_list_count
Definition: cs.c:70
void * data
Definition: cs.c:56
struct wined3d_device * device
Definition: cs.c:53
unsigned int sub_resource_idx
enum wined3d_cs_op opcode
Definition: cs.c:508
struct wined3d_texture * texture
Definition: cs.c:509
struct wined3d_resource * dst_resource
Definition: cs.c:485
struct wined3d_blt_fx fx
Definition: cs.c:492
enum wined3d_cs_op opcode
Definition: cs.c:484
struct wined3d_box src_box
Definition: cs.c:490
struct wined3d_resource * src_resource
Definition: cs.c:488
unsigned int src_sub_resource_idx
Definition: cs.c:489
struct wined3d_box dst_box
Definition: cs.c:487
enum wined3d_texture_filter_type filter
Definition: cs.c:493
unsigned int dst_sub_resource_idx
Definition: cs.c:486
void * object
Definition: cs.c:433
enum wined3d_cs_op opcode
Definition: cs.c:431
void(* callback)(void *object)
Definition: cs.c:432
enum wined3d_cs_op opcode
Definition: cs.c:185
unsigned int sub_resource_idx
Definition: cs.c:187
struct wined3d_texture * texture
Definition: cs.c:186
struct wined3d_unordered_access_view * view
Definition: cs.c:516
enum wined3d_cs_op opcode
Definition: cs.c:515
struct wined3d_uvec4 clear_value
Definition: cs.c:517
uint32_t flags
Definition: cs.c:172
float depth
Definition: cs.c:177
unsigned int rt_count
Definition: cs.c:173
RECT rects[1]
Definition: cs.c:180
unsigned int rect_count
Definition: cs.c:179
DWORD stencil
Definition: cs.c:178
RECT draw_rect
Definition: cs.c:175
struct wined3d_fb_state fb
Definition: cs.c:174
enum wined3d_cs_op opcode
Definition: cs.c:171
struct wined3d_buffer * buffer
Definition: cs.c:524
struct wined3d_unordered_access_view * view
Definition: cs.c:526
unsigned int offset
Definition: cs.c:525
enum wined3d_cs_op opcode
Definition: cs.c:523
struct wined3d_dispatch_parameters parameters
Definition: cs.c:195
enum wined3d_cs_op opcode
Definition: cs.c:194
enum wined3d_cs_op opcode
Definition: cs.c:200
enum wined3d_primitive_type primitive_type
Definition: cs.c:201
unsigned int patch_vertex_count
Definition: cs.c:202
struct wined3d_draw_parameters parameters
Definition: cs.c:203
struct wined3d_command_list * list
Definition: cs.c:538
enum wined3d_cs_op opcode
Definition: cs.c:537
enum wined3d_cs_op opcode
Definition: cs.c:208
struct wined3d_shader_resource_view * view
Definition: cs.c:532
enum wined3d_cs_op opcode
Definition: cs.c:531
enum wined3d_cs_op opcode
Definition: cs.c:476
uint32_t flags
Definition: cs.c:462
enum wined3d_cs_op opcode
Definition: cs.c:457
unsigned int sub_resource_idx
Definition: cs.c:459
HRESULT * hr
Definition: cs.c:463
struct wined3d_resource * resource
Definition: cs.c:458
const struct wined3d_box * box
Definition: cs.c:461
void ** map_ptr
Definition: cs.c:460
enum wined3d_cs_op opcode
Definition: cs.c:155
size_t size
Definition: cs.c:149
enum wined3d_cs_op opcode
Definition: cs.c:445
struct wined3d_resource * resource
Definition: cs.c:446
HWND dst_window_override
Definition: cs.c:161
unsigned int swap_interval
Definition: cs.c:165
enum wined3d_cs_op opcode
Definition: cs.c:160
RECT src_rect
Definition: cs.c:163
struct wined3d_swapchain * swapchain
Definition: cs.c:162
RECT dst_rect
Definition: cs.c:164
uint32_t flags
Definition: cs.c:166
unsigned int start_idx
Definition: cs.c:418
unsigned int count
Definition: cs.c:419
uint32_t update_mask
Definition: cs.c:420
enum wined3d_push_constants type
Definition: cs.c:417
enum wined3d_cs_op opcode
Definition: cs.c:416
struct wined3d_query * query
Definition: cs.c:439
enum wined3d_cs_op opcode
Definition: cs.c:438
uint32_t flags
Definition: cs.c:440
enum wined3d_cs_op opcode
Definition: cs.c:425
struct wined3d_color factor
Definition: cs.c:342
struct wined3d_blend_state * state
Definition: cs.c:341
unsigned int sample_mask
Definition: cs.c:343
enum wined3d_cs_op opcode
Definition: cs.c:340
enum wined3d_cs_op opcode
Definition: cs.c:390
struct wined3d_vec4 plane
Definition: cs.c:392
struct wined3d_color_key color_key
Definition: cs.c:297
enum wined3d_cs_op opcode
Definition: cs.c:293
struct wined3d_texture * texture
Definition: cs.c:294
unsigned int start_idx
Definition: cs.c:278
enum wined3d_cs_op opcode
Definition: cs.c:276
enum wined3d_shader_type type
Definition: cs.c:277
enum wined3d_cs_op opcode
Definition: cs.c:361
struct wined3d_depth_stencil_state * state
Definition: cs.c:349
enum wined3d_cs_op opcode
Definition: cs.c:348
struct wined3d_rendertarget_view * view
Definition: cs.c:243
enum wined3d_cs_op opcode
Definition: cs.c:242
enum wined3d_cs_op opcode
Definition: cs.c:410
enum wined3d_feature_level level
Definition: cs.c:411
enum wined3d_format_id format_id
Definition: cs.c:270
unsigned int offset
Definition: cs.c:271
enum wined3d_cs_op opcode
Definition: cs.c:268
struct wined3d_buffer * buffer
Definition: cs.c:269
enum wined3d_cs_op opcode
Definition: cs.c:403
unsigned int idx
Definition: cs.c:404
struct wined3d_light_info light
Definition: cs.c:398
enum wined3d_cs_op opcode
Definition: cs.c:397
enum wined3d_cs_op opcode
Definition: cs.c:213
struct wined3d_query * predicate
Definition: cs.c:214
enum wined3d_cs_op opcode
Definition: cs.c:355
struct wined3d_rasterizer_state * state
Definition: cs.c:356
enum wined3d_render_state state
Definition: cs.c:369
enum wined3d_cs_op opcode
Definition: cs.c:368
struct wined3d_rendertarget_view * views[1]
Definition: cs.c:237
enum wined3d_cs_op opcode
Definition: cs.c:234
enum wined3d_cs_op opcode
Definition: cs.c:324
unsigned int start_idx
Definition: cs.c:326
unsigned int count
Definition: cs.c:327
enum wined3d_shader_type type
Definition: cs.c:325
unsigned int rect_count
Definition: cs.c:228
enum wined3d_cs_op opcode
Definition: cs.c:227
enum wined3d_cs_op opcode
Definition: cs.c:302
enum wined3d_shader_type type
Definition: cs.c:303
struct wined3d_shader_resource_view * views[1]
Definition: cs.c:306
struct wined3d_shader * shader
Definition: cs.c:335
enum wined3d_cs_op opcode
Definition: cs.c:333
enum wined3d_shader_type type
Definition: cs.c:334
struct wined3d_stream_output outputs[WINED3D_MAX_STREAM_OUTPUT_BUFFERS]
Definition: cs.c:263
enum wined3d_cs_op opcode
Definition: cs.c:262
struct wined3d_stream_state streams[1]
Definition: cs.c:257
unsigned int count
Definition: cs.c:256
enum wined3d_cs_op opcode
Definition: cs.c:254
unsigned int start_idx
Definition: cs.c:255
enum wined3d_texture_stage_state state
Definition: cs.c:377
enum wined3d_cs_op opcode
Definition: cs.c:375
enum wined3d_shader_type shader_type
Definition: cs.c:286
struct wined3d_shader_resource_view * view
Definition: cs.c:288
unsigned int bind_index
Definition: cs.c:287
enum wined3d_cs_op opcode
Definition: cs.c:285
enum wined3d_cs_op opcode
Definition: cs.c:383
enum wined3d_transform_state state
Definition: cs.c:384
struct wined3d_cs_set_unordered_access_views::@333 uavs[1]
struct wined3d_unordered_access_view * view
Definition: cs.c:317
enum wined3d_pipeline pipeline
Definition: cs.c:312
enum wined3d_cs_op opcode
Definition: cs.c:311
enum wined3d_cs_op opcode
Definition: cs.c:248
struct wined3d_vertex_declaration * declaration
Definition: cs.c:249
struct wined3d_viewport viewports[1]
Definition: cs.c:222
enum wined3d_cs_op opcode
Definition: cs.c:220
unsigned int viewport_count
Definition: cs.c:221
enum wined3d_cs_op opcode
Definition: cs.c:543
enum wined3d_cs_op opcode
Definition: cs.c:451
struct wined3d_resource * resource
Definition: cs.c:452
struct wined3d_resource * resource
Definition: cs.c:469
unsigned int sub_resource_idx
Definition: cs.c:470
enum wined3d_cs_op opcode
Definition: cs.c:468
HRESULT * hr
Definition: cs.c:471
struct upload_bo bo
Definition: cs.c:502
struct wined3d_box box
Definition: cs.c:501
unsigned int row_pitch
Definition: cs.c:503
unsigned int sub_resource_idx
Definition: cs.c:500
enum wined3d_cs_op opcode
Definition: cs.c:498
struct wined3d_resource * resource
Definition: cs.c:499
unsigned int slice_pitch
Definition: cs.c:503
HMODULE wined3d_module
struct wined3d_d3d_limits limits
uint32_t draw_base_vertex_offset
SIZE_T command_list_count
Definition: cs.c:4192
struct wined3d_deferred_upload * uploads
Definition: cs.c:4184
SIZE_T command_lists_capacity
Definition: cs.c:4192
SIZE_T resources_capacity
Definition: cs.c:4180
SIZE_T uploads_capacity
Definition: cs.c:4183
struct wined3d_resource ** resources
Definition: cs.c:4181
SIZE_T data_capacity
Definition: cs.c:4177
SIZE_T queries_capacity
Definition: cs.c:4195
struct wined3d_deferred_query_issue * queries
Definition: cs.c:4196
struct wined3d_command_list ** command_lists
Definition: cs.c:4193
LONG * upload_heap_refcount
Definition: cs.c:4187
SIZE_T resource_count
Definition: cs.c:4180
struct wined3d_device_context c
Definition: cs.c:4175
unsigned int flags
Definition: cs.c:46
struct wined3d_query * query
Definition: cs.c:45
struct wined3d_box box
Definition: cs.c:39
struct wined3d_bo * bo
Definition: cs.c:37
uint8_t * sysmem
Definition: cs.c:38
unsigned int sub_resource_idx
Definition: cs.c:36
uint8_t * map_ptr
Definition: cs.c:38
struct wined3d_resource * resource
Definition: cs.c:35
uint32_t upload_flags
Definition: cs.c:40
struct color_fixup_desc color_fixup
struct rb_entry entry
unsigned int OriginalIndex
struct wined3d_light_constants constants
struct wined3d_light OriginalParms
struct list poll_list_entry
struct wined3d_resource * resource
const struct wined3d_format * format
unsigned int cs_multithreaded
struct wined3d_resource * resource
const DWORD * function
unsigned int representative
enum wined3d_primitive_type primitive_type
unsigned int patch_vertex_count
unsigned int stencil_ref
struct wined3d_color blend_factor
uint32_t sample_mask
struct wined3d_texture ** back_buffers
const struct wined3d_swapchain_ops * swapchain_ops
struct wined3d_swapchain_state state
struct wined3d_device * device
unsigned int slice_pitch
const struct wined3d_texture_ops * texture_ops
struct wined3d_swapchain * swapchain
unsigned int row_pitch
struct wined3d_resource resource
unsigned int level_count
struct wined3d_resource * resource
#define max(a, b)
Definition: svc.c:63
static void invalidate()
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:587
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:669
GLfixed fx
Definition: tritemp.h:484
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
int64_t LONGLONG
Definition: typedefs.h:68
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
LONGLONG QuadPart
Definition: typedefs.h:114
Definition: pdh_main.c:64
HANDLE WINAPI GetCurrentThread(void)
Definition: proc.c:1195
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define WINAPI
Definition: msvc.h:6
const struct wined3d_parent_ops wined3d_null_parent_ops
Definition: directx.c:3472
void state_cleanup(struct wined3d_state *state)
Definition: stateblock.c:648
void CDECL wined3d_state_destroy(struct wined3d_state *state)
Definition: stateblock.c:2385
HRESULT CDECL wined3d_state_create(struct wined3d_device *device, const enum wined3d_feature_level *levels, unsigned int level_count, struct wined3d_state **state)
Definition: stateblock.c:2357
bool wined3d_light_state_enable_light(struct wined3d_light_state *state, const struct wined3d_d3d_info *d3d_info, struct wined3d_light_info *light_info, BOOL enable)
Definition: stateblock.c:803
struct wined3d_light_info * wined3d_light_state_get_light(const struct wined3d_light_state *state, unsigned int idx)
Definition: stateblock.c:687
void CDECL wined3d_swapchain_set_window(struct wined3d_swapchain *swapchain, HWND window)
Definition: swapchain.c:177
#define WINED3DISSUE_BEGIN
Definition: wined3d.h:781
#define WINED3D_CKEY_DST_BLT
Definition: wined3d.h:1339
#define WINED3DCLEAR_TARGET
Definition: wined3d.h:1008
@ WINED3D_FOG_NONE
Definition: wined3d.h:480
wined3d_render_state
Definition: wined3d.h:288
@ WINED3D_RS_SRGBWRITEENABLE
Definition: wined3d.h:400
@ WINED3D_RS_FOGTABLEMODE
Definition: wined3d.h:318
@ WINED3D_RS_FOGENABLE
Definition: wined3d.h:311
wined3d_primitive_type
Definition: wined3d.h:74
@ WINED3D_PT_POINTLIST
Definition: wined3d.h:76
#define WINED3D_OK
Definition: wined3d.h:33
#define WINED3D_BLT_ALPHA_TEST
Definition: wined3d.h:1373
#define WINED3D_CKEY_SRC_OVERLAY
Definition: wined3d.h:1342
@ WINED3D_SWAP_EFFECT_FLIP_DISCARD
Definition: wined3d.h:536
@ WINED3D_SWAP_EFFECT_DISCARD
Definition: wined3d.h:534
#define WINED3DUSAGE_LEGACY_CUBEMAP
Definition: wined3d.h:934
#define WINED3D_MAX_PS_CONSTS_F
Definition: wined3d.h:1605
#define WINED3D_MAX_STREAM_OUTPUT_BUFFERS
Definition: wined3d.h:1576
#define WINED3D_RESOURCE_ACCESS_GPU
Definition: wined3d.h:51
#define WINED3D_BLT_SRC_CKEY
Definition: wined3d.h:1367
#define WINED3D_RESOURCE_ACCESS_CPU
Definition: wined3d.h:52
@ WINED3D_RTYPE_BUFFER
Definition: wined3d.h:718
@ WINED3D_RTYPE_TEXTURE_3D
Definition: wined3d.h:721
#define WINED3D_MAX_VS_CONSTS_F
Definition: wined3d.h:1604
wined3d_texture_filter_type
Definition: wined3d.h:704
@ WINED3D_TEXF_POINT
Definition: wined3d.h:706
wined3d_texture_stage_state
Definition: wined3d.h:593
#define WINED3D_CKEY_SRC_BLT
Definition: wined3d.h:1341
wined3d_format_id
Definition: wined3d.h:126
@ WINED3DFMT_A8_UNORM
Definition: wined3d.h:222
#define WINED3DISSUE_END
Definition: wined3d.h:782
wined3d_pipeline
Definition: wined3d.h:854
@ WINED3D_PIPELINE_COMPUTE
Definition: wined3d.h:856
@ WINED3D_PIPELINE_GRAPHICS
Definition: wined3d.h:855
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 WINED3DCLEAR_STENCIL
Definition: wined3d.h:1010
#define WINED3DCLEAR_SYNCHRONOUS
Definition: wined3d.h:1011
#define WINED3D_RESOURCE_ACCESS_MAP_R
Definition: wined3d.h:53
#define WINED3D_MAP_DISCARD
Definition: wined3d.h:953
#define WINED3D_MAP_WRITE
Definition: wined3d.h:956
#define WINED3D_BLT_SYNCHRONOUS
Definition: wined3d.h:1372
#define WINED3D_MAX_CONSTS_B
Definition: wined3d.h:1602
wined3d_feature_level
Definition: wined3d.h:98
#define WINED3DCLEAR_ZBUFFER
Definition: wined3d.h:1009
#define WINED3D_CKEY_DST_OVERLAY
Definition: wined3d.h:1340
wined3d_shader_type
Definition: wined3d.h:840
@ WINED3D_SHADER_TYPE_PIXEL
Definition: wined3d.h:841
@ WINED3D_SHADER_TYPE_GEOMETRY
Definition: wined3d.h:843
@ WINED3D_SHADER_TYPE_COMPUTE
Definition: wined3d.h:848
@ WINED3D_SHADER_TYPE_VERTEX
Definition: wined3d.h:842
@ WINED3D_SHADER_TYPE_COUNT
Definition: wined3d.h:849
#define WINED3D_MAX_CONSTS_I
Definition: wined3d.h:1603
#define WINED3D_MAP_NOOVERWRITE
Definition: wined3d.h:952
#define WINED3D_SWAPCHAIN_DISCARD_DEPTHSTENCIL
Definition: wined3d.h:892
wined3d_transform_state
Definition: wined3d.h:666
@ WINED3D_TS_PROJECTION
Definition: wined3d.h:668
#define WINED3D_MAX_FFP_TEXTURES
Definition: wined3d.h:1597
#define WINED3D_BIND_CONSTANT_BUFFER
Definition: wined3d.h:911
#define WINED3D_SRGB_READ_WRITE_CONTROL
Definition: wined3d.h:1330
#define WINED3D_RESOURCE_ACCESS_MAP_W
Definition: wined3d.h:54
#define WINED3D_BLT_RAW
Definition: wined3d.h:1371
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:544
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:539
CRITICAL_SECTION wined3d_command_cs
Definition: wined3d_main.c:104
#define STATE_BASEVERTEXINDEX
#define STATE_DEPTH_STENCIL
static unsigned int wined3d_texture_get_level_height(const struct wined3d_texture *texture, unsigned int level)
#define UPLOAD_BO_RENAME_ON_UNMAP
#define STATE_CLIPPLANE(a)
#define STATE_STENCIL_REF
#define STATE_CONSTANT_BUFFER(a)
#define WINED3D_CS_QUEUE_MASK
#define STATE_HIGHEST
wined3d_push_constants
@ WINED3D_PUSH_CONSTANTS_PS_FFP
@ WINED3D_PUSH_CONSTANTS_PS_B
@ WINED3D_PUSH_CONSTANTS_VS_B
@ WINED3D_PUSH_CONSTANTS_VS_FFP
@ WINED3D_PUSH_CONSTANTS_VS_I
@ WINED3D_PUSH_CONSTANTS_PS_F
@ WINED3D_PUSH_CONSTANTS_PS_I
@ WINED3D_PUSH_CONSTANTS_COUNT
@ WINED3D_PUSH_CONSTANTS_VS_F
#define WINED3D_MAX_CBS
#define WINED3D_SHADER_CONST_BASE_VERTEX_ID
static void wined3d_resource_get_sub_resource_map_pitch(struct wined3d_resource *resource, unsigned int sub_resource_idx, unsigned int *row_pitch, unsigned int *slice_pitch)
#define WINED3D_STATE_NO_REF
#define STATE_GRAPHICS_SHADER_RESOURCE_BINDING
#define WINED3D_LOCATION_SYSMEM
static void wined3d_device_bo_map_lock(struct wined3d_device *device)
static void wined3d_cs_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id queue_id)
#define STATE_STREAM_OUTPUT
static void wined3d_device_bo_map_unlock(struct wined3d_device *device)
static void wined3d_not_from_cs(const struct wined3d_cs *cs)
static unsigned int wined3d_texture_get_level_width(const struct wined3d_texture *texture, unsigned int level)
#define WINED3D_FORMAT_CAP_SHADOW
#define WINED3D_CSMT_ENABLE
#define STATE_DEPTH_BOUNDS
#define UPLOAD_BO_FREE_ON_UNMAP
static void wined3d_resource_wait_idle(const struct wined3d_resource *resource)
#define WINED3D_STATE_INIT_DEFAULT
#define STATE_SHADER(a)
static struct wined3d_texture * wined3d_state_get_ffp_texture(const struct wined3d_state *state, unsigned int idx)
#define WINED3D_CSMT_SERIALIZE
#define WINED3D_LOCATION_BUFFER
#define MAX_UNORDERED_ACCESS_VIEWS
static void wined3d_pause(unsigned int *spin_count)
#define WINED3D_CS_QUEUE_SIZE
static void context_release(struct wined3d_context *context)
#define RESOURCE_ALIGNMENT
static BOOL is_same_fixup(struct color_fixup_desc f1, struct color_fixup_desc f2)
static void wined3d_device_context_unlock(struct wined3d_device_context *context)
static BOOL can_use_texture_swizzle(const struct wined3d_d3d_info *d3d_info, const struct wined3d_format *format)
#define STATE_BLEND_FACTOR
#define WINED3D_FORMAT_CAP_SRGB_WRITE
#define STATE_SAMPLE_MASK
#define STATE_SCISSORRECT
static ULONG wined3d_resource_decref(struct wined3d_resource *resource)
#define CLIENT_BO_DISCARDED
static void wined3d_state_reset(struct wined3d_state *state, const struct wined3d_d3d_info *d3d_info)
#define STATE_STREAMSRC
#define WINED3D_CS_SPIN_COUNT
#define STATE_COMPUTE_SHADER_RESOURCE_BINDING
#define WINED3D_LOCATION_TEXTURE_RGB
static size_t align(size_t addr, size_t alignment)
static bool wined3d_map_persistent(void)
static void wined3d_resource_reference(struct wined3d_resource *resource)
#define WINED3D_CS_COMMAND_WAIT_WITH_QUERIES_TIMEOUT
#define STATE_RASTERIZER
#define WINED3D_TEXTURE_DISCARD
static void wined3d_device_context_lock(struct wined3d_device_context *context)
#define WINED3D_CS_QUERY_POLL_INTERVAL
static ULONG wined3d_resource_incref(struct wined3d_resource *resource)
@ QUERY_BUILDING
@ QUERY_SIGNALLED
static void wined3d_from_cs(const struct wined3d_cs *cs)
#define WINED3D_LOCATION_DISCARDED
#define STATE_TEXTURESTAGE(stage, num)
static void * wined3d_context_map_bo_address(struct wined3d_context *context, const struct wined3d_bo_address *data, size_t size, uint32_t map_flags)
#define STATE_INDEXBUFFER
#define STATE_UNORDERED_ACCESS_VIEW_BINDING(a)
#define STATE_VDECL
#define UPLOAD_BO_UPLOAD_ON_UNMAP
#define STATE_VIEWPORT
static void wined3d_context_destroy_bo(struct wined3d_context *context, struct wined3d_bo *bo)
static struct wined3d_context * context_acquire(struct wined3d_device *device, struct wined3d_texture *texture, unsigned int sub_resource_idx)
wined3d_cs_queue_id
@ WINED3D_CS_QUEUE_MAP
@ WINED3D_CS_QUEUE_DEFAULT
#define STATE_FRAMEBUFFER
#define STATE_RENDER(a)
#define STATE_BLEND
static struct wined3d_texture * texture_from_resource(struct wined3d_resource *resource)
static struct wined3d_buffer * buffer_from_resource(struct wined3d_resource *resource)
static unsigned int wined3d_texture_get_level_depth(const struct wined3d_texture *texture, unsigned int level)
#define poll
Definition: wintirpc.h:59
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
unsigned char BYTE
Definition: xxhash.c:193