Alex icon indicating copy to clipboard operation
Alex copied to clipboard

[Mac OS] Shader compilation fails

Open douira opened this issue 2 years ago • 12 comments

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):

  • OS: macOS 12.2.1 (Monterey)
  • Platform: x64 (CPU: Intel i7 6700K)
  • GPU: AMD Radeon RX 6900 XT
  • Build number: 1.0.0-8919d98

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

douira avatar Mar 03 '22 18:03 douira

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.

kennyvv avatar Mar 07 '22 07:03 kennyvv

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.

douira avatar Mar 07 '22 09:03 douira

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

kennyvv avatar Mar 13 '22 18:03 kennyvv

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

douira avatar Mar 27 '22 17:03 douira

same thing for me ;)

hackedXD avatar Apr 03 '22 09:04 hackedXD

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!

kennyvv avatar Apr 14 '22 09:04 kennyvv

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

zamfofex avatar Apr 15 '22 23:04 zamfofex

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.

kennyvv avatar Apr 16 '22 20:04 kennyvv

When would there be a fix to this?

devgocri avatar Jun 12 '22 00:06 devgocri

Any update on this?

Declan-Reid avatar Oct 07 '23 03:10 Declan-Reid

Any update?

onion108 avatar Jan 13 '24 13:01 onion108

I think this might have died. Very sad.

Declan-Reid avatar Jan 13 '24 15:01 Declan-Reid