linebender / druid

A data-first Rust-native UI design toolkit.
https://linebender.org/druid/
Apache License 2.0
9.55k stars 569 forks source link

Latest version can not run on Windows 7 64bit #1300

Closed alanthinker closed 4 years ago

alanthinker commented 4 years ago

Latest git version(2020-10-11) can not run on Windows 7 64 bit ( in VirtualBox ).

for example widget_gallery.exe:

INFO [druid_shell::platform::windows::util] No shcore.dll INFO [druid_shell::platform::windows::util] Could not load GetDpiForSystem. Windows 10 or later is needed INFO [druid_shell::platform::windows::util] Could not load GetDpiForWindow. Windows 10 or later is needed INFO [druid_shell::platform::windows::util] Could not load SetProcessDpiAwarenessContext. Windows 10 or later is needed INFO [druid_shell::platform::windows::util] Could not load GetSystemMetricsForDpi. Windows 10 or later is needed DEBUG [druid::localization] available locales [], current en-US DEBUG [druid::localization] resolved: [en-US] DEBUG [druid_shell::platform::windows::window] dxgi factory pointer = 0x3a39d0 DEBUG [druid_shell::platform::windows::window] 0x3b6bb0: desc = Some("VirtualBox Graphics Adapter (WDDM)"), vram = 147914752 DEBUG [druid_shell::platform::windows::window] adapter = 0x3b6bb0 ERROR [druid_shell::platform::windows::dcomp] D3D11CreateDevice: 0x887a0004 ERROR [druid_shell::platform::windows::window] Creating swapchain failed: Hr(-2005270524) thread 'main' panicked at 'called Option::unwrap() on a None value', druid-shell\src\platform\windows\window.rs:812:55 stack backtrace: 0: 0x13f93479e - 1: 0x13f94b57b - 2: 0x13f930b98 - 3: 0x13f937534 - 4: 0x13f937118 - 5: 0x13f937def - 6: 0x13f937955 - 7: 0x13f9350df - 8: 0x13f937909 - 9: 0x13f9492d0 - 10: 0x13f94921c - 11: 0x13f857d06 - 12: 0x13f85bf6d - 13: 0x77079bbd - TranslateMessageEx 14: 0x7707729b - SetWindowTextW 15: 0x770767e9 - IsDialogMessageW 16: 0x771cb5cf - KiUserCallbackDispatcher 17: 0x770718ea - ShowWindow 18: 0x13f84e70a - 19: 0x13f73386c - 20: 0x13f749dd8 - 21: 0x13f739d76 - 22: 0x13f739d8c - 23: 0x13f938133 - 24: 0x13f74fd07 - 25: 0x13f9aefc4 - 26: 0x76f5556d - BaseThreadInitThunk 27: 0x771b385d - RtlUserThreadStart

raphlinus commented 4 years ago

The HRESULT is 0x887A0004, which is DXGI_ERROR_UNSUPPORTED.

Is this Windows 7 with Platform Update, or just Windows 7? We don't support the latter. I just tested master on my Windows 7 (with Platform Update) compatibility test machine, and it's fine. Also, does druid 0.6 work? I made some changes in #1191, it's possible that regressed compatibility, though I was trying to be careful and did test.

alanthinker commented 4 years ago

all example of 0.6 work properly on my win7. But git version(2020-10-11) can not run.

This is the win7 sp1, but haven't update to the latest update. Below is system info of the os:

