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

Pass the vr_use_immersive_mode as a Vertex Shader Uniform flag #37

Merged
merged 1 commit into from
Jan 29, 2024
Merged

Pass the vr_use_immersive_mode as a Vertex Shader Uniform flag #37

merged 1 commit into from
Jan 29, 2024

Conversation

DrBeef
Copy link
Contributor

@DrBeef DrBeef commented Jan 28, 2024

This means the same shaders can be used for both immersive and non-immersive as the uniform itself is the toggle in the GLSL rather than generating two different instances of the shader.

Furthermore, only one place where the gl_Position was being modified was actually needed; the other two seem to be able to be removed without it preventing immersive mode from working.

Hopefully this change will help make it easier to merge immersive to the main branch as it will now longer cause shader cache issues for anyone.

This means the same shaders can be used for both immersive and non-immersive as the uniform itself it the toggle in the GLSL rather than generating two different instances of the shader.
Furthermore, only one place where the gl_Position was being modified was actually needed; the other two seem to be able to be removed without it preventing immersive mode from working.
@amwatson amwatson merged commit fbabdf7 into amwatson:lubos_immersive_mode Jan 29, 2024
@amwatson
Copy link
Owner

Looks great! Thanks so much!

@amwatson
Copy link
Owner

maybe we should just pass the immersion_factor in as the uniform? then we could have the low/high res mode your original version had

@DrBeef
Copy link
Contributor Author

DrBeef commented Jan 29, 2024

Sure!, I'll take a look at that. Using the uniforms like this might also be a way of either adding in the "adaptive screen" functionality that some people have mentioned.. but one step at a time. I'll make the additional change to restore the alternative immersive modes.

@raphaelthegreat
Copy link
Contributor

raphaelthegreat commented Jan 29, 2024

Have you checked the layout of the uniform structure is correct? bools are padded to 4 bytes under the std140 layout rules. The previous one worked cause the client side struct was padded as well, but now that you added another one, they are packed. You can add an alignas(4) to the client side if not

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

Successfully merging this pull request may close these issues.

3 participants