-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
[Bug report] GL Context fails to be created on RPI4/ARM64 #343
Comments
Related issue at Silk.NET: dotnet/Silk.NET#1277 |
@Pyrdacor based on the replies on the Silk.NET issue, and from what I tested here, it seems that this library won't work on devices such as the RPI, due to the OpenGL minimum requirements (the lib is hardcoded to use OpenGL 3.1 as a minimum). Considering there are no 3D functions being used, perhaps we could use something simpler like a pure SDL2 implementation? Not sure how much of a change that would be... |
Well OpenGL 3.1 is explicitly required as the engine uses shaders. This is from 2009 so 14 years old already. But the Pi uses OpenGL ES which is a whole different story. See the Ambermoon.net project and there the GameWindow.cs file. Relevant code: #if GLES
var api = new GraphicsAPI
(ContextAPI.OpenGLES, ContextProfile.Compatability, ContextFlags.Default, new APIVersion(3, 0));
#else
var api = GraphicsAPI.Default;
#endif So to make it work with Pi you need to define GLES when compiling. The Pi4 should support OpenGL ES 3.0 which is based on OpenGL 3.3. This is what I am aiming for. The Pi3 only has OpenGL ES 2.0 which won't work maybe. But I guess it also emulates some newer features as well. But as I just now realize, it also supports at least fragment and vertex shaders which is all that is needed. So maybe just change |
Creating a new render backend with SDL is a huge task. But in theory I designed the projects to be able to support this. Basically the game works with interfaces defined in the Ambermoon.Core project in sub-folder "Render". You could create your own render backend which implements those interfaces and provides the implementation. Basically you have to take the project Ambermoon.Renderer.OpenGL as a reference and create a new similar project. Still it is a lot of work. But this would be the way to go. As you can see in that project, there are many shader classes which won't work without OpenGL 3.1 or OpenGL ES 2 or 3. The concept in a nutshell is:
If you implement them all, you should be fine in theory. The project grew a lot since the initial design so there might be some more things to take care of. In general it should be enough to set the Visible property of a render node to true and ensure a valid position on the screen through the X and Y property. And of course a valid layer must be assigned. If those 4 properties are valid, the render node is drawn. This is the basic workflow for displaying stuff on the screen. I could provide more info, but writing a new renderer might be much work. |
I tried the configuration
it seems that's the shader itself that fails now, but I don't have enough knowledge about shaders to fix that :) BTW, the |
For the first shader error you could fix this with changing Maybe you have to do Maybe ES doesn't support some functions. If this is the only error, this is no big deal. |
@Pyrdacor Any idea what this might be related to? |
Also, I am probably missing something here, but I can't seem to be able to define You had an env variable being defined in your PS1 script, but that didn't seem to work. No matter what value it got (true/false) it would never define
However, it still does not define Like I said, I'm probably missing something here, but I think this should have worked. |
The Ambermoon.net project most likely has no such configuration. You would have to add it. You can see this in the configuration manager of the solution. I bet when the solution configuration "ReleaseWithAndroid" is selected, the Ambrrmoon.net project uses the "Release" config. The configurations exist for each project and also for the whole solution. But a project can use a different configuration as the solution config. Especially when it doesn't have that config. |
About the messed up UI. This can have multiple causes. One is the display layer (layer in the shader) which controls the Z order. |
You can check in the debugger if the property |
Regarding the config issue above, perhaps you can take a look at my branch and see if you can notice something I missed: https://github.com/midwan/Ambermoon.net/tree/fix-rpi :) |
How did you check if GLES is defined? As it is only evaluated in the renderer project it won't have an effect to define it in Ambermoon.net I guess. |
In the configuration manager I see "ReleaseWithAndroid" but in the project file you added and also check for "ReleaseAndroid" |
@Pyrdacor
I didn't add that, it was already there. And you had a condition in the project file to define |
Ok good catch. You saw my second reply? You used the wrong configuration name in the project file. |
@Pyrdacor |
I think you should instead have replaced "ReleaseAndroid" by "ReleaseWithAndroid" as this is the used solution configuration. If it works in the renderer project it should also work in the main project if the names are right. |
Ok I saw you also renamed it inside the solution file so it should work. Did you restart VS? Sometimes it's just a visual issue and it actually works. I can test it tomorrow when I am back at my PC. |
If you want to rule out the configuration you could just remove the condition in the project file for testing. If it then still does not work, something else is broken. |
Ok I found the reason. The project has another condition I updated the whole solutions and projects and added 2 new configs "ReleaseES" and "DebugES" to distinguish between Android and just ES (RPI etc). Maybe you can just rebase against master again. I already changed the ES context version to 2.0, upgraded some dependencies etc. See a51b905 |
Ah, good catch! I'll rebase against |
How is the status? I saw on your screenshot in the background that it runs with the SDL backend which is not well supported. Were you able to run it with glow? |
I didn't have a chance to do anything more with this, I'm afraid. Been busy with a few other projects lately... |
Ok let me know when you continue with this. |
Maybe we can try this with a Pull request, so we can comment/make changes in the code directly as well? I can send over what I have done so far, and we can continue on that. |
PR submitted: #346 - ignore that, I'll clean up the git mess and try again |
Proper PR submitted: #347 :) |
Perhaps this issue should be closed, as we've moved on from the original problem/description? :) |
Describe the bug
Ambermoon fails to start on a Raspberry Pi running Manjaro (arm64/aarch64), with the following error:
The window opens up, but contains nothing. Pressing enter in the console shuts down the game.
Based on this related answer in StackOverflow: https://stackoverflow.com/questions/65531911/glx-context-creation-error-glxbadfbconfig, the specification of GLX_ARB_create_context is clear about when GLXBadFBConfig error may be returned:
It might be a case of Silk.NET requesting a major/minor version that is not supported on these devices, but I'm not 100% sure yet.
The output of
glxinfo | grep -e "OpenGL version" -e "Core" -e "Compatible"
on the device is the following:From what I could see so far, you don't explicitly request any GL version when initializing the window, so this may be internal to Silk.NET. I'll try opening an issue there to see if they have any feedback, and keep digging to see if there's a way to fix this.
Submitting this issue here for future reference, and in the case of any PR that fixes it. :)
The text was updated successfully, but these errors were encountered: