From c41b93bda5328ce13faf7048dfd38708e6486b6a Mon Sep 17 00:00:00 2001 From: Peter Kim Date: Sat, 24 Jul 2021 00:11:22 +0900 Subject: XR: Fix for Viewport Denoising Artifacts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Addresses T76003. When using VR with Eevee and viewport denoising, scene geometry could sometimes be occluded for one eye. Solution is to use a separate GPUViewport/GPUOffscreen for each VR view instead of reusing a single one for rendering. Reviewed By: Julian Eisel, Clément Foucault Differential Revision: http://developer.blender.org/D11858 --- intern/ghost/GHOST_Types.h | 4 ++++ intern/ghost/intern/GHOST_XrSession.cpp | 4 ++++ intern/ghost/intern/GHOST_XrSession.h | 1 + 3 files changed, 9 insertions(+) (limited to 'intern') diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h index ff93de4f203..ddebfa7e816 100644 --- a/intern/ghost/GHOST_Types.h +++ b/intern/ghost/GHOST_Types.h @@ -683,6 +683,10 @@ typedef struct GHOST_XrDrawViewInfo { /** Set if the buffer should be submitted with a SRGB transfer applied. */ char expects_srgb_buffer; + + /** The view that this info represents. Not necessarily the "eye index" (e.g. for quad view + * systems, etc). */ + char view_idx; } GHOST_XrDrawViewInfo; typedef struct GHOST_XrError { diff --git a/intern/ghost/intern/GHOST_XrSession.cpp b/intern/ghost/intern/GHOST_XrSession.cpp index 263b2b6cfbd..6140b2aab46 100644 --- a/intern/ghost/intern/GHOST_XrSession.cpp +++ b/intern/ghost/intern/GHOST_XrSession.cpp @@ -409,6 +409,7 @@ void GHOST_XrSession::drawView(GHOST_XrSwapchain &swapchain, XrCompositionLayerProjectionView &r_proj_layer_view, XrSpaceLocation &view_location, XrView &view, + uint32_t view_idx, void *draw_customdata) { XrSwapchainImageBaseHeader *swapchain_image = swapchain.acquireDrawableSwapchainImage(); @@ -419,6 +420,8 @@ void GHOST_XrSession::drawView(GHOST_XrSwapchain &swapchain, r_proj_layer_view.fov = view.fov; swapchain.updateCompositionLayerProjectViewSubImage(r_proj_layer_view.subImage); + assert(view_idx < 256); + draw_view_info.view_idx = (char)view_idx; draw_view_info.expects_srgb_buffer = swapchain.isBufferSRGB(); draw_view_info.ofsx = r_proj_layer_view.subImage.imageRect.offset.x; draw_view_info.ofsy = r_proj_layer_view.subImage.imageRect.offset.y; @@ -468,6 +471,7 @@ XrCompositionLayerProjection GHOST_XrSession::drawLayer( r_proj_layer_views[view_idx], view_location, m_oxr->views[view_idx], + view_idx, draw_customdata); } diff --git a/intern/ghost/intern/GHOST_XrSession.h b/intern/ghost/intern/GHOST_XrSession.h index c871b98da46..d448585d14c 100644 --- a/intern/ghost/intern/GHOST_XrSession.h +++ b/intern/ghost/intern/GHOST_XrSession.h @@ -117,6 +117,7 @@ class GHOST_XrSession { XrCompositionLayerProjectionView &r_proj_layer_view, XrSpaceLocation &view_location, XrView &view, + uint32_t view_idx, void *draw_customdata); void beginFrameDrawing(); void endFrameDrawing(std::vector &layers); -- cgit v1.2.3