Low performance when using uncompiled objects

Started by Jakes, October 13, 2019, 06:40:54 PM

Previous topic - Next topic

Jakes

These textures vary from 512x512 to 4096x4096, the ones giving the major hiccups are the 2048x2048 and 4096x4096. when I removed them, everything worked fine, without hiccups at all (some so small you wodnt notice them 512 textures were harmless), using both the old and new jars.

So I removed the preWarm() I was using, and chaged it to the first cycle iteration of the simulation progress, and still had the same results as if there were no effect at all.
The example was a sphere with a 4096x4096 texture on it and 2 more of the same size with alpha channels. (only right before looking at the object you will have a small freeze-frame for 0.3/4 secs and it would continue normally afterwards)

I am building a single case scenario now with the same example, to test on my other machine, I will send you today the results and the project if you want them.

Jakes

#31
Found it!

It seems that the AWTJPCTCanvas is not assuming the preWarm action.

Here is my test example in attachment: Link

I've tested with 2 spheres with 2 4096x textures each, every time each one comes to play, there's a short freezing of the simulation.

I checked that this behavior doesn't apply when using the LWJGL Display combined with the preWarm, but when I'm using the Canvas generated by the "FrameBuffer.enableGLCanvasRenderer()" the preWarm seems to be ignored as you can check on this image below:


EgonOlsen

#32
Oh, you are using the AWTJPCTCanvas renderer!? I wasn't aware of that, I always thought you were using the "normal" GL renderer. In that case, it's pretty clear that the preWarm doesn't help. That's because with the  AWTJPCTCanvas renderer, your application and the rendering are running in two different threads and your application can't access the GL context hence it can't execute preWarm directly and just ignores the call. I would have to make sure to push the preWarm() into the rendering thread's pipeline and execute it from there. I'll look at it.

Jakes

Yes, I'm sorry I wasn't clear about that.

Yeah, I'm using the separate canvas because I'm writing an editor tool with some AWT components on the side, so it helps using a smaller viewport mixed with other stuff.

and yes, I figured that was the reason, since there are no syncronization wit this component. Well, thanks a lot, if you need any help on my side, just let me know.

EgonOlsen

Please try this jar: https://jpct.de/download/net/jpct.jar

I've modified the behaviour so that prewarming should happen when using the AWTGLRenderer too. Please note that I've renamed the method World.compileAllObjects() to World.prewarmCompiledObjects(), because that's what it does. It doesn't actually compile anything but it uploads objects on which compile() has already been called.

Jakes

It worked!

Finally I can run the simulation in a smoother way, and it keeps stable without any staggering along the way.

BTW, I'm only using the TextureManager.preWarm(), the World.prewarmCompiledObjects() for some reason changed my objects orientation, prolly because of the "building" process of those objects. I'll have a look into it afterwards.

But thanks again man, if you want to publish that I'll download the offical version from the site.

I think this thread can finally rest now after a month of intense testing.

Regards,
Jakes