pal1000 / mesa-dist-win

Pre-built Mesa3D drivers for Windows
MIT License
860 stars 77 forks source link

EXCEPTION_ACCESS_VIOLATION w/ libgallium_wgl.dll when using Mesa 3D in Blender 3.0 #164

Open retr0cube opened 6 months ago

retr0cube commented 6 months ago

Hi! Whenever I use Mesa 3D with Blender 3.0.0, the app crashes & I get the following error:

Error   : EXCEPTION_ACCESS_VIOLATION
Address : 0x00007FFDB7875B64
Module  : libgallium_wgl.dll
Thread  : 00001508
Writing: C:\Users\Retcy\AppData\Local\Temp\blender.crash.txt

and here's the full stack trace:

# Blender 3.0.0, Commit date: 2021-12-02 18:35, Hash f1cca3055776

# backtrace
Exception Record:

ExceptionCode         : EXCEPTION_ACCESS_VIOLATION
Exception Address     : 0x00007FFDB7875B64
Exception Module      : libgallium_wgl.dll
Exception Flags       : 0x00000000
Exception Parameters  : 0x2
    Parameters[0] : 0x0000000000000000
    Parameters[1] : 0x0000000000000000

Stack trace:
libgallium_wgl.dll  :0x00007FFDB77E9CE0  DrvValidateVersion
libgallium_wgl.dll  :0x00007FFDB77E9CE0  DrvValidateVersion
libgallium_wgl.dll  :0x00007FFDBA0AFEF0  stw_unbind_context
libgallium_wgl.dll  :0x00007FFDBA0AFEF0  stw_unbind_context
libgallium_wgl.dll  :0x00007FFDB77E9CE0  DrvValidateVersion
libgallium_wgl.dll  :0x00007FFDBA0AFEF0  stw_unbind_context
libgallium_wgl.dll  :0x00007FFDB77E9CE0  DrvValidateVersion
libgallium_wgl.dll  :0x00007FFDBA0AFEF0  stw_unbind_context
libgallium_wgl.dll  :0x00007FFDB77E9CE0  DrvValidateVersion
blender.exe         :0x00007FF67775E900  blender::gpu::GLTexture::update_sub_direct_state_access
blender.exe         :0x00007FF67775E550  blender::gpu::GLTexture::update_sub
blender.exe         :0x00007FF6777432F0  GPU_texture_update_sub
blender.exe         :0x00007FF6776DAF80  blf_batch_draw
blender.exe         :0x00007FF6776D9850  BLF_batch_draw_end
blender.exe         :0x00007FF6730A9640  UI_block_draw
blender.exe         :0x00007FF6730AA820  UI_blocklist_draw
blender.exe         :0x00007FF672D4B0A0  ED_region_header_draw
blender.exe         :0x00007FF672D4A3A0  ED_region_do_draw
blender.exe         :0x00007FF6727C3310  wm_draw_window_offscreen
blender.exe         :0x00007FF6727C3160  wm_draw_window
blender.exe         :0x00007FF6727C2C60  wm_draw_update
blender.exe         :0x00007FF67279D330  WM_main
blender.exe         :0x00007FF67241F190  main
blender.exe         :0x00007FF677937208  __scrt_common_main_seh
KERNEL32.DLL        :0x00007FFE45CD7330  BaseThreadInitThunk
ntdll.dll           :0x00007FFE47622690  RtlUserThreadStart

Threads:
Thread : 00001fe4
ntdll.dll           :0x00007FFE47670A60  ZwWaitForWorkViaWorkerFactory
ntdll.dll           :0x00007FFE476226E0  TpReleaseCleanupGroupMembers
KERNEL32.DLL        :0x00007FFE45CD7330  BaseThreadInitThunk
ntdll.dll           :0x00007FFE47622690  RtlUserThreadStart

Thread : 00002518
ntdll.dll           :0x00007FFE47670A60  ZwWaitForWorkViaWorkerFactory
ntdll.dll           :0x00007FFE476226E0  TpReleaseCleanupGroupMembers
KERNEL32.DLL        :0x00007FFE45CD7330  BaseThreadInitThunk
ntdll.dll           :0x00007FFE47622690  RtlUserThreadStart

