Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gles2 renderer - GLSL shader compilation error (aarch64 Linux / Panfrost) #112

Closed
porschemad911 opened this issue Feb 27, 2024 · 15 comments
Closed
Labels

Comments

@porschemad911
Copy link

First off, thank you so much for this excellent Linux port of NFS II SE!

I have been attempting to get the GLES renderer working on a couple of devices running JELOS. Both devices are runnning mainline Linux 6.7.5 aarch64 kernels and Mesa 24.1.0 with Panfrost GPU drivers compiled with OpenGL ES 1 and 2 support included and 32-bit libs built. One has a RockChip RK3326 SOC with a Mali G31 GPU, and the other has an Amlogic S922X SOC with a Mali G52 GPU. Both devices support OpenGL ES 3.1 and OpenGL 3.1 according to Panfrost Mesa driver docs.

The OpenGL 1 and 2 renderers work fine and the game runs well. But the GLES render is producing the following error:

RK3326:/roms/ports/nfs2se # MESA_GLSL=dump ./nfs2se
Need For Speed II SE
  Wrapper v1.3.0
  Game    v1.1.2-cpp_r5
  OpenGL  ES 2
Mesa: info: GLSL source for vertex shader 1:
Mesa: info: precision mediump float;attribute vec4 aPosition;attribute vec4 aTexCoord;attribute vec4 aColor;attribute float aFog;varying vec4 vTexCoord;varying vec4 vColor;varying float vFog;uniform mat4 uMatrix;void main(){vTexCoord = aTexCoord;vColor = aColor;vFog = aFog;gl_Position = uMatrix * aPosition;}
Mesa: info: GLSL shader 1 failed to compile.
Mesa: info: GLSL shader 1 info log:
Mesa: info: 0:1(1): error: syntax error, unexpected NEW_IDENTIFIER

0:1(1): error: syntax error, unexpected NEW_IDENTIFIER

Aborted

It seems to be crashing in /src/Glide2x/OpenGL2.c

@porschemad911
Copy link
Author

I have tried different values in the MESA_GLES_VERSION_OVERRIDE and MESA_GLSL_VERSION_OVERRIDE environment variables as workarounds but with no luck. Is there a particular version number of GLSL I should try?

@zaps166
Copy link
Owner

zaps166 commented Feb 27, 2024

It can't compile GLES shader, hmm. I remember same on R-Pi, but this works on Android.
If OpenGL1 works correctly, use it, GL1 is best here.

@porschemad911
Copy link
Author

Thank you for that information, good to know that OpenGL 1 is the preferred renderer.

@zaps166 zaps166 reopened this Mar 2, 2024
@zaps166
Copy link
Owner

zaps166 commented Mar 2, 2024

🤦 It's my bug 🤣

@zaps166 zaps166 closed this as completed in 06c3571 Mar 2, 2024
@zaps166
Copy link
Owner

zaps166 commented Mar 2, 2024

Fixed, however if OpenGL 1 is working there - use it.

@porschemad911
Copy link
Author

Brilliant thank you, I'll give it a test!

@zaps166
Copy link
Owner

zaps166 commented Mar 3, 2024

Also I generally improved OpenGL performance, maybe it'll run faster now!

@porschemad911
Copy link
Author

@zaps166 was able to compile at commit 06c357106827eee5f9845a749aa3d4869cb34cc9 in a docker container, and the gles2 renderer is now working on the Panfrost devices. Thank you for the fix!

@zaps166
Copy link
Owner

zaps166 commented Mar 7, 2024

After some changes, GL(ES)2 is now default renderer.

@porschemad911
Copy link
Author

porschemad911 commented Mar 7, 2024

I see you have been busy!

Earlier in the week I was attempting to re-compile for arm32v7 / armhf at commit 7d144a070547260a27a71d5cb6a5dd7af38188f3. Compilation was fine, but at runtime on my devices all 3 renderers would crash with error:

Application closed with a signal: 7 /storage/roms/ports Need For Speed II SE.sh: line 46: 14104 Bus error $GAMEDIR/nfs2se

Will try my luck again at HEAD :-)

@zaps166
Copy link
Owner

zaps166 commented Mar 7, 2024

Bus error is caused by alignment error, probably floating point numbers. I hope it'll work on current master 🙂 It's working on R-Pi 4 and Android 😄

@porschemad911
Copy link
Author

porschemad911 commented Mar 8, 2024

No luck unfortunately. When running ./compile_nfs cpp at commit 52c9f50faa7addfa46c1db77ad7e4213184f2974 I get quite a few warnings similar to the following:

Compiling C code... DInput.c:586:27: warning: incompatible pointer types assigning to 'uint32_t (*)(struct DirectInputEffect **, const DIEFFECT *, uint32_t)' (aka 'unsigned int (*)(struct DirectInputEffect **, const DIEFFECT *, unsigned int)') from 'void (void *)' [-Wincompatible-pointer-types]
        dinputEff->SetParameters = WRAP_NAME(SetParameters);

Then same runtime errors as in #112 (comment)

This is in an Ubuntu Focal Docker Container (arm32v7 / armhf):

john@john-desktop:~/workspace/sdl2$ docker ps
CONTAINER ID   IMAGE                  COMMAND       CREATED      STATUS          PORTS     NAMES
139df2187727   arm32v7/ubuntu:focal   "/bin/bash"   3 days ago   Up 31 minutes             flamboyant_sinoussi

Dependency versions: SDL2 2.26.2, clang 1:10.0-50 and lld 1:10.0-50

Maybe I'm doing something wrong, although it is fine at commits prior to the switch to lld. How are you compiling for R-Pi 4?

@zaps166
Copy link
Owner

zaps166 commented Mar 8, 2024

I get quite a few warnings similar to the following:

Because I don't use cast, in C it can compile 😄 However I don't have these warnings. Maybe different compiler version? I see Clang 10, I use newer Clang.

How are you compiling for R-Pi 4?

32-bit Arch Linux, ./compile_nfs cpp. It runs normally there.

Bus error

I copy floating-point data to aligned stack and use VFP there, so it shouldn't happen.


Could you try ./compile_nfs cpp debug ?

@edemirkan
Copy link

Let me know if I would need to move this another issue but just adding here as I also test with porschemad911's binaries - but on another device using the same OS.
In my case I'm getting the bus error in run time, after 30-40 secs while in a race. Would that still be related Clang version used for compilation?

'/storage/.nfs2se' -> '/roms/ports/nfs2se/conf/.nfs2se'
Need For Speed II SE
  Wrapper v1.3.0
  Game    v1.1.2-cpp_r5
  OpenGL  ES 2
Application closed with a signal: 7
/storage/roms/ports/Need For Speed II SE.sh: line 59:  3391 Bus error               $GAMEDIR/nfs2se
Failed to restart oga_events.service: Unit oga_events.service not found.

@zaps166
Copy link
Owner

zaps166 commented Mar 9, 2024

You use old version, check current master branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants