-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcsmt-wine-1.7.4-0.2.patch
15851 lines (14774 loc) · 594 KB
/
csmt-wine-1.7.4-0.2.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
diff -Naur a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
--- a/dlls/ddraw/ddraw.c 2013-10-11 17:21:06.000000000 +0000
+++ b/dlls/ddraw/ddraw.c 2013-11-07 21:40:09.000000000 +0000
@@ -776,6 +776,13 @@
restore_mode_on_normal);
DDRAW_dump_cooperativelevel(cooplevel);
+ /* hack for WA/WWP/Diablo, wine bug 2082
+ *
+ * These programs use dialog boxes containing standard controls, which they
+ * draw over using directdraw. If we draw to the given window, the draw will
+ * be clipped by the dialog. Instead, draw to the desktop window. */
+ if (use_desktop_hack) window = GetDesktopWindow();
+
wined3d_mutex_lock();
if (ddraw->flags & DDRAW_SCL_RECURSIVE)
@@ -2962,7 +2969,7 @@
}
}
- if (DDSD->ddsCaps.dwCaps2 & DDSCAPS2_TEXTUREMANAGE)
+ if (DDSD->ddsCaps.dwCaps2 & (DDSCAPS2_TEXTUREMANAGE | DDSCAPS2_D3DTEXTUREMANAGE))
{
if (!(DDSD->ddsCaps.dwCaps & DDSCAPS_TEXTURE))
{
@@ -3001,7 +3008,7 @@
}
if (!(desc2.ddsCaps.dwCaps & (DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY))
- && !(desc2.ddsCaps.dwCaps2 & DDSCAPS2_TEXTUREMANAGE))
+ && !(desc2.ddsCaps.dwCaps2 & (DDSCAPS2_TEXTUREMANAGE | DDSCAPS2_D3DTEXTUREMANAGE)))
{
enum wined3d_format_id format = wined3dformat_from_ddrawformat(&desc2.u4.ddpfPixelFormat);
enum wined3d_resource_type rtype;
@@ -5279,7 +5286,8 @@
ddraw->numIfaces = 1;
ddraw->ref7 = 1;
- flags = WINED3D_LEGACY_DEPTH_BIAS | WINED3D_VIDMEM_ACCOUNTING;
+ flags = WINED3D_LEGACY_DEPTH_BIAS | WINED3D_VIDMEM_ACCOUNTING
+ | WINED3D_NO_CSMT;
if (!(ddraw->wined3d = wined3d_create(7, flags)))
{
if (!(ddraw->wined3d = wined3d_create(7, flags | WINED3D_NO3D)))
diff -Naur a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h
--- a/dlls/ddraw/ddraw_private.h 2013-10-11 17:21:06.000000000 +0000
+++ b/dlls/ddraw/ddraw_private.h 2013-11-07 21:40:09.000000000 +0000
@@ -128,6 +128,9 @@
void DDRAW_Convert_DDDEVICEIDENTIFIER_2_To_1(const DDDEVICEIDENTIFIER2 *pIn, DDDEVICEIDENTIFIER *pOut) DECLSPEC_HIDDEN;
struct wined3d_vertex_declaration *ddraw_find_decl(struct ddraw *ddraw, DWORD fvf) DECLSPEC_HIDDEN;
+/* hack for WA/WWP/Diablo */
+extern int use_desktop_hack;
+
struct ddraw_surface
{
/* IUnknown fields */
diff -Naur a/dlls/ddraw/main.c b/dlls/ddraw/main.c
--- a/dlls/ddraw/main.c 2013-10-11 17:21:06.000000000 +0000
+++ b/dlls/ddraw/main.c 2013-11-07 21:40:09.000000000 +0000
@@ -36,6 +36,9 @@
WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
+/* hack for WA/WWP/Diablo */
+int use_desktop_hack = 0;
+
static struct list global_ddraw_list = LIST_INIT(global_ddraw_list);
static HINSTANCE instance;
@@ -799,6 +802,22 @@
}
/***********************************************************************
+ * get_config_key
+ *
+ * Reads a config key from the registry. Taken from WineD3D
+ *
+ ***********************************************************************/
+static inline DWORD get_config_key(HKEY defkey, HKEY appkey, const char* name, char* buffer, DWORD size)
+{
+ if (0 != appkey && !RegQueryValueExA( appkey, name, 0, NULL, (LPBYTE) buffer, &size )) return 0;
+ if (0 != defkey && !RegQueryValueExA( defkey, name, 0, NULL, (LPBYTE) buffer, &size )) return 0;
+ return ERROR_FILE_NOT_FOUND;
+}
+
+#define IS_OPTION_TRUE(ch) \
+ ((ch) == 'y' || (ch) == 'Y' || (ch) == 't' || (ch) == 'T' || (ch) == '1')
+
+/***********************************************************************
* DllMain (DDRAW.0)
*
* Could be used to register DirectDraw drivers, if we have more than
@@ -813,8 +832,12 @@
case DLL_PROCESS_ATTACH:
{
static HMODULE ddraw_self;
+ char buffer[MAX_PATH+10];
+ DWORD size = sizeof(buffer);
HKEY hkey = 0;
+ HKEY appkey = 0;
WNDCLASSA wc;
+ DWORD len;
/* Register the window class. This is used to create a hidden window
* for D3D rendering, if the application didn't pass one. It can also
@@ -835,6 +858,33 @@
return FALSE;
}
+ /* @@ Wine registry key: HKCU\Software\Wine\Direct3D */
+ if ( RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\Direct3D", &hkey ) ) hkey = 0;
+
+ len = GetModuleFileNameA( 0, buffer, MAX_PATH );
+ if (len && len < MAX_PATH)
+ {
+ HKEY tmpkey;
+ /* @@ Wine registry key: HKCU\Software\Wine\AppDefaults\app.exe\Direct3D */
+ if (!RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\AppDefaults", &tmpkey ))
+ {
+ char *p, *appname = buffer;
+ if ((p = strrchr( appname, '/' ))) appname = p + 1;
+ if ((p = strrchr( appname, '\\' ))) appname = p + 1;
+ strcat( appname, "\\Direct3D" );
+ TRACE("appname = [%s]\n", appname);
+ if (RegOpenKeyA( tmpkey, appname, &appkey )) appkey = 0;
+ RegCloseKey( tmpkey );
+ }
+ }
+
+ if ( 0 != hkey || 0 != appkey )
+ {
+ /* hack for WA/WWP/Diablo */
+ if ( !get_config_key( hkey, appkey, "DDrawDesktopHack", buffer, size) )
+ use_desktop_hack = IS_OPTION_TRUE( buffer[0] );
+ }
+
/* On Windows one can force the refresh rate that DirectDraw uses by
* setting an override value in dxdiag. This is documented in KB315614
* (main article), KB230002, and KB217348. By comparing registry dumps
diff -Naur a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c
--- a/dlls/ddraw/surface.c 2013-10-11 17:21:06.000000000 +0000
+++ b/dlls/ddraw/surface.c 2013-11-07 21:40:09.000000000 +0000
@@ -5608,7 +5608,7 @@
else
layers = 1;
- if (desc->ddsCaps.dwCaps2 & DDSCAPS2_TEXTUREMANAGE)
+ if (desc->ddsCaps.dwCaps2 & (DDSCAPS2_TEXTUREMANAGE | DDSCAPS2_D3DTEXTUREMANAGE))
{
wined3d_desc.usage = WINED3DUSAGE_TEXTURE;
pool = WINED3D_POOL_MANAGED;
@@ -5623,7 +5623,7 @@
}
else
{
- wined3d_desc.usage = WINED3DUSAGE_TEXTURE;
+ wined3d_desc.usage = WINED3DUSAGE_TEXTURE | WINED3DUSAGE_DYNAMIC;
pool = WINED3D_POOL_DEFAULT;
}
@@ -5730,7 +5730,7 @@
if (!(desc->ddsCaps.dwCaps & (DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY))
&& !((desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE)
- && (desc->ddsCaps.dwCaps2 & DDSCAPS2_TEXTUREMANAGE)))
+ && (desc->ddsCaps.dwCaps2 & (DDSCAPS2_TEXTUREMANAGE | DDSCAPS2_D3DTEXTUREMANAGE))))
{
/* Tests show surfaces without memory flags get these flags added
* right after creation. */
@@ -5760,7 +5760,7 @@
{
pool = WINED3D_POOL_SYSTEM_MEM;
}
- else if (desc->ddsCaps.dwCaps2 & DDSCAPS2_TEXTUREMANAGE)
+ else if (desc->ddsCaps.dwCaps2 & (DDSCAPS2_TEXTUREMANAGE | DDSCAPS2_D3DTEXTUREMANAGE))
{
pool = WINED3D_POOL_MANAGED;
/* Managed textures have the system memory flag set. */
@@ -5771,6 +5771,7 @@
/* Videomemory adds localvidmem. This is mutually exclusive with
* systemmemory and texturemanage. */
desc->ddsCaps.dwCaps |= DDSCAPS_LOCALVIDMEM;
+ usage |= WINED3DUSAGE_DYNAMIC;
}
format = wined3dformat_from_ddrawformat(&desc->u4.ddpfPixelFormat);
@@ -5837,8 +5838,12 @@
}
else
{
+ UINT row_pitch, slice_pitch;
+ struct wined3d_resource *resource = wined3d_surface_get_resource(surface->wined3d_surface);
+ wined3d_resource_get_pitch(resource, &row_pitch, &slice_pitch);
+
surface->surface_desc.dwFlags |= DDSD_PITCH;
- surface->surface_desc.u1.lPitch = wined3d_surface_get_pitch(surface->wined3d_surface);
+ surface->surface_desc.u1.lPitch = row_pitch;
}
if (desc->dwFlags & DDSD_CKDESTOVERLAY)
diff -Naur a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
--- a/dlls/wined3d/arb_program_shader.c 2013-10-11 17:21:06.000000000 +0000
+++ b/dlls/wined3d/arb_program_shader.c 2013-11-07 21:40:10.000000000 +0000
@@ -170,6 +170,7 @@
} no;
struct wined3d_shader_loop_control loop_control;
BOOL had_else;
+ char src_param[256]; /* For the broken ARA quirk */
};
struct arb_ps_np2fixup_info
@@ -185,8 +186,7 @@
struct arb_ps_compile_args
{
struct ps_compile_args super;
- WORD bools;
- WORD clip; /* only a boolean, use a WORD for alignment */
+ DWORD bools;
unsigned char loop_ctrl[MAX_CONST_I][3];
};
@@ -706,7 +706,7 @@
{
const struct wined3d_shader *pshader = state->shader[WINED3D_SHADER_TYPE_PIXEL];
const struct arb_ps_compiled_shader *gl_shader = priv->compiled_fprog;
- UINT rt_height = state->fb->render_targets[0]->resource.height;
+ UINT rt_height = state->fb.render_targets[0]->resource.height;
/* Load DirectX 9 float constants for pixel shader */
priv->highest_dirty_ps_const = shader_arb_load_constantsF(pshader, gl_info, GL_FRAGMENT_PROGRAM_ARB,
@@ -2506,7 +2506,9 @@
case WINED3DSIH_RSQ: instruction = "RSQ"; break;
case WINED3DSIH_RCP: instruction = "RCP"; break;
case WINED3DSIH_EXP: instruction = "EX2"; break;
- case WINED3DSIH_EXPP: instruction = "EXP"; break;
+ /* Use EX2, not EXP, otherwise fog breaks in Guild
+ * Wars 2. */
+ case WINED3DSIH_EXPP: instruction = "EX2"; break;
default: instruction = "";
FIXME("Unhandled opcode %#x\n", ins->handler_idx);
break;
@@ -2803,8 +2805,12 @@
return;
}
- /* LOG and LOGP operate on the absolute value of the input */
- src0_copy.modifiers = abs_modifier(src0_copy.modifiers, &need_abs);
+ /* LOG and LOGP operate on the absolute value of the input. */
+ /* CrossOver hack: This was added for a DCT test, and it breaks Half Life
+ * 2 Episode two because the TA blasts the 32 register limit on gf7 cards.
+ * Allow disabling it for HL2. */
+ if (!cxgames_hacks.no_pow_abs)
+ src0_copy.modifiers = abs_modifier(src0_copy.modifiers, &need_abs);
shader_arb_get_dst_param(ins, &ins->dst[0], dst);
shader_arb_get_src_param(ins, &src0_copy, 0, src0);
@@ -2829,8 +2835,12 @@
struct shader_arb_ctx_priv *priv = ins->ctx->backend_data;
const char *one = arb_get_helper_value(ins->ctx->reg_maps->shader_version.type, ARB_ONE);
- /* POW operates on the absolute value of the input */
- src0_copy.modifiers = abs_modifier(src0_copy.modifiers, &need_abs);
+ /* POW operates on the absolute value of the input. */
+ /* CrossOver hack: This was added for a DCT test, and it breaks Half Life
+ * 2 Episode two because the TA blasts the 32 register limit on gf7 cards.
+ * Allow disabling it for HL2. */
+ if (!cxgames_hacks.no_pow_abs)
+ src0_copy.modifiers = abs_modifier(src0_copy.modifiers, &need_abs);
shader_arb_get_dst_param(ins, &ins->dst[0], dst);
shader_arb_get_src_param(ins, &src0_copy, 0, src0);
@@ -2862,11 +2872,33 @@
}
}
+static void loop_helper_component(unsigned int depth, char *counter, char *aL)
+{
+ if(depth == 0)
+ {
+ *counter = 'x';
+ *aL = 'y';
+ return;
+ }
+ if(depth == 1)
+ {
+ *counter = 'z';
+ *aL = 'w';
+ return;
+ }
+
+ FIXME("Unsupported loop depth for broken ARA quirk: %u\n", depth);
+ *counter = '?';
+ *aL = '?';
+}
+
static void shader_hw_loop(const struct wined3d_shader_instruction *ins)
{
struct wined3d_shader_buffer *buffer = ins->ctx->buffer;
char src_name[50];
BOOL vshader = shader_is_vshader_version(ins->ctx->reg_maps->shader_version.type);
+ const struct wined3d_device *device = ins->ctx->shader->device;
+ const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
/* src0 is aL */
shader_arb_get_src_param(ins, &ins->src[1], 0, src_name);
@@ -2876,12 +2908,30 @@
struct shader_arb_ctx_priv *priv = ins->ctx->backend_data;
struct list *e = list_head(&priv->control_frames);
struct control_frame *control_frame = LIST_ENTRY(e, struct control_frame, entry);
+ char counter, aL;
if(priv->loop_depth > 1) shader_addline(buffer, "PUSHA aL;\n");
- /* The constant loader makes sure to load -1 into iX.w */
- shader_addline(buffer, "ARLC aL, %s.xywz;\n", src_name);
- shader_addline(buffer, "BRA loop_%u_end (LE.x);\n", control_frame->no.loop);
+
+ if (gl_info->quirks & WINED3D_CX_QUIRK_BROKEN_ARA)
+ {
+ loop_helper_component(priv->loop_depth, &counter, &aL);
+ shader_addline(buffer, "MOVC loop_helper.%c%c, %s.xyxy;\n", counter, aL, src_name);
+ strcpy(control_frame->src_param, src_name);
+ }
+ else
+ {
+ /* The constant loader makes sure to load -1 into iX.w */
+ shader_addline(buffer, "ARLC aL, %s.xywz;\n", src_name);
+ counter = 'x';
+ aL = 'y';
+ }
+ shader_addline(buffer, "BRA loop_%u_end (LE.%c);\n", control_frame->no.loop, counter);
shader_addline(buffer, "loop_%u_start:\n", control_frame->no.loop);
+
+ if (gl_info->quirks & WINED3D_CX_QUIRK_BROKEN_ARA)
+ {
+ shader_addline(buffer, "ARL aL.y, loop_helper.%c;\n", aL);
+ }
}
else
{
@@ -2889,11 +2939,24 @@
}
}
+static char rep_helper_component(unsigned int depth)
+{
+ if(depth == 0) return 'x';
+ if(depth == 1) return 'y';
+ if(depth == 2) return 'z';
+ if(depth == 3) return 'w';
+
+ FIXME("Unsupported rep depth for broken ARA quirk: %u\n", depth);
+ return 'w';
+}
+
static void shader_hw_rep(const struct wined3d_shader_instruction *ins)
{
struct wined3d_shader_buffer *buffer = ins->ctx->buffer;
char src_name[50];
BOOL vshader = shader_is_vshader_version(ins->ctx->reg_maps->shader_version.type);
+ const struct wined3d_device *device = ins->ctx->shader->device;
+ const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
shader_arb_get_src_param(ins, &ins->src[0], 0, src_name);
@@ -2903,11 +2966,21 @@
struct shader_arb_ctx_priv *priv = ins->ctx->backend_data;
struct list *e = list_head(&priv->control_frames);
struct control_frame *control_frame = LIST_ENTRY(e, struct control_frame, entry);
+ char component;
- if(priv->loop_depth > 1) shader_addline(buffer, "PUSHA aL;\n");
-
- shader_addline(buffer, "ARLC aL, %s.xywz;\n", src_name);
- shader_addline(buffer, "BRA loop_%u_end (LE.x);\n", control_frame->no.loop);
+ if (gl_info->quirks & WINED3D_CX_QUIRK_BROKEN_ARA)
+ {
+ component = rep_helper_component(priv->loop_depth);
+ shader_addline(buffer, "MOVC rep_helper.%c, %s.x;\n", component, src_name);
+ strcpy(control_frame->src_param, src_name);
+ }
+ else
+ {
+ component = 'x';
+ if(priv->loop_depth > 1) shader_addline(buffer, "PUSHA aL;\n");
+ shader_addline(buffer, "ARLC aL, %s.xywz;\n", src_name);
+ }
+ shader_addline(buffer, "BRA loop_%u_end (LE.%c);\n", control_frame->no.loop, component);
shader_addline(buffer, "loop_%u_start:\n", control_frame->no.loop);
}
else
@@ -2920,15 +2993,29 @@
{
struct wined3d_shader_buffer *buffer = ins->ctx->buffer;
BOOL vshader = shader_is_vshader_version(ins->ctx->reg_maps->shader_version.type);
+ const struct wined3d_device *device = ins->ctx->shader->device;
+ const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
if(vshader)
{
struct shader_arb_ctx_priv *priv = ins->ctx->backend_data;
struct list *e = list_head(&priv->control_frames);
struct control_frame *control_frame = LIST_ENTRY(e, struct control_frame, entry);
+ char counter, aL;
- shader_addline(buffer, "ARAC aL.xy, aL;\n");
- shader_addline(buffer, "BRA loop_%u_start (GT.x);\n", control_frame->no.loop);
+ if (gl_info->quirks & WINED3D_CX_QUIRK_BROKEN_ARA)
+ {
+ loop_helper_component(priv->loop_depth, &counter, &aL);
+ shader_addline(buffer, "ADDC loop_helper.%c%c, loop_helper.%c%c%c%c, %s.wzwz;\n",
+ counter, aL, counter, aL, counter, aL, control_frame->src_param);
+ }
+ else
+ {
+ shader_addline(buffer, "ARAC aL.xy, aL;\n");
+ counter = 'x';
+ aL = 'y';
+ }
+ shader_addline(buffer, "BRA loop_%u_start (GT.%c);\n", control_frame->no.loop, counter);
shader_addline(buffer, "loop_%u_end:\n", control_frame->no.loop);
if(priv->loop_depth > 1) shader_addline(buffer, "POPA aL;\n");
@@ -2943,18 +3030,34 @@
{
struct wined3d_shader_buffer *buffer = ins->ctx->buffer;
BOOL vshader = shader_is_vshader_version(ins->ctx->reg_maps->shader_version.type);
+ const struct wined3d_device *device = ins->ctx->shader->device;
+ const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
if(vshader)
{
struct shader_arb_ctx_priv *priv = ins->ctx->backend_data;
struct list *e = list_head(&priv->control_frames);
struct control_frame *control_frame = LIST_ENTRY(e, struct control_frame, entry);
+ char component;
- shader_addline(buffer, "ARAC aL.xy, aL;\n");
- shader_addline(buffer, "BRA loop_%u_start (GT.x);\n", control_frame->no.loop);
+ if (gl_info->quirks & WINED3D_CX_QUIRK_BROKEN_ARA)
+ {
+ component = rep_helper_component(priv->loop_depth);
+ shader_addline(buffer, "ADDC rep_helper.%c, rep_helper.%c, %s.w;\n", component,
+ component, control_frame->src_param);
+ }
+ else
+ {
+ component = 'x';
+ shader_addline(buffer, "ARAC aL.xy, aL;\n");
+ }
+ shader_addline(buffer, "BRA loop_%u_start (GT.%c);\n", control_frame->no.loop, component);
shader_addline(buffer, "loop_%u_end:\n", control_frame->no.loop);
- if(priv->loop_depth > 1) shader_addline(buffer, "POPA aL;\n");
+ if (!(gl_info->quirks & WINED3D_CX_QUIRK_BROKEN_ARA))
+ {
+ if(priv->loop_depth > 1) shader_addline(buffer, "POPA aL;\n");
+ }
}
else
{
@@ -3601,9 +3704,11 @@
BOOL dcl_td = FALSE;
BOOL want_nv_prog = FALSE;
struct arb_pshader_private *shader_priv = shader->backend_data;
+ BOOL varying_limit_ok = TRUE;
GLint errPos;
DWORD map;
BOOL custom_linear_fog = FALSE;
+ WORD old_fpu_cw = wined3d_get_fpu_cw();
char srgbtmp[4][4];
char ftoa_tmp[16];
@@ -3698,7 +3803,22 @@
shader_addline(buffer, "OPTION ARB_draw_buffers;\n");
}
- if (reg_maps->shader_version.major < 3)
+ if (gl_info->quirks & WINED3D_CX_QUIRK_TEXCOORD_FOG)
+ {
+ unsigned int cnt = 0;
+ for(i = 0; i < MAX_REG_TEXCRD; i++)
+ {
+ if (reg_maps->texcoord & (1 << i)) ++cnt;
+ }
+ if(shader_priv->clipplane_emulation) cnt++;
+ if(cnt >= 8)
+ {
+ WARN("Disabling fog because 8 texcoords are used\n");
+ varying_limit_ok = FALSE;
+ }
+ }
+
+ if (reg_maps->shader_version.major < 3 && varying_limit_ok)
{
switch (args->super.fog)
{
@@ -3882,7 +4002,7 @@
}
}
- if (shader_priv->clipplane_emulation != ~0U && args->clip)
+ if (shader_priv->clipplane_emulation != ~0U && args->super.clip)
{
shader_addline(buffer, "KIL fragment.texcoord[%u];\n", shader_priv->clipplane_emulation);
}
@@ -3911,10 +4031,17 @@
TRACE("Created hw pixel shader, prg=%d\n", retval);
/* Create the program and check for errors */
+
+ if (old_fpu_cw != WINED3D_DEFAULT_FPU_CW)
+ wined3d_set_fpu_cw(WINED3D_DEFAULT_FPU_CW);
+
GL_EXTCALL(glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
buffer->content_size, buffer->buffer));
checkGLcall("glProgramStringARB()");
+ if (old_fpu_cw != WINED3D_DEFAULT_FPU_CW)
+ wined3d_set_fpu_cw(old_fpu_cw);
+
gl_info->gl_ops.gl.p_glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errPos);
if (errPos != -1)
{
@@ -4189,6 +4316,7 @@
struct shader_arb_ctx_priv priv_ctx;
unsigned int i;
GLint errPos;
+ WORD old_fpu_cw = wined3d_get_fpu_cw();
memset(&priv_ctx, 0, sizeof(priv_ctx));
priv_ctx.cur_vs_args = args;
@@ -4206,6 +4334,11 @@
shader_addline(buffer, "OPTION NV_vertex_program3;\n");
priv_ctx.target_version = NV3;
shader_addline(buffer, "ADDRESS aL;\n");
+ if (gl_info->quirks & WINED3D_CX_QUIRK_BROKEN_ARA)
+ {
+ shader_addline(buffer, "TEMP rep_helper;\n");
+ shader_addline(buffer, "TEMP loop_helper;\n");
+ }
}
else if (gl_info->supported[NV_VERTEX_PROGRAM2_OPTION])
{
@@ -4309,10 +4442,17 @@
TRACE("Created hw vertex shader, prg=%d\n", ret);
/* Create the program and check for errors */
+
+ if (old_fpu_cw != WINED3D_DEFAULT_FPU_CW)
+ wined3d_set_fpu_cw(WINED3D_DEFAULT_FPU_CW);
+
GL_EXTCALL(glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
buffer->content_size, buffer->buffer));
checkGLcall("glProgramStringARB()");
+ if (old_fpu_cw != WINED3D_DEFAULT_FPU_CW)
+ wined3d_set_fpu_cw(old_fpu_cw);
+
gl_info->gl_ops.gl.p_glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errPos);
if (errPos != -1)
{
@@ -4521,7 +4661,6 @@
struct arb_ps_compile_args *args)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
- const struct wined3d_d3d_info *d3d_info = context->d3d_info;
int i;
WORD int_skip;
@@ -4536,17 +4675,6 @@
args->bools |= ( 1 << i);
}
- /* Only enable the clip plane emulation KIL if at least one clipplane is enabled. The KIL instruction
- * is quite expensive because it forces the driver to disable early Z discards. It is cheaper to
- * duplicate the shader than have a no-op KIL instruction in every shader
- */
- if (!d3d_info->vs_clipping && use_vs(state)
- && state->render_states[WINED3D_RS_CLIPPING]
- && state->render_states[WINED3D_RS_CLIPPLANEENABLE])
- args->clip = 1;
- else
- args->clip = 0;
-
/* Skip if unused or local, or supported natively */
int_skip = ~shader->reg_maps.integer_constants | shader->reg_maps.local_int_consts;
if (int_skip == 0xffff || gl_info->supported[NV_FRAGMENT_PROGRAM_OPTION])
@@ -4699,7 +4827,7 @@
}
else
{
- UINT rt_height = state->fb->render_targets[0]->resource.height;
+ UINT rt_height = state->fb.render_targets[0]->resource.height;
shader_arb_ps_local_constants(compiled, context, state, rt_height);
}
@@ -5093,6 +5221,11 @@
}
caps->vs_version = min(wined3d_settings.max_sm_vs, vs_version);
caps->vs_uniform_count = vs_consts;
+ if (cxgames_hacks.safe_vs_consts)
+ {
+ /* One for the posFixup, one for the helper const, and the clipplanes. */
+ caps->vs_uniform_count -= 2 + gl_info->limits.clipplanes;
+ }
}
else
{
@@ -7460,7 +7593,8 @@
/* Now load the surface */
if (wined3d_settings.offscreen_rendering_mode != ORM_FBO
- && (src_surface->flags & (SFLAG_INTEXTURE | SFLAG_INDRAWABLE)) == SFLAG_INDRAWABLE
+ && (src_surface->resource.locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_DRAWABLE))
+ == WINED3D_LOCATION_DRAWABLE
&& !surface_is_offscreen(src_surface))
{
/* Without FBO blits transferring from the drawable to the texture is
@@ -7489,14 +7623,16 @@
/* Leave the opengl state valid for blitting */
arbfp_blit_unset(context->gl_info);
- if (wined3d_settings.strict_draw_ordering
+ if (wined3d_use_csmt(device))
+ context->gl_info->gl_ops.gl.p_glFinish();
+ else if (wined3d_settings.strict_draw_ordering
|| (dst_surface->swapchain && (dst_surface->swapchain->front_buffer == dst_surface)))
context->gl_info->gl_ops.gl.p_glFlush(); /* Flush to ensure ordering across contexts. */
context_release(context);
- surface_validate_location(dst_surface, dst_surface->draw_binding);
- surface_invalidate_location(dst_surface, ~dst_surface->draw_binding);
+ wined3d_resource_validate_location(&dst_surface->resource, dst_surface->draw_binding);
+ wined3d_resource_invalidate_location(&dst_surface->resource, ~dst_surface->draw_binding);
return WINED3D_OK;
}
diff -Naur a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
--- a/dlls/wined3d/buffer.c 2013-10-11 17:21:06.000000000 +0000
+++ b/dlls/wined3d/buffer.c 2013-11-07 21:40:10.000000000 +0000
@@ -32,17 +32,16 @@
#define WINED3D_BUFFER_HASDESC 0x01 /* A vertex description has been found. */
#define WINED3D_BUFFER_CREATEBO 0x02 /* Create a buffer object for this buffer. */
#define WINED3D_BUFFER_DOUBLEBUFFER 0x04 /* Keep both a buffer object and a system memory copy for this buffer. */
-#define WINED3D_BUFFER_FLUSH 0x08 /* Manual unmap flushing. */
-#define WINED3D_BUFFER_DISCARD 0x10 /* A DISCARD lock has occurred since the last preload. */
-#define WINED3D_BUFFER_NOSYNC 0x20 /* All locks since the last preload had NOOVERWRITE set. */
-#define WINED3D_BUFFER_APPLESYNC 0x40 /* Using sync as in GL_APPLE_flush_buffer_range. */
+#define WINED3D_BUFFER_DISCARD 0x08 /* A DISCARD lock has occurred since the last preload. */
+#define WINED3D_BUFFER_NOSYNC 0x10 /* All locks since the last preload had NOOVERWRITE set. */
+#define WINED3D_BUFFER_APPLESYNC 0x20 /* Using sync as in GL_APPLE_flush_buffer_range. */
#define VB_MAXDECLCHANGES 100 /* After that number of decl changes we stop converting */
#define VB_RESETDECLCHANGE 1000 /* Reset the decl changecount after that number of draws */
#define VB_MAXFULLCONVERSIONS 5 /* Number of full conversions before we stop converting */
#define VB_RESETFULLCONVS 20 /* Reset full conversion counts after that number of draws */
-static void buffer_invalidate_bo_range(struct wined3d_buffer *buffer, UINT offset, UINT size)
+void buffer_invalidate_bo_range(struct wined3d_buffer *buffer, UINT offset, UINT size)
{
if (!offset && !size)
goto invalidate_all;
@@ -118,7 +117,7 @@
}
/* Context activation is done by the caller. */
-static void buffer_create_buffer_object(struct wined3d_buffer *This, struct wined3d_context *context)
+void buffer_create_buffer_object(struct wined3d_buffer *This, struct wined3d_context *context)
{
GLenum gl_usage = GL_STATIC_DRAW_ARB;
GLenum error;
@@ -163,18 +162,25 @@
TRACE("Buffer has WINED3DUSAGE_DYNAMIC set.\n");
gl_usage = GL_STREAM_DRAW_ARB;
- if(gl_info->supported[APPLE_FLUSH_BUFFER_RANGE])
+ if (cxgames_hacks.allow_glmapbuffer == WINED3D_MAPBUF_NEVER
+ || cxgames_hacks.allow_glmapbuffer == WINED3D_MAPBUF_STATIC)
+ {
+ This->flags |= WINED3D_BUFFER_DOUBLEBUFFER;
+ }
+ else if (gl_info->supported[APPLE_FLUSH_BUFFER_RANGE] && !wined3d_use_csmt(This->resource.device))
{
GL_EXTCALL(glBufferParameteriAPPLE(This->buffer_type_hint, GL_BUFFER_FLUSHING_UNMAP_APPLE, GL_FALSE));
checkGLcall("glBufferParameteriAPPLE(This->buffer_type_hint, GL_BUFFER_FLUSHING_UNMAP_APPLE, GL_FALSE)");
- This->flags |= WINED3D_BUFFER_FLUSH;
-
GL_EXTCALL(glBufferParameteriAPPLE(This->buffer_type_hint, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_FALSE));
checkGLcall("glBufferParameteriAPPLE(This->buffer_type_hint, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_FALSE)");
This->flags |= WINED3D_BUFFER_APPLESYNC;
}
/* No setup is needed here for GL_ARB_map_buffer_range */
}
+ else if (cxgames_hacks.allow_glmapbuffer == WINED3D_MAPBUF_NEVER)
+ {
+ This->flags |= WINED3D_BUFFER_DOUBLEBUFFER;
+ }
/* Reserve memory for the buffer. The amount of data won't change
* so we are safe with calling glBufferData once and
@@ -200,6 +206,7 @@
{
wined3d_resource_free_sysmem(&This->resource);
This->resource.allocatedMemory = NULL;
+ This->map_mem = NULL;
}
return;
@@ -429,7 +436,7 @@
{
DWORD src_color = *dst_color;
- /* Color conversion like in drawStridedSlow. watch out for little endianity
+ /* Color conversion like in draw_strided_slow. watch out for little endianity
* If we want that stuff to work on big endian machines too we have to consider more things
*
* 0xff000000: Alpha mask
@@ -463,7 +470,8 @@
data->buffer_object = buffer->buffer_object;
if (!buffer->buffer_object)
{
- if ((buffer->flags & WINED3D_BUFFER_CREATEBO) && !buffer->resource.map_count)
+ if ((!buffer->resource.map_count || buffer->flags & WINED3D_BUFFER_DOUBLEBUFFER)
+ && buffer->flags & WINED3D_BUFFER_CREATEBO)
{
buffer_create_buffer_object(buffer, context);
buffer->flags &= ~WINED3D_BUFFER_CREATEBO;
@@ -501,7 +509,9 @@
if (!wined3d_resource_allocate_sysmem(&This->resource))
ERR("Failed to allocate system memory.\n");
+ This->resource.heap_memory = This->resource.map_heap_memory;
This->resource.allocatedMemory = This->resource.heap_memory;
+ This->map_mem = This->resource.allocatedMemory;
if (This->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER_ARB)
context_invalidate_state(context, STATE_INDEXBUFFER);
@@ -549,28 +559,38 @@
resource_unload(resource);
}
+void wined3d_buffer_cleanup_cs(struct wined3d_buffer *buffer)
+{
+ struct wined3d_context *context;
+ struct wined3d_device *device = buffer->resource.device;
+
+ if (buffer->buffer_object)
+ {
+ context = context_acquire(device, NULL);
+ delete_gl_buffer(buffer, context->gl_info);
+ context_release(context);
+
+ HeapFree(GetProcessHeap(), 0, buffer->conversion_map);
+ }
+
+ HeapFree(GetProcessHeap(), 0, buffer->maps);
+ HeapFree(GetProcessHeap(), 0, buffer);
+}
+
ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer)
{
ULONG refcount = InterlockedDecrement(&buffer->resource.ref);
- struct wined3d_context *context;
TRACE("%p decreasing refcount to %u.\n", buffer, refcount);
if (!refcount)
{
- if (buffer->buffer_object)
- {
- context = context_acquire(buffer->resource.device, NULL);
- delete_gl_buffer(buffer, context->gl_info);
- context_release(context);
-
- HeapFree(GetProcessHeap(), 0, buffer->conversion_map);
- }
+ struct wined3d_device *device = buffer->resource.device;
resource_cleanup(&buffer->resource);
+
buffer->resource.parent_ops->wined3d_object_destroyed(buffer->resource.parent);
- HeapFree(GetProcessHeap(), 0, buffer->maps);
- HeapFree(GetProcessHeap(), 0, buffer);
+ wined3d_cs_emit_buffer_cleanup(device->cs, buffer);
}
return refcount;
@@ -665,43 +685,17 @@
/* The caller provides a GL context */
static void buffer_direct_upload(struct wined3d_buffer *This, const struct wined3d_gl_info *gl_info, DWORD flags)
{
- BYTE *map;
UINT start = 0, len = 0;
/* This potentially invalidates the element array buffer binding, but the
* caller always takes care of this. */
GL_EXTCALL(glBindBufferARB(This->buffer_type_hint, This->buffer_object));
checkGLcall("glBindBufferARB");
- if (gl_info->supported[ARB_MAP_BUFFER_RANGE])
- {
- GLbitfield mapflags;
- mapflags = GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT;
- if (flags & WINED3D_BUFFER_DISCARD)
- mapflags |= GL_MAP_INVALIDATE_BUFFER_BIT;
- if (flags & WINED3D_BUFFER_NOSYNC)
- mapflags |= GL_MAP_UNSYNCHRONIZED_BIT;
- map = GL_EXTCALL(glMapBufferRange(This->buffer_type_hint, 0,
- This->resource.size, mapflags));
- checkGLcall("glMapBufferRange");
- }
- else
- {
- if (This->flags & WINED3D_BUFFER_APPLESYNC)
- {
- DWORD syncflags = 0;
- if (flags & WINED3D_BUFFER_DISCARD)
- syncflags |= WINED3D_MAP_DISCARD;
- if (flags & WINED3D_BUFFER_NOSYNC)
- syncflags |= WINED3D_MAP_NOOVERWRITE;
- buffer_sync_apple(This, syncflags, gl_info);
- }
- map = GL_EXTCALL(glMapBufferARB(This->buffer_type_hint, GL_WRITE_ONLY_ARB));
- checkGLcall("glMapBufferARB");
- }
- if (!map)
+
+ if (flags & WINED3D_BUFFER_DISCARD)
{
- ERR("Failed to map opengl buffer\n");
- return;
+ GL_EXTCALL(glBufferDataARB(This->buffer_type_hint, This->resource.size, NULL, GL_STREAM_DRAW_ARB));
+ checkGLcall("glBufferDataARB");
}
while (This->modified_areas)
@@ -710,21 +704,9 @@
start = This->maps[This->modified_areas].offset;
len = This->maps[This->modified_areas].size;
- memcpy(map + start, This->resource.allocatedMemory + start, len);
-
- if (gl_info->supported[ARB_MAP_BUFFER_RANGE])
- {
- GL_EXTCALL(glFlushMappedBufferRange(This->buffer_type_hint, start, len));
- checkGLcall("glFlushMappedBufferRange");
- }
- else if (This->flags & WINED3D_BUFFER_FLUSH)
- {
- GL_EXTCALL(glFlushMappedBufferRangeAPPLE(This->buffer_type_hint, start, len));
- checkGLcall("glFlushMappedBufferRangeAPPLE");
- }
+ GL_EXTCALL(glBufferSubDataARB(This->buffer_type_hint, start, len, This->resource.allocatedMemory + start));
+ checkGLcall("glBufferSubDataARB");
}
- GL_EXTCALL(glUnmapBufferARB(This->buffer_type_hint));
- checkGLcall("glUnmapBufferARB");
}
/* Context activation is done by the caller. */
@@ -741,12 +723,6 @@
TRACE("buffer %p.\n", buffer);
- if (buffer->resource.map_count)
- {
- WARN("Buffer is mapped, skipping preload.\n");
- return;
- }
-
buffer->flags &= ~(WINED3D_BUFFER_NOSYNC | WINED3D_BUFFER_DISCARD);
if (!buffer->buffer_object)
@@ -935,10 +911,15 @@
void CDECL wined3d_buffer_preload(struct wined3d_buffer *buffer)
{
- struct wined3d_context *context;
- context = context_acquire(buffer->resource.device, NULL);
- buffer_internal_preload(buffer, context, NULL);
- context_release(context);
+ struct wined3d_device *device = buffer->resource.device;
+
+ if (buffer->resource.map_count)
+ {
+ WARN("Buffer is mapped, skipping preload.\n");
+ return;
+ }
+
+ wined3d_cs_emit_buffer_preload(device->cs, buffer);
}
struct wined3d_resource * CDECL wined3d_buffer_get_resource(struct wined3d_buffer *buffer)
@@ -952,9 +933,31 @@
{
BOOL dirty = buffer_is_dirty(buffer);
LONG count;
+ struct wined3d_device *device = buffer->resource.device;
+ struct wined3d_context *context;
TRACE("buffer %p, offset %u, size %u, data %p, flags %#x\n", buffer, offset, size, data, flags);
+ /* FIXME: There is a race condition with the same code in
+ * buffer_internal_preload and buffer_get_memory.
+ *
+ * This deals with a race condition concering buffer creation and buffer maps.
+ * If a VBO is created by the worker thread while the buffer is mapped, outdated
+ * data may be uploaded, and the BO range is not properly invaliated. Keep in
+ * mind that a broken application might draw from a buffer before mapping it.
+ *
+ * Don't try to solve this by going back to always invalidating changed areas.
+ * This won't work if we ever want to support glMapBufferRange mapping with
+ * GL_ARB_buffer_storage in the CS.
+ *
+ * Also keep in mind that UnLoad can destroy the VBO, so simply creating it
+ * on buffer creation won't work either. */
+ if (buffer->flags & WINED3D_BUFFER_CREATEBO)
+ {
+ wined3d_cs_emit_create_vbo(device->cs, buffer);
+ buffer->flags &= ~WINED3D_BUFFER_CREATEBO;
+ }
+
flags = wined3d_resource_sanitize_map_flags(&buffer->resource, flags);
count = ++buffer->resource.map_count;
@@ -965,18 +968,24 @@
* being uploaded in that case. Two such applications are Port Royale
* and Darkstar One. */
if (flags & WINED3D_MAP_DISCARD)
- buffer_invalidate_bo_range(buffer, 0, 0);
+ wined3d_cs_emit_buffer_invalidate_bo_range(device->cs, buffer, 0, 0);
else if (!(flags & WINED3D_MAP_READONLY))
- buffer_invalidate_bo_range(buffer, offset, size);
+ wined3d_cs_emit_buffer_invalidate_bo_range(device->cs, buffer, offset, size);
if (!(buffer->flags & WINED3D_BUFFER_DOUBLEBUFFER))
{
if (count == 1)
{
struct wined3d_device *device = buffer->resource.device;
- struct wined3d_context *context;
const struct wined3d_gl_info *gl_info;
+ if (wined3d_use_csmt(buffer->resource.device))
+ {
+ FIXME("waiting for cs\n");
+ wined3d_cs_emit_glfinish(device->cs);
+ device->cs->ops->finish(device->cs);
+ }
+
context = context_acquire(device, NULL);
gl_info = context->gl_info;
@@ -1027,10 +1036,11 @@
}
TRACE("New pointer is %p.\n", buffer->resource.allocatedMemory);
}
+ buffer->map_mem = buffer->resource.allocatedMemory;
context_release(context);
}
}
- else
+ else if(!wined3d_use_csmt(buffer->resource.device))
{
if (dirty)
{
@@ -1051,9 +1061,23 @@
}
}
- *data = buffer->resource.allocatedMemory + offset;
+ if (wined3d_use_csmt(buffer->resource.device) && count == 1)
+ {
+ BOOL swvp = device->create_parms.flags & WINED3DCREATE_SOFTWARE_VERTEXPROCESSING;
+ if (flags & WINED3D_MAP_DISCARD && !swvp)
+ {
+ buffer->map_mem = wined3d_resource_allocate_sysmem2(&buffer->resource);
+ wined3d_cs_emit_swap_mem(device->cs, buffer, buffer->map_mem);
+ }
+ else if(!(flags & (WINED3D_MAP_NOOVERWRITE | WINED3D_MAP_READONLY)))
+ {
+ wined3d_resource_wait_fence((struct wined3d_resource *)buffer);
+ }
+ }
+
+ *data = buffer->map_mem + offset;
- TRACE("Returning memory at %p (base %p, offset %u).\n", *data, buffer->resource.allocatedMemory, offset);
+ TRACE("Returning memory at %p (base %p, offset %u).\n", *data, buffer->map_mem, offset);
/* TODO: check Flags compatibility with buffer->currentDesc.Usage (see MSDN) */
return WINED3D_OK;
@@ -1104,7 +1128,7 @@
checkGLcall("glFlushMappedBufferRange");
}
}
- else if (buffer->flags & WINED3D_BUFFER_FLUSH)
+ else if (buffer->flags & WINED3D_BUFFER_APPLESYNC)