Thread : 00001bf4
ntdll.dll           :0x00007FFE4766D050  ZwWaitForSingleObject
KERNELBASE.dll      :0x00007FFE45353040  WaitForSingleObjectEx
blender.exe         :0x00007FF6772EF130  IlmThread_2_5::Semaphore::wait
blender.exe         :0x00007FF6772EE900  IlmThread_2_5::ThreadPool::numThreads
blender.exe         :0x00007FF6772EF5A0  std::_LaunchPad<std::unique_ptr<std::tuple<void (__cdecl IlmThread_2_5::Thread::*)(void) __ptr64,Il
blender.exe         :0x00007FF67542E950  std::_Pad::_Call_func
ucrtbase.dll        :0x00007FFE44FE1B20  configthreadlocale
KERNEL32.DLL        :0x00007FFE45CD7330  BaseThreadInitThunk
ntdll.dll           :0x00007FFE47622690  RtlUserThreadStart

Thread : 000026d8
ntdll.dll           :0x00007FFE4766D050  ZwWaitForSingleObject
KERNELBASE.dll      :0x00007FFE45353040  WaitForSingleObjectEx
blender.exe         :0x00007FF6772EF130  IlmThread_2_5::Semaphore::wait
blender.exe         :0x00007FF6772EE900  IlmThread_2_5::ThreadPool::numThreads
blender.exe         :0x00007FF6772EF5A0  std::_LaunchPad<std::unique_ptr<std::tuple<void (__cdecl IlmThread_2_5::Thread::*)(void) __ptr64,Il
blender.exe         :0x00007FF67542E950  std::_Pad::_Call_func
ucrtbase.dll        :0x00007FFE44FE1B20  configthreadlocale
KERNEL32.DLL        :0x00007FFE45CD7330  BaseThreadInitThunk
ntdll.dll           :0x00007FFE47622690  RtlUserThreadStart

Thread : 000010d4
ntdll.dll           :0x00007FFE47670A60  ZwWaitForWorkViaWorkerFactory
ntdll.dll           :0x00007FFE476226E0  TpReleaseCleanupGroupMembers
KERNEL32.DLL        :0x00007FFE45CD7330  BaseThreadInitThunk
ntdll.dll           :0x00007FFE47622690  RtlUserThreadStart

Thread : 00000edc
ntdll.dll           :0x00007FFE47670A60  ZwWaitForWorkViaWorkerFactory
ntdll.dll           :0x00007FFE476226E0  TpReleaseCleanupGroupMembers
KERNEL32.DLL        :0x00007FFE45CD7330  BaseThreadInitThunk
ntdll.dll           :0x00007FFE47622690  RtlUserThreadStart

Thread : 00001ae0
ntdll.dll           :0x00007FFE47670A00  NtWaitForAlertByThreadId
ntdll.dll           :0x00007FFE47634270  RtlSleepConditionVariableCS
KERNELBASE.dll      :0x00007FFE453A3890  SleepConditionVariableCS
libgallium_wgl.dll  :0x00007FFDB77E9CE0  DrvValidateVersion
libgallium_wgl.dll  :0x00007FFDBA0AFEF0  stw_unbind_context
ucrtbase.dll        :0x00007FFE44FE1B20  configthreadlocale
KERNEL32.DLL        :0x00007FFE45CD7330  BaseThreadInitThunk
ntdll.dll           :0x00007FFE47622690  RtlUserThreadStart

Thread : 00000bdc
ntdll.dll           :0x00007FFE4766DB20  NtWaitForMultipleObjects
KERNELBASE.dll      :0x00007FFE45381C30  WaitForMultipleObjectsEx
combase.dll         :0x00007FFE472D2CC0  InternalTlsAllocData
combase.dll         :0x00007FFE472D2CC0  InternalTlsAllocData
combase.dll         :0x00007FFE472D2CC0  InternalTlsAllocData
combase.dll         :0x00007FFE472D2CC0  InternalTlsAllocData
KERNEL32.DLL        :0x00007FFE45CD7330  BaseThreadInitThunk
ntdll.dll           :0x00007FFE47622690  RtlUserThreadStart

Thread : 00001b2c
ntdll.dll           :0x00007FFE47670A00  NtWaitForAlertByThreadId
ntdll.dll           :0x00007FFE47634270  RtlSleepConditionVariableCS
KERNELBASE.dll      :0x00007FFE453A3890  SleepConditionVariableCS
libgallium_wgl.dll  :0x00007FFDB77E9CE0  DrvValidateVersion
libgallium_wgl.dll  :0x00007FFDBA0AFEF0  stw_unbind_context
ucrtbase.dll        :0x00007FFE44FE1B20  configthreadlocale
KERNEL32.DLL        :0x00007FFE45CD7330  BaseThreadInitThunk
ntdll.dll           :0x00007FFE47622690  RtlUserThreadStart

Thread : 00002468
ntdll.dll           :0x00007FFE4766D050  ZwWaitForSingleObject
KERNELBASE.dll      :0x00007FFE45353040  WaitForSingleObjectEx
tbb.dll             :0x00007FFE3476DBD0  tbb::thread_bound_filter::try_process_item
tbb.dll             :0x00007FFE3476DBD0  tbb::thread_bound_filter::try_process_item
ucrtbase.dll        :0x00007FFE44FE1B20  configthreadlocale
KERNEL32.DLL        :0x00007FFE45CD7330  BaseThreadInitThunk
ntdll.dll           :0x00007FFE47622690  RtlUserThreadStart

Loaded Modules :
0x00007FF6722A0000 3.0.0.0              blender.exe C:\Program Files\Blender Foundation\Blender\blender.pdb 
0x00007FFE475D0000 10.0.19041.3636      ntdll.dll  
0x00007FFE45CC0000 10.0.19041.3636      KERNEL32.DLL  
0x00007FFE45330000 10.0.19041.3758      KERNELBASE.dll  
0x00007FFE45810000 10.0.19041.3636      USER32.dll  
0x00007FFE44CE0000 10.0.19041.3803      win32u.dll  
0x00007FFE45A90000 10.0.19041.3636      GDI32.dll  
0x00007FFE450C0000 10.0.19041.3758      gdi32full.dll  
0x00007FFE45290000 10.0.19041.3636      msvcp_win.dll  
0x00007FFE34760000                      tbb.dll  
0x00007FFE44FC0000 10.0.19041.3636      ucrtbase.dll  
0x00007FFE467E0000 10.0.19041.3758      SHELL32.dll  
0x00007FFE44E70000 10.0.19041.3636      CFGMGR32.dll  
0x00007FFE45EB0000 10.0.19041.3636      WS2_32.dll  
0x00007FFE2C930000                      tbbmalloc.dll  
0x00007FFE45F20000 10.0.19041.3758      RPCRT4.dll  
0x00007FFE45700000 10.0.19041.3693      ADVAPI32.dll  
0x00007FFE46550000 7.0.19041.3636       msvcrt.dll  
0x00007FFE470C0000 10.0.19041.3636      sechost.dll  
0x00007FFE45D80000 10.0.19041.3636      ole32.dll  
0x00007FFE47230000 10.0.19041.3636      combase.dll  
0x00007FFE465F0000 10.0.19041.3636      PSAPI.DLL  
0x00007FFE457B0000 10.0.19041.3636      SHLWAPI.dll  
0x00007FFE46730000 10.0.19041.3636      shcore.dll  
0x00007FFE189D0000 8.0.1.0              openvdb.dll  
0x00007FFE27680000 23.3.0.5             OPENGL32.dll  
0x00007FFE15640000 3.9.7150.1013        python39.dll  
0x00007FFDE1430000 58.134.100.0         avcodec-58.dll  
0x00007FFE152E0000 58.76.100.0          avformat-58.dll  
0x00007FFE366B0000 58.13.100.0          avdevice-58.dll  
0x00007FFE45630000 10.0.19041.3636      OLEAUT32.dll  
0x00007FFE15010000 56.70.100.0          avutil-56.dll  
0x00007FFE44CB0000 10.0.19041.3636      bcrypt.dll  
0x00007FFE45C70000 10.0.19041.3636      IMM32.dll  
0x00007FFE24BD0000 5.9.100.0            swscale-5.dll  
0x0000000070440000 1.0.28.0             libsndfile-1.dll  
0x00007FFE18880000 1.20.1.0             OpenAL32.dll  
0x00007FFE15C90000 2.0.12.0             SDL2.dll  
0x00007FFE46050000 10.0.19041.3636      SETUPAPI.dll  
0x000000006ACC0000                      libgmp-10.dll  
0x00007FFE14F80000 14.28.29910.0        MSVCP140.dll  
0x00007FFE36670000 14.28.29910.0        VCRUNTIME140.dll  
0x00007FFE3E3C0000                      tbbmalloc_proxy.dll  
0x00007FFE3D8D0000 14.28.29910.0        VCRUNTIME140_1.dll  
0x00007FFE343F0000 6.10.19041.3636      COMCTL32.dll  
0x00007FFE24BA0000 10.0.19041.1         AVIFIL32.dll  
0x00007FFE358E0000 10.0.19041.3636      VERSION.dll  
0x00007FFE3E1B0000 10.0.19041.3636      dbghelp.dll  
0x00007FFE1E480000 23.3.0.5             libglapi.dll  
0x00007FFE1F660000 3.9.100.0            swresample-3.dll  
0x00007FFDB76B0000 23.3.0.5             libgallium_wgl.dll  
0x00007FFE329A0000 10.0.19041.3636      Secur32.dll  
0x00007FFE309F0000 10.0.19041.1         AVICAP32.dll  
0x0000000070680000                      libfftw3-3.dll  
0x00007FFE36AE0000 10.0.19041.3636      WINMM.dll  
0x00007FFE1BEA0000 10.0.19041.1         MSVFW32.dll  
0x00007FFE23E20000 10.0.19041.1         MSACM32.dll  
0x00007FFE26CD0000 10.0.19041.1         winmmbase.dll  
0x00007FFE44B90000 10.0.19041.3636      SSPICLI.DLL  
0x00007FFE44660000 10.0.19041.3636      CRYPTBASE.DLL  
0x00007FFE44EC0000 10.0.19041.3636      bcryptPrimitives.dll  
0x00007FFE42B70000 10.0.19041.3758      kernel.appcore.dll  
0x00007FFE42D70000 10.0.19041.3758      windows.storage.dll  
0x00007FFE446F0000 10.0.19041.3636      Wldp.dll  
0x00007FFE426A0000 10.0.19041.3636      uxtheme.dll  
0x00007FFE44BE0000 10.0.19041.3636      profapi.dll  
0x00007FFE47010000 2001.12.10941.16384  clbcatq.dll  
0x00007FFE3DE60000 10.0.19041.3636      MMDevApi.dll  
0x00007FFE44A40000 10.0.19041.3636      DEVOBJ.dll  
0x00007FFE3CE00000 10.0.19041.3636      AUDIOSES.DLL  
0x00007FFE44200000 10.0.19041.3636      powrprof.dll  
0x00007FFE440D0000                      UMPDC.dll  
0x00007FFE46600000 10.0.19041.3636      MSCTF.dll  
0x00007FFE3C9F0000 10.0.19041.3636      d3d12.dll  
0x00007FFE43570000 10.0.19041.3636      dxgi.dll  
0x00007FFE113A0000 10.0.19041.3758      D3D12Core.dll  
0x00007FFE381F0000 10.0.19041.3636      dxcore.dll  
0x00007FFE36DA0000 10.0.19041.3636      d3d10warp.dll  
0x00007FFE1BE70000 10.0.19041.3636      D3DSCache.dll  
0x00007FFE44B60000 10.0.19041.3636      USERENV.dll  
0x00007FFE3ADA0000 10.0.19041.3758      twinapi.appcore.dll  
0x00007FFE41AC0000 10.0.19041.3693      dcomp.dll  
0x00007FFE42990000 10.0.19041.3636      dwmapi.dll  
0x00007FFE11240000 101.7.2308.12        DXIL.dll  
0x00007FFE299F0000 10.0.19041.3636      dataexchange.dll  
0x00007FFE41130000 10.0.19041.3636      d3d11.dll  
0x00007FFE3B110000 10.0.19041.3758      textinputframework.dll  
0x00007FFE42050000 10.0.19041.3636      CoreUIComponents.dll  
0x00007FFE424B0000 10.0.19041.3636      CoreMessaging.dll  
0x00007FFE43E50000 10.0.19041.3636      ntmarta.dll  
0x00007FFE41960000 10.0.19041.3636      wintypes.dll  
0x00007FFE28B60000 10.0.19041.3758      explorerframe.dll  
0x00007FFE405B0000 7.0.19041.3636       propsys.dll  
0x00007FFE44640000 10.0.19041.3636      CRYPTSP.dll  
0x00007FFE43D10000 10.0.19041.3636      rsaenh.dll  

# Python backtrace

MESA version: latests as of 14th of december OS: Windows 10 22H2 Deployement type: Per app Enabled features: All

pal1000 commented 6 months ago

Try 23.3.1. Also you should try blender 3.3, 3.6 and 4.0, in this order, to see if crash stops. Meesa3D usually doesn't support software versions that are no longer supported if there are newer versions still supported.

retr0cube commented 6 months ago

Try 23.3.1. Also you should try blender 3.3, 3.6 and 4.0, in this order, to see if crash stops. Meesa3D usually doesn't support software versions that are no longer supported if there are newer versions still supported.

@pal1000 thanks i'll try that

retr0cube commented 6 months ago

@pal1000 with 23.3.1, I got the following results: 3.3 - Same error 3.6 - Zink: unable to load vulkan-1.dll <- Missing, installing the dll gives this error:

MESA: error: ZINK: vkEnumerateInstanceExtensionProperties failed
MESA: error: ZINK: vkCreateInstance failed (VK_ERROR_INITIALIZATION_FAILED)

But it ends up with the same error:

Error   : EXCEPTION_ACCESS_VIOLATION
Address : 0x0000026C37C96CA0
Module  :
Thread  : 00002a68

4.0 - Same error as 3.6

pal1000 commented 6 months ago

Does the crash occurs with MSVC release, MinGW or both?

