First use of image() takes too long on integrated graphics

A game I have made with Processing is in closed beta at the moment, and one issue that has come up is excessive hang ups the first time an image is drawn. For context the game uses the P2D renderer. The background for the menu is 1920x1080. Some friends and I reported these times for how long it takes the sketch to show the menu image after starting:

  • Intel UHD 620: ~30 seconds
  • Intel HD 4600: ~10 seconds
  • Intel UHD 630: ~1 second (mine)

Obviously there are other factors such as drivers, machine, etc. but these times seem to me like a bigger issue. On dedicated graphics, these hang ups are non-existent. I have tested a simple sketch that just draws an image and it shows the same hang up, so it seems independent of the game. The hang-up is also not part of the sketch itself, as in the elapsed time of the sketch does not reflect the hang up time.

I have no graphics background, but from some reading on the forum it seems this is related to the image data being sent to the GPU. This issue seems to be fundamental to processing, so I’m at a loss as to how to address this.

1 Like

Have you got them to test a P2D sketch that doesn’t use image()? Do the times improve on a second run? I’ve seen seriously long delays in initializing an OpenGL sketch on Windows in the past, particularly on the first run.

I have not had them run a P2D sketch without image(), when I get a change I will. From my own testing on my integrated card I am confident image() is the slow down.

This is the simple app I am having them test. The image file is just some 1920x1080 image. I export this sketch and they run it as an application

PImage menuImg;

void setup(){
  size(1920,1080,P2D);
  menuImg = loadImage("menu.png");
}

void draw(){
    background(0,0,0);
    image(menuImg,0,0);
}

My friend who most recently tested it timed 7 seconds from starting the application to when the image appeared. Running it a second time or third does not make it faster. They have Intel UHD graphics