Host Name: ALAN-PC-VM OS Name: Microsoft Windows 7 Enterprise OS Version: 6.1.7601 Service Pack 1 Build 7601 OS Manufacturer: Microsoft Corporation OS Configuration: Standalone Workstation OS Build Type: Multiprocessor Free Registered Owner: Alan Registered Organization:
Product ID: 00392-918-5000002-85524 Original Install Date: 2019/8/29, 7:27:00 System Boot Time: 2020/10/13, 14:03:02 System Manufacturer: innotek GmbH System Model: VirtualBox System Type: x64-based PC Processor(s): 1 Processor(s) Installed. 01: Intel64 Family 6 Model 60 Stepping 3 GenuineIntel ~3492 Mhz BIOS Version: innotek GmbH VirtualBox, 2006/12/1 Windows Directory: C:\Windows System Directory: C:\Windows\system32 Boot Device: \Device\HarddiskVolume1 System Locale: zh-cn;Chinese (China) Input Locale: en-us;English (United States) Time Zone: (UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi Total Physical Memory: 4,096 MB Available Physical Memory: 2,911 MB Virtual Memory: Max Size: 8,189 MB Virtual Memory: Available: 7,112 MB Virtual Memory: In Use: 1,077 MB Page File Location(s): C:\pagefile.sys Domain: WORKGROUP Logon Server: \ALAN-PC-VM Hotfix(s): 169 Hotfix(s) Installed.

                       [02]: KB2849696
                       [03]: KB2841134
                       [04]: KB2670838
                       [05]: KB2479943
                       [06]: KB2491683
                       [07]: KB2506014
                       [08]: KB2506212
                       [09]: KB2506928
                       [10]: KB2532531
                       [11]: KB2533552
                       [12]: KB2534111
                       [13]: KB2545698
                       [14]: KB2547666
                       [15]: KB2552343
                       [16]: KB2560656
                       [17]: KB2564958
                       [18]: KB2579686
                       [19]: KB2603229
                       [20]: KB2604115
                       [21]: KB2620704
                       [22]: KB2621440
                       [23]: KB2631813
                       [24]: KB2640148
                       [25]: KB2653956
                       [26]: KB2654428
                       [27]: KB2660075
                       [28]: KB2667402
                       [29]: KB2685811
                       [30]: KB2685813
                       [31]: KB2685939
                       [32]: KB2690533
                       [33]: KB2698365
                       [34]: KB2705219
                       [35]: KB2706045
                       [36]: KB2719857
                       [37]: KB2726535
                       [38]: KB2727528
                       [39]: KB2729094
                       [40]: KB2729452
                       [41]: KB2732059
                       [42]: KB2736422
                       [43]: KB2742599
                       [44]: KB2750841
                       [45]: KB2761217
                       [46]: KB2770660
                       [47]: KB2773072
                       [48]: KB2786081
                       [49]: KB2789645
                       [50]: KB2791765
                       [51]: KB2799926
                       [52]: KB2800095
                       [53]: KB2807986
                       [54]: KB2808679
                       [55]: KB2813430
                       [56]: KB2834140
                       [57]: KB2836943
                       [58]: KB2840631
                       [59]: KB2843630
                       [60]: KB2847927
                       [61]: KB2852386
                       [62]: KB2853952
                       [63]: KB2861698
                       [64]: KB2862330
                       [65]: KB2862335
                       [66]: KB2864202
                       [67]: KB2868038
                       [68]: KB2871997
                       [69]: KB2884256
                       [70]: KB2888049
                       [71]: KB2891804
                       [72]: KB2893294
                       [73]: KB2893519
                       [74]: KB2894844
                       [75]: KB2908783
                       [76]: KB2911501
                       [77]: KB2912390
                       [78]: KB2918077
                       [79]: KB2919469
                       [80]: KB2931356
                       [81]: KB2937610
                       [82]: KB2943357
                       [83]: KB2968294
                       [84]: KB2970228
                       [85]: KB2972100
                       [86]: KB2973112
                       [87]: KB2973201
                       [88]: KB2977292
                       [89]: KB2978120
                       [90]: KB2978742
                       [91]: KB2984972
                       [92]: KB2985461
                       [93]: KB2991963
                       [94]: KB2992611
                       [95]: KB3004375
                       [96]: KB3006121
                       [97]: KB3006137
                       [98]: KB3010788
                       [99]: KB3011780
                       [100]: KB3013531
                       [101]: KB3019978
                       [102]: KB3020370
                       [103]: KB3021674
                       [104]: KB3021917
                       [105]: KB3023215
                       [106]: KB3030377
                       [107]: KB3031432
                       [108]: KB3035126
                       [109]: KB3037574
                       [110]: KB3042058
                       [111]: KB3045685
                       [112]: KB3046017
                       [113]: KB3046269
                       [114]: KB3054476
                       [115]: KB3055642
                       [116]: KB3059317
                       [117]: KB3060716
                       [118]: KB3067903
                       [119]: KB3068708
                       [120]: KB3071756
                       [121]: KB3072305
                       [122]: KB3074543
                       [123]: KB3075220
                       [124]: KB3078667
                       [125]: KB3080149
                       [126]: KB3086255
                       [127]: KB3092601
                       [128]: KB3093513
                       [129]: KB3097989
                       [130]: KB3101722
                       [131]: KB3107998
                       [132]: KB3108371
                       [133]: KB3108664
                       [134]: KB3109103
                       [135]: KB3109560
                       [136]: KB3110329
                       [137]: KB3122648
                       [138]: KB3124275
                       [139]: KB3126587
                       [140]: KB3127220
                       [141]: KB3133977
                       [142]: KB3137061
                       [143]: KB3138378
                       [144]: KB3138612
                       [145]: KB3138910
                       [146]: KB3139398
                       [147]: KB3139914
                       [148]: KB3140245
                       [149]: KB3147071
                       [150]: KB3150220
                       [151]: KB3150513
                       [152]: KB3155178
                       [153]: KB3156016
                       [154]: KB3159398
                       [155]: KB3161102
                       [156]: KB3161949
                       [157]: KB3170735
                       [158]: KB3172605
                       [159]: KB3179573
                       [160]: KB3184143
                       [161]: KB3185319
                       [162]: KB4019990
                       [163]: KB4040980
                       [164]: KB4474419
                       [165]: KB4490628
                       [166]: KB4507004
                       [167]: KB976902
                       [168]: KB982018
                       [169]: KB4512506

Network Card(s): 2 NIC(s) Installed. 01: Intel(R) PRO/1000 MT Desktop Adapter Connection Name: Local Area Connection DHCP Enabled: Yes DHCP Server: 10.0.2.2 IP address(es)

                             [02]: fe80::98ac:674c:6123:eab0
                       [02]: Intel(R) PRO/1000 MT Desktop Adapter
                             Connection Name: Local Area Connection 2
                             DHCP Enabled:    Yes
                             DHCP Server:     192.168.110.2
                             IP address(es)
                             [01]: 192.168.110.7
                             [02]: fe80::1dc5:1e2c:6de1:46d7
raphlinus commented 4 years ago

Ok. Can you confirm that 30922d037da09f11503fb0255f1835c3171522d6 works but b63166739ac6271fd0aa4578c70e0399116ff8ae fails with the same error code?

Can you try using D3D_DRIVER_TYPE_UNKNOWN or D3D_DRIVER_TYPE_SOFTWARE in dcomp.rs (around line 53)?

Basically, we're not supporting anything earlier than Windows 7 with Platform Update, but the fact that it worked before means I am willing to consider a fix if it's not too complicated. Honestly I am a little surprised it worked before because I would have expected the downcast to ID2D1DeviceContext to fail.

alanthinker commented 4 years ago

30922d0 can not compile here. I mean 0.6 (2020-6-2) release version is ok. but git version(2020-10-11) is not ok.

30922d0 compile error message: error[E0599]: no variant or associated item named ForegroundColor found for enum TextAttribute in the current scope --> druid\src\text\layout.rs:231:55 | 231 | .default_attribute(TextAttribute::ForegroundColor(text_color)) | ^^^^^^^^^^^^^^^ variant or associated item not found in TextAttribute

alanthinker commented 4 years ago

D3D_DRIVER_TYPE_SOFTWARE still wrong.

INFO [druid_shell::platform::windows::util] No shcore.dll INFO [druid_shell::platform::windows::util] Could not load GetDpiForSystem. Windows 10 or later is needed INFO [druid_shell::platform::windows::util] Could not load GetDpiForWindow. Windows 10 or later is needed INFO [druid_shell::platform::windows::util] Could not load SetProcessDpiAwarenessContext. Windows 10 or later is needed INFO [druid_shell::platform::windows::util] Could not load GetSystemMetricsForDpi. Windows 10 or later is needed DEBUG [druid::localization] available locales [], current en-US DEBUG [druid::localization] resolved: [en-US] DEBUG [druid_shell::platform::windows::window] dxgi factory pointer = 0x22e730 DEBUG [druid_shell::platform::windows::window] 0x2517d0: desc = Some("VMware SVGA 3D"), vram = 8388608 DEBUG [druid_shell::platform::windows::window] adapter = 0x2517d0 ERROR [druid_shell::platform::windows::dcomp] D3D11CreateDevice: 0x80070057 ERROR [druid_shell::platform::windows::window] Creating swapchain failed: Hr(-2147024809) thread 'main' panicked at 'called Option::unwrap() on a None value', druid-shell\src\platform\windows\window.rs:812:55 stack backtrace: 0: 0x13f3c1dfe - 1: 0x13f3d68fb - 2: 0x13f3bedc8 - 3: 0x13f3c4a14 - 4: 0x13f3c45f8 - 5: 0x13f3c52cf - 6: 0x13f3c4e35 - 7: 0x13f3c273f - 8: 0x13f3c4de9 - 9: 0x13f3d50c0 - 10: 0x13f3d500c - 11: 0x13f39a0f6 - 12: 0x13f39e35d - 13: 0x779b9ac1 - TranslateMessageEx 14: 0x779b718b - SetWindowTextW 15: 0x779b66d9 - IsDialogMessageW 16: 0x77b0b4ef - KiUserCallbackDispatcher 17: 0x779b17ea - ShowWindow 18: 0x13f393f2a - 19: 0x13f33d5d9 - 20: 0x13f351826 - 21: 0x13f35183c - 22: 0x13f3c54d3 - 23: 0x13f33fed7 - 24: 0x13f3dcf84 - 25: 0x7789556d - BaseThreadInitThunk 26: 0x77af372d - RtlUserThreadStart

raphlinus commented 4 years ago

Yes, this is because of the very annoying fact that the 0.2.0-pre3 reference to piet breaks semver. Change the piet-common dep in druid-shell/Cargo.toml to:

piet-common = "=0.2.0-pre3"
piet-direct2d = "=0.2.0-pre3"
piet = "=0.2.0-pre3"
raphlinus commented 4 years ago

What about D3D_DRIVER_TYPE_WARP? It looks like SOFTWARE and UNKNOWN are invalid parameters to that function (even on my Windows 10 machine), but it does work with WARP.

alanthinker commented 4 years ago

30922d0 work on my win7. I test b631667 now.

alanthinker commented 4 years ago

b631667 not work.

alanthinker commented 4 years ago

version 2020-10-11, changed to D3D_DRIVER_TYPE_WARP work on my win7.

raphlinus commented 4 years ago

Sweet! Let me prepare a PR that hopefully will fix this.

alanthinker commented 4 years ago

Thank you!

alanthinker commented 4 years ago

My win7 and windows server 2008 r2 are all virtual PC, so there's a possibility that maybe is caused by virtual PC? not caused windows version?

raphlinus commented 4 years ago

It could be a combination of both. What's failing is selecting the hardware GPU driver, so the PR falls back to software in that case. In either case, let me know if it works, and if so, we don't need to worry too much about the exact factor.

alanthinker commented 4 years ago

Now it works fine on the virtual machine win7 sp1 and windows server 2008 r2, so whether it is the problem of the virtual machine or the operating system, the problem has been solved.