KhronosGroup / Vulkan-Samples

One stop solution for all Vulkan samples
Apache License 2.0
4.33k stars 647 forks source link

Samples appear different on iOS when VkClearValue::color value contains zero alpha #1121

Closed billhollings closed 2 months ago

billhollings commented 3 months ago

Many samples do not specify a value in VkClearValue::color[3], which leaves the alpha value for the clear color as 0.0.

For most platforms, this does not matter, but on iOS, the platform does honour the alpha value when blending the rendering onto the platform view. The result is that the background color for the sample displays whatever color the view is showing.

Unless it will somehow interfere with other platforms, I recommend that all samples should specify a value of 1.0 for the alpha value in VkClearValue.

I was going to introduce a PR for this, but I have no way of testing anything other than Apple platforms, and I did not want to introduce issues on other platforms, in case leaving alpha at 0.0 was intentional for some platforms.

SRSaunders commented 3 months ago

I have a pending fix for this which is simply to change the Global Tint to Default in the iOS Storyboard view controller pane within Xcode. This seems to fix the problem - it was bugging me too.

I plan to bundle the above fix with some other items mostly around iOS build configuration, iOS Simulator support (x86_64 and arm64), an imgui scaling fix for iOS, MoltenVK standalone builds for macOS & iOS (i.e. without the loader), and Xcode support for macOS builds. I am waiting for PR #1084 to be merged, as some of my changes depend on it.

billhollings commented 2 months ago

PR #1120 fixes this issue.

billhollings commented 2 months ago

I have a pending fix for this which is simply to change the Global Tint to Default in the iOS Storyboard view controller pane within Xcode. This seems to fix the problem - it was bugging me too.

We might be on parallel paths. 😉

I've updated #1120 so that it fixes this issue as well, plus an issue I found where the HUD overlay was being displayed WAY too big.

My involvement in these fixes was just to ensure that MoltenVK was not the culprit on them. Feel free to swap in any similar fixes you have, instead of using mine.