-
Notifications
You must be signed in to change notification settings - Fork 52
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
Add Heightmap integration test #785
Add Heightmap integration test #785
Conversation
Use proper sRGB conversion in DepthCamera Signed-off-by: Matias N. Goldberg <[email protected]>
Signed-off-by: Matias N. Goldberg <[email protected]>
Signed-off-by: Matias N. Goldberg <[email protected]>
OgreNext has CompositorPassSceneDef::setVisibilityMask to prevent overwriting reserved flags. If user calls gz::Camera::SetVisibilityMask with the reserved flags set, wrong rendering could happen. Signed-off-by: Matias N. Goldberg <[email protected]>
Signed-off-by: Matias N. Goldberg <[email protected]>
Signed-off-by: Matias N. Goldberg <[email protected]>
Signed-off-by: Matias N. Goldberg <[email protected]>
Oooofff. CI has a lot of failures:
Update: It seems a lot of these errors actually belong to ogre1 as I can repro them locally. I'd swear I tested ogre1 and it was passing. Maybe I accidentally tested ogre2 instead? Or maybe a regression? (when I rebased gz-rendering7) |
Signed-off-by: Matias N. Goldberg <[email protected]>
Fix memory leak Signed-off-by: Matias N. Goldberg <[email protected]>
Signed-off-by: Matias N. Goldberg <[email protected]>
Signed-off-by: Matias N. Goldberg <[email protected]>
This test is a gift that keeps on giving. There is a memory corruption in GpuRays: if (this->dataPtr->firstPassTextures[i])
{
ogreRoot->getRenderSystem()->getTextureGpuManager()->destroyTexture(
this->dataPtr->firstPassTextures[i]);
this->dataPtr->firstPassTextures[i] = nullptr;
}
if (this->dataPtr->ogreCompositorWorkspace1st[i])
{
ogreCompMgr->removeWorkspace(
this->dataPtr->ogreCompositorWorkspace1st[i]);
this->dataPtr->ogreCompositorWorkspace1st[i] = nullptr;
} The order of destruction is inverted. |
Order of destruction was inverted Signed-off-by: Matias N. Goldberg <[email protected]>
Signed-off-by: Matias N. Goldberg <[email protected]>
Signed-off-by: Matias N. Goldberg <[email protected]>
Signed-off-by: Matias N. Goldberg <[email protected]>
So tell clang tidy to ignore that. Signed-off-by: Matias N. Goldberg <[email protected]>
Signed-off-by: Matias N. Goldberg <[email protected]>
Signed-off-by: Matias N. Goldberg <[email protected]>
OK new round of fixes:
Useless!
Reference (according to macOS CI): RGB: 0 73 0 Depth Camera (according to macOS CI): RGB: 0 0 0 There is only two possibilities:
|
af12184
to
7ada41b
Compare
Signed-off-by: Matias N. Goldberg <[email protected]>
7ada41b
to
e70fb25
Compare
I ran the backtrace[Wrn] [Ogre2Heightmap.cc:118] Heightmap final sampling should be 2^n
which differs from ogre1's 2^n+1
The last row and column will be cropped
size = (width * sampling) - sampling + 1
[257] = ([129] * [2]) - [2] + 1
[Msg] Loading heightmap: example_bowl
[Msg] Heightmap loaded. Process took 0 ms.
INTEGRATION_heightmap: /home/jenkins/workspace/ogre-2.3-debbuilder/repo/OgreMain/include/Math/Array/SSE2/Single/OgreMathlibSSE2.h:136: static Ogre::ArrayReal Ogre::MathlibSSE2::Cmov4(Ogre::ArrayReal, Ogre::ArrayReal, Ogre::ArrayMaskR): Assertion `_mm_movemask_ps( _mm_cmpeq_ps( arg1, arg1 ) ) == 0x0f && _mm_movemask_ps( _mm_cmpeq_ps( arg2, arg2 ) ) == 0x0f && "Passing NaN values to CMov4"' failed.
Thread 1 "INTEGRATION_hei" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007fe99195c859 in __GI_abort () at abort.c:79
#2 0x00007fe99195c729 in __assert_fail_base (fmt=0x7fe991af2588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n",
assertion=0x7fe98792fc20 "_mm_movemask_ps( _mm_cmpeq_ps( arg1, arg1 ) ) == 0x0f && _mm_movemask_ps( _mm_cmpeq_ps( arg2, arg2 ) ) == 0x0f && \"Passing NaN values to CMov4\"",
file=0x7fe98792fbb0 "/home/jenkins/workspace/ogre-2.3-debbuilder/repo/OgreMain/include/Math/Array/SSE2/Single/OgreMathlibSSE2.h", line=136, function=<optimized out>) at assert.c:92
#3 0x00007fe99196dfd6 in __GI___assert_fail (assertion=0x7fe98792fc20 "_mm_movemask_ps( _mm_cmpeq_ps( arg1, arg1 ) ) == 0x0f && _mm_movemask_ps( _mm_cmpeq_ps( arg2, arg2 ) ) == 0x0f && \"Passing NaN values to CMov4\"",
file=0x7fe98792fbb0 "/home/jenkins/workspace/ogre-2.3-debbuilder/repo/OgreMain/include/Math/Array/SSE2/Single/OgreMathlibSSE2.h", line=136,
function=0x7fe98792fb48 "static Ogre::ArrayReal Ogre::MathlibSSE2::Cmov4(Ogre::ArrayReal, Ogre::ArrayReal, Ogre::ArrayMaskR)") at assert.c:101
#4 0x00007fe9877185b4 in Ogre::Node::updateFromParentImpl() () from /usr/lib/x86_64-linux-gnu/OGRE-2.3/libOgreNextMain.so.2.3.1
#5 0x00007fe987718cbf in Ogre::Node::_updateFromParent() () from /usr/lib/x86_64-linux-gnu/OGRE-2.3/libOgreNextMain.so.2.3.1
#6 0x00007fe987718cb6 in Ogre::Node::_updateFromParent() () from /usr/lib/x86_64-linux-gnu/OGRE-2.3/libOgreNextMain.so.2.3.1
#7 0x00007fe987719d7d in Ogre::Node::_getDerivedOrientationUpdated() () from /usr/lib/x86_64-linux-gnu/OGRE-2.3/libOgreNextMain.so.2.3.1
#8 0x00007fe9875c86fe in Ogre::Camera::isViewOutOfDate() const () from /usr/lib/x86_64-linux-gnu/OGRE-2.3/libOgreNextMain.so.2.3.1
#9 0x00007fe98760ea11 in Ogre::Frustum::updateView() const () from /usr/lib/x86_64-linux-gnu/OGRE-2.3/libOgreNextMain.so.2.3.1
#10 0x00007fe9875caa71 in Ogre::Camera::getDerivedPosition() const () from /usr/lib/x86_64-linux-gnu/OGRE-2.3/libOgreNextMain.so.2.3.1
#11 0x00007fe987d76968 in Ogre::Terra::update (this=this@entry=0x55688e33d3e0, lightDir=..., lightEpsilon=lightEpsilon@entry=9.99999997e-07) at /home/user/code/gz_g_ws/src/gz-rendering/ogre2/src/terrain/Terra/src/Terra.cpp:597
#12 0x00007fe987ce04a8 in gz::rendering::v7::Ogre2Heightmap::UpdateForRender (this=this@entry=0x55688e35f940, _activeCamera=_activeCamera@entry=0x55688e2022d0)
at /home/user/code/gz_g_ws/src/gz-rendering/ogre2/src/Ogre2Heightmap.cc:424
#13 0x00007fe987d49f38 in gz::rendering::v7::Ogre2Scene::UpdateAllHeightmaps (this=0x55688dd0c730, _camera=0x55688e2022d0) at /home/user/code/gz_g_ws/src/gz-rendering/ogre2/src/Ogre2Scene.cc:497
#14 0x00007fe987d4a247 in gz::rendering::v7::Ogre2Scene::StartRendering (this=0x55688dd0c730, _camera=<optimized out>) at /home/user/code/gz_g_ws/src/gz-rendering/ogre2/src/Ogre2Scene.cc:288
#15 0x00007fe987d41ee5 in gz::rendering::v7::Ogre2RenderTarget::Render (this=0x55688e1753d8) at /usr/include/c++/9/bits/shared_ptr_base.h:1020
#16 0x00007fe987ca5a6e in gz::rendering::v7::BaseCamera<gz::rendering::v7::Ogre2Sensor>::Update (this=0x55688e185700) at /usr/include/c++/9/ext/atomicity.h:82
#17 0x00007fe987ca306a in gz::rendering::v7::BaseCamera<gz::rendering::v7::Ogre2Sensor>::Capture (this=0x55688e185700, _image=...) at /home/user/code/gz_g_ws/src/gz-rendering/include/gz/rendering/base/BaseCamera.hh:431
#18 0x000055688c7cb5d3 in HeightmapTest_Heightmap_Test::TestBody (this=0x55688d67cfe0) at /usr/include/c++/9/bits/shared_ptr_base.h:1020
#19 0x000055688c80fee1 in testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void> (location=0x55688c812e31 "the test body", method=<optimized out>, object=0x55688d67cfe0)
at /home/user/code/gz_g_ws/src/gz-rendering/test/gtest_vendor/src/gtest.cc:2580
#20 testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void> (object=object@entry=0x55688d67cfe0, method=<optimized out>, location=location@entry=0x55688c812e31 "the test body")
at /home/user/code/gz_g_ws/src/gz-rendering/test/gtest_vendor/src/gtest.cc:2635
#21 0x000055688c801c26 in testing::Test::Run (this=this@entry=0x55688d67cfe0) at /home/user/code/gz_g_ws/src/gz-rendering/test/gtest_vendor/src/gtest.cc:2674
#22 0x000055688c801eb2 in testing::Test::Run (this=0x55688d67cfe0) at /home/user/code/gz_g_ws/src/gz-rendering/test/gtest_vendor/src/gtest.cc:2853
#23 testing::TestInfo::Run (this=0x55688d67cb00) at /home/user/code/gz_g_ws/src/gz-rendering/test/gtest_vendor/src/gtest.cc:2853
#24 0x000055688c80203a in testing::TestSuite::Run (this=0x55688d644f80) at /home/user/code/gz_g_ws/src/gz-rendering/test/gtest_vendor/src/gtest.cc:3012
#25 0x000055688c8025e5 in testing::TestSuite::Run (this=<optimized out>) at /home/user/code/gz_g_ws/src/gz-rendering/test/gtest_vendor/src/gtest.cc:2986
#26 testing::internal::UnitTestImpl::RunAllTests (this=0x55688d659000) at /home/user/code/gz_g_ws/src/gz-rendering/test/gtest_vendor/src/gtest.cc:5870
#27 0x000055688c810451 in testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool> (location=0x55688c8148c8 "auxiliary test code (environments or event listeners)", method=<optimized out>,
object=0x55688d659000) at /home/user/code/gz_g_ws/src/gz-rendering/test/gtest_vendor/src/gtest.cc:2580
#28 testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool> (object=0x55688d659000, method=<optimized out>,
location=location@entry=0x55688c8148c8 "auxiliary test code (environments or event listeners)") at /home/user/code/gz_g_ws/src/gz-rendering/test/gtest_vendor/src/gtest.cc:2635
#29 0x000055688c802b30 in testing::UnitTest::Run (this=0x55688c82c8a0 <testing::UnitTest::GetInstance()::instance>) at /home/user/code/gz_g_ws/src/gz-rendering/test/gtest_vendor/include/gtest/gtest.h:1246
#30 0x000055688c7c9a04 in RUN_ALL_TESTS () at /home/user/code/gz_g_ws/src/gz-rendering/test/gtest_vendor/include/gtest/gtest.h:2293
#31 main (argc=<optimized out>, argv=0x7ffe45cc7908) at /home/user/code/gz_g_ws/src/gz-rendering/test/gtest_vendor/src/gtest_main.cc:51 I found that if I comment out the directional light in the test, then it passes. |
Mmmm this still reeks of some weird corruption going on. The assert is detecting that a position/direction is NaN and then complaining. But this shouldn't be happening based on how it runs on my machine and jammy. That is what really throws me off. Perhaps I should try using the *.SO built by gazebo (since I see the crash comes from I've been using my own OgreNext 2.3 to run the samples. Also, if you are able to run Valgrind on it, that would be of great help.
Is it complex to launch a docker instance w/ gazebo to test it on? |
ah ok I think I found the right combination for the crash: Focal + llvmpipe. The docker container I was on was doing software rendering. When I tried with Focal + nvidia docker, the test passed. The test also passes on Jammy with llvmpipe so it's just Focal. So to reproduce, I think you just need to force software rendering:
We have a few tests disabled because it does not work well on CI due to the same reason, e.g. here. So if it's not trivial, we should probably just disable this on CI. If you're still interested in valgrind output, here's the gist: |
Out of all problems, it was an llvmpipe crash? I did not see that one coming. That explains it, I am using Kisak PPA which provides more recent mesa drivers, which includes llvmpipe. Either llvmpipe is buggy or it did not provide a feature we rely on. This is a major relief because it means there is no corruption bug in our part. We just need to disable the test for that CI (and see if we can detect why it crashes, perhaps it's just unsupported). As for the macOS check; I'm torn apart:
I'm leaning towards implementing solution in pt 3 (increase thresholds) because at least it covers some errors As for the solution in pt 4, I won't be around to help you guys implement that, BUT it shouldn't be too difficult to implement. |
Going with pt 3 with a todo note sounds good given the limited time we have. We'll take care of pt 4 later in time. Thanks! |
Signed-off-by: Matias N. Goldberg <[email protected]>
Signed-off-by: Matias N. Goldberg <[email protected]>
Codecov Report
@@ Coverage Diff @@
## gz-rendering7 #785 +/- ##
=================================================
+ Coverage 76.10% 76.19% +0.09%
=================================================
Files 164 164
Lines 14393 14393
=================================================
+ Hits 10954 10967 +13
+ Misses 3439 3426 -13
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Signed-off-by: Matias N. Goldberg <[email protected]>
Signed-off-by: Matias N. Goldberg <[email protected]>
Now we only skip on Focal GH Actions (Focal only!) correctly Signed-off-by: Matias N. Goldberg <[email protected]>
Thanks. It's not just enough to do that, since we only want to block Focal, not Jammy. I added IsUbuntuFocal to check for that. The only shame is that Focal CI uploads the coverage results, and since Focal is skipped, Codecov won't pick up the coverage results. Given the other checks via "MESA_GL_VERSION_OVERRIDE" appear to be on GpuRays as well, it sounds like it's the same problem. It also appears on the GI test, and seems to be a similar problem (llvmpipe doesn't support what we need yet, or crashes) |
CI is done running. All checks passed :) ( |
Signed-off-by: Matias N. Goldberg <[email protected]>
Signed-off-by: Matias N. Goldberg <[email protected]>
Whoa! So I wrote down the instructions for somebody else to pick up and implement pt 4 (use But my instructions were so detailed I realized it was quick and easy to do so... I just did it. AND IT WORKS! The problem is forever solved now. This ticket now closes bug #332 on macOS (and possibly other Linux/Windows driver/HW) for good. I apologize for fixing a (mostly unrelated) bug in this PR rather than creating another one. I just won't be around long enough to do that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me! Thanks for fixing #332 as well. I think it'd have taking us a bit of time to do!
Fixes #332 (again) for macOS and possibly any OS/HW/Driver combination. Fixes #369 For a very long time macOS (and possibly other OS/HW/Driver combination) would fail the tests because the shader code was doing (simplified, in C to convey the explanation): ``` uint32_t valueToStore = r << 24 | g << 16 | b << 8 | a; float output; output = (float*)&valueToStore; return output; ``` In ticket #332 I made a deep analysis and found out that given the wrong conditions, the bit pattern would result in either a denormal or a NaN in floating point; which risks being flushed to 0 (or set all types of NaN to the same type bit pattern of NaN). Although the ticket was closed and tagged as "fixed", on some OS/HW/Driver combinations (e.g. macOS + Metal) this error would reappear. This isn't just a mere test failure. This is an actual bug. Running DepthCamera in macOS could result in wrong readings. This PR fixes the problem for good by using RGBA32_UINT instead of RGBA32_FLOAT; and having uints be reinterpreted to floats and back when needed; which is well-defined and much more stable as far as GPU shader compilers go. The same fix is also part of PR #785 which targets Garden and includes other changes. This PR is a backport specific for Fortress. Signed-off-by: Matias N. Goldberg <[email protected]>
🦟 Bug fix
Almost all issues in #546 are covered.
Only Thermal Camera is not covered.
Fixes #332 (again) for macOS and possibly any OS/HW/Driver combination.
Fixes #369
Summary
This PR adds a heightmap test.
This test has uncovered a lot of bugs recently.
Note: This PR currently includes part of #784 because it otherwise will fail unit tests.
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.