retr0cube commented 6 months ago

Does the crash occurs with MSVC release, MinGW or both?

I only used MinGW

pal1000 commented 6 months ago

Try MSVC. While llvmpipe and lavapipe drivers are a bit slower, it's more reliable overall.

rdp commented 6 months ago

I get this failure (only msvc builds), ex: demo app https://www.winteracter.com/demo.htm

I don't get it with GALLIUM_DRIVER=llvmpipe but I do get it with GALLIUM_DRIVER=d3d12 (maybe that's the default?) FWIW. Thanks. Should I report upstream?

Here's the java wrapper message to it:

#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffa481971ab, pid=9212, tid=7940
#
# JRE version: OpenJDK Runtime Environment (17.0.2+8) (build 17.0.2+8-86)
# Java VM: OpenJDK 64-Bit Server VM (17.0.2+8-86, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64)
# Problematic frame:
# C  [libgallium_wgl.dll+0x5a71ab]
#
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

---------------  S U M M A R Y ------------

Command Line: redacted

Host: Intel(R) Core(TM) i5-2540M CPU @ 2.60GHz, 4 cores, 5G,  Windows 10 , 64 bit Build 19041 (10.0.19041.3636)
Time: Mon Jan  1 23:55:03 2024 Mountain Standard Time elapsed time: 20.230541 seconds (0d 0h 0m 20s)

---------------  T H R E A D  ---------------

Current thread (0x000002159fd1c470):  JavaThread "Render thread" [_thread_in_native, id=7940, stack(0x000000bd31000000,0x000000bd31100000)]

Stack: [0x000000bd31000000,0x000000bd31100000],  sp=0x000000bd310fe7b0,  free space=1017k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [libgallium_wgl.dll+0x5a71ab]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.lwjgl.system.JNI.invokePPPP(IIJJJJ)J+0
j  org.lwjgl.glfw.GLFW.nglfwCreateWindow(IIJJJ)J+14
j  org.lwjgl.glfw.GLFW.glfwCreateWindow(IILjava/lang/CharSequence;JJ)J+34
j  epf.<init>(Lepg;Lepd;Leos;Ljava/lang/String;Ljava/lang/String;)V+281
j  ftz.a(Leos;Ljava/lang/String;Ljava/lang/String;)Lepf;+15
j  evi.<init>(Lfip;)V+785
j  net.minecraft.client.main.Main.main([Ljava/lang/String;)V+1482
v  ~StubRoutines::call_stub
pal1000 commented 6 months ago

I get this failure (only msvc builds), ex: demo app https://www.winteracter.com/demo.htm

I don't get it with GALLIUM_DRIVER=llvmpipe but I do get it with GALLIUM_DRIVER=d3d12 (maybe that's the default?) FWIW. Thanks. Should I report upstream?

Yes, d3d12 is default if it can run. It should fallback to llvmpipe otherwise. Reporting upstream requires a call stack annotated by debug symbols. You'll need the debug info package and a debugger that understands MSVC PDB format. MSVC itself with Desktop Development for C++ workload or WinDbg from Windows SDK debugging tools would do it. The latter is harder to use but smaller install.

Host: Intel(R) Core(TM) i5-2540M CPU @ 2.60GHz, 4 cores, 5G, Windows 10 , 64 bit Build 19041 (10.0.19041.3636)

Without dGPU or eGPU this system should fallback to llvmpipe automatically.

cwfitzgerald commented 6 months ago

A possible explanation (if lavapipe is involved) is that swrast was pretty broken on 23.3.2 - see https://gitlab.freedesktop.org/mesa/mesa/-/issues/10371. I'm not 100% sure but this sounds like it might have been your problem.

Appreciate that this repo uses github releases and keeps old versions around - version pinning meant that our windows CI kept working fine despite linux CI exploding.

retr0cube commented 6 months ago

Try MSVC. While llvmpipe and lavapipe drivers are a bit slower, it's more reliable overall.

Hey! software rendering (i.e lavapipe and llvmpipe) is terrible in my machine compared to native rendering