vuk icon indicating copy to clipboard operation
vuk copied to clipboard

Viability of VUK on Android?

Open DethRaid opened this issue 1 year ago • 5 comments

I'm looking into using VUK on Android and I've hit a couple problems

The biggest one is that VUK seems to rely on extensions that aren't available on Android, such as VK_KHR_synchronization2 and VK_KHR_timeline_semaphore. How much does VUK actually rely on these? Would I have to change some core parts of the library to remove them?

DethRaid avatar Sep 15 '22 14:09 DethRaid

It depends. Both synchronization2 and timeline_semaphore have emulation layers - would you be willing/are you able to use these layers? If not then it is possible to bake these layers into vuk itself, provided you are okay with timeline semaphore emulation (sync2 emulation is just translation).

The other 1.2 dependencies are smaller - BDA is currently enabled unconditionally, but this is easy to change. Similar vuk uses host query reset, but this can be made optional. The final bit is descriptor indexing, which is not required by vuk, but it is exposed, so this needs to be gated and the extension used instead of the core feature.

Finally, vuk does not currently attempt to make good use of subpasses and has no support for input attachments yet (although this wouldn't be a large feature to add). Efficient subpass use of course is a different can of worms...

With all this being said, I am not opposed to bringing this support, but with the caveat that I have no way of testing on Android (but can target 1.1 with devsim on PC).

martty avatar Sep 16 '22 17:09 martty

Hmm

I don't know much about the sync2 and timeline semaphore emulation layers, I'm willing to try them

BDA is somewhat supported on Android, that's not a major issue. My phone has host query reset as well. I can add some feature gate for descriptor indexing (and raytracing)

Subpasses and input attachments are pretty important though. That's the can of worms I'm trying to open, actually. I may or may not hack on it this weekend and see what I can do

DethRaid avatar Sep 17 '22 01:09 DethRaid

Also... VUK uses plf::colony. plf::colony tries to use concepts if the compiler claims that C++20 is supported. The Android NDK has managed to include a version of libc++ that claims to support C++20, yet does not support concepts like std::convertible_to

I could use an older Android NDK... but VUK seems to rely on std::bit_width and I have some errors from std::span

app/src/main/cpp/extern/vuk/src/ExecutableRenderGraph.cpp:818:27: error: no viable constructor or deduction guide for deduction of template arguments of 'span'
                                  auto partition_span = std::span(partition_it, new_partition_it);
                                                        ^
  C:/Users/gold1/AppData/Local/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1/span:217:41: note: candidate template ignored: could not match 'pointer' (aka '_Tp *') against 'std::span<vuk::RenderPassInfo, 18446744073709551615>::iterator' (aka '__wrap_iter<vuk::RenderPassInfo *>')
      _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __ptr, size_type __count) : __data{__ptr}
                                          ^

Maybe another deficiency in the NDK's libc++?

DethRaid avatar Sep 17 '22 04:09 DethRaid

Perhaps the easiest would be to switch to a fork of plf::colony with C++20 forced off for the time being, if that doesn't break anything.

martty avatar Sep 17 '22 09:09 martty

That works, but I still have the issue with std::span. I get that error no matter which NDK version I'm using

DethRaid avatar Sep 17 '22 15:09 DethRaid