M1 Mac Error: "UNSUPPORTED (log once): POSSIBLE ISSUE: unit 2 GLD_TEXTURE_INDEX_2D is unloadable and bound to sampler type (Float)"
Setup
- JDK: 1.8 (Amazon Coretto 1.8)
- (M1 Max) Mackbook Pro 16 2021.
- MacOs Monterey 12.0.1
Issue:
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
This doesn't actually seem to affect the output of the program. It still runs completely as expected.
This seems to be a common issue that is specific to GLSL and M1?
- https://developer.apple.com/forums/thread/683865
- https://blog.dengine.net/2021/01/wonders-and-mysteries-of-the-m1/
- https://stackoverflow.com/questions/32237439/why-do-i-get-texture-unit-0-is-accessed-both-as-sampler2d-and-samplercube-for
Repro steps:
The following will repro the issue.
import com.soywiz.korge.Korge
import com.soywiz.korge.view.circle
suspend fun main() = Korge() {
circle {
}
}
This however, does not reproduce the issue:
import com.soywiz.korge.Korge
suspend fun main() = Korge() {
}
Getting the same error with imgui when trying to use AddImage(). Some report that the issue is caused by texture arrays and (float) indices. This doesn't apply here as Imgui only uses a single texture. Any insights welcome!
Oh, this is a warning. I believe running OpenGL code is perfectly valid. We didn't figure out how to "fix" this, and this looks like a problem on Apple's side. In our case, we plan to publish a Metal backend at some point, that will circumvent this problem. But in any case, this is just a harmless "log once" warning, so not a big deal.
For anybody who faces the same issue: The min/mag filter was defaulting to mipmap but the texture had no mipmaps attached. Explicotly seeting the filter to linear fixed it.
For anybody who faces the same issue: The min/mag filter was defaulting to mipmap but the texture had no mipmaps attached. Explicotly seeting the filter to linear fixed it.
Ohh. Awesome. Thought it was not possible. Do you have a link to a commit in another code-base fixing it?
PS: Just tried to change this to linear or NEAREST: https://github.com/korlibs/korge/blob/c2251600d5e1dfeff0ce7d3ebb08b21a0ad12168/korgw/src/commonMain/kotlin/korlibs/graphics/gl/AGOpengl.kt#L749-L750 and doesn't fixes the issue. Also tried to call it before binding the texture and it doesn't help either. So if you can provide the imgui patch where it happened and it stops happening that will be really useful.
@soywiz sry mate, it wasn't an issue with ImGui but with my OpenGL code:
int id;
glGenTextures(1, &id);
glBindTexture(GL_TEXTURE_2D, id);
glTexImage2D(GL_TEXTURE_2D, ...);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); // *
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); // *
...
ImGui::Image(id); // +
+ was failing with the above error message on my Mac until I inserted the lines *.