diff --git a/OgreMain/src/Compositor/Pass/OgreCompositorPass.cpp b/OgreMain/src/Compositor/Pass/OgreCompositorPass.cpp index d28cd88c422..4f0aeec037c 100644 --- a/OgreMain/src/Compositor/Pass/OgreCompositorPass.cpp +++ b/OgreMain/src/Compositor/Pass/OgreCompositorPass.cpp @@ -310,6 +310,21 @@ namespace Ogre rtv->preferDepthTexture, rtv->depthBufferFormat ); } + if( mDefinition->mSkipLoadStoreSemantics ) + { + // Set everything to dont_care since validation must not complain. + const size_t numColourEntries = renderPassDesc->getNumColourEntries(); + for( size_t i = 0u; i < numColourEntries; ++i ) + { + renderPassDesc->mColour[i].loadAction = LoadAction::DontCare; + renderPassDesc->mColour[i].storeAction = StoreAction::DontCare; + } + renderPassDesc->mDepth.loadAction = LoadAction::DontCare; + renderPassDesc->mDepth.storeAction = StoreAction::DontCare; + renderPassDesc->mStencil.loadAction = LoadAction::DontCare; + renderPassDesc->mStencil.storeAction = StoreAction::DontCare; + } + postRenderPassDescriptorSetup( renderPassDesc ); try diff --git a/Samples/2.0/ApiUsage/StereoRendering/StereoRendering.cpp b/Samples/2.0/ApiUsage/StereoRendering/StereoRendering.cpp index 5498cc4744f..aab3c61c901 100644 --- a/Samples/2.0/ApiUsage/StereoRendering/StereoRendering.cpp +++ b/Samples/2.0/ApiUsage/StereoRendering/StereoRendering.cpp @@ -105,6 +105,13 @@ namespace Demo return mEyeWorkspaces[0]; } + void initMiscParamsListener( Ogre::NameValuePairList ¶ms ) override + { + // This sample specifically REQUIRES the window's depth buffer contents to be preserved + // between multiple passes. Therefore we must disable it. + params["memoryless_depth_buffer"] = "No"; + } + public: StereoGraphicsSystem( GameState *gameState ) : GraphicsSystem( gameState ) {} }; diff --git a/Samples/2.0/Common/src/System/Desktop/UnitTesting.cpp b/Samples/2.0/Common/src/System/Desktop/UnitTesting.cpp index 21f3917b05d..c328c02ac9a 100644 --- a/Samples/2.0/Common/src/System/Desktop/UnitTesting.cpp +++ b/Samples/2.0/Common/src/System/Desktop/UnitTesting.cpp @@ -692,10 +692,10 @@ namespace Demo img.save( outputFolder + frameIdxStr + "RenderWindow_colour.png", 0u, texture->getNumMipmaps() ); - texture = renderWindow->getDepthBuffer(); + /*texture = renderWindow->getDepthBuffer(); img.convertFromTexture( texture, 0u, texture->getNumMipmaps() - 1u ); img.save( outputFolder + frameIdxStr + "RenderWindow_depth.exr", 0u, - texture->getNumMipmaps() ); + texture->getNumMipmaps() );*/ } Ogre::StringVector::const_iterator itor = diff --git a/Samples/Media/2.0/scripts/Compositors/Refractions.compositor b/Samples/Media/2.0/scripts/Compositors/Refractions.compositor index 435423b8e0d..6fdcad2bfdf 100644 --- a/Samples/Media/2.0/scripts/Compositors/Refractions.compositor +++ b/Samples/Media/2.0/scripts/Compositors/Refractions.compositor @@ -123,6 +123,11 @@ compositor_node RefractionsRefractionsNode pass render_quad { load { all dont_care } + store + { + depth dont_care + stencil dont_care + } material Ogre/Copy/4xFP32 input 0 rtt_final diff --git a/Samples/Media/2.0/scripts/Compositors/TutorialSky_Postprocess.compositor b/Samples/Media/2.0/scripts/Compositors/TutorialSky_Postprocess.compositor index 94fdd7c7e1f..ad21e39170a 100644 --- a/Samples/Media/2.0/scripts/Compositors/TutorialSky_Postprocess.compositor +++ b/Samples/Media/2.0/scripts/Compositors/TutorialSky_Postprocess.compositor @@ -12,6 +12,11 @@ compositor_node TutorialSky_PostprocessRenderingNode all clear clear_colour 0.2 0.4 0.6 1 } + store + { + depth dont_care + stencil dont_care + } overlays off rq_first 0 rq_last 2 @@ -22,6 +27,8 @@ compositor_node TutorialSky_PostprocessRenderingNode //Render sky after opaque stuff (performance optimization) pass render_quad { + skip_load_store_semantics true + quad_normals camera_direction material SkyPostprocess @@ -31,11 +38,37 @@ compositor_node TutorialSky_PostprocessRenderingNode //Render transparent stuff after sky pass render_scene { + skip_load_store_semantics true + overlays on rq_first 2 profiling_id "Transparents" } + + + // Render overlays. + pass render_scene + { + // We must set depth & stencil to dont_care because the + // Window's DepthBuffer is Memoryless by default and Overlays break the pass. + load + { + depth dont_care + stencil dont_care + } + store + { + depth dont_care + stencil dont_care + } + + overlays on + rq_first 254 + rq_last 255 + + profiling_id "Overlays" + } } } diff --git a/Samples/Media/2.0/scripts/Compositors/Tutorial_DynamicCubemap.compositor b/Samples/Media/2.0/scripts/Compositors/Tutorial_DynamicCubemap.compositor index fa39875baf9..4fa8f45cd90 100644 --- a/Samples/Media/2.0/scripts/Compositors/Tutorial_DynamicCubemap.compositor +++ b/Samples/Media/2.0/scripts/Compositors/Tutorial_DynamicCubemap.compositor @@ -127,18 +127,24 @@ compositor_node Tutorial_DynamicCubemapRenderingNode //Render sky (see TutorialSky_Postprocess) pass render_quad { - store - { - depth dont_care - stencil dont_care - } + skip_load_store_semantics true + quad_normals camera_direction material SkyPostprocess + + profiling_id "Sky" } //Render transparent stuff after sky pass render_scene { + // We must set depth & stencil to dont_care because the + // Window's DepthBuffer is Memoryless by default and Overlays break the pass. + load + { + depth dont_care + stencil dont_care + } store { depth dont_care diff --git a/Samples/Media/2.0/scripts/Compositors/Tutorial_ReconstructPosFromDepth.compositor b/Samples/Media/2.0/scripts/Compositors/Tutorial_ReconstructPosFromDepth.compositor index 7f39f1d4e65..f0766b572f5 100644 --- a/Samples/Media/2.0/scripts/Compositors/Tutorial_ReconstructPosFromDepth.compositor +++ b/Samples/Media/2.0/scripts/Compositors/Tutorial_ReconstructPosFromDepth.compositor @@ -39,7 +39,15 @@ compositor_node Tutorial_ReconstructPosFromDepthNode { load { - colour dont_care + colour dont_care + depth dont_care + stencil dont_care + } + + store + { + depth dont_care + stencil dont_care } material ReconstructPosFromDepth @@ -50,6 +58,13 @@ compositor_node Tutorial_ReconstructPosFromDepthNode pass render_scene { + // We must set depth & stencil to dont_care because the + // Window's DepthBuffer is Memoryless by default and Overlays break the pass. + load + { + depth dont_care + stencil dont_care + } store { depth dont_care diff --git a/Samples/Media/2.0/scripts/Compositors/Tutorial_Terrain.compositor b/Samples/Media/2.0/scripts/Compositors/Tutorial_Terrain.compositor index 54508caeea8..4fafc864cfe 100644 --- a/Samples/Media/2.0/scripts/Compositors/Tutorial_Terrain.compositor +++ b/Samples/Media/2.0/scripts/Compositors/Tutorial_Terrain.compositor @@ -4,11 +4,6 @@ compositor_node Tutorial_TerrainRenderingNode target rt_renderwindow { - pass clear - { - colour_value 0.2 0.4 0.6 1 - } - pass render_scene { load diff --git a/Samples/Media/2.0/scripts/Compositors/UvBaking.compositor b/Samples/Media/2.0/scripts/Compositors/UvBaking.compositor index 2ba43718cf5..9ecf26e9fae 100644 --- a/Samples/Media/2.0/scripts/Compositors/UvBaking.compositor +++ b/Samples/Media/2.0/scripts/Compositors/UvBaking.compositor @@ -116,6 +116,13 @@ compositor_node ShowBakingTextureNode pass render_scene { + // We must set depth & stencil to dont_care because the + // Window's DepthBuffer is Memoryless by default and Overlays break the pass. + load + { + depth dont_care + stencil dont_care + } store { depth dont_care diff --git a/Samples/Media/2.0/scripts/materials/Distortion/Distortion.compositor b/Samples/Media/2.0/scripts/materials/Distortion/Distortion.compositor index e105ab88ac6..e92b30d9e3c 100644 --- a/Samples/Media/2.0/scripts/materials/Distortion/Distortion.compositor +++ b/Samples/Media/2.0/scripts/materials/Distortion/Distortion.compositor @@ -62,6 +62,11 @@ compositor_node DistortionNode { all dont_care } + store + { + depth dont_care + stencil dont_care + } material Distortion/Quad input 0 rt_scene input 1 rt_distortion @@ -71,6 +76,19 @@ compositor_node DistortionNode { lod_update_list off + // We must set depth & stencil to dont_care because the + // Window's DepthBuffer is Memoryless by default and Overlays break the pass. + load + { + depth dont_care + stencil dont_care + } + store + { + depth dont_care + stencil dont_care + } + //Render Overlays overlays on rq_first 254 diff --git a/Samples/Media/2.0/scripts/materials/Postprocessing/Postprocessing.compositor b/Samples/Media/2.0/scripts/materials/Postprocessing/Postprocessing.compositor index 81548f4236d..7231ec5851e 100644 --- a/Samples/Media/2.0/scripts/materials/Postprocessing/Postprocessing.compositor +++ b/Samples/Media/2.0/scripts/materials/Postprocessing/Postprocessing.compositor @@ -521,6 +521,11 @@ compositor_node FinalComposition pass render_quad { load { all dont_care } + store + { + depth dont_care + stencil dont_care + } //Ignore the alpha channel material Ogre/Copy/4xFP32 input 0 rtN @@ -537,6 +542,19 @@ compositor_node FinalComposition // skip_load_store_semantics true + // We must set depth & stencil to dont_care because the + // Window's DepthBuffer is Memoryless by default and Overlays break the pass. + load + { + depth dont_care + stencil dont_care + } + store + { + depth dont_care + stencil dont_care + } + lod_update_list off //Render Overlays diff --git a/Samples/Media/2.0/scripts/materials/TutorialCompute01_UavTexture/Compute.compositor b/Samples/Media/2.0/scripts/materials/TutorialCompute01_UavTexture/Compute.compositor index 47aa1977d85..7168737ebc3 100644 --- a/Samples/Media/2.0/scripts/materials/TutorialCompute01_UavTexture/Compute.compositor +++ b/Samples/Media/2.0/scripts/materials/TutorialCompute01_UavTexture/Compute.compositor @@ -18,21 +18,38 @@ compositor_node TutorialComputeTest01_UavTextureRenderingNode target rt_renderwindow { - pass clear - { - colour_value 0.2 0.4 0.6 1 - } - //Compositor will issue the appropiate barriers because //it knows testTexture will be used as a texture. pass render_quad { + load + { + all dont_care + } + store + { + depth dont_care + stencil dont_care + } + material Ogre/Copy/4xFP32 input 0 testTexture } pass render_scene { + // We must set depth & stencil to dont_care because the + // Window's DepthBuffer is Memoryless by default and Overlays break the pass. + load + { + depth dont_care + stencil dont_care + } + store + { + depth dont_care + stencil dont_care + } overlays on } } diff --git a/Samples/Media/2.0/scripts/materials/TutorialCompute02_UavBuffer/Compute.compositor b/Samples/Media/2.0/scripts/materials/TutorialCompute02_UavBuffer/Compute.compositor index 3322934a4ff..6acc6bc0500 100644 --- a/Samples/Media/2.0/scripts/materials/TutorialCompute02_UavBuffer/Compute.compositor +++ b/Samples/Media/2.0/scripts/materials/TutorialCompute02_UavBuffer/Compute.compositor @@ -20,14 +20,19 @@ compositor_node TutorialComputeTest02_UavBufferRenderingNode target rt_renderwindow { - pass clear - { - colour_value 0.2 0.4 0.6 1 - } - //The bindings made by pass bind_uav PERSIST even after we're out of rt_renderwindow. pass bind_uav { + load + { + all dont_care + } + store + { + depth dont_care + stencil dont_care + } + starting_slot 1 uav_buffer 0 testBuffer read } @@ -36,12 +41,35 @@ compositor_node TutorialComputeTest02_UavBufferRenderingNode //it knows testTexture will be used as a texture. pass render_quad { + load + { + all dont_care + } + store + { + depth dont_care + stencil dont_care + } + material DrawFromUavBuffer uses_uav 0 read } pass render_scene { + // We must set depth & stencil to dont_care because the + // Window's DepthBuffer is Memoryless by default and Overlays break the pass. + load + { + depth dont_care + stencil dont_care + } + store + { + depth dont_care + stencil dont_care + } + overlays on } } diff --git a/Samples/Media/2.0/scripts/materials/Tutorial_SMAA/TutorialCompositorScript/Tutorial_SMAA.compositor b/Samples/Media/2.0/scripts/materials/Tutorial_SMAA/TutorialCompositorScript/Tutorial_SMAA.compositor index fec423a1000..b557fc4fdd3 100644 --- a/Samples/Media/2.0/scripts/materials/Tutorial_SMAA/TutorialCompositorScript/Tutorial_SMAA.compositor +++ b/Samples/Media/2.0/scripts/materials/Tutorial_SMAA/TutorialCompositorScript/Tutorial_SMAA.compositor @@ -37,12 +37,24 @@ compositor_node FinalComposition pass render_quad { load { all dont_care } + store + { + depth dont_care + stencil dont_care + } material Ogre/Copy/4xFP32 input 0 rtN } pass render_scene { + // We must set depth & stencil to dont_care because the + // Window's DepthBuffer is Memoryless by default and Overlays break the pass. + load + { + depth dont_care + stencil dont_care + } store { depth dont_care diff --git a/Samples/Media/2.0/scripts/materials/Tutorial_SSAO/SSAO_HS.compositor b/Samples/Media/2.0/scripts/materials/Tutorial_SSAO/SSAO_HS.compositor index 86d19a4dbef..53dc7820054 100644 --- a/Samples/Media/2.0/scripts/materials/Tutorial_SSAO/SSAO_HS.compositor +++ b/Samples/Media/2.0/scripts/materials/Tutorial_SSAO/SSAO_HS.compositor @@ -128,6 +128,11 @@ compositor_node SSAO_GenerationSSAO_and_Composite pass render_quad { load { all dont_care } + store + { + depth dont_care + stencil dont_care + } material SSAO/Apply input 0 blurTextureVertical input 1 RT0 @@ -135,6 +140,19 @@ compositor_node SSAO_GenerationSSAO_and_Composite pass render_scene { + // We must set depth & stencil to dont_care because the + // Window's DepthBuffer is Memoryless by default and Overlays break the pass. + load + { + depth dont_care + stencil dont_care + } + store + { + depth dont_care + stencil dont_care + } + lod_update_list off //Render Overlays diff --git a/Scripts/UnitTesting/ogreVk.cfg b/Scripts/UnitTesting/ogreVk.cfg index 7de02f25c88..71fddeed3f7 100644 --- a/Scripts/UnitTesting/ogreVk.cfg +++ b/Scripts/UnitTesting/ogreVk.cfg @@ -1,6 +1,7 @@ Render System=Vulkan Rendering Subsystem [Vulkan Rendering Subsystem] +Allow Memoryless RTT=Yes Device=(default) Display Frequency=N/A FSAA=1