From 52d20500d7647e57cb43c376ef59f538594a7a4c Mon Sep 17 00:00:00 2001 From: Robert Beckebans Date: Sat, 12 Mar 2022 10:14:05 +0100 Subject: [PATCH] Outcommented unused renderpasses --- neo/renderer/BindingCache.cpp | 50 ++++------------------ neo/renderer/NVRHI/RenderBackend_NVRHI.cpp | 8 ++-- neo/renderer/Passes/FowardShadingPass.cpp | 4 ++ neo/renderer/Passes/FowardShadingPass.h | 2 + neo/renderer/Passes/GBufferFillPass.cpp | 4 ++ neo/renderer/Passes/GBufferFillPass.h | 4 ++ neo/renderer/Passes/GeometryPasses.cpp | 3 +- neo/renderer/Passes/GeometryPasses.h | 3 ++ neo/renderer/RenderBackend.h | 4 +- 9 files changed, 33 insertions(+), 49 deletions(-) diff --git a/neo/renderer/BindingCache.cpp b/neo/renderer/BindingCache.cpp index f8db7263..2be869cc 100644 --- a/neo/renderer/BindingCache.cpp +++ b/neo/renderer/BindingCache.cpp @@ -39,6 +39,7 @@ nvrhi::BindingSetHandle BindingCache::GetCachedBindingSet( const nvrhi::BindingS nvrhi::BindingSetHandle BindingCache::GetOrCreateBindingSet( const nvrhi::BindingSetDesc& desc, nvrhi::IBindingLayout* layout ) { +#if 1 size_t hash = 0; nvrhi::hash_combine( hash, desc ); nvrhi::hash_combine( hash, layout ); @@ -60,27 +61,6 @@ nvrhi::BindingSetHandle BindingCache::GetOrCreateBindingSet( const nvrhi::Bindin if( !result ) { - /* - mutex.Lock(); - - int entryIndex = bindingSets.Append( result ); - bindingHash.Add( hash, entryIndex ); - - nvrhi::BindingSetHandle& entry = bindingSets[entryIndex]; - - if( !entry ) - { - result = device->createBindingSet( desc, layout ); - entry = result; - } - else - { - result = entry; - } - - mutex.Unlock(); - */ - mutex.Lock(); result = device->createBindingSet( desc, layout ); @@ -97,6 +77,9 @@ nvrhi::BindingSetHandle BindingCache::GetOrCreateBindingSet( const nvrhi::Bindin } return result; +#else + return device->createBindingSet( desc, layout ); +#endif } void BindingCache::Clear() @@ -122,6 +105,7 @@ void SamplerCache::Clear() nvrhi::SamplerHandle SamplerCache::GetOrCreateSampler( nvrhi::SamplerDesc desc ) { +#if 1 size_t hash = std::hash {}( desc ); mutex.Lock(); @@ -141,27 +125,6 @@ nvrhi::SamplerHandle SamplerCache::GetOrCreateSampler( nvrhi::SamplerDesc desc ) if( !result ) { - /* - mutex.Lock(); - - int entryIndex = samplers.Append( result ); - samplerHash.Add( hash, entryIndex ); - - nvrhi::SamplerHandle& entry = samplers[entryIndex]; - - if( !entry ) - { - result = device->createSampler( desc ); - entry = result; - } - else - { - result = entry; - } - - mutex.Unlock(); - */ - mutex.Lock(); result = device->createSampler( desc ); @@ -178,4 +141,7 @@ nvrhi::SamplerHandle SamplerCache::GetOrCreateSampler( nvrhi::SamplerDesc desc ) } return result; +#else + return device->createSampler( desc ); +#endif } diff --git a/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp b/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp index a9c248b2..62218101 100644 --- a/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp +++ b/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp @@ -546,7 +546,7 @@ void idRenderBackend::Init() commonPasses.Init( deviceManager->GetDevice() ); hiZGenPass = nullptr; ssaoPass = nullptr; - fowardShadingPass.Init( deviceManager->GetDevice() ); + //fowardShadingPass.Init( deviceManager->GetDevice() ); tr.SetInitialized(); @@ -746,15 +746,15 @@ void idRenderBackend::DrawElementsWithCounters( const drawSurf_t* surf ) common->FatalError( "Invalid binding set %d\n", renderProgManager.BindingLayoutType() ); } - int bindingLayoutType = renderProgManager.BindingLayoutType(); - currentBindingSet = bindingCache.GetOrCreateBindingSet( bindingSetDesc, renderProgManager.BindingLayout() ); + //int bindingLayoutType = renderProgManager.BindingLayoutType(); + nvrhi::BindingSetHandle sourceBindingSet = bindingCache.GetOrCreateBindingSet( bindingSetDesc, renderProgManager.BindingLayout() ); renderProgManager.CommitConstantBuffer( commandList ); PipelineKey key{ glStateBits, renderProgManager.CurrentProgram(), viewDef->isMirror, depthBias, slopeScaleBias, currentFrameBuffer }; auto pipeline = pipelineCache.GetOrCreatePipeline( key ); nvrhi::GraphicsState state; - state.bindings = { currentBindingSet }; + state.bindings = { sourceBindingSet }; state.indexBuffer = { currentIndexBuffer, nvrhi::Format::R16_UINT, indexOffset }; state.vertexBuffers = { { currentVertexBuffer, 0, vertOffset } }; state.pipeline = pipeline; diff --git a/neo/renderer/Passes/FowardShadingPass.cpp b/neo/renderer/Passes/FowardShadingPass.cpp index 8e3ff63d..a47364c6 100644 --- a/neo/renderer/Passes/FowardShadingPass.cpp +++ b/neo/renderer/Passes/FowardShadingPass.cpp @@ -34,6 +34,8 @@ If you have questions concerning this license or the applicable additional terms #include "FowardShadingPass.h" +#if 0 + /* same as D3DXMatrixOrthoOffCenterRH @@ -853,3 +855,5 @@ void ForwardShadingPass::SetupInputBuffers( const drawSurf_t* surf, nvrhi::Graph void ForwardShadingPass::SetPushConstants( nvrhi::ICommandList* commandList, nvrhi::GraphicsState& state, nvrhi::DrawArguments& args ) { } + +#endif \ No newline at end of file diff --git a/neo/renderer/Passes/FowardShadingPass.h b/neo/renderer/Passes/FowardShadingPass.h index f4e73b83..aad03052 100644 --- a/neo/renderer/Passes/FowardShadingPass.h +++ b/neo/renderer/Passes/FowardShadingPass.h @@ -30,6 +30,7 @@ If you have questions concerning this license or the applicable additional terms #include "GeometryPasses.h" +#if 0 class ForwardShadingPass : IGeometryPass { public: @@ -64,5 +65,6 @@ private: idRenderMatrix shadowV[6]; // shadow depth view matrix idRenderMatrix shadowP[6]; // shadow depth projection matrix }; +#endif #endif \ No newline at end of file diff --git a/neo/renderer/Passes/GBufferFillPass.cpp b/neo/renderer/Passes/GBufferFillPass.cpp index ee072b66..108cc7a4 100644 --- a/neo/renderer/Passes/GBufferFillPass.cpp +++ b/neo/renderer/Passes/GBufferFillPass.cpp @@ -32,6 +32,8 @@ If you have questions concerning this license or the applicable additional terms #include "GBufferFillPass.h" +#if 0 + void GBufferFillPass::Init( nvrhi::DeviceHandle deviceHandle ) { } @@ -681,3 +683,5 @@ void GBufferFillPass::SetupInputBuffers( const drawSurf_t* drawSurf, nvrhi::Grap void GBufferFillPass::SetPushConstants( nvrhi::ICommandList* commandList, nvrhi::GraphicsState& state, nvrhi::DrawArguments& args ) { } + +#endif \ No newline at end of file diff --git a/neo/renderer/Passes/GBufferFillPass.h b/neo/renderer/Passes/GBufferFillPass.h index caca40cd..91c16d3b 100644 --- a/neo/renderer/Passes/GBufferFillPass.h +++ b/neo/renderer/Passes/GBufferFillPass.h @@ -30,6 +30,8 @@ If you have questions concerning this license or the applicable additional terms #include "GeometryPasses.h" +#if 0 + // "Light" G-Buffer that renders the normals of the geometry class GBufferFillPass : IGeometryPass { @@ -61,4 +63,6 @@ public: }; +#endif + #endif \ No newline at end of file diff --git a/neo/renderer/Passes/GeometryPasses.cpp b/neo/renderer/Passes/GeometryPasses.cpp index b53d77ac..168fef51 100644 --- a/neo/renderer/Passes/GeometryPasses.cpp +++ b/neo/renderer/Passes/GeometryPasses.cpp @@ -34,7 +34,7 @@ If you have questions concerning this license or the applicable additional terms #include "nvrhi/utils.h" - +#if 0 static ID_INLINE void SetVertexParm( renderParm_t rp, const float* value ) { renderProgManager.SetUniformValue( rp, value ); @@ -802,3 +802,4 @@ void IGeometryPass::GL_ClearDepthStencil( nvrhi::ICommandList* commandList ) { nvrhi::utils::ClearDepthStencilAttachment( commandList, currentFramebuffer->GetApiObject( ), depthClearValue, stencilClearValue ); } +#endif \ No newline at end of file diff --git a/neo/renderer/Passes/GeometryPasses.h b/neo/renderer/Passes/GeometryPasses.h index c1093e78..f075860b 100644 --- a/neo/renderer/Passes/GeometryPasses.h +++ b/neo/renderer/Passes/GeometryPasses.h @@ -31,6 +31,8 @@ If you have questions concerning this license or the applicable additional terms constexpr std::size_t MAX_IMAGE_PARMS = 16; +#if 0 + class IGeometryPass { public: @@ -92,5 +94,6 @@ protected: GL_Scissor( x, y, w, h ); } }; +#endif #endif \ No newline at end of file diff --git a/neo/renderer/RenderBackend.h b/neo/renderer/RenderBackend.h index 83996850..cf99ccf8 100644 --- a/neo/renderer/RenderBackend.h +++ b/neo/renderer/RenderBackend.h @@ -502,7 +502,7 @@ private: int currentVertexOffset; nvrhi::BufferHandle currentIndexBuffer; int currentIndexOffset; - nvrhi::BindingSetHandle currentBindingSet; + //nvrhi::BindingSetHandle currentBindingSet; nvrhi::BindingLayoutHandle currentBindingLayout; nvrhi::GraphicsPipelineHandle currentPipeline; nvrhi::RenderState currentRenderState; @@ -516,7 +516,7 @@ private: MipMapGenPass* hiZGenPass; TonemapPass toneMapPass; - ForwardShadingPass fowardShadingPass; + //ForwardShadingPass fowardShadingPass; BindingCache bindingCache; SamplerCache samplerCache;