Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Texturing breaks when using OpenVR #1867

Open
mkovaxx opened this issue Sep 6, 2020 · 4 comments
Open

Texturing breaks when using OpenVR #1867

mkovaxx opened this issue Sep 6, 2020 · 4 comments

Comments

@mkovaxx
Copy link
Contributor

mkovaxx commented Sep 6, 2020

Submitting frames to the OpenVR compositor invalidates a glium::Texture2d (or its contents).

The glium::Texture2d mentioned above is used to render a textured quad in the main window.
Two other textures are used for submitting frames to OpenVR.
Each frame is submitted by passing the output of GlObject::get_id called on a glium::Texture2d.
Nothing is rendered to any of the textures.

Setup:

  • Rust toolchain version: 1.46.0
  • openvr version: 0.6.0
  • glium version: 0.27.0
  • OpenGL vendor: NVIDIA Corporation
  • OpenGL renderer: GeForce GTX 1070 Ti/PCIe/SSE2
  • OpenGL version: 3.1.0 NVIDIA 432.00
  • OS: Windows 10
  • Headset: Oculus Rift

The same issue is reproduced on an Alienware laptop with a 1060.
Also tried with an Oculus Quest (via Oculus Link), same result.

Here's code that demonstrates the problem:
https://github.com/mkovacs/openvr-texture-problem

Also note that I've posted the same issue on the rust-openvr repo almost a year ago:
rust-openvr/rust-openvr#43

@mkovaxx
Copy link
Contributor Author

mkovaxx commented Sep 6, 2020

Found this post on Reddit where another person describes the same issue:
https://www.reddit.com/r/rust/comments/biuzaw/bizarre_issue_with_glium/
CC @NickDriscoll

@mkovaxx
Copy link
Contributor Author

mkovaxx commented Sep 6, 2020

The hypothesis put forward by a commenter on the Reddit thread above seems to be correct.
Glium doesn't seem to handle well that an external process modifies the GL context state.

I collected info about two frames via RenderDoc.
Looking at the info about the fragment shader stage reveals the issue.

Frame 0, taken before submitting anything to OpenVR:
Screenshot of Correct Frame

Frame 1, taken after submitting stuff to OpenVR:
Screenshot of Incorrect Frame

There's simply no texture bound to the checker_texture uniform in the shader.
That's likely because the OpenVR compositor unbinds it, which is a change that Glium doesn't expect to happen.

@mkovaxx
Copy link
Contributor Author

mkovaxx commented Sep 6, 2020

This seems to be related to #1696, i.e. could be fixed by the ability to tell Glium that the cached GL state is no longer valid.

@mkovaxx
Copy link
Contributor Author

mkovaxx commented Sep 12, 2020

I think a solution to #1505 would also resolve this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant