-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Geometry shader parameter OpenGL error #715
Comments
In addition to that, it looks like the |
use Program::setParameter as in the example osgtransformfeedback |
That won't help with this - the parameters simply don't exist in core OpenGL 3.2 or |
Just to clarify in case it wasn't clear - the error is triggered whether or not the application actually uses any geometry shaders. Whenever OSG links a per-context program, it sets these parameters just in case a geometry shader is in use. |
I think I was having a problem similar to what you're describing. It only impacted Mesa drivers. I'm using a GL 3.3 core profile context, and I got a 3.3 core profile. I use the following code to get around the problem:
|
I don't understand why you'd make it check against OpenGL 4.1. Geometry shaders work the same there as they do in 3.2 and still don't want the parameters setting. I'm going to write a list. Requires setting geometry shader parameters before linking a program:
Requires setting geometry shader parameters within the geometry shader source:
|
I'm not even using Geometry shaders. I was getting an error at the same spot. Mesa is the only one that complained. I figured it was due to my lack of understanding or a driver bug -- and given that we've seen a lot of Mesa driver bugs, I put it up to Mesa. I wasn't seeing the problem past 3.2. I didn't feel confident enough in the work-around to bring it up on the mailing list, and again it felt like a driver bug. It's been a while, so I'm going off memory -- but I was seeing OSG under Mesa reporting that it supported GL_EXT_geometry_shader4 when it did not. Perhaps that means the core problem is in osg/GLExtensions.cpp: https://github.com/openscenegraph/OpenSceneGraph/blob/OpenSceneGraph-3.6.4-rc3/src/osg/GLExtensions.cpp#L458 It appears to set isGeometryShader4Supported when 3.2 or greater, or when GL_OES_geometry_shader. According to your text above it sounds like that's an error. Just trying to lend a hand on the workaround we found on the various hardware we tested. Never saw the issue on GL past 4.1. |
Maybe Mesa does something weird like only supporting both geometry shader implementations with GL 4.1+, and just supporting the core version below that. |
It looks like |
Can you provide a test example that MESA doesn't like, please? |
Literally any OSG application that uses a shader of any kind will exhibit the issue. |
I've asked the person who reported this to me to test a 35-line test program. Being not on Mesa myself, I can't actually test it, so I'm not going to post it until I know it breaks in only the expected way. |
Strange, It should be one of the latest commit as I have made some VAO experiments with openmw/osg36branch/mesa in January without any problem... |
If it helps @mp3butcher I was seeing the issue, which I'm pretty sure is the same one, as far back as June 2018. That's when we started our transition to GL Core profile to support these Mesa drivers that only support GL 3.3+ when in core profile. So I don't think it's impacted by your January changes. |
I can read the OpenGL spec and see that what OSG is doing now is definitely not allowed and what it would be doing after the PR would be allowed. This isn't some wild shot in the dark, and doing testing on someone else's computer in a different timezone takes ages.
I'm thinking that Mesa exposes different geometry shader extensions depending on either:
With the information I have right now, I can only guarantee that I could reproduce the issue if I:
It might turn out to be less specific than that, but it might not. It's too much time and money to investigate a bug of this severity. |
I've got the reporter to run the test and it's enough to reproduce the error. The minimum broken example is this: #include <osg/ShapeDrawable>
#include <osgViewer/Viewer>
static const char* vertexShader = R"GLSL(
#version 120
void main(void)
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}
)GLSL";
static const char* fragmentShader = R"GLSL(
#version 120
void main(void)
{
gl_FragData[0] = vec4(1.0, 1.0, 1.0, 1.0);
}
)GLSL";
int main()
{
osg::ref_ptr<osg::Drawable> drawable = new osg::ShapeDrawable(new osg::Sphere(osg::Vec3(0.0f, 0.0f, 0.0f), 1.0f));
osg::ref_ptr<osg::Program> program = new osg::Program();
program->addShader(new osg::Shader(osg::Shader::VERTEX, vertexShader));
program->addShader(new osg::Shader(osg::Shader::FRAGMENT, fragmentShader));;
drawable->getOrCreateStateSet()->setAttributeAndModes(program, osg::StateAttribute::ON);
osgViewer::Viewer viewer;
viewer.setSceneData(drawable);
return viewer.run();
} I expect that I'll have confirmation that #716 is enough to fix it soon. |
I now have confirmation that #716 does prevent the error being printed. |
I'd prefer to exchange directly (using discord) with the original reporter (@JDGBOLT) to track this bug... |
On some systems (the user who reported this to me is using Mesa with a Radeon Fury), OpenGL errors are being triggered here: https://github.com/openscenegraph/OpenSceneGraph/blob/OpenSceneGraph-3.6.4-rc3/src/osg/Program.cpp#L714
Investigation has lead me to believe that it's because of the differences between the OpenGL extensions exposing geometry shaders and the core feature of GL 3.2 that does the same thing.
In the extensions (e.g.
GL_EXT_geometry_shader4
andGL_ARB_geometry_shader4
) parameters such as input and output type are set as program parameters, just as OSG is doing on the linked lines. However, in the core feature, they're set in the shader source itself. On systems which have the core feature, but not the older extensions, theglProgramParameteri
calls are erroneous, and are causing errors to be reported.I'm not sure how OSG handles the two different implementations of geometry shaders (if at all), but a short-term fix would be to change the final call on this line https://github.com/openscenegraph/OpenSceneGraph/blob/OpenSceneGraph-3.6/src/osg/GLExtensions.cpp#L458 from
isGLExtensionOrVersionSupported
toisGLExtensionSupported
. It's definitely not correct to have it asisGLExtensionOrVersionSupported
given that the extension and core feature are different, so the presence of the extension isn't implied by the GL version.The text was updated successfully, but these errors were encountered: