-
Notifications
You must be signed in to change notification settings - Fork 44
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 Vulkan QML backend #467
Conversation
} | ||
|
||
///////////////////////////////////////////////// | ||
///////////////////////////////////////////////// |
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.
///////////////////////////////////////////////// |
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.
The double comment is on purpose (it's also in MinimalSceneRhiOpenGL.cc.cpp & MinimalSceneRhiMetal.mm) to distinguish the switch from GzCameraTextureRhiVulkan
class definitions to RenderThreadRhiVulkan
.
(fun fact: GzCameraTextureRhi* don't seem to actually be used. It seems to be dead code but this theory needs to be tested; I added a TODO in class GzCameraTextureRhi
).
I think there is no ABI breakage? Adding a new function to |
29a911e
to
784319d
Compare
we need to bump gz-rendering dep version to 8.0.0 and update CI configurations. I'll do that in a separate PRs after all changes are forward ported to |
I thought this could land in garden? |
gazebosim/gz-rendering#706 may have some ABI breaking changes. We could try to work around it. |
Originally yes. With a few hacks I think/thought it could still land on Garden. However my original assessment was assuming #357 was already merged (I was surprised when I found out it was not), and AFAIK Garden will be released without it. I'm not sure if we can avoid ABI breakage given that #357 wasn't included. I'd have to carefully look into it if we want to backport at least the fallback path. |
I think #357 can go in |
coming back to this, I think gazebosim/gz-rendering#706 is going to be hard to backport to garden. @mjcarroll are you ok with these PRs landing in |
Yes, lets land them on main for expedience. |
needs version bumps |
@azeey I'm trying to rebase this PR to main; but current main has a gazillion build errors.
gz-sim/main is in the same state (merging has quite a number of merge conflicts). On top of those build errors, they're also looking for the wrong project versions (e.g they look for gz-rendering7 instead of gz-rendering8). Basically building Should I wait until Harmonic is buildable? |
Yes, there are a couple of PRs in flight bumping the major versions of |
after #512 gets in, everything up to gz-gui should be buildable |
784319d
to
964a568
Compare
Another rebased and retargeted. |
Codecov Report
@@ Coverage Diff @@
## main #467 +/- ##
==========================================
- Coverage 68.39% 68.30% -0.10%
==========================================
Files 45 45
Lines 4980 5038 +58
==========================================
+ Hits 3406 3441 +35
- Misses 1574 1597 +23
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
I need to rebase this PR now that the previous one has been merged. |
It's working! Signed-off-by: Matias N. Goldberg <dark_sylinc@yahoo.com.ar>
Signed-off-by: Matias N. Goldberg <dark_sylinc@yahoo.com.ar>
Signed-off-by: Matias N. Goldberg <dark_sylinc@yahoo.com.ar>
Signed-off-by: Matias N. Goldberg <dark_sylinc@yahoo.com.ar>
Signed-off-by: Matias N. Goldberg <dark_sylinc@yahoo.com.ar>
This fixes Vulkan validation warnings Signed-off-by: Matias N. Goldberg <dark_sylinc@yahoo.com.ar>
Signed-off-by: Matias N. Goldberg <dark_sylinc@yahoo.com.ar>
964a568
to
657f7a2
Compare
Signed-off-by: Matias N. Goldberg <dark_sylinc@yahoo.com.ar>
Fix some GCC warnings Signed-off-by: Matias N. Goldberg <dark_sylinc@yahoo.com.ar>
Signed-off-by: Matias N. Goldberg <dark_sylinc@yahoo.com.ar>
Signed-off-by: Matias N. Goldberg <dark_sylinc@yahoo.com.ar>
Are the tests flaky? Jammy always fails on these two:
And Focal always succeeded except this last time (I made no significant changes that would cause this, possibly flaky):
As for Windows CI, I fixed the problems caused by my PR; the new warnings don't look like caused by me (?) And macOS was failing build, I fixed that. Now it fails various tests. I don't know if those are my fault. |
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.
tested this with gazebosim/gz-sim#1735 on Jammy with Qt 5.13.3 (typo: it's Qt 5.15.3). It's working well for me with worlds like sensors_demo.sdf
and segmentation_camera.sdf
.
One thing I noticed is that gui crashes when I tried to resize the window when gui uses vulkan. If it's not trivial to fix, we can ticket an issue for this.
externalDevice.deviceExtensions.push_back(VkExtensionProperties{}); | ||
VkExtensionProperties &extProp = externalDevice.deviceExtensions.back(); | ||
strncpy(extProp.extensionName, ext.toStdString().c_str(), | ||
VK_MAX_EXTENSION_NAME_SIZE); |
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.
there is a compile warning here:
In function ‘char* strncpy(char*, const char*, size_t)’,
inlined from ‘void fillQtDeviceExtensionsToOgre(gz::rendering::v8::GzVulkanExternalDevice&)’ at /home/ian/code/gz_h_ws/src/gz-gui/src/plugins/minimal_scene/MinimalScene.cc:655:12,
inlined from ‘std::string gz::gui::plugins::GzRenderer::Initialize(gz::gui::plugins::RenderThreadRhi&)’ at /home/ian/code/gz_h_ws/src/gz-gui/src/plugins/minimal_scene/MinimalScene.cc:711:35:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:95:34: warning: ‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ specified bound 256 equals destination size [-Wstringop-truncation]
95 | return __builtin___strncpy_chk (__dest, __src, __len,
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
96 | __glibc_objsize (__dest));
```sh
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.
That should be impossible? The macros:
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 2) && QT_CONFIG(vulkan)
#endif
Which means it should be excluded from complication with Qt 5.13.3
Anyway, the macro says we are doing this:
char data[256];
strncpy( data, somePtr, 256);
Which is dangerous because if strlen( somePtr ) >= 256; then data[255] will not contain the null terminator \0
.
Which is why I do on the next line:
extProp.extensionName[VK_MAX_EXTENSION_NAME_SIZE - 1u] = 0;
in order to enforce the string is always valid.
Anyway, there may be other ways to fix this warning:
strncpy(extProp.extensionName, ext.constData(),
VK_MAX_EXTENSION_NAME_SIZE - 1u);
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.
ah typo, I was testing with Qt 5.15.3 not Qt 5.13.3. I added the suggested fix to that line (and left other similar lines untouched) to get rid of the warning. 99f887f
I've seen these tests fail from time to time. I think they are flaky.
I haven't seen those tests failed before. Not sure why. I restarted a new homebrew build and now it only has one expected test failure: https://build.osrfoundation.org/job/ignition_gui-ci-pr_any-homebrew-amd64/1893/. Will need to keep an eye on this. |
Signed-off-by: Ian Chen <ichen@osrfoundation.org>
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.
CI looks good. Tested together with gazebosim/gz-sim#1735:
gz sim -v 4 --render-engine-gui-api-backend vulkan sensors_demo.sdf
GUI works for me in both vulkan and OpenGL.
🎉 New feature
Order in which PRs must be merged
Summary
This PR adds native Vulkan backend using Qt's QML Vulkan RHI.
I couldn't believe it so I opened it up on RenderDoc and indeed it's using Vulkan:
This PR breaks ABI slightly, so it's best if it targets post-Garden.
With a few global variables we could workaround it and backport it to Garden though. Note that Garden supports Vulkan via a fallback that is very slow. This PR offers native, full speed integration.
Missing tasks:
Test it
This PR can be tested once gazebosim/gz-sim#1735 (which comes after this PR) is merged, which adds the capability to enable the features in this PR via CLI.
Testing it in Ubuntu 20.04
It is possible to build with Ubuntu 20.04 against Qt 5.15.2. You need the following:
colcon build --cmake-args -DCMAKE_PREFIX_PATH=/opt/Qt/5.15.2/gcc_64 -DQT_QMAKE_EXECUTABLE=/opt/Qt/5.15.2/gcc_64/bin/qmake --merge-install
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.