From 1c4968a873a25b30d7d7b96ef921eab5369a1f00 Mon Sep 17 00:00:00 2001 From: Robert Beckebans Date: Sat, 7 May 2022 18:57:25 +0200 Subject: [PATCH] Compile shaders to renderprogs2, removed motion_vectors.*.hlsl --- neo/renderer/NVRHI/RenderProgs_NVRHI.cpp | 4 +- neo/shaders/CMakeLists.txt | 2 +- .../builtin/post/motion_vectors.ps.hlsl | 102 ------------------ .../builtin/post/motion_vectors.vs.hlsl | 33 ------ neo/shaders/shaders.cfg | 2 - 5 files changed, 3 insertions(+), 140 deletions(-) delete mode 100644 neo/shaders/builtin/post/motion_vectors.ps.hlsl delete mode 100644 neo/shaders/builtin/post/motion_vectors.vs.hlsl diff --git a/neo/renderer/NVRHI/RenderProgs_NVRHI.cpp b/neo/renderer/NVRHI/RenderProgs_NVRHI.cpp index 1d5838ad..f9136a1c 100644 --- a/neo/renderer/NVRHI/RenderProgs_NVRHI.cpp +++ b/neo/renderer/NVRHI/RenderProgs_NVRHI.cpp @@ -121,11 +121,11 @@ void idRenderProgManager::LoadShader( shader_t& shader ) adjustedName.StripFileExtension(); if( deviceManager->GetGraphicsAPI() == nvrhi::GraphicsAPI::D3D12 ) { - adjustedName = idStr( "renderprogs/dxil/" ) + adjustedName + "." + stage + ".bin"; + adjustedName = idStr( "renderprogs2/dxil/" ) + adjustedName + "." + stage + ".bin"; } else if( deviceManager->GetGraphicsAPI() == nvrhi::GraphicsAPI::VULKAN ) { - adjustedName = idStr( "renderprogs/spirv/" ) + adjustedName + "." + stage + ".bin"; + adjustedName = idStr( "renderprogs2/spirv/" ) + adjustedName + "." + stage + ".bin"; } else { diff --git a/neo/shaders/CMakeLists.txt b/neo/shaders/CMakeLists.txt index ae95651c..2b9551e5 100644 --- a/neo/shaders/CMakeLists.txt +++ b/neo/shaders/CMakeLists.txt @@ -34,7 +34,7 @@ source_group("user" FILES ${usershaders}) compile_shaders_all_platforms( TARGET Shaders CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/shaders.cfg - OUTPUT_BASE ${CMAKE_CURRENT_SOURCE_DIR}/../../base/renderprogs # This path scheme is a bit odd. + OUTPUT_BASE ${CMAKE_CURRENT_SOURCE_DIR}/../../base/renderprogs2 # This path scheme is a bit odd. SHADER_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} SOURCES ${shaders} ) \ No newline at end of file diff --git a/neo/shaders/builtin/post/motion_vectors.ps.hlsl b/neo/shaders/builtin/post/motion_vectors.ps.hlsl deleted file mode 100644 index 388c9416..00000000 --- a/neo/shaders/builtin/post/motion_vectors.ps.hlsl +++ /dev/null @@ -1,102 +0,0 @@ -/* -* Copyright (c) 2014-2021, NVIDIA CORPORATION. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -* DEALINGS IN THE SOFTWARE. -*/ - -#pragma pack_matrix(row_major) - -//#include - -struct TemporalAntiAliasingConstants -{ - float4x4 reprojectionMatrix; - - float2 inputViewOrigin; - float2 inputViewSize; - - float2 outputViewOrigin; - float2 outputViewSize; - - float2 inputPixelOffset; - float2 outputTextureSizeInv; - - float2 inputOverOutputViewSize; - float2 outputOverInputViewSize; - - float clampingFactor; - float newFrameWeight; - float pqC; - float invPqC; - - uint stencilMask; -}; - -cbuffer c_TemporalAA : -register( b0 ) -{ - TemporalAntiAliasingConstants g_TemporalAA; -}; - -Texture2D t_GBufferDepth : -register( t0 ); -#if USE_STENCIL -Texture2D t_GBufferStencil : -register( t1 ); -#endif - -void main( - in float4 i_position : SV_Position, - in float2 i_uv : UV, - out float4 o_color : SV_Target0 -) -{ - o_color = 0; - -#if USE_STENCIL - uint stencil = t_GBufferStencil[i_position.xy].y; - if( ( stencil & g_TemporalAA.stencilMask ) == g_TemporalAA.stencilMask ) - { - discard; - } -#endif - float depth = t_GBufferDepth[i_position.xy].x; - - float4 clipPos; - clipPos.x = i_uv.x * 2 - 1; - clipPos.y = 1 - i_uv.y * 2; - clipPos.z = depth; - clipPos.w = 1; - - float4 prevClipPos = mul( clipPos, g_TemporalAA.reprojectionMatrix ); - - if( prevClipPos.w <= 0 ) - { - return; - } - - prevClipPos.xyz /= prevClipPos.w; - float2 prevUV; - prevUV.x = 0.5 + prevClipPos.x * 0.5; - prevUV.y = 0.5 - prevClipPos.y * 0.5; - - float2 prevWindowPos = prevUV * g_TemporalAA.inputViewSize + g_TemporalAA.inputViewOrigin; - - o_color.xy = prevWindowPos.xy - i_position.xy; -} diff --git a/neo/shaders/builtin/post/motion_vectors.vs.hlsl b/neo/shaders/builtin/post/motion_vectors.vs.hlsl deleted file mode 100644 index 00ba55bd..00000000 --- a/neo/shaders/builtin/post/motion_vectors.vs.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -/* -* Copyright (c) 2014-2021, NVIDIA CORPORATION. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -* DEALINGS IN THE SOFTWARE. -*/ - -void main( - in uint iVertex : SV_VertexID, - out float4 o_posClip : SV_Position, - out float2 o_uv : UV ) -{ - uint u = iVertex & 1; - uint v = ( iVertex >> 1 ) & 1; - - o_posClip = float4( float( u ) * 2 - 1, 1 - float( v ) * 2, QUAD_Z, 1 ); - o_uv = float2( u, v ); -} diff --git a/neo/shaders/shaders.cfg b/neo/shaders/shaders.cfg index 13fff71c..48515f2b 100644 --- a/neo/shaders/shaders.cfg +++ b/neo/shaders/shaders.cfg @@ -74,8 +74,6 @@ builtin/post/exposure.cs.hlsl -T cs_5_0 -D HISTOGRAM_BINS=256 builtin/post/histogram.cs.hlsl -T cs_5_0 -D HISTOGRAM_BINS=256 -D SOURCE_ARRAY={0,1} builtin/post/tonemapping.ps.hlsl -T ps_5_0 -D HISTOGRAM_BINS=256 -D SOURCE_ARRAY={0,1} -D QUAD_Z={0,1} builtin/post/tonemapping.vs.hlsl -T vs_5_0 -D HISTOGRAM_BINS=256 -D SOURCE_ARRAY={0,1} -D QUAD_Z={0,1} -builtin/post/motion_vectors.vs.hlsl -T vs_5_0 -D USE_STENCIL=0 -D QUAD_Z={0,1} -builtin/post/motion_vectors.ps.hlsl -T ps_5_0 -D USE_STENCIL=0 -D QUAD_Z={0,1} builtin/post/taa.cs.hlsl -T cs_5_0 -D SAMPLE_COUNT={1,2,4,8} -D USE_CATMULL_ROM_FILTER={0,1} builtin/SSAO/AmbientOcclusion_AO.vs.hlsl -T vs_5_0 -D BRIGHTPASS={0,1}