Submitted here instead at OpenVR because my guess is that this is a problem of the Linux specific OpenGL-Vulkan interop and that it's better with Vulkan textures and maybe on Windows though I have not tested it.
First, this code creates a 32x32 RGBA OpenGL texture once and submits it 10 times with SetOverlayTexture(). This is slow the first time, subsequent calls to SetOverlayTexture are done in acceptable time.
Then, it creates the same 32x32RGBA OpenGL texture, but every loop it is a new OpenGL texture with a new handle that is submitted. This is slow every time.
Submitting a new 32x32 OpenGL texture on average takes longer than three 11ms frames on the Vive. If you leave it running for longer (see below), submitting a single texture can take more than 200ms.
But wait, there's more.
If you change the loops variable to something big and skip the texture reusing code by changing the lines like this,
int loops = 10000;
for (int createNewTextures = 1; createNewTextures <= 1; createNewTextures++) {
then it runs long enough to look into the HMD and see vrcompositor itself stuttering!
This stutter can also be seen in the frametime graph:
Submitted here instead at OpenVR because my guess is that this is a problem of the Linux specific OpenGL-Vulkan interop and that it's better with Vulkan textures and maybe on Windows though I have not tested it.
Here is a small example: https://gist.github.com/ChristophHaag/b144c5837ff6b90f38f391d761d68f38
First, this code creates a 32x32 RGBA OpenGL texture once and submits it 10 times with SetOverlayTexture(). This is slow the first time, subsequent calls to SetOverlayTexture are done in acceptable time.
Then, it creates the same 32x32RGBA OpenGL texture, but every loop it is a new OpenGL texture with a new handle that is submitted. This is slow every time.
The numbers for me:
Submitting a new 32x32 OpenGL texture on average takes longer than three 11ms frames on the Vive. If you leave it running for longer (see below), submitting a single texture can take more than 200ms.
But wait, there's more.
If you change the loops variable to something big and skip the texture reusing code by changing the lines like this,
then it runs long enough to look into the HMD and see vrcompositor itself stuttering!
This stutter can also be seen in the frametime graph:
