openvr icon indicating copy to clipboard operation
openvr copied to clipboard

How to use Submit_GlArrayTexture

Open freetailupdate opened this issue 4 years ago • 0 comments

Hi

I noticed Submit_GlArrayTexture was added an EVRSubmitFlags for compositor Submit. There doesn't seem to be any documentation on how to use it.

I have a texture array with the left eye rendered in layer 0, right eye in layer 1. Rendered via GL_OVR_multiview. Is the intention of this flag to allow us to submit texture arrays to the compositor?

A quick test seems not to work. I noticed this line related to metal textures

https://github.com/ValveSoftware/openvr/blob/4c85abcb7f7f1f02adaf3812018c99fc593bc341/headers/openvr.h#L165 MTLTextureType2DArray assume layer 0 is the left eye texture (vr::EVREye::Eye_left), layer 1 is the right eye texture (vr::EVREye::Eye_Right).

So have assumed the same for GL, that you just submit the same texture for both eyes and it'll assume to use layer 0 for left and layer 1 for right

      vr::VRCompositorError error = vr::VRCompositorError_None;
      error = vr::VRCompositor()->Submit(vr::EVREye::Eye_Left, &tex, nullptr, vr::EVRSubmitFlags::Submit_GlArrayTexture);
      if (error != vr::VRCompositorError_None)
      {
         DtWarn << "Error submitting left eye to HMD:  " << error << std::endl;
      }

      error = vr::VRCompositor()->Submit(vr::EVREye::Eye_Right, &tex, nullptr, vr::EVRSubmitFlags::Submit_GlArrayTexture);
      if (error != vr::VRCompositorError_None)
      {
         DtWarn << "Error submitting right eye to HMD:  " << error << std::endl;
      }

I just get black though and a GL error "GL_INVALID_VALUE error generated. The z values exceeds the slice count of the array texture."

Anyone know what I'm doing wrong or if this is even the intended purpose of the flag.

Thanks Tom

freetailupdate avatar Sep 17 '21 13:09 freetailupdate