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

Apple Silicon - unit 2 GLD_TEXTURE_INDEX_2D is unloadable and bound to sampler type (Float) #76

Open
athaun opened this issue Feb 19, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@athaun
Copy link
Member

athaun commented Feb 19, 2022

Warning when running some scenes on mac OS.

2022-02-18 22:22:23.705 java[64638:5363288] [JRSAppKitAWT markAppIsDaemon]: Process manager already initialized: can't fully enable headless mode.
UNSUPPORTED (log once): POSSIBLE ISSUE: unit 1 GLD_TEXTURE_INDEX_2D is unloadable and bound to sampler type (Float) - using zero texture because texture unloadable

Reason for this is unknown right now, this issue is mostly a reminder for myself to debug it.
Possibly a result of System.setProperty("java.awt.headless", "true"); on L. 139 in graphics.Window

@athaun athaun added the bug Something isn't working label Feb 19, 2022
@heavyrain266
Copy link

You may want to try using java.awt.Toolkit.getDefaultToolkit(); before or after initializing glfw, this should remove this message.

@athaun
Copy link
Member Author

athaun commented Mar 28, 2022

That actually results in a black screen and the engine hanging.
Interestingly, after researching the issue I found this:
Someone who has the same error on apple silicon (which is also applicable to me).

Next I took a closer look at the shader itself. The texture samplers were stored in an array, which is a bit of a special case in GLSL, particularly when it comes to OpenGL 3. All accesses to the sampler array must use compile-time fixed indices. I was using a switch statement to branch out uses of every possible index, and this has been working fine on various OpenGL drivers so far. The shader was responding correctly to if statements, though, so eventually I decided to replace the switch statements with a series of ifs. Functionally these are supposed to be equivalent, but to my surprise it fixed the problem!
from https://blog.dengine.net/2021/01/wonders-and-mysteries-of-the-m1/

I will investigate some more with a windows or linux machine to see if the error arises, if not, I will assume it is either mac OS and or m1 architecture specific.
I will also see if using a if/else ladder resolves the issue.

@athaun athaun changed the title Mac OS warning Apple Silicon - unit 2 GLD_TEXTURE_INDEX_2D is unloadable and bound to sampler type (Float) Jul 10, 2022
@athaun
Copy link
Member Author

athaun commented Jul 10, 2022

Likely apple silicon
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants