https://bugs.winehq.org/show_bug.cgi?id=39057
--- Comment #19 from gamiljydcome@gmail.com --- (In reply to swswine from comment #16)
Created attachment 52747 [details] Patch to implement indexed vertex blending support (using UBO, wine 1.7.55)
Hi swswine.
I applied this patch for wine 1.7.55. then test the game battleraper2 crash when it start. Could you review the error log? It seem calling shader_glsl_select cause crash.
---------------------------------- err:dmloader:IDirectMusicLoaderImpl_SetObject : could not attach stream to file fixme:dmime:IDirectMusicPerformance8Impl_InitAudio (0x1d5a4b8, (nil), 0x6efebc, 0x1004a, 1, 64, 3f, (nil)): to check fixme:dmime:IDirectMusicPerformance8Impl_Init (iface = 0x1d5a4b8, dmusic = (nil), dsound = 0x1d5a8b4, hwnd = 0x1004a) fixme:dmime:IDirectMusicPerformance8Impl_CreateStandardAudioPath (0x1d5a4b8)->(1, 64, 0, 0x1d5a684): semi-stub fixme:dmime:IDirectMusicAudioPathImpl_Activate (0x1d7c9b8, 0): stub fixme:dmime:IDirectMusicPerformance8Impl_GetDefaultAudioPath (0x1d5a4b8, 0x6efed0): semi-stub (0x1d7c9b8) err:quartz:GetClassMediaFile Media class not found fixme:d3d:wined3d_device_set_software_vertex_processing device 0x1c5ef0, software 0 stub! wine: Unhandled page fault on read access to 0x00000000 at address (nil) (thread 0009), starting debugger... Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00000000). Register dump: CS:0023 SS:002b DS:002b ES:002b FS:0063 GS:006b EIP:00000000 ESP:0032f4cc EBP:0032f548 EFLAGS:00210246( R- -- I Z- -P- ) EAX:01da4c80 EBX:7ebd8b30 ECX:00000000 EDX:7eb99a6f ESI:01da4c80 EDI:001bf5d0 Stack dump: 0x0032f4cc: 7eb058b2 00000006 0015c5e0 0000000f 0x0032f4dc: 7eb16f5c 001bf5d0 00000006 00000001 0x0032f4ec: 00127ec4 00000002 7d0a11b4 7d6958a4 0x0032f4fc: 7d45e16f 7cf942d4 7d0a11b4 0032f514 0x0032f50c: 7d359d7d 7ebdc659 00127eb0 7d45e04b 0x0032f51c: 00000000 01d9bdec 7eb99a48 001bf5d0 Backtrace: =>0 0x00000000 (0x0032f548) 1 0x7eb18f22 shader_glsl_select+0x1ba1() in wined3d (0x0032f668) 2 0x7eadfc45 context_apply_draw_state+0xf84() in wined3d (0x0032f6d8) 3 0x7eb0066c draw_primitive+0x1eb() in wined3d (0x0032f928) 4 0x7eae12d3 wined3d_cs_exec_draw+0x22() in wined3d (0x0032f958) 5 0x7eae0596 wined3d_cs_st_submit+0x25() in wined3d (0x0032f978) 6 0x7eae14dd wined3d_cs_emit_draw+0x3c() in wined3d (0x0032f998) 7 0x7eaf1615 wined3d_device_draw_indexed_primitive+0x74() in wined3d (0x0032f9e8) 8 0x7ebf7804 d3d9_device_DrawIndexedPrimitive+0xb3() in d3d9 (0x0032fa38) 9 0x004da2a2 in battleraper2 (+0xda2a1) (0x0032fb20) 10 0x004db4f3 in battleraper2 (+0xdb4f2) (0x0032fc9c) 11 0x004daca6 in battleraper2 (+0xdaca5) (0x0032fcb0) 12 0x004017cd in battleraper2 (+0x17cc) (0x0032fcdc) 13 0x004063fd in battleraper2 (+0x63fc) (0x0032fd38) 14 0x0059b913 in battleraper2 (+0x19b912) (0x0032fe60) 15 0x7b85bfec call_process_entry+0xb() in kernel32 (0x0032fe78) 16 0x7b85cf7a start_process+0x59() in kernel32 (0x0032fea8) 17 0x7bc7a7c0 call_thread_func_wrapper+0xb() in ntdll (0x0032fec8) 18 0x7bc7d581 call_thread_func+0xb0() in ntdll (0x0032ffa8) 19 0x7bc7a79e call_thread_entry_point+0x11() in ntdll (0x0032ffc8) 20 0x7bc50cc7 start_process+0x16() in ntdll (0x0032ffe8) 21 0xf76211bd wine_call_on_stack+0x1c() in libwine.so.1 (0x00000000) 22 0xf7621320 wine_switch_to_stack+0x1f() in libwine.so.1 (0xffdaa748) 23 0x7bc567e5 LdrInitializeThunk+0x1f4() in ntdll (0xffdaa788) 24 0x7b862d43 __wine_kernel_init+0x9b2() in kernel32 (0xffdab678) 25 0x7bc575a3 __wine_process_init+0x152() in ntdll (0xffdab6e8) 26 0xf761ee33 wine_init+0x292() in libwine.so.1 (0xffdab738) 27 0x7bf00d6a main+0x79() in <wine-loader> (0xffdabb78) 28 0xf7455a63 __libc_start_main+0xf2() in libc.so.6 (0x00000000) 0x00000000: -- no code accessible -- Modules: Module Address Debug info Name (119 modules) PE 400000- 845000 Export battleraper2 ELF 7a800000-7a92d000 Deferred opengl32<elf> -PE 7a820000-7a92d000 \ opengl32 ELF 7b800000-7ba61000 Dwarf kernel32<elf> -PE 7b810000-7ba61000 \ kernel32 ELF 7bc00000-7bce9000 Dwarf ntdll<elf>
(In reply to swswine from comment #15)
Created attachment 52746 [details] Patch to implement index version support (using UBO, wine 1.7.55)
I updated the patch to use UBOs to transfer blend matrices, and now all 256 possible matrices are supported. The patch is for wine release 1.7.55.
Vertex blending without indices also use UBO with this patch. The patch is still not optimal in a sense that there are much of extra updates of the buffer with all the 256 matrices on any transform matrix change or view matrix change (and even for every shader which is redundant as UBO is common for all shaders). But this is in place only if vertex blending is actually requested by application. If not, UBO is not created (and '#extension GL_ARB_uniform_buffer_object' is not added), and glsl shader is even simplified a bit compared to current release version. So I hope this patch should not introduce any regression for the applications not using vertex blending.
Neater solution on matrix update is of course possible but requires getting deeper into glsl pipeline update logic.