Bug 107693

Summary: [wine] Wolfenstein: The Old Blood - can't find GL_EXT_framebuffer_object
Product: Mesa Reporter: Sven Arvidsson <sa>
Component: Drivers/Gallium/radeonsiAssignee: Default DRI bug account <dri-devel>
Status: RESOLVED FIXED QA Contact: Default DRI bug account <dri-devel>
Severity: normal    
Priority: medium CC: fdsfgs
Version: 18.2   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: game log
wine wgl log

Description Sven Arvidsson 2018-08-26 16:56:25 UTC
Created attachment 141290 [details]
game log

The game Wolfenstein The Old Blood fails to start with 
FATAL ERROR: GL_EXT_framebuffer_object not available

This is another old title that uses a 3.2 compatibility context.

Wine log with +wgl and the game log file is attached.

System environment:
-- system architecture: 64-bit
-- Linux distribution: Debian unstable
-- GPU: TONGA
-- Model: Asus Strix R9 285 2GB
-- Display connector: DVI
-- xf86-video-amdgpu: 18.0.1
-- xserver: 1.20.1
-- mesa: 18.2.0~rc4
-- drm: 2.4.93
-- kernel: 4.17
Comment 1 Sven Arvidsson 2018-08-26 16:57:06 UTC
Created attachment 141291 [details]
wine wgl log
Comment 2 Timothy Arceri 2018-08-31 05:13:51 UTC
This is an odd one. The games rendering thread creates and uses a compat profile but when it checks extensions it actually creates a core profile in another thread.

It ends up failing to find GL_EXT_framebuffer_object because its checking the core profile rather than the compat profile (in mesa this extension is currently only enable for the comapt profile).
Comment 3 Sven Arvidsson 2018-08-31 10:24:59 UTC
AFAIK none of the id Tech 5/6 actually uses any legacy stuff. The compatibility context is only used for initial probing by the GLEW library.
Comment 4 Sven Arvidsson 2018-09-01 19:01:54 UTC
Looks like the Nvidia driver exposes GL_EXT_framebuffer_object in core profiles.

The ARB and EXT variants supposedly differ somewhat so I guess it's done for compatibility?
Comment 5 Timothy Arceri 2018-09-05 23:51:36 UTC
(In reply to Sven Arvidsson from comment #4)
> Looks like the Nvidia driver exposes GL_EXT_framebuffer_object in core
> profiles.
> 
> The ARB and EXT variants supposedly differ somewhat so I guess it's done for
> compatibility?

The game also looks for ARB_vertex_buffer_object in core (which mesa doesn't expose) and tries to use EXT_direct_state_access without checking for it.

I've enabled these extensions and added a partial implementation of EXT_direct_state_access but the game is crashing so I'm still missing something [1].

The EXT_direct_state_access implementation does work well enough to be able to run Doom (2016) which uses the extension when it detects it. 


[1] https://gitlab.freedesktop.org/tarceri/mesa/commits/EXT_direct_state_access
Comment 6 Thomas Crider 2018-09-06 19:36:51 UTC
Unsure if this helps or not, but before mesa's profiles were updated I was able to get the game running using this patch:

https://gitlab.com/GloriousEggroll/wolfenstein-tno-tob-linux/blob/master/idtech5.patch

and setting
MESA_GL_VERSION_OVERRIDE=4.5COMPAT

this was working with wine 2.17 at the time
Comment 7 Thomas Crider 2018-09-06 19:37:40 UTC
this patch was for wine btw, not mesa, but maybe it can be used to find what wine was providing that allowed the game to start
Comment 8 Timothy Arceri 2018-09-07 06:02:26 UTC
(In reply to gloriouseggroll from comment #6)
> Unsure if this helps or not, but before mesa's profiles were updated I was
> able to get the game running using this patch:
> 
> https://gitlab.com/GloriousEggroll/wolfenstein-tno-tob-linux/blob/master/
> idtech5.patch
> 
> and setting
> MESA_GL_VERSION_OVERRIDE=4.5COMPAT
> 
> this was working with wine 2.17 at the time

I'm not sure how that was possible, without my partial EXT_direct_state_access implementation I just get a green screen.

Anyway it seems the game also requires ARB_vertex_program exposed in the core profile. With this I can now play the game on my EXT_direct_state_access branch.
Comment 9 Thomas Crider 2018-09-07 13:52:47 UTC
it may have been using 3.3compat or 3.2compat, dont remember which, but that patch was working with both games
Comment 10 Sven Arvidsson 2018-09-07 20:54:10 UTC
FWIW, the patch doesn't apply cleanly, but still works with Wine 3.15. The game starts and looks ok with  MESA_GLSL_VERSION_OVERRIDE=150 MESA_GL_VERSION_OVERRIDE=3.2COMPAT (both on 18.0.5 without real compatibility and on 18.2).

But for all I know. it might break horribly after the first few minutes. 

(In reply to Timothy Arceri from comment #8)
> Anyway it seems the game also requires ARB_vertex_program exposed in the
> core profile. With this I can now play the game on my
> EXT_direct_state_access branch.

That is awesome! Thanks for working on this!
Comment 11 Timothy Arceri 2018-09-18 09:39:40 UTC
Should be fixed by:

commit 64ec50d52fa691cc1712df1d7eebea90552b7c2e
Author: Timothy Arceri <tarceri@itsqueeze.com>
Date:   Wed Sep 12 10:52:06 2018 +1000

    mesa/st: add force_compat_profile option to driconfig
    
    Reviewed-by: Marek Olšák <marek.olsak@amd.com>

and

commit 024abd3534a171ae4ee1532a078f3af68eb6fdea (HEAD -> master)
Author: Timothy Arceri <tarceri@itsqueeze.com>
Date:   Wed Sep 12 10:52:07 2018 +1000

    util: use force_compat_profile for Wolfenstein The Old Blood
    
    This game is looking for some odd extension after creating a core
    context such as ARB_vertex_program and EXT_framebuffer_object.
    
    Rather then enabling these in core this forces the game to use
    compat. This allows the game to run and seems to work without
    issues. All other id tech games/engines use a compat profile.
    
    Reviewed-by: Marek Olšák <marek.olsak@amd.com>

As for the green screen that is a bug with wine staging. Proton and older versions of wine staging were fine. See: https://bugs.winehq.org/show_bug.cgi?id=45826
Comment 12 Thomas Crider 2018-09-18 23:05:33 UTC
We've removed the broken opengl patchset in wine-staging. Seems the problems it resolved originally have all been resolved in wine already. Should be effective next release. it was also affecting DOOM 2016.

https://github.com/wine-staging/wine-staging/commits/master
commit: bd3794c11e682e8489959ff79405396f742ee7c4

can confirm after your patches wolfenstein TOB works perfectly. thank you!

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.