ConcreteMC / Alex

A Minecraft client written in C# aimed at compatibility with MC:Java & MC:Bedrock
Mozilla Public License 2.0
590 stars 46 forks source link

[Mac OS] Shader compilation fails #124

Open douira opened 2 years ago

douira commented 2 years ago

Describe the bug The latest release release-331 crashes with the following error:

[...]
INFO|PluginManager|Registered 0 plugin instances 
 INFO|PluginManager|Enabled 0 plugins! 
 INFO|Alex|Startup time: 00:00:40.2538415 
Unhandled exception. System.InvalidOperationException: Shader Compilation Failed
   at Microsoft.Xna.Framework.Graphics.Shader.GetShaderHandle()
   at Microsoft.Xna.Framework.Graphics.ShaderProgramCache.Link(Shader vertexShader, Shader pixelShader, Shader hullShader, Shader domainShader, Shader geometryShader, Shader computeShader)
   at Microsoft.Xna.Framework.Graphics.ShaderProgramCache.GetProgram(Shader vertexShader, Shader pixelShader, Shader hullShader, Shader domainShader, Shader geometryShader, Shader computeShader)
   at Microsoft.Xna.Framework.Graphics.GraphicsDevice.ActivateShaderProgram()
   at Microsoft.Xna.Framework.Graphics.GraphicsDevice.PlatformApplyState(Boolean applyShaders)
   at Microsoft.Xna.Framework.Graphics.GraphicsDevice.PlatformDrawIndexedPrimitives(PrimitiveType primitiveType, Int32 baseVertex, Int32 startIndex, Int32 primitiveCount)
   at Microsoft.Xna.Framework.Graphics.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType primitiveType, Int32 baseVertex, Int32 startIndex, Int32 primitiveCount)
   at Alex.Graphics.Models.ModelMeshPart.Draw(GraphicsDevice graphicsDevice, Effect effect)
   at Alex.Graphics.Models.Model.Draw(Matrix world, Matrix view, Matrix projection, Matrix[] matrices, Effect effect)
   at Alex.Entities.Entity.Render(IRenderArgs renderArgs, Boolean useCulling)
   at Alex.Gui.Elements.Context3D.GuiEntityModelView.EntityDrawable.DrawContext3D(IRenderArgs args, IGuiRenderer guiRenderer)
   at Alex.Gui.Elements.Context3D.GuiContext3DElement.OnDraw(GuiSpriteBatch graphics, GameTime gameTime)
   at RocketUI.RocketElement.Draw(GuiSpriteBatch graphics, GameTime gameTime)
   at RocketUI.RocketElement.ForEachChild(Action`1 childAction)
   at RocketUI.RocketElement.Draw(GuiSpriteBatch graphics, GameTime gameTime)
   at RocketUI.GuiManager.Draw(GameTime gameTime)
   at Microsoft.Xna.Framework.Game.SortingFilteringCollection`1.ForEachFilteredItem[TUserData](Action`2 action, TUserData userData)
   at Microsoft.Xna.Framework.Game.DoDraw(GameTime gameTime)
   at Microsoft.Xna.Framework.Game.Tick()
   at Microsoft.Xna.Framework.SdlGamePlatform.RunLoop()
   at Microsoft.Xna.Framework.Game.Run(GameRunBehavior runBehavior)
   at Alex.Program.LaunchGame(LaunchSettings launchSettings)
   at Alex.Program.Main(String[] args)
zsh: abort

Additionally a section of the window flickers red/black before it crashes. Resizing the window by any amount stops that.

To Reproduce Steps to reproduce the behavior:

  1. Start the binary and wait for it to crash after downloading assets.

Expected behavior It should not crash. (and also not flicker)

Screenshots The window does appear but then disappears after the crash.

Screenshot 2022-03-03 at 19 14 05

The area in the window that is black flickers between black and red every frame.

Some time before the crash but after resizing to make the flickering go away:

Screenshot 2022-03-03 at 19 17 15

Desktop (please complete the following information):

If possible, I would also like to know where Alex stores the downloaded assets and other data.

kennyvv commented 2 years ago

Hi @douira , Thanks for the bug report! I sadly don't have a mac available to test on, so it will probably take me a while before i can work on fixing this. Secondly, to answer your question, the assets are stored under your user folder.

On a linux system this would be "~/.config/Alex", i think it's the same on a mac. It's the equivalent of the %appdata% folder on a windows machine.

douira commented 2 years ago

Thanks for looking into it. If you want me to test something, I can try to help. I suspect this issue has something to do with Apple's implementation of OpenGL on macOS. Additionally, it only has support for OpenGL 4.1.

It's the equivalent of the %appdata% folder on a windows machine.

On macOS the equivalent of the %appdata% folder is ~/Library/Application Support/Alex. That's also where Minecraft stores it's application data (in it's own folder minecraft). Putting it in .config is ok but a little unusual since one wouldn't expect it to be there on macOS.

kennyvv commented 2 years ago

The latest release has a new version of the library responsible for shader compilation, so if you could test this again, that would be great! Tho i'm not very hopeful it's gonna be fixed

douira commented 2 years ago

I tried it again now and it still fails on shader compilation.

hackedXD commented 2 years ago

same thing for me ;)

kennyvv commented 2 years ago

Small update, i have a machine i can test this on now. So i will be looking into the issue as soon as i've got time to do so!

ghost commented 2 years ago

I wanted to say that I get seemingly the same problem on Guix (Linux). I’m using Mesa (as opposed to CUDA) for OpenGL.

kennyvv commented 2 years ago

I have a decent idea of what the issue is, just need to take the time to fix it.

It seems like it's todo with the OpenGL version used for the shaders, as i did manage to get it to run when swapping them out for different ones.

devgocri commented 2 years ago

When would there be a fix to this?

Declan-Reid commented 1 year ago

Any update on this?

onion108 commented 10 months ago

Any update?

Declan-Reid commented 10 months ago

I think this might have died. Very sad.