-
Notifications
You must be signed in to change notification settings - Fork 51
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
Make sure shader param exists before setting its value #558
Conversation
Signed-off-by: Ian Chen <[email protected]>
Codecov Report
@@ Coverage Diff @@
## ign-rendering6 #558 +/- ##
==================================================
- Coverage 54.40% 54.37% -0.03%
==================================================
Files 198 198
Lines 20084 20151 +67
==================================================
+ Hits 10926 10957 +31
- Misses 9158 9194 +36
Continue to review full report at Codecov.
|
This pull request has been mentioned on Gazebo Community. There might be relevant details there: https://community.gazebosim.org/t/new-ignition-releases-2022-03-01-citadel-edifice-fortress/1313/1 |
@iche033 I've realised that this breaks the custom shaders for Metal, which can be seen on the waves example The issue is that the Metal shaders do not declare the textures as parameters and they are not found as named constants. As a result a warning is issued and registration of the texture unit state is skipped. For textures the named constant is only set for OpenGL: A possible fix would be to skip this check if the shader param type is a texture and not OpenGL? if (!_ogreParams->_findNamedConstantDefinition(name_param.first) &&
!(Ogre2RenderEngine::Instance()->GraphicsAPI() !=
GraphicsAPI::OPENGL &&
(ShaderParam::PARAM_TEXTURE == name_param.second.Type() ||
ShaderParam::PARAM_TEXTURE_CUBE == name_param.second.Type()))
)
{
ignwarn << "Unable to find GPU program parameter: "
<< name_param.first << std::endl;
continue;
} |
Signed-off-by: Ian Chen [email protected]
🦟 Bug fix
Summary
Fixes crash when setting a shader parameter that does not exist. Now it prints out a warning msg to let users know what param will not be set.
Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-by
messages.