Page 1 of 1

Trying native switch port, glsl problem

PostPosted: Wed Oct 12, 2022 4:26 pm
by r4dius
Hi,
I'm trying to port on switch for "fun", I've got it compiled but when executing on switch I get shader errors like :

[Info] OpenGL information:
[Info] Vendor : nouveau
[Info] Renderer : NV120
[Info] Version : OpenGL ES 3.2 Mesa 20.1.0-rc3
[Info] Shading Language Version : OpenGL ES GLSL ES 3.20
[Info] Maximum Vertex Array Size: 3000 vertices
[Info] Maximum Texture Size : 16384 texels
[Info] Maximum Vertex Attributes: 16
[Info] Maximum Vertex Uniforms : 16384
[Info] Maximum Texture Img Units: 32
[Info]
[Error] Vertex shader failed to compile. Your OpenGL driver said:
0:3(10): error: GLSL 1.20 is not supported. Supported versions are: 1.00 ES, 3.00 ES, 3.10 ES, and 3.20 ES

I have 0 knowledge with opengl and even less with shaders, do you guys think there's any compatibility way to get it running or does this need to rebuild all shaders code ?

Thanks

Re: Trying native switch port, glsl problem

PostPosted: Fri Oct 21, 2022 8:49 am
by Ian
Don't quote me on this because I've never written any OpenGL ES. But last time I looked OpenGL ES is basically the same as regular opengl. But slightly cut down, so they've removed a bunch of functions/functionality.

The shaders are failing for the simple reason you are trying to compile regular opengl shaders with opengl es.
All opengl shaders must start with a version declaration which starts like this

#version 120

opengl es is the same

but they need es after the version, so ..

#define opengl 320 es

But beyond that, i don't think there is much you'll have to change to get things working. I'd either try porting the triangle renderer (default new3d engine) or the legacy engine.

Re: Trying native switch port, glsl problem

PostPosted: Sun Nov 13, 2022 8:04 am
by r4dius
Thanks for the reply,
I've been testing changing the version and changing some deprecated stuff but still have to replace complex parts of the opengl,
as for the new3d render there's still some use of shaders in shaders2d.h which is initialized for both renderers
and it contains at least one of the blocking opengl stuff "gl_MultiTexCoord0" which doesn't exist in gl ES and I can't find any example of how it's replaced :oops:

Re: Trying native switch port, glsl problem

PostPosted: Mon Nov 14, 2022 4:52 pm
by Ian
glVertexAttribPointer would be a direct replacement.
Been looking it might be possible to get the new renderer working with gles 3 2. I wonder how fast the hw is.