UE4: buggy shader workaround for openSuse

I use the Linux openSUSE & MSI notebook with ATI Mobility Radeon HD 5870 card.
Unfortunally, my UE 4.17 doesn’t work properly

One of the precompiled shaders in the Unreal editor comes in the form of very bad TGSI that can not be properly translated to R600 byte code. I get error messages


src/gallium/drivers/r600/r600_shader.c:183 r600_pipe_shader_create - translation from TGSI failed !
src/gallium/drivers/r600/r600_state_common.c:787 r600_shader_select - Failed to build shader variant (type=1) -1

I found the solution here

[UE4 -opengl3: buggy shader on mesa/Radeon - Platform & Builds - Epic Developer Community Forums][2]

Many thanks, Gert Wollny & [Gewo][3]

But this patch doesn’t work with last openSUSE Leap 42.3 - Kernel 4.4.87-25 because system has a too old Mesa-17.0.3. The version of mesa above 17.1.0 can’t work properly on openSUSE Leap 42.3 because require libLLVM 3.9.0 or above. But latest Suse release precompiled with libLLVM 3.8.0-5.1.

I tried to build llvm-3.9.0 from sources and new Mesa, but it’s no way. You will have too short enjoy. Because we should get a broken system after first reboot. System has too many dependencies to libLLVM 3.8.0.

The described Gewo patch isn’t so easy for use. I made the adaptation of these changes for Mesa-17.0.3.

It can be useful for lot of UE4 and Steam users.

I present one patch and short introduction for patching your Radeon OpenGL driver

[Download patch][5]


$uname -a
$cat /etc/issue

For check your system. If You use old openSUSE, update system from repo through Yast2.

Check your Radeon driver driver. You must have loaded ‘radeon’ module.

It’s a very strong condition!

$sudo /sbin/lsmod |grep radeon

radeon 1597440 26
i2c_algo_bit 16384 1 radeon
drm_kms_helper 167936 1 radeon
ttm 110592 1 radeon
drm 397312 15 ttm,drm_kms_helper,radeon

If you don’t have loaded radeon module

PLEASE STOPPED!

Please make a double check

$sudo /sbin/lspci |grep Radeon

01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Broadway XT [Mobility Radeon HD 5870]
01:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Juniper HDMI Audio [Radeon HD 5700 Series]

and find your controller at these list

I’m sorry. I found only Russian version of these list.


https://goo.gl/pRMqP8


$glxinfo | egrep -i ‘OpenGL|profile version’

Check your current OpenGL profile

The first 4 rows can say about used hardware gear

You need Max core profile version more than 3.2

-------------------------------

Max core profile version: 3.3
Max compat profile version: 3.0
Max GLES1 profile version: 1.1
Max GLES[23] profile version: 3.0

OpenGL vendor string: X.Org
OpenGL renderer string: Gallium 0.4 on AMD JUNIPER (DRM 2.49.0 / 4.4.87-25-default, LLVM 3.8.0)
OpenGL core profile version string: 3.3 (Core Profile) Mesa 17.0.3 (git-ca5fef94b2)
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 17.0.3 (git-ca5fef94b2)
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.0 Mesa 17.0.3 (git-ca5fef94b2)
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00
OpenGL ES profile extensions:

Also You can use glxgears for check your current mesa

$glxgears

Please check your python-Mako

$zypper se python-Mako

And install it if needed

$sudo zypper in python-Mako

Prepare Your build directory

$mkdir /home/your_user_name/something

$cd /home/your_user_name/something

Place attached patch file ‘Mesa-ATI-17.0.3-git-7f34ecae7f.patch’ here

$wget http://metalki.ru/files/Mesa-ATI-17.0.3-git-7f34ecae7f.patch

$git clone git://anongit.freedesktop.org/git/mesa/mesa

Be patient

More info available at

https://www.mesa3d.org/repository.html

$cd mesa # It should be /home/your_user_name/something/mesa

$git checkout mesa-17.0.3

$patch -p1 -i …/Mesa-ATI-17.0.3-git-7f34ecae7f.patch

$./autogen.sh
$./configure --enable-texture-float

–enable-texture-float - The very important secret key for build openGL more than 2.1 version

It should be like this

#…
prefix: /usr/local
exec_prefix: ${prefix}
libdir: ${exec_prefix}/lib64
includedir: ${prefix}/include

    OpenGL:          yes (ES1: yes ES2: yes)

    OSMesa:          no

    DRI platform:    drm
    DRI drivers:     i915 i965 nouveau r200 radeon swrast 
    DRI driver dir:  ${libdir}/dri
    GLX:             DRI-based

    EGL:             yes
    EGL platforms:   x11 drm
    EGL drivers:     builtin:egl_dri2 builtin:egl_dri3
    GBM:             yes

    Vulkan drivers:  no

    llvm:            yes
    llvm-config:     /usr/bin/llvm-config
    llvm-version:    3.8.0

    Gallium drivers: r300 r600 svga swrast
    Gallium st:      mesa xvmc vdpau va

    HUD extra stats: no
    HUD lmsensors:   no

    Shared libs:     yes
    Static libs:     no
    Shared-glapi:    yes

$make

Be patient

$sudo make install

$ls /usr/local/lib64

for check new libGL.so and another files

Turn switch to the new libraries

$sudo ldconfig

And check

$ldd $(which glxgears) |grep /local
libGL.so.1 => /usr/local/lib64/libGL.so.1 (0x00007f7e40454000)
libglapi.so.0 => /usr/local/lib64/libglapi.so.0 (0x00007f7e3e5eb000)

Where ‘/usr/local’ are most important part

Check your openGL version (>= 3.0)

$glxinfo |egrep -i ‘OpenGL|profile version’

and

$glxgears

After it you can check the your UE 4.17 with a new color world

If something will be wrong you have to restore original Mesa

$cd /home/your_user_name/something/mesa
$sudo make uninstall
$sudo ldconfig

THE LAST IMPORTANT STEP !!!


$sudo mkinitrd

Please do reboot for last check your new configuration

ENJOY


If something will be wrong, use these instruction

https://en.opensuse.org/SDB:Configuring_graphics_cards

and do

$cd /home/your_user_name/something/mesa

$sudo make uninstall

$sudo ldconfig

$sudo mkinitrd


################ Another HELP for You ##################

If you doesn’t have kernel sources and kernel-firmware

$sudo zypper in kernel-source
$sudo zypper in kernel-firmware

Your RADEON firmware must be placed in directory

$echo /lib/firmware/$(uname -r)/radeon

Please check the firmware for your card

$ls /lib/firmware/$(uname -r)/radeon |grep $(glxinfo |egrep -i ‘renderer string’ |sed -e s/.*AMD// |awk ‘{print $1}’)

If you doesn’t have it, try to find it in another firmware directories

$find /lib/firmware -name $(glxinfo |egrep -i ‘renderer string’ |sed -e s/.AMD// |awk ‘{print $1}’)
#In my case I found it in:

/lib/firmware/radeon/JUNIPER_rlc.bin
/lib/firmware/radeon/JUNIPER_smc.bin
/lib/firmware/radeon/JUNIPER_pfp.bin
/lib/firmware/radeon/JUNIPER_me.bin

You should copy these .bin files into /lib/firmware/$(uname -r)/radeon directory

Like a

/lib/firmware/4.4.87-25-default/radeon/JUNIPER_rlc.bin
/lib/firmware/4.4.87-25-default/radeon/JUNIPER_smc.bin
/lib/firmware/4.4.87-25-default/radeon/JUNIPER_pfp.bin
/lib/firmware/4.4.87-25-default/radeon/JUNIPER_me.bin

Can someone tell me how to fix this problem on Mint?

I am using Radeon HD5850. Mesa3.0 . Is the graphic card to old, or is there a patch for Ubuntu / Mint?

Problem shown as below when it is Lit.

But if I unlit, it looks closer to normal.

Fix by installing fglrx
https://forums.linuxmint.com/viewtopic.php?t=250829