Author Topic: Low performance when using uncompiled objects  (Read 11045 times)

Offline Jakes

  • int
  • **
  • Posts: 63
    • View Profile
Re: Low performance when using uncompiled objects
« Reply #30 on: November 15, 2019, 04:20:05 pm »
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.

Offline Jakes

  • int
  • **
  • Posts: 63
    • View Profile
Re: Low performance when using uncompiled objects
« Reply #31 on: November 16, 2019, 04:25:30 am »
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:

« Last Edit: November 18, 2019, 12:53:55 pm by Jakes »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Low performance when using uncompiled objects
« Reply #32 on: November 19, 2019, 08:21:29 am »
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.
« Last Edit: November 19, 2019, 08:27:16 am by EgonOlsen »

Offline Jakes

  • int
  • **
  • Posts: 63
    • View Profile
Re: Low performance when using uncompiled objects
« Reply #33 on: November 19, 2019, 11:42:00 am »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Low performance when using uncompiled objects
« Reply #34 on: November 19, 2019, 07:49:46 pm »
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.

Offline Jakes

  • int
  • **
  • Posts: 63
    • View Profile
Re: Low performance when using uncompiled objects
« Reply #35 on: November 20, 2019, 11:33:27 am »
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