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

glViewportIndexed not supported in OpenGL versions older than 4.1 #455

Open
marc-cr1810 opened this issue Jun 22, 2022 · 1 comment
Open

Comments

@marc-cr1810
Copy link

marc-cr1810 commented Jun 22, 2022

When trying to run my application on a computer with OpenGL version 3.1. I found that it always crashes when it tries to set the viewport. Looking through the source I found that anytime you try to set the viewport it calls the glViewportIndexedf function.
image
According to OpenGL's own documentation this function is not supported on OpenGL versions below 4.1.
image
There should be a check in Veldrid.OpenGL.OpenGLCommandExecutor.SetViewport function to detect whether the version is correct to use glViewportIndexed or just use glViewport which is supported from OpenGL 2.0.
image
image

References:
https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glViewportIndexed.xhtml
https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glViewport.xhtml

@mellinoe
Copy link
Collaborator

mellinoe commented Jul 7, 2022

Yes, this is an issue. There is already a feature flag (GraphicsDeviceFeatures.MultipleViewports) which communicates whether multiple viewports are supported by the device, and this should be reflected correctly already on the GL backend:

ARB_ViewportArray = IsExtensionSupported("GL_ARB_viewport_array") || GLVersion(4, 1);

OpenGLCommandExecutor should consult that feature flag (or check the extension directly) before it calls that function. Additionally, there should probably be a check inside the base CommandList.SetViewport method which asserts that you don't try to set a viewport where index != 0 if the feature isn't supported.

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

No branches or pull requests

2 participants