Closed jcortell68 closed 1 year ago
I forgot to mention in the commit message that there's also an enhancement to AMDVulkanDemo::InitializeGpa(). In the Android code path, we were not registering the color cube logging callback function via GpaRegisterLoggingCallback. That's something we do in the non-Android codepath. Also, I've enhanced the color cube's callback function to additionally send the message to logcat (in the Android case). The net result of those two changes is that logging that happens in the GPA library now also ends up in logcat.
The lack of logging to logcat on Android makes it very difficult to know what's going wrong when the app doesn't work. The device just shows a black screen and nothing appears in logcat. This pull request brings much needed relief.
The color cube test app does all its error reporting and logging using std::cout. This works fine on desktop platforms but not so well on Android. Android apps typically write to logcat, as the standard handles are not easily accessible.
This introduces a AMDVulkanDemoVkUtils::Log() which writes to logcat on Android, and stdout everywhere else. This also changes all std::cout writes to use the new utility method.
Finally, the code that tries to create a Vulkan android surface was neglecting to check if the operation succeeded. It wrote the result code to stdout, but assumed success. It now checks and aborts if the creation failed.
Change-Id: I9c731a3363227e3fc14289445f112526e1882689