Bug 100393 - Cemu wiiu emulator crashes after selecting game on radeonsi
Summary: Cemu wiiu emulator crashes after selecting game on radeonsi
Status: RESOLVED NOTABUG
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Gallium/radeonsi (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Default DRI bug account
QA Contact: Default DRI bug account
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-25 17:19 UTC by Giovanni ongaro
Modified: 2018-04-03 04:16 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
few tweaks to make it work (9.77 KB, patch)
2017-05-15 20:49 UTC, Mika
Details | Splinter Review
To make it works using compatibility (11.90 KB, patch)
2017-06-26 08:39 UTC, Mika
Details | Splinter Review

Description Giovanni ongaro 2017-03-25 17:19:47 UTC
under wine staging 2.3 after selecting game cemu crashes with page fault error
and this message is displayed 
Mesa: User error: GL_INVALID_ENUM in glGetString(GL_EXTENSIONS)
note i am using MESA_GL_VERSION_OVERRIDE="4.0" MESA_GLSL_OVERRIDE="400"
in nvidia proprietary drivers it works fine
so i suggest it is a mesa problem
Comment 1 Ilia Mirkin 2017-03-25 17:26:46 UTC
You're forcing a core context, which in turn disables things like glGetString(GL_EXTENSIONS); you have to use glGetStringi now. However cemu isn't ready for a core context.

Try MESA_GL_VERSION_OVERRIDE=4.0COMPAT -- that should have the desired effect. Note that tons of stuff doesn't work in such high-versioned compat contexts. Any time you're setting any overrides, it's your problem rather than a mesa problem...
Comment 2 Giovanni ongaro 2017-03-25 17:38:06 UTC
THanks for the quick response i tried without the override but the screen stays black no error is displayed and sound is played maybe i shoud change this bug title to cemu does not render
Comment 3 Giovanni ongaro 2017-03-25 17:41:57 UTC
sorry but in fact this error is displayed
Mesa: User error: GL_INVALID_ENUM in glEnable(GL_PRIMITIVE_RESTART)

and then sound plays
Comment 4 Ilia Mirkin 2017-03-25 17:52:50 UTC
(In reply to Giovanni ongaro from comment #3)
> sorry but in fact this error is displayed
> Mesa: User error: GL_INVALID_ENUM in glEnable(GL_PRIMITIVE_RESTART)
> 
> and then sound plays

The issue is "cemu was developed against a specific GL implementation, and doesn't work with other perfectly conformant GL implementations".

In this case, you're getting a GL 3.0 compat context. It tries to enable GL_PRIMITIVE_RESTART, which was not available in GL 3.0. With NV_primitive_restart, which is most likely exposed, one needs to use GL_PRIMITIVE_RESTART_NV, which conveniently is a different value.

As I mentioned, you can try the COMPAT tail to the version override so you get a compat context, but lots of stuff won't work - there are good reasons why mesa doesn't expose high-versioned compat contexts.
Comment 5 Mika 2017-05-15 20:49:25 UTC
Created attachment 131369 [details] [review]
few tweaks to make it work

This patch will provide 4 new options in driconf.

You must activate them prior launching CEMU, they're labeled :

- Bypass mesa_Uniform when location is -1
- In core profile allow glDrawArray with primitives > GL_TRIANGLES
- In core profile allow glGetString(GL_EXTENSIONS)
- Allow a uncompatible VBO validation against core profile

Activate all of them and activate too :

- Force GLSL extension behavior to 'warn'

And then disable (or check that it's not enabled) :

 - Enable offloading GL driver work to a separate thread

Then launch CEMU like this :

MESA_GL_VERSION_OVERRIDE=4.5 wine64 Cemu.exe

I barely tested it with radeonsi on a R9-270X and it seems to work (at least for me)

If you find an issue (except the way I code :) ) I'll be interested to know about it.
Comment 6 Ilia Mirkin 2017-05-15 20:52:00 UTC
(In reply to Mika from comment #5)
> Created attachment 131369 [details] [review] [review]
> few tweaks to make it work
> 
> This patch will provide 4 new options in driconf.
> 
> You must activate them prior launching CEMU, they're labeled :
> 
> - Bypass mesa_Uniform when location is -1
> - In core profile allow glDrawArray with primitives > GL_TRIANGLES
> - In core profile allow glGetString(GL_EXTENSIONS)
> - Allow a uncompatible VBO validation against core profile
> 
> Activate all of them and activate too :
> 
> - Force GLSL extension behavior to 'warn'
> 
> And then disable (or check that it's not enabled) :
> 
>  - Enable offloading GL driver work to a separate thread
> 
> Then launch CEMU like this :
> 
> MESA_GL_VERSION_OVERRIDE=4.5 wine64 Cemu.exe
> 
> I barely tested it with radeonsi on a R9-270X and it seems to work (at least
> for me)
> 
> If you find an issue (except the way I code :) ) I'll be interested to know
> about it.

Sounds like you really just wanted

MESA_GL_VERSION_OVERRIDE=4.5COMPAT
Comment 7 Mika 2017-05-15 21:31:05 UTC
Hi,
With compat, in earlier version (1.7.4) I had GLSL compilation issues so in few application the transform_feedback didn't work. It was related to GL_ARB_enhanced_layouts, something was telling me it was not usable within a vertex  shader.

In latest version with compat I had a completly garbled display, there was a problem when resolving function pointers for GL_ARB_direct_state_access, mainly glBindTextureUnit, if I remember correctly.

The only way I found was to start with a core profile, and address issues one by one.
Comment 8 Mika 2017-06-26 08:38:43 UTC
@Ilia Mirkin 

I found a way to make it work using compat, it's enabling DSA in compat profile, and add option to enable higher compatibility profile.
(cf patch)

I cannot state it regresses somehow, of course I do not have a lot of application to test this modification against.

However the application's shader uses "#version 420" and various extensions, that are not needed if I change to "#version 450" in the binary.

I'm aware that there's MESA_GLSL_VERSION_OVERRIDE, I may be wrong, but it seems it's not intended to force if "#version" is already there.

The binary also reacts to glGetString(GL_VENDOR) and glGetString(GL_RENDERER), to adapt to the proprietary drivers.
It leads intel's to fail to render properly and sometimes Radeonsi.
By overriding from time to time, the result is awesomly correct thanks to the quality of mesa.
Comment 9 Mika 2017-06-26 08:39:56 UTC
Created attachment 132244 [details] [review]
To make it works using compatibility
Comment 10 Giovanni ongaro 2017-06-26 17:59:05 UTC
Mika your last patch works even for cemu 1.8.0 i have only one question when is the VENDOR override worth and what are you forcing as vendor and render?
Comment 11 Mika 2017-08-06 07:44:57 UTC
Sorry, I guess I didn't spot your question.

GL_VENDOR, GL_RENDERER are used to circumvent the fact that CEMU will change behavior related to what it detects. In general you do not want it to know which GPU you have.

That is more than useful with intel IGD, because when Cemu believe he's on windows with an intel, it display some kind of Picasso remotely related to a video game, and you couldn't tell which one it is...



You can set any string like "Giovanni GPU" "Giovanni Ltd." and Cemu will trigger its [generic] behavior. (Check the title bar on the windows)
Comment 12 Daniel Monaga 2018-01-05 05:41:20 UTC
Hi all, i tried with MESA_GLSL_OVERRIDE="400" with a new game on menu, but you see the black screen that if the audio is perfect, you hear walking and jumping normal but without image.
instead, when using MESA_GL_VERSION_OVERRIDE=4.5COMPAT, it shows a corrupted image and when loading the saved game it breaks

in driconf, force_glsl_extensions_warn=enable, allow_higher_compat_version=enable

use ubuntu 17.10+Mesa 17.3.1 - padoka PPA Stable+Kernel 4.15.0-RC6 AMDGPU GitHub M-Bab(https://github.com/M-Bab/linux-kernel-amdgpu-binaries)+Wine-Staging 2.21

this is what I get;
log Cemu 1.11.3 - https://pastebin.com/jRYZXNaV
crashlog Cemu 1.11.3 - https://pastebin.com/NSEmYE01
Console Dump Cemu 1.11.3 - https://pastebin.com/nLy92LbP

more info:
Video Test https://www.youtube.com/watch?v=2bmYvZENVTw

Wine Configuration OS WIN 7
Wine regedit key Direct3D AMD - https://pastebin.com/hBSbBLbj
Wine regedit key OpenGL AMD - https://pastebin.com/iH3skhEJ

Hardware - MSI RX580+Ryzen 5 1600

I hope you can guide me, I know it came out mesa 17.3.2, maybe improve something.
-https://lists.freedesktop.org/archives/mesa-dev/2018-January/181024.html

I have also seen a version of mesa patched version of mikakev1 mesa_mild_compatibility, which I failed to install in ubuntu 17.10.

greetings from Chile.
Comment 13 Timothy Arceri 2018-04-03 04:16:02 UTC
radeonis doesn't support compat for anything above OpenGL 3.1. Additional support is being worked on but I don't see any reason to keep this bug open. Closing.


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.