Closed morallo closed 2 years ago
It means each time there is a change between 2D and 3D rendering. Well, technically now it may be called twice, one when XWA calls DirectDraw::SetDisplayMode (when first showing the loading screen, and when exiting a mission) and another one in the 2D overlay code inside Flip() (but only on the first frame of a new mode). I can correctly identify the different calls so we can control what is released/created at each call. But we probably need to adapt the buffer descriptors for all the buffers that are now "inheriting" from te backbuffer.
About other options... Maybe create a completely separate buffer for the 2D rendering with specific size, but that would require changes in the rendering code anyway.
What I'm trying to achieve is to have a correctly sized 2D buffer, that I can copy to the overlay and have a 4:3 aspect.
Now, the backbuffer size and aspect is determined by SteamVR resolution, even in 2D rendering mode. It made sense when we were projecting the 2D image with 3D headtracking, but now we just need to render to a texture and openVR takes care of putting it in the virtual world in the right place.
El dom., 9 ene. 2022 0:22, Leo Reyes @.***> escribió:
@.**** commented on this pull request.
"OnSizeChanged() is called each time"
I'm not sure what this means, but it's probably not a great idea to call OnSizeChanged() more frequently. There are a number of places in the code that assume that this method is only called when switching modes, plus there's a bunch of resource release and creation that happens here. What's the problem that you're trying to solve? Can we try a different approach?
— Reply to this email directly, view it on GitHub https://github.com/Prof-Butts/xwa_ddraw_d3d11/pull/56#pullrequestreview-847201947, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPMSLGTEMKKE5LUG5F6DHTUVDBLVANCNFSM5LQB4KOQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you authored the thread.Message ID: @.***>
Eventually I discarded the option to call OnsizeChanged() in each 2D to 3D change. What I did instead is to create a new texture buffer and render target view for the overlay, with the right size. In ResizeForSteamVR() the 2D content from _offScreenBuffer is copied to this new texture with the right size and aspect using a shader to render a full screen quad.
Known issues: the tech library and the briefings when there are 3D elements rendered is not displayed correctly. The aspect ratio and size of the crafts is not properly adjusted. Also, the "second 2D layer" elements (mouse cursor, navigation buttons) is not displayed in these cases.
Fixed the Tech Room and briefing 3D object aspect ratio. One known issue left: when displaying a 3D object in those situations, the 2nd layer of 2D image is not displayed. Maybe it has to do with the Z value for the 2nd layer? @Prof-Butts any tips on where to look?
The basics are working, and there are some improvements:
But there are a few things to fix: