Bug 111010 - Cemu Shader Cache Corruption Displaying Solid Color After commit 11e16ca7ce0
Summary: Cemu Shader Cache Corruption Displaying Solid Color After commit 11e16ca7ce0
Status: RESOLVED FIXED
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: 2019-06-27 02:32 UTC by e88z4
Modified: 2019-07-11 23:32 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
shader cache corruption (10.82 KB, image/png)
2019-06-27 02:32 UTC, e88z4
Details

Description e88z4 2019-06-27 02:32:23 UTC
Created attachment 144651 [details]
shader cache corruption

Background:
Using Cemu emulator with shader cache functionality breaks after commit 11e16ca7ce0. Screen display only solid colors with very low fps.

System:
AMD Ryzen 2600
RX580
Linux 5.0.9, amdgpu, mesa master

How to reproduce the issue:
1. Run Cemu, enable shader cache functionality
2. Play a game then let shader cahce be generated. Game can be played normally and shader can be built normally. No graphical issue is found at this stage.
3. Quit Cemu
4. Play the same game again utilizing the generated shader cache
5. Game display shows flickering solid colors as shown in this ticket attachment. 

Expected result:
Playing the same game with previously generated shader cache should display the correct graphic instead of flickering solid colors.

Can you address this issue?
Comment 1 Timothy Arceri 2019-07-01 02:31:20 UTC
Thanks for the top quality bug report!

Just to be clear before 11e16ca7ce0 Cemu wasn't actually making use of the cache as it was disabled for core profiles (which Cemu uses). Enabling it uncovered a bug with the interaction of our cache implementation and the separate shader objects extension.

Anyway the following patch should fix the issue.

https://patchwork.freedesktop.org/patch/315016/
Comment 2 Timothy Arceri 2019-07-01 02:32:13 UTC
(In reply to Timothy Arceri from comment #1)
> Thanks for the top quality bug report!
> 
> Just to be clear before 11e16ca7ce0 Cemu wasn't actually making use of the
> cache as it was disabled for core profiles (which Cemu uses).

Sorry that should have been "it was disabled for compatibility profiles"
Comment 3 e88z4 2019-07-01 03:38:55 UTC
I applied your patch to the latest mesa git-2042f22e28. Your patch fixed the issue. You can close this bug. Thank for responding so quickly.
Comment 4 Timothy Arceri 2019-07-11 23:32:32 UTC
Fixed by:

commit 3043908ccb9c7030add1f34f9a947a787949a399
Author: Timothy Arceri <tarceri@itsqueeze.com>
Date:   Mon Jul 1 12:25:19 2019 +1000

    mesa: save/restore SSO flag when using ARB_get_program_binary
    
    Without this the restored program will fail the pipeline validation
    checks when we attempt to use an SSO program.
    
    Fixes: c20fd744fef1 ("mesa: Add Mesa ARB_get_program_binary helper functions")
    
    Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111010


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.