-
Notifications
You must be signed in to change notification settings - Fork 36
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
Imgui in minecraft yields nondeterministic rendering issues #114
Comments
I'll look into that in this holidays, do you have a SSCCE I can use it to debug it? Ps: opening issues is actually a great help |
I created a repository here. Assuming you are using IDEA:
If everything went right, minecraft will start up and in the console will appear:
|
I found this issue a while back, but could only crash when trying to run it
myself! Thank you for finding this! What OS are you using? I think Windows,
which I was using, will not work to re-create, since mine would always
crash.
…On Thu, Dec 19, 2019, 09:57 Ridan Vandenbergh ***@***.***> wrote:
I created a repository here
<https://github.com/zeroeightysix/fabric-example-mod>.
I believe you need minecraft installed on your system for fabric to work.
Assuming you are using IDEA:
1. Import the project from the build.gradle
2. Wait for fabric to finish generating sources, etc.
3. Run ./gradlew idea, to generate the run configurations
3.1. You may have to restart your IDE for the run configurations to
show up!
4. Run the newly generated 'Minecraft Client' run configuration.
If everything went right, minecraft will start up and in the console will
appear:
[main/INFO]: [STDOUT]: Hello imgui!
1. Create a new world (Singleplayer > Create new world > Create new
world)
2. Once ingame, press Y. This will open the imgui screen.
2.1 Press R to reload the imgui screen.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#114?email_source=notifications&email_token=ADTJ6QEQNBQD2BJSN7QASRLQZOKYFA5CNFSM4J5I3GK2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHKB2XQ#issuecomment-567549278>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADTJ6QCGNTBGHOVNSS4KX2LQZOKYFANCNFSM4J5I3GKQ>
.
|
I'm on linux. Edit: I'll try to reproduce this issue on windows. |
Turns out it's even worse on windows. I got one JVM crash though (also appearing in nondeterministic nature): Oh, what fun this is to debug.. Edit: The hex number in |
Instinct says to me that we're using a different texture format than
Minecraft and incorrectly setting it
…On Thu, Dec 19, 2019, 11:27 Ridan Vandenbergh ***@***.***> wrote:
Turns out it's even worse on windows.
The problem stays the same, with nondeterministic rendering when the GUI
screen is opened. However, sometimes the program is killed upon either
opening the screen or always killed when pressing R to renew the ImplGl3
instance. No crash, no error, no nothing. Just a bogus exit code (
-1073741819).
I got one JVM crash though (also appearing in nondeterministic nature):
jvm_crash.txt
<https://github.com/kotlin-graphics/imgui/files/3984814/jvm_crash.txt>
hs_err_pid5428.log
<https://github.com/kotlin-graphics/imgui/files/3984813/hs_err_pid5428.log>
Oh, what fun this is to debug..
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#114?email_source=notifications&email_token=ADTJ6QG4HHDWC6EDR73DEKLQZOVIDA5CNFSM4J5I3GK2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHKKRKQ#issuecomment-567584938>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADTJ6QCXM3LRF6OBNTHTXETQZOVIDANCNFSM4J5I3GKQ>
.
|
How come the crashes and rendering is so unpredictable though? If you were using another format, I'd assume it'd crash all the time, or render wrongly all the time |
The crashes may be because of the texture being placed in different places in memory. Before the end leads to weird results due to reading nulls, at the end causes an access violation after we read past the end that we think is there. |
I get:
Which jdk do you use? |
Well, it's complicated. I temporarily fixed it by setting the project SDK to java |
Same. Could you try to replicate? Delete the project and re-clone |
Sorry for the late response. I am able to replicate the issue you described and using the configuration I posted above, I am able to get it to run anyways. |
I have 11.0.1, let me try 11.0.5 |
@zeroeightysix, give it a try, thanks to tests, I fixed tons of bugs and corner cases, a couple of crash allocation bugs included |
Unfortunately I am still able to reproduce this issue. However, the amount of crashes I randomly encounter has decreased significantly (recently, none). Good work! |
May I see one log of these still existing crashes? |
Looking at my remaining logs.. looks like it won't be anything new! My last crash was Feb 2, meaning I haven't had any crashes since fc381b7 - I'm going to assume the commits after have fixed them all. If I do run into a crash again, I'll let you know. |
Nice, let's keep this open still for a while and if there wont be still any crashe, we'll consider it resolved |
I've managed to avoid both the crashes and rendering issues by initializing ImplGL3 right after the Minecraft window is created in WindowProvider::createWindow. @Mixin(WindowProvider.class)
public class WindowProviderInit {
@Inject(at = @At("TAIL"), method = "createWindow")
public void onCreateWindow(WindowSettings settings, String videoMode, String title, CallbackInfoReturnable<Window> cir) {
Window window = cir.getReturnValue();
// Initialize ImplGL3 here!
}
} |
This might be related to #112, #99 or #96. My setup is comparable to all three issues.
Setup
build.gradle
:To work around Can't import uno.glfw.GlfwWindow #112, the fix mentioned in that thread are being used:
The rest of the file is omitted for brevity.
MinecraftScreen.java
:The minecraft screen (GUI) (see Minecraft example not working #99 examples, and the example on the wiki)
Source code
Problem
Imgui's rendering screws up randomly, depending on at what time
implGl3 = new ImplGL3();
(inMinecraftScreen
) is called.Sometimes it renders just fine:
Sometimes it doesn't render at all.
Sometimes it only draws some glyphs, varying in readability:
More readable:
Sometimes all text gets cut off slightly.
How the rendering screws up depends on the current instance of
ImplGL3
.Each time the player invokes a command causing
MinecraftScreen#reload
(this method) to be invoked (thus, creating a new instance ofImplGl3
), the rendering changes, randomly, to any of the above.I'm assuming this has something to do with the openGL state imgui sets up for itself. Changing the GL state before any call to
implGl3.renderDrawData
does not affect how the windows are drawn.Sorry for opening all of these issues! Thanks for your continued help.
The text was updated successfully, but these errors were encountered: