-
Notifications
You must be signed in to change notification settings - Fork 442
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
tvOS fixups #934
tvOS fixups #934
Conversation
Looks like I missed splitting out |
Though not ideal, I believe we are stuck with this for the moment as vulkan-headers only exposes |
That's from the old, deprecated surface extension. Since tvOS is a new platform, we shouldn't even need to expose that extension. The new one, |
Thanks @cdavis5e! I switched over and things are making a lot more sense now. I finally got things wired up enough that I'm hitting actual bugs. Looks like |
I'm struggling to find where the values for |
FYI...I will be pushing a simulator PR tonight or tomorrow. For no extra charge, it includes some tvOS fixes I noticed and/or needed to patch in order to get the basics of tvOS working on the tvOS Simulator. That PR might impact what you need to include in this WIP PR. |
Wonderful. Please cc me on the PR if you don't mind. |
Will do. Just got some documentation updates to do...then I'll push it up. I just had a quick look at your changes. Looks like your focus is on other areas than what I worked on, so we shouldn't see any conflicts. |
My application is now getting past vulkan init and failing somewhere in the render pipeline:
|
Uh oh. Usually, that's because the command buffer got stuck waiting for something, either an |
I'm not sure. I do see this during boot:
I'm trying to use libmpv and libplacebo to render video, so there's quite a few moving pieces involved. What's the best way to get more details about where/what is getting stuck? |
Looking at #602 (comment), it seems the issue might be that I don't have |
I added |
Okay, it looks like some videos are rendering correctly! I should be able to figure out how the shaders for the one failing earlier is different from here! |
@billhollings This is good to merge whenever you get a chance. There are no conflicts with your other PR so should be fine to merge in any order. |
Actually hold on merge. I just found |
So it looks like I was able to add MoltenVK to libmpv fairly easily: mpv-player/mpv#7857 But libplacebo is trying to find a memory slab with
|
No. The memory type corresponding to |
I'm not sure why it doesn't. You're saying we should make this change? --- a/MoltenVK/MoltenVK/API/mvk_datatypes.h
+++ b/MoltenVK/MoltenVK/API/mvk_datatypes.h
@@ -443,7 +443,7 @@ static inline VkExtent3D mvkVkExtent3DFromMTLSize(MTLSize mtlSize) {
#define MVK_VK_MEMORY_TYPE_METAL_PRIVATE (VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)
/** Macro indicating the Vulkan memory type bits corresponding to Metal shared memory (host visible and coherent). */
-#define MVK_VK_MEMORY_TYPE_METAL_SHARED (VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT)
+#define MVK_VK_MEMORY_TYPE_METAL_SHARED (VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | VK_MEMORY_PROPERTY_HOST_CACHED_BIT)
/** Macro indicating the Vulkan memory type bits corresponding to Metal managed memory (host visible and non-coherent). */
#define MVK_VK_MEMORY_TYPE_METAL_MANAGED (VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_CACHED_BIT) |
I don't know. |
Is
In particular, the reference to uncached memory is always host coherent, but slower than cached memory doesn't seem to map well to the UMA that underlies So I think when I was reworking memory definitions with UMA in mind, I took it out, thinking that However, @cdavis5e 's observation that...
...sounds reasonable (although I still don't understand what's going on under the covers if Apple needs to distinguish Anyway...I'm fine with re-adding |
Thanks for the context. I'm not sure what the motivations in libplacebo were. I found this commit via git blame which last touched the flag: haasn/libplacebo@22d8002 It sounds like we all agree that the cached bit makes sense to add back. Would you prefer I do so on a new PR, or is it fine in this one? I'm struggling with a few more issues on tvOS, so this PR may sit open for a bit. |
I'm trying now to render 10bit HDR video. I would like to use |
Looks like I need the |
You might as well do it here, since you're well suited to test it, and we haven't had any other complaints about it yet.
If you are going to do so, please do this one as a separate PR...and include the other outstanding available surface formats in the process. BTW...I notice that doc says Or I can take care of this one (surface formats) in a separate PR if you prefer. |
The header looks like this:
I thought this meant it might be available, but when trying to use it I get an error:
|
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 changes to RGB10A2Unorm
and RGB10A2Uint
need to be modified.
I've opened #939 to fix the supported surface formats. |
I made a little bit progress with my HDR video rendering goal. First I figured out how to explicitly specify the
|
I just upgraded this Apple TV to tvOS 14.0 beta (18J5313t) and the video is now rendering with the correct colors! |
I guess then it was a bug, or a missing feature. Maybe we should avoid advertising the HDR color spaces unless we're on version |
At the moment, I am using a software decoder to decode these UHD video frames. libplacebo takes the decoded frame and uploads its pixel data into the Instead, I would ideally like to use VideoToolbox to do the decoding using hardware acceleration. That gives me a |
Currently, you can use @billhollings is working on an extension to be used with |
Thanks!
My understanding was that the loader is currently only used on macOS, so this technique may work for me on tvOS/iOS until the new It looks like libplacebo supports a number of other |
There appears to be quite a lot of code related to
This is the only outstanding issue left, and I'm not sure where exactly the bug lies. My uneducated guess is that its related to the SPIRV -> MSL conversions perhaps, especially since the same SPIRV is confirmed to be working on several other platforms. It's also interesting that it works on macOS in the simulators, but not on the actual devices. Here's what the corruption looks like: Only seems to happen at the beginning and end of the buffer. So perhaps some kind of alignment problem? |
@billhollings Please go ahead and merge this now. I'm probably going to step away from this project until later in the year, when tvOS 14 is released (and hopefully there's also some progress on the |
Okay. It looks good so far. Thanks for all the work so far on bringing tvOS to MoltenVK!
Definitely should be. But if not...there is always the existing |
Looks like I forgot to mark this scheme as shared.
I'm importing MoltenVK into another tvOS project now, and will leave this in WIP until I get things work in-case anything else was missed.
cc #912 #541