-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Handle VR submit depth and pose in the windows/unix marshalling layer #7286
Conversation
05cec31
to
0a32968
Compare
@rbernon occurred to me that my pull requests might just be sitting because they aren't on the correct radars... 😄 |
else u_texture.handle = unwrap_texture_vkdata( (w_VRVulkanTextureData_t *)w_texture->handle, (u_VRVulkanTextureData_t *)u_vkdata ); | ||
/* We should maybe unwrap the vkdata but No Man Sky uses a garbage handle in its w_VRTextureDepthInfo_t, is this really used? */ | ||
u_texture.depth.handle = w_texture->depth.handle; | ||
/* No Man Sky uses a garbage handle in its w_VRTextureDepthInfo_t, is depth without pose really used? */ |
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.
What about that comment now? Is this something that was missing from the DXVK unwrap, or is it still garbage? If this is still garbage we can't safely access it.
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 is a good question. I don't have No Man Sky (No Man's Sky?) to test if it works or not. I did build build a redist
proton with these commits though that someone could test.
I can see a couple of options
- No Man Sky works, so we are good as is.
- Let the developers of No Man Sky know they are incorrectly using
Submit_TextureWithDepth
as they are not submitting with a depth texture so they fix it. - If it is possible to determine if the application is No Man Sky (an if on the SteamAppId or something?), make the unpack conditional on that.
- Don't unpack the just depth case.
This last one would still unpack Just pose or pose and depth (the two cases I am actually interested in), so, from my perspective, it would be okay. Although it does seem kind of wrong as it would then be broken for any other application that actually does use Submit_TextureWithDepth
properly.
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.
Okay, thanks for the clarifications. I'm not the original author here, so I'd rather keep it like it is unless it's fixed. I can probably test whether it is or not, just need to find time for that.
Thanks for the PR, it looks okay from a first quick glance. Though it might take a moment until it lands.
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.
No problem. Thanks very much for looking at it. 👍
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.
What about that comment now? Is this something that was missing from the DXVK unwrap, or is it still garbage? If this is still garbage we can't safely access it.
No Man's Sky is a Vulkan game, no dxvk unwrap is used. I think it still passes broken data here (at least we had seen that a few weeks ago I guess), and it is still not used by the compositor. I suppose only the first patch is needed for the games to work? I think we can leave that without unwrapping (with some warn maybe), but we can't unconditionally unwrap.
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.
What I am trying to say that you probably don't really need to pass depth texture anyhow. What I suppose is actually fixing the game is passing pose and handling the flag combination. Can you please check if the game works if instead of unwrapping depth texture you just pass the null handle it still works? I'd expect it so, and then we could get rid of most of the code in those patches, also avoiding breaking NMS on the way.
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.
On a separate note, are you checking this with Steam VR or some custom compositor?
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.
To give a bit more context, ValveSoftware/openvr#825 (depth texture used to be plainly ignored on SteamVR). That's why passing invalid data there doesn't break things, and why I am curious how actual texture unwrapping can change anything WRT the mentioned games.
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 particular application I was looking at was Revive. It is a dll that you inject into an Oculus application. It hooks the Oculus API calls and translates them to OpenVR calls instead. There is a fairly extensive list of titles that it works for.
Right now it just does Submit_TextureWithPose
. The author (@CrossVR) said
The flag is necessary to ensure stable reprojection. To closely align with the Oculus API Revive does its own pose prediction for each frame. The pose that was used to render the frame is then sent to the compositor to use for reprojection.
There is also a ENABLE_DEPTH_SUBMIT
define in the code that will cause it to do Submit_TextureWithDepth
too . Currently this isn't enabled by default. I don't know if it will be at some point or not. I figured I might as well do them all while I was at it though as the hard part was getting up to speed on the code, getting it accepted, etc., not doing the actual patch.
With regard to other possible titles, googling for fixme:vrclient:ivrcompositor_submit_dxvk Unhandled flags 0x8 (Submit_TextureWithPose
) gives reports that mention L.A. Noire: The VR Case Files and various VR mods (GTA5 VR, Red Dead Redemption 2 VR, CyberPunk 2077). Doing the same for flags 0x10 (Submit_TextureWithDepth
) and 0x18 (Submit_TextureWithPose | Submit_TextureWithDepth
) doesn't return any hits.
I am just using the Steam VR compositor. From what you are saying though, it even if Revive did do Submit_TextureWithDepth
at some point, unpacking wouldn't matter as it isn't used.
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.
Thanks!
So if I understand correctly, from what you are saying nothing really depends on actually unwrapping the textures. Also, as I noted, SteamVR seems to ignore depth texture anyway, doesn't matter whether the application passes that or not.
So could you please remove all the code related to actual texture unwrapping from PR and just handle flags and their combination, along with correctly passing the pose? Submit_TextureWithDepth and both pose in depth can be handled, you just don't need to actually mind the texture. That will remove the majority of most complicated and regression prone code from the MR. Then I'd look at the final version in more details for nits and we could get that in.
If SteamVR gets actual support for depth texture we might get back to correctly delivering the data, before that, even regardless of NMS, it doesn't make much sense to add effectively dead code which we can't even test.
On a slightly different note, would you happen to know if there is someone in particular I should CC on my ValveSoftware wine pull request. It just adds a missing case to the certificate handling code that is required for the Oculus runtime dll to authenticate. It has already been accepted in upstream wine and GE Proton, so it should be pretty non-controversial. |
Yeah, I can probably do that especially as it's upstream already. Sorry for the delay, I don't monitor PR here very closely. |
0a32968
to
6c3edc0
Compare
When called with CERT_NAME_ATTR_TYPE and pvTypePara=NULL, Windows did the first of email, CN, OU, or O while Wine just did email. (cherry picked from commit 01c69eb) Link: ValveSoftware/Proton#7286
(cherry picked from commit 554a23d) Link: ValveSoftware/Proton#7286
(cherry picked from commit 0065b24) Link: ValveSoftware/Proton#7286
f04eabc
to
c4e4205
Compare
67f07b9
to
4ae7d51
Compare
I believe that should be much more to your liking. If you want, I also have these commits that I could add
If you do, just let me know, and I will push again. |
If some apps are using (or might start using soon) Submit_TextureWithDepth, (Submit_TextureWithDepth | Submit_TextureWithPose) I think it is cleaner to do something like this in load_compositor_texture_dxvk() to clear the flag to Vulkan backend instead of passing undefined data (even though it currently ignores it):
Since VRTextureWithPoseAndDepth_t is inherited from VRTextureWithPose_t we don't have to mind input VRTextureWithPoseAndDepth_t layout. A couple of nits about the rest:
I'd rename pose to texture_with_pose.
Please don't change formatting here (before the patch the second line is aligned differently.
Spurious spaces here (after '(' and before ')').
You are assuming here that &state->texture.texture == &state->texture.pose.[texture] (i. e., that pose is inherited from texture). Which is technically correct but hard to read and a bit fragile. I know it is inconvenient to do strtaightforward with how it is currently done with returning texture by value from vrclient_translate_texture_dxvk. But I'd at least make it explicit, e. g., like *(w_VRTextureWithPose_t *)&state->texture.texture) = ... Or otherwise each time I look at such code I have to think of how that assignment to pose gets passed anywhere at all from here. |
c4e4205
to
3192d8b
Compare
This resolves a black HMD with the log message "fixme:vrclient:ivrcompositor_submit_dxvk Unhandled flags 0x8".
Don't bother passing as SteamVR compositor ignores depth textures.
Thanks very much for the feedback. I have made all the changes. One last thing I was wondering is, given your comment about preferring the cast for being more explicit, would you prefer me to replace
with just the larger pose types
and do explicit casts to the smaller types everywhere they are used? Basically, what I am thinking, is like the way things are done in unix_vrcompositor_manual.c. For example
|
bc18859
to
71cc0a9
Compare
This resolves a black HMD with the log message "fixme:vrclient:ivrcompositor_submit_dxvk Unhandled flags 0x8". Link: #7286
Don't bother passing as SteamVR compositor ignores depth textures. Link: #7286
71cc0a9
to
52dbfce
Compare
Thanks a lot! I've pushed that to Proton, it is now in Experimental [bleeding-edge] branch: https://github.com/ValveSoftware/Proton/commits/experimental-bleeding-edge-8.0-66940-20231204-p831858-w8b5ab8-d1b31aa-v04cad9 . From there it should trip to regular Experimental on the next Experimental release (unless some regression spotted) and then eventually to stable. If you think it worth cleaning up some stuff around shuffling those textures and are interested to proceed you are wellcome but I think in any case it is unrelated to the present PR and would be better to do and discuss in a separate. But one thing I'd start from is to stop returning texture by value from vrclient_translate_texture_dxvk(). If you open something like that, would you please ping me there? |
06967c6
to
8f4d9ec
Compare
Thank you very much! I can open a new pull request for the cleanup. I'll start with that return and just do one thing at a time. |
When called with CERT_NAME_ATTR_TYPE and pvTypePara=NULL, Windows did the first of email, CN, OU, or O while Wine just did email. (cherry picked from commit 01c69eb) Link: ValveSoftware/Proton#7286
(cherry picked from commit 554a23d) Link: ValveSoftware/Proton#7286
(cherry picked from commit 0065b24) Link: ValveSoftware/Proton#7286
This resolves a black HMD with the log message "fixme:vrclient:ivrcompositor_submit_dxvk Unhandled flags 0x8". Link: #7286
Don't bother passing as SteamVR compositor ignores depth textures. Link: #7286
This resolves a black HMD with the log message "fixme:vrclient:ivrcompositor_submit_dxvk Unhandled flags 0x8". Link: #7286
Don't bother passing as SteamVR compositor ignores depth textures. Link: #7286
Add support for the flags
Submit_TextureWithPose
and/orSubmit_TextureWithDepth
. This is required for LibreVR Revive to work and it should also close issue #4121, which apparently affects at least GTA V in VR and the Red Dead Redemption 2 VR mod.On the actual patch, I could push the
arrayLayers
andTransitionSurfaceLayout
bits intovrclient_translate_surface_dxvk
too as these operations are common to all calls tovrclient_translate_surface_dxvk
. It would be a bit more of a rewrite though, is I didn't want to go ahead and do it unless you actually wanted it. Maybe best to do that as a followup commit if you want it.As a side note, it would be great if you could accept my wine pull request too to solve the other missing piece for LibreVRRevive. It has already been accepted into upstream and GE Proton.