From 428fc40b23482a8ad5b297c107d20453db6a7805 Mon Sep 17 00:00:00 2001 From: Stephen Saunders Date: Wed, 4 Oct 2023 12:06:17 -0400 Subject: [PATCH 01/15] Divide large constant buffer into subsets and implement push constants for Vulkan and DX12 (cherry picked from commit 5320c573f1e380dd6970c4faaeb1ae0e5dcabc2c) --- neo/renderer/Material.cpp | 11 +- neo/renderer/NVRHI/RenderBackend_NVRHI.cpp | 134 ++--- neo/renderer/NVRHI/RenderProgs_NVRHI.cpp | 188 +++++- neo/renderer/Passes/SsaoPass.cpp | 15 +- .../Passes/TemporalAntiAliasingPass.cpp | 8 +- .../Passes/TemporalAntiAliasingPass.h | 9 +- neo/renderer/RenderBackend.cpp | 20 +- neo/renderer/RenderCommon.h | 35 ++ neo/renderer/RenderProgs.cpp | 548 +++++++++++++----- neo/renderer/RenderProgs.h | 93 ++- neo/shaders/CMakeLists.txt | 2 +- neo/shaders/bloodorb1_capture.ps.hlsl | 3 +- neo/shaders/bloodorb1_capture.vs.hlsl | 13 +- neo/shaders/bloodorb2_capture.ps.hlsl | 3 +- neo/shaders/bloodorb2_capture.vs.hlsl | 17 +- neo/shaders/bloodorb3_capture.ps.hlsl | 3 +- neo/shaders/bloodorb3_capture.vs.hlsl | 17 +- neo/shaders/bloodorb_draw.ps.hlsl | 3 +- neo/shaders/bloodorb_draw.vs.hlsl | 11 +- .../builtin/SSAO/AmbientOcclusion_AO.ps.hlsl | 22 +- .../builtin/SSAO/AmbientOcclusion_AO.vs.hlsl | 3 +- .../SSAO/AmbientOcclusion_blur.ps.hlsl | 21 +- .../SSAO/AmbientOcclusion_blur.vs.hlsl | 3 +- .../SSGI/DeepGBufferRadiosity_blur.ps.hlsl | 17 +- .../SSGI/DeepGBufferRadiosity_blur.vs.hlsl | 3 +- .../DeepGBufferRadiosity_radiosity.ps.hlsl | 15 +- .../DeepGBufferRadiosity_radiosity.vs.hlsl | 3 +- neo/shaders/builtin/VR/stereoDeGhost.ps.hlsl | 5 +- neo/shaders/builtin/VR/stereoDeGhost.vs.hlsl | 11 +- .../builtin/VR/stereoInterlace.ps.hlsl | 3 +- .../builtin/VR/stereoInterlace.vs.hlsl | 11 +- neo/shaders/builtin/VR/stereoWarp.ps.hlsl | 1 + neo/shaders/builtin/VR/stereoWarp.vs.hlsl | 11 +- neo/shaders/builtin/color.ps.hlsl | 5 +- neo/shaders/builtin/color.vs.hlsl | 19 +- .../builtin/debug/debug_shadowmap.ps.hlsl | 7 +- .../builtin/debug/debug_shadowmap.vs.hlsl | 31 +- neo/shaders/builtin/debug/lightgrid.ps.hlsl | 29 +- neo/shaders/builtin/debug/lightgrid.vs.hlsl | 25 +- neo/shaders/builtin/debug/octahedron.ps.hlsl | 7 +- neo/shaders/builtin/debug/octahedron.vs.hlsl | 13 +- neo/shaders/builtin/depth.ps.hlsl | 4 +- neo/shaders/builtin/depth.vs.hlsl | 20 +- neo/shaders/builtin/fog/blendLight.ps.hlsl | 3 +- neo/shaders/builtin/fog/blendLight.vs.hlsl | 33 +- neo/shaders/builtin/fog/fog.ps.hlsl | 3 +- neo/shaders/builtin/fog/fog.vs.hlsl | 33 +- neo/shaders/builtin/gbuffer.ps.hlsl | 3 +- neo/shaders/builtin/gbuffer.vs.hlsl | 35 +- neo/shaders/builtin/gui.ps.hlsl | 3 +- neo/shaders/builtin/gui.vs.hlsl | 9 +- .../builtin/legacy/bumpyenvironment.ps.hlsl | 1 + .../builtin/legacy/bumpyenvironment.vs.hlsl | 72 +-- .../builtin/legacy/environment.ps.hlsl | 1 + .../builtin/legacy/environment.vs.hlsl | 23 +- neo/shaders/builtin/legacy/skybox.ps.hlsl | 1 + neo/shaders/builtin/legacy/skybox.vs.hlsl | 13 +- neo/shaders/builtin/legacy/wobblesky.ps.hlsl | 1 + neo/shaders/builtin/legacy/wobblesky.vs.hlsl | 19 +- .../lighting/ambient_lightgrid_IBL.ps.hlsl | 57 +- .../lighting/ambient_lightgrid_IBL.vs.hlsl | 59 +- .../lighting/ambient_lighting_IBL.ps.hlsl | 43 +- .../lighting/ambient_lighting_IBL.vs.hlsl | 61 +- .../builtin/lighting/interaction.ps.hlsl | 11 +- .../builtin/lighting/interaction.vs.hlsl | 39 +- .../lighting/interactionAmbient.ps.hlsl | 5 +- .../lighting/interactionAmbient.vs.hlsl | 37 +- .../builtin/lighting/interactionSM.ps.hlsl | 59 +- .../builtin/lighting/interactionSM.vs.hlsl | 57 +- .../post/SMAA_blending_weight_calc.ps.hlsl | 1 + .../post/SMAA_blending_weight_calc.vs.hlsl | 3 +- .../builtin/post/SMAA_edge_detection.ps.hlsl | 1 + .../builtin/post/SMAA_edge_detection.vs.hlsl | 3 +- neo/shaders/builtin/post/SMAA_final.ps.hlsl | 1 + neo/shaders/builtin/post/SMAA_final.vs.hlsl | 3 +- .../builtin/post/hdr_glare_chromatic.ps.hlsl | 5 +- .../builtin/post/hdr_glare_chromatic.vs.hlsl | 11 +- neo/shaders/builtin/post/motionBlur.ps.hlsl | 13 +- neo/shaders/builtin/post/motionBlur.vs.hlsl | 5 +- neo/shaders/builtin/post/postprocess.ps.hlsl | 19 +- neo/shaders/builtin/post/postprocess.vs.hlsl | 3 +- neo/shaders/builtin/post/screen.ps.hlsl | 1 + neo/shaders/builtin/post/screen.vs.hlsl | 11 +- neo/shaders/builtin/post/tonemap.ps.hlsl | 17 +- neo/shaders/builtin/post/tonemap.vs.hlsl | 11 +- neo/shaders/builtin/texture.ps.hlsl | 9 +- neo/shaders/builtin/texture.vs.hlsl | 21 +- neo/shaders/builtin/texture_color.ps.hlsl | 3 +- neo/shaders/builtin/texture_color.vs.hlsl | 41 +- .../builtin/texture_color_texgen.ps.hlsl | 4 +- .../builtin/texture_color_texgen.vs.hlsl | 25 +- neo/shaders/builtin/vertex_color.ps.hlsl | 3 +- neo/shaders/builtin/vertex_color.vs.hlsl | 11 +- neo/shaders/builtin/video/bink.ps.hlsl | 3 +- neo/shaders/builtin/video/bink.vs.hlsl | 11 +- neo/shaders/builtin/video/bink_gui.ps.hlsl | 1 + neo/shaders/builtin/video/bink_gui.vs.hlsl | 9 +- neo/shaders/colorProcess.ps.hlsl | 1 + neo/shaders/colorProcess.vs.hlsl | 13 +- neo/shaders/enviroSuit.ps.hlsl | 1 + neo/shaders/enviroSuit.vs.hlsl | 13 +- neo/shaders/fogwithlights.ps.hlsl | 3 +- neo/shaders/fogwithlights.vs.hlsl | 13 +- neo/shaders/global_inc.hlsl | 14 +- neo/shaders/heatHazeWithMask.ps.hlsl | 3 +- neo/shaders/heatHazeWithMask.vs.hlsl | 13 +- neo/shaders/heatHazeWithMaskAndVertex.ps.hlsl | 3 +- neo/shaders/heatHazeWithMaskAndVertex.vs.hlsl | 13 +- neo/shaders/heathaze.ps.hlsl | 3 +- neo/shaders/heathaze.vs.hlsl | 13 +- neo/shaders/mattiascrt.ps.hlsl | 3 +- neo/shaders/mattiascrt.vs.hlsl | 6 +- neo/shaders/renderParmSet0.inc.hlsl | 58 ++ neo/shaders/renderParmSet1.inc.hlsl | 58 ++ neo/shaders/renderParmSet10.inc.hlsl | 91 +++ neo/shaders/renderParmSet2.inc.hlsl | 57 ++ neo/shaders/renderParmSet3.inc.hlsl | 70 +++ neo/shaders/renderParmSet4.inc.hlsl | 69 +++ neo/shaders/renderParmSet5.inc.hlsl | 69 +++ neo/shaders/renderParmSet6.inc.hlsl | 68 +++ neo/shaders/renderParmSet7.inc.hlsl | 73 +++ neo/shaders/renderParmSet8.inc.hlsl | 93 +++ neo/shaders/renderParmSet9.inc.hlsl | 74 +++ neo/shaders/shaders.cfg | 204 +++---- neo/shaders/skinning.inc.hlsl | 10 +- neo/shaders/vertbuffershaders.hlsl | 12 +- neo/shaders/vornoipattern.ps.hlsl | 3 +- neo/shaders/vornoipattern.vs.hlsl | 14 +- neo/sys/DeviceManager.h | 5 + neo/sys/DeviceManager_VK.cpp | 5 + 130 files changed, 2489 insertions(+), 1011 deletions(-) create mode 100644 neo/shaders/renderParmSet0.inc.hlsl create mode 100644 neo/shaders/renderParmSet1.inc.hlsl create mode 100644 neo/shaders/renderParmSet10.inc.hlsl create mode 100644 neo/shaders/renderParmSet2.inc.hlsl create mode 100644 neo/shaders/renderParmSet3.inc.hlsl create mode 100644 neo/shaders/renderParmSet4.inc.hlsl create mode 100644 neo/shaders/renderParmSet5.inc.hlsl create mode 100644 neo/shaders/renderParmSet6.inc.hlsl create mode 100644 neo/shaders/renderParmSet7.inc.hlsl create mode 100644 neo/shaders/renderParmSet8.inc.hlsl create mode 100644 neo/shaders/renderParmSet9.inc.hlsl diff --git a/neo/renderer/Material.cpp b/neo/renderer/Material.cpp index 2584eb33b9..925b11f19c 100644 --- a/neo/renderer/Material.cpp +++ b/neo/renderer/Material.cpp @@ -34,6 +34,8 @@ If you have questions concerning this license or the applicable additional terms #include "RenderCommon.h" +#include +extern DeviceManager* deviceManager; /* @@ -2144,11 +2146,14 @@ void idMaterial::ParseStage( idLexer& src, const textureRepeat_t trpDefault ) ss->conditionRegister = ParseExpression( src ); continue; } + + auto usePushConstants = deviceManager->m_DeviceParams.maxPushConstantSize >= renderProgManager.layoutAttributes[BINDING_LAYOUT_POST_PROCESS_INGAME].rpBufSize ? "1" : "0"; + if( !token.Icmp( "program" ) ) { if( src.ReadTokenOnLine( &token ) ) { - idList macros = { { "USE_GPU_SKINNING", "0" } }; + idList macros = { { "USE_GPU_SKINNING", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants } }; newStage.vertexProgram = renderProgManager.FindShader( token.c_str(), SHADER_STAGE_VERTEX, "", macros, false ); newStage.fragmentProgram = renderProgManager.FindShader( token.c_str(), SHADER_STAGE_FRAGMENT, "", macros, false ); } @@ -2158,7 +2163,7 @@ void idMaterial::ParseStage( idLexer& src, const textureRepeat_t trpDefault ) { if( src.ReadTokenOnLine( &token ) ) { - idList macros = { { "USE_GPU_SKINNING", "0" } }; + idList macros = { { "USE_GPU_SKINNING", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants } }; newStage.fragmentProgram = renderProgManager.FindShader( token.c_str(), SHADER_STAGE_FRAGMENT, "", macros, false ); } continue; @@ -2167,7 +2172,7 @@ void idMaterial::ParseStage( idLexer& src, const textureRepeat_t trpDefault ) { if( src.ReadTokenOnLine( &token ) ) { - idList macros = { { "USE_GPU_SKINNING", "0" } }; + idList macros = { { "USE_GPU_SKINNING", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants } }; newStage.vertexProgram = renderProgManager.FindShader( token.c_str(), SHADER_STAGE_VERTEX, "", macros, false ); } continue; diff --git a/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp b/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp index baf70f9088..9701a80aa0 100644 --- a/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp +++ b/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp @@ -448,7 +448,7 @@ void idRenderBackend::DrawElementsWithCounters( const drawSurf_t* surf, bool sha for( int i = 0; i < layouts->Num(); i++ ) { - if( !currentBindingSets[i] || *currentBindingSets[i]->getDesc() != pendingBindingSetDescs[bindingLayoutType][i] ) + if( !currentBindingSets[i] || *currentBindingSets[i]->getDesc() != pendingBindingSetDescs[bindingLayoutType][i] || bindingLayoutType != prevBindingLayoutType ) { currentBindingSets[i] = bindingCache.GetOrCreateBindingSet( pendingBindingSetDescs[bindingLayoutType][i], ( *layouts )[i] ); changeState = true; @@ -482,9 +482,17 @@ void idRenderBackend::DrawElementsWithCounters( const drawSurf_t* surf, bool sha { if( deviceManager->GetGraphicsAPI() == nvrhi::GraphicsAPI::VULKAN ) { - // Reset the graphics state if the constant buffer is written to since - // the render pass is ended for vulkan. setGraphicsState will - // reinstate the render pass. + // Reset the graphics state if push constants are enabled or + // the constant buffer is written to and the render pass is + // ended for vulkan. setGraphicsState will reinstate the + // render pass or set up for push constants. + changeState = true; + } + else if( renderProgManager.layoutAttributes[bindingLayoutType].pcEnabled ) + { + // Reset the graphics state if push constants are enabled and + // the uniforms or binding layout have changed for DX12. + // setGraphicsState will set up for push constants. changeState = true; } } @@ -524,6 +532,8 @@ void idRenderBackend::DrawElementsWithCounters( const drawSurf_t* surf, bool sha } commandList->setGraphicsState( state ); + + renderProgManager.CommitPushConstants( commandList, bindingLayoutType ); } // @@ -564,19 +574,24 @@ void idRenderBackend::GetCurrentBindingLayout( int type ) nvrhi::IBuffer* paramCb = renderProgManager.ConstantBuffer(); auto range = nvrhi::EntireBuffer; - if( type == BINDING_LAYOUT_DEFAULT ) + auto uniformsBindingSetItem = nvrhi::BindingSetItem::ConstantBuffer( 0, paramCb, range ); + if( deviceManager->m_DeviceParams.maxPushConstantSize >= renderProgManager.layoutAttributes[type].rpBufSize ) + { + uniformsBindingSetItem = nvrhi::BindingSetItem::PushConstants( 0, renderProgManager.layoutAttributes[type].rpBufSize ); + } + + if( type == BINDING_LAYOUT_DEFAULT || type == BINDING_LAYOUT_GBUFFER || type == BINDING_LAYOUT_TEXTURE || type == BINDING_LAYOUT_WOBBLESKY || type == BINDING_LAYOUT_SSGI || type == BINDING_LAYOUT_POST_PROCESS ) { if( desc[0].bindings.empty() ) { desc[0].bindings = { - nvrhi::BindingSetItem::ConstantBuffer( 0, paramCb, range ), + uniformsBindingSetItem }; } else { - desc[0].bindings[0].resourceHandle = paramCb; - desc[0].bindings[0].range = range; + desc[0].bindings[0] = uniformsBindingSetItem; } if( desc[1].bindings.empty() ) @@ -603,21 +618,20 @@ void idRenderBackend::GetCurrentBindingLayout( int type ) desc[2].bindings[0].resourceHandle = ( nvrhi::ISampler* )GetImageAt( 0 )->GetSampler( samplerCache ); } } - else if( type == BINDING_LAYOUT_DEFAULT_SKINNED ) + else if( type == BINDING_LAYOUT_DEFAULT_SKINNED || type == BINDING_LAYOUT_GBUFFER_SKINNED || type == BINDING_LAYOUT_TEXTURE_SKINNED || type == BINDING_LAYOUT_SSGI_SKINNED ) { if( desc[0].bindings.empty() ) { desc[0].bindings = { - nvrhi::BindingSetItem::ConstantBuffer( 0, paramCb, range ), + uniformsBindingSetItem, nvrhi::BindingSetItem::StructuredBuffer_SRV( 11, currentJointBuffer, nvrhi::Format::UNKNOWN, nvrhi::BufferRange( currentJointOffset, sizeof( idVec4 ) * numBoneMatrices ) ) }; } else { auto& bindings = desc[0].bindings; - bindings[0].resourceHandle = paramCb; - bindings[0].range = range; + bindings[0] = uniformsBindingSetItem; bindings[1].resourceHandle = currentJointBuffer; bindings[1].range = nvrhi::BufferRange{ currentJointOffset, sizeof( idVec4 )* numBoneMatrices }; } @@ -652,13 +666,12 @@ void idRenderBackend::GetCurrentBindingLayout( int type ) { desc[0].bindings = { - nvrhi::BindingSetItem::ConstantBuffer( 0, paramCb, range ), + uniformsBindingSetItem }; } else { - desc[0].bindings[0].resourceHandle = paramCb; - desc[0].bindings[0].range = range; + desc[0].bindings[0] = uniformsBindingSetItem; } } else if( type == BINDING_LAYOUT_CONSTANT_BUFFER_ONLY_SKINNED ) @@ -667,15 +680,14 @@ void idRenderBackend::GetCurrentBindingLayout( int type ) { desc[0].bindings = { - nvrhi::BindingSetItem::ConstantBuffer( 0, paramCb, range ), + uniformsBindingSetItem, nvrhi::BindingSetItem::StructuredBuffer_SRV( 11, currentJointBuffer, nvrhi::Format::UNKNOWN, nvrhi::BufferRange( currentJointOffset, sizeof( idVec4 ) * numBoneMatrices ) ) }; } else { auto& bindings = desc[0].bindings; - bindings[0].resourceHandle = paramCb; - bindings[0].range = range; + bindings[0] = uniformsBindingSetItem; bindings[1].resourceHandle = currentJointBuffer; bindings[1].range = nvrhi::BufferRange{ currentJointOffset, sizeof( idVec4 )* numBoneMatrices }; } @@ -686,13 +698,12 @@ void idRenderBackend::GetCurrentBindingLayout( int type ) { desc[0].bindings = { - nvrhi::BindingSetItem::ConstantBuffer( 0, paramCb, range ), + uniformsBindingSetItem }; } else { - desc[0].bindings[0].resourceHandle = paramCb; - desc[0].bindings[0].range = range; + desc[0].bindings[0] = uniformsBindingSetItem; } if( desc[1].bindings.empty() ) @@ -753,15 +764,14 @@ void idRenderBackend::GetCurrentBindingLayout( int type ) { desc[0].bindings = { - nvrhi::BindingSetItem::ConstantBuffer( 0, paramCb, range ), + uniformsBindingSetItem, nvrhi::BindingSetItem::StructuredBuffer_SRV( 11, currentJointBuffer, nvrhi::Format::UNKNOWN, nvrhi::BufferRange( currentJointOffset, sizeof( idVec4 ) * numBoneMatrices ) ) }; } else { auto& bindings = desc[0].bindings; - bindings[0].resourceHandle = paramCb; - bindings[0].range = range; + bindings[0] = uniformsBindingSetItem; bindings[1].resourceHandle = currentJointBuffer; bindings[1].range = nvrhi::BufferRange{ currentJointOffset, sizeof( idVec4 )* numBoneMatrices }; } @@ -824,7 +834,7 @@ void idRenderBackend::GetCurrentBindingLayout( int type ) { desc[0].bindings = { - nvrhi::BindingSetItem::ConstantBuffer( 0, paramCb, range ), + uniformsBindingSetItem, nvrhi::BindingSetItem::Texture_SRV( 0, ( nvrhi::ITexture* )GetImageAt( 0 )->GetTextureID() ), nvrhi::BindingSetItem::Texture_SRV( 1, ( nvrhi::ITexture* )GetImageAt( 1 )->GetTextureID() ), nvrhi::BindingSetItem::Texture_SRV( 2, ( nvrhi::ITexture* )GetImageAt( 2 )->GetTextureID() ) @@ -832,8 +842,7 @@ void idRenderBackend::GetCurrentBindingLayout( int type ) } else { - desc[0].bindings[0].resourceHandle = paramCb; - desc[0].bindings[0].range = range; + desc[0].bindings[0] = uniformsBindingSetItem; desc[0].bindings[1].resourceHandle = ( nvrhi::ITexture* )GetImageAt( 0 )->GetTextureID(); desc[0].bindings[2].resourceHandle = ( nvrhi::ITexture* )GetImageAt( 1 )->GetTextureID(); desc[0].bindings[3].resourceHandle = ( nvrhi::ITexture* )GetImageAt( 2 )->GetTextureID(); @@ -858,13 +867,12 @@ void idRenderBackend::GetCurrentBindingLayout( int type ) { desc[0].bindings = { - nvrhi::BindingSetItem::ConstantBuffer( 0, paramCb, range ), + uniformsBindingSetItem }; } else { - desc[0].bindings[0].resourceHandle = paramCb; - desc[0].bindings[0].range = range; + desc[0].bindings[0] = uniformsBindingSetItem; } // materials: 1 @@ -921,15 +929,14 @@ void idRenderBackend::GetCurrentBindingLayout( int type ) { desc[0].bindings = { - nvrhi::BindingSetItem::ConstantBuffer( 0, paramCb, range ), + uniformsBindingSetItem, nvrhi::BindingSetItem::StructuredBuffer_SRV( 11, currentJointBuffer, nvrhi::Format::UNKNOWN, nvrhi::BufferRange( currentJointOffset, sizeof( idVec4 ) * numBoneMatrices ) ) }; } else { auto& bindings = desc[0].bindings; - bindings[0].resourceHandle = paramCb; - bindings[0].range = range; + bindings[0] = uniformsBindingSetItem; bindings[1].resourceHandle = currentJointBuffer; bindings[1].range = nvrhi::BufferRange{ currentJointOffset, sizeof( idVec4 )* numBoneMatrices }; } @@ -988,13 +995,12 @@ void idRenderBackend::GetCurrentBindingLayout( int type ) { desc[0].bindings = { - nvrhi::BindingSetItem::ConstantBuffer( 0, paramCb, range ), + uniformsBindingSetItem }; } else { - desc[0].bindings[0].resourceHandle = paramCb; - desc[0].bindings[0].range = range; + desc[0].bindings[0] = uniformsBindingSetItem; } // materials: 1 @@ -1064,15 +1070,14 @@ void idRenderBackend::GetCurrentBindingLayout( int type ) { desc[0].bindings = { - nvrhi::BindingSetItem::ConstantBuffer( 0, paramCb, range ), + uniformsBindingSetItem, nvrhi::BindingSetItem::StructuredBuffer_SRV( 11, currentJointBuffer, nvrhi::Format::UNKNOWN, nvrhi::BufferRange( currentJointOffset, sizeof( idVec4 ) * numBoneMatrices ) ) }; } else { auto& bindings = desc[0].bindings; - bindings[0].resourceHandle = paramCb; - bindings[0].range = range; + bindings[0] = uniformsBindingSetItem; bindings[1].resourceHandle = currentJointBuffer; bindings[1].range = nvrhi::BufferRange{ currentJointOffset, sizeof( idVec4 )* numBoneMatrices }; } @@ -1143,13 +1148,12 @@ void idRenderBackend::GetCurrentBindingLayout( int type ) { desc[0].bindings = { - nvrhi::BindingSetItem::ConstantBuffer( 0, paramCb, range ), + uniformsBindingSetItem }; } else { - desc[0].bindings[0].resourceHandle = paramCb; - desc[0].bindings[0].range = range; + desc[0].bindings[0] = uniformsBindingSetItem; } if( desc[1].bindings.empty() ) @@ -1188,15 +1192,14 @@ void idRenderBackend::GetCurrentBindingLayout( int type ) { desc[0].bindings = { - nvrhi::BindingSetItem::ConstantBuffer( 0, paramCb, range ), + uniformsBindingSetItem, nvrhi::BindingSetItem::StructuredBuffer_SRV( 11, currentJointBuffer, nvrhi::Format::UNKNOWN, nvrhi::BufferRange( currentJointOffset, sizeof( idVec4 ) * numBoneMatrices ) ) }; } else { auto& bindings = desc[0].bindings; - bindings[0].resourceHandle = paramCb; - bindings[0].range = range; + bindings[0] = uniformsBindingSetItem; bindings[1].resourceHandle = currentJointBuffer; bindings[1].range = nvrhi::BufferRange{ currentJointOffset, sizeof( idVec4 )* numBoneMatrices }; } @@ -1237,13 +1240,12 @@ void idRenderBackend::GetCurrentBindingLayout( int type ) { desc[0].bindings = { - nvrhi::BindingSetItem::ConstantBuffer( 0, paramCb, range ), + uniformsBindingSetItem }; } else { - desc[0].bindings[0].resourceHandle = paramCb; - desc[0].bindings[0].range = range; + desc[0].bindings[0] = uniformsBindingSetItem; } if( desc[1].bindings.empty() ) @@ -1279,15 +1281,14 @@ void idRenderBackend::GetCurrentBindingLayout( int type ) { desc[0].bindings = { - nvrhi::BindingSetItem::ConstantBuffer( 0, paramCb, range ), + uniformsBindingSetItem, nvrhi::BindingSetItem::StructuredBuffer_SRV( 11, currentJointBuffer, nvrhi::Format::UNKNOWN, nvrhi::BufferRange( currentJointOffset, sizeof( idVec4 ) * numBoneMatrices ) ) }; } else { auto& bindings = desc[0].bindings; - bindings[0].resourceHandle = paramCb; - bindings[0].range = range; + bindings[0] = uniformsBindingSetItem; bindings[1].resourceHandle = currentJointBuffer; bindings[1].range = nvrhi::BufferRange{ currentJointOffset, sizeof( idVec4 )* numBoneMatrices }; } @@ -1325,7 +1326,7 @@ void idRenderBackend::GetCurrentBindingLayout( int type ) { desc[0].bindings = { - nvrhi::BindingSetItem::ConstantBuffer( 0, paramCb, range ), + uniformsBindingSetItem, nvrhi::BindingSetItem::Texture_SRV( 0, ( nvrhi::ITexture* )GetImageAt( 0 )->GetTextureID() ), nvrhi::BindingSetItem::Texture_SRV( 1, ( nvrhi::ITexture* )GetImageAt( 1 )->GetTextureID() ), nvrhi::BindingSetItem::Texture_SRV( 2, ( nvrhi::ITexture* )GetImageAt( 2 )->GetTextureID() ) @@ -1333,8 +1334,7 @@ void idRenderBackend::GetCurrentBindingLayout( int type ) } else { - desc[0].bindings[0].resourceHandle = paramCb; - desc[0].bindings[0].range = range; + desc[0].bindings[0] = uniformsBindingSetItem; desc[0].bindings[1].resourceHandle = ( nvrhi::ITexture* )GetImageAt( 0 )->GetTextureID(); desc[0].bindings[2].resourceHandle = ( nvrhi::ITexture* )GetImageAt( 1 )->GetTextureID(); desc[0].bindings[3].resourceHandle = ( nvrhi::ITexture* )GetImageAt( 2 )->GetTextureID(); @@ -1358,15 +1358,14 @@ void idRenderBackend::GetCurrentBindingLayout( int type ) { desc[0].bindings = { - nvrhi::BindingSetItem::ConstantBuffer( 0, paramCb, range ), + uniformsBindingSetItem, nvrhi::BindingSetItem::Texture_SRV( 0, ( nvrhi::ITexture* )GetImageAt( 0 )->GetTextureID() ), nvrhi::BindingSetItem::Texture_SRV( 1, ( nvrhi::ITexture* )GetImageAt( 1 )->GetTextureID() ) }; } else { - desc[0].bindings[0].resourceHandle = paramCb; - desc[0].bindings[0].range = range; + desc[0].bindings[0] = uniformsBindingSetItem; desc[0].bindings[1].resourceHandle = ( nvrhi::ITexture* )GetImageAt( 0 )->GetTextureID(); desc[0].bindings[2].resourceHandle = ( nvrhi::ITexture* )GetImageAt( 1 )->GetTextureID(); } @@ -1391,13 +1390,12 @@ void idRenderBackend::GetCurrentBindingLayout( int type ) { desc[0].bindings = { - nvrhi::BindingSetItem::ConstantBuffer( 0, paramCb, range ), + uniformsBindingSetItem }; } else { - desc[0].bindings[0].resourceHandle = paramCb; - desc[0].bindings[0].range = range; + desc[0].bindings[0] = uniformsBindingSetItem; } if( desc[1].bindings.empty() ) @@ -1433,16 +1431,14 @@ void idRenderBackend::GetCurrentBindingLayout( int type ) { desc[0].bindings = { - nvrhi::BindingSetItem::ConstantBuffer( 0, paramCb, range ), + uniformsBindingSetItem, nvrhi::BindingSetItem::StructuredBuffer_SRV( 11, currentJointBuffer, nvrhi::Format::UNKNOWN, nvrhi::BufferRange( currentJointOffset, sizeof( idVec4 ) * numBoneMatrices ) ) }; } else { auto& bindings = desc[0].bindings; - bindings[0].resourceHandle = paramCb; - bindings[0].range = range; - + bindings[0] = uniformsBindingSetItem; bindings[1].resourceHandle = currentJointBuffer; bindings[1].range = nvrhi::BufferRange{ currentJointOffset, sizeof( idVec4 )* numBoneMatrices }; } @@ -1480,7 +1476,7 @@ void idRenderBackend::GetCurrentBindingLayout( int type ) { desc[0].bindings = { - nvrhi::BindingSetItem::ConstantBuffer( 0, paramCb, range ), + uniformsBindingSetItem, nvrhi::BindingSetItem::Texture_SRV( 0, ( nvrhi::ITexture* )GetImageAt( 0 )->GetTextureID() ), nvrhi::BindingSetItem::Texture_SRV( 1, ( nvrhi::ITexture* )GetImageAt( 1 )->GetTextureID() ), nvrhi::BindingSetItem::Texture_SRV( 2, ( nvrhi::ITexture* )GetImageAt( 2 )->GetTextureID() ) @@ -1488,8 +1484,7 @@ void idRenderBackend::GetCurrentBindingLayout( int type ) } else { - desc[0].bindings[0].resourceHandle = paramCb; - desc[0].bindings[0].range = range; + desc[0].bindings[0] = uniformsBindingSetItem; desc[0].bindings[1].resourceHandle = ( nvrhi::ITexture* )GetImageAt( 0 )->GetTextureID(); desc[0].bindings[2].resourceHandle = ( nvrhi::ITexture* )GetImageAt( 1 )->GetTextureID(); desc[0].bindings[3].resourceHandle = ( nvrhi::ITexture* )GetImageAt( 2 )->GetTextureID(); @@ -1513,15 +1508,14 @@ void idRenderBackend::GetCurrentBindingLayout( int type ) { desc[0].bindings = { - nvrhi::BindingSetItem::ConstantBuffer( 0, paramCb, range ), + uniformsBindingSetItem, nvrhi::BindingSetItem::Texture_SRV( 0, ( nvrhi::ITexture* )GetImageAt( 0 )->GetTextureID() ), nvrhi::BindingSetItem::Texture_SRV( 1, ( nvrhi::ITexture* )GetImageAt( 1 )->GetTextureID() ) }; } else { - desc[0].bindings[0].resourceHandle = paramCb; - desc[0].bindings[0].range = range; + desc[0].bindings[0] = uniformsBindingSetItem; desc[0].bindings[1].resourceHandle = ( nvrhi::ITexture* )GetImageAt( 0 )->GetTextureID(); desc[0].bindings[2].resourceHandle = ( nvrhi::ITexture* )GetImageAt( 1 )->GetTextureID(); } diff --git a/neo/renderer/NVRHI/RenderProgs_NVRHI.cpp b/neo/renderer/NVRHI/RenderProgs_NVRHI.cpp index facf8069dd..531d127708 100644 --- a/neo/renderer/NVRHI/RenderProgs_NVRHI.cpp +++ b/neo/renderer/NVRHI/RenderProgs_NVRHI.cpp @@ -289,12 +289,26 @@ idRenderProgManager::SetUniformValue */ void idRenderProgManager::SetUniformValue( const renderParm_t rp, const float value[4] ) { + bool rpChanged = false; + for( int i = 0; i < 4; i++ ) { - uniforms[rp][i] = value[i]; + if( uniforms[rp][i] != value[i] ) + { + uniforms[rp][i] = value[i]; + rpChanged = true; + } } - uniformsChanged = true; + for( int i = 0; i < renderParmLayouts[rp].Num(); i++ ) + { + // SRS - set flag if uniforms changed or volatile constant buffer enabled for layout + int layout = renderParmLayouts[rp][i]; + if( rpChanged || !layoutAttributes[layout].cbStatic ) + { + uniformsChanged[layout] = true; + } + } } /* @@ -306,22 +320,184 @@ void idRenderProgManager::ZeroUniforms() { memset( uniforms.Ptr(), 0, uniforms.Allocated() ); - uniformsChanged = true; + for( int i = 0; i < NUM_BINDING_LAYOUTS; i++ ) + { + uniformsChanged[i] = true; + } +} + +/* +================================================================================================ +idRenderProgManager::SelectUniforms +================================================================================================ +*/ +void idRenderProgManager::SelectUniforms( renderParmSet_t* renderParmSet, int bindingLayoutType ) +{ + switch ( layoutAttributes[bindingLayoutType].rpSubSet ) + { + case renderParmSet0: + { + for( int i = 0; i < rpMinimalSet0.Num(); i++ ) + { + memcpy( &renderParmSet->minimalSet[i], &uniforms[rpMinimalSet0[i]], sizeof( idVec4 ) ); + } + break; + } + + case renderParmSet1: + { + for( int i = 0; i < rpMinimalSet1.Num(); i++ ) + { + memcpy( &renderParmSet->minimalSet[i], &uniforms[rpMinimalSet1[i]], sizeof( idVec4 ) ); + } + break; + } + + case renderParmSet2: + { + for( int i = 0; i < rpMinimalSet2.Num(); i++ ) + { + memcpy( &renderParmSet->minimalSet[i], &uniforms[rpMinimalSet2[i]], sizeof( idVec4 ) ); + } + break; + } + + case renderParmSet3: + { + for( int i = 0; i < rpNominalSet3.Num(); i++ ) + { + memcpy( &renderParmSet->nominalSet[i], &uniforms[rpNominalSet3[i]], sizeof( idVec4 ) ); + } + break; + } + + case renderParmSet4: + { + for( int i = 0; i < rpNominalSet4.Num(); i++ ) + { + memcpy( &renderParmSet->nominalSet[i], &uniforms[rpNominalSet4[i]], sizeof( idVec4 ) ); + } + break; + } + + case renderParmSet5: + { + for( int i = 0; i < rpNominalSet5.Num(); i++ ) + { + memcpy( &renderParmSet->nominalSet[i], &uniforms[rpNominalSet5[i]], sizeof( idVec4 ) ); + } + break; + } + + case renderParmSet6: + { + for( int i = 0; i < rpNominalSet6.Num(); i++ ) + { + memcpy( &renderParmSet->nominalSet[i], &uniforms[rpNominalSet6[i]], sizeof( idVec4 ) ); + } + break; + } + + case renderParmSet7: + { + for( int i = 0; i < rpNominalSet7.Num(); i++ ) + { + memcpy( &renderParmSet->nominalSet[i], &uniforms[rpNominalSet7[i]], sizeof( idVec4 ) ); + } + break; + } + + case renderParmSet8: + { + for( int i = 0; i < rpMaximalSet8.Num(); i++ ) + { + memcpy( &renderParmSet->maximalSet[i], &uniforms[rpMaximalSet8[i]], sizeof( idVec4 ) ); + } + break; + } + + case renderParmSet9: + { + for( int i = 0; i < rpMaximalSet9.Num(); i++ ) + { + memcpy( &renderParmSet->maximalSet[i], &uniforms[rpMaximalSet9[i]], sizeof( idVec4 ) ); + } + break; + } + + case renderParmSet10: + { + for( int i = 0; i < rpMaximalSet10.Num(); i++ ) + { + memcpy( &renderParmSet->maximalSet[i], &uniforms[rpMaximalSet10[i]], sizeof( idVec4 ) ); + } + break; + } + + case renderParmNullSet: + default: + { + common->FatalError( "No layout subset found for binding layout set %d\n", bindingLayoutType ); + } + } + + return; } // Only updates the constant buffer if it was updated at all bool idRenderProgManager::CommitConstantBuffer( nvrhi::ICommandList* commandList, bool bindingLayoutTypeChanged ) { + const int bindingLayoutType = BindingLayoutType(); + + // SRS - If push constants enabled, skip writing the constant buffer but return state change indicator + if( layoutAttributes[bindingLayoutType].pcEnabled ) + { + if( deviceManager->GetGraphicsAPI() == nvrhi::GraphicsAPI::VULKAN ) + { + // SRS - always return true to force writing of Vulkan push constants + return true; + } + else // DX12 + { + // SRS - return uniforms change status to control writing of DX12 root constants + return uniformsChanged[bindingLayoutType] || bindingLayoutTypeChanged; + } + } // RB: It would be better to NUM_BINDING_LAYOUTS uniformsChanged entrys but we don't know the current binding layout type when we set the uniforms. // The vkDoom3 backend even didn't bother with this and always fired the uniforms for each draw call. - if( uniformsChanged || bindingLayoutTypeChanged ) + // SRS - Implemented uniformsChanged detection at per-layout granularity + else if( uniformsChanged[bindingLayoutType] || bindingLayoutTypeChanged ) { - commandList->writeBuffer( constantBuffer[BindingLayoutType()], uniforms.Ptr(), uniforms.Allocated() ); + renderParmSet_t renderParmSet; + + SelectUniforms( &renderParmSet, bindingLayoutType ); - uniformsChanged = false; + commandList->writeBuffer( constantBuffer[bindingLayoutType], &renderParmSet, layoutAttributes[bindingLayoutType].rpBufSize ); + + for( int i = 0; i < NUM_BINDING_LAYOUTS; i++ ) + { + uniformsChanged[i] = false; + } return true; } return false; } + +void idRenderProgManager::CommitPushConstants( nvrhi::ICommandList* commandList, int bindingLayoutType ) +{ + if( layoutAttributes[bindingLayoutType].pcEnabled ) + { + renderParmSet_t renderParmSet; + + SelectUniforms( &renderParmSet, bindingLayoutType ); + + commandList->setPushConstants( &renderParmSet, layoutAttributes[bindingLayoutType].rpBufSize ); + + for( int i = 0; i < NUM_BINDING_LAYOUTS; i++ ) + { + uniformsChanged[i] = false; + } + } +} diff --git a/neo/renderer/Passes/SsaoPass.cpp b/neo/renderer/Passes/SsaoPass.cpp index 25b127e22b..eb7485a644 100644 --- a/neo/renderer/Passes/SsaoPass.cpp +++ b/neo/renderer/Passes/SsaoPass.cpp @@ -103,7 +103,7 @@ SsaoPass::SsaoPass( DeinterleaveBindings.visibility = nvrhi::ShaderType::Compute; DeinterleaveBindings.bindings = { - nvrhi::BindingLayoutItem::VolatileConstantBuffer( 0 ), + //nvrhi::BindingLayoutItem::VolatileConstantBuffer( 0 ), nvrhi::BindingLayoutItem::VolatileConstantBuffer( 1 ), nvrhi::BindingLayoutItem::Texture_SRV( 0 ), nvrhi::BindingLayoutItem::Texture_UAV( 0 ), @@ -131,7 +131,7 @@ SsaoPass::SsaoPass( ComputeBindings.visibility = nvrhi::ShaderType::Compute; ComputeBindings.bindings = { - nvrhi::BindingLayoutItem::VolatileConstantBuffer( 0 ), + //nvrhi::BindingLayoutItem::VolatileConstantBuffer( 0 ), nvrhi::BindingLayoutItem::VolatileConstantBuffer( 1 ), nvrhi::BindingLayoutItem::Texture_SRV( 0 ), nvrhi::BindingLayoutItem::Texture_SRV( 1 ), @@ -159,7 +159,7 @@ SsaoPass::SsaoPass( BlurBindings.visibility = nvrhi::ShaderType::Compute; BlurBindings.bindings = { - nvrhi::BindingLayoutItem::VolatileConstantBuffer( 0 ), + //nvrhi::BindingLayoutItem::VolatileConstantBuffer( 0 ), nvrhi::BindingLayoutItem::VolatileConstantBuffer( 1 ), nvrhi::BindingLayoutItem::Texture_SRV( 0 ), nvrhi::BindingLayoutItem::Texture_SRV( 1 ), @@ -204,7 +204,7 @@ void SsaoPass::CreateBindingSet( nvrhi::BindingSetDesc DeinterleaveBindings; DeinterleaveBindings.bindings = { - nvrhi::BindingSetItem::ConstantBuffer( 0, renderProgManager.ConstantBuffer() ), + //nvrhi::BindingSetItem::ConstantBuffer( 0, renderProgManager.ConstantBuffer() ), nvrhi::BindingSetItem::ConstantBuffer( 1, m_ConstantBuffer ), nvrhi::BindingSetItem::Texture_SRV( 0, gbufferDepth ), nvrhi::BindingSetItem::Texture_UAV( 0, m_DeinterleavedDepth ) @@ -214,7 +214,7 @@ void SsaoPass::CreateBindingSet( nvrhi::BindingSetDesc ComputeBindings; ComputeBindings.bindings = { - nvrhi::BindingSetItem::ConstantBuffer( 0, renderProgManager.ConstantBuffer() ), + //nvrhi::BindingSetItem::ConstantBuffer( 0, renderProgManager.ConstantBuffer() ), nvrhi::BindingSetItem::ConstantBuffer( 1, m_ConstantBuffer ), nvrhi::BindingSetItem::Texture_SRV( 0, m_DeinterleavedDepth ), nvrhi::BindingSetItem::Texture_SRV( 1, gbufferNormals ), @@ -225,7 +225,7 @@ void SsaoPass::CreateBindingSet( nvrhi::BindingSetDesc BlurBindings; BlurBindings.bindings = { - nvrhi::BindingSetItem::ConstantBuffer( 0, renderProgManager.ConstantBuffer() ), + //nvrhi::BindingSetItem::ConstantBuffer( 0, renderProgManager.ConstantBuffer() ), nvrhi::BindingSetItem::ConstantBuffer( 1, m_ConstantBuffer ), nvrhi::BindingSetItem::Texture_SRV( 0, m_DeinterleavedDepth ), nvrhi::BindingSetItem::Texture_SRV( 1, m_DeinterleavedOcclusion ), @@ -256,7 +256,8 @@ void SsaoPass::Render( // TODO required and remove this by fixing the shaders renderProgManager.BindShader_TextureVertexColor(); - renderProgManager.CommitConstantBuffer( commandList, true ); + // SRS - global constant buffer no longer applicable (bindings commented out above) + //renderProgManager.CommitConstantBuffer( commandList, true ); SsaoConstants ssaoConstants = {}; ssaoConstants.viewportOrigin = idVec2( viewDef->viewport.x1, viewDef->viewport.y1 ); diff --git a/neo/renderer/Passes/TemporalAntiAliasingPass.cpp b/neo/renderer/Passes/TemporalAntiAliasingPass.cpp index 1770855470..27e735679e 100644 --- a/neo/renderer/Passes/TemporalAntiAliasingPass.cpp +++ b/neo/renderer/Passes/TemporalAntiAliasingPass.cpp @@ -88,8 +88,9 @@ void TemporalAntiAliasingPass::Init( //MotionVectorMacros.push_back( ShaderMacro( "USE_STENCIL", useStencil ? "1" : "0" ) ); //m_MotionVectorPS = shaderFactory->CreateShader( "donut/passes/motion_vectors_ps.hlsl", "main", &MotionVectorMacros, nvrhi::ShaderType::Pixel ); - auto taaMotionVectorsShaderInfo = renderProgManager.GetProgramInfo( BUILTIN_TAA_MOTION_VECTORS ); - m_MotionVectorPS = taaMotionVectorsShaderInfo.ps; + // SRS - Motion Vectors are generated using motionBlur shader in graphics pipeline + //auto taaMotionVectorsShaderInfo = renderProgManager.GetProgramInfo( BUILTIN_TAA_MOTION_VECTORS ); + //m_MotionVectorPS = taaMotionVectorsShaderInfo.ps; //std::vector ResolveMacros; //ResolveMacros.push_back( ShaderMacro( "SAMPLE_COUNT", std::to_string( unresolvedColorDesc.sampleCount ) ) ); @@ -141,6 +142,7 @@ void TemporalAntiAliasingPass::Init( constantBufferDesc.maxVersions = params.numConstantBufferVersions; m_TemporalAntiAliasingCB = device->createBuffer( constantBufferDesc ); +/* SRS - Motion Vectors are generated using motionBlur shader in graphics pipeline if( params.sourceDepth ) { nvrhi::BindingLayoutDesc layoutDesc; @@ -170,7 +172,7 @@ void TemporalAntiAliasingPass::Init( } m_MotionVectorsBindingSet = device->createBindingSet( bindingSetDesc, m_MotionVectorsBindingLayout ); } - +*/ { nvrhi::BindingSetDesc bindingSetDesc; bindingSetDesc.bindings = diff --git a/neo/renderer/Passes/TemporalAntiAliasingPass.h b/neo/renderer/Passes/TemporalAntiAliasingPass.h index 0811459d51..4f09f0ea7c 100644 --- a/neo/renderer/Passes/TemporalAntiAliasingPass.h +++ b/neo/renderer/Passes/TemporalAntiAliasingPass.h @@ -74,14 +74,15 @@ class TemporalAntiAliasingPass private: CommonRenderPasses* m_CommonPasses; - nvrhi::ShaderHandle m_MotionVectorPS; + //nvrhi::ShaderHandle m_MotionVectorPS; nvrhi::ShaderHandle m_TemporalAntiAliasingCS; nvrhi::SamplerHandle m_BilinearSampler; nvrhi::BufferHandle m_TemporalAntiAliasingCB; - nvrhi::BindingLayoutHandle m_MotionVectorsBindingLayout; - nvrhi::BindingSetHandle m_MotionVectorsBindingSet; - nvrhi::GraphicsPipelineHandle m_MotionVectorsPso; + // SRS - Motion Vectors are generated using motionBlur shader in graphics pipeline + //nvrhi::BindingLayoutHandle m_MotionVectorsBindingLayout; + //nvrhi::BindingSetHandle m_MotionVectorsBindingSet; + //nvrhi::GraphicsPipelineHandle m_MotionVectorsPso; nvrhi::BindingLayoutHandle m_ResolveBindingLayout; nvrhi::BindingSetHandle m_ResolveBindingSet; diff --git a/neo/renderer/RenderBackend.cpp b/neo/renderer/RenderBackend.cpp index 6095114593..51b405619f 100644 --- a/neo/renderer/RenderBackend.cpp +++ b/neo/renderer/RenderBackend.cpp @@ -743,7 +743,14 @@ void idRenderBackend::FillDepthBufferGeneric( const drawSurf_t* const* drawSurfs { if( shader->GetSort() == SS_SUBVIEW ) { - renderProgManager.BindShader_Color(); + if( drawSurf->jointCache ) + { + renderProgManager.BindShader_ColorSkinned(); + } + else + { + renderProgManager.BindShader_Color(); + } GL_Color( color ); GL_State( surfGLState ); } @@ -4366,6 +4373,15 @@ void idRenderBackend::T_BlendLight( const drawSurf_t* drawSurfs, const viewLight currentSpace = drawSurf->space; } + if( drawSurf->jointCache ) + { + renderProgManager.BindShader_BlendLightSkinned(); + } + else + { + renderProgManager.BindShader_BlendLight(); + } + DrawElementsWithCounters( drawSurf ); } } @@ -4400,8 +4416,6 @@ void idRenderBackend::BlendLight( const drawSurf_t* drawSurfs, const drawSurf_t* // texture 0 will get the projected texture GL_SelectTexture( 0 ); - renderProgManager.BindShader_BlendLight(); - for( int i = 0; i < lightShader->GetNumStages(); i++ ) { const shaderStage_t* stage = lightShader->GetStage( i ); diff --git a/neo/renderer/RenderCommon.h b/neo/renderer/RenderCommon.h index 3a9dbf2124..0cc57c5d57 100644 --- a/neo/renderer/RenderCommon.h +++ b/neo/renderer/RenderCommon.h @@ -824,6 +824,21 @@ enum bindingLayoutType_t BINDING_LAYOUT_DEFAULT, BINDING_LAYOUT_DEFAULT_SKINNED, + // SRS - new layouts for mapping renderparms to smaller constant buffer / push constant subsets + BINDING_LAYOUT_GBUFFER, + BINDING_LAYOUT_GBUFFER_SKINNED, + + BINDING_LAYOUT_TEXTURE, + BINDING_LAYOUT_TEXTURE_SKINNED, + + BINDING_LAYOUT_WOBBLESKY, + + BINDING_LAYOUT_SSGI, + BINDING_LAYOUT_SSGI_SKINNED, + + BINDING_LAYOUT_POST_PROCESS, + // SRS end + BINDING_LAYOUT_CONSTANT_BUFFER_ONLY, BINDING_LAYOUT_CONSTANT_BUFFER_ONLY_SKINNED, @@ -1698,6 +1713,26 @@ TR_BACKEND_DRAW ============================================================ */ +// SRS - Define renderparm subset sizes for push constants and smaller constant buffer entries + +typedef idVec4 rpMinimalSet[8]; // 128 bytes for minimal Vulkan push / DX12 root constant sizes +typedef idVec4 rpNominalSet[16]; // 256 bytes for nominal Vulkan push / DX12 root constant sizes +typedef idVec4 rpMaximalSet[64]; // 1024 bytes for larger sizes (e.g. 4096 limit on macOS MoltenVK) + +struct renderParmSet_t +{ + union + { + rpMinimalSet minimalSet; + rpNominalSet nominalSet; + rpMaximalSet maximalSet; + }; + + renderParmSet_t() : maximalSet{} + { + }; +}; + void RB_SetMVP( const idRenderMatrix& mvp ); /* diff --git a/neo/renderer/RenderProgs.cpp b/neo/renderer/RenderProgs.cpp index 2a70f60650..f807947495 100644 --- a/neo/renderer/RenderProgs.cpp +++ b/neo/renderer/RenderProgs.cpp @@ -69,6 +69,42 @@ static void R_ReloadShaders( const idCmdArgs& args ) renderProgManager.LoadAllShaders(); } +/* +================================================================================================ +uniformsLayout +================================================================================================ +*/ +nvrhi::BindingLayoutHandle idRenderProgManager::uniformsLayout( bindingLayoutType_t layout, bool skinning ) +{ + // SRS - Create initial layout item based on choice of static vs. volatile constant buffer + auto rpLayoutItem = layoutAttributes[layout].cbStatic ? nvrhi::BindingLayoutItem::ConstantBuffer( 0 ) : nvrhi::BindingLayoutItem::VolatileConstantBuffer( 0 ); + + // SRS - Optionally override based on renderparm subset size and push constant enablement + if( deviceManager->m_DeviceParams.maxPushConstantSize >= layoutAttributes[layout].rpBufSize ) + { + rpLayoutItem = nvrhi::BindingLayoutItem::PushConstants( 0, layoutAttributes[layout].rpBufSize ); + } + + // SRS - Create and return uniforms layout based on above choices and skinning enablement + if( skinning ) + { + auto skinningLayoutDesc = nvrhi::BindingLayoutDesc() + .setVisibility( nvrhi::ShaderType::All ) + .addItem( rpLayoutItem ) + .addItem( nvrhi::BindingLayoutItem::StructuredBuffer_SRV( 11 ) ); // joint buffer; + + return device->createBindingLayout( skinningLayoutDesc ); + } + else + { + auto uniformsLayoutDesc = nvrhi::BindingLayoutDesc() + .setVisibility( nvrhi::ShaderType::All ) + .addItem( rpLayoutItem ); + + return device->createBindingLayout( uniformsLayoutDesc ); + } +} + /* ================================================================================================ idRenderProgManager::Init() @@ -85,14 +121,7 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) this->device = device; - uniforms.SetNum( RENDERPARM_TOTAL, vec4_zero ); - uniformsChanged = false; - - for( int i = 0; i < NUM_BINDING_LAYOUTS; i++ ) - { - auto constantBufferDesc = nvrhi::utils::CreateVolatileConstantBufferDesc( uniforms.Allocated(), va( "RenderParams_%d", i ), 16384 ); - constantBuffer[i] = device->createBuffer( constantBufferDesc ); - } + ZeroUniforms(); // === Main draw vertex layout === vertexLayoutDescs.SetNum( NUM_VERTEX_LAYOUTS, {} ); @@ -163,37 +192,196 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) bindingLayouts.SetNum( NUM_BINDING_LAYOUTS ); - auto renderParmLayoutItem = nvrhi::BindingLayoutItem::VolatileConstantBuffer( 0 ); - - auto uniformsLayoutDesc = nvrhi::BindingLayoutDesc() - .setVisibility( nvrhi::ShaderType::All ) - .addItem( renderParmLayoutItem ); - - auto uniformsLayout = device->createBindingLayout( uniformsLayoutDesc ); + // SRS - Check to make sure renderparm subsets are within push constant size limits + if( rpMinimalSet0.Num() * sizeof( idVec4 ) > sizeof( rpMinimalSet ) || + rpMinimalSet1.Num() * sizeof( idVec4 ) > sizeof( rpMinimalSet ) || + rpMinimalSet2.Num() * sizeof( idVec4 ) > sizeof( rpMinimalSet ) || + rpNominalSet3.Num() * sizeof( idVec4 ) > sizeof( rpNominalSet ) || + rpNominalSet4.Num() * sizeof( idVec4 ) > sizeof( rpNominalSet ) || + rpNominalSet5.Num() * sizeof( idVec4 ) > sizeof( rpNominalSet ) || + rpNominalSet6.Num() * sizeof( idVec4 ) > sizeof( rpNominalSet ) || + rpNominalSet7.Num() * sizeof( idVec4 ) > sizeof( rpNominalSet ) || + rpMaximalSet8.Num() * sizeof( idVec4 ) > sizeof( rpMaximalSet ) || + rpMaximalSet9.Num() * sizeof( idVec4 ) > sizeof( rpMaximalSet ) || + rpMaximalSet10.Num() * sizeof( idVec4 ) > sizeof( rpMaximalSet ) ) + { + common->FatalError( "Renderparm subset sizes exceed push constant buffer sizes" ); + } - auto skinningLayoutDesc = nvrhi::BindingLayoutDesc() - .setVisibility( nvrhi::ShaderType::All ) - .addItem( renderParmLayoutItem ) - .addItem( nvrhi::BindingLayoutItem::StructuredBuffer_SRV( 11 ) ); // joint buffer; + for( int layout = 0; layout < NUM_BINDING_LAYOUTS; layout++ ) + { + // SRS - Define renderparm subset attributes for each binding layout type + if( rpMinimalSet0Layouts.Find( ( bindingLayoutType_t )layout ) ) + { + layoutAttributes[layout].rpSubSet = renderParmSet0; + layoutAttributes[layout].rpBufSize = rpMinimalSet0.Num() * sizeof( idVec4 ); + layoutAttributes[layout].cbStatic = false; + + // SRS - create renderparm to binding layouts mapping for efficient render-time lookups + for( int i = 0; i < rpMinimalSet0.Num(); i++ ) + { + renderParmLayouts[rpMinimalSet0[i]].Append( ( bindingLayoutType_t )layout ); + } + } + else if( rpMinimalSet1Layouts.Find( ( bindingLayoutType_t )layout ) ) + { + layoutAttributes[layout].rpSubSet = renderParmSet1; + layoutAttributes[layout].rpBufSize = rpMinimalSet1.Num() * sizeof( idVec4 ); + layoutAttributes[layout].cbStatic = true; + + // SRS - create renderparm to binding layouts mapping for efficient render-time lookups + for( int i = 0; i < rpMinimalSet1.Num(); i++ ) + { + renderParmLayouts[rpMinimalSet1[i]].Append( ( bindingLayoutType_t )layout ); + } + } + else if( rpMinimalSet2Layouts.Find( ( bindingLayoutType_t )layout ) ) + { + layoutAttributes[layout].rpSubSet = renderParmSet2; + layoutAttributes[layout].rpBufSize = rpMinimalSet2.Num() * sizeof( idVec4 ); + layoutAttributes[layout].cbStatic = true; + + // SRS - create renderparm to binding layouts mapping for efficient render-time lookups + for( int i = 0; i < rpMinimalSet2.Num(); i++ ) + { + renderParmLayouts[rpMinimalSet2[i]].Append( ( bindingLayoutType_t )layout ); + } + } + else if( rpNominalSet3Layouts.Find( ( bindingLayoutType_t )layout ) ) + { + layoutAttributes[layout].rpSubSet = renderParmSet3; + layoutAttributes[layout].rpBufSize = rpNominalSet3.Num() * sizeof( idVec4 ); + layoutAttributes[layout].cbStatic = false; + + // SRS - create renderparm to binding layouts mapping for efficient render-time lookups + for( int i = 0; i < rpNominalSet3.Num(); i++ ) + { + renderParmLayouts[rpNominalSet3[i]].Append( ( bindingLayoutType_t )layout ); + } + } + else if( rpNominalSet4Layouts.Find( ( bindingLayoutType_t )layout ) ) + { + layoutAttributes[layout].rpSubSet = renderParmSet4; + layoutAttributes[layout].rpBufSize = rpNominalSet4.Num() * sizeof( idVec4 ); + layoutAttributes[layout].cbStatic = false; + + // SRS - create renderparm to binding layouts mapping for efficient render-time lookups + for( int i = 0; i < rpNominalSet4.Num(); i++ ) + { + renderParmLayouts[rpNominalSet4[i]].Append( ( bindingLayoutType_t )layout ); + } + } + else if( rpNominalSet5Layouts.Find( ( bindingLayoutType_t )layout ) ) + { + layoutAttributes[layout].rpSubSet = renderParmSet5; + layoutAttributes[layout].rpBufSize = rpNominalSet5.Num() * sizeof( idVec4 ); + layoutAttributes[layout].cbStatic = false; + + // SRS - create renderparm to binding layouts mapping for efficient render-time lookups + for( int i = 0; i < rpNominalSet5.Num(); i++ ) + { + renderParmLayouts[rpNominalSet5[i]].Append( ( bindingLayoutType_t )layout ); + } + } + else if( rpNominalSet6Layouts.Find( ( bindingLayoutType_t )layout ) ) + { + layoutAttributes[layout].rpSubSet = renderParmSet6; + layoutAttributes[layout].rpBufSize = rpNominalSet6.Num() * sizeof( idVec4 ); + layoutAttributes[layout].cbStatic = false; + + // SRS - create renderparm to binding layouts mapping for efficient render-time lookups + for( int i = 0; i < rpNominalSet6.Num(); i++ ) + { + renderParmLayouts[rpNominalSet6[i]].Append( ( bindingLayoutType_t )layout ); + } + } + else if( rpNominalSet7Layouts.Find( ( bindingLayoutType_t )layout ) ) + { + layoutAttributes[layout].rpSubSet = renderParmSet7; + layoutAttributes[layout].rpBufSize = rpNominalSet7.Num() * sizeof( idVec4 ); + layoutAttributes[layout].cbStatic = false; + + // SRS - create renderparm to binding layouts mapping for efficient render-time lookups + for( int i = 0; i < rpNominalSet7.Num(); i++ ) + { + renderParmLayouts[rpNominalSet7[i]].Append( ( bindingLayoutType_t )layout ); + } + } + else if( rpMaximalSet8Layouts.Find( ( bindingLayoutType_t )layout ) ) + { + layoutAttributes[layout].rpSubSet = renderParmSet8; + layoutAttributes[layout].rpBufSize = rpMaximalSet8.Num() * sizeof( idVec4 ); + layoutAttributes[layout].cbStatic = true; + + // SRS - create renderparm to binding layouts mapping for efficient render-time lookups + for( int i = 0; i < rpMaximalSet8.Num(); i++ ) + { + renderParmLayouts[rpMaximalSet8[i]].Append( ( bindingLayoutType_t )layout ); + } + } + else if( rpMaximalSet9Layouts.Find( ( bindingLayoutType_t )layout ) ) + { + layoutAttributes[layout].rpSubSet = renderParmSet9; + layoutAttributes[layout].rpBufSize = rpMaximalSet9.Num() * sizeof( idVec4 ); + layoutAttributes[layout].cbStatic = true; + + // SRS - create renderparm to binding layouts mapping for efficient render-time lookups + for( int i = 0; i < rpMaximalSet9.Num(); i++ ) + { + renderParmLayouts[rpMaximalSet9[i]].Append( ( bindingLayoutType_t )layout ); + } + } + else if( rpMaximalSet10Layouts.Find( ( bindingLayoutType_t )layout ) ) + { + layoutAttributes[layout].rpSubSet = renderParmSet10; + layoutAttributes[layout].rpBufSize = rpMaximalSet10.Num() * sizeof( idVec4 ); + layoutAttributes[layout].cbStatic = true; + + // SRS - create renderparm to binding layouts mapping for efficient render-time lookups + for( int i = 0; i < rpMaximalSet10.Num(); i++ ) + { + renderParmLayouts[rpMaximalSet10[i]].Append( ( bindingLayoutType_t )layout ); + } + } + else + { + layoutAttributes[layout].rpSubSet = renderParmNullSet; + layoutAttributes[layout].rpBufSize = 0; + layoutAttributes[layout].cbStatic = false; + } - auto skinningLayout = device->createBindingLayout( skinningLayoutDesc ); + layoutAttributes[layout].pcEnabled = deviceManager->m_DeviceParams.maxPushConstantSize >= layoutAttributes[layout].rpBufSize; + } auto defaultLayoutDesc = nvrhi::BindingLayoutDesc() .setVisibility( nvrhi::ShaderType::Pixel ) .addItem( nvrhi::BindingLayoutItem::Texture_SRV( 0 ) ); + auto defaultLayout = device->createBindingLayout( defaultLayoutDesc ); + auto samplerOneLayoutDesc = nvrhi::BindingLayoutDesc() .setVisibility( nvrhi::ShaderType::Pixel ) .addItem( nvrhi::BindingLayoutItem::Sampler( 0 ) ); auto samplerOneBindingLayout = device->createBindingLayout( samplerOneLayoutDesc ); - auto defaultLayout = device->createBindingLayout( defaultLayoutDesc ); + bindingLayouts[BINDING_LAYOUT_DEFAULT] = { uniformsLayout( BINDING_LAYOUT_DEFAULT, false ), defaultLayout, samplerOneBindingLayout }; + bindingLayouts[BINDING_LAYOUT_DEFAULT_SKINNED] = { uniformsLayout( BINDING_LAYOUT_DEFAULT_SKINNED, true ), defaultLayout, samplerOneBindingLayout }; + + bindingLayouts[BINDING_LAYOUT_GBUFFER] = { uniformsLayout( BINDING_LAYOUT_GBUFFER, false ), defaultLayout, samplerOneBindingLayout }; + bindingLayouts[BINDING_LAYOUT_GBUFFER_SKINNED] = { uniformsLayout( BINDING_LAYOUT_GBUFFER_SKINNED, true ), defaultLayout, samplerOneBindingLayout }; + + bindingLayouts[BINDING_LAYOUT_TEXTURE] = { uniformsLayout( BINDING_LAYOUT_TEXTURE, false ), defaultLayout, samplerOneBindingLayout }; + bindingLayouts[BINDING_LAYOUT_TEXTURE_SKINNED] = { uniformsLayout( BINDING_LAYOUT_TEXTURE_SKINNED, true ), defaultLayout, samplerOneBindingLayout }; - bindingLayouts[BINDING_LAYOUT_DEFAULT] = { uniformsLayout, defaultLayout, samplerOneBindingLayout }; - bindingLayouts[BINDING_LAYOUT_DEFAULT_SKINNED] = { skinningLayout, defaultLayout, samplerOneBindingLayout }; + bindingLayouts[BINDING_LAYOUT_WOBBLESKY] = { uniformsLayout( BINDING_LAYOUT_WOBBLESKY, false ), defaultLayout, samplerOneBindingLayout }; - bindingLayouts[BINDING_LAYOUT_CONSTANT_BUFFER_ONLY] = { uniformsLayout }; - bindingLayouts[BINDING_LAYOUT_CONSTANT_BUFFER_ONLY_SKINNED] = { skinningLayout }; + bindingLayouts[BINDING_LAYOUT_SSGI] = { uniformsLayout( BINDING_LAYOUT_SSGI, false ), defaultLayout, samplerOneBindingLayout }; + bindingLayouts[BINDING_LAYOUT_SSGI_SKINNED] = { uniformsLayout( BINDING_LAYOUT_SSGI_SKINNED, true ), defaultLayout, samplerOneBindingLayout }; + + bindingLayouts[BINDING_LAYOUT_POST_PROCESS] = { uniformsLayout( BINDING_LAYOUT_POST_PROCESS, false ), defaultLayout, samplerOneBindingLayout }; + + bindingLayouts[BINDING_LAYOUT_CONSTANT_BUFFER_ONLY] = { uniformsLayout( BINDING_LAYOUT_CONSTANT_BUFFER_ONLY, false ) }; + bindingLayouts[BINDING_LAYOUT_CONSTANT_BUFFER_ONLY_SKINNED] = { uniformsLayout( BINDING_LAYOUT_CONSTANT_BUFFER_ONLY_SKINNED, true ) }; auto defaultMaterialLayoutDesc = nvrhi::BindingLayoutDesc() .setVisibility( nvrhi::ShaderType::Pixel ) @@ -220,13 +408,13 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) .addItem( nvrhi::BindingLayoutItem::Sampler( 1 ) ); // (Clamp) Linear sampler: brdf lut sampler & ssao sampler auto samplerTwoBindingLayout = device->createBindingLayout( samplerTwoBindingLayoutDesc ); - bindingLayouts[ BINDING_LAYOUT_AMBIENT_LIGHTING_IBL ] = + bindingLayouts[BINDING_LAYOUT_AMBIENT_LIGHTING_IBL] = { - uniformsLayout, defaultMaterialLayout, ambientIblLayout, samplerTwoBindingLayout + uniformsLayout( BINDING_LAYOUT_AMBIENT_LIGHTING_IBL, false ), defaultMaterialLayout, ambientIblLayout, samplerTwoBindingLayout }; - bindingLayouts[ BINDING_LAYOUT_AMBIENT_LIGHTING_IBL_SKINNED ] = + bindingLayouts[BINDING_LAYOUT_AMBIENT_LIGHTING_IBL_SKINNED] = { - skinningLayout, defaultMaterialLayout, ambientIblLayout, samplerTwoBindingLayout + uniformsLayout( BINDING_LAYOUT_AMBIENT_LIGHTING_IBL_SKINNED, true ), defaultMaterialLayout, ambientIblLayout, samplerTwoBindingLayout }; auto blitLayoutDesc = nvrhi::BindingLayoutDesc() @@ -235,9 +423,16 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) bindingLayouts[BINDING_LAYOUT_BLIT] = { device->createBindingLayout( blitLayoutDesc ) }; + auto aoLayoutItem = layoutAttributes[BINDING_LAYOUT_DRAW_AO].cbStatic ? nvrhi::BindingLayoutItem::ConstantBuffer( 0 ) : nvrhi::BindingLayoutItem::VolatileConstantBuffer( 0 ); + + if( deviceManager->m_DeviceParams.maxPushConstantSize >= layoutAttributes[BINDING_LAYOUT_DRAW_AO].rpBufSize ) + { + aoLayoutItem = nvrhi::BindingLayoutItem::PushConstants( 0, layoutAttributes[BINDING_LAYOUT_DRAW_AO].rpBufSize ); + } + auto aoLayoutDesc = nvrhi::BindingLayoutDesc() .setVisibility( nvrhi::ShaderType::All ) - .addItem( renderParmLayoutItem ) + .addItem( aoLayoutItem ) .addItem( nvrhi::BindingLayoutItem::Texture_SRV( 0 ) ) .addItem( nvrhi::BindingLayoutItem::Texture_SRV( 1 ) ) .addItem( nvrhi::BindingLayoutItem::Texture_SRV( 2 ) ); @@ -246,7 +441,7 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) auto aoLayoutDesc2 = nvrhi::BindingLayoutDesc() .setVisibility( nvrhi::ShaderType::All ) - .addItem( renderParmLayoutItem ) + .addItem( aoLayoutItem ) .addItem( nvrhi::BindingLayoutItem::Texture_SRV( 0 ) ); bindingLayouts[BINDING_LAYOUT_DRAW_AO1] = { device->createBindingLayout( aoLayoutDesc2 ), samplerOneBindingLayout }; @@ -257,13 +452,14 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) .addItem( nvrhi::BindingLayoutItem::Texture_SRV( 4 ) ); // light projection auto interactionBindingLayout = device->createBindingLayout( interactionBindingLayoutDesc ); + bindingLayouts[BINDING_LAYOUT_DRAW_INTERACTION] = { - uniformsLayout, defaultMaterialLayout, interactionBindingLayout, samplerTwoBindingLayout + uniformsLayout( BINDING_LAYOUT_DRAW_INTERACTION, false ), defaultMaterialLayout, interactionBindingLayout, samplerTwoBindingLayout }; bindingLayouts[BINDING_LAYOUT_DRAW_INTERACTION_SKINNED] = { - skinningLayout, defaultMaterialLayout, interactionBindingLayout, samplerTwoBindingLayout + uniformsLayout( BINDING_LAYOUT_DRAW_INTERACTION_SKINNED, true ), defaultMaterialLayout, interactionBindingLayout, samplerTwoBindingLayout }; auto interactionSmBindingLayoutDesc = nvrhi::BindingLayoutDesc() @@ -285,11 +481,11 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) bindingLayouts[BINDING_LAYOUT_DRAW_INTERACTION_SM] = { - uniformsLayout, defaultMaterialLayout, interactionSmBindingLayout, samplerFourBindingLayout + uniformsLayout( BINDING_LAYOUT_DRAW_INTERACTION_SM, false ), defaultMaterialLayout, interactionSmBindingLayout, samplerFourBindingLayout }; bindingLayouts[BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED] = { - skinningLayout, defaultMaterialLayout, interactionSmBindingLayout, samplerFourBindingLayout + uniformsLayout( BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED, true ), defaultMaterialLayout, interactionSmBindingLayout, samplerFourBindingLayout }; auto fogBindingLayoutDesc = nvrhi::BindingLayoutDesc() @@ -301,11 +497,11 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) bindingLayouts[BINDING_LAYOUT_FOG] = { - uniformsLayout, fogBindingLayout, samplerTwoBindingLayout + uniformsLayout( BINDING_LAYOUT_FOG, false ), fogBindingLayout, samplerTwoBindingLayout }; bindingLayouts[BINDING_LAYOUT_FOG_SKINNED] = { - skinningLayout, fogBindingLayout, samplerTwoBindingLayout + uniformsLayout( BINDING_LAYOUT_FOG_SKINNED, true ), fogBindingLayout, samplerTwoBindingLayout }; auto blendLightBindingLayoutDesc = nvrhi::BindingLayoutDesc() @@ -317,25 +513,39 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) bindingLayouts[BINDING_LAYOUT_BLENDLIGHT] = { - uniformsLayout, blendLightBindingLayout, samplerOneBindingLayout + uniformsLayout( BINDING_LAYOUT_BLENDLIGHT, false ), blendLightBindingLayout, samplerOneBindingLayout }; bindingLayouts[BINDING_LAYOUT_BLENDLIGHT_SKINNED] = { - uniformsLayout, blendLightBindingLayout, samplerOneBindingLayout + uniformsLayout( BINDING_LAYOUT_BLENDLIGHT_SKINNED, true ), blendLightBindingLayout, samplerOneBindingLayout }; + auto pp3DLayoutItem = layoutAttributes[BINDING_LAYOUT_POST_PROCESS_INGAME].cbStatic ? nvrhi::BindingLayoutItem::ConstantBuffer( 0 ) : nvrhi::BindingLayoutItem::VolatileConstantBuffer( 0 ); + + if( deviceManager->m_DeviceParams.maxPushConstantSize >= layoutAttributes[BINDING_LAYOUT_POST_PROCESS_INGAME].rpBufSize ) + { + pp3DLayoutItem = nvrhi::BindingLayoutItem::PushConstants( 0, layoutAttributes[BINDING_LAYOUT_POST_PROCESS_INGAME].rpBufSize ); + } + auto pp3DBindingLayout = nvrhi::BindingLayoutDesc() .setVisibility( nvrhi::ShaderType::All ) - .addItem( renderParmLayoutItem ) + .addItem( pp3DLayoutItem ) .addItem( nvrhi::BindingLayoutItem::Texture_SRV( 0 ) ) // current render .addItem( nvrhi::BindingLayoutItem::Texture_SRV( 1 ) ) // normal map .addItem( nvrhi::BindingLayoutItem::Texture_SRV( 2 ) ); // mask bindingLayouts[BINDING_LAYOUT_POST_PROCESS_INGAME] = { device->createBindingLayout( pp3DBindingLayout ), samplerOneBindingLayout }; + auto ppFxLayoutItem = layoutAttributes[BINDING_LAYOUT_POST_PROCESS_FINAL].cbStatic ? nvrhi::BindingLayoutItem::ConstantBuffer( 0 ) : nvrhi::BindingLayoutItem::VolatileConstantBuffer( 0 ); + + if( deviceManager->m_DeviceParams.maxPushConstantSize >= layoutAttributes[BINDING_LAYOUT_POST_PROCESS_FINAL].rpBufSize ) + { + ppFxLayoutItem = nvrhi::BindingLayoutItem::PushConstants( 0, layoutAttributes[BINDING_LAYOUT_POST_PROCESS_FINAL].rpBufSize ); + } + auto ppFxBindingLayout = nvrhi::BindingLayoutDesc() .setVisibility( nvrhi::ShaderType::All ) - .addItem( renderParmLayoutItem ) + .addItem( ppFxLayoutItem ) .addItem( nvrhi::BindingLayoutItem::Texture_SRV( 0 ) ) .addItem( nvrhi::BindingLayoutItem::Texture_SRV( 1 ) ); @@ -350,30 +560,46 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) bindingLayouts[BINDING_LAYOUT_NORMAL_CUBE] = { - uniformsLayout, normalCubeBindingLayout, samplerOneBindingLayout + uniformsLayout( BINDING_LAYOUT_NORMAL_CUBE, false ), normalCubeBindingLayout, samplerOneBindingLayout }; bindingLayouts[BINDING_LAYOUT_NORMAL_CUBE_SKINNED] = { - skinningLayout, normalCubeBindingLayout, samplerOneBindingLayout + uniformsLayout( BINDING_LAYOUT_NORMAL_CUBE_SKINNED, true ), normalCubeBindingLayout, samplerOneBindingLayout }; + auto binkVideoLayoutItem = layoutAttributes[BINDING_LAYOUT_BINK_VIDEO].cbStatic ? nvrhi::BindingLayoutItem::ConstantBuffer( 0 ) : nvrhi::BindingLayoutItem::VolatileConstantBuffer( 0 ); + + if( deviceManager->m_DeviceParams.maxPushConstantSize >= layoutAttributes[BINDING_LAYOUT_BINK_VIDEO].rpBufSize ) + { + binkVideoLayoutItem = nvrhi::BindingLayoutItem::PushConstants( 0, layoutAttributes[BINDING_LAYOUT_BINK_VIDEO].rpBufSize ); + } + auto binkVideoBindingLayout = nvrhi::BindingLayoutDesc() .setVisibility( nvrhi::ShaderType::All ) - .addItem( renderParmLayoutItem ) + .addItem( binkVideoLayoutItem ) .addItem( nvrhi::BindingLayoutItem::Texture_SRV( 0 ) ) // cube map .addItem( nvrhi::BindingLayoutItem::Texture_SRV( 1 ) ) // cube map .addItem( nvrhi::BindingLayoutItem::Texture_SRV( 2 ) ); // normal map bindingLayouts[BINDING_LAYOUT_BINK_VIDEO] = { device->createBindingLayout( binkVideoBindingLayout ), samplerOneBindingLayout }; + auto motionVectorsLayoutItem = layoutAttributes[BINDING_LAYOUT_TAA_MOTION_VECTORS].cbStatic ? nvrhi::BindingLayoutItem::ConstantBuffer( 0 ) : nvrhi::BindingLayoutItem::VolatileConstantBuffer( 0 ); + + if( deviceManager->m_DeviceParams.maxPushConstantSize >= layoutAttributes[BINDING_LAYOUT_TAA_MOTION_VECTORS].rpBufSize ) + { + motionVectorsLayoutItem = nvrhi::BindingLayoutItem::PushConstants( 0, layoutAttributes[BINDING_LAYOUT_TAA_MOTION_VECTORS].rpBufSize ); + } + auto motionVectorsBindingLayout = nvrhi::BindingLayoutDesc() .setVisibility( nvrhi::ShaderType::All ) - .addItem( renderParmLayoutItem ) + .addItem( motionVectorsLayoutItem ) .addItem( nvrhi::BindingLayoutItem::Texture_SRV( 0 ) ) // cube map .addItem( nvrhi::BindingLayoutItem::Texture_SRV( 1 ) ); // normal map bindingLayouts[BINDING_LAYOUT_TAA_MOTION_VECTORS] = { device->createBindingLayout( motionVectorsBindingLayout ), samplerOneBindingLayout }; + bindingLayouts[BINDING_LAYOUT_TAA_RESOLVE] = { }; + nvrhi::BindingLayoutDesc tonemapLayout; tonemapLayout.visibility = nvrhi::ShaderType::Pixel; tonemapLayout.bindings = @@ -384,6 +610,7 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) nvrhi::BindingLayoutItem::Texture_SRV( 2 ), nvrhi::BindingLayoutItem::Sampler( 0 ) }; + bindingLayouts[BINDING_LAYOUT_TONEMAP] = { device->createBindingLayout( tonemapLayout ) }; nvrhi::BindingLayoutDesc histogramLayout; @@ -394,6 +621,7 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) nvrhi::BindingLayoutItem::Texture_SRV( 0 ), nvrhi::BindingLayoutItem::TypedBuffer_UAV( 0 ) }; + bindingLayouts[BINDING_LAYOUT_HISTOGRAM] = { device->createBindingLayout( histogramLayout ) }; nvrhi::BindingLayoutDesc exposureLayout; @@ -404,8 +632,32 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) nvrhi::BindingLayoutItem::TypedBuffer_SRV( 0 ), nvrhi::BindingLayoutItem::TypedBuffer_UAV( 0 ) }; + bindingLayouts[BINDING_LAYOUT_EXPOSURE] = { device->createBindingLayout( exposureLayout ) }; + // SRS - allocate static/volatile constant buffers after binding layout sizes are defined + for( int i = 0; i < NUM_BINDING_LAYOUTS; i++ ) + { + nvrhi::BufferDesc constantBufferDesc; + + // SRS - allocate static constant buffer for specific binding layouts, otherwise volatile + if( layoutAttributes[i].cbStatic ) + { + constantBufferDesc = nvrhi::utils::CreateStaticConstantBufferDesc( layoutAttributes[i].rpBufSize, va( "RenderParams_%d", i ) ); + constantBufferDesc.initialState = nvrhi::ResourceStates::ConstantBuffer; + constantBufferDesc.keepInitialState = true; + } + else + { + constantBufferDesc = nvrhi::utils::CreateVolatileConstantBufferDesc( layoutAttributes[i].rpBufSize, va( "RenderParams_%d", i ), 8192 ); + } + + constantBuffer[i] = device->createBuffer( constantBufferDesc ); + } + + // SRS - added support for runtime configuration of push constants + #define usePushConstants(layout) (deviceManager->m_DeviceParams.maxPushConstantSize >= layoutAttributes[layout].rpBufSize ? "1" : "0") + // RB: added checks for GPU skinning struct builtinShaders_t { @@ -420,141 +672,141 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) //bindingLayoutType_t bindingLayout2; } builtins[] = { - { BUILTIN_GUI, "builtin/gui", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, - { BUILTIN_COLOR, "builtin/color", "", { {"USE_GPU_SKINNING", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_CONSTANT_BUFFER_ONLY }, + { BUILTIN_GUI, "builtin/gui", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DEFAULT ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, + { BUILTIN_COLOR, "builtin/color", "", { { "USE_GPU_SKINNING", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_CONSTANT_BUFFER_ONLY ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_CONSTANT_BUFFER_ONLY }, - { BUILTIN_COLOR_SKINNED, "builtin/color", "_skinned", { {"USE_GPU_SKINNING", "1" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_CONSTANT_BUFFER_ONLY_SKINNED }, - { BUILTIN_VERTEX_COLOR, "builtin/vertex_color", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_CONSTANT_BUFFER_ONLY }, + { BUILTIN_COLOR_SKINNED, "builtin/color", "_skinned", { { "USE_GPU_SKINNING", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_CONSTANT_BUFFER_ONLY_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_CONSTANT_BUFFER_ONLY_SKINNED }, + { BUILTIN_VERTEX_COLOR, "builtin/vertex_color", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_CONSTANT_BUFFER_ONLY ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_CONSTANT_BUFFER_ONLY }, - { BUILTIN_AMBIENT_LIGHTING_IBL, "builtin/lighting/ambient_lighting_IBL", "", { { "USE_GPU_SKINNING", "0" }, { "USE_PBR", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_AMBIENT_LIGHTING_IBL }, - { BUILTIN_AMBIENT_LIGHTING_IBL_SKINNED, "builtin/lighting/ambient_lighting_IBL", "_skinned", { { "USE_GPU_SKINNING", "1" }, { "USE_PBR", "0" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_AMBIENT_LIGHTING_IBL_SKINNED }, - { BUILTIN_AMBIENT_LIGHTING_IBL_PBR, "builtin/lighting/ambient_lighting_IBL", "_PBR", { { "USE_GPU_SKINNING", "0" }, { "USE_PBR", "1" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_AMBIENT_LIGHTING_IBL }, - { BUILTIN_AMBIENT_LIGHTING_IBL_PBR_SKINNED, "builtin/lighting/ambient_lighting_IBL", "_PBR_skinned", { { "USE_GPU_SKINNING", "1" }, { "USE_PBR", "1" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_AMBIENT_LIGHTING_IBL_SKINNED }, + { BUILTIN_AMBIENT_LIGHTING_IBL, "builtin/lighting/ambient_lighting_IBL", "", { { "USE_GPU_SKINNING", "0" }, { "USE_PBR", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_AMBIENT_LIGHTING_IBL ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_AMBIENT_LIGHTING_IBL }, + { BUILTIN_AMBIENT_LIGHTING_IBL_SKINNED, "builtin/lighting/ambient_lighting_IBL", "_skinned", { { "USE_GPU_SKINNING", "1" }, { "USE_PBR", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_AMBIENT_LIGHTING_IBL_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_AMBIENT_LIGHTING_IBL_SKINNED }, + { BUILTIN_AMBIENT_LIGHTING_IBL_PBR, "builtin/lighting/ambient_lighting_IBL", "_PBR", { { "USE_GPU_SKINNING", "0" }, { "USE_PBR", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_AMBIENT_LIGHTING_IBL ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_AMBIENT_LIGHTING_IBL }, + { BUILTIN_AMBIENT_LIGHTING_IBL_PBR_SKINNED, "builtin/lighting/ambient_lighting_IBL", "_PBR_skinned", { { "USE_GPU_SKINNING", "1" }, { "USE_PBR", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_AMBIENT_LIGHTING_IBL_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_AMBIENT_LIGHTING_IBL_SKINNED }, - { BUILTIN_AMBIENT_LIGHTGRID_IBL, "builtin/lighting/ambient_lightgrid_IBL", "", { { "USE_GPU_SKINNING", "0" }, { "USE_PBR", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_AMBIENT_LIGHTING_IBL }, - { BUILTIN_AMBIENT_LIGHTGRID_IBL_SKINNED, "builtin/lighting/ambient_lightgrid_IBL", "_skinned", { { "USE_GPU_SKINNING", "1" }, { "USE_PBR", "0" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_AMBIENT_LIGHTING_IBL_SKINNED }, - { BUILTIN_AMBIENT_LIGHTGRID_IBL_PBR, "builtin/lighting/ambient_lightgrid_IBL", "_PBR", { { "USE_GPU_SKINNING", "0" }, { "USE_PBR", "1" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_AMBIENT_LIGHTING_IBL }, - { BUILTIN_AMBIENT_LIGHTGRID_IBL_PBR_SKINNED, "builtin/lighting/ambient_lightgrid_IBL", "_PBR_skinned", { { "USE_GPU_SKINNING", "1" }, { "USE_PBR", "1" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_AMBIENT_LIGHTING_IBL_SKINNED }, + { BUILTIN_AMBIENT_LIGHTGRID_IBL, "builtin/lighting/ambient_lightgrid_IBL", "", { { "USE_GPU_SKINNING", "0" }, { "USE_PBR", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_AMBIENT_LIGHTING_IBL ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_AMBIENT_LIGHTING_IBL }, + { BUILTIN_AMBIENT_LIGHTGRID_IBL_SKINNED, "builtin/lighting/ambient_lightgrid_IBL", "_skinned", { { "USE_GPU_SKINNING", "1" }, { "USE_PBR", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_AMBIENT_LIGHTING_IBL_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_AMBIENT_LIGHTING_IBL_SKINNED }, + { BUILTIN_AMBIENT_LIGHTGRID_IBL_PBR, "builtin/lighting/ambient_lightgrid_IBL", "_PBR", { { "USE_GPU_SKINNING", "0" }, { "USE_PBR", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_AMBIENT_LIGHTING_IBL ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_AMBIENT_LIGHTING_IBL }, + { BUILTIN_AMBIENT_LIGHTGRID_IBL_PBR_SKINNED, "builtin/lighting/ambient_lightgrid_IBL", "_PBR_skinned", { { "USE_GPU_SKINNING", "1" }, { "USE_PBR", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_AMBIENT_LIGHTING_IBL_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_AMBIENT_LIGHTING_IBL_SKINNED }, - { BUILTIN_SMALL_GEOMETRY_BUFFER, "builtin/gbuffer", "", { {"USE_GPU_SKINNING", "0" }, { "USE_NORMAL_FMT_RGB8", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, - { BUILTIN_SMALL_GEOMETRY_BUFFER_SKINNED, "builtin/gbuffer", "_skinned", { {"USE_GPU_SKINNING", "1" }, { "USE_NORMAL_FMT_RGB8", "0" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT_SKINNED }, + { BUILTIN_SMALL_GEOMETRY_BUFFER, "builtin/gbuffer", "", { { "USE_GPU_SKINNING", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_GBUFFER ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_GBUFFER }, + { BUILTIN_SMALL_GEOMETRY_BUFFER_SKINNED, "builtin/gbuffer", "_skinned", { { "USE_GPU_SKINNING", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_GBUFFER_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_GBUFFER_SKINNED }, - { BUILTIN_TEXTURED, "builtin/texture", "", { }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, - { BUILTIN_TEXTURE_VERTEXCOLOR, "builtin/texture_color", "", { {"USE_GPU_SKINNING", "0" }, {"USE_SRGB", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, - { BUILTIN_TEXTURE_VERTEXCOLOR_SRGB, "builtin/texture_color", "_sRGB", { {"USE_GPU_SKINNING", "0" }, {"USE_SRGB", "1" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, - { BUILTIN_TEXTURE_VERTEXCOLOR_SKINNED, "builtin/texture_color", "_skinned", { {"USE_GPU_SKINNING", "1" }, {"USE_SRGB", "0" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT_SKINNED }, - { BUILTIN_TEXTURE_TEXGEN_VERTEXCOLOR, "builtin/texture_color_texgen", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, + { BUILTIN_TEXTURED, "builtin/texture", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_TEXTURE ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_TEXTURE }, + { BUILTIN_TEXTURE_VERTEXCOLOR, "builtin/texture_color", "", { { "USE_GPU_SKINNING", "0" }, {"USE_SRGB", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_TEXTURE ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_TEXTURE }, + { BUILTIN_TEXTURE_VERTEXCOLOR_SRGB, "builtin/texture_color", "_sRGB", { { "USE_GPU_SKINNING", "0" }, {"USE_SRGB", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_TEXTURE ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_TEXTURE }, + { BUILTIN_TEXTURE_VERTEXCOLOR_SKINNED, "builtin/texture_color", "_skinned", { { "USE_GPU_SKINNING", "1" }, {"USE_SRGB", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_TEXTURE_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_TEXTURE_SKINNED }, + { BUILTIN_TEXTURE_TEXGEN_VERTEXCOLOR, "builtin/texture_color_texgen", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_TEXTURE ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_TEXTURE }, + { BUILTIN_INTERACTION, "builtin/lighting/interaction", "", { { "USE_GPU_SKINNING", "0" }, { "USE_PBR", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION }, + { BUILTIN_INTERACTION_SKINNED, "builtin/lighting/interaction", "_skinned", { { "USE_GPU_SKINNING", "1" }, { "USE_PBR", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SKINNED }, - { BUILTIN_INTERACTION, "builtin/lighting/interaction", "", { {"USE_GPU_SKINNING", "0" }, { "USE_PBR", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION }, - { BUILTIN_INTERACTION_SKINNED, "builtin/lighting/interaction", "_skinned", { {"USE_GPU_SKINNING", "1" }, { "USE_PBR", "0" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SKINNED }, - - { BUILTIN_INTERACTION_AMBIENT, "builtin/lighting/interactionAmbient", "", { {"USE_GPU_SKINNING", "0" }, { "USE_PBR", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION }, - { BUILTIN_INTERACTION_AMBIENT_SKINNED, "builtin/lighting/interactionAmbient", "_skinned", { {"USE_GPU_SKINNING", "1" }, { "USE_PBR", "0" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SKINNED }, + { BUILTIN_INTERACTION_AMBIENT, "builtin/lighting/interactionAmbient", "", { { "USE_GPU_SKINNING", "0" }, { "USE_PBR", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION }, + { BUILTIN_INTERACTION_AMBIENT_SKINNED, "builtin/lighting/interactionAmbient", "_skinned", { { "USE_GPU_SKINNING", "1" }, { "USE_PBR", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SKINNED }, // PBR variants - { BUILTIN_PBR_INTERACTION, "builtin/lighting/interaction", "_PBR", { {"USE_GPU_SKINNING", "0" }, { "USE_PBR", "1" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION }, - { BUILTIN_PBR_INTERACTION_SKINNED, "builtin/lighting/interaction", "_skinned_PBR", { {"USE_GPU_SKINNING", "1" }, { "USE_PBR", "1" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SKINNED }, + { BUILTIN_PBR_INTERACTION, "builtin/lighting/interaction", "_PBR", { { "USE_GPU_SKINNING", "0" }, { "USE_PBR", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION }, + { BUILTIN_PBR_INTERACTION_SKINNED, "builtin/lighting/interaction", "_skinned_PBR", { { "USE_GPU_SKINNING", "1" }, { "USE_PBR", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SKINNED }, - { BUILTIN_PBR_INTERACTION_AMBIENT, "builtin/lighting/interactionAmbient", "_PBR", { {"USE_GPU_SKINNING", "0" }, { "USE_PBR", "1" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION }, - { BUILTIN_PBR_INTERACTION_AMBIENT_SKINNED, "builtin/lighting/interactionAmbient", "_skinned_PBR", { {"USE_GPU_SKINNING", "1" }, { "USE_PBR", "1" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SKINNED }, + { BUILTIN_PBR_INTERACTION_AMBIENT, "builtin/lighting/interactionAmbient", "_PBR", { { "USE_GPU_SKINNING", "0" }, { "USE_PBR", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION }, + { BUILTIN_PBR_INTERACTION_AMBIENT_SKINNED, "builtin/lighting/interactionAmbient", "_skinned_PBR", { { "USE_GPU_SKINNING", "1" }, { "USE_PBR", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SKINNED }, // regular shadow mapping - { BUILTIN_INTERACTION_SHADOW_MAPPING_SPOT, "builtin/lighting/interactionSM", "_spot", { {"USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM }, - { BUILTIN_INTERACTION_SHADOW_MAPPING_SPOT_SKINNED, "builtin/lighting/interactionSM", "_spot_skinned", { {"USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED }, + { BUILTIN_INTERACTION_SHADOW_MAPPING_SPOT, "builtin/lighting/interactionSM", "_spot", { { "USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION_SM ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM }, + { BUILTIN_INTERACTION_SHADOW_MAPPING_SPOT_SKINNED, "builtin/lighting/interactionSM", "_spot_skinned", { { "USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED }, - { BUILTIN_INTERACTION_SHADOW_MAPPING_POINT, "builtin/lighting/interactionSM", "_point", { {"USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "1" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM }, - { BUILTIN_INTERACTION_SHADOW_MAPPING_POINT_SKINNED, "builtin/lighting/interactionSM", "_point_skinned", { {"USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "1" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED }, + { BUILTIN_INTERACTION_SHADOW_MAPPING_POINT, "builtin/lighting/interactionSM", "_point", { { "USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "1" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION_SM ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM }, + { BUILTIN_INTERACTION_SHADOW_MAPPING_POINT_SKINNED, "builtin/lighting/interactionSM", "_point_skinned", { { "USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "1" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED }, - { BUILTIN_INTERACTION_SHADOW_MAPPING_PARALLEL, "builtin/lighting/interactionSM", "_parallel", { {"USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "1" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM }, - { BUILTIN_INTERACTION_SHADOW_MAPPING_PARALLEL_SKINNED, "builtin/lighting/interactionSM", "_parallel_skinned", { {"USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "1" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED }, + { BUILTIN_INTERACTION_SHADOW_MAPPING_PARALLEL, "builtin/lighting/interactionSM", "_parallel", { { "USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "1" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION_SM ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM }, + { BUILTIN_INTERACTION_SHADOW_MAPPING_PARALLEL_SKINNED, "builtin/lighting/interactionSM", "_parallel_skinned", { { "USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "1" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED }, - { BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_SPOT, "builtin/lighting/interactionSM", "_spot_PBR", { {"USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM }, - { BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_SPOT_SKINNED, "builtin/lighting/interactionSM", "_spot_skinned_PBR", { {"USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED }, + { BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_SPOT, "builtin/lighting/interactionSM", "_spot_PBR", { { "USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION_SM ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM }, + { BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_SPOT_SKINNED, "builtin/lighting/interactionSM", "_spot_skinned_PBR", { { "USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED }, - { BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_POINT, "builtin/lighting/interactionSM", "_point_PBR", { {"USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "1" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM }, - { BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_POINT_SKINNED, "builtin/lighting/interactionSM", "_point_skinned_PBR", { {"USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "1" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED }, + { BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_POINT, "builtin/lighting/interactionSM", "_point_PBR", { { "USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "1" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION_SM ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM }, + { BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_POINT_SKINNED, "builtin/lighting/interactionSM", "_point_skinned_PBR", { { "USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "1" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED }, - { BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_PARALLEL, "builtin/lighting/interactionSM", "_parallel_PBR", { {"USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "1" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM }, - { BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_PARALLEL_SKINNED, "builtin/lighting/interactionSM", "_parallel_skinned_PBR", { {"USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "1" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED }, + { BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_PARALLEL, "builtin/lighting/interactionSM", "_parallel_PBR", { { "USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "1" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION_SM ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM }, + { BUILTIN_PBR_INTERACTION_SHADOW_MAPPING_PARALLEL_SKINNED, "builtin/lighting/interactionSM", "_parallel_skinned_PBR", { { "USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "1" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED }, // shadow mapping using a big atlas - { BUILTIN_INTERACTION_SHADOW_ATLAS_SPOT, "builtin/lighting/interactionSM", "_atlas_spot", { {"USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM }, - { BUILTIN_INTERACTION_SHADOW_ATLAS_SPOT_SKINNED, "builtin/lighting/interactionSM", "_atlas_spot_skinned", { {"USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED }, - - { BUILTIN_INTERACTION_SHADOW_ATLAS_POINT, "builtin/lighting/interactionSM", "_atlas_point", { {"USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "1" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM }, - { BUILTIN_INTERACTION_SHADOW_ATLAS_POINT_SKINNED, "builtin/lighting/interactionSM", "_atlas_point_skinned", { {"USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "1" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED }, + { BUILTIN_INTERACTION_SHADOW_ATLAS_SPOT, "builtin/lighting/interactionSM", "_atlas_spot", { { "USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION_SM ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM }, + { BUILTIN_INTERACTION_SHADOW_ATLAS_SPOT_SKINNED, "builtin/lighting/interactionSM", "_atlas_spot_skinned", { { "USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED }, - { BUILTIN_INTERACTION_SHADOW_ATLAS_PARALLEL, "builtin/lighting/interactionSM", "_atlas_parallel", { {"USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "1" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM }, - { BUILTIN_INTERACTION_SHADOW_ATLAS_PARALLEL_SKINNED, "builtin/lighting/interactionSM", "_atlas_parallel_skinned", { {"USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "1" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED }, + { BUILTIN_INTERACTION_SHADOW_ATLAS_POINT, "builtin/lighting/interactionSM", "_atlas_point", { { "USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "1" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION_SM ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM }, + { BUILTIN_INTERACTION_SHADOW_ATLAS_POINT_SKINNED, "builtin/lighting/interactionSM", "_atlas_point_skinned", { { "USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "1" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED }, - { BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_SPOT, "builtin/lighting/interactionSM", "_atlas_spot_PBR", { {"USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM }, - { BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_SPOT_SKINNED, "builtin/lighting/interactionSM", "_atlas_spot_skinned_PBR", { {"USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED }, + { BUILTIN_INTERACTION_SHADOW_ATLAS_PARALLEL, "builtin/lighting/interactionSM", "_atlas_parallel", { { "USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "1" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION_SM ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM }, + { BUILTIN_INTERACTION_SHADOW_ATLAS_PARALLEL_SKINNED, "builtin/lighting/interactionSM", "_atlas_parallel_skinned", { { "USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "1" }, { "USE_PBR", "0" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED }, - { BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_POINT, "builtin/lighting/interactionSM", "_atlas_point_PBR", { {"USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "1" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM }, - { BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_POINT_SKINNED, "builtin/lighting/interactionSM", "_atlas_point_skinned_PBR", { {"USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "1" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED }, + { BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_SPOT, "builtin/lighting/interactionSM", "_atlas_spot_PBR", { { "USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION_SM ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM }, + { BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_SPOT_SKINNED, "builtin/lighting/interactionSM", "_atlas_spot_skinned_PBR", { { "USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED }, - { BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_PARALLEL, "builtin/lighting/interactionSM", "_atlas_parallel_PBR", { {"USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "1" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM }, - { BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_PARALLEL_SKINNED, "builtin/lighting/interactionSM", "_atlas_parallel_skinned_PBR", { {"USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "1" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED }, + { BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_POINT, "builtin/lighting/interactionSM", "_atlas_point_PBR", { { "USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "1" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION_SM ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM }, + { BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_POINT_SKINNED, "builtin/lighting/interactionSM", "_atlas_point_skinned_PBR", { { "USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "1" }, { "LIGHT_PARALLEL", "0" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED }, + { BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_PARALLEL, "builtin/lighting/interactionSM", "_atlas_parallel_PBR", { { "USE_GPU_SKINNING", "0" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "1" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION_SM ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM }, + { BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_PARALLEL_SKINNED, "builtin/lighting/interactionSM", "_atlas_parallel_skinned_PBR", { { "USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "1" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED }, // debug stuff - { BUILTIN_DEBUG_LIGHTGRID, "builtin/debug/lightgrid", "", { {"USE_GPU_SKINNING", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, - { BUILTIN_DEBUG_LIGHTGRID_SKINNED, "builtin/debug/lightgrid", "_skinned", { {"USE_GPU_SKINNING", "1" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT_SKINNED }, - - { BUILTIN_DEBUG_OCTAHEDRON, "builtin/debug/octahedron", "", { {"USE_GPU_SKINNING", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, - { BUILTIN_DEBUG_OCTAHEDRON_SKINNED, "builtin/debug/octahedron", "_skinned", { {"USE_GPU_SKINNING", "1" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT_SKINNED }, - - - { BUILTIN_ENVIRONMENT, "builtin/legacy/environment", "", { {"USE_GPU_SKINNING", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, - { BUILTIN_ENVIRONMENT_SKINNED, "builtin/legacy/environment", "_skinned", { {"USE_GPU_SKINNING", "1" } }, true , SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT_SKINNED }, - { BUILTIN_BUMPY_ENVIRONMENT, "builtin/legacy/bumpyenvironment", "", { {"USE_GPU_SKINNING", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_NORMAL_CUBE }, - { BUILTIN_BUMPY_ENVIRONMENT_SKINNED, "builtin/legacy/bumpyenvironment", "_skinned", { {"USE_GPU_SKINNING", "1" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_NORMAL_CUBE_SKINNED }, - - { BUILTIN_DEPTH, "builtin/depth", "", { {"USE_GPU_SKINNING", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_CONSTANT_BUFFER_ONLY }, - { BUILTIN_DEPTH_SKINNED, "builtin/depth", "_skinned", { {"USE_GPU_SKINNING", "1" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_CONSTANT_BUFFER_ONLY_SKINNED }, - - { BUILTIN_BLENDLIGHT, "builtin/fog/blendlight", "", { {"USE_GPU_SKINNING", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_BLENDLIGHT }, - { BUILTIN_BLENDLIGHT_SKINNED, "builtin/fog/blendlight", "_skinned", { {"USE_GPU_SKINNING", "1" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_BLENDLIGHT_SKINNED }, - { BUILTIN_FOG, "builtin/fog/fog", "", { {"USE_GPU_SKINNING", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_FOG }, - { BUILTIN_FOG_SKINNED, "builtin/fog/fog", "_skinned", { {"USE_GPU_SKINNING", "1" } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_FOG_SKINNED }, - { BUILTIN_SKYBOX, "builtin/legacy/skybox", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, - { BUILTIN_WOBBLESKY, "builtin/legacy/wobblesky", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, - { BUILTIN_POSTPROCESS, "builtin/post/postprocess", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_POST_PROCESS_FINAL }, - - { BUILTIN_SCREEN, "builtin/post/screen", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, - { BUILTIN_TONEMAP, "builtin/post/tonemap", "", { { "BRIGHTPASS", "0" }, { "HDR_DEBUG", "0"} }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, - { BUILTIN_BRIGHTPASS, "builtin/post/tonemap", "_brightpass", { { "BRIGHTPASS", "1" }, { "HDR_DEBUG", "0"} }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, - { BUILTIN_HDR_GLARE_CHROMATIC, "builtin/post/hdr_glare_chromatic", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, - { BUILTIN_HDR_DEBUG, "builtin/post/tonemap", "_debug", { { "BRIGHTPASS", "0" }, { "HDR_DEBUG", "1"} }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, - - { BUILTIN_SMAA_EDGE_DETECTION, "builtin/post/SMAA_edge_detection", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, - { BUILTIN_SMAA_BLENDING_WEIGHT_CALCULATION, "builtin/post/SMAA_blending_weight_calc", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, - { BUILTIN_SMAA_NEIGHBORHOOD_BLENDING, "builtin/post/SMAA_final", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, - - { BUILTIN_MOTION_BLUR, "builtin/post/motionBlur", "_vectors", { { "VECTORS_ONLY", "1" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_TAA_MOTION_VECTORS }, + { BUILTIN_DEBUG_LIGHTGRID, "builtin/debug/lightgrid", "", { { "USE_GPU_SKINNING", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_SSGI ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_SSGI }, + { BUILTIN_DEBUG_LIGHTGRID_SKINNED, "builtin/debug/lightgrid", "_skinned", { { "USE_GPU_SKINNING", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_SSGI_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_SSGI_SKINNED }, + + { BUILTIN_DEBUG_OCTAHEDRON, "builtin/debug/octahedron", "", { { "USE_GPU_SKINNING", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DEFAULT ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, + { BUILTIN_DEBUG_OCTAHEDRON_SKINNED, "builtin/debug/octahedron", "_skinned", { { "USE_GPU_SKINNING", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DEFAULT_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT_SKINNED }, + + { BUILTIN_ENVIRONMENT, "builtin/legacy/environment", "", { { "USE_GPU_SKINNING", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DEFAULT ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, + { BUILTIN_ENVIRONMENT_SKINNED, "builtin/legacy/environment", "_skinned", { { "USE_GPU_SKINNING", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DEFAULT_SKINNED ) } }, true , SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT_SKINNED }, + { BUILTIN_BUMPY_ENVIRONMENT, "builtin/legacy/bumpyenvironment", "", { { "USE_GPU_SKINNING", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_NORMAL_CUBE ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_NORMAL_CUBE }, + { BUILTIN_BUMPY_ENVIRONMENT_SKINNED, "builtin/legacy/bumpyenvironment", "_skinned", { { "USE_GPU_SKINNING", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_NORMAL_CUBE_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_NORMAL_CUBE_SKINNED }, + + { BUILTIN_DEPTH, "builtin/depth", "", { { "USE_GPU_SKINNING", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_CONSTANT_BUFFER_ONLY ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_CONSTANT_BUFFER_ONLY }, + { BUILTIN_DEPTH_SKINNED, "builtin/depth", "_skinned", { { "USE_GPU_SKINNING", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_CONSTANT_BUFFER_ONLY_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_CONSTANT_BUFFER_ONLY_SKINNED }, + + { BUILTIN_BLENDLIGHT, "builtin/fog/blendlight", "", { { "USE_GPU_SKINNING", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_BLENDLIGHT ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_BLENDLIGHT }, + { BUILTIN_BLENDLIGHT_SKINNED, "builtin/fog/blendlight", "_skinned", { { "USE_GPU_SKINNING", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_BLENDLIGHT_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_BLENDLIGHT_SKINNED }, + { BUILTIN_FOG, "builtin/fog/fog", "", { { "USE_GPU_SKINNING", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_FOG ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_FOG }, + { BUILTIN_FOG_SKINNED, "builtin/fog/fog", "_skinned", { { "USE_GPU_SKINNING", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_FOG_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_FOG_SKINNED }, + { BUILTIN_SKYBOX, "builtin/legacy/skybox", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DEFAULT ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, + { BUILTIN_WOBBLESKY, "builtin/legacy/wobblesky", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_WOBBLESKY ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_WOBBLESKY }, + { BUILTIN_POSTPROCESS, "builtin/post/postprocess", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_POST_PROCESS_FINAL ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_POST_PROCESS_FINAL }, + + { BUILTIN_SCREEN, "builtin/post/screen", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_POST_PROCESS ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_POST_PROCESS }, + { BUILTIN_TONEMAP, "builtin/post/tonemap", "", { { "BRIGHTPASS", "0" }, { "HDR_DEBUG", "0"}, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_POST_PROCESS ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_POST_PROCESS }, + { BUILTIN_BRIGHTPASS, "builtin/post/tonemap", "_brightpass", { { "BRIGHTPASS", "1" }, { "HDR_DEBUG", "0"}, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_POST_PROCESS ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_POST_PROCESS }, + { BUILTIN_HDR_GLARE_CHROMATIC, "builtin/post/hdr_glare_chromatic", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_POST_PROCESS ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_POST_PROCESS }, + { BUILTIN_HDR_DEBUG, "builtin/post/tonemap", "_debug", { { "BRIGHTPASS", "0" }, { "HDR_DEBUG", "1"}, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_POST_PROCESS ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_POST_PROCESS }, + + { BUILTIN_SMAA_EDGE_DETECTION, "builtin/post/SMAA_edge_detection", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_POST_PROCESS ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_POST_PROCESS }, + { BUILTIN_SMAA_BLENDING_WEIGHT_CALCULATION, "builtin/post/SMAA_blending_weight_calc", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_POST_PROCESS ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_POST_PROCESS }, + { BUILTIN_SMAA_NEIGHBORHOOD_BLENDING, "builtin/post/SMAA_final", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_POST_PROCESS ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_POST_PROCESS }, + + // SRS - changed from BUILTIN_MOTION_BLUR to BUILTIN_TAA_MOTION_VECTORS + { BUILTIN_TAA_MOTION_VECTORS, "builtin/post/motionBlur", "_vectors", { { "VECTORS_ONLY", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_TAA_MOTION_VECTORS ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_TAA_MOTION_VECTORS }, { BUILTIN_TAA_RESOLVE, "builtin/post/taa", "", { { "SAMPLE_COUNT", "1" }, { "USE_CATMULL_ROM_FILTER", "1" } }, false, SHADER_STAGE_COMPUTE, LAYOUT_UNKNOWN, BINDING_LAYOUT_TAA_RESOLVE }, { BUILTIN_TAA_RESOLVE_MSAA_2X, "builtin/post/taa", "_msaa2x", { { "SAMPLE_COUNT", "2" }, { "USE_CATMULL_ROM_FILTER", "1" } }, false, SHADER_STAGE_COMPUTE, LAYOUT_UNKNOWN, BINDING_LAYOUT_TAA_RESOLVE }, { BUILTIN_TAA_RESOLVE_MSAA_4X, "builtin/post/taa", "_msaa4x", { { "SAMPLE_COUNT", "4" }, { "USE_CATMULL_ROM_FILTER", "1" } }, false, SHADER_STAGE_COMPUTE, LAYOUT_UNKNOWN, BINDING_LAYOUT_TAA_RESOLVE }, { BUILTIN_TAA_RESOLVE_MSAA_8X, "builtin/post/taa", "_msaa8x", { { "SAMPLE_COUNT", "8" }, { "USE_CATMULL_ROM_FILTER", "1" } }, false, SHADER_STAGE_COMPUTE, LAYOUT_UNKNOWN, BINDING_LAYOUT_TAA_RESOLVE }, - { BUILTIN_AMBIENT_OCCLUSION, "builtin/SSAO/AmbientOcclusion_AO", "", { { "BRIGHTPASS", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_AO }, - { BUILTIN_AMBIENT_OCCLUSION_AND_OUTPUT, "builtin/SSAO/AmbientOcclusion_AO", "_write", { { "BRIGHTPASS", "1" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_AO }, - { BUILTIN_AMBIENT_OCCLUSION_BLUR, "builtin/SSAO/AmbientOcclusion_blur", "", { { "BRIGHTPASS", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_AO }, - { BUILTIN_AMBIENT_OCCLUSION_BLUR_AND_OUTPUT, "builtin/SSAO/AmbientOcclusion_blur", "_write", { { "BRIGHTPASS", "1" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_AO }, - { BUILTIN_DEEP_GBUFFER_RADIOSITY_SSGI, "builtin/SSGI/DeepGBufferRadiosity_radiosity", "", { }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, - { BUILTIN_DEEP_GBUFFER_RADIOSITY_BLUR, "builtin/SSGI/DeepGBufferRadiosity_blur", "", { }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, - { BUILTIN_DEEP_GBUFFER_RADIOSITY_BLUR_AND_OUTPUT, "builtin/SSGI/DeepGBufferRadiosity_blur", "_write", { }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, + { BUILTIN_AMBIENT_OCCLUSION, "builtin/SSAO/AmbientOcclusion_AO", "", { { "BRIGHTPASS", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_AO ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_AO }, + { BUILTIN_AMBIENT_OCCLUSION_AND_OUTPUT, "builtin/SSAO/AmbientOcclusion_AO", "_write", { { "BRIGHTPASS", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_AO ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_AO }, + { BUILTIN_AMBIENT_OCCLUSION_BLUR, "builtin/SSAO/AmbientOcclusion_blur", "", { { "BRIGHTPASS", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_AO ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_AO }, + { BUILTIN_AMBIENT_OCCLUSION_BLUR_AND_OUTPUT, "builtin/SSAO/AmbientOcclusion_blur", "_write", { { "BRIGHTPASS", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_AO ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_AO }, + { BUILTIN_DEEP_GBUFFER_RADIOSITY_SSGI, "builtin/SSGI/DeepGBufferRadiosity_radiosity", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_SSGI ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_SSGI }, + { BUILTIN_DEEP_GBUFFER_RADIOSITY_BLUR, "builtin/SSGI/DeepGBufferRadiosity_blur", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_SSGI ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_SSGI }, + { BUILTIN_DEEP_GBUFFER_RADIOSITY_BLUR_AND_OUTPUT, "builtin/SSGI/DeepGBufferRadiosity_blur", "_write", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_SSGI ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_SSGI }, + + { BUILTIN_STEREO_DEGHOST, "builtin/VR/stereoDeGhost", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DEFAULT ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, + { BUILTIN_STEREO_WARP, "builtin/VR/stereoWarp", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DEFAULT ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, + { BUILTIN_BINK, "builtin/video/bink", "", { {"USE_SRGB", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_BINK_VIDEO ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_BINK_VIDEO }, + { BUILTIN_BINK_SRGB, "builtin/video/bink", "_sRGB", { {"USE_SRGB", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_BINK_VIDEO ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_BINK_VIDEO }, + { BUILTIN_BINK_GUI, "builtin/video/bink_gui", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_BINK_VIDEO ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_BINK_VIDEO }, + { BUILTIN_STEREO_INTERLACE, "builtin/VR/stereoInterlace", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DEFAULT ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, - { BUILTIN_STEREO_DEGHOST, "builtin/VR/stereoDeGhost", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, - { BUILTIN_STEREO_WARP, "builtin/VR/stereoWarp", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, - { BUILTIN_BINK, "builtin/video/bink", "", { {"USE_SRGB", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_BINK_VIDEO }, - { BUILTIN_BINK_SRGB, "builtin/video/bink", "_srgb", { {"USE_SRGB", "1" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_BINK_VIDEO }, - { BUILTIN_BINK_GUI, "builtin/video/bink_gui", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_BINK_VIDEO }, - { BUILTIN_STEREO_INTERLACE, "builtin/VR/stereoInterlace", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, - { BUILTIN_MOTION_BLUR, "builtin/post/motionBlur", "", { { "VECTORS_ONLY", "1" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, + // SRS - disabled VECTORS_ONLY now that BUILTIN_TAA_MOTION_VECTORS is properly defined + { BUILTIN_MOTION_BLUR, "builtin/post/motionBlur", "", { { "VECTORS_ONLY", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_TAA_MOTION_VECTORS ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_TAA_MOTION_VECTORS }, - { BUILTIN_DEBUG_SHADOWMAP, "builtin/debug/debug_shadowmap", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, + { BUILTIN_DEBUG_SHADOWMAP, "builtin/debug/debug_shadowmap", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_GBUFFER ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_GBUFFER }, // SP begin { BUILTIN_BLIT, "builtin/blit", "", { { "TEXTURE_ARRAY", "0" } }, false, SHADER_STAGE_FRAGMENT, LAYOUT_UNKNOWN, BINDING_LAYOUT_BLIT }, @@ -624,12 +876,14 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) uniforms.SetNum( RENDERPARM_TOTAL, vec4_zero ); { + renderProgs[builtinShaders[BUILTIN_COLOR_SKINNED]].usesJoints = true; renderProgs[builtinShaders[BUILTIN_TEXTURE_VERTEXCOLOR_SKINNED]].usesJoints = true; renderProgs[builtinShaders[BUILTIN_INTERACTION_SKINNED]].usesJoints = true; renderProgs[builtinShaders[BUILTIN_INTERACTION_AMBIENT_SKINNED]].usesJoints = true; renderProgs[builtinShaders[BUILTIN_ENVIRONMENT_SKINNED]].usesJoints = true; renderProgs[builtinShaders[BUILTIN_BUMPY_ENVIRONMENT_SKINNED]].usesJoints = true; renderProgs[builtinShaders[BUILTIN_DEPTH_SKINNED]].usesJoints = true; + renderProgs[builtinShaders[BUILTIN_BLENDLIGHT_SKINNED]].usesJoints = true; renderProgs[builtinShaders[BUILTIN_FOG_SKINNED]].usesJoints = true; renderProgs[builtinShaders[BUILTIN_DEBUG_LIGHTGRID_SKINNED]].usesJoints = true; diff --git a/neo/renderer/RenderProgs.h b/neo/renderer/RenderProgs.h index 4d94efa75d..4201d1efc9 100644 --- a/neo/renderer/RenderProgs.h +++ b/neo/renderer/RenderProgs.h @@ -203,6 +203,74 @@ enum renderParm_t RENDERPARM_TOTAL, }; +// SRS - This enum list corresponds 1:1 to hlsl include files and renderparm subsets defined below + +enum renderParmSubSet_t +{ + renderParmSet0, + renderParmSet1, + renderParmSet2, + renderParmSet3, + renderParmSet4, + renderParmSet5, + renderParmSet6, + renderParmSet7, + renderParmSet8, + renderParmSet9, + renderParmSet10, + renderParmNullSet +}; + +// SRS - For push constants, define the renderparm subsets and the binding layouts they apply to +// - rpMinimalSets **must** be <= sizeof( rpMinimalSet ) -> currently 8 entries or 128 bytes +// - rpNominalSets **must** be <= sizeof( rpNominalSet ) -> currently 16 entries or 256 bytes +// - rpMaximalSets **must** be <= sizeof( rpMaximalSet ) -> currently 64 entries or 1024 bytes +// - The order/contents of all subsets must match the renderParmSet*.inc.hlsl include files + +const idList rpMinimalSet0 = { RENDERPARM_LOCALVIEWORIGIN, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_COLOR, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W }; + +const idList rpMinimalSet0Layouts = { BINDING_LAYOUT_DEFAULT, BINDING_LAYOUT_DEFAULT_SKINNED, BINDING_LAYOUT_CONSTANT_BUFFER_ONLY, BINDING_LAYOUT_CONSTANT_BUFFER_ONLY_SKINNED, BINDING_LAYOUT_BINK_VIDEO }; + +const idList rpMinimalSet1 = { RENDERPARM_SCREENCORRECTIONFACTOR, RENDERPARM_WINDOWCOORD, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_PROJMATRIX_Z, RENDERPARM_OVERBRIGHT }; + +const idList rpMinimalSet1Layouts = { BINDING_LAYOUT_POST_PROCESS, BINDING_LAYOUT_TAA_MOTION_VECTORS }; + +const idList rpMinimalSet2 = { RENDERPARM_SCREENCORRECTIONFACTOR, RENDERPARM_WINDOWCOORD, RENDERPARM_MODELMATRIX_X, RENDERPARM_MODELMATRIX_Y, RENDERPARM_MODELMATRIX_Z, RENDERPARM_MODELMATRIX_W, RENDERPARM_JITTERTEXSCALE, RENDERPARM_JITTERTEXOFFSET }; + +const idList rpMinimalSet2Layouts = { BINDING_LAYOUT_POST_PROCESS_FINAL, BINDING_LAYOUT_DRAW_AO, BINDING_LAYOUT_DRAW_AO1 }; + +const idList rpNominalSet3 = { RENDERPARM_SCREENCORRECTIONFACTOR, RENDERPARM_BUMPMATRIX_S, RENDERPARM_BUMPMATRIX_T, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_COLOR, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_MODELVIEWMATRIX_X, RENDERPARM_MODELVIEWMATRIX_Y, RENDERPARM_MODELVIEWMATRIX_Z, RENDERPARM_TEXTUREMATRIX_S, RENDERPARM_TEXTUREMATRIX_T, RENDERPARM_TEXGEN_0_ENABLED }; + +const idList rpNominalSet3Layouts = { BINDING_LAYOUT_GBUFFER, BINDING_LAYOUT_GBUFFER_SKINNED }; + +const idList rpNominalSet4 = { RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_COLOR, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_TEXTUREMATRIX_S, RENDERPARM_TEXTUREMATRIX_T, RENDERPARM_TEXGEN_0_S, RENDERPARM_TEXGEN_0_T, RENDERPARM_TEXGEN_0_Q, RENDERPARM_TEXGEN_0_ENABLED, RENDERPARM_TEXGEN_1_S, RENDERPARM_TEXGEN_1_T, RENDERPARM_ALPHA_TEST }; + +const idList rpNominalSet4Layouts = { BINDING_LAYOUT_TEXTURE, BINDING_LAYOUT_TEXTURE_SKINNED, BINDING_LAYOUT_FOG, BINDING_LAYOUT_FOG_SKINNED, BINDING_LAYOUT_BLENDLIGHT, BINDING_LAYOUT_BLENDLIGHT_SKINNED }; + +const idList rpNominalSet5 = { RENDERPARM_LOCALVIEWORIGIN, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_COLOR, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_MODELMATRIX_X, RENDERPARM_MODELMATRIX_Y, RENDERPARM_MODELMATRIX_Z, RENDERPARM_MODELMATRIX_W, RENDERPARM_WOBBLESKY_X, RENDERPARM_WOBBLESKY_Y, RENDERPARM_WOBBLESKY_Z, RENDERPARM_CASCADEDISTANCES }; + +const idList rpNominalSet5Layouts = { BINDING_LAYOUT_WOBBLESKY, BINDING_LAYOUT_NORMAL_CUBE, BINDING_LAYOUT_NORMAL_CUBE_SKINNED }; + +const idList rpNominalSet6 = { RENDERPARM_SCREENCORRECTIONFACTOR, RENDERPARM_WINDOWCOORD, RENDERPARM_COLOR, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_MODELMATRIX_X, RENDERPARM_MODELMATRIX_Y, RENDERPARM_MODELMATRIX_Z, RENDERPARM_MODELMATRIX_W, RENDERPARM_OVERBRIGHT, RENDERPARM_GLOBALLIGHTORIGIN, RENDERPARM_JITTERTEXSCALE, RENDERPARM_JITTERTEXOFFSET, RENDERPARM_CASCADEDISTANCES }; + +const idList rpNominalSet6Layouts = { BINDING_LAYOUT_SSGI, BINDING_LAYOUT_SSGI_SKINNED }; + +const idList rpNominalSet7 = { RENDERPARM_WINDOWCOORD, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_PROJMATRIX_Y, RENDERPARM_PROJMATRIX_W, RENDERPARM_MODELVIEWMATRIX_Z, RENDERPARM_ENABLE_SKINNING, RENDERPARM_ALPHA_TEST, RENDERPARM_USER0, RENDERPARM_USER1, RENDERPARM_USER2, RENDERPARM_USER3, RENDERPARM_USER4, RENDERPARM_USER5 }; + +const idList rpNominalSet7Layouts = { BINDING_LAYOUT_POST_PROCESS_INGAME }; + +const idList rpMaximalSet8 = { RENDERPARM_SCREENCORRECTIONFACTOR, RENDERPARM_WINDOWCOORD, RENDERPARM_DIFFUSEMODIFIER, RENDERPARM_SPECULARMODIFIER, RENDERPARM_LOCALLIGHTORIGIN, RENDERPARM_LOCALVIEWORIGIN, RENDERPARM_BUMPMATRIX_S, RENDERPARM_BUMPMATRIX_T, RENDERPARM_DIFFUSEMATRIX_S, RENDERPARM_DIFFUSEMATRIX_T, RENDERPARM_SPECULARMATRIX_S, RENDERPARM_SPECULARMATRIX_T, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_GLOBALEYEPOS, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_MODELMATRIX_X, RENDERPARM_MODELMATRIX_Y, RENDERPARM_MODELMATRIX_Z, RENDERPARM_MODELMATRIX_W, RENDERPARM_AMBIENT_COLOR, RENDERPARM_GLOBALLIGHTORIGIN, RENDERPARM_JITTERTEXSCALE, RENDERPARM_JITTERTEXOFFSET, RENDERPARM_CASCADEDISTANCES }; + +const idList rpMaximalSet8Layouts = { BINDING_LAYOUT_AMBIENT_LIGHTING_IBL, BINDING_LAYOUT_AMBIENT_LIGHTING_IBL_SKINNED }; + +const idList rpMaximalSet9 = { RENDERPARM_DIFFUSEMODIFIER, RENDERPARM_SPECULARMODIFIER, RENDERPARM_LOCALLIGHTORIGIN, RENDERPARM_LOCALVIEWORIGIN, RENDERPARM_LIGHTPROJECTION_S, RENDERPARM_LIGHTPROJECTION_T, RENDERPARM_LIGHTPROJECTION_Q, RENDERPARM_LIGHTFALLOFF_S, RENDERPARM_BUMPMATRIX_S, RENDERPARM_BUMPMATRIX_T, RENDERPARM_DIFFUSEMATRIX_S, RENDERPARM_DIFFUSEMATRIX_T, RENDERPARM_SPECULARMATRIX_S, RENDERPARM_SPECULARMATRIX_T, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W }; + +const idList rpMaximalSet9Layouts = { BINDING_LAYOUT_DRAW_INTERACTION, BINDING_LAYOUT_DRAW_INTERACTION_SKINNED }; + +const idList rpMaximalSet10 = { RENDERPARM_SCREENCORRECTIONFACTOR, RENDERPARM_DIFFUSEMODIFIER, RENDERPARM_SPECULARMODIFIER, RENDERPARM_LOCALLIGHTORIGIN, RENDERPARM_LOCALVIEWORIGIN, RENDERPARM_LIGHTPROJECTION_S, RENDERPARM_LIGHTPROJECTION_T, RENDERPARM_LIGHTPROJECTION_Q, RENDERPARM_LIGHTFALLOFF_S, RENDERPARM_BUMPMATRIX_S, RENDERPARM_BUMPMATRIX_T, RENDERPARM_DIFFUSEMATRIX_S, RENDERPARM_DIFFUSEMATRIX_T, RENDERPARM_SPECULARMATRIX_S, RENDERPARM_SPECULARMATRIX_T, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_MODELMATRIX_X, RENDERPARM_MODELMATRIX_Y, RENDERPARM_MODELMATRIX_Z, RENDERPARM_MODELMATRIX_W, RENDERPARM_MODELVIEWMATRIX_X, RENDERPARM_MODELVIEWMATRIX_Y, RENDERPARM_MODELVIEWMATRIX_Z, RENDERPARM_MODELVIEWMATRIX_W, RENDERPARM_GLOBALLIGHTORIGIN, RENDERPARM_JITTERTEXSCALE, RENDERPARM_JITTERTEXOFFSET, RENDERPARM_CASCADEDISTANCES, RENDERPARM_SHADOW_MATRIX_0_X, RENDERPARM_SHADOW_MATRIX_0_Y, RENDERPARM_SHADOW_MATRIX_0_Z, RENDERPARM_SHADOW_MATRIX_0_W, RENDERPARM_SHADOW_MATRIX_1_X, RENDERPARM_SHADOW_MATRIX_1_Y, RENDERPARM_SHADOW_MATRIX_1_Z, RENDERPARM_SHADOW_MATRIX_1_W, RENDERPARM_SHADOW_MATRIX_2_X, RENDERPARM_SHADOW_MATRIX_2_Y, RENDERPARM_SHADOW_MATRIX_2_Z, RENDERPARM_SHADOW_MATRIX_2_W, RENDERPARM_SHADOW_MATRIX_3_X, RENDERPARM_SHADOW_MATRIX_3_Y, RENDERPARM_SHADOW_MATRIX_3_Z, RENDERPARM_SHADOW_MATRIX_3_W, RENDERPARM_SHADOW_MATRIX_4_X, RENDERPARM_SHADOW_MATRIX_4_Y, RENDERPARM_SHADOW_MATRIX_4_Z, RENDERPARM_SHADOW_MATRIX_4_W, RENDERPARM_SHADOW_MATRIX_5_X, RENDERPARM_SHADOW_MATRIX_5_Y, RENDERPARM_SHADOW_MATRIX_5_Z, RENDERPARM_SHADOW_MATRIX_5_W, RENDERPARM_SHADOW_ATLAS_OFFSET_0, RENDERPARM_SHADOW_ATLAS_OFFSET_1, RENDERPARM_SHADOW_ATLAS_OFFSET_2, RENDERPARM_SHADOW_ATLAS_OFFSET_3, RENDERPARM_SHADOW_ATLAS_OFFSET_4, RENDERPARM_SHADOW_ATLAS_OFFSET_5 }; + +const idList rpMaximalSet10Layouts = { BINDING_LAYOUT_DRAW_INTERACTION_SM, BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED }; + enum rpStage_t { SHADER_STAGE_VERTEX = BIT( 0 ), @@ -421,6 +489,9 @@ idRenderProgManager */ class idRenderProgManager { + friend class idRenderBackend; + friend class idMaterial; + public: idRenderProgManager(); virtual ~idRenderProgManager(); @@ -777,6 +848,11 @@ class idRenderProgManager BindShader_Builtin( BUILTIN_BLENDLIGHT ); } + void BindShader_BlendLightSkinned() + { + BindShader_Builtin( BUILTIN_BLENDLIGHT_SKINNED ); + } + void BindShader_Fog() { BindShader_Builtin( BUILTIN_FOG ); @@ -958,10 +1034,13 @@ class idRenderProgManager void CommitUniforms( uint64 stateBits ); int FindProgram( const char* name, int vIndex, int fIndex, bindingLayoutType_t bindingType = BINDING_LAYOUT_DEFAULT ); void ZeroUniforms(); + void SelectUniforms( renderParmSet_t* renderParmSet, int bindingLayoutType ); int UniformSize(); bool CommitConstantBuffer( nvrhi::ICommandList* commandList, bool bindingLayoutTypeChanged ); + void CommitPushConstants( nvrhi::ICommandList* commandList, int bindingLayoutType ); + ID_INLINE nvrhi::IBuffer* ConstantBuffer() { return constantBuffer[BindingLayoutType()]; @@ -1058,13 +1137,25 @@ class idRenderProgManager void LoadShader( shader_t& shader ); + struct layoutAttributes_t + { + renderParmSubSet_t rpSubSet; + int rpBufSize; + bool cbStatic; + bool pcEnabled; + }; + int currentIndex; idList renderProgs; idList shaders; idStaticList< idVec4, RENDERPARM_TOTAL > uniforms; - bool uniformsChanged; + bool uniformsChanged[NUM_BINDING_LAYOUTS]; + layoutAttributes_t layoutAttributes[NUM_BINDING_LAYOUTS]; + idList renderParmLayouts[RENDERPARM_TOTAL]; nvrhi::IDevice* device; + nvrhi::BindingLayoutHandle uniformsLayout( bindingLayoutType_t layout, bool skinning ); + using VertexAttribDescList = idList< nvrhi::VertexAttributeDesc >; idStaticList< VertexAttribDescList, NUM_VERTEX_LAYOUTS > vertexLayoutDescs; diff --git a/neo/shaders/CMakeLists.txt b/neo/shaders/CMakeLists.txt index 2617a5e508..24ad276533 100644 --- a/neo/shaders/CMakeLists.txt +++ b/neo/shaders/CMakeLists.txt @@ -1,6 +1,6 @@ include(../compileshaders.cmake) -file(GLOB globalshaders "BRDF.inc.hlsl" "global_inc.hlsl" "vulkan.hlsli") +file(GLOB globalshaders "BRDF.inc.hlsl" "global_inc.hlsl" "vulkan.hlsli" "renderParmSet0.inc.hlsl" "renderParmSet1.inc.hlsl" "renderParmSet2.inc.hlsl" "renderParmSet3.inc.hlsl" "renderParmSet4.inc.hlsl" "renderParmSet5.inc.hlsl" "renderParmSet6.inc.hlsl" "renderParmSet7.inc.hlsl" "renderParmSet8.inc.hlsl" "renderParmSet9.inc.hlsl" "renderParmSet10.inc.hlsl") file(GLOB builtins "builtin/*.hlsl") file(GLOB debug "builtin/debug/*hlsl") file(GLOB fog "builtin/fog/*hlsl") diff --git a/neo/shaders/bloodorb1_capture.ps.hlsl b/neo/shaders/bloodorb1_capture.ps.hlsl index 068be86784..7cf854cf37 100644 --- a/neo/shaders/bloodorb1_capture.ps.hlsl +++ b/neo/shaders/bloodorb1_capture.ps.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet7.inc.hlsl" // *INDENT-OFF* @@ -56,4 +57,4 @@ void main( PS_IN fragment, out PS_OUT result ) float4 currentRenderSample = t_CurrentRender.Sample( LinearSampler, fragment.texcoord1 ); result.color = lerp( accumSample, currentRenderSample, maskSample.a ); -} \ No newline at end of file +} diff --git a/neo/shaders/bloodorb1_capture.vs.hlsl b/neo/shaders/bloodorb1_capture.vs.hlsl index 0d7577c101..f5ed4752b7 100644 --- a/neo/shaders/bloodorb1_capture.vs.hlsl +++ b/neo/shaders/bloodorb1_capture.vs.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet7.inc.hlsl" // *INDENT-OFF* @@ -50,15 +51,15 @@ struct VS_OUT { void main( VS_IN vertex, out VS_OUT result ) { - result.position.x = dot4( vertex.position, rpMVPmatrixX ); - result.position.y = dot4( vertex.position, rpMVPmatrixY ); - result.position.z = dot4( vertex.position, rpMVPmatrixZ ); - result.position.w = dot4( vertex.position, rpMVPmatrixW ); + result.position.x = dot4( vertex.position, pc.rpMVPmatrixX ); + result.position.y = dot4( vertex.position, pc.rpMVPmatrixY ); + result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); + result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); //center scale - const float4 centerScale = rpUser0; + const float4 centerScale = pc.rpUser0; result.texcoord0 = CenterScale( vertex.texcoord, centerScale.xy ); // pass through texcoords result.texcoord1 = vertex.texcoord; -} \ No newline at end of file +} diff --git a/neo/shaders/bloodorb2_capture.ps.hlsl b/neo/shaders/bloodorb2_capture.ps.hlsl index 68f04db3ff..eae16bd84a 100644 --- a/neo/shaders/bloodorb2_capture.ps.hlsl +++ b/neo/shaders/bloodorb2_capture.ps.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet7.inc.hlsl" // *INDENT-OFF* @@ -63,4 +64,4 @@ void main( PS_IN fragment, out PS_OUT result ) float4 currentRenderSample = t_CurrentRender.Sample( LinearSampler, fragment.texcoord2 ) * tint; result.color = lerp( accumSample, currentRenderSample, maskSample.a ); -} \ No newline at end of file +} diff --git a/neo/shaders/bloodorb2_capture.vs.hlsl b/neo/shaders/bloodorb2_capture.vs.hlsl index 7f21d355ea..1a990b3d61 100644 --- a/neo/shaders/bloodorb2_capture.vs.hlsl +++ b/neo/shaders/bloodorb2_capture.vs.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet7.inc.hlsl" // *INDENT-OFF* @@ -50,14 +51,14 @@ struct VS_OUT { void main( VS_IN vertex, out VS_OUT result ) { - result.position.x = dot4( vertex.position, rpMVPmatrixX ); - result.position.y = dot4( vertex.position, rpMVPmatrixY ); - result.position.z = dot4( vertex.position, rpMVPmatrixZ ); - result.position.w = dot4( vertex.position, rpMVPmatrixW ); + result.position.x = dot4( vertex.position, pc.rpMVPmatrixX ); + result.position.y = dot4( vertex.position, pc.rpMVPmatrixY ); + result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); + result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); - const float4 centerScaleTex0 = rpUser0; - const float4 rotateTex0 = rpUser1; - const float4 centerScaleTex1 = rpUser2; + const float4 centerScaleTex0 = pc.rpUser0; + const float4 rotateTex0 = pc.rpUser1; + const float4 centerScaleTex1 = pc.rpUser2; //center scale and rotate for _accum float2 tc0 = CenterScale( vertex.texcoord, centerScaleTex0.xy ); @@ -68,4 +69,4 @@ void main( VS_IN vertex, out VS_OUT result ) // pass through for currentrender result.texcoord2 = vertex.texcoord; -} \ No newline at end of file +} diff --git a/neo/shaders/bloodorb3_capture.ps.hlsl b/neo/shaders/bloodorb3_capture.ps.hlsl index 5426a53998..96109985df 100644 --- a/neo/shaders/bloodorb3_capture.ps.hlsl +++ b/neo/shaders/bloodorb3_capture.ps.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet7.inc.hlsl" // *INDENT-OFF* @@ -74,4 +75,4 @@ void main( PS_IN fragment, out PS_OUT result ) accumColor = lerp( accumColor, currentRenderSample, maskSample.a ); result.color = accumColor; -} \ No newline at end of file +} diff --git a/neo/shaders/bloodorb3_capture.vs.hlsl b/neo/shaders/bloodorb3_capture.vs.hlsl index 86a7474d55..a88f2fee18 100644 --- a/neo/shaders/bloodorb3_capture.vs.hlsl +++ b/neo/shaders/bloodorb3_capture.vs.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet7.inc.hlsl" // *INDENT-OFF* @@ -52,14 +53,14 @@ struct VS_OUT { void main( VS_IN vertex, out VS_OUT result ) { - result.position.x = dot4( vertex.position, rpMVPmatrixX ); - result.position.y = dot4( vertex.position, rpMVPmatrixY ); - result.position.z = dot4( vertex.position, rpMVPmatrixZ ); - result.position.w = dot4( vertex.position, rpMVPmatrixW ); + result.position.x = dot4( vertex.position, pc.rpMVPmatrixX ); + result.position.y = dot4( vertex.position, pc.rpMVPmatrixY ); + result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); + result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); //_accum 1 - const float4 centerScaleTex = rpUser0; - const float4 rotateTex = rpUser1; + const float4 centerScaleTex = pc.rpUser0; + const float4 rotateTex = pc.rpUser1; float2 tc0 = CenterScale( vertex.texcoord, centerScaleTex.xy ); result.texcoord0 = Rotate2D( tc0, rotateTex.xy ); @@ -73,6 +74,6 @@ void main( VS_IN vertex, out VS_OUT result ) result.texcoord3 = vertex.texcoord; // pass through the color fator - const float4 colorFactor = rpUser2; + const float4 colorFactor = pc.rpUser2; result.texcoord4 = colorFactor.xx; -} \ No newline at end of file +} diff --git a/neo/shaders/bloodorb_draw.ps.hlsl b/neo/shaders/bloodorb_draw.ps.hlsl index da221fe745..34cc7a43c7 100644 --- a/neo/shaders/bloodorb_draw.ps.hlsl +++ b/neo/shaders/bloodorb_draw.ps.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet7.inc.hlsl" // *INDENT-OFF* @@ -56,4 +57,4 @@ void main( PS_IN fragment, out PS_OUT result ) float4 maskSample = t_Mask.Sample( LinearSampler, fragment.texcoord0 ); result.color = lerp( accumSample, currentRenderSample, maskSample.a ); -} \ No newline at end of file +} diff --git a/neo/shaders/bloodorb_draw.vs.hlsl b/neo/shaders/bloodorb_draw.vs.hlsl index 46ddc417de..c98815fb08 100644 --- a/neo/shaders/bloodorb_draw.vs.hlsl +++ b/neo/shaders/bloodorb_draw.vs.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet7.inc.hlsl" // *INDENT-OFF* @@ -49,11 +50,11 @@ struct VS_OUT void main( VS_IN vertex, out VS_OUT result ) { - result.position.x = dot4( vertex.position, rpMVPmatrixX ); - result.position.y = dot4( vertex.position, rpMVPmatrixY ); - result.position.z = dot4( vertex.position, rpMVPmatrixZ ); - result.position.w = dot4( vertex.position, rpMVPmatrixW ); + result.position.x = dot4( vertex.position, pc.rpMVPmatrixX ); + result.position.y = dot4( vertex.position, pc.rpMVPmatrixY ); + result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); + result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); // pass through texcoords result.texcoord0 = vertex.texcoord; -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/SSAO/AmbientOcclusion_AO.ps.hlsl b/neo/shaders/builtin/SSAO/AmbientOcclusion_AO.ps.hlsl index 597802b81c..e5249f84cf 100644 --- a/neo/shaders/builtin/SSAO/AmbientOcclusion_AO.ps.hlsl +++ b/neo/shaders/builtin/SSAO/AmbientOcclusion_AO.ps.hlsl @@ -30,6 +30,8 @@ */ #include "global_inc.hlsl" +#include "renderParmSet2.inc.hlsl" + #define DIFFERENT_DEPTH_RESOLUTIONS 0 #define USE_DEPTH_PEEL 0 @@ -114,10 +116,10 @@ struct PS_OUT float BlueNoise( float2 n, float x ) { - float noise = t_BlueNoise.Sample( blueNoiseSampler, n.xy * rpJitterTexOffset.xy ).r; + float noise = t_BlueNoise.Sample( blueNoiseSampler, n.xy * pc.rpJitterTexOffset.xy ).r; #if TEMPORALLY_VARY_TAPS - noise = frac( noise + c_goldenRatioConjugate * rpJitterTexOffset.z * x ); + noise = frac( noise + c_goldenRatioConjugate * pc.rpJitterTexOffset.z * x ); #else noise = frac( noise ); #endif @@ -164,14 +166,14 @@ float3 reconstructCSPosition( float2 S, float z ) { float4 P; P.z = z;// * 2.0 - 1.0; - P.xy = ( S * rpWindowCoord.xy ) * 2.0 - 1.0; + P.xy = ( S * pc.rpWindowCoord.xy ) * 2.0 - 1.0; P.w = 1.0; float4 csP; - csP.x = dot4( P, rpModelMatrixX ); - csP.y = dot4( P, rpModelMatrixY ); - csP.z = dot4( P, rpModelMatrixZ ); - csP.w = dot4( P, rpModelMatrixW ); + csP.x = dot4( P, pc.rpModelMatrixX ); + csP.y = dot4( P, pc.rpModelMatrixY ); + csP.z = dot4( P, pc.rpModelMatrixZ ); + csP.w = dot4( P, pc.rpModelMatrixW ); csP.xyz /= csP.w; @@ -347,8 +349,8 @@ void main( PS_IN fragment, out PS_OUT result ) visibility = 1.0; // Pixel being shaded - float2 ssC = fragment.texcoord0 * rpScreenCorrectionFactor.xy; - int2 ssP = int2( ssC.x * rpWindowCoord.z, ssC.y * rpWindowCoord.w ); + float2 ssC = fragment.texcoord0 * pc.rpScreenCorrectionFactor.xy; + int2 ssP = int2( ssC.x * pc.rpWindowCoord.z, ssC.y * pc.rpWindowCoord.w ); //int2 ssP = int2( gl_FragCoord.xy ); @@ -396,7 +398,7 @@ void main( PS_IN fragment, out PS_OUT result ) // Hash function used in the HPG12 AlchemyAO paper float randomPatternRotationAngle = float( ( ( 3 * ssP.x ) ^ ( ssP.y + ssP.x * ssP.y ) ) #if TEMPORALLY_VARY_TAPS - + rpJitterTexOffset.z + + pc.rpJitterTexOffset.z #endif ) * 10.0; diff --git a/neo/shaders/builtin/SSAO/AmbientOcclusion_AO.vs.hlsl b/neo/shaders/builtin/SSAO/AmbientOcclusion_AO.vs.hlsl index fab2def0f4..64c0eda249 100644 --- a/neo/shaders/builtin/SSAO/AmbientOcclusion_AO.vs.hlsl +++ b/neo/shaders/builtin/SSAO/AmbientOcclusion_AO.vs.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet2.inc.hlsl" // *INDENT-OFF* @@ -52,4 +53,4 @@ void main( VS_IN vertex, out VS_OUT result ) result.position = vertex.position; result.position.y = -result.position.y; result.texcoord0 = vertex.texcoord; -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/SSAO/AmbientOcclusion_blur.ps.hlsl b/neo/shaders/builtin/SSAO/AmbientOcclusion_blur.ps.hlsl index 335c85a72e..1799979fc0 100644 --- a/neo/shaders/builtin/SSAO/AmbientOcclusion_blur.ps.hlsl +++ b/neo/shaders/builtin/SSAO/AmbientOcclusion_blur.ps.hlsl @@ -17,6 +17,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "global_inc.hlsl" +#include "renderParmSet2.inc.hlsl" // *INDENT-OFF* @@ -125,14 +126,14 @@ float3 reconstructCSPosition( float2 S, float z ) { float4 P; P.z = z * 2.0 - 1.0; - P.xy = ( S * rpWindowCoord.xy ) * 2.0 - 1.0; + P.xy = ( S * pc.rpWindowCoord.xy ) * 2.0 - 1.0; P.w = 1.0; float4 csP; - csP.x = dot4( P, rpModelMatrixX ); - csP.y = dot4( P, rpModelMatrixY ); - csP.z = dot4( P, rpModelMatrixZ ); - csP.w = dot4( P, rpModelMatrixW ); + csP.x = dot4( P, pc.rpModelMatrixX ); + csP.y = dot4( P, pc.rpModelMatrixY ); + csP.z = dot4( P, pc.rpModelMatrixZ ); + csP.w = dot4( P, pc.rpModelMatrixW ); csP.xyz /= csP.w; @@ -265,8 +266,8 @@ void main( PS_IN fragment, out PS_OUT result ) int2 ssC = int2( fragment.position.xy ); - //float2 ssF = fragment.texcoord0 * rpScreenCorrectionFactor.xy; - //int2 ssC = int2( ssF.x * rpWindowCoord.z, ssF.y * rpWindowCoord.w ); + //float2 ssF = fragment.texcoord0 * pc.rpScreenCorrectionFactor.xy; + //int2 ssC = int2( ssF.x * pc.rpWindowCoord.z, ssF.y * pc.rpWindowCoord.w ); float4 temp = texelFetch( source, ssC, 0 ); @@ -316,7 +317,7 @@ void main( PS_IN fragment, out PS_OUT result ) // so the IF statement has no runtime cost if( r != 0 ) { - int2 tapLoc = ssC + int2( rpJitterTexScale.xy ) * ( r * SCALE ); + int2 tapLoc = ssC + int2( pc.rpJitterTexScale.xy ) * ( r * SCALE ); temp = texelFetch( source, tapLoc, 0 ); @@ -338,7 +339,7 @@ void main( PS_IN fragment, out PS_OUT result ) float lastBilateralWeight = 9999.0; for( int r = -1; r >= -R; --r ) { - int2 tapLoc = ssC + int2( rpJitterTexScale.xy ) * ( r * SCALE ); + int2 tapLoc = ssC + int2( pc.rpJitterTexScale.xy ) * ( r * SCALE ); temp = texelFetch( source, tapLoc, 0 ); float tapKey = getKey( tapLoc ); @@ -359,7 +360,7 @@ void main( PS_IN fragment, out PS_OUT result ) lastBilateralWeight = 9999.0; for( int r = 1; r <= R; ++r ) { - int2 tapLoc = ssC + int2( rpJitterTexScale.xy ) * ( r * SCALE ); + int2 tapLoc = ssC + int2( pc.rpJitterTexScale.xy ) * ( r * SCALE ); temp = texelFetch( source, tapLoc, 0 ); float tapKey = getKey( tapLoc ); VALUE_TYPE value = temp.VALUE_COMPONENTS; diff --git a/neo/shaders/builtin/SSAO/AmbientOcclusion_blur.vs.hlsl b/neo/shaders/builtin/SSAO/AmbientOcclusion_blur.vs.hlsl index f0fbdf38dd..2315cc52f7 100644 --- a/neo/shaders/builtin/SSAO/AmbientOcclusion_blur.vs.hlsl +++ b/neo/shaders/builtin/SSAO/AmbientOcclusion_blur.vs.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet2.inc.hlsl" // *INDENT-OFF* @@ -51,4 +52,4 @@ void main( VS_IN vertex, out VS_OUT result ) { result.position = vertex.position; result.texcoord0 = vertex.texcoord; -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_blur.ps.hlsl b/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_blur.ps.hlsl index ee379ec07b..426b33fd44 100644 --- a/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_blur.ps.hlsl +++ b/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_blur.ps.hlsl @@ -17,6 +17,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "global_inc.hlsl" +#include "renderParmSet6.inc.hlsl" // *INDENT-OFF* @@ -129,14 +130,14 @@ float3 reconstructCSPosition( float2 S, float z ) { float4 P; P.z = z * 2.0 - 1.0; - P.xy = ( S * rpScreenCorrectionFactor.xy ) * 2.0 - 1.0; + P.xy = ( S * pc.rpScreenCorrectionFactor.xy ) * 2.0 - 1.0; P.w = 1.0; float4 csP; - csP.x = dot4( P, rpModelMatrixX ); - csP.y = dot4( P, rpModelMatrixY ); - csP.z = dot4( P, rpModelMatrixZ ); - csP.w = dot4( P, rpModelMatrixW ); + csP.x = dot4( P, pc.rpModelMatrixX ); + csP.y = dot4( P, pc.rpModelMatrixY ); + csP.z = dot4( P, pc.rpModelMatrixZ ); + csP.w = dot4( P, pc.rpModelMatrixW ); csP.xyz /= csP.w; @@ -316,7 +317,7 @@ void main( PS_IN fragment, out PS_OUT result ) // so the IF statement has no runtime cost if( r != 0 ) { - int2 tapLoc = ssC + int2( rpJitterTexScale.xy ) * ( r * SCALE ); + int2 tapLoc = ssC + int2( pc.rpJitterTexScale.xy ) * ( r * SCALE ); temp = texelFetch( source, tapLoc, 0 ); @@ -338,7 +339,7 @@ void main( PS_IN fragment, out PS_OUT result ) float lastBilateralWeight = 9999.0; for( int r = -1; r >= -R; --r ) { - int2 tapLoc = ssC + int2( rpJitterTexScale.xy ) * ( r * SCALE ); + int2 tapLoc = ssC + int2( pc.rpJitterTexScale.xy ) * ( r * SCALE ); temp = texelFetch( source, tapLoc, 0 ); float tapKey = getKey( tapLoc ); @@ -359,7 +360,7 @@ void main( PS_IN fragment, out PS_OUT result ) lastBilateralWeight = 9999.0; for( int r = 1; r <= R; ++r ) { - int2 tapLoc = ssC + int2( rpJitterTexScale.xy ) * ( r * SCALE ); + int2 tapLoc = ssC + int2( pc.rpJitterTexScale.xy ) * ( r * SCALE ); temp = texelFetch( source, tapLoc, 0 ); float tapKey = getKey( tapLoc ); VALUE_TYPE value = temp.VALUE_COMPONENTS; diff --git a/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_blur.vs.hlsl b/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_blur.vs.hlsl index bf39a0bdb1..8b8385cd36 100644 --- a/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_blur.vs.hlsl +++ b/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_blur.vs.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet6.inc.hlsl" // *INDENT-OFF* @@ -51,4 +52,4 @@ void main( VS_IN vertex, out VS_OUT result ) { result.position = vertex.position; result.texcoord0 = vertex.texcoord; -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_radiosity.ps.hlsl b/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_radiosity.ps.hlsl index 4986c5f949..bd543870f9 100644 --- a/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_radiosity.ps.hlsl +++ b/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_radiosity.ps.hlsl @@ -1,5 +1,6 @@ #include "global_inc.hlsl" +#include "renderParmSet6.inc.hlsl" // #version 120 // -*- c++ -*- @@ -159,14 +160,14 @@ float3 reconstructCSPosition( float2 S, float z ) float4 P; P.z = z * 2.0 - 1.0; //P.z = reconstructCSZ( z ); - P.xy = ( S * rpScreenCorrectionFactor.xy ) * 2.0 - 1.0; + P.xy = ( S * pc.rpScreenCorrectionFactor.xy ) * 2.0 - 1.0; P.w = 1.0; float4 csP; - csP.x = dot4( P, rpModelMatrixX ); - csP.y = dot4( P, rpModelMatrixY ); - csP.z = dot4( P, rpModelMatrixZ ); - csP.w = dot4( P, rpModelMatrixW ); + csP.x = dot4( P, pc.rpModelMatrixX ); + csP.y = dot4( P, pc.rpModelMatrixY ); + csP.z = dot4( P, pc.rpModelMatrixZ ); + csP.w = dot4( P, pc.rpModelMatrixW ); csP.xyz /= csP.w; @@ -518,12 +519,12 @@ void main( PS_IN fragment, out PS_OUT result ) // Hash function used in the HPG12 AlchemyAO paper float randomPatternRotationAngle = float( 3 * ssC.x ^ ssC.y + ssC.x * ssC.y ) * 10.0; #if TEMPORALLY_VARY_TAPS - randomPatternRotationAngle += rpJitterTexOffset.x; + randomPatternRotationAngle += pc.rpJitterTexOffset.x; #endif float radialJitter = frac( sin( fragment.position.x * 1e2 + #if TEMPORALLY_VARY_TAPS - rpJitterTexOffset.x + + pc.rpJitterTexOffset.x + #endif fragment.position.y ) * 1e5 + sin( fragment.position.y * 1e3 ) * 1e3 ) * 0.8 + 0.1; diff --git a/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_radiosity.vs.hlsl b/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_radiosity.vs.hlsl index bf39a0bdb1..8b8385cd36 100644 --- a/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_radiosity.vs.hlsl +++ b/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_radiosity.vs.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet6.inc.hlsl" // *INDENT-OFF* @@ -51,4 +52,4 @@ void main( VS_IN vertex, out VS_OUT result ) { result.position = vertex.position; result.texcoord0 = vertex.texcoord; -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/VR/stereoDeGhost.ps.hlsl b/neo/shaders/builtin/VR/stereoDeGhost.ps.hlsl index 36fc735ab8..0928bb498f 100644 --- a/neo/shaders/builtin/VR/stereoDeGhost.ps.hlsl +++ b/neo/shaders/builtin/VR/stereoDeGhost.ps.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet0.inc.hlsl" // *INDENT-OFF* @@ -41,5 +42,5 @@ struct PS_OUT void main( out PS_OUT result ) { - result.color = rpColor; -} \ No newline at end of file + result.color = pc.rpColor; +} diff --git a/neo/shaders/builtin/VR/stereoDeGhost.vs.hlsl b/neo/shaders/builtin/VR/stereoDeGhost.vs.hlsl index f11dc4f86b..cb9ff67bd2 100644 --- a/neo/shaders/builtin/VR/stereoDeGhost.vs.hlsl +++ b/neo/shaders/builtin/VR/stereoDeGhost.vs.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet0.inc.hlsl" // *INDENT-OFF* @@ -47,8 +48,8 @@ struct VS_OUT { void main( VS_IN vertex, out VS_OUT result ) { - result.position.x = dot4( vertex.position, rpMVPmatrixX ); - result.position.y = dot4( vertex.position, rpMVPmatrixY ); - result.position.z = dot4( vertex.position, rpMVPmatrixZ ); - result.position.w = dot4( vertex.position, rpMVPmatrixW ); -} \ No newline at end of file + result.position.x = dot4( vertex.position, pc.rpMVPmatrixX ); + result.position.y = dot4( vertex.position, pc.rpMVPmatrixY ); + result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); + result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); +} diff --git a/neo/shaders/builtin/VR/stereoInterlace.ps.hlsl b/neo/shaders/builtin/VR/stereoInterlace.ps.hlsl index 65d03566ba..592553feec 100644 --- a/neo/shaders/builtin/VR/stereoInterlace.ps.hlsl +++ b/neo/shaders/builtin/VR/stereoInterlace.ps.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet0.inc.hlsl" // *INDENT-OFF* @@ -58,4 +59,4 @@ void main( PS_IN fragment, out PS_OUT result ) { result.color = t_t2.Sample( LinearSampler, vec2( fragment.texcoord0 ) ); } -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/VR/stereoInterlace.vs.hlsl b/neo/shaders/builtin/VR/stereoInterlace.vs.hlsl index 14b2fcd8ad..2461b6fbc6 100644 --- a/neo/shaders/builtin/VR/stereoInterlace.vs.hlsl +++ b/neo/shaders/builtin/VR/stereoInterlace.vs.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet0.inc.hlsl" // *INDENT-OFF* @@ -48,10 +49,10 @@ struct VS_OUT { void main( VS_IN vertex, out VS_OUT result ) { - result.position.x = dot4( vertex.position, rpMVPmatrixX ); - result.position.y = dot4( vertex.position, rpMVPmatrixY ); - result.position.z = dot4( vertex.position, rpMVPmatrixZ ); - result.position.w = dot4( vertex.position, rpMVPmatrixW ); + result.position.x = dot4( vertex.position, pc.rpMVPmatrixX ); + result.position.y = dot4( vertex.position, pc.rpMVPmatrixY ); + result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); + result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); result.texcoord0 = vertex.texcoord; -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/VR/stereoWarp.ps.hlsl b/neo/shaders/builtin/VR/stereoWarp.ps.hlsl index 22e4f628cf..3c7bf29df1 100644 --- a/neo/shaders/builtin/VR/stereoWarp.ps.hlsl +++ b/neo/shaders/builtin/VR/stereoWarp.ps.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet0.inc.hlsl" /* diff --git a/neo/shaders/builtin/VR/stereoWarp.vs.hlsl b/neo/shaders/builtin/VR/stereoWarp.vs.hlsl index 8cb14b9c79..a17c28c15c 100644 --- a/neo/shaders/builtin/VR/stereoWarp.vs.hlsl +++ b/neo/shaders/builtin/VR/stereoWarp.vs.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet0.inc.hlsl" // *INDENT-OFF* @@ -48,9 +49,9 @@ struct VS_OUT { void main( VS_IN vertex, out VS_OUT result ) { - result.position.x = dot4( vertex.position, rpMVPmatrixX ); - result.position.y = dot4( vertex.position, rpMVPmatrixY ); - result.position.z = dot4( vertex.position, rpMVPmatrixZ ); - result.position.w = dot4( vertex.position, rpMVPmatrixW ); + result.position.x = dot4( vertex.position, pc.rpMVPmatrixX ); + result.position.y = dot4( vertex.position, pc.rpMVPmatrixY ); + result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); + result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); result.texcoord0 = vertex.texcoord; -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/color.ps.hlsl b/neo/shaders/builtin/color.ps.hlsl index a3fdcc0bb4..fff8580eff 100644 --- a/neo/shaders/builtin/color.ps.hlsl +++ b/neo/shaders/builtin/color.ps.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet0.inc.hlsl" // *INDENT-OFF* //sampler samp0 : register( s0 VK_DESCRIPTOR_SET( 1 ) ); @@ -39,5 +40,5 @@ struct PS_OUT void main( out PS_OUT result ) { - result.color = rpColor; -} \ No newline at end of file + result.color = pc.rpColor; +} diff --git a/neo/shaders/builtin/color.vs.hlsl b/neo/shaders/builtin/color.vs.hlsl index e75255992d..995c2ca2eb 100644 --- a/neo/shaders/builtin/color.vs.hlsl +++ b/neo/shaders/builtin/color.vs.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet0.inc.hlsl" // *INDENT-OFF* @@ -91,14 +92,14 @@ void main( VS_IN vertex, out VS_OUT result ) modelPosition.z = dot4( matZ, vertex.position ); modelPosition.w = 1.0; - result.position.x = dot4( modelPosition, rpMVPmatrixX ); - result.position.y = dot4( modelPosition, rpMVPmatrixY ); - result.position.z = dot4( modelPosition, rpMVPmatrixZ ); - result.position.w = dot4( modelPosition, rpMVPmatrixW ); + result.position.x = dot4( modelPosition, pc.rpMVPmatrixX ); + result.position.y = dot4( modelPosition, pc.rpMVPmatrixY ); + result.position.z = dot4( modelPosition, pc.rpMVPmatrixZ ); + result.position.w = dot4( modelPosition, pc.rpMVPmatrixW ); #else - result.position.x = dot4( vertex.position, rpMVPmatrixX ); - result.position.y = dot4( vertex.position, rpMVPmatrixY ); - result.position.z = dot4( vertex.position, rpMVPmatrixZ ); - result.position.w = dot4( vertex.position, rpMVPmatrixW ); + result.position.x = dot4( vertex.position, pc.rpMVPmatrixX ); + result.position.y = dot4( vertex.position, pc.rpMVPmatrixY ); + result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); + result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); #endif -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/debug/debug_shadowmap.ps.hlsl b/neo/shaders/builtin/debug/debug_shadowmap.ps.hlsl index 8c6d094dcb..ef7d8f49af 100644 --- a/neo/shaders/builtin/debug/debug_shadowmap.ps.hlsl +++ b/neo/shaders/builtin/debug/debug_shadowmap.ps.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet3.inc.hlsl" // *INDENT-OFF* @@ -52,7 +53,7 @@ void main( PS_IN fragment, out PS_OUT result ) { float3 tc; tc.xy = fragment.texcoord0.xy; - tc.z = rpScreenCorrectionFactor.x; // layer + tc.z = pc.rpScreenCorrectionFactor.x; // layer - result.color = t_t1.SampleLevel( LinearSampler, tc.xy, tc.z );// * rpColor; -} \ No newline at end of file + result.color = t_t1.SampleLevel( LinearSampler, tc.xy, tc.z );// * pc.rpColor; +} diff --git a/neo/shaders/builtin/debug/debug_shadowmap.vs.hlsl b/neo/shaders/builtin/debug/debug_shadowmap.vs.hlsl index 38ecabbc8f..5a06bb729c 100644 --- a/neo/shaders/builtin/debug/debug_shadowmap.vs.hlsl +++ b/neo/shaders/builtin/debug/debug_shadowmap.vs.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet3.inc.hlsl" // *INDENT-OFF* @@ -48,20 +49,20 @@ struct VS_OUT { void main( VS_IN vertex, out VS_OUT result ) { - result.position.x = dot4( vertex.position, rpMVPmatrixX ); - result.position.y = dot4( vertex.position, rpMVPmatrixY ); - result.position.z = dot4( vertex.position, rpMVPmatrixZ ); - result.position.w = dot4( vertex.position, rpMVPmatrixW ); + result.position.x = dot4( vertex.position, pc.rpMVPmatrixX ); + result.position.y = dot4( vertex.position, pc.rpMVPmatrixY ); + result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); + result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); // compute oldschool texgen or multiply by texture matrix - BRANCH if( rpTexGen0Enabled.x > 0.0 ) - { - result.texcoord0.x = dot4( vertex.position, rpTexGen0S ); - result.texcoord0.y = dot4( vertex.position, rpTexGen0T ); - } - else - { - result.texcoord0.x = dot4( vertex.texcoord.xy, rpTextureMatrixS ); - result.texcoord0.y = dot4( vertex.texcoord.xy, rpTextureMatrixT ); - } -} \ No newline at end of file + //BRANCH if( pc.rpTexGen0Enabled.x > 0.0 ) + //{ + // result.texcoord0.x = dot4( vertex.position, rpTexGen0S ); + // result.texcoord0.y = dot4( vertex.position, rpTexGen0T ); + //} + //else + //{ + result.texcoord0.x = dot4( vertex.texcoord.xy, pc.rpTextureMatrixS ); + result.texcoord0.y = dot4( vertex.texcoord.xy, pc.rpTextureMatrixT ); + //} +} diff --git a/neo/shaders/builtin/debug/lightgrid.ps.hlsl b/neo/shaders/builtin/debug/lightgrid.ps.hlsl index 337971bc29..4754cea93c 100644 --- a/neo/shaders/builtin/debug/lightgrid.ps.hlsl +++ b/neo/shaders/builtin/debug/lightgrid.ps.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet6.inc.hlsl" // *INDENT-OFF* @@ -51,9 +52,9 @@ struct PS_OUT int3 GetBaseGridCoord( float3 origin ) { - float3 lightGridOrigin = rpGlobalLightOrigin.xyz; - float3 lightGridSize = rpJitterTexScale.xyz; - int3 lightGridBounds = int3( rpJitterTexOffset.x, rpJitterTexOffset.y, rpJitterTexOffset.z ); + float3 lightGridOrigin = pc.rpGlobalLightOrigin.xyz; + float3 lightGridSize = pc.rpJitterTexScale.xyz; + int3 lightGridBounds = int3( pc.rpJitterTexOffset.x, pc.rpJitterTexOffset.y, pc.rpJitterTexOffset.z ); int3 pos; @@ -88,9 +89,9 @@ void main( PS_IN fragment, out PS_OUT result ) float2 normalizedOctCoord = octEncode( globalNormal ); float2 normalizedOctCoordZeroOne = ( normalizedOctCoord + _float2( 1.0 ) ) * 0.5; - float3 lightGridOrigin = rpGlobalLightOrigin.xyz; - float3 lightGridSize = rpJitterTexScale.xyz; - int3 lightGridBounds = int3( rpJitterTexOffset.x, rpJitterTexOffset.y, rpJitterTexOffset.z ); + float3 lightGridOrigin = pc.rpGlobalLightOrigin.xyz; + float3 lightGridSize = pc.rpJitterTexScale.xyz; + int3 lightGridBounds = int3( pc.rpJitterTexOffset.x, pc.rpJitterTexOffset.y, pc.rpJitterTexOffset.z ); float invXZ = ( 1.0 / ( lightGridBounds[0] * lightGridBounds[2] ) ); float invY = ( 1.0 / lightGridBounds[1] ); @@ -111,17 +112,17 @@ void main( PS_IN fragment, out PS_OUT result ) // offset by one pixel border bleed size for linear filtering #if 1 - // rpScreenCorrectionFactor.x = probeSize - borderSize, e.g. ( 18 - 2 ) = 16 - // rpScreenCorrectionFactor.y = probeSize including border, e.g = 18 - // rpScreenCorrectionFactor.z = borderSize e.g = 2 - // rpScreenCorrectionFactor.w = probeSize factor accounting account offset border, e.g = ( 16 / 18 ) = 0.8888 - float2 octCoordNormalizedToTextureDimensions = normalizedOctCoordZeroOne * rpScreenCorrectionFactor.w; + // pc.rpScreenCorrectionFactor.x = probeSize - borderSize, e.g. ( 18 - 2 ) = 16 + // pc.rpScreenCorrectionFactor.y = probeSize including border, e.g = 18 + // pc.rpScreenCorrectionFactor.z = borderSize e.g = 2 + // pc.rpScreenCorrectionFactor.w = probeSize factor accounting account offset border, e.g = ( 16 / 18 ) = 0.8888 + float2 octCoordNormalizedToTextureDimensions = normalizedOctCoordZeroOne * pc.rpScreenCorrectionFactor.w; float2 probeTopLeftPosition; - probeTopLeftPosition.x = ( gridCoord[0] * gridStep[0] + gridCoord[2] * gridStep[1] ) * rpScreenCorrectionFactor.z + rpScreenCorrectionFactor.z * 0.5; - probeTopLeftPosition.y = ( gridCoord[1] ) * rpScreenCorrectionFactor.z + rpScreenCorrectionFactor.z * 0.5; + probeTopLeftPosition.x = ( gridCoord[0] * gridStep[0] + gridCoord[2] * gridStep[1] ) * pc.rpScreenCorrectionFactor.z + pc.rpScreenCorrectionFactor.z * 0.5; + probeTopLeftPosition.y = ( gridCoord[1] ) * pc.rpScreenCorrectionFactor.z + pc.rpScreenCorrectionFactor.z * 0.5; - float2 normalizedProbeTopLeftPosition = probeTopLeftPosition * rpCascadeDistances.zw; + float2 normalizedProbeTopLeftPosition = probeTopLeftPosition * pc.rpCascadeDistances.zw; normalizedOctCoordZeroOne.xy = normalizedProbeTopLeftPosition + octCoordNormalizedToTextureDimensions; #endif diff --git a/neo/shaders/builtin/debug/lightgrid.vs.hlsl b/neo/shaders/builtin/debug/lightgrid.vs.hlsl index f5d49902bf..acc2099653 100644 --- a/neo/shaders/builtin/debug/lightgrid.vs.hlsl +++ b/neo/shaders/builtin/debug/lightgrid.vs.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet6.inc.hlsl" // *INDENT-OFF* @@ -110,21 +111,21 @@ void main( VS_IN vertex, out VS_OUT result ) #endif - result.position.x = dot4( modelPosition, rpMVPmatrixX ); - result.position.y = dot4( modelPosition, rpMVPmatrixY ); - result.position.z = dot4( modelPosition, rpMVPmatrixZ ); - result.position.w = dot4( modelPosition, rpMVPmatrixW ); + result.position.x = dot4( modelPosition, pc.rpMVPmatrixX ); + result.position.y = dot4( modelPosition, pc.rpMVPmatrixY ); + result.position.z = dot4( modelPosition, pc.rpMVPmatrixZ ); + result.position.w = dot4( modelPosition, pc.rpMVPmatrixW ); - result.texcoord1.x = dot3( normal, rpModelMatrixX ); - result.texcoord1.y = dot3( normal, rpModelMatrixY ); - result.texcoord1.z = dot3( normal, rpModelMatrixZ ); + result.texcoord1.x = dot3( normal, pc.rpModelMatrixX ); + result.texcoord1.y = dot3( normal, pc.rpModelMatrixY ); + result.texcoord1.z = dot3( normal, pc.rpModelMatrixZ ); float4 worldPosition; - worldPosition.x = dot4( modelPosition, rpModelMatrixX ); - worldPosition.y = dot4( modelPosition, rpModelMatrixY ); - worldPosition.z = dot4( modelPosition, rpModelMatrixZ ); - worldPosition.w = dot4( modelPosition, rpModelMatrixW ); + worldPosition.x = dot4( modelPosition, pc.rpModelMatrixX ); + worldPosition.y = dot4( modelPosition, pc.rpModelMatrixY ); + worldPosition.z = dot4( modelPosition, pc.rpModelMatrixZ ); + worldPosition.w = dot4( modelPosition, pc.rpModelMatrixW ); result.texcoord0 = worldPosition.xyz; - result.color = sRGBAToLinearRGBA( rpColor ); + result.color = sRGBAToLinearRGBA( pc.rpColor ); } diff --git a/neo/shaders/builtin/debug/octahedron.ps.hlsl b/neo/shaders/builtin/debug/octahedron.ps.hlsl index 93dff5f367..f78f466ab2 100644 --- a/neo/shaders/builtin/debug/octahedron.ps.hlsl +++ b/neo/shaders/builtin/debug/octahedron.ps.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet0.inc.hlsl" // *INDENT-OFF* @@ -62,15 +63,15 @@ void main( PS_IN fragment, out PS_OUT result ) // offset by one pixel border bleed size for linear filtering #if 0 - float2 octCoordNormalizedToTextureDimensions = ( normalizedOctCoordZeroOne * ( rpCascadeDistances.x - float( 2.0 ) ) ) / rpCascadeDistances.xy; + float2 octCoordNormalizedToTextureDimensions = ( normalizedOctCoordZeroOne * ( pc.rpCascadeDistances.x - float( 2.0 ) ) ) / pc.rpCascadeDistances.xy; float2 probeTopLeftPosition = float2( 1.0, 1.0 ); - float2 normalizedProbeTopLeftPosition = probeTopLeftPosition * rpCascadeDistances.zw; + float2 normalizedProbeTopLeftPosition = probeTopLeftPosition * pc.rpCascadeDistances.zw; normalizedOctCoordZeroOne.xy = normalizedProbeTopLeftPosition + octCoordNormalizedToTextureDimensions; #endif - //normalizedOctCoordZeroOne = TextureCoordFromDirection( reflectionVector, 0, int( rpCascadeDistances.x ), int( rpCascadeDistances.y ), int( rpCascadeDistances.x ) - 2 ); + //normalizedOctCoordZeroOne = TextureCoordFromDirection( reflectionVector, 0, int( pc.rpCascadeDistances.x ), int( pc.rpCascadeDistances.y ), int( pc.rpCascadeDistances.x ) - 2 ); float4 envMap = t_CubeMap.SampleLevel( samp0, normalizedOctCoordZeroOne, 0 ); diff --git a/neo/shaders/builtin/debug/octahedron.vs.hlsl b/neo/shaders/builtin/debug/octahedron.vs.hlsl index 09bf515964..f889d9ed57 100644 --- a/neo/shaders/builtin/debug/octahedron.vs.hlsl +++ b/neo/shaders/builtin/debug/octahedron.vs.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet0.inc.hlsl" // *INDENT-OFF* @@ -110,15 +111,15 @@ void main( VS_IN vertex, out VS_OUT result ) #endif - result.position.x = dot4( modelPosition, rpMVPmatrixX ); - result.position.y = dot4( modelPosition, rpMVPmatrixY ); - result.position.z = dot4( modelPosition, rpMVPmatrixZ ); - result.position.w = dot4( modelPosition, rpMVPmatrixW ); + result.position.x = dot4( modelPosition, pc.rpMVPmatrixX ); + result.position.y = dot4( modelPosition, pc.rpMVPmatrixY ); + result.position.z = dot4( modelPosition, pc.rpMVPmatrixZ ); + result.position.w = dot4( modelPosition, pc.rpMVPmatrixW ); - float4 toEye = rpLocalViewOrigin - vertex.position; + float4 toEye = pc.rpLocalViewOrigin - vertex.position; result.texcoord0 = toEye.xyz; result.texcoord1 = normal.xyz; - result.color = sRGBAToLinearRGBA( rpColor ); + result.color = sRGBAToLinearRGBA( pc.rpColor ); } diff --git a/neo/shaders/builtin/depth.ps.hlsl b/neo/shaders/builtin/depth.ps.hlsl index e00371ba46..99ac5efea9 100644 --- a/neo/shaders/builtin/depth.ps.hlsl +++ b/neo/shaders/builtin/depth.ps.hlsl @@ -27,6 +27,8 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet0.inc.hlsl" + // *INDENT-OFF* struct PS_OUT @@ -38,4 +40,4 @@ struct PS_OUT void main( out PS_OUT result ) { result.color = float4( 0.0, 0.0, 0.0, 1.0 ); -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/depth.vs.hlsl b/neo/shaders/builtin/depth.vs.hlsl index f7a2b3eac5..a81751ea4a 100644 --- a/neo/shaders/builtin/depth.vs.hlsl +++ b/neo/shaders/builtin/depth.vs.hlsl @@ -27,6 +27,8 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet0.inc.hlsl" + // *INDENT-OFF* #if USE_GPU_SKINNING @@ -89,14 +91,14 @@ void main( VS_IN vertex, out VS_OUT result ) modelPosition.z = dot4( matZ, vertex.position ); modelPosition.w = 1.0; - result.position.x = dot4( modelPosition, rpMVPmatrixX ); - result.position.y = dot4( modelPosition, rpMVPmatrixY ); - result.position.z = dot4( modelPosition, rpMVPmatrixZ ); - result.position.w = dot4( modelPosition, rpMVPmatrixW ); + result.position.x = dot4( modelPosition, pc.rpMVPmatrixX ); + result.position.y = dot4( modelPosition, pc.rpMVPmatrixY ); + result.position.z = dot4( modelPosition, pc.rpMVPmatrixZ ); + result.position.w = dot4( modelPosition, pc.rpMVPmatrixW ); #else - result.position.x = dot4( vertex.position, rpMVPmatrixX ); - result.position.y = dot4( vertex.position, rpMVPmatrixY ); - result.position.z = dot4( vertex.position, rpMVPmatrixZ ); - result.position.w = dot4( vertex.position, rpMVPmatrixW ); + result.position.x = dot4( vertex.position, pc.rpMVPmatrixX ); + result.position.y = dot4( vertex.position, pc.rpMVPmatrixY ); + result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); + result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); #endif -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/fog/blendLight.ps.hlsl b/neo/shaders/builtin/fog/blendLight.ps.hlsl index 4e3ee598bd..3f763825cf 100644 --- a/neo/shaders/builtin/fog/blendLight.ps.hlsl +++ b/neo/shaders/builtin/fog/blendLight.ps.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet4.inc.hlsl" // *INDENT-OFF* @@ -50,7 +51,7 @@ struct PS_OUT void main( PS_IN fragment, out PS_OUT result ) { - float4 c = idtex2Dproj( s_LinearClamp, t_Light1, fragment.texcoord0 ) * t_Light2.Sample( s_LinearClamp, fragment.texcoord1 ) * rpColor; + float4 c = idtex2Dproj( s_LinearClamp, t_Light1, fragment.texcoord0 ) * t_Light2.Sample( s_LinearClamp, fragment.texcoord1 ) * pc.rpColor; result.color = sRGBAToLinearRGBA( c ); } diff --git a/neo/shaders/builtin/fog/blendLight.vs.hlsl b/neo/shaders/builtin/fog/blendLight.vs.hlsl index fbff331afa..a7782d2ca7 100644 --- a/neo/shaders/builtin/fog/blendLight.vs.hlsl +++ b/neo/shaders/builtin/fog/blendLight.vs.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet4.inc.hlsl" // *INDENT-OFF* @@ -94,30 +95,30 @@ void main( VS_IN vertex, out VS_OUT result ) // end of skinning // start of fog portion - result.position.x = dot4( modelPosition, rpMVPmatrixX ); - result.position.y = dot4( modelPosition, rpMVPmatrixY ); - result.position.z = dot4( modelPosition, rpMVPmatrixZ ); - result.position.w = dot4( modelPosition, rpMVPmatrixW ); + result.position.x = dot4( modelPosition, pc.rpMVPmatrixX ); + result.position.y = dot4( modelPosition, pc.rpMVPmatrixY ); + result.position.z = dot4( modelPosition, pc.rpMVPmatrixZ ); + result.position.w = dot4( modelPosition, pc.rpMVPmatrixW ); - result.texcoord0.x = dot4( modelPosition, rpTexGen0S ); - result.texcoord0.y = dot4( modelPosition, rpTexGen0T ); + result.texcoord0.x = dot4( modelPosition, pc.rpTexGen0S ); + result.texcoord0.y = dot4( modelPosition, pc.rpTexGen0T ); result.texcoord0.z = 0.0; - result.texcoord0.w = dot4( modelPosition, rpTexGen0Q ); + result.texcoord0.w = dot4( modelPosition, pc.rpTexGen0Q ); - result.texcoord1.x = dot4( modelPosition, rpTexGen1S ); + result.texcoord1.x = dot4( modelPosition, pc.rpTexGen1S ); result.texcoord1.y = 0.5; #else - result.position.x = dot4( vertex.position, rpMVPmatrixX ); - result.position.y = dot4( vertex.position, rpMVPmatrixY ); - result.position.z = dot4( vertex.position, rpMVPmatrixZ ); - result.position.w = dot4( vertex.position, rpMVPmatrixW ); + result.position.x = dot4( vertex.position, pc.rpMVPmatrixX ); + result.position.y = dot4( vertex.position, pc.rpMVPmatrixY ); + result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); + result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); - result.texcoord0.x = dot4( vertex.position, rpTexGen0S ); - result.texcoord0.y = dot4( vertex.position, rpTexGen0T ); + result.texcoord0.x = dot4( vertex.position, pc.rpTexGen0S ); + result.texcoord0.y = dot4( vertex.position, pc.rpTexGen0T ); result.texcoord0.z = 0.0; - result.texcoord0.w = dot4( vertex.position, rpTexGen0Q ); + result.texcoord0.w = dot4( vertex.position, pc.rpTexGen0Q ); - result.texcoord1.x = dot4( vertex.position, rpTexGen1S ); + result.texcoord1.x = dot4( vertex.position, pc.rpTexGen1S ); result.texcoord1.y = 0.5; #endif } diff --git a/neo/shaders/builtin/fog/fog.ps.hlsl b/neo/shaders/builtin/fog/fog.ps.hlsl index a050d34a0c..c0249f262b 100644 --- a/neo/shaders/builtin/fog/fog.ps.hlsl +++ b/neo/shaders/builtin/fog/fog.ps.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet4.inc.hlsl" // *INDENT-OFF* @@ -52,7 +53,7 @@ struct PS_OUT void main( PS_IN fragment, out PS_OUT result ) { - float4 c = t_Fog1.Sample( samp0, fragment.texcoord0 ) * t_Fog2.Sample( samp1, fragment.texcoord1 ) * rpColor; + float4 c = t_Fog1.Sample( samp0, fragment.texcoord0 ) * t_Fog2.Sample( samp1, fragment.texcoord1 ) * pc.rpColor; result.color = sRGBAToLinearRGBA( c ); } diff --git a/neo/shaders/builtin/fog/fog.vs.hlsl b/neo/shaders/builtin/fog/fog.vs.hlsl index 7118650e90..1567fb2322 100644 --- a/neo/shaders/builtin/fog/fog.vs.hlsl +++ b/neo/shaders/builtin/fog/fog.vs.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet4.inc.hlsl" // *INDENT-OFF* @@ -94,26 +95,26 @@ void main( VS_IN vertex, out VS_OUT result ) // end of skinning // start of fog portion - result.position.x = dot4( modelPosition, rpMVPmatrixX ); - result.position.y = dot4( modelPosition, rpMVPmatrixY ); - result.position.z = dot4( modelPosition, rpMVPmatrixZ ); - result.position.w = dot4( modelPosition, rpMVPmatrixW ); + result.position.x = dot4( modelPosition, pc.rpMVPmatrixX ); + result.position.y = dot4( modelPosition, pc.rpMVPmatrixY ); + result.position.z = dot4( modelPosition, pc.rpMVPmatrixZ ); + result.position.w = dot4( modelPosition, pc.rpMVPmatrixW ); - result.texcoord0.x = dot4( modelPosition, rpTexGen0S ); - result.texcoord0.y = dot4( modelPosition, rpTexGen0T ); + result.texcoord0.x = dot4( modelPosition, pc.rpTexGen0S ); + result.texcoord0.y = dot4( modelPosition, pc.rpTexGen0T ); - result.texcoord1.x = dot4( modelPosition, rpTexGen1S ); - result.texcoord1.y = dot4( modelPosition, rpTexGen1T ); + result.texcoord1.x = dot4( modelPosition, pc.rpTexGen1S ); + result.texcoord1.y = dot4( modelPosition, pc.rpTexGen1T ); #else - result.position.x = dot4( vertex.position, rpMVPmatrixX ); - result.position.y = dot4( vertex.position, rpMVPmatrixY ); - result.position.z = dot4( vertex.position, rpMVPmatrixZ ); - result.position.w = dot4( vertex.position, rpMVPmatrixW ); + result.position.x = dot4( vertex.position, pc.rpMVPmatrixX ); + result.position.y = dot4( vertex.position, pc.rpMVPmatrixY ); + result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); + result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); - result.texcoord0.x = dot4( vertex.position, rpTexGen0S ); - result.texcoord0.y = dot4( vertex.position, rpTexGen0T ); + result.texcoord0.x = dot4( vertex.position, pc.rpTexGen0S ); + result.texcoord0.y = dot4( vertex.position, pc.rpTexGen0T ); - result.texcoord1.x = dot4( vertex.position, rpTexGen1S ); - result.texcoord1.y = dot4( vertex.position, rpTexGen1T ); + result.texcoord1.x = dot4( vertex.position, pc.rpTexGen1S ); + result.texcoord1.y = dot4( vertex.position, pc.rpTexGen1T ); #endif } diff --git a/neo/shaders/builtin/gbuffer.ps.hlsl b/neo/shaders/builtin/gbuffer.ps.hlsl index 38194b57a8..41fface1d3 100644 --- a/neo/shaders/builtin/gbuffer.ps.hlsl +++ b/neo/shaders/builtin/gbuffer.ps.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet3.inc.hlsl" // *INDENT-OFF* @@ -82,6 +83,6 @@ void main( PS_IN fragment, out PS_OUT result ) #endif // RB: rpColor is white and only used to generate the _fa_ uniform array - result.color.rgb = ( globalNormal.xyz * 0.5 + 0.5 ) * fragment.color.rgb;// * rpColor; + result.color.rgb = ( globalNormal.xyz * 0.5 + 0.5 ) * fragment.color.rgb;// * pc.rpColor; result.color.a = 1.0; } diff --git a/neo/shaders/builtin/gbuffer.vs.hlsl b/neo/shaders/builtin/gbuffer.vs.hlsl index ed8271a456..ff51e8c6d4 100644 --- a/neo/shaders/builtin/gbuffer.vs.hlsl +++ b/neo/shaders/builtin/gbuffer.vs.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet3.inc.hlsl" // *INDENT-OFF* #if USE_GPU_SKINNING @@ -125,14 +126,14 @@ void main( VS_IN vertex, out VS_OUT result ) float3 bitangent = vBitangent.xyz; #endif - result.position.x = dot4( modelPosition, rpMVPmatrixX ); - result.position.y = dot4( modelPosition, rpMVPmatrixY ); - result.position.z = dot4( modelPosition, rpMVPmatrixZ ); - result.position.w = dot4( modelPosition, rpMVPmatrixW ); + result.position.x = dot4( modelPosition, pc.rpMVPmatrixX ); + result.position.y = dot4( modelPosition, pc.rpMVPmatrixY ); + result.position.z = dot4( modelPosition, pc.rpMVPmatrixZ ); + result.position.w = dot4( modelPosition, pc.rpMVPmatrixW ); // textures 0 takes the base coordinates by the texture matrix - result.texcoord0.x = dot4( vertex.texcoord.xy, rpBumpMatrixS ); - result.texcoord0.y = dot4( vertex.texcoord.xy, rpBumpMatrixT ); + result.texcoord0.x = dot4( vertex.texcoord.xy, pc.rpBumpMatrixS ); + result.texcoord0.y = dot4( vertex.texcoord.xy, pc.rpBumpMatrixT ); //float4 toEye = rpLocalViewOrigin - modelPosition; //result.texcoord1.x = dot3( toEye, rpModelMatrixX ); @@ -155,17 +156,17 @@ void main( VS_IN vertex, out VS_OUT result ) #else // rotate into view space - result.texcoord2.x = dot3( tangent, rpModelViewMatrixX ); - result.texcoord3.x = dot3( tangent, rpModelViewMatrixY ); - result.texcoord4.x = dot3( tangent, rpModelViewMatrixZ ); + result.texcoord2.x = dot3( tangent, pc.rpModelViewMatrixX ); + result.texcoord3.x = dot3( tangent, pc.rpModelViewMatrixY ); + result.texcoord4.x = dot3( tangent, pc.rpModelViewMatrixZ ); - result.texcoord2.y = dot3( bitangent, rpModelViewMatrixX ); - result.texcoord3.y = dot3( bitangent, rpModelViewMatrixY ); - result.texcoord4.y = dot3( bitangent, rpModelViewMatrixZ ); + result.texcoord2.y = dot3( bitangent, pc.rpModelViewMatrixX ); + result.texcoord3.y = dot3( bitangent, pc.rpModelViewMatrixY ); + result.texcoord4.y = dot3( bitangent, pc.rpModelViewMatrixZ ); - result.texcoord2.z = dot3( normal, rpModelViewMatrixX ); - result.texcoord3.z = dot3( normal, rpModelViewMatrixY ); - result.texcoord4.z = dot3( normal, rpModelViewMatrixZ ); + result.texcoord2.z = dot3( normal, pc.rpModelViewMatrixX ); + result.texcoord3.z = dot3( normal, pc.rpModelViewMatrixY ); + result.texcoord4.z = dot3( normal, pc.rpModelViewMatrixZ ); #endif #if USE_GPU_SKINNING @@ -178,6 +179,6 @@ void main( VS_IN vertex, out VS_OUT result ) //# for 1.0 : env[16] = 0, env[17] = 1 //# for color : env[16] = 1, env[17] = 0 //# for 1.0-color : env[16] = -1, env[17] = 1 - result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd; + result.color = ( swizzleColor( vertex.color ) * pc.rpVertexColorModulate ) + pc.rpVertexColorAdd; #endif -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/gui.ps.hlsl b/neo/shaders/builtin/gui.ps.hlsl index 147eb5c016..ecc848fc0b 100644 --- a/neo/shaders/builtin/gui.ps.hlsl +++ b/neo/shaders/builtin/gui.ps.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet0.inc.hlsl" // *INDENT-OFF* Texture2D texGui : register( t0 VK_DESCRIPTOR_SET( 1 ) ); @@ -51,4 +52,4 @@ void main( PS_IN fragment, out PS_OUT result ) float4 color = ( texData * fragment.color ) + fragment.texcoord1; result.color.xyz = color.xyz * color.w; result.color.w = color.w; -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/gui.vs.hlsl b/neo/shaders/builtin/gui.vs.hlsl index f356cb4307..9339fa3987 100644 --- a/neo/shaders/builtin/gui.vs.hlsl +++ b/neo/shaders/builtin/gui.vs.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include +#include "renderParmSet0.inc.hlsl" // *INDENT-OFF* struct VS_IN @@ -51,10 +52,10 @@ struct VS_OUT void main( VS_IN vertex, out VS_OUT result ) { - result.position.x = dot4( vertex.position, rpMVPmatrixX ); - result.position.y = dot4( vertex.position, rpMVPmatrixY ); - result.position.z = dot4( vertex.position, rpMVPmatrixZ ); - result.position.w = dot4( vertex.position, rpMVPmatrixW ); + result.position.x = dot4( vertex.position, pc.rpMVPmatrixX ); + result.position.y = dot4( vertex.position, pc.rpMVPmatrixY ); + result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); + result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); result.texcoord0.xy = vertex.texcoord.xy; result.texcoord1 = ( ( vertex.color2 ) * 2.0 ) - 1.0; diff --git a/neo/shaders/builtin/legacy/bumpyenvironment.ps.hlsl b/neo/shaders/builtin/legacy/bumpyenvironment.ps.hlsl index 44a440e0f8..e0a8a90bb9 100644 --- a/neo/shaders/builtin/legacy/bumpyenvironment.ps.hlsl +++ b/neo/shaders/builtin/legacy/bumpyenvironment.ps.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet5.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/builtin/legacy/bumpyenvironment.vs.hlsl b/neo/shaders/builtin/legacy/bumpyenvironment.vs.hlsl index 803e2713f9..2b055a216f 100644 --- a/neo/shaders/builtin/legacy/bumpyenvironment.vs.hlsl +++ b/neo/shaders/builtin/legacy/bumpyenvironment.vs.hlsl @@ -27,6 +27,8 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet5.inc.hlsl" + // *INDENT-OFF* #if USE_GPU_SKINNING @@ -117,61 +119,61 @@ void main( VS_IN vertex, out VS_OUT result ) modelPosition.z = dot4( matZ, vertex.position ); modelPosition.w = 1.0; - result.position.x = dot4( modelPosition, rpMVPmatrixX ); - result.position.y = dot4( modelPosition, rpMVPmatrixY ); - result.position.z = dot4( modelPosition, rpMVPmatrixZ ); - result.position.w = dot4( modelPosition, rpMVPmatrixW ); + result.position.x = dot4( modelPosition, pc.rpMVPmatrixX ); + result.position.y = dot4( modelPosition, pc.rpMVPmatrixY ); + result.position.z = dot4( modelPosition, pc.rpMVPmatrixZ ); + result.position.w = dot4( modelPosition, pc.rpMVPmatrixW ); result.texcoord0 = vertex.texcoord.xy; - float4 toEye = rpLocalViewOrigin - modelPosition; + float4 toEye = pc.rpLocalViewOrigin - modelPosition; - result.texcoord1.x = dot3( toEye, rpModelMatrixX ); - result.texcoord1.y = dot3( toEye, rpModelMatrixY ); - result.texcoord1.z = dot3( toEye, rpModelMatrixZ ); + result.texcoord1.x = dot3( toEye, pc.rpModelMatrixX ); + result.texcoord1.y = dot3( toEye, pc.rpModelMatrixY ); + result.texcoord1.z = dot3( toEye, pc.rpModelMatrixZ ); - result.texcoord2.x = dot3( tangent, rpModelMatrixX ); - result.texcoord3.x = dot3( tangent, rpModelMatrixY ); - result.texcoord4.x = dot3( tangent, rpModelMatrixZ ); + result.texcoord2.x = dot3( tangent, pc.rpModelMatrixX ); + result.texcoord3.x = dot3( tangent, pc.rpModelMatrixY ); + result.texcoord4.x = dot3( tangent, pc.rpModelMatrixZ ); - result.texcoord2.y = dot3( binormal, rpModelMatrixX ); - result.texcoord3.y = dot3( binormal, rpModelMatrixY ); - result.texcoord4.y = dot3( binormal, rpModelMatrixZ ); + result.texcoord2.y = dot3( binormal, pc.rpModelMatrixX ); + result.texcoord3.y = dot3( binormal, pc.rpModelMatrixY ); + result.texcoord4.y = dot3( binormal, pc.rpModelMatrixZ ); - result.texcoord2.z = dot3( normal, rpModelMatrixX ); - result.texcoord3.z = dot3( normal, rpModelMatrixY ); - result.texcoord4.z = dot3( normal, rpModelMatrixZ ); + result.texcoord2.z = dot3( normal, pc.rpModelMatrixX ); + result.texcoord3.z = dot3( normal, pc.rpModelMatrixY ); + result.texcoord4.z = dot3( normal, pc.rpModelMatrixZ ); #else float4 normal = vertex.normal * 2.0 - 1.0; float4 tangent = vertex.tangent * 2.0 - 1.0; float3 binormal = cross( normal.xyz, tangent.xyz ) * tangent.w; - result.position.x = dot4( vertex.position, rpMVPmatrixX ); - result.position.y = dot4( vertex.position, rpMVPmatrixY ); - result.position.z = dot4( vertex.position, rpMVPmatrixZ ); - result.position.w = dot4( vertex.position, rpMVPmatrixW ); + result.position.x = dot4( vertex.position, pc.rpMVPmatrixX ); + result.position.y = dot4( vertex.position, pc.rpMVPmatrixY ); + result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); + result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); result.texcoord0 = vertex.texcoord.xy; - float4 toEye = rpLocalViewOrigin - vertex.position; + float4 toEye = pc.rpLocalViewOrigin - vertex.position; - result.texcoord1.x = dot3( toEye, rpModelMatrixX ); - result.texcoord1.y = dot3( toEye, rpModelMatrixY ); - result.texcoord1.z = dot3( toEye, rpModelMatrixZ ); + result.texcoord1.x = dot3( toEye, pc.rpModelMatrixX ); + result.texcoord1.y = dot3( toEye, pc.rpModelMatrixY ); + result.texcoord1.z = dot3( toEye, pc.rpModelMatrixZ ); - result.texcoord2.x = dot3( tangent, rpModelMatrixX ); - result.texcoord3.x = dot3( tangent, rpModelMatrixY ); - result.texcoord4.x = dot3( tangent, rpModelMatrixZ ); + result.texcoord2.x = dot3( tangent, pc.rpModelMatrixX ); + result.texcoord3.x = dot3( tangent, pc.rpModelMatrixY ); + result.texcoord4.x = dot3( tangent, pc.rpModelMatrixZ ); - result.texcoord2.y = dot3( binormal, rpModelMatrixX ); - result.texcoord3.y = dot3( binormal, rpModelMatrixY ); - result.texcoord4.y = dot3( binormal, rpModelMatrixZ ); + result.texcoord2.y = dot3( binormal, pc.rpModelMatrixX ); + result.texcoord3.y = dot3( binormal, pc.rpModelMatrixY ); + result.texcoord4.y = dot3( binormal, pc.rpModelMatrixZ ); - result.texcoord2.z = dot3( normal, rpModelMatrixX ); - result.texcoord3.z = dot3( normal, rpModelMatrixY ); - result.texcoord4.z = dot3( normal, rpModelMatrixZ ); + result.texcoord2.z = dot3( normal, pc.rpModelMatrixX ); + result.texcoord3.z = dot3( normal, pc.rpModelMatrixY ); + result.texcoord4.z = dot3( normal, pc.rpModelMatrixZ ); #endif - result.color = rpColor; + result.color = pc.rpColor; } diff --git a/neo/shaders/builtin/legacy/environment.ps.hlsl b/neo/shaders/builtin/legacy/environment.ps.hlsl index a31f56f86c..bc5bcfd362 100644 --- a/neo/shaders/builtin/legacy/environment.ps.hlsl +++ b/neo/shaders/builtin/legacy/environment.ps.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet0.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/builtin/legacy/environment.vs.hlsl b/neo/shaders/builtin/legacy/environment.vs.hlsl index 4cb9f31c39..68a98c9e33 100644 --- a/neo/shaders/builtin/legacy/environment.vs.hlsl +++ b/neo/shaders/builtin/legacy/environment.vs.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet0.inc.hlsl" // *INDENT-OFF* #if USE_GPU_SKINNING @@ -100,26 +101,26 @@ void main( VS_IN vertex, out VS_OUT result ) modelPosition.z = dot4( matZ, vertex.position ); modelPosition.w = 1.0; - result.position.x = dot4( modelPosition, rpMVPmatrixX ); - result.position.y = dot4( modelPosition, rpMVPmatrixY ); - result.position.z = dot4( modelPosition, rpMVPmatrixZ ); - result.position.w = dot4( modelPosition, rpMVPmatrixW ); + result.position.x = dot4( modelPosition, pc.rpMVPmatrixX ); + result.position.y = dot4( modelPosition, pc.rpMVPmatrixY ); + result.position.z = dot4( modelPosition, pc.rpMVPmatrixZ ); + result.position.w = dot4( modelPosition, pc.rpMVPmatrixW ); - float4 toEye = rpLocalViewOrigin - modelPosition; + float4 toEye = pc.rpLocalViewOrigin - modelPosition; result.texcoord0 = toEye.xyz; result.texcoord1 = vNormalSkinned.xyz; #else - result.position.x = dot4( vertex.position, rpMVPmatrixX ); - result.position.y = dot4( vertex.position, rpMVPmatrixY ); - result.position.z = dot4( vertex.position, rpMVPmatrixZ ); - result.position.w = dot4( vertex.position, rpMVPmatrixW ); + result.position.x = dot4( vertex.position, pc.rpMVPmatrixX ); + result.position.y = dot4( vertex.position, pc.rpMVPmatrixY ); + result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); + result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); - float4 toEye = rpLocalViewOrigin - vertex.position; + float4 toEye = pc.rpLocalViewOrigin - vertex.position; result.texcoord0 = toEye.xyz; result.texcoord1 = vNormal.xyz; #endif - result.color = sRGBAToLinearRGBA( rpColor ); + result.color = sRGBAToLinearRGBA( pc.rpColor ); } diff --git a/neo/shaders/builtin/legacy/skybox.ps.hlsl b/neo/shaders/builtin/legacy/skybox.ps.hlsl index 60da70f444..ec281eaca2 100644 --- a/neo/shaders/builtin/legacy/skybox.ps.hlsl +++ b/neo/shaders/builtin/legacy/skybox.ps.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet0.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/builtin/legacy/skybox.vs.hlsl b/neo/shaders/builtin/legacy/skybox.vs.hlsl index b642b04d1f..6bcd75628b 100644 --- a/neo/shaders/builtin/legacy/skybox.vs.hlsl +++ b/neo/shaders/builtin/legacy/skybox.vs.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet0.inc.hlsl" // *INDENT-OFF* @@ -49,12 +50,12 @@ struct VS_OUT { void main( VS_IN vertex, out VS_OUT result ) { - result.position.x = dot4( vertex.position, rpMVPmatrixX ); - result.position.y = dot4( vertex.position, rpMVPmatrixY ); - result.position.z = dot4( vertex.position, rpMVPmatrixZ ); - result.position.w = dot4( vertex.position, rpMVPmatrixW ); + result.position.x = dot4( vertex.position, pc.rpMVPmatrixX ); + result.position.y = dot4( vertex.position, pc.rpMVPmatrixY ); + result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); + result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); - result.texcoord0 = vertex.position.xyz - rpLocalViewOrigin.xyz; + result.texcoord0 = vertex.position.xyz - pc.rpLocalViewOrigin.xyz; - result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd; + result.color = ( swizzleColor( vertex.color ) * pc.rpVertexColorModulate ) + pc.rpVertexColorAdd; } diff --git a/neo/shaders/builtin/legacy/wobblesky.ps.hlsl b/neo/shaders/builtin/legacy/wobblesky.ps.hlsl index 4f7b0d958f..f822e25b57 100644 --- a/neo/shaders/builtin/legacy/wobblesky.ps.hlsl +++ b/neo/shaders/builtin/legacy/wobblesky.ps.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet5.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/builtin/legacy/wobblesky.vs.hlsl b/neo/shaders/builtin/legacy/wobblesky.vs.hlsl index be44c45979..df25b9d9fa 100644 --- a/neo/shaders/builtin/legacy/wobblesky.vs.hlsl +++ b/neo/shaders/builtin/legacy/wobblesky.vs.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet5.inc.hlsl" // *INDENT-OFF* @@ -50,15 +51,15 @@ struct VS_OUT void main( VS_IN vertex, out VS_OUT result ) { - result.position.x = dot4( vertex.position, rpMVPmatrixX ); - result.position.y = dot4( vertex.position, rpMVPmatrixY ); - result.position.z = dot4( vertex.position, rpMVPmatrixZ ); - result.position.w = dot4( vertex.position, rpMVPmatrixW ); + result.position.x = dot4( vertex.position, pc.rpMVPmatrixX ); + result.position.y = dot4( vertex.position, pc.rpMVPmatrixY ); + result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); + result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); - float3 t0 = vertex.position.xyz - rpLocalViewOrigin.xyz; - result.texcoord0.x = dot3( t0, rpWobbleSkyX ); - result.texcoord0.y = dot3( t0, rpWobbleSkyY ); - result.texcoord0.z = dot3( t0, rpWobbleSkyZ ); + float3 t0 = vertex.position.xyz - pc.rpLocalViewOrigin.xyz; + result.texcoord0.x = dot3( t0, pc.rpWobbleSkyX ); + result.texcoord0.y = dot3( t0, pc.rpWobbleSkyY ); + result.texcoord0.z = dot3( t0, pc.rpWobbleSkyZ ); - result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd; + result.color = ( swizzleColor( vertex.color ) * pc.rpVertexColorModulate ) + pc.rpVertexColorAdd; } diff --git a/neo/shaders/builtin/lighting/ambient_lightgrid_IBL.ps.hlsl b/neo/shaders/builtin/lighting/ambient_lightgrid_IBL.ps.hlsl index b700b79468..04daae35b8 100644 --- a/neo/shaders/builtin/lighting/ambient_lightgrid_IBL.ps.hlsl +++ b/neo/shaders/builtin/lighting/ambient_lightgrid_IBL.ps.hlsl @@ -1,4 +1,4 @@ -/* +/* =========================================================================== Doom 3 BFG Edition GPL Source Code @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet8.inc.hlsl" #include "BRDF.inc.hlsl" @@ -150,7 +151,7 @@ void main( PS_IN fragment, out PS_OUT result ) float3 globalPosition = fragment.texcoord7.xyz; - float3 globalView = normalize( rpGlobalEyePos.xyz - globalPosition ); + float3 globalView = normalize( pc.rpGlobalEyePos.xyz - globalPosition ); float3 reflectionVector = globalNormal * dot3( globalView, globalNormal ); reflectionVector = normalize( ( reflectionVector * 2.0f ) - globalView ); @@ -159,13 +160,13 @@ void main( PS_IN fragment, out PS_OUT result ) // parallax box correction using portal area bounds float hitScale = 0.0; float3 bounds[2]; - bounds[0].x = rpWobbleSkyX.x; - bounds[0].y = rpWobbleSkyX.y; - bounds[0].z = rpWobbleSkyX.z; + bounds[0].x = pc.rpWobbleSkyX.x; + bounds[0].y = pc.rpWobbleSkyX.y; + bounds[0].z = pc.rpWobbleSkyX.z; - bounds[1].x = rpWobbleSkyY.x; - bounds[1].y = rpWobbleSkyY.y; - bounds[1].z = rpWobbleSkyY.z; + bounds[1].x = pc.rpWobbleSkyY.x; + bounds[1].y = pc.rpWobbleSkyY.y; + bounds[1].z = pc.rpWobbleSkyY.z; // global fragment position float3 rayStart = fragment.texcoord7.xyz; @@ -174,12 +175,12 @@ void main( PS_IN fragment, out PS_OUT result ) rayStart += reflectionVector * 10000.0; // only do a box <-> ray intersection test if we use a local cubemap - if( ( rpWobbleSkyX.w > 0.0 ) && AABBRayIntersection( bounds, rayStart, -reflectionVector, hitScale ) ) + if( ( pc.rpWobbleSkyX.w > 0.0 ) && AABBRayIntersection( bounds, rayStart, -reflectionVector, hitScale ) ) { float3 hitPoint = rayStart - reflectionVector * hitScale; - // rpWobbleSkyZ is cubemap center - reflectionVector = hitPoint - rpWobbleSkyZ.xyz; + // pc.rpWobbleSkyZ is cubemap center + reflectionVector = hitPoint - pc.rpWobbleSkyZ.xyz; } #endif @@ -233,7 +234,7 @@ void main( PS_IN fragment, out PS_OUT result ) // calculate the screen texcoord in the 0.0 to 1.0 range //float2 screenTexCoord = vposToScreenPosTexCoord( fragment.position.xy ); - float2 screenTexCoord = fragment.position.xy * rpWindowCoord.xy; + float2 screenTexCoord = fragment.position.xy * pc.rpWindowCoord.xy; float ao = 1.0; ao = t_Ssao.Sample( s_LinearClamp, screenTexCoord ).r; @@ -251,9 +252,9 @@ void main( PS_IN fragment, out PS_OUT result ) //float3 lightGridSize = float3( 64.0, 64.0, 128.0 ); //int3 lightGridBounds = int3( 7, 7, 3 ); - float3 lightGridOrigin = rpGlobalLightOrigin.xyz; - float3 lightGridSize = rpJitterTexScale.xyz; - int3 lightGridBounds = int3( rpJitterTexOffset.x, rpJitterTexOffset.y, rpJitterTexOffset.z ); + float3 lightGridOrigin = pc.rpGlobalLightOrigin.xyz; + float3 lightGridSize = pc.rpJitterTexScale.xyz; + int3 lightGridBounds = int3( pc.rpJitterTexOffset.x, pc.rpJitterTexOffset.y, pc.rpJitterTexOffset.z ); float invXZ = ( 1.0 / ( lightGridBounds[0] * lightGridBounds[2] ) ); float invY = ( 1.0 / lightGridBounds[1] ); @@ -348,16 +349,16 @@ void main( PS_IN fragment, out PS_OUT result ) // offset by one pixel border bleed size for linear filtering #if 1 - // rpScreenCorrectionFactor.w = probeSize factor accounting account offset border, e.g = ( 16 / 18 ) = 0.8888 - float2 octCoordNormalizedToTextureDimensions = ( normalizedOctCoordZeroOne + atlasOffset ) * rpScreenCorrectionFactor.w; + // pc.rpScreenCorrectionFactor.w = probeSize factor accounting account offset border, e.g = ( 16 / 18 ) = 0.8888 + float2 octCoordNormalizedToTextureDimensions = ( normalizedOctCoordZeroOne + atlasOffset ) * pc.rpScreenCorrectionFactor.w; // skip by default 2 pixels for each grid cell and offset the start position by (1,1) - // rpScreenCorrectionFactor.z = borderSize e.g = 2 + // pc.rpScreenCorrectionFactor.z = borderSize e.g = 2 float2 probeTopLeftPosition; - probeTopLeftPosition.x = ( gridCoord2[0] * gridStep[0] + gridCoord2[2] * gridStep[1] ) * rpScreenCorrectionFactor.z + rpScreenCorrectionFactor.z * 0.5; - probeTopLeftPosition.y = ( gridCoord2[1] ) * rpScreenCorrectionFactor.z + rpScreenCorrectionFactor.z * 0.5; + probeTopLeftPosition.x = ( gridCoord2[0] * gridStep[0] + gridCoord2[2] * gridStep[1] ) * pc.rpScreenCorrectionFactor.z + pc.rpScreenCorrectionFactor.z * 0.5; + probeTopLeftPosition.y = ( gridCoord2[1] ) * pc.rpScreenCorrectionFactor.z + pc.rpScreenCorrectionFactor.z * 0.5; - float2 normalizedProbeTopLeftPosition = probeTopLeftPosition * rpCascadeDistances.zw; + float2 normalizedProbeTopLeftPosition = probeTopLeftPosition * pc.rpCascadeDistances.zw; float2 atlasCoord = normalizedProbeTopLeftPosition + octCoordNormalizedToTextureDimensions; #else @@ -386,7 +387,7 @@ void main( PS_IN fragment, out PS_OUT result ) // lightgrid atlas - float3 diffuseLight = ( kD * irradiance * diffuseColor ) * ao * ( rpDiffuseModifier.xyz * 1.0 ); + float3 diffuseLight = ( kD * irradiance * diffuseColor ) * ao * ( pc.rpDiffuseModifier.xyz * 1.0 ); // evaluate specular IBL @@ -400,9 +401,9 @@ void main( PS_IN fragment, out PS_OUT result ) normalizedOctCoord = octEncode( reflectionVector ); normalizedOctCoordZeroOne = ( normalizedOctCoord + float2( 1.0, 1.0 ) ) * 0.5; - float3 radiance = t_RadianceCubeMap1.SampleLevel( s_LinearClamp, normalizedOctCoordZeroOne, mip ).rgb * rpLocalLightOrigin.x; - radiance += t_RadianceCubeMap2.SampleLevel( s_LinearClamp, normalizedOctCoordZeroOne, mip ).rgb * rpLocalLightOrigin.y; - radiance += t_RadianceCubeMap3.SampleLevel( s_LinearClamp, normalizedOctCoordZeroOne, mip ).rgb * rpLocalLightOrigin.z; + float3 radiance = t_RadianceCubeMap1.SampleLevel( s_LinearClamp, normalizedOctCoordZeroOne, mip ).rgb * pc.rpLocalLightOrigin.x; + radiance += t_RadianceCubeMap2.SampleLevel( s_LinearClamp, normalizedOctCoordZeroOne, mip ).rgb * pc.rpLocalLightOrigin.y; + radiance += t_RadianceCubeMap3.SampleLevel( s_LinearClamp, normalizedOctCoordZeroOne, mip ).rgb * pc.rpLocalLightOrigin.z; //radiance = float3( 0.0 ); float2 envBRDF = t_BrdfLut.Sample( s_LinearClamp, float2( max( vDotN, 0.0 ), roughness ) ).rg; @@ -414,7 +415,7 @@ void main( PS_IN fragment, out PS_OUT result ) #endif float specAO = ComputeSpecularAO( vDotN, ao, roughness ); - float3 specularLight = radiance * ( kS * envBRDF.x + envBRDF.y ) * specAO * ( rpSpecularModifier.xyz * 1.0 ); + float3 specularLight = radiance * ( kS * envBRDF.x + envBRDF.y ) * specAO * ( pc.rpSpecularModifier.xyz * 1.0 ); #if 1 // Marmoset Horizon Fade trick @@ -424,8 +425,8 @@ void main( PS_IN fragment, out PS_OUT result ) //horiz = clamp( horiz, 0.0, 1.0 ); #endif - //half3 lightColor = sRGBToLinearRGB( rpAmbientColor.rgb ); - half3 lightColor = ( rpAmbientColor.rgb ); + //half3 lightColor = sRGBToLinearRGB( pc.rpAmbientColor.rgb ); + half3 lightColor = ( pc.rpAmbientColor.rgb ); //result.color.rgb = diffuseLight; //result.color.rgb = diffuseLight * lightColor; diff --git a/neo/shaders/builtin/lighting/ambient_lightgrid_IBL.vs.hlsl b/neo/shaders/builtin/lighting/ambient_lightgrid_IBL.vs.hlsl index c1246f1f9e..1848735ce4 100644 --- a/neo/shaders/builtin/lighting/ambient_lightgrid_IBL.vs.hlsl +++ b/neo/shaders/builtin/lighting/ambient_lightgrid_IBL.vs.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet8.inc.hlsl" // *INDENT-OFF* @@ -130,10 +131,10 @@ void main( VS_IN vertex, out VS_OUT result ) float3 bitangent = vBitangent.xyz; #endif - result.position.x = dot4( modelPosition, rpMVPmatrixX ); - result.position.y = dot4( modelPosition, rpMVPmatrixY ); - result.position.z = dot4( modelPosition, rpMVPmatrixZ ); - result.position.w = dot4( modelPosition, rpMVPmatrixW ); + result.position.x = dot4( modelPosition, pc.rpMVPmatrixX ); + result.position.y = dot4( modelPosition, pc.rpMVPmatrixY ); + result.position.z = dot4( modelPosition, pc.rpMVPmatrixZ ); + result.position.w = dot4( modelPosition, pc.rpMVPmatrixW ); float4 defaultTexCoord = float4( 0.0f, 0.5f, 0.0f, 1.0f ); @@ -142,45 +143,45 @@ void main( VS_IN vertex, out VS_OUT result ) //# textures 0 takes the base coordinates by the texture matrix result.texcoord0 = defaultTexCoord; - result.texcoord0.x = dot4( vertex.texcoord.xy, rpBumpMatrixS ); - result.texcoord0.y = dot4( vertex.texcoord.xy, rpBumpMatrixT ); + result.texcoord0.x = dot4( vertex.texcoord.xy, pc.rpBumpMatrixS ); + result.texcoord0.y = dot4( vertex.texcoord.xy, pc.rpBumpMatrixT ); //# textures 1 takes the base coordinates by the texture matrix result.texcoord1 = defaultTexCoord; - result.texcoord1.x = dot4( vertex.texcoord.xy, rpDiffuseMatrixS ); - result.texcoord1.y = dot4( vertex.texcoord.xy, rpDiffuseMatrixT ); + result.texcoord1.x = dot4( vertex.texcoord.xy, pc.rpDiffuseMatrixS ); + result.texcoord1.y = dot4( vertex.texcoord.xy, pc.rpDiffuseMatrixT ); //# textures 2 takes the base coordinates by the texture matrix result.texcoord2 = defaultTexCoord; - result.texcoord2.x = dot4( vertex.texcoord.xy, rpSpecularMatrixS ); - result.texcoord2.y = dot4( vertex.texcoord.xy, rpSpecularMatrixT ); + result.texcoord2.x = dot4( vertex.texcoord.xy, pc.rpSpecularMatrixS ); + result.texcoord2.y = dot4( vertex.texcoord.xy, pc.rpSpecularMatrixT ); //# calculate normalized vector to viewer in R1 //result.texcoord3 = modelPosition; - float4 toEye = normalize( rpLocalViewOrigin - modelPosition ); + float4 toEye = normalize( pc.rpLocalViewOrigin - modelPosition ); - result.texcoord3.x = dot3( toEye, rpModelMatrixX ); - result.texcoord3.y = dot3( toEye, rpModelMatrixY ); - result.texcoord3.z = dot3( toEye, rpModelMatrixZ ); + result.texcoord3.x = dot3( toEye, pc.rpModelMatrixX ); + result.texcoord3.y = dot3( toEye, pc.rpModelMatrixY ); + result.texcoord3.z = dot3( toEye, pc.rpModelMatrixZ ); - result.texcoord4.x = dot3( tangent, rpModelMatrixX ); - result.texcoord5.x = dot3( tangent, rpModelMatrixY ); - result.texcoord6.x = dot3( tangent, rpModelMatrixZ ); + result.texcoord4.x = dot3( tangent, pc.rpModelMatrixX ); + result.texcoord5.x = dot3( tangent, pc.rpModelMatrixY ); + result.texcoord6.x = dot3( tangent, pc.rpModelMatrixZ ); - result.texcoord4.y = dot3( bitangent, rpModelMatrixX ); - result.texcoord5.y = dot3( bitangent, rpModelMatrixY ); - result.texcoord6.y = dot3( bitangent, rpModelMatrixZ ); + result.texcoord4.y = dot3( bitangent, pc.rpModelMatrixX ); + result.texcoord5.y = dot3( bitangent, pc.rpModelMatrixY ); + result.texcoord6.y = dot3( bitangent, pc.rpModelMatrixZ ); - result.texcoord4.z = dot3( normal, rpModelMatrixX ); - result.texcoord5.z = dot3( normal, rpModelMatrixY ); - result.texcoord6.z = dot3( normal, rpModelMatrixZ ); + result.texcoord4.z = dot3( normal, pc.rpModelMatrixX ); + result.texcoord5.z = dot3( normal, pc.rpModelMatrixY ); + result.texcoord6.z = dot3( normal, pc.rpModelMatrixZ ); float4 worldPosition; - worldPosition.x = dot4( modelPosition, rpModelMatrixX ); - worldPosition.y = dot4( modelPosition, rpModelMatrixY ); - worldPosition.z = dot4( modelPosition, rpModelMatrixZ ); - worldPosition.w = dot4( modelPosition, rpModelMatrixW ); + worldPosition.x = dot4( modelPosition, pc.rpModelMatrixX ); + worldPosition.y = dot4( modelPosition, pc.rpModelMatrixY ); + worldPosition.z = dot4( modelPosition, pc.rpModelMatrixZ ); + worldPosition.w = dot4( modelPosition, pc.rpModelMatrixW ); result.texcoord7 = worldPosition; #if USE_GPU_SKINNING @@ -193,6 +194,6 @@ void main( VS_IN vertex, out VS_OUT result ) //# for 1.0 : env[16] = 0, env[17] = 1 //# for color : env[16] = 1, env[17] = 0 //# for 1.0-color : env[16] = -1, env[17] = 1 - result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd; + result.color = ( swizzleColor( vertex.color ) * pc.rpVertexColorModulate ) + pc.rpVertexColorAdd; #endif -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/lighting/ambient_lighting_IBL.ps.hlsl b/neo/shaders/builtin/lighting/ambient_lighting_IBL.ps.hlsl index 589e7ed376..18fc1c6e3e 100644 --- a/neo/shaders/builtin/lighting/ambient_lighting_IBL.ps.hlsl +++ b/neo/shaders/builtin/lighting/ambient_lighting_IBL.ps.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet8.inc.hlsl" #include "BRDF.inc.hlsl" @@ -133,11 +134,11 @@ float2 OctTexCoord( float3 worldDir ) // offset by one pixel border bleed size for linear filtering #if 0 - // texcoord sizes in rpCascadeDistances are not valid - float2 octCoordNormalizedToTextureDimensions = ( normalizedOctCoordZeroOne * ( rpCascadeDistances.x - float( 2.0 ) ) ) / rpCascadeDistances.xy; + // texcoord sizes in pc.rpCascadeDistances are not valid + float2 octCoordNormalizedToTextureDimensions = ( normalizedOctCoordZeroOne * ( pc.rpCascadeDistances.x - float( 2.0 ) ) ) / pc.rpCascadeDistances.xy; float2 probeTopLeftPosition = float2( 1.0, 1.0 ); - float2 normalizedProbeTopLeftPosition = probeTopLeftPosition * rpCascadeDistances.zw; + float2 normalizedProbeTopLeftPosition = probeTopLeftPosition * pc.rpCascadeDistances.zw; normalizedOctCoordZeroOne.xy = normalizedProbeTopLeftPosition + octCoordNormalizedToTextureDimensions; #endif @@ -171,7 +172,7 @@ void main( PS_IN fragment, out PS_OUT result ) float3 globalPosition = fragment.texcoord7.xyz; - float3 globalView = normalize( rpGlobalEyePos.xyz - globalPosition ); + float3 globalView = normalize( pc.rpGlobalEyePos.xyz - globalPosition ); float3 reflectionVector = globalNormal * dot3( globalView, globalNormal ); reflectionVector = normalize( ( reflectionVector * 2.0f ) - globalView ); @@ -180,13 +181,13 @@ void main( PS_IN fragment, out PS_OUT result ) // parallax box correction using portal area bounds float hitScale = 0.0; float3 bounds[2]; - bounds[0].x = rpWobbleSkyX.x; - bounds[0].y = rpWobbleSkyX.y; - bounds[0].z = rpWobbleSkyX.z; + bounds[0].x = pc.rpWobbleSkyX.x; + bounds[0].y = pc.rpWobbleSkyX.y; + bounds[0].z = pc.rpWobbleSkyX.z; - bounds[1].x = rpWobbleSkyY.x; - bounds[1].y = rpWobbleSkyY.y; - bounds[1].z = rpWobbleSkyY.z; + bounds[1].x = pc.rpWobbleSkyY.x; + bounds[1].y = pc.rpWobbleSkyY.y; + bounds[1].z = pc.rpWobbleSkyY.z; // global fragment position float3 rayStart = fragment.texcoord7.xyz; @@ -195,12 +196,12 @@ void main( PS_IN fragment, out PS_OUT result ) rayStart += reflectionVector * 10000.0; // only do a box <-> ray intersection test if we use a local cubemap - if( ( rpWobbleSkyX.w > 0.0 ) && AABBRayIntersection( bounds, rayStart, -reflectionVector, hitScale ) ) + if( ( pc.rpWobbleSkyX.w > 0.0 ) && AABBRayIntersection( bounds, rayStart, -reflectionVector, hitScale ) ) { float3 hitPoint = rayStart - reflectionVector * hitScale; - // rpWobbleSkyZ is cubemap center - reflectionVector = hitPoint - rpWobbleSkyZ.xyz; + // pc.rpWobbleSkyZ is cubemap center + reflectionVector = hitPoint - pc.rpWobbleSkyZ.xyz; } #endif @@ -254,7 +255,7 @@ void main( PS_IN fragment, out PS_OUT result ) // calculate the screen texcoord in the 0.0 to 1.0 range //float2 screenTexCoord = vposToScreenPosTexCoord( fragment.position.xy ); - float2 screenTexCoord = fragment.position.xy * rpWindowCoord.xy; + float2 screenTexCoord = fragment.position.xy * pc.rpWindowCoord.xy; float ao = 1.0; ao = t_Ssao.Sample( s_LinearClamp, screenTexCoord ).r; @@ -266,7 +267,7 @@ void main( PS_IN fragment, out PS_OUT result ) float2 normalizedOctCoordZeroOne = OctTexCoord( globalNormal ); float3 irradiance = t_IrradianceCubeMap.Sample( s_LinearClamp, normalizedOctCoordZeroOne ).rgb; - float3 diffuseLight = ( kD * irradiance * diffuseColor ) * ao * ( rpDiffuseModifier.xyz * 1.0 ); + float3 diffuseLight = ( kD * irradiance * diffuseColor ) * ao * ( pc.rpDiffuseModifier.xyz * 1.0 ); // evaluate specular IBL @@ -279,9 +280,9 @@ void main( PS_IN fragment, out PS_OUT result ) normalizedOctCoordZeroOne = OctTexCoord( reflectionVector ); - float3 radiance = t_RadianceCubeMap1.SampleLevel( s_LinearClamp, normalizedOctCoordZeroOne, mip ).rgb * rpLocalLightOrigin.x; - radiance += t_RadianceCubeMap2.SampleLevel( s_LinearClamp, normalizedOctCoordZeroOne, mip ).rgb * rpLocalLightOrigin.y; - radiance += t_RadianceCubeMap3.SampleLevel( s_LinearClamp, normalizedOctCoordZeroOne, mip ).rgb * rpLocalLightOrigin.z; + float3 radiance = t_RadianceCubeMap1.SampleLevel( s_LinearClamp, normalizedOctCoordZeroOne, mip ).rgb * pc.rpLocalLightOrigin.x; + radiance += t_RadianceCubeMap2.SampleLevel( s_LinearClamp, normalizedOctCoordZeroOne, mip ).rgb * pc.rpLocalLightOrigin.y; + radiance += t_RadianceCubeMap3.SampleLevel( s_LinearClamp, normalizedOctCoordZeroOne, mip ).rgb * pc.rpLocalLightOrigin.z; //radiance = float3( 0.0 ); float2 envBRDF = t_BrdfLut.Sample( s_LinearClamp, float2( max( vDotN, 0.0 ), roughness ) ).rg; @@ -293,7 +294,7 @@ void main( PS_IN fragment, out PS_OUT result ) #endif float specAO = ComputeSpecularAO( vDotN, ao, roughness ); - float3 specularLight = radiance * ( kS * envBRDF.x + envBRDF.y ) * specAO * ( rpSpecularModifier.xyz * 1.0 ); + float3 specularLight = radiance * ( kS * envBRDF.x + envBRDF.y ) * specAO * ( pc.rpSpecularModifier.xyz * 1.0 ); #if 1 // Marmoset Horizon Fade trick @@ -303,8 +304,8 @@ void main( PS_IN fragment, out PS_OUT result ) //horiz = clamp( horiz, 0.0, 1.0 ); #endif - //half3 lightColor = sRGBToLinearRGB( rpAmbientColor.rgb ); - half3 lightColor = ( rpAmbientColor.rgb ); + //half3 lightColor = sRGBToLinearRGB( pc.rpAmbientColor.rgb ); + half3 lightColor = ( pc.rpAmbientColor.rgb ); //result.color.rgb = diffuseLight; //result.color.rgb = diffuseLight * lightColor; diff --git a/neo/shaders/builtin/lighting/ambient_lighting_IBL.vs.hlsl b/neo/shaders/builtin/lighting/ambient_lighting_IBL.vs.hlsl index 28befa53a7..5a07ef5ac2 100644 --- a/neo/shaders/builtin/lighting/ambient_lighting_IBL.vs.hlsl +++ b/neo/shaders/builtin/lighting/ambient_lighting_IBL.vs.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet8.inc.hlsl" // *INDENT-OFF* @@ -130,15 +131,15 @@ void main( VS_IN vertex, out VS_OUT result ) float3 bitangent = vBitangent.xyz; #endif - result.position.x = dot4( modelPosition, rpMVPmatrixX ); - result.position.y = dot4( modelPosition, rpMVPmatrixY ); - result.position.z = dot4( modelPosition, rpMVPmatrixZ ); - result.position.w = dot4( modelPosition, rpMVPmatrixW ); + result.position.x = dot4( modelPosition, pc.rpMVPmatrixX ); + result.position.y = dot4( modelPosition, pc.rpMVPmatrixY ); + result.position.z = dot4( modelPosition, pc.rpMVPmatrixZ ); + result.position.w = dot4( modelPosition, pc.rpMVPmatrixW ); float4 defaultTexCoord = float4( 0.0f, 0.5f, 0.0f, 1.0f ); //calculate vector to light - //float4 toLight = rpLocalLightOrigin; + //float4 toLight = pc.rpLocalLightOrigin; float4 toLight = normalize( float4( 0.0f, 0.5f, 1.0f, 1.0f ) ); //-------------------------------------------------------------- @@ -146,45 +147,45 @@ void main( VS_IN vertex, out VS_OUT result ) //# textures 0 takes the base coordinates by the texture matrix result.texcoord0 = defaultTexCoord; - result.texcoord0.x = dot4( vertex.texcoord.xy, rpBumpMatrixS ); - result.texcoord0.y = dot4( vertex.texcoord.xy, rpBumpMatrixT ); + result.texcoord0.x = dot4( vertex.texcoord.xy, pc.rpBumpMatrixS ); + result.texcoord0.y = dot4( vertex.texcoord.xy, pc.rpBumpMatrixT ); //# textures 1 takes the base coordinates by the texture matrix result.texcoord1 = defaultTexCoord; - result.texcoord1.x = dot4( vertex.texcoord.xy, rpDiffuseMatrixS ); - result.texcoord1.y = dot4( vertex.texcoord.xy, rpDiffuseMatrixT ); + result.texcoord1.x = dot4( vertex.texcoord.xy, pc.rpDiffuseMatrixS ); + result.texcoord1.y = dot4( vertex.texcoord.xy, pc.rpDiffuseMatrixT ); //# textures 2 takes the base coordinates by the texture matrix result.texcoord2 = defaultTexCoord; - result.texcoord2.x = dot4( vertex.texcoord.xy, rpSpecularMatrixS ); - result.texcoord2.y = dot4( vertex.texcoord.xy, rpSpecularMatrixT ); + result.texcoord2.x = dot4( vertex.texcoord.xy, pc.rpSpecularMatrixS ); + result.texcoord2.y = dot4( vertex.texcoord.xy, pc.rpSpecularMatrixT ); //# calculate normalized vector to viewer in R1 //result.texcoord3 = modelPosition; - float4 toEye = normalize( rpLocalViewOrigin - modelPosition ); + float4 toEye = normalize( pc.rpLocalViewOrigin - modelPosition ); - result.texcoord3.x = dot3( toEye, rpModelMatrixX ); - result.texcoord3.y = dot3( toEye, rpModelMatrixY ); - result.texcoord3.z = dot3( toEye, rpModelMatrixZ ); + result.texcoord3.x = dot3( toEye, pc.rpModelMatrixX ); + result.texcoord3.y = dot3( toEye, pc.rpModelMatrixY ); + result.texcoord3.z = dot3( toEye, pc.rpModelMatrixZ ); - result.texcoord4.x = dot3( tangent, rpModelMatrixX ); - result.texcoord5.x = dot3( tangent, rpModelMatrixY ); - result.texcoord6.x = dot3( tangent, rpModelMatrixZ ); + result.texcoord4.x = dot3( tangent, pc.rpModelMatrixX ); + result.texcoord5.x = dot3( tangent, pc.rpModelMatrixY ); + result.texcoord6.x = dot3( tangent, pc.rpModelMatrixZ ); - result.texcoord4.y = dot3( bitangent, rpModelMatrixX ); - result.texcoord5.y = dot3( bitangent, rpModelMatrixY ); - result.texcoord6.y = dot3( bitangent, rpModelMatrixZ ); + result.texcoord4.y = dot3( bitangent, pc.rpModelMatrixX ); + result.texcoord5.y = dot3( bitangent, pc.rpModelMatrixY ); + result.texcoord6.y = dot3( bitangent, pc.rpModelMatrixZ ); - result.texcoord4.z = dot3( normal, rpModelMatrixX ); - result.texcoord5.z = dot3( normal, rpModelMatrixY ); - result.texcoord6.z = dot3( normal, rpModelMatrixZ ); + result.texcoord4.z = dot3( normal, pc.rpModelMatrixX ); + result.texcoord5.z = dot3( normal, pc.rpModelMatrixY ); + result.texcoord6.z = dot3( normal, pc.rpModelMatrixZ ); float4 worldPosition; - worldPosition.x = dot4( modelPosition, rpModelMatrixX ); - worldPosition.y = dot4( modelPosition, rpModelMatrixY ); - worldPosition.z = dot4( modelPosition, rpModelMatrixZ ); - worldPosition.w = dot4( modelPosition, rpModelMatrixW ); + worldPosition.x = dot4( modelPosition, pc.rpModelMatrixX ); + worldPosition.y = dot4( modelPosition, pc.rpModelMatrixY ); + worldPosition.z = dot4( modelPosition, pc.rpModelMatrixZ ); + worldPosition.w = dot4( modelPosition, pc.rpModelMatrixW ); result.texcoord7 = worldPosition; #if USE_GPU_SKINNING @@ -197,6 +198,6 @@ void main( VS_IN vertex, out VS_OUT result ) //# for 1.0 : env[16] = 0, env[17] = 1 //# for color : env[16] = 1, env[17] = 0 //# for 1.0-color : env[16] = -1, env[17] = 1 - result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd; + result.color = ( swizzleColor( vertex.color ) * pc.rpVertexColorModulate ) + pc.rpVertexColorAdd; #endif -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/lighting/interaction.ps.hlsl b/neo/shaders/builtin/lighting/interaction.ps.hlsl index 23ea32a0c6..b63652f013 100644 --- a/neo/shaders/builtin/lighting/interaction.ps.hlsl +++ b/neo/shaders/builtin/lighting/interaction.ps.hlsl @@ -1,4 +1,4 @@ -/* +/* =========================================================================== Doom 3 BFG Edition GPL Source Code @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet9.inc.hlsl" #include "BRDF.inc.hlsl" @@ -130,7 +131,7 @@ void main( PS_IN fragment, out PS_OUT result ) // RB: compensate r_lightScale 3 and the division of Pi //lambert *= 1.3; - // rpDiffuseModifier contains light color multiplier + // pc.rpDiffuseModifier contains light color multiplier float3 lightColor = sRGBToLinearRGB( lightProj.xyz * lightFalloff.xyz ); float vdotN = clamp( dot3( viewVector, localNormal ), 0.0, 1.0 ); @@ -138,7 +139,7 @@ void main( PS_IN fragment, out PS_OUT result ) float ldotH = clamp( dot3( lightVector, halfAngleVector ), 0.0, 1.0 ); // compensate r_lightScale 3 * 2 - float3 reflectColor = specularColor * rpSpecularModifier.rgb * 1.0;// * 0.5; + float3 reflectColor = specularColor * pc.rpSpecularModifier.rgb * 1.0;// * 0.5; // cheap approximation by ARM with only one division // http://community.arm.com/servlet/JiveServlet/download/96891546-19496/siggraph2015-mmg-renaldas-slides.pdf @@ -161,8 +162,8 @@ void main( PS_IN fragment, out PS_OUT result ) // see http://seblagarde.wordpress.com/2012/01/08/pi-or-not-to-pi-in-game-lighting-equation/ //lambert /= PI; - //float3 diffuseColor = mix( diffuseMap, F0, metal ) * rpDiffuseModifier.xyz; - float3 diffuseLight = diffuseColor * lambert * ( rpDiffuseModifier.xyz ); + //float3 diffuseColor = mix( diffuseMap, F0, metal ) * pc.rpDiffuseModifier.xyz; + float3 diffuseLight = diffuseColor * lambert * ( pc.rpDiffuseModifier.xyz ); float3 color = ( diffuseLight + specularLight ) * lightColor * fragment.color.rgb; diff --git a/neo/shaders/builtin/lighting/interaction.vs.hlsl b/neo/shaders/builtin/lighting/interaction.vs.hlsl index be528720ed..728f9b753c 100644 --- a/neo/shaders/builtin/lighting/interaction.vs.hlsl +++ b/neo/shaders/builtin/lighting/interaction.vs.hlsl @@ -1,4 +1,4 @@ -/* +/* =========================================================================== Doom 3 BFG Edition GPL Source Code @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet9.inc.hlsl" // *INDENT-OFF* #if USE_GPU_SKINNING @@ -128,15 +129,15 @@ void main( VS_IN vertex, out VS_OUT result ) float3 bitangent = vBitangent.xyz; #endif - result.position.x = dot4( modelPosition, rpMVPmatrixX ); - result.position.y = dot4( modelPosition, rpMVPmatrixY ); - result.position.z = dot4( modelPosition, rpMVPmatrixZ ); - result.position.w = dot4( modelPosition, rpMVPmatrixW ); + result.position.x = dot4( modelPosition, pc.rpMVPmatrixX ); + result.position.y = dot4( modelPosition, pc.rpMVPmatrixY ); + result.position.z = dot4( modelPosition, pc.rpMVPmatrixZ ); + result.position.w = dot4( modelPosition, pc.rpMVPmatrixW ); float4 defaultTexCoord = float4( 0.0f, 0.5f, 0.0f, 1.0f ); //calculate vector to light - float4 toLight = rpLocalLightOrigin - modelPosition; + float4 toLight = pc.rpLocalLightOrigin - modelPosition; //-------------------------------------------------------------- @@ -148,28 +149,28 @@ void main( VS_IN vertex, out VS_OUT result ) //textures 1 takes the base coordinates by the texture matrix result.texcoord1 = defaultTexCoord; - result.texcoord1.x = dot4( vertex.texcoord.xy, rpBumpMatrixS ); - result.texcoord1.y = dot4( vertex.texcoord.xy, rpBumpMatrixT ); + result.texcoord1.x = dot4( vertex.texcoord.xy, pc.rpBumpMatrixS ); + result.texcoord1.y = dot4( vertex.texcoord.xy, pc.rpBumpMatrixT ); //# texture 2 has one texgen result.texcoord2 = defaultTexCoord; - result.texcoord2.x = dot4( modelPosition, rpLightFalloffS ); + result.texcoord2.x = dot4( modelPosition, pc.rpLightFalloffS ); //# texture 3 has three texgens - result.texcoord3.x = dot4( modelPosition, rpLightProjectionS ); - result.texcoord3.y = dot4( modelPosition, rpLightProjectionT ); + result.texcoord3.x = dot4( modelPosition, pc.rpLightProjectionS ); + result.texcoord3.y = dot4( modelPosition, pc.rpLightProjectionT ); result.texcoord3.z = 0.0f; - result.texcoord3.w = dot4( modelPosition, rpLightProjectionQ ); + result.texcoord3.w = dot4( modelPosition, pc.rpLightProjectionQ ); //# textures 4 takes the base coordinates by the texture matrix result.texcoord4 = defaultTexCoord; - result.texcoord4.x = dot4( vertex.texcoord.xy, rpDiffuseMatrixS ); - result.texcoord4.y = dot4( vertex.texcoord.xy, rpDiffuseMatrixT ); + result.texcoord4.x = dot4( vertex.texcoord.xy, pc.rpDiffuseMatrixS ); + result.texcoord4.y = dot4( vertex.texcoord.xy, pc.rpDiffuseMatrixT ); //# textures 5 takes the base coordinates by the texture matrix result.texcoord5 = defaultTexCoord; - result.texcoord5.x = dot4( vertex.texcoord.xy, rpSpecularMatrixS ); - result.texcoord5.y = dot4( vertex.texcoord.xy, rpSpecularMatrixT ); + result.texcoord5.x = dot4( vertex.texcoord.xy, pc.rpSpecularMatrixS ); + result.texcoord5.y = dot4( vertex.texcoord.xy, pc.rpSpecularMatrixT ); //# texture 6's texcoords will be the halfangle in texture space @@ -177,7 +178,7 @@ void main( VS_IN vertex, out VS_OUT result ) toLight = normalize( toLight ); //# calculate normalized vector to viewer in R1 - float4 toView = normalize( rpLocalViewOrigin - modelPosition ); + float4 toView = normalize( pc.rpLocalViewOrigin - modelPosition ); //# put into texture space result.texcoord6.x = dot3( tangent, toView ); @@ -195,6 +196,6 @@ void main( VS_IN vertex, out VS_OUT result ) //# for 1.0 : env[16] = 0, env[17] = 1 //# for color : env[16] = 1, env[17] = 0 //# for 1.0-color : env[16] = -1, env[17] = 1 - result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd; + result.color = ( swizzleColor( vertex.color ) * pc.rpVertexColorModulate ) + pc.rpVertexColorAdd; #endif -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/lighting/interactionAmbient.ps.hlsl b/neo/shaders/builtin/lighting/interactionAmbient.ps.hlsl index 487a482a71..6a1ab655c5 100644 --- a/neo/shaders/builtin/lighting/interactionAmbient.ps.hlsl +++ b/neo/shaders/builtin/lighting/interactionAmbient.ps.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet9.inc.hlsl" // *INDENT-OFF* @@ -101,8 +102,8 @@ void main( PS_IN fragment, out PS_OUT result ) // RB: added abs float3 specularContribution = _float3( pow( abs( hDotN ), specularPower ) ); - float3 diffuseColor = diffuseMap * ( rpDiffuseModifier.xyz ); - float3 specularColor = specMap.xyz * specularContribution * ( rpSpecularModifier.xyz ); + float3 diffuseColor = diffuseMap * ( pc.rpDiffuseModifier.xyz ); + float3 specularColor = specMap.xyz * specularContribution * ( pc.rpSpecularModifier.xyz ); float3 lightColor = sRGBToLinearRGB( lightProj.xyz * lightFalloff.xyz ); result.color.xyz = ( diffuseColor + specularColor ) * lightColor * fragment.color.xyz; diff --git a/neo/shaders/builtin/lighting/interactionAmbient.vs.hlsl b/neo/shaders/builtin/lighting/interactionAmbient.vs.hlsl index 7682eab260..13eb23cb96 100644 --- a/neo/shaders/builtin/lighting/interactionAmbient.vs.hlsl +++ b/neo/shaders/builtin/lighting/interactionAmbient.vs.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet9.inc.hlsl" // *INDENT-OFF* #if USE_GPU_SKINNING @@ -127,40 +128,40 @@ void main( VS_IN vertex, out VS_OUT result ) float3 bitangent = vBitangent.xyz; #endif - result.position.x = dot4( modelPosition, rpMVPmatrixX ); - result.position.y = dot4( modelPosition, rpMVPmatrixY ); - result.position.z = dot4( modelPosition, rpMVPmatrixZ ); - result.position.w = dot4( modelPosition, rpMVPmatrixW ); + result.position.x = dot4( modelPosition, pc.rpMVPmatrixX ); + result.position.y = dot4( modelPosition, pc.rpMVPmatrixY ); + result.position.z = dot4( modelPosition, pc.rpMVPmatrixZ ); + result.position.w = dot4( modelPosition, pc.rpMVPmatrixW ); float4 defaultTexCoord = float4( 0.0f, 0.5f, 0.0f, 1.0f ); //calculate vector to light - float4 toLight = rpLocalLightOrigin - modelPosition; + float4 toLight = pc.rpLocalLightOrigin - modelPosition; //textures 1 takes the base coordinates by the texture matrix result.texcoord1 = defaultTexCoord; - result.texcoord1.x = dot4( vertex.texcoord.xy, rpBumpMatrixS ); - result.texcoord1.y = dot4( vertex.texcoord.xy, rpBumpMatrixT ); + result.texcoord1.x = dot4( vertex.texcoord.xy, pc.rpBumpMatrixS ); + result.texcoord1.y = dot4( vertex.texcoord.xy, pc.rpBumpMatrixT ); //# texture 2 has one texgen result.texcoord2 = defaultTexCoord; - result.texcoord2.x = dot4( modelPosition, rpLightFalloffS ); + result.texcoord2.x = dot4( modelPosition, pc.rpLightFalloffS ); //# texture 3 has three texgens - result.texcoord3.x = dot4( modelPosition, rpLightProjectionS ); - result.texcoord3.y = dot4( modelPosition, rpLightProjectionT ); + result.texcoord3.x = dot4( modelPosition, pc.rpLightProjectionS ); + result.texcoord3.y = dot4( modelPosition, pc.rpLightProjectionT ); result.texcoord3.z = 0.0f; - result.texcoord3.w = dot4( modelPosition, rpLightProjectionQ ); + result.texcoord3.w = dot4( modelPosition, pc.rpLightProjectionQ ); //# textures 4 takes the base coordinates by the texture matrix result.texcoord4 = defaultTexCoord; - result.texcoord4.x = dot4( vertex.texcoord.xy, rpDiffuseMatrixS ); - result.texcoord4.y = dot4( vertex.texcoord.xy, rpDiffuseMatrixT ); + result.texcoord4.x = dot4( vertex.texcoord.xy, pc.rpDiffuseMatrixS ); + result.texcoord4.y = dot4( vertex.texcoord.xy, pc.rpDiffuseMatrixT ); //# textures 5 takes the base coordinates by the texture matrix result.texcoord5 = defaultTexCoord; - result.texcoord5.x = dot4( vertex.texcoord.xy, rpSpecularMatrixS ); - result.texcoord5.y = dot4( vertex.texcoord.xy, rpSpecularMatrixT ); + result.texcoord5.x = dot4( vertex.texcoord.xy, pc.rpSpecularMatrixS ); + result.texcoord5.y = dot4( vertex.texcoord.xy, pc.rpSpecularMatrixT ); //# texture 6's texcoords will be the halfangle in texture space @@ -168,7 +169,7 @@ void main( VS_IN vertex, out VS_OUT result ) toLight = normalize( toLight ); //# calculate normalized vector to viewer in R1 - float4 toView = normalize( rpLocalViewOrigin - modelPosition ); + float4 toView = normalize( pc.rpLocalViewOrigin - modelPosition ); //# add together to become the half angle vector in object space (non-normalized) float4 halfAngleVector = toLight + toView; @@ -189,6 +190,6 @@ void main( VS_IN vertex, out VS_OUT result ) //# for 1.0 : env[16] = 0, env[17] = 1 //# for color : env[16] = 1, env[17] = 0 //# for 1.0-color : env[16] = -1, env[17] = 1 - result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd; + result.color = ( swizzleColor( vertex.color ) * pc.rpVertexColorModulate ) + pc.rpVertexColorAdd; #endif -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/lighting/interactionSM.ps.hlsl b/neo/shaders/builtin/lighting/interactionSM.ps.hlsl index 51af4c1a78..49c581eb34 100644 --- a/neo/shaders/builtin/lighting/interactionSM.ps.hlsl +++ b/neo/shaders/builtin/lighting/interactionSM.ps.hlsl @@ -1,4 +1,4 @@ -/* +/* =========================================================================== Doom 3 BFG Edition GPL Source Code @@ -29,6 +29,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet10.inc.hlsl" #include "BRDF.inc.hlsl" @@ -75,11 +76,11 @@ struct PS_OUT float BlueNoise( float2 n, float x ) { - float2 uv = n.xy * rpJitterTexOffset.xy; + float2 uv = n.xy * pc.rpJitterTexOffset.xy; float noise = t_Jitter.Sample( s_Jitter, uv ).r; - noise = frac( noise + c_goldenRatioConjugate * rpJitterTexOffset.w * x ); + noise = frac( noise + c_goldenRatioConjugate * pc.rpJitterTexOffset.w * x ); //noise = RemapNoiseTriErp( noise ); //noise = noise * 2.0 - 0.5; @@ -172,7 +173,7 @@ void main( PS_IN fragment, out PS_OUT result ) shadowIndex = 4; for( int ci = 0; ci < 4; ci++ ) { - if( viewZ < rpCascadeDistances[ci] ) + if( viewZ < pc.rpCascadeDistances[ci] ) { shadowIndex = ci; break; @@ -210,11 +211,11 @@ void main( PS_IN fragment, out PS_OUT result ) return; #endif - // rpShadowMatrices contain model -> world -> shadow transformation for evaluation - float4 shadowMatrixX = rpShadowMatrices[ int ( shadowIndex * 4 + 0 ) ]; - float4 shadowMatrixY = rpShadowMatrices[ int ( shadowIndex * 4 + 1 ) ]; - float4 shadowMatrixZ = rpShadowMatrices[ int ( shadowIndex * 4 + 2 ) ]; - float4 shadowMatrixW = rpShadowMatrices[ int ( shadowIndex * 4 + 3 ) ]; + // pc.rpShadowMatrices contain model -> world -> shadow transformation for evaluation + float4 shadowMatrixX = pc.rpShadowMatrices[ int ( shadowIndex * 4 + 0 ) ]; + float4 shadowMatrixY = pc.rpShadowMatrices[ int ( shadowIndex * 4 + 1 ) ]; + float4 shadowMatrixZ = pc.rpShadowMatrices[ int ( shadowIndex * 4 + 2 ) ]; + float4 shadowMatrixW = pc.rpShadowMatrices[ int ( shadowIndex * 4 + 3 ) ]; float4 modelPosition = float4( fragment.texcoord7.xyz, 1.0 ); @@ -231,7 +232,7 @@ void main( PS_IN fragment, out PS_OUT result ) shadowTexcoord.xyz /= shadowTexcoord.w; // receiver / occluder terminology like in ESM - float receiver = shadowTexcoord.z * rpScreenCorrectionFactor.w; + float receiver = shadowTexcoord.z * pc.rpScreenCorrectionFactor.w; //shadowTexcoord.z = shadowTexcoord.z * 0.999991; //shadowTexcoord.z = shadowTexcoord.z - bias; shadowTexcoord.w = float( shadowIndex ); @@ -241,7 +242,7 @@ void main( PS_IN fragment, out PS_OUT result ) #if 0 float4 base = shadowTexcoord; - base.xy += rpJitterTexScale.xy * -0.5; + base.xy += pc.rpJitterTexScale.xy * -0.5; float shadow = 0.0; @@ -249,10 +250,10 @@ void main( PS_IN fragment, out PS_OUT result ) float numSamples = 16; float stepSize = 1.0 / numSamples; - float2 jitterTC = ( fragment.position.xy * rpScreenCorrectionFactor.xy ) + rpJitterTexOffset.ww; + float2 jitterTC = ( fragment.position.xy * pc.rpScreenCorrectionFactor.xy ) + pc.rpJitterTexOffset.ww; for( float n = 0.0; n < numSamples; n += 1.0 ) { - float4 jitter = base + t_Jitter.Sample( samp1, jitterTC.xy ) * rpJitterTexScale; + float4 jitter = base + t_Jitter.Sample( samp1, jitterTC.xy ) * pc.rpJitterTexScale; jitter.zw = shadowTexcoord.zw; shadow += t_Jitter.Sample( samp1, jitter.xy / jitter.z ).r; @@ -285,10 +286,10 @@ void main( PS_IN fragment, out PS_OUT result ) float shadow = 0.0; // RB: casting a float to int and using it as index can really kill the performance ... - float numSamples = 12.0; //int(rpScreenCorrectionFactor.w); + float numSamples = 12.0; //int(pc.rpScreenCorrectionFactor.w); float stepSize = 1.0 / numSamples; - float4 jitterTC = ( fragment.position * rpScreenCorrectionFactor ) + rpJitterTexOffset; + float4 jitterTC = ( fragment.position * pc.rpScreenCorrectionFactor ) + pc.rpJitterTexOffset; float4 random = t_Jitter.Sample( s_Jitter, jitterTC.xy ) * PI; //float4 random = fragment.position; @@ -296,7 +297,7 @@ void main( PS_IN fragment, out PS_OUT result ) rot.x = cos( random.x ); rot.y = sin( random.x ); - float shadowTexelSize = rpScreenCorrectionFactor.z * rpJitterTexScale.x; + float shadowTexelSize = pc.rpScreenCorrectionFactor.z * pc.rpJitterTexScale.x; for( int i = 0; i < 12; i++ ) { float2 jitter = poissonDisk[i]; @@ -340,7 +341,7 @@ void main( PS_IN fragment, out PS_OUT result ) float stepSize = 1.0 / numSamples; float random = BlueNoise( fragment.position.xy, 1.0 ); - //float random = InterleavedGradientNoiseAnim( fragment.position.xy, rpJitterTexOffset.w ); + //float random = InterleavedGradientNoiseAnim( fragment.position.xy, pc.rpJitterTexOffset.w ); random *= PI; @@ -348,7 +349,7 @@ void main( PS_IN fragment, out PS_OUT result ) rot.x = cos( random ); rot.y = sin( random ); - float shadowTexelSize = rpScreenCorrectionFactor.z * rpJitterTexScale.x; + float shadowTexelSize = pc.rpScreenCorrectionFactor.z * pc.rpJitterTexScale.x; for( int si = 0; si < 12; si++ ) { float2 jitter = poissonDisk[si]; @@ -357,7 +358,7 @@ void main( PS_IN fragment, out PS_OUT result ) jitterRotated.y = jitter.x * rot.y + jitter.y * rot.x; // [0 .. 1] -> rectangle in atlas transform - float2 shadowTexcoordAtlas = shadowTexcoord.xy * rpJitterTexScale.y + rpShadowAtlasOffsets[ shadowIndex ].xy; + float2 shadowTexcoordAtlas = shadowTexcoord.xy * pc.rpJitterTexScale.y + pc.rpShadowAtlasOffsets[ shadowIndex ].xy; float2 shadowTexcoordJittered = shadowTexcoordAtlas.xy + jitterRotated * shadowTexelSize; @@ -376,20 +377,20 @@ void main( PS_IN fragment, out PS_OUT result ) float shadow = 0.0; - float numSamples = rpJitterTexScale.w; + float numSamples = pc.rpJitterTexScale.w; float stepSize = 1.0 / numSamples; float vogelPhi = BlueNoise( fragment.position.xy, 1.0 ); - //float vogelPhi = InterleavedGradientNoiseAnim( fragment.position.xy, rpJitterTexOffset.w ); + //float vogelPhi = InterleavedGradientNoiseAnim( fragment.position.xy, pc.rpJitterTexOffset.w ); - float shadowTexelSize = rpScreenCorrectionFactor.z * rpJitterTexScale.x; + float shadowTexelSize = pc.rpScreenCorrectionFactor.z * pc.rpJitterTexScale.x; for( float si = 0.0; si < numSamples; si += 1.0 ) { float2 jitter = VogelDiskSample( si, numSamples, vogelPhi ); #if USE_SHADOW_ATLAS // [0 .. 1] -> rectangle in atlas transform - float2 shadowTexcoordAtlas = shadowTexcoord.xy * rpJitterTexScale.y + rpShadowAtlasOffsets[ shadowIndex ].xy; + float2 shadowTexcoordAtlas = shadowTexcoord.xy * pc.rpJitterTexScale.y + pc.rpShadowAtlasOffsets[ shadowIndex ].xy; float2 shadowTexcoordJittered = shadowTexcoordAtlas + jitter * shadowTexelSize; @@ -412,7 +413,7 @@ void main( PS_IN fragment, out PS_OUT result ) uvShadow.y = shadowTexcoord.y; // [0 .. 1] -> rectangle in atlas transform - uvShadow = uvShadow * rpJitterTexScale.y + rpShadowAtlasOffsets[ shadowIndex ].xy; + uvShadow = uvShadow * pc.rpJitterTexScale.y + pc.rpShadowAtlasOffsets[ shadowIndex ].xy; float shadow = t_ShadowAtlas.SampleCmpLevelZero( s_Shadow, uvShadow.xy, receiver ); #else @@ -456,7 +457,7 @@ void main( PS_IN fragment, out PS_OUT result ) #endif // allow shadows to fade out - shadow = saturate( max( shadow, rpJitterTexScale.z ) ); + shadow = saturate( max( shadow, pc.rpJitterTexScale.z ) ); float3 halfAngleVector = normalize( lightVector + viewVector ); float hdotN = clamp( dot3( halfAngleVector, localNormal ), 0.0, 1.0 ); @@ -488,7 +489,7 @@ void main( PS_IN fragment, out PS_OUT result ) // RB: compensate r_lightScale 3 and the division of Pi //lambert *= 1.3; - // rpDiffuseModifier contains light color multiplier + // pc.rpDiffuseModifier contains light color multiplier float3 lightColor = sRGBToLinearRGB( lightProj.xyz * lightFalloff.xyz ); float vdotN = clamp( dot3( viewVector, localNormal ), 0.0, 1.0 ); @@ -496,7 +497,7 @@ void main( PS_IN fragment, out PS_OUT result ) float ldotH = clamp( dot3( lightVector, halfAngleVector ), 0.0, 1.0 ); // compensate r_lightScale 3 * 2 - float3 reflectColor = specularColor * rpSpecularModifier.rgb * 1.0;// * 0.5; + float3 reflectColor = specularColor * pc.rpSpecularModifier.rgb * 1.0;// * 0.5; // cheap approximation by ARM with only one division // http://community.arm.com/servlet/JiveServlet/download/96891546-19496/siggraph2015-mmg-renaldas-slides.pdf @@ -519,8 +520,8 @@ void main( PS_IN fragment, out PS_OUT result ) // see http://seblagarde.wordpress.com/2012/01/08/pi-or-not-to-pi-in-game-lighting-equation/ //lambert /= PI; - //float3 diffuseColor = mix( diffuseMap, F0, metal ) * rpDiffuseModifier.xyz; - float3 diffuseLight = diffuseColor * lambert * ( rpDiffuseModifier.xyz ); + //float3 diffuseColor = mix( diffuseMap, F0, metal ) * pc.rpDiffuseModifier.xyz; + float3 diffuseLight = diffuseColor * lambert * ( pc.rpDiffuseModifier.xyz ); float3 color = ( diffuseLight + specularLight ) * lightColor * fragment.color.rgb * shadow; diff --git a/neo/shaders/builtin/lighting/interactionSM.vs.hlsl b/neo/shaders/builtin/lighting/interactionSM.vs.hlsl index 1e3f1bad13..9c198fb883 100644 --- a/neo/shaders/builtin/lighting/interactionSM.vs.hlsl +++ b/neo/shaders/builtin/lighting/interactionSM.vs.hlsl @@ -1,4 +1,4 @@ -/* +/* =========================================================================== Doom 3 BFG Edition GPL Source Code @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet10.inc.hlsl" // *INDENT-OFF* #if USE_GPU_SKINNING @@ -131,15 +132,15 @@ void main( VS_IN vertex, out VS_OUT result ) float3 bitangent = vBitangent.xyz; #endif - result.position.x = dot4( modelPosition, rpMVPmatrixX ); - result.position.y = dot4( modelPosition, rpMVPmatrixY ); - result.position.z = dot4( modelPosition, rpMVPmatrixZ ); - result.position.w = dot4( modelPosition, rpMVPmatrixW ); + result.position.x = dot4( modelPosition, pc.rpMVPmatrixX ); + result.position.y = dot4( modelPosition, pc.rpMVPmatrixY ); + result.position.z = dot4( modelPosition, pc.rpMVPmatrixZ ); + result.position.w = dot4( modelPosition, pc.rpMVPmatrixW ); float4 defaultTexCoord = float4( 0.0f, 0.5f, 0.0f, 1.0f ); //calculate vector to light - float4 toLightLocal = rpLocalLightOrigin - modelPosition; + float4 toLightLocal = pc.rpLocalLightOrigin - modelPosition; //-------------------------------------------------------------- @@ -151,28 +152,28 @@ void main( VS_IN vertex, out VS_OUT result ) //textures 1 takes the base coordinates by the texture matrix result.texcoord1 = defaultTexCoord; - result.texcoord1.x = dot4( vertex.texcoord.xy, rpBumpMatrixS ); - result.texcoord1.y = dot4( vertex.texcoord.xy, rpBumpMatrixT ); + result.texcoord1.x = dot4( vertex.texcoord.xy, pc.rpBumpMatrixS ); + result.texcoord1.y = dot4( vertex.texcoord.xy, pc.rpBumpMatrixT ); //# texture 2 has one texgen result.texcoord2 = defaultTexCoord; - result.texcoord2.x = dot4( modelPosition, rpLightFalloffS ); + result.texcoord2.x = dot4( modelPosition, pc.rpLightFalloffS ); //# texture 3 has three texgens - result.texcoord3.x = dot4( modelPosition, rpLightProjectionS ); - result.texcoord3.y = dot4( modelPosition, rpLightProjectionT ); + result.texcoord3.x = dot4( modelPosition, pc.rpLightProjectionS ); + result.texcoord3.y = dot4( modelPosition, pc.rpLightProjectionT ); result.texcoord3.z = 0.0f; - result.texcoord3.w = dot4( modelPosition, rpLightProjectionQ ); + result.texcoord3.w = dot4( modelPosition, pc.rpLightProjectionQ ); //# textures 4 takes the base coordinates by the texture matrix result.texcoord4 = defaultTexCoord; - result.texcoord4.x = dot4( vertex.texcoord.xy, rpDiffuseMatrixS ); - result.texcoord4.y = dot4( vertex.texcoord.xy, rpDiffuseMatrixT ); + result.texcoord4.x = dot4( vertex.texcoord.xy, pc.rpDiffuseMatrixS ); + result.texcoord4.y = dot4( vertex.texcoord.xy, pc.rpDiffuseMatrixT ); //# textures 5 takes the base coordinates by the texture matrix result.texcoord5 = defaultTexCoord; - result.texcoord5.x = dot4( vertex.texcoord.xy, rpSpecularMatrixS ); - result.texcoord5.y = dot4( vertex.texcoord.xy, rpSpecularMatrixT ); + result.texcoord5.x = dot4( vertex.texcoord.xy, pc.rpSpecularMatrixS ); + result.texcoord5.y = dot4( vertex.texcoord.xy, pc.rpSpecularMatrixT ); //# texture 6's texcoords will be the halfangle in texture space @@ -180,7 +181,7 @@ void main( VS_IN vertex, out VS_OUT result ) toLightLocal = normalize( toLightLocal ); //# calculate normalized vector to viewer in R1 - float4 toView = normalize( rpLocalViewOrigin - modelPosition ); + float4 toView = normalize( pc.rpLocalViewOrigin - modelPosition ); //# put into texture space result.texcoord6.x = dot3( tangent, toView ); @@ -191,20 +192,20 @@ void main( VS_IN vertex, out VS_OUT result ) result.texcoord7 = modelPosition; float4 worldPosition; - worldPosition.x = dot4( modelPosition, rpModelMatrixX ); - worldPosition.y = dot4( modelPosition, rpModelMatrixY ); - worldPosition.z = dot4( modelPosition, rpModelMatrixZ ); - worldPosition.w = dot4( modelPosition, rpModelMatrixW ); + worldPosition.x = dot4( modelPosition, pc.rpModelMatrixX ); + worldPosition.y = dot4( modelPosition, pc.rpModelMatrixY ); + worldPosition.z = dot4( modelPosition, pc.rpModelMatrixZ ); + worldPosition.w = dot4( modelPosition, pc.rpModelMatrixW ); - float4 toLightGlobal = rpGlobalLightOrigin - worldPosition; + float4 toLightGlobal = pc.rpGlobalLightOrigin - worldPosition; result.texcoord8 = toLightGlobal; float4 viewPosition; - viewPosition.x = dot4( modelPosition, rpModelViewMatrixX ); - viewPosition.y = dot4( modelPosition, rpModelViewMatrixY ); - viewPosition.z = dot4( modelPosition, rpModelViewMatrixZ ); - viewPosition.w = dot4( modelPosition, rpModelViewMatrixW ); + viewPosition.x = dot4( modelPosition, pc.rpModelViewMatrixX ); + viewPosition.y = dot4( modelPosition, pc.rpModelViewMatrixY ); + viewPosition.z = dot4( modelPosition, pc.rpModelViewMatrixZ ); + viewPosition.w = dot4( modelPosition, pc.rpModelViewMatrixW ); result.texcoord9 = viewPosition; @@ -218,6 +219,6 @@ void main( VS_IN vertex, out VS_OUT result ) //# for 1.0 : env[16] = 0, env[17] = 1 //# for color : env[16] = 1, env[17] = 0 //# for 1.0-color : env[16] = -1, env[17] = 1 - result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd; + result.color = ( swizzleColor( vertex.color ) * pc.rpVertexColorModulate ) + pc.rpVertexColorAdd; #endif -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/post/SMAA_blending_weight_calc.ps.hlsl b/neo/shaders/builtin/post/SMAA_blending_weight_calc.ps.hlsl index aa861daa8b..8aeff818ec 100644 --- a/neo/shaders/builtin/post/SMAA_blending_weight_calc.ps.hlsl +++ b/neo/shaders/builtin/post/SMAA_blending_weight_calc.ps.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet1.inc.hlsl" #define SMAA_INCLUDE_VS 0 diff --git a/neo/shaders/builtin/post/SMAA_blending_weight_calc.vs.hlsl b/neo/shaders/builtin/post/SMAA_blending_weight_calc.vs.hlsl index af7f376543..d0ee9b86d9 100644 --- a/neo/shaders/builtin/post/SMAA_blending_weight_calc.vs.hlsl +++ b/neo/shaders/builtin/post/SMAA_blending_weight_calc.vs.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet1.inc.hlsl" #define SMAA_INCLUDE_VS 1 @@ -75,4 +76,4 @@ void main( VS_IN vertex, out VS_OUT result ) // TODO(Stephen): Could be zw instead? result.texcoord4.xy = pixcoord; -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/post/SMAA_edge_detection.ps.hlsl b/neo/shaders/builtin/post/SMAA_edge_detection.ps.hlsl index 984b567992..95f1c68ca8 100644 --- a/neo/shaders/builtin/post/SMAA_edge_detection.ps.hlsl +++ b/neo/shaders/builtin/post/SMAA_edge_detection.ps.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet1.inc.hlsl" #define SMAA_INCLUDE_VS 0 diff --git a/neo/shaders/builtin/post/SMAA_edge_detection.vs.hlsl b/neo/shaders/builtin/post/SMAA_edge_detection.vs.hlsl index f0fc33e565..9ca88fbb73 100644 --- a/neo/shaders/builtin/post/SMAA_edge_detection.vs.hlsl +++ b/neo/shaders/builtin/post/SMAA_edge_detection.vs.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet1.inc.hlsl" #define SMAA_INCLUDE_VS 1 @@ -71,4 +72,4 @@ void main( VS_IN vertex, out VS_OUT result ) result.texcoord1 = offset[0]; result.texcoord2 = offset[1]; result.texcoord3 = offset[2]; -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/post/SMAA_final.ps.hlsl b/neo/shaders/builtin/post/SMAA_final.ps.hlsl index 00b8ddad4d..56a5fc443b 100644 --- a/neo/shaders/builtin/post/SMAA_final.ps.hlsl +++ b/neo/shaders/builtin/post/SMAA_final.ps.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet1.inc.hlsl" #define SMAA_INCLUDE_VS 0 diff --git a/neo/shaders/builtin/post/SMAA_final.vs.hlsl b/neo/shaders/builtin/post/SMAA_final.vs.hlsl index 18c123873f..ba6c995a55 100644 --- a/neo/shaders/builtin/post/SMAA_final.vs.hlsl +++ b/neo/shaders/builtin/post/SMAA_final.vs.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet1.inc.hlsl" #define SMAA_INCLUDE_VS 1 @@ -64,4 +65,4 @@ void main( VS_IN vertex, out VS_OUT result ) SMAANeighborhoodBlendingVS( vertex.texcoord, offset ); result.texcoord1 = offset; -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/post/hdr_glare_chromatic.ps.hlsl b/neo/shaders/builtin/post/hdr_glare_chromatic.ps.hlsl index a18aca3bd5..7a109b491d 100644 --- a/neo/shaders/builtin/post/hdr_glare_chromatic.ps.hlsl +++ b/neo/shaders/builtin/post/hdr_glare_chromatic.ps.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet1.inc.hlsl" // *INDENT-OFF* @@ -107,7 +108,7 @@ void main( PS_IN fragment, out PS_OUT result ) //float3 so = spectrumoffset( t ); float3 so = chromaticOffsets[ i ]; - float4 color = t_CurrentRender.Sample( samp0, st + float2( float( i ), 0 ) * rpWindowCoord.xy * scale ); + float4 color = t_CurrentRender.Sample( samp0, st + float2( float( i ), 0 ) * pc.rpWindowCoord.xy * scale ); float weight = gaussFact[ i ]; sumColor += color.rgb * ( so.rgb * weight * weightScale ); @@ -120,7 +121,7 @@ void main( PS_IN fragment, out PS_OUT result ) //float3 so = spectrumoffset( t ); float3 so = chromaticOffsets[sI]; - float4 color = t_CurrentRender.Sample( samp0, st + float2( float( -sI ), 0 ) * rpWindowCoord.xy * scale ); + float4 color = t_CurrentRender.Sample( samp0, st + float2( float( -sI ), 0 ) * pc.rpWindowCoord.xy * scale ); float weight = gaussFact[sI]; sumColor += color.rgb * ( so.rgb * weight * weightScale ); diff --git a/neo/shaders/builtin/post/hdr_glare_chromatic.vs.hlsl b/neo/shaders/builtin/post/hdr_glare_chromatic.vs.hlsl index 65dfc087ca..4c437500bb 100644 --- a/neo/shaders/builtin/post/hdr_glare_chromatic.vs.hlsl +++ b/neo/shaders/builtin/post/hdr_glare_chromatic.vs.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet1.inc.hlsl" // *INDENT-OFF* @@ -50,9 +51,9 @@ void main( VS_IN vertex, out VS_OUT result ) { result.position = vertex.position; - //result.position.x = vertex.position; //dot4( vertex.position, rpMVPmatrixX ); - //result.position.y = dot4( vertex.position, rpMVPmatrixY ); - //result.position.z = dot4( vertex.position, rpMVPmatrixZ ); - //result.position.w = dot4( vertex.position, rpMVPmatrixW ); + //result.position.x = vertex.position; //dot4( vertex.position, pc.rpMVPmatrixX ); + //result.position.y = dot4( vertex.position, pc.rpMVPmatrixY ); + //result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); + //result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); result.texcoord0 = vertex.texcoord; -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/post/motionBlur.ps.hlsl b/neo/shaders/builtin/post/motionBlur.ps.hlsl index f50cf1545d..b1e07260a8 100644 --- a/neo/shaders/builtin/post/motionBlur.ps.hlsl +++ b/neo/shaders/builtin/post/motionBlur.ps.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet1.inc.hlsl" // *INDENT-OFF* @@ -81,10 +82,10 @@ void main( PS_IN fragment, out PS_OUT result ) // convert from clip space this frame to clip space previous frame float4 prevClipPos; - prevClipPos.x = dot( rpMVPmatrixX, clip ); - prevClipPos.y = dot( rpMVPmatrixY, clip ); - prevClipPos.z = dot( rpMVPmatrixZ, clip ); - prevClipPos.w = dot( rpMVPmatrixW, clip ); + prevClipPos.x = dot( pc.rpMVPmatrixX, clip ); + prevClipPos.y = dot( pc.rpMVPmatrixY, clip ); + prevClipPos.z = dot( pc.rpMVPmatrixZ, clip ); + prevClipPos.w = dot( pc.rpMVPmatrixW, clip ); if( prevClipPos.w <= 0 ) { @@ -101,7 +102,7 @@ void main( PS_IN fragment, out PS_OUT result ) float2 delta = ( fragment.texcoord0 - prevTexCoord ); #if VECTORS_ONLY - float2 prevWindowPos = prevTexCoord * rpWindowCoord.zw; + float2 prevWindowPos = prevTexCoord * pc.rpWindowCoord.zw; float2 deltaPos = prevWindowPos - fragment.position.xy; float2 deltaUV = prevTexCoord - fragment.texcoord0; @@ -110,7 +111,7 @@ void main( PS_IN fragment, out PS_OUT result ) #else float3 sum = _float3( 0.0 ); float goodSamples = 0.0; - float samples = rpOverbright.x; + float samples = pc.rpOverbright.x; for( float i = 0.0 ; i < samples ; i = i + 1.0 ) { diff --git a/neo/shaders/builtin/post/motionBlur.vs.hlsl b/neo/shaders/builtin/post/motionBlur.vs.hlsl index bf4072075d..441ece77ab 100644 --- a/neo/shaders/builtin/post/motionBlur.vs.hlsl +++ b/neo/shaders/builtin/post/motionBlur.vs.hlsl @@ -26,6 +26,9 @@ If you have questions concerning this license or the applicable additional terms =========================================================================== */ +#include "renderParmSet1.inc.hlsl" + + // *INDENT-OFF* struct VS_IN { @@ -50,4 +53,4 @@ void main( VS_IN vertex, out VS_OUT result ) result.position.y = -result.position.y; result.texcoord0 = vertex.texcoord; -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/post/postprocess.ps.hlsl b/neo/shaders/builtin/post/postprocess.ps.hlsl index 8684da9fd3..ba3075c1de 100644 --- a/neo/shaders/builtin/post/postprocess.ps.hlsl +++ b/neo/shaders/builtin/post/postprocess.ps.hlsl @@ -30,6 +30,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet2.inc.hlsl" // *INDENT-OFF* @@ -164,7 +165,7 @@ void ChromaticAberrationPass( inout float4 color, PS_IN fragment ) float3 sum = _float3( 0.0 ); float3 sumColor = _float3( 0.0 ); - //float samples = rpOverbright.x; + //float samples = pc.rpOverbright.x; float samples = 12.0; // * 2; for( float i = 0.0; i < samples; i = i + 1.0 ) @@ -189,7 +190,7 @@ void ChromaticAberrationPass2( inout float4 color, PS_IN fragment ) float2 uv = fragment.texcoord0; - //float2 texel = 1.0 / rpWindowCoord.zw; + //float2 texel = 1.0 / pc.rpWindowCoord.zw; float2 texel = 1.0 / float2( 1920.0, 1080.0 ); float2 coords = ( uv - 0.5 ) * 2.0; @@ -253,9 +254,9 @@ void ChromaticAberrationPass2( inout float4 color, PS_IN fragment ) float BlueNoise( float2 n, float x ) { - float noise = t_BlueNoise.Sample( samp1, ( n.xy * rpJitterTexOffset.xy ) * 1.0 ).r; + float noise = t_BlueNoise.Sample( samp1, ( n.xy * pc.rpJitterTexOffset.xy ) * 1.0 ).r; - noise = frac( noise + 0.61803398875 * rpJitterTexOffset.z * x ); + noise = frac( noise + 0.61803398875 * pc.rpJitterTexOffset.z * x ); //noise = InterleavedGradientNoise( n ); @@ -268,11 +269,11 @@ float BlueNoise( float2 n, float x ) float3 BlueNoise3( float2 n, float x ) { - float2 uv = n.xy * rpJitterTexOffset.xy; + float2 uv = n.xy * pc.rpJitterTexOffset.xy; float3 noise = t_BlueNoise.Sample( samp1, uv ).rgb; - noise = frac( noise + c_goldenRatioConjugate * rpJitterTexOffset.w * x ); + noise = frac( noise + c_goldenRatioConjugate * pc.rpJitterTexOffset.w * x ); //noise.x = RemapNoiseTriErp( noise.x ); //noise.y = RemapNoiseTriErp( noise.y ); @@ -366,9 +367,9 @@ float3 Step3( float2 uv ) float3 Step3T( float2 uv ) { #if DITHER_GENERATE_NOISE - float a = Step2( uv, 0.07 * fract( rpJitterTexOffset.z ) ); - float b = Step2( uv, 0.11 * fract( rpJitterTexOffset.z ) ); - float c = Step2( uv, 0.13 * fract( rpJitterTexOffset.z ) ); + float a = Step2( uv, 0.07 * fract( pc.rpJitterTexOffset.z ) ); + float b = Step2( uv, 0.11 * fract( pc.rpJitterTexOffset.z ) ); + float c = Step2( uv, 0.13 * fract( pc.rpJitterTexOffset.z ) ); return float3( a, b, c ); #else diff --git a/neo/shaders/builtin/post/postprocess.vs.hlsl b/neo/shaders/builtin/post/postprocess.vs.hlsl index 75519fe84b..d0999dd6fb 100644 --- a/neo/shaders/builtin/post/postprocess.vs.hlsl +++ b/neo/shaders/builtin/post/postprocess.vs.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet2.inc.hlsl" // *INDENT-OFF* @@ -52,4 +53,4 @@ void main( VS_IN vertex, out VS_OUT result ) result.position.y = -result.position.y; result.texcoord0 = vertex.texcoord; -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/post/screen.ps.hlsl b/neo/shaders/builtin/post/screen.ps.hlsl index 9da70a0c59..1a99a61ac6 100644 --- a/neo/shaders/builtin/post/screen.ps.hlsl +++ b/neo/shaders/builtin/post/screen.ps.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet1.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/builtin/post/screen.vs.hlsl b/neo/shaders/builtin/post/screen.vs.hlsl index 65dfc087ca..4c437500bb 100644 --- a/neo/shaders/builtin/post/screen.vs.hlsl +++ b/neo/shaders/builtin/post/screen.vs.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet1.inc.hlsl" // *INDENT-OFF* @@ -50,9 +51,9 @@ void main( VS_IN vertex, out VS_OUT result ) { result.position = vertex.position; - //result.position.x = vertex.position; //dot4( vertex.position, rpMVPmatrixX ); - //result.position.y = dot4( vertex.position, rpMVPmatrixY ); - //result.position.z = dot4( vertex.position, rpMVPmatrixZ ); - //result.position.w = dot4( vertex.position, rpMVPmatrixW ); + //result.position.x = vertex.position; //dot4( vertex.position, pc.rpMVPmatrixX ); + //result.position.y = dot4( vertex.position, pc.rpMVPmatrixY ); + //result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); + //result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); result.texcoord0 = vertex.texcoord; -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/post/tonemap.ps.hlsl b/neo/shaders/builtin/post/tonemap.ps.hlsl index cb13131e17..63ae3171fc 100644 --- a/neo/shaders/builtin/post/tonemap.ps.hlsl +++ b/neo/shaders/builtin/post/tonemap.ps.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet1.inc.hlsl" // *INDENT-OFF* @@ -116,9 +117,9 @@ void main( PS_IN fragment, out PS_OUT result ) } #endif - float hdrKey = rpScreenCorrectionFactor.x; - float hdrAverageLuminance = rpScreenCorrectionFactor.y; - float hdrMaxLuminance = rpScreenCorrectionFactor.z; + float hdrKey = pc.rpScreenCorrectionFactor.x; + float hdrAverageLuminance = pc.rpScreenCorrectionFactor.y; + float hdrMaxLuminance = pc.rpScreenCorrectionFactor.z; // calculate the relative luminance float Yr = ( hdrKey * Y ) / hdrAverageLuminance; @@ -156,7 +157,7 @@ void main( PS_IN fragment, out PS_OUT result ) #elif OPERATOR == 2 // can be in range [-4.0 .. 4.0] - //float exposureOffset = rpScreenCorrectionFactor.w; + //float exposureOffset = pc.rpScreenCorrectionFactor.w; float avgLuminance = max( hdrAverageLuminance, 0.001 ); float linearExposure = ( hdrKey / avgLuminance ); @@ -170,7 +171,7 @@ void main( PS_IN fragment, out PS_OUT result ) #elif OPERATOR == 3 // can be in range [-4.0 .. 4.0] - float exposure = rpScreenCorrectionFactor.w; + float exposure = pc.rpScreenCorrectionFactor.w; // exposure curves ranges from 0.0625 to 16.0 float3 exposedColor = exp2( exposure ) * color.rgb; @@ -186,7 +187,7 @@ void main( PS_IN fragment, out PS_OUT result ) //float exposure = ( hdrKey / hdrAverageLuminance ) * 0.2; //float exposure = Yr * 1.0; - float exposure = rpScreenCorrectionFactor.w; + float exposure = pc.rpScreenCorrectionFactor.w; float3 exposedColor = exposure * color.rgb; float3 curr = Uncharted2Tonemap( exposedColor ); @@ -199,8 +200,8 @@ void main( PS_IN fragment, out PS_OUT result ) // adjust contrast //L = pow( L, 1.32 ); - const half hdrContrastThreshold = rpOverbright.x; - const half hdrContrastOffset = rpOverbright.y; + const half hdrContrastThreshold = pc.rpOverbright.x; + const half hdrContrastOffset = pc.rpOverbright.y; //float T = max( ( Yr * ( 1.0 + Yr / ( Ymax * Ymax * 2.0 ) ) ) - hdrContrastThreshold, 0.0 ); //float T = max( 1.0 - exp( -Yr ) - hdrContrastThreshold, 0.0 ); diff --git a/neo/shaders/builtin/post/tonemap.vs.hlsl b/neo/shaders/builtin/post/tonemap.vs.hlsl index 2162a48689..6348a13bf2 100644 --- a/neo/shaders/builtin/post/tonemap.vs.hlsl +++ b/neo/shaders/builtin/post/tonemap.vs.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet1.inc.hlsl" // *INDENT-OFF* @@ -51,9 +52,9 @@ void main( VS_IN vertex, out VS_OUT result ) result.position = vertex.position; result.position.y = -result.position.y; - //result.position.x = vertex.position; //dot4( vertex.position, rpMVPmatrixX ); - //result.position.y = dot4( vertex.position, rpMVPmatrixY ); - //result.position.z = dot4( vertex.position, rpMVPmatrixZ ); - //result.position.w = dot4( vertex.position, rpMVPmatrixW ); + //result.position.x = vertex.position; //dot4( vertex.position, pc.rpMVPmatrixX ); + //result.position.y = dot4( vertex.position, pc.rpMVPmatrixY ); + //result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); + //result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); result.texcoord0 = vertex.texcoord; -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/texture.ps.hlsl b/neo/shaders/builtin/texture.ps.hlsl index 6600209f7a..29253bab08 100644 --- a/neo/shaders/builtin/texture.ps.hlsl +++ b/neo/shaders/builtin/texture.ps.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet4.inc.hlsl" // *INDENT-OFF* @@ -45,7 +46,7 @@ struct PS_OUT { void main( PS_IN fragment, out PS_OUT result ) { - result.color = tex.Sample( samp0, fragment.texcoord0 ) * rpColor; - //result.color = textureLod( samp0, fragment.texcoord0, 2.0 ) * rpColor; - //result.color = float4( 0.0, 1.0, 0.0, 1.0 ) * rpColor; -} \ No newline at end of file + result.color = tex.Sample( samp0, fragment.texcoord0 ) * pc.rpColor; + //result.color = textureLod( samp0, fragment.texcoord0, 2.0 ) * pc.rpColor; + //result.color = float4( 0.0, 1.0, 0.0, 1.0 ) * pc.rpColor; +} diff --git a/neo/shaders/builtin/texture.vs.hlsl b/neo/shaders/builtin/texture.vs.hlsl index 6491a155b2..6498a86fec 100644 --- a/neo/shaders/builtin/texture.vs.hlsl +++ b/neo/shaders/builtin/texture.vs.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet4.inc.hlsl" // *INDENT-OFF* @@ -48,20 +49,20 @@ struct VS_OUT { void main( VS_IN vertex, out VS_OUT result ) { - result.position.x = dot4( vertex.position, rpMVPmatrixX ); - result.position.y = dot4( vertex.position, rpMVPmatrixY ); - result.position.z = dot4( vertex.position, rpMVPmatrixZ ); - result.position.w = dot4( vertex.position, rpMVPmatrixW ); + result.position.x = dot4( vertex.position, pc.rpMVPmatrixX ); + result.position.y = dot4( vertex.position, pc.rpMVPmatrixY ); + result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); + result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); // compute oldschool texgen or multiply by texture matrix - BRANCH if( rpTexGen0Enabled.x > 0.0 ) + BRANCH if( pc.rpTexGen0Enabled.x > 0.0 ) { - result.texcoord0.x = dot4( vertex.position, rpTexGen0S ); - result.texcoord0.y = dot4( vertex.position, rpTexGen0T ); + result.texcoord0.x = dot4( vertex.position, pc.rpTexGen0S ); + result.texcoord0.y = dot4( vertex.position, pc.rpTexGen0T ); } else { - result.texcoord0.x = dot4( vertex.texcoord.xy, rpTextureMatrixS ); - result.texcoord0.y = dot4( vertex.texcoord.xy, rpTextureMatrixT ); + result.texcoord0.x = dot4( vertex.texcoord.xy, pc.rpTextureMatrixS ); + result.texcoord0.y = dot4( vertex.texcoord.xy, pc.rpTextureMatrixT ); } -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/texture_color.ps.hlsl b/neo/shaders/builtin/texture_color.ps.hlsl index a35f569209..e2ad92dd46 100644 --- a/neo/shaders/builtin/texture_color.ps.hlsl +++ b/neo/shaders/builtin/texture_color.ps.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet4.inc.hlsl" // *INDENT-OFF* @@ -47,6 +48,6 @@ struct PS_OUT { void main( in PS_IN fragment, out PS_OUT result ) { float4 color = t_BaseColor.Sample( s_Sampler, fragment.texcoord0 ) * fragment.color; - clip( color.a - rpAlphaTest.x ); + clip( color.a - pc.rpAlphaTest.x ); result.color = sRGBAToLinearRGBA( color ); } diff --git a/neo/shaders/builtin/texture_color.vs.hlsl b/neo/shaders/builtin/texture_color.vs.hlsl index 7451a5af7f..6c50cebc6c 100644 --- a/neo/shaders/builtin/texture_color.vs.hlsl +++ b/neo/shaders/builtin/texture_color.vs.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet4.inc.hlsl" // *INDENT-OFF* #if USE_GPU_SKINNING @@ -91,42 +92,42 @@ void main( VS_IN vertex, out VS_OUT result ) modelPosition.z = dot4( matZ, vertex.position ); modelPosition.w = 1.0; - result.position.x = dot4( modelPosition, rpMVPmatrixX ); - result.position.y = dot4( modelPosition, rpMVPmatrixY ); - result.position.z = dot4( modelPosition, rpMVPmatrixZ ); - result.position.w = dot4( modelPosition, rpMVPmatrixW ); + result.position.x = dot4( modelPosition, pc.rpMVPmatrixX ); + result.position.y = dot4( modelPosition, pc.rpMVPmatrixY ); + result.position.z = dot4( modelPosition, pc.rpMVPmatrixZ ); + result.position.w = dot4( modelPosition, pc.rpMVPmatrixW ); // compute oldschool texgen or multiply by texture matrix - BRANCH if( rpTexGen0Enabled.x > 0.0 ) + BRANCH if( pc.rpTexGen0Enabled.x > 0.0 ) { - result.texcoord0.x = dot4( modelPosition, rpTexGen0S ); - result.texcoord0.y = dot4( modelPosition, rpTexGen0T ); + result.texcoord0.x = dot4( modelPosition, pc.rpTexGen0S ); + result.texcoord0.y = dot4( modelPosition, pc.rpTexGen0T ); } else { - result.texcoord0.x = dot4( vertex.texcoord.xy, rpTextureMatrixS ); - result.texcoord0.y = dot4( vertex.texcoord.xy, rpTextureMatrixT ); + result.texcoord0.x = dot4( vertex.texcoord.xy, pc.rpTextureMatrixS ); + result.texcoord0.y = dot4( vertex.texcoord.xy, pc.rpTextureMatrixT ); } #else - result.position.x = dot4( vertex.position, rpMVPmatrixX ); - result.position.y = dot4( vertex.position, rpMVPmatrixY ); - result.position.z = dot4( vertex.position, rpMVPmatrixZ ); - result.position.w = dot4( vertex.position, rpMVPmatrixW ); + result.position.x = dot4( vertex.position, pc.rpMVPmatrixX ); + result.position.y = dot4( vertex.position, pc.rpMVPmatrixY ); + result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); + result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); // Compute oldschool texgen or multiply by texture matrix - BRANCH if( rpTexGen0Enabled.x > 0.0 ) + BRANCH if( pc.rpTexGen0Enabled.x > 0.0 ) { - result.texcoord0.x = dot4( vertex.position, rpTexGen0S ); - result.texcoord0.y = dot4( vertex.position, rpTexGen0T ); + result.texcoord0.x = dot4( vertex.position, pc.rpTexGen0S ); + result.texcoord0.y = dot4( vertex.position, pc.rpTexGen0T ); } else { - result.texcoord0.x = dot4( vertex.texcoord.xy, rpTextureMatrixS ); - result.texcoord0.y = dot4( vertex.texcoord.xy, rpTextureMatrixT ); + result.texcoord0.x = dot4( vertex.texcoord.xy, pc.rpTextureMatrixS ); + result.texcoord0.y = dot4( vertex.texcoord.xy, pc.rpTextureMatrixT ); } #endif - float4 vertexColor = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd; - result.color = vertexColor * rpColor; + float4 vertexColor = ( swizzleColor( vertex.color ) * pc.rpVertexColorModulate ) + pc.rpVertexColorAdd; + result.color = vertexColor * pc.rpColor; } diff --git a/neo/shaders/builtin/texture_color_texgen.ps.hlsl b/neo/shaders/builtin/texture_color_texgen.ps.hlsl index 23975681c2..7393d848cc 100644 --- a/neo/shaders/builtin/texture_color_texgen.ps.hlsl +++ b/neo/shaders/builtin/texture_color_texgen.ps.hlsl @@ -27,6 +27,8 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet4.inc.hlsl" + // *INDENT-OFF* Texture2D t_Texture : register( t0 VK_DESCRIPTOR_SET( 1 ) ); @@ -53,4 +55,4 @@ void main( PS_IN fragment, out PS_OUT result ) float4 texSample = t_Texture.Sample( samp0, fragment.texcoord0.xy / fragment.texcoord0.w ); result.color = sRGBAToLinearRGBA( texSample ) * fragment.color; -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/texture_color_texgen.vs.hlsl b/neo/shaders/builtin/texture_color_texgen.vs.hlsl index a5f8b6196b..d47f5c659b 100644 --- a/neo/shaders/builtin/texture_color_texgen.vs.hlsl +++ b/neo/shaders/builtin/texture_color_texgen.vs.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet4.inc.hlsl" // *INDENT-OFF* @@ -50,24 +51,24 @@ struct VS_OUT void main( VS_IN vertex, out VS_OUT result ) { - result.position.x = dot4( vertex.position, rpMVPmatrixX ); - result.position.y = dot4( vertex.position, rpMVPmatrixY ); - result.position.z = dot4( vertex.position, rpMVPmatrixZ ); - result.position.w = dot4( vertex.position, rpMVPmatrixW ); + result.position.x = dot4( vertex.position, pc.rpMVPmatrixX ); + result.position.y = dot4( vertex.position, pc.rpMVPmatrixY ); + result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); + result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); float4 tc0; - tc0.x = dot4( vertex.position, rpTexGen0S ); - tc0.y = dot4( vertex.position, rpTexGen0T ); + tc0.x = dot4( vertex.position, pc.rpTexGen0S ); + tc0.y = dot4( vertex.position, pc.rpTexGen0T ); tc0.z = 0.0f; - tc0.w = dot4( vertex.position, rpTexGen0Q ); + tc0.w = dot4( vertex.position, pc.rpTexGen0Q ); // multiply the texture matrix in - result.texcoord0.x = dot4( tc0, rpTextureMatrixS ); - result.texcoord0.y = dot4( tc0, rpTextureMatrixT ); + result.texcoord0.x = dot4( tc0, pc.rpTextureMatrixS ); + result.texcoord0.y = dot4( tc0, pc.rpTextureMatrixT ); result.texcoord0.zw = tc0.zw; // compute vertex modulation - float4 vertexColor = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd; - result.color = vertexColor * rpColor; -} \ No newline at end of file + float4 vertexColor = ( swizzleColor( vertex.color ) * pc.rpVertexColorModulate ) + pc.rpVertexColorAdd; + result.color = vertexColor * pc.rpColor; +} diff --git a/neo/shaders/builtin/vertex_color.ps.hlsl b/neo/shaders/builtin/vertex_color.ps.hlsl index bc9694d5b9..9b5534218c 100644 --- a/neo/shaders/builtin/vertex_color.ps.hlsl +++ b/neo/shaders/builtin/vertex_color.ps.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet0.inc.hlsl" // *INDENT-OFF* @@ -46,4 +47,4 @@ struct PS_OUT void main( in PS_IN fragment, out PS_OUT result ) { result.color = sRGBAToLinearRGBA( fragment.color ); -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/vertex_color.vs.hlsl b/neo/shaders/builtin/vertex_color.vs.hlsl index 6cbea33b86..fea11a5d80 100644 --- a/neo/shaders/builtin/vertex_color.vs.hlsl +++ b/neo/shaders/builtin/vertex_color.vs.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet0.inc.hlsl" // *INDENT-OFF* @@ -50,10 +51,10 @@ struct VS_OUT void main( VS_IN vertex, out VS_OUT result ) { - result.position.x = dot4( vertex.position, rpMVPmatrixX ); - result.position.y = dot4( vertex.position, rpMVPmatrixY ); - result.position.z = dot4( vertex.position, rpMVPmatrixZ ); - result.position.w = dot4( vertex.position, rpMVPmatrixW ); + result.position.x = dot4( vertex.position, pc.rpMVPmatrixX ); + result.position.y = dot4( vertex.position, pc.rpMVPmatrixY ); + result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); + result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); result.color = swizzleColor( vertex.color ); -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/video/bink.ps.hlsl b/neo/shaders/builtin/video/bink.ps.hlsl index 264ed8ab2e..87d3f5fa30 100644 --- a/neo/shaders/builtin/video/bink.ps.hlsl +++ b/neo/shaders/builtin/video/bink.ps.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet0.inc.hlsl" // *INDENT-OFF* @@ -64,7 +65,7 @@ void main( PS_IN fragment, out PS_OUT result ) float4 color; color.xyz = p; color.w = 1.0; - color *= rpColor; + color *= pc.rpColor; result.color = sRGBAToLinearRGBA( color ); } diff --git a/neo/shaders/builtin/video/bink.vs.hlsl b/neo/shaders/builtin/video/bink.vs.hlsl index cd6b347e28..2921bc4bdb 100644 --- a/neo/shaders/builtin/video/bink.vs.hlsl +++ b/neo/shaders/builtin/video/bink.vs.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet0.inc.hlsl" // *INDENT-OFF* @@ -48,10 +49,10 @@ struct VS_OUT { void main( VS_IN vertex, out VS_OUT result ) { - result.position.x = dot4( vertex.position, rpMVPmatrixX ); - result.position.y = dot4( vertex.position, rpMVPmatrixY ); - result.position.z = dot4( vertex.position, rpMVPmatrixZ ); - result.position.w = dot4( vertex.position, rpMVPmatrixW ); + result.position.x = dot4( vertex.position, pc.rpMVPmatrixX ); + result.position.y = dot4( vertex.position, pc.rpMVPmatrixY ); + result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); + result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); result.texcoord0 = vertex.texcoord; -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/video/bink_gui.ps.hlsl b/neo/shaders/builtin/video/bink_gui.ps.hlsl index 9a10845caa..d2501460b0 100644 --- a/neo/shaders/builtin/video/bink_gui.ps.hlsl +++ b/neo/shaders/builtin/video/bink_gui.ps.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet0.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/builtin/video/bink_gui.vs.hlsl b/neo/shaders/builtin/video/bink_gui.vs.hlsl index aa6cc55083..e62c097bc3 100644 --- a/neo/shaders/builtin/video/bink_gui.vs.hlsl +++ b/neo/shaders/builtin/video/bink_gui.vs.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet0.inc.hlsl" // *INDENT-OFF* @@ -51,10 +52,10 @@ struct VS_OUT { void main( VS_IN vertex, out VS_OUT result ) { - result.position.x = dot4( vertex.position, rpMVPmatrixX ); - result.position.y = dot4( vertex.position, rpMVPmatrixY ); - result.position.z = dot4( vertex.position, rpMVPmatrixZ ); - result.position.w = dot4( vertex.position, rpMVPmatrixW ); + result.position.x = dot4( vertex.position, pc.rpMVPmatrixX ); + result.position.y = dot4( vertex.position, pc.rpMVPmatrixY ); + result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); + result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); result.texcoord0.xy = vertex.texcoord.xy; result.texcoord1 = ( ( vertex.color2 ) * 2.0 ) - 1.0; diff --git a/neo/shaders/colorProcess.ps.hlsl b/neo/shaders/colorProcess.ps.hlsl index fb3dcf43a9..58f1a20e7f 100644 --- a/neo/shaders/colorProcess.ps.hlsl +++ b/neo/shaders/colorProcess.ps.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet7.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/colorProcess.vs.hlsl b/neo/shaders/colorProcess.vs.hlsl index c625acba78..11ba58bf04 100644 --- a/neo/shaders/colorProcess.vs.hlsl +++ b/neo/shaders/colorProcess.vs.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet7.inc.hlsl" // *INDENT-OFF* @@ -51,16 +52,16 @@ struct VS_OUT void main( VS_IN vertex, out VS_OUT result ) { - result.position.x = dot4( vertex.position, rpMVPmatrixX ); - result.position.y = dot4( vertex.position, rpMVPmatrixY ); - result.position.z = dot4( vertex.position, rpMVPmatrixZ ); - result.position.w = dot4( vertex.position, rpMVPmatrixW ); + result.position.x = dot4( vertex.position, pc.rpMVPmatrixX ); + result.position.y = dot4( vertex.position, pc.rpMVPmatrixY ); + result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); + result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); - result.color = rpUser1; // targetHue + result.color = pc.rpUser1; // targetHue result.texcoord0.x = vertex.texcoord.x; result.texcoord0.y = 1.0f - vertex.texcoord.y; - result.texcoord0.z = rpUser0.x; // fraction + result.texcoord0.z = pc.rpUser0.x; // fraction } diff --git a/neo/shaders/enviroSuit.ps.hlsl b/neo/shaders/enviroSuit.ps.hlsl index 8744e5a28e..ac5ee89017 100644 --- a/neo/shaders/enviroSuit.ps.hlsl +++ b/neo/shaders/enviroSuit.ps.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet7.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/enviroSuit.vs.hlsl b/neo/shaders/enviroSuit.vs.hlsl index de038b3f1d..705635602b 100644 --- a/neo/shaders/enviroSuit.vs.hlsl +++ b/neo/shaders/enviroSuit.vs.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet7.inc.hlsl" // User Renderparms start at 128 as per renderprogs.h @@ -54,13 +55,13 @@ struct VS_OUT void main( VS_IN vertex, out VS_OUT result ) { - result.position.x = dot4( vertex.position, rpMVPmatrixX ); - result.position.y = dot4( vertex.position, rpMVPmatrixY ); - result.position.z = dot4( vertex.position, rpMVPmatrixZ ); - result.position.w = dot4( vertex.position, rpMVPmatrixW ); + result.position.x = dot4( vertex.position, pc.rpMVPmatrixX ); + result.position.y = dot4( vertex.position, pc.rpMVPmatrixY ); + result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); + result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); result.texcoord = vertex.texcoord.xy; - const float4 deformMagnitude = rpUser1; + const float4 deformMagnitude = pc.rpUser1; result.color = deformMagnitude; -} \ No newline at end of file +} diff --git a/neo/shaders/fogwithlights.ps.hlsl b/neo/shaders/fogwithlights.ps.hlsl index 62353853dc..a13d3b9bd2 100644 --- a/neo/shaders/fogwithlights.ps.hlsl +++ b/neo/shaders/fogwithlights.ps.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet7.inc.hlsl" // *INDENT-OFF* @@ -205,4 +206,4 @@ void main( PS_IN fragment, out PS_OUT result ) result.color = float4( _float3( cloudIntensity1 * clouds( uv, time ) ) * lightColor1 + lighIntensity1 * lightColor1 , 1.0 ); -} \ No newline at end of file +} diff --git a/neo/shaders/fogwithlights.vs.hlsl b/neo/shaders/fogwithlights.vs.hlsl index 77879465e0..dde69c70e5 100644 --- a/neo/shaders/fogwithlights.vs.hlsl +++ b/neo/shaders/fogwithlights.vs.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet7.inc.hlsl" // *INDENT-OFF* @@ -51,13 +52,13 @@ struct VS_OUT void main( VS_IN vertex, out VS_OUT result ) { - result.position.x = dot4( vertex.position, rpMVPmatrixX ); - result.position.y = dot4( vertex.position, rpMVPmatrixY ); - result.position.z = dot4( vertex.position, rpMVPmatrixZ ); - result.position.w = dot4( vertex.position, rpMVPmatrixW ); + result.position.x = dot4( vertex.position, pc.rpMVPmatrixX ); + result.position.y = dot4( vertex.position, pc.rpMVPmatrixY ); + result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); + result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); // pass through texcoords result.texcoord0 = float4( vertex.texcoord.xy, 0, 0 ); - result.texcoord1 = rpUser0; -} \ No newline at end of file + result.texcoord1 = pc.rpUser0; +} diff --git a/neo/shaders/global_inc.hlsl b/neo/shaders/global_inc.hlsl index ca4cf16136..7e710710e1 100644 --- a/neo/shaders/global_inc.hlsl +++ b/neo/shaders/global_inc.hlsl @@ -30,6 +30,7 @@ If you have questions concerning this license or the applicable additional terms #include "vulkan.hlsli" // *INDENT-OFF* +/* SRS - Disable global renderparms and use reduced-size constant buffer / push constant subsets cbuffer globals : register( b0 VK_DESCRIPTOR_SET( 0 ) ) { float4 rpScreenCorrectionFactor; @@ -122,7 +123,7 @@ cbuffer globals : register( b0 VK_DESCRIPTOR_SET( 0 ) ) float4 rpUser6; float4 rpUser7; }; - +*/ // *INDENT-ON* static float dot2( float2 a, float2 b ) @@ -448,10 +449,11 @@ static int2 textureSize( Texture2D buffer, int mipLevel ) return int2( width, height ); } -static float2 vposToScreenPosTexCoord( float2 vpos ) -{ - return vpos.xy * rpWindowCoord.xy; -} +// SRS - moved to renderParmSet7.inc.hlsl and renderParmSet8.inc.hlsl +//static float2 vposToScreenPosTexCoord( float2 vpos ) +//{ +// return vpos.xy * rpWindowCoord.xy; +//} #define BRANCH #define IFANY @@ -498,4 +500,4 @@ float3 Hash33( float3 p3 ) return frac( ( p3.xxy + p3.yxx ) * p3.zyx ); } -#define SMAA_RT_METRICS float4(1.0 / 1280.0, 1.0 / 720.0, 1280.0, 720.0) \ No newline at end of file +#define SMAA_RT_METRICS float4(1.0 / 1280.0, 1.0 / 720.0, 1280.0, 720.0) diff --git a/neo/shaders/heatHazeWithMask.ps.hlsl b/neo/shaders/heatHazeWithMask.ps.hlsl index 388c861e67..7d43e368b5 100644 --- a/neo/shaders/heatHazeWithMask.ps.hlsl +++ b/neo/shaders/heatHazeWithMask.ps.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet7.inc.hlsl" // *INDENT-OFF* @@ -70,4 +71,4 @@ void main( PS_IN fragment, out PS_OUT result ) screenTexCoord = saturate( screenTexCoord ); result.color = ( t_CurrentRender.Sample( LinearSampler, screenTexCoord ) ); -} \ No newline at end of file +} diff --git a/neo/shaders/heatHazeWithMask.vs.hlsl b/neo/shaders/heatHazeWithMask.vs.hlsl index 0cb9cc109f..6acf545a0d 100644 --- a/neo/shaders/heatHazeWithMask.vs.hlsl +++ b/neo/shaders/heatHazeWithMask.vs.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet7.inc.hlsl" // User Renderparms start at 128 as per renderprogs.h @@ -66,19 +67,19 @@ void main( VS_IN vertex, out VS_OUT result ) result.texcoord0 = float4( vertex.texcoord.xy, 0, 0 ); // texture 1 takes the texture coordinates and adds a scroll - const float4 textureScroll = rpUser0; + const float4 textureScroll = pc.rpUser0; result.texcoord1 = float4( vertex.texcoord.xy, 0, 0 ) + textureScroll; // texture 2 takes the deform magnitude and scales it by the projection distance float4 vec = float4( 0, 1, 0, 1 ); - vec.z = dot4( modelPosition, rpModelViewMatrixZ ); + vec.z = dot4( modelPosition, pc.rpModelViewMatrixZ ); // magicProjectionAdjust is a magic scalar that scales the projection since we changed from // using the X axis to the Y axis to calculate R1. It is an approximation to closely match // what the original game did const float magicProjectionAdjust = 0.43f; - float x = dot4( vec, rpProjectionMatrixY ) * magicProjectionAdjust; - float w = dot4( vec, rpProjectionMatrixW ); + float x = dot4( vec, pc.rpProjectionMatrixY ) * magicProjectionAdjust; + float w = dot4( vec, pc.rpProjectionMatrixW ); // don't let the recip get near zero for polygons that cross the view plane w = max( w, 1.0 ); @@ -88,6 +89,6 @@ void main( VS_IN vertex, out VS_OUT result ) // clamp the distance so the the deformations don't get too wacky near the view x = min( x, 0.02 ); - const float4 deformMagnitude = rpUser1; + const float4 deformMagnitude = pc.rpUser1; result.texcoord2 = x * deformMagnitude; -} \ No newline at end of file +} diff --git a/neo/shaders/heatHazeWithMaskAndVertex.ps.hlsl b/neo/shaders/heatHazeWithMaskAndVertex.ps.hlsl index 957f860fc3..20679c2893 100644 --- a/neo/shaders/heatHazeWithMaskAndVertex.ps.hlsl +++ b/neo/shaders/heatHazeWithMaskAndVertex.ps.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet7.inc.hlsl" // *INDENT-OFF* @@ -72,4 +73,4 @@ void main( PS_IN fragment, out PS_OUT result ) screenTexCoord = saturate( screenTexCoord ); result.color = ( t_CurrentRender.Sample( LinearSampler, screenTexCoord ) ); -} \ No newline at end of file +} diff --git a/neo/shaders/heatHazeWithMaskAndVertex.vs.hlsl b/neo/shaders/heatHazeWithMaskAndVertex.vs.hlsl index 596592afdb..1170733487 100644 --- a/neo/shaders/heatHazeWithMaskAndVertex.vs.hlsl +++ b/neo/shaders/heatHazeWithMaskAndVertex.vs.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet7.inc.hlsl" // *INDENT-OFF* @@ -63,19 +64,19 @@ void main( VS_IN vertex, out VS_OUT result ) result.texcoord0 = float4( vertex.texcoord, 0 , 0 ); // texture 1 takes the texture coordinates and adds a scroll - const float4 textureScroll = rpUser0; + const float4 textureScroll = pc.rpUser0; result.texcoord1 = float4( vertex.texcoord, 0, 0 ) + textureScroll; // texture 2 takes the deform magnitude and scales it by the projection distance float4 vec = float4( 0, 1, 0, 1 ); - vec.z = dot4( modelPosition, rpModelViewMatrixZ ); + vec.z = dot4( modelPosition, pc.rpModelViewMatrixZ ); // magicProjectionAdjust is a magic scalar that scales the projection since we changed from // using the X axis to the Y axis to calculate x. It is an approximation to closely match // what the original game did const float magicProjectionAdjust = 0.43f; - float x = dot4( vec, rpProjectionMatrixY ) * magicProjectionAdjust; - float w = dot4( vec, rpProjectionMatrixW ); + float x = dot4( vec, pc.rpProjectionMatrixY ) * magicProjectionAdjust; + float w = dot4( vec, pc.rpProjectionMatrixW ); // don't let the recip get near zero for polygons that cross the view plane w = max( w, 1.0f ); @@ -85,7 +86,7 @@ void main( VS_IN vertex, out VS_OUT result ) // clamp the distance so the the deformations don't get too wacky near the view x = min( x, 0.02f ); - const float4 deformMagnitude = rpUser1; + const float4 deformMagnitude = pc.rpUser1; result.texcoord2 = x * deformMagnitude; result.color = swizzleColor( vertex.color ); -} \ No newline at end of file +} diff --git a/neo/shaders/heathaze.ps.hlsl b/neo/shaders/heathaze.ps.hlsl index 6b93e92190..f5271aff36 100644 --- a/neo/shaders/heathaze.ps.hlsl +++ b/neo/shaders/heathaze.ps.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet7.inc.hlsl" // *INDENT-OFF* @@ -60,4 +61,4 @@ void main( PS_IN fragment, out PS_OUT result ) // load the screen render result.color = ( t_CurrentRender.Sample( LinearSampler, screenTexCoord.xy ) ); -} \ No newline at end of file +} diff --git a/neo/shaders/heathaze.vs.hlsl b/neo/shaders/heathaze.vs.hlsl index 9beb790fcc..d01d90a9e2 100644 --- a/neo/shaders/heathaze.vs.hlsl +++ b/neo/shaders/heathaze.vs.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet7.inc.hlsl" // User Renderparms start at 128 as per renderprogs.h @@ -61,19 +62,19 @@ void main( VS_IN vertex, out VS_OUT result ) #include "skinning.inc.hlsl" // texture 0 takes the texture coordinates and adds a scroll - const float4 textureScroll = rpUser0; + const float4 textureScroll = pc.rpUser0; result.texcoord0 = float4( vertex.texcoord.xy, 0, 0 ) + textureScroll; // texture 1 takes the deform magnitude and scales it by the projection distance float4 vec = float4( 0, 1, 0, 1 ); - vec.z = dot4( modelPosition, rpModelViewMatrixZ ); // this is the modelview matrix + vec.z = dot4( modelPosition, pc.rpModelViewMatrixZ ); // this is the modelview matrix // magicProjectionAdjust is a magic scalar that scales the projection since we changed from // using the X axis to the Y axis to calculate x. It is an approximation to closely match // what the original game did const float magicProjectionAdjust = 0.43f; - float x = dot4( vec, rpProjectionMatrixY ) * magicProjectionAdjust; - float w = dot4( vec, rpProjectionMatrixW ); + float x = dot4( vec, pc.rpProjectionMatrixY ) * magicProjectionAdjust; + float w = dot4( vec, pc.rpProjectionMatrixW ); // don't let the recip get near zero for polygons that cross the view plane w = max( w, 1.0 ); @@ -83,6 +84,6 @@ void main( VS_IN vertex, out VS_OUT result ) // clamp the distance so the the deformations don't get too wacky near the view x = min( x, 0.02 ); - const float4 deformMagnitude = rpUser1; + const float4 deformMagnitude = pc.rpUser1; result.texcoord1 = x * deformMagnitude; -} \ No newline at end of file +} diff --git a/neo/shaders/mattiascrt.ps.hlsl b/neo/shaders/mattiascrt.ps.hlsl index f2fd239dc3..acb91b668a 100644 --- a/neo/shaders/mattiascrt.ps.hlsl +++ b/neo/shaders/mattiascrt.ps.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet7.inc.hlsl" // *INDENT-OFF* @@ -115,4 +116,4 @@ void main( PS_IN fragment, out PS_OUT result ) //result.color = tex2D(samp0, fragment.texcoord0.xy ); //result.color = float4(1.0f, 1.0f, 1.0f, 1.0f); -} \ No newline at end of file +} diff --git a/neo/shaders/mattiascrt.vs.hlsl b/neo/shaders/mattiascrt.vs.hlsl index 7ceb4e894f..b67b7e193a 100644 --- a/neo/shaders/mattiascrt.vs.hlsl +++ b/neo/shaders/mattiascrt.vs.hlsl @@ -27,6 +27,8 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet7.inc.hlsl" + // *INDENT-OFF* #if USE_GPU_SKINNING @@ -59,5 +61,5 @@ void main( VS_IN vertex, out VS_OUT result ) result.texcoord0.xy = vertex.texcoord; // user parameters from material - result.texcoord1 = rpUser0; -} \ No newline at end of file + result.texcoord1 = pc.rpUser0; +} diff --git a/neo/shaders/renderParmSet0.inc.hlsl b/neo/shaders/renderParmSet0.inc.hlsl new file mode 100644 index 0000000000..4c6f755146 --- /dev/null +++ b/neo/shaders/renderParmSet0.inc.hlsl @@ -0,0 +1,58 @@ +/* +=========================================================================== + +Doom 3 BFG Edition GPL Source Code +Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. +Copyright (C) 2013-2020 Robert Beckebans + +This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). + +Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Doom 3 BFG Edition Source Code. If not, see . + +In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. + +If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. + +=========================================================================== +*/ + +#include "vulkan.hlsli" + +struct renderParmSet0_t +{ + float4 rpLocalViewOrigin; + + float4 rpVertexColorModulate; + float4 rpVertexColorAdd; + + float4 rpColor; + + float4 rpMVPmatrixX; + float4 rpMVPmatrixY; + float4 rpMVPmatrixZ; + float4 rpMVPmatrixW; +}; + +#if USE_PUSH_CONSTANTS + +VK_PUSH_CONSTANT ConstantBuffer pc : register( b0 ); + +#else + +cbuffer pc : register( b0 VK_DESCRIPTOR_SET( 0 ) ) +{ + renderParmSet0_t pc; +} + +#endif diff --git a/neo/shaders/renderParmSet1.inc.hlsl b/neo/shaders/renderParmSet1.inc.hlsl new file mode 100644 index 0000000000..48e9bcd40b --- /dev/null +++ b/neo/shaders/renderParmSet1.inc.hlsl @@ -0,0 +1,58 @@ +/* +=========================================================================== + +Doom 3 BFG Edition GPL Source Code +Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. +Copyright (C) 2013-2020 Robert Beckebans + +This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). + +Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Doom 3 BFG Edition Source Code. If not, see . + +In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. + +If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. + +=========================================================================== +*/ + +#include "vulkan.hlsli" + +struct renderParmSet1_t +{ + float4 rpScreenCorrectionFactor; + float4 rpWindowCoord; + + float4 rpMVPmatrixX; + float4 rpMVPmatrixY; + float4 rpMVPmatrixZ; + float4 rpMVPmatrixW; + + float4 rpProjectionMatrixZ; + + float4 rpOverbright; +}; + +#if USE_PUSH_CONSTANTS + +VK_PUSH_CONSTANT ConstantBuffer pc : register( b0 ); + +#else + +cbuffer pc : register( b0 VK_DESCRIPTOR_SET( 0 ) ) +{ + renderParmSet1_t pc; +} + +#endif diff --git a/neo/shaders/renderParmSet10.inc.hlsl b/neo/shaders/renderParmSet10.inc.hlsl new file mode 100644 index 0000000000..26cc78acad --- /dev/null +++ b/neo/shaders/renderParmSet10.inc.hlsl @@ -0,0 +1,91 @@ +/* +=========================================================================== + +Doom 3 BFG Edition GPL Source Code +Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. +Copyright (C) 2013-2020 Robert Beckebans + +This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). + +Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Doom 3 BFG Edition Source Code. If not, see . + +In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. + +If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. + +=========================================================================== +*/ + +struct renderParmSet10_t +{ + float4 rpScreenCorrectionFactor; + float4 rpDiffuseModifier; + float4 rpSpecularModifier; + + float4 rpLocalLightOrigin; + float4 rpLocalViewOrigin; + + float4 rpLightProjectionS; + float4 rpLightProjectionT; + float4 rpLightProjectionQ; + float4 rpLightFalloffS; + + float4 rpBumpMatrixS; + float4 rpBumpMatrixT; + + float4 rpDiffuseMatrixS; + float4 rpDiffuseMatrixT; + + float4 rpSpecularMatrixS; + float4 rpSpecularMatrixT; + + float4 rpVertexColorModulate; + float4 rpVertexColorAdd; + + float4 rpMVPmatrixX; + float4 rpMVPmatrixY; + float4 rpMVPmatrixZ; + float4 rpMVPmatrixW; + + float4 rpModelMatrixX; + float4 rpModelMatrixY; + float4 rpModelMatrixZ; + float4 rpModelMatrixW; + + float4 rpModelViewMatrixX; + float4 rpModelViewMatrixY; + float4 rpModelViewMatrixZ; + float4 rpModelViewMatrixW; + + float4 rpGlobalLightOrigin; + float4 rpJitterTexScale; + float4 rpJitterTexOffset; + float4 rpCascadeDistances; + + float4 rpShadowMatrices[6 * 4]; + float4 rpShadowAtlasOffsets[6]; +}; + +#if USE_PUSH_CONSTANTS + +VK_PUSH_CONSTANT ConstantBuffer pc : register( b0 ); + +#else + +cbuffer pc : register( b0 VK_DESCRIPTOR_SET( 0 ) ) +{ + renderParmSet10_t pc; +} + +#endif diff --git a/neo/shaders/renderParmSet2.inc.hlsl b/neo/shaders/renderParmSet2.inc.hlsl new file mode 100644 index 0000000000..e320e6cc49 --- /dev/null +++ b/neo/shaders/renderParmSet2.inc.hlsl @@ -0,0 +1,57 @@ +/* +=========================================================================== + +Doom 3 BFG Edition GPL Source Code +Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. +Copyright (C) 2013-2020 Robert Beckebans + +This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). + +Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Doom 3 BFG Edition Source Code. If not, see . + +In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. + +If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. + +=========================================================================== +*/ + +#include "vulkan.hlsli" + +struct renderParmSet2_t +{ + float4 rpScreenCorrectionFactor; + float4 rpWindowCoord; + + float4 rpModelMatrixX; + float4 rpModelMatrixY; + float4 rpModelMatrixZ; + float4 rpModelMatrixW; + + float4 rpJitterTexScale; + float4 rpJitterTexOffset; +}; + +#if USE_PUSH_CONSTANTS + +VK_PUSH_CONSTANT ConstantBuffer pc : register( b0 ); + +#else + +cbuffer pc : register( b0 VK_DESCRIPTOR_SET( 0 ) ) +{ + renderParmSet2_t pc; +} + +#endif diff --git a/neo/shaders/renderParmSet3.inc.hlsl b/neo/shaders/renderParmSet3.inc.hlsl new file mode 100644 index 0000000000..e6ecc1cb45 --- /dev/null +++ b/neo/shaders/renderParmSet3.inc.hlsl @@ -0,0 +1,70 @@ +/* +=========================================================================== + +Doom 3 BFG Edition GPL Source Code +Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. +Copyright (C) 2013-2020 Robert Beckebans + +This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). + +Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Doom 3 BFG Edition Source Code. If not, see . + +In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. + +If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. + +=========================================================================== +*/ + +#include "vulkan.hlsli" + +struct renderParmSet3_t +{ + float4 rpScreenCorrectionFactor; + + float4 rpBumpMatrixS; + float4 rpBumpMatrixT; + + float4 rpVertexColorModulate; + float4 rpVertexColorAdd; + + float4 rpColor; + + float4 rpMVPmatrixX; + float4 rpMVPmatrixY; + float4 rpMVPmatrixZ; + float4 rpMVPmatrixW; + + float4 rpModelViewMatrixX; + float4 rpModelViewMatrixY; + float4 rpModelViewMatrixZ; + + float4 rpTextureMatrixS; + float4 rpTextureMatrixT; + + float4 rpTexGen0Enabled; +}; + +#if USE_PUSH_CONSTANTS + +VK_PUSH_CONSTANT ConstantBuffer pc : register( b0 ); + +#else + +cbuffer pc : register( b0 VK_DESCRIPTOR_SET( 0 ) ) +{ + renderParmSet3_t pc; +} + +#endif diff --git a/neo/shaders/renderParmSet4.inc.hlsl b/neo/shaders/renderParmSet4.inc.hlsl new file mode 100644 index 0000000000..715345cc89 --- /dev/null +++ b/neo/shaders/renderParmSet4.inc.hlsl @@ -0,0 +1,69 @@ +/* +=========================================================================== + +Doom 3 BFG Edition GPL Source Code +Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. +Copyright (C) 2013-2020 Robert Beckebans + +This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). + +Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Doom 3 BFG Edition Source Code. If not, see . + +In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. + +If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. + +=========================================================================== +*/ + +#include "vulkan.hlsli" + +struct renderParmSet4_t +{ + float4 rpVertexColorModulate; + float4 rpVertexColorAdd; + + float4 rpColor; + + float4 rpMVPmatrixX; + float4 rpMVPmatrixY; + float4 rpMVPmatrixZ; + float4 rpMVPmatrixW; + + float4 rpTextureMatrixS; + float4 rpTextureMatrixT; + + float4 rpTexGen0S; + float4 rpTexGen0T; + float4 rpTexGen0Q; + float4 rpTexGen0Enabled; + + float4 rpTexGen1S; + float4 rpTexGen1T; + + float4 rpAlphaTest; +}; + +#if USE_PUSH_CONSTANTS + +VK_PUSH_CONSTANT ConstantBuffer pc : register( b0 ); + +#else + +cbuffer pc : register( b0 VK_DESCRIPTOR_SET( 0 ) ) +{ + renderParmSet4_t pc; +} + +#endif diff --git a/neo/shaders/renderParmSet5.inc.hlsl b/neo/shaders/renderParmSet5.inc.hlsl new file mode 100644 index 0000000000..a15d733bed --- /dev/null +++ b/neo/shaders/renderParmSet5.inc.hlsl @@ -0,0 +1,69 @@ +/* +=========================================================================== + +Doom 3 BFG Edition GPL Source Code +Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. +Copyright (C) 2013-2020 Robert Beckebans + +This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). + +Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Doom 3 BFG Edition Source Code. If not, see . + +In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. + +If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. + +=========================================================================== +*/ + +#include "vulkan.hlsli" + +struct renderParmSet5_t +{ + float4 rpLocalViewOrigin; + + float4 rpVertexColorModulate; + float4 rpVertexColorAdd; + + float4 rpColor; + + float4 rpMVPmatrixX; + float4 rpMVPmatrixY; + float4 rpMVPmatrixZ; + float4 rpMVPmatrixW; + + float4 rpModelMatrixX; + float4 rpModelMatrixY; + float4 rpModelMatrixZ; + float4 rpModelMatrixW; + + float4 rpWobbleSkyX; + float4 rpWobbleSkyY; + float4 rpWobbleSkyZ; + + float4 rpCascadeDistances; +}; + +#if USE_PUSH_CONSTANTS + +VK_PUSH_CONSTANT ConstantBuffer pc : register( b0 ); + +#else + +cbuffer pc : register( b0 VK_DESCRIPTOR_SET( 0 ) ) +{ + renderParmSet5_t pc; +} + +#endif diff --git a/neo/shaders/renderParmSet6.inc.hlsl b/neo/shaders/renderParmSet6.inc.hlsl new file mode 100644 index 0000000000..daa04d0017 --- /dev/null +++ b/neo/shaders/renderParmSet6.inc.hlsl @@ -0,0 +1,68 @@ +/* +=========================================================================== + +Doom 3 BFG Edition GPL Source Code +Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. +Copyright (C) 2013-2020 Robert Beckebans + +This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). + +Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Doom 3 BFG Edition Source Code. If not, see . + +In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. + +If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. + +=========================================================================== +*/ + +#include "vulkan.hlsli" + +struct renderParmSet6_t +{ + float4 rpScreenCorrectionFactor; + float4 rpWindowCoord; + + float4 rpColor; + + float4 rpMVPmatrixX; + float4 rpMVPmatrixY; + float4 rpMVPmatrixZ; + float4 rpMVPmatrixW; + + float4 rpModelMatrixX; + float4 rpModelMatrixY; + float4 rpModelMatrixZ; + float4 rpModelMatrixW; + + float4 rpOverbright; + + float4 rpGlobalLightOrigin; + float4 rpJitterTexScale; + float4 rpJitterTexOffset; + float4 rpCascadeDistances; +}; + +#if USE_PUSH_CONSTANTS + +VK_PUSH_CONSTANT ConstantBuffer pc : register( b0 ); + +#else + +cbuffer pc : register( b0 VK_DESCRIPTOR_SET( 0 ) ) +{ + renderParmSet6_t pc; +} + +#endif diff --git a/neo/shaders/renderParmSet7.inc.hlsl b/neo/shaders/renderParmSet7.inc.hlsl new file mode 100644 index 0000000000..64067ef3eb --- /dev/null +++ b/neo/shaders/renderParmSet7.inc.hlsl @@ -0,0 +1,73 @@ +/* +=========================================================================== + +Doom 3 BFG Edition GPL Source Code +Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. +Copyright (C) 2013-2020 Robert Beckebans + +This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). + +Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Doom 3 BFG Edition Source Code. If not, see . + +In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. + +If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. + +=========================================================================== +*/ + +#include "vulkan.hlsli" + +struct renderParmSet7_t +{ + float4 rpWindowCoord; + + float4 rpMVPmatrixX; + float4 rpMVPmatrixY; + float4 rpMVPmatrixZ; + float4 rpMVPmatrixW; + + float4 rpProjectionMatrixY; + float4 rpProjectionMatrixW; + + float4 rpModelViewMatrixZ; + + float4 rpEnableSkinning; + float4 rpAlphaTest; + + float4 rpUser0; + float4 rpUser1; + float4 rpUser2; + float4 rpUser3; + float4 rpUser4; + float4 rpUser5; +}; + +#if USE_PUSH_CONSTANTS + +VK_PUSH_CONSTANT ConstantBuffer pc : register( b0 ); + +#else + +cbuffer pc : register( b0 VK_DESCRIPTOR_SET( 0 ) ) +{ + renderParmSet7_t pc; +} + +#endif + +static float2 vposToScreenPosTexCoord( float2 vpos ) +{ + return vpos.xy * pc.rpWindowCoord.xy; +} diff --git a/neo/shaders/renderParmSet8.inc.hlsl b/neo/shaders/renderParmSet8.inc.hlsl new file mode 100644 index 0000000000..4921969e8e --- /dev/null +++ b/neo/shaders/renderParmSet8.inc.hlsl @@ -0,0 +1,93 @@ +/* +=========================================================================== + +Doom 3 BFG Edition GPL Source Code +Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. +Copyright (C) 2013-2020 Robert Beckebans + +This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). + +Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Doom 3 BFG Edition Source Code. If not, see . + +In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. + +If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. + +=========================================================================== +*/ + +#include "vulkan.hlsli" + +struct renderParmSet8_t +{ + float4 rpScreenCorrectionFactor; + float4 rpWindowCoord; + float4 rpDiffuseModifier; + float4 rpSpecularModifier; + + float4 rpLocalLightOrigin; + float4 rpLocalViewOrigin; + + float4 rpBumpMatrixS; + float4 rpBumpMatrixT; + + float4 rpDiffuseMatrixS; + float4 rpDiffuseMatrixT; + + float4 rpSpecularMatrixS; + float4 rpSpecularMatrixT; + + float4 rpVertexColorModulate; + float4 rpVertexColorAdd; + + float4 rpGlobalEyePos; + + float4 rpMVPmatrixX; + float4 rpMVPmatrixY; + float4 rpMVPmatrixZ; + float4 rpMVPmatrixW; + + float4 rpModelMatrixX; + float4 rpModelMatrixY; + float4 rpModelMatrixZ; + float4 rpModelMatrixW; + + //float4 rpWobbleSkyX; + //float4 rpWobbleSkyY; + //float4 rpWobbleSkyZ; + + float4 rpAmbientColor; + float4 rpGlobalLightOrigin; + float4 rpJitterTexScale; + float4 rpJitterTexOffset; + float4 rpCascadeDistances; +}; + +#if USE_PUSH_CONSTANTS + +VK_PUSH_CONSTANT ConstantBuffer pc : register( b0 ); + +#else + +cbuffer pc : register( b0 VK_DESCRIPTOR_SET( 0 ) ) +{ + renderParmSet8_t pc; +} + +#endif + +static float2 vposToScreenPosTexCoord( float2 vpos ) +{ + return vpos.xy * pc.rpWindowCoord.xy; +} diff --git a/neo/shaders/renderParmSet9.inc.hlsl b/neo/shaders/renderParmSet9.inc.hlsl new file mode 100644 index 0000000000..976c8db923 --- /dev/null +++ b/neo/shaders/renderParmSet9.inc.hlsl @@ -0,0 +1,74 @@ +/* +=========================================================================== + +Doom 3 BFG Edition GPL Source Code +Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. +Copyright (C) 2013-2020 Robert Beckebans + +This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). + +Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Doom 3 BFG Edition Source Code. If not, see . + +In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. + +If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. + +=========================================================================== +*/ + +#include "vulkan.hlsli" + +struct renderParmSet9_t +{ + float4 rpDiffuseModifier; + float4 rpSpecularModifier; + + float4 rpLocalLightOrigin; + float4 rpLocalViewOrigin; + + float4 rpLightProjectionS; + float4 rpLightProjectionT; + float4 rpLightProjectionQ; + float4 rpLightFalloffS; + + float4 rpBumpMatrixS; + float4 rpBumpMatrixT; + + float4 rpDiffuseMatrixS; + float4 rpDiffuseMatrixT; + + float4 rpSpecularMatrixS; + float4 rpSpecularMatrixT; + + float4 rpVertexColorModulate; + float4 rpVertexColorAdd; + + float4 rpMVPmatrixX; + float4 rpMVPmatrixY; + float4 rpMVPmatrixZ; + float4 rpMVPmatrixW; +}; + +#if USE_PUSH_CONSTANTS + +VK_PUSH_CONSTANT ConstantBuffer pc : register( b0 ); + +#else + +cbuffer pc : register( b0 VK_DESCRIPTOR_SET( 0 ) ) +{ + renderParmSet9_t pc; +} + +#endif diff --git a/neo/shaders/shaders.cfg b/neo/shaders/shaders.cfg index 2e74f58d9e..2b8e5b4c58 100644 --- a/neo/shaders/shaders.cfg +++ b/neo/shaders/shaders.cfg @@ -4,100 +4,100 @@ ## remove these if we load the shaders as separate units instead of as ## packaged programs. -builtin/debug/lightgrid.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -builtin/debug/lightgrid.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -builtin/debug/octahedron.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -builtin/debug/octahedron.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -builtin/debug/debug_shadowmap.vs.hlsl -T vs_5_0 -builtin/debug/debug_shadowmap.ps.hlsl -T ps_5_0 +builtin/debug/lightgrid.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/debug/lightgrid.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/debug/octahedron.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/debug/octahedron.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/debug/debug_shadowmap.vs.hlsl -T vs_5_0 -D USE_PUSH_CONSTANTS={0,1} +builtin/debug/debug_shadowmap.ps.hlsl -T ps_5_0 -D USE_PUSH_CONSTANTS={0,1} -builtin/gui.vs.hlsl -T vs_5_0 -builtin/gui.ps.hlsl -T ps_5_0 -builtin/color.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -builtin/color.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -builtin/vertex_color.vs.hlsl -T vs_5_0 -builtin/vertex_color.ps.hlsl -T ps_5_0 -builtin/texture_color.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_SRGB={0,1} -builtin/texture_color.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_SRGB={0,1} -builtin/texture_color_texgen.vs.hlsl -T vs_5_0 -builtin/texture_color_texgen.ps.hlsl -T ps_5_0 -builtin/texture.vs.hlsl -T vs_5_0 -builtin/texture.ps.hlsl -T ps_5_0 -builtin/gbuffer.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_NORMAL_FMT_RGB8={0,1} -builtin/gbuffer.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_NORMAL_FMT_RGB8={0,1} -builtin/depth.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -builtin/depth.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} +builtin/gui.vs.hlsl -T vs_5_0 -D USE_PUSH_CONSTANTS={0,1} +builtin/gui.ps.hlsl -T ps_5_0 -D USE_PUSH_CONSTANTS={0,1} +builtin/color.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/color.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/vertex_color.vs.hlsl -T vs_5_0 -D USE_PUSH_CONSTANTS={0,1} +builtin/vertex_color.ps.hlsl -T ps_5_0 -D USE_PUSH_CONSTANTS={0,1} +builtin/texture_color.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_SRGB={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/texture_color.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_SRGB={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/texture_color_texgen.vs.hlsl -T vs_5_0 -D USE_PUSH_CONSTANTS={0,1} +builtin/texture_color_texgen.ps.hlsl -T ps_5_0 -D USE_PUSH_CONSTANTS={0,1} +builtin/texture.vs.hlsl -T vs_5_0 -D USE_PUSH_CONSTANTS={0,1} +builtin/texture.ps.hlsl -T ps_5_0 -D USE_PUSH_CONSTANTS={0,1} +builtin/gbuffer.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_NORMAL_FMT_RGB8={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/gbuffer.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_NORMAL_FMT_RGB8={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/depth.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/depth.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} builtin/blit.ps.hlsl -T ps_5_0 -D TEXTURE_ARRAY={0,1} builtin/rect.vs.hlsl -T vs_5_0 -builtin/legacy/environment.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -builtin/legacy/environment.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -builtin/legacy/bumpyenvironment.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -builtin/legacy/bumpyenvironment.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -builtin/legacy/skybox.vs.hlsl -T vs_5_0 -builtin/legacy/skybox.ps.hlsl -T ps_5_0 -builtin/legacy/wobblesky.vs.hlsl -T vs_5_0 -builtin/legacy/wobblesky.ps.hlsl -T ps_5_0 +builtin/legacy/environment.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/legacy/environment.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/legacy/bumpyenvironment.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/legacy/bumpyenvironment.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/legacy/skybox.vs.hlsl -T vs_5_0 -D USE_PUSH_CONSTANTS={0,1} +builtin/legacy/skybox.ps.hlsl -T ps_5_0 -D USE_PUSH_CONSTANTS={0,1} +builtin/legacy/wobblesky.vs.hlsl -T vs_5_0 -D USE_PUSH_CONSTANTS={0,1} +builtin/legacy/wobblesky.ps.hlsl -T ps_5_0 -D USE_PUSH_CONSTANTS={0,1} -builtin/lighting/ambient_lighting_IBL.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1} -builtin/lighting/ambient_lighting_IBL.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1} -builtin/lighting/ambient_lightgrid_IBL.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1} -builtin/lighting/ambient_lightgrid_IBL.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1} -builtin/lighting/interaction.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1} -builtin/lighting/interaction.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1} -builtin/lighting/interactionAmbient.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1} -builtin/lighting/interactionAmbient.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1} -builtin/lighting/interactionSM.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D LIGHT_POINT={0,1} -D LIGHT_PARALLEL={0,1} -D USE_PBR={0,1} -D USE_NORMAL_FMT_RGB8={0,1} -D USE_SHADOW_ATLAS={0,1} -builtin/lighting/interactionSM.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D LIGHT_POINT={0,1} -D LIGHT_PARALLEL={0,1} -D USE_PBR={0,1} -D USE_NORMAL_FMT_RGB8={0,1} -D USE_SHADOW_ATLAS={0,1} +builtin/lighting/ambient_lighting_IBL.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/lighting/ambient_lighting_IBL.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/lighting/ambient_lightgrid_IBL.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/lighting/ambient_lightgrid_IBL.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/lighting/interaction.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/lighting/interaction.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/lighting/interactionAmbient.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/lighting/interactionAmbient.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/lighting/interactionSM.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D LIGHT_POINT={0,1} -D LIGHT_PARALLEL={0,1} -D USE_PBR={0,1} -D USE_NORMAL_FMT_RGB8={0,1} -D USE_SHADOW_ATLAS={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/lighting/interactionSM.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D LIGHT_POINT={0,1} -D LIGHT_PARALLEL={0,1} -D USE_PBR={0,1} -D USE_NORMAL_FMT_RGB8={0,1} -D USE_SHADOW_ATLAS={0,1} -D USE_PUSH_CONSTANTS={0,1} -builtin/post/postprocess.vs.hlsl -T vs_5_0 -builtin/post/postprocess.ps.hlsl -T ps_5_0 -builtin/post/screen.vs.hlsl -T vs_5_0 -builtin/post/screen.ps.hlsl -T ps_5_0 -builtin/post/tonemap.vs.hlsl -T vs_5_0 -D BRIGHTPASS={0,1} -D HDR_DEBUG={0,1} -builtin/post/tonemap.ps.hlsl -T ps_5_0 -D BRIGHTPASS={0,1} -D HDR_DEBUG={0,1} -builtin/post/hdr_glare_chromatic.vs.hlsl -T vs_5_0 -builtin/post/hdr_glare_chromatic.ps.hlsl -T ps_5_0 -builtin/post/SMAA_edge_detection.vs.hlsl -T vs_5_0 -builtin/post/SMAA_edge_detection.ps.hlsl -T ps_5_0 -builtin/post/SMAA_blending_weight_calc.vs.hlsl -T vs_5_0 -builtin/post/SMAA_blending_weight_calc.ps.hlsl -T ps_5_0 -builtin/post/SMAA_final.vs.hlsl -T vs_5_0 -builtin/post/SMAA_final.ps.hlsl -T ps_5_0 -builtin/post/motionBlur.vs.hlsl -T vs_5_0 -D VECTORS_ONLY={0,1} -builtin/post/motionBlur.ps.hlsl -T ps_5_0 -D VECTORS_ONLY={0,1} +builtin/post/postprocess.vs.hlsl -T vs_5_0 -D USE_PUSH_CONSTANTS={0,1} +builtin/post/postprocess.ps.hlsl -T ps_5_0 -D USE_PUSH_CONSTANTS={0,1} +builtin/post/screen.vs.hlsl -T vs_5_0 -D USE_PUSH_CONSTANTS={0,1} +builtin/post/screen.ps.hlsl -T ps_5_0 -D USE_PUSH_CONSTANTS={0,1} +builtin/post/tonemap.vs.hlsl -T vs_5_0 -D BRIGHTPASS={0,1} -D HDR_DEBUG={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/post/tonemap.ps.hlsl -T ps_5_0 -D BRIGHTPASS={0,1} -D HDR_DEBUG={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/post/hdr_glare_chromatic.vs.hlsl -T vs_5_0 -D USE_PUSH_CONSTANTS={0,1} +builtin/post/hdr_glare_chromatic.ps.hlsl -T ps_5_0 -D USE_PUSH_CONSTANTS={0,1} +builtin/post/SMAA_edge_detection.vs.hlsl -T vs_5_0 -D USE_PUSH_CONSTANTS={0,1} +builtin/post/SMAA_edge_detection.ps.hlsl -T ps_5_0 -D USE_PUSH_CONSTANTS={0,1} +builtin/post/SMAA_blending_weight_calc.vs.hlsl -T vs_5_0 -D USE_PUSH_CONSTANTS={0,1} +builtin/post/SMAA_blending_weight_calc.ps.hlsl -T ps_5_0 -D USE_PUSH_CONSTANTS={0,1} +builtin/post/SMAA_final.vs.hlsl -T vs_5_0 -D USE_PUSH_CONSTANTS={0,1} +builtin/post/SMAA_final.ps.hlsl -T ps_5_0 -D USE_PUSH_CONSTANTS={0,1} +builtin/post/motionBlur.vs.hlsl -T vs_5_0 -D VECTORS_ONLY={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/post/motionBlur.ps.hlsl -T ps_5_0 -D VECTORS_ONLY={0,1} -D USE_PUSH_CONSTANTS={0,1} 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/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} -builtin/SSAO/AmbientOcclusion_AO.ps.hlsl -T ps_5_0 -D BRIGHTPASS={0,1} -builtin/SSAO/AmbientOcclusion_blur.vs.hlsl -T vs_5_0 -D BRIGHTPASS={0,1} -builtin/SSAO/AmbientOcclusion_blur.ps.hlsl -T ps_5_0 -D BRIGHTPASS={0,1} +builtin/SSAO/AmbientOcclusion_AO.vs.hlsl -T vs_5_0 -D BRIGHTPASS={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/SSAO/AmbientOcclusion_AO.ps.hlsl -T ps_5_0 -D BRIGHTPASS={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/SSAO/AmbientOcclusion_blur.vs.hlsl -T vs_5_0 -D BRIGHTPASS={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/SSAO/AmbientOcclusion_blur.ps.hlsl -T ps_5_0 -D BRIGHTPASS={0,1} -D USE_PUSH_CONSTANTS={0,1} -builtin/SSGI/DeepGBufferRadiosity_blur.vs.hlsl -T vs_5_0 -builtin/SSGI/DeepGBufferRadiosity_blur.ps.hlsl -T ps_5_0 -builtin/SSGI/DeepGBufferRadiosity_radiosity.vs.hlsl -T vs_5_0 -builtin/SSGI/DeepGBufferRadiosity_radiosity.ps.hlsl -T ps_5_0 +builtin/SSGI/DeepGBufferRadiosity_blur.vs.hlsl -T vs_5_0 -D USE_PUSH_CONSTANTS={0,1} +builtin/SSGI/DeepGBufferRadiosity_blur.ps.hlsl -T ps_5_0 -D USE_PUSH_CONSTANTS={0,1} +builtin/SSGI/DeepGBufferRadiosity_radiosity.vs.hlsl -T vs_5_0 -D USE_PUSH_CONSTANTS={0,1} +builtin/SSGI/DeepGBufferRadiosity_radiosity.ps.hlsl -T ps_5_0 -D USE_PUSH_CONSTANTS={0,1} -builtin/fog/blendLight.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -builtin/fog/blendLight.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -builtin/fog/fog.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -builtin/fog/fog.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} +builtin/fog/blendLight.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/fog/blendLight.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/fog/fog.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/fog/fog.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} -builtin/video/bink.vs.hlsl -T vs_5_0 -D USE_SRGB={0,1} -builtin/video/bink.ps.hlsl -T ps_5_0 -D USE_SRGB={0,1} -builtin/video/bink_gui.vs.hlsl -T vs_5_0 -builtin/video/bink_gui.ps.hlsl -T ps_5_0 +builtin/video/bink.vs.hlsl -T vs_5_0 -D USE_SRGB={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/video/bink.ps.hlsl -T ps_5_0 -D USE_SRGB={0,1} -D USE_PUSH_CONSTANTS={0,1} +builtin/video/bink_gui.vs.hlsl -T vs_5_0 -D USE_PUSH_CONSTANTS={0,1} +builtin/video/bink_gui.ps.hlsl -T ps_5_0 -D USE_PUSH_CONSTANTS={0,1} -builtin/VR/stereoDeGhost.vs.hlsl -T vs_5_0 -builtin/VR/stereoDeGhost.ps.hlsl -T ps_5_0 -builtin/VR/stereoInterlace.vs.hlsl -T vs_5_0 -builtin/VR/stereoInterlace.ps.hlsl -T ps_5_0 -builtin/VR/stereoWarp.vs.hlsl -T vs_5_0 -builtin/VR/stereoWarp.ps.hlsl -T ps_5_0 +builtin/VR/stereoDeGhost.vs.hlsl -T vs_5_0 -D USE_PUSH_CONSTANTS={0,1} +builtin/VR/stereoDeGhost.ps.hlsl -T ps_5_0 -D USE_PUSH_CONSTANTS={0,1} +builtin/VR/stereoInterlace.vs.hlsl -T vs_5_0 -D USE_PUSH_CONSTANTS={0,1} +builtin/VR/stereoInterlace.ps.hlsl -T ps_5_0 -D USE_PUSH_CONSTANTS={0,1} +builtin/VR/stereoWarp.vs.hlsl -T vs_5_0 -D USE_PUSH_CONSTANTS={0,1} +builtin/VR/stereoWarp.ps.hlsl -T ps_5_0 -D USE_PUSH_CONSTANTS={0,1} # Compute shaders builtin/mipmapgen.cs.hlsl -T cs_5_0 -D MODE={0,1,2,3} @@ -106,27 +106,27 @@ builtin/SSAO/ssao_compute.cs.hlsl -T cs_5_0 -D OCT_ENCODED_NORMALS={0,1} -D DIRE builtin/SSAO/ssao_deinterleave.cs.hlsl -T cs_5_0 -D LINEAR_DEPTH={0,1} # User shaders -bloodorb_draw.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -bloodorb_draw.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -bloodorb1_capture.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -bloodorb1_capture.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -bloodorb2_capture.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -bloodorb2_capture.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -bloodorb3_capture.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -bloodorb3_capture.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -colorProcess.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -colorProcess.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -enviroSuit.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -enviroSuit.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -fogwithlights.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -fogwithlights.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -heathaze.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -heathaze.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -heatHazeWithMask.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -heatHazeWithMask.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -heatHazeWithMaskAndVertex.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -heatHazeWithMaskAndVertex.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -mattiascrt.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -mattiascrt.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -vornoipattern.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -vornoipattern.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} \ No newline at end of file +bloodorb_draw.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +bloodorb_draw.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +bloodorb1_capture.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +bloodorb1_capture.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +bloodorb2_capture.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +bloodorb2_capture.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +bloodorb3_capture.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +bloodorb3_capture.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +colorProcess.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +colorProcess.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +enviroSuit.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +enviroSuit.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +fogwithlights.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +fogwithlights.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +heathaze.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +heathaze.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +heatHazeWithMask.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +heatHazeWithMask.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +heatHazeWithMaskAndVertex.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +heatHazeWithMaskAndVertex.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +mattiascrt.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +mattiascrt.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +vornoipattern.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} +vornoipattern.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PUSH_CONSTANTS={0,1} diff --git a/neo/shaders/skinning.inc.hlsl b/neo/shaders/skinning.inc.hlsl index 194482e232..df1456f859 100644 --- a/neo/shaders/skinning.inc.hlsl +++ b/neo/shaders/skinning.inc.hlsl @@ -31,7 +31,7 @@ float4 modelPosition = vertex.position; // RB: no GPU skinning with ES 2.0 #if USE_GPU_SKINNING -BRANCH if( rpEnableSkinning.x > 0.0 ) +BRANCH if( pc.rpEnableSkinning.x > 0.0 ) { //-------------------------------------------------------------- // GPU transformation of the normal / binormal / bitangent @@ -72,7 +72,7 @@ BRANCH if( rpEnableSkinning.x > 0.0 ) #endif // RB end -result.position.x = dot4( modelPosition, rpMVPmatrixX ); -result.position.y = dot4( modelPosition, rpMVPmatrixY ); -result.position.z = dot4( modelPosition, rpMVPmatrixZ ); -result.position.w = dot4( modelPosition, rpMVPmatrixW ); \ No newline at end of file +result.position.x = dot4( modelPosition, pc.rpMVPmatrixX ); +result.position.y = dot4( modelPosition, pc.rpMVPmatrixY ); +result.position.z = dot4( modelPosition, pc.rpMVPmatrixZ ); +result.position.w = dot4( modelPosition, pc.rpMVPmatrixW ); diff --git a/neo/shaders/vertbuffershaders.hlsl b/neo/shaders/vertbuffershaders.hlsl index b302d0d6a0..47fdc7283f 100644 --- a/neo/shaders/vertbuffershaders.hlsl +++ b/neo/shaders/vertbuffershaders.hlsl @@ -21,6 +21,8 @@ */ #include "global_inc.hlsl" +#include "renderParmSet7.inc.hlsl" + #pragma pack_matrix(row_major) @@ -46,10 +48,10 @@ PS_INPUT main_vs( VS_INPUT input ) PS_INPUT output; - output.pos.x = dot4( pos, rpMVPmatrixX ); - output.pos.y = dot4( pos, rpMVPmatrixY ); - output.pos.z = dot4( pos, rpMVPmatrixZ ); - output.pos.w = dot4( pos, rpMVPmatrixW ); + output.pos.x = dot4( pos, pc.rpMVPmatrixX ); + output.pos.y = dot4( pos, pc.rpMVPmatrixY ); + output.pos.z = dot4( pos, pc.rpMVPmatrixZ ); + output.pos.w = dot4( pos, pc.rpMVPmatrixW ); output.color = swizzleColor( input.color ); output.uv = input.uv; @@ -66,7 +68,7 @@ float4 main_ps( PS_INPUT input ) : SV_Target { float4 color = t_Texture.Sample( s_Sampler, input.uv ) * input.color; - clip( color.a - rpAlphaTest.x ); + clip( color.a - pc.rpAlphaTest.x ); return sRGBAToLinearRGBA( color ); } diff --git a/neo/shaders/vornoipattern.ps.hlsl b/neo/shaders/vornoipattern.ps.hlsl index 9d5a58b470..9c45215b1e 100644 --- a/neo/shaders/vornoipattern.ps.hlsl +++ b/neo/shaders/vornoipattern.ps.hlsl @@ -56,6 +56,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet7.inc.hlsl" // *INDENT-OFF* @@ -193,4 +194,4 @@ void main( PS_IN fragment, out PS_OUT result ) // Basic gamma correction result.color = float4( sqrt( clamp( col, 0., 1. ) ).xyz, 1 ); -} \ No newline at end of file +} diff --git a/neo/shaders/vornoipattern.vs.hlsl b/neo/shaders/vornoipattern.vs.hlsl index df5c6bcf0c..0da34a96e5 100644 --- a/neo/shaders/vornoipattern.vs.hlsl +++ b/neo/shaders/vornoipattern.vs.hlsl @@ -27,6 +27,8 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet7.inc.hlsl" + // *INDENT-OFF* #if USE_GPU_SKINNING @@ -54,13 +56,13 @@ struct VS_OUT void main( VS_IN vertex, out VS_OUT result ) { #include "skinning.inc.hlsl" - //result.position.x = dot4( vertex.position, rpMVPmatrixX ); - //result.position.y = dot4( vertex.position, rpMVPmatrixY ); - //result.position.z = dot4( vertex.position, rpMVPmatrixZ ); - //result.position.w = dot4( vertex.position, rpMVPmatrixW ); + //result.position.x = dot4( vertex.position, pc.rpMVPmatrixX ); + //result.position.y = dot4( vertex.position, pc.rpMVPmatrixY ); + //result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); + //result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); // pass through texcoords result.texcoord0 = float4( vertex.texcoord.xy, 0, 0 ); - result.texcoord1 = rpUser0; -} \ No newline at end of file + result.texcoord1 = pc.rpUser0; +} diff --git a/neo/sys/DeviceManager.h b/neo/sys/DeviceManager.h index 7cfd8e3401..46d545b7f1 100644 --- a/neo/sys/DeviceManager.h +++ b/neo/sys/DeviceManager.h @@ -109,6 +109,9 @@ struct DeviceCreationParameters // SRS - Used by idImage::AllocImage() to determine if format D24S8 is supported by device (default = true) bool enableImageFormatD24S8 = true; + + // SRS - Used by RenderProgs to determine maximum push constant size (set default for DX12, override for Vulkan) + int maxPushConstantSize = 256; }; struct DefaultMessageCallback : public nvrhi::IMessageCallback @@ -149,6 +152,8 @@ class DeviceManager protected: friend class idRenderBackend; friend class idImage; + friend class idRenderProgManager; + friend class idMaterial; void* windowInstance; void* windowHandle; diff --git a/neo/sys/DeviceManager_VK.cpp b/neo/sys/DeviceManager_VK.cpp index 9813527792..4985708847 100644 --- a/neo/sys/DeviceManager_VK.cpp +++ b/neo/sys/DeviceManager_VK.cpp @@ -924,6 +924,11 @@ bool DeviceManager_VK::createDevice() enablePModeImmediate = find( surfacePModes.begin(), surfacePModes.end(), vk::PresentModeKHR::eImmediate ) != surfacePModes.end(); enablePModeFifoRelaxed = find( surfacePModes.begin(), surfacePModes.end(), vk::PresentModeKHR::eFifoRelaxed ) != surfacePModes.end(); + // SRS - Determine maxPushConstantSize for Vulkan device + vk::PhysicalDeviceProperties deviceProperties; + m_VulkanPhysicalDevice.getProperties( &deviceProperties ); + m_DeviceParams.maxPushConstantSize = deviceProperties.limits.maxPushConstantsSize; + // stash the renderer string auto prop = m_VulkanPhysicalDevice.getProperties(); m_RendererString = std::string( prop.deviceName.data() ); From 01bd50b7cf70ad01aba79560a4f42a64c5198a3c Mon Sep 17 00:00:00 2001 From: Stephen Saunders Date: Mon, 9 Oct 2023 17:03:16 -0400 Subject: [PATCH 02/15] Refactor renderParmSets to fit within D3D12 root constant limit and rename helper arrays for clarity (cherry picked from commit 54f5ffb800114b86ea4e16fcd41c9ac09b17e98a) --- neo/renderer/Material.cpp | 4 +- neo/renderer/NVRHI/RenderBackend_NVRHI.cpp | 11 +- neo/renderer/NVRHI/RenderProgs_NVRHI.cpp | 46 ++-- neo/renderer/RenderProgs.cpp | 202 +++++++++--------- neo/renderer/RenderProgs.h | 66 +++--- neo/shaders/CMakeLists.txt | 4 +- neo/shaders/bloodorb1_capture.ps.hlsl | 2 +- neo/shaders/bloodorb1_capture.vs.hlsl | 2 +- neo/shaders/bloodorb2_capture.ps.hlsl | 2 +- neo/shaders/bloodorb2_capture.vs.hlsl | 2 +- neo/shaders/bloodorb3_capture.ps.hlsl | 2 +- neo/shaders/bloodorb3_capture.vs.hlsl | 2 +- neo/shaders/bloodorb_draw.ps.hlsl | 2 +- neo/shaders/bloodorb_draw.vs.hlsl | 2 +- .../builtin/debug/debug_shadowmap.ps.hlsl | 2 +- .../builtin/debug/debug_shadowmap.vs.hlsl | 18 +- neo/shaders/builtin/fog/blendLight.ps.hlsl | 2 +- neo/shaders/builtin/fog/blendLight.vs.hlsl | 2 +- neo/shaders/builtin/fog/fog.ps.hlsl | 2 +- neo/shaders/builtin/fog/fog.vs.hlsl | 2 +- .../lighting/ambient_lightgrid_IBL.ps.hlsl | 2 +- .../lighting/ambient_lightgrid_IBL.vs.hlsl | 2 +- .../lighting/ambient_lighting_IBL.ps.hlsl | 2 +- .../lighting/ambient_lighting_IBL.vs.hlsl | 2 +- .../builtin/lighting/interaction.ps.hlsl | 2 +- .../builtin/lighting/interaction.vs.hlsl | 2 +- .../lighting/interactionAmbient.ps.hlsl | 2 +- .../lighting/interactionAmbient.vs.hlsl | 2 +- .../builtin/lighting/interactionSM.ps.hlsl | 2 +- .../builtin/lighting/interactionSM.vs.hlsl | 2 +- neo/shaders/colorProcess.ps.hlsl | 2 +- neo/shaders/colorProcess.vs.hlsl | 2 +- neo/shaders/enviroSuit.ps.hlsl | 2 +- neo/shaders/enviroSuit.vs.hlsl | 2 +- neo/shaders/fogwithlights.ps.hlsl | 2 +- neo/shaders/fogwithlights.vs.hlsl | 2 +- neo/shaders/global_inc.hlsl | 2 +- neo/shaders/heatHazeWithMask.ps.hlsl | 2 +- neo/shaders/heatHazeWithMask.vs.hlsl | 2 +- neo/shaders/heatHazeWithMaskAndVertex.ps.hlsl | 2 +- neo/shaders/heatHazeWithMaskAndVertex.vs.hlsl | 2 +- neo/shaders/heathaze.ps.hlsl | 2 +- neo/shaders/heathaze.vs.hlsl | 2 +- neo/shaders/mattiascrt.ps.hlsl | 2 +- neo/shaders/mattiascrt.vs.hlsl | 2 +- neo/shaders/renderParmSet1.inc.hlsl | 2 - neo/shaders/renderParmSet10.inc.hlsl | 25 +-- neo/shaders/renderParmSet11.inc.hlsl | 93 ++++++++ neo/shaders/renderParmSet3.inc.hlsl | 9 - neo/shaders/renderParmSet4.inc.hlsl | 5 +- neo/shaders/renderParmSet5.inc.hlsl | 3 - neo/shaders/renderParmSet6.inc.hlsl | 3 - neo/shaders/renderParmSet7.inc.hlsl | 25 +-- neo/shaders/renderParmSet8.inc.hlsl | 47 ++-- neo/shaders/renderParmSet9.inc.hlsl | 25 ++- neo/shaders/vertbuffershaders.hlsl | 2 +- neo/shaders/vornoipattern.ps.hlsl | 2 +- neo/shaders/vornoipattern.vs.hlsl | 2 +- neo/sys/DeviceManager.h | 6 +- neo/sys/DeviceManager_VK.cpp | 2 +- 60 files changed, 364 insertions(+), 314 deletions(-) create mode 100644 neo/shaders/renderParmSet11.inc.hlsl diff --git a/neo/renderer/Material.cpp b/neo/renderer/Material.cpp index 925b11f19c..6c03999a86 100644 --- a/neo/renderer/Material.cpp +++ b/neo/renderer/Material.cpp @@ -34,8 +34,6 @@ If you have questions concerning this license or the applicable additional terms #include "RenderCommon.h" -#include -extern DeviceManager* deviceManager; /* @@ -2147,7 +2145,7 @@ void idMaterial::ParseStage( idLexer& src, const textureRepeat_t trpDefault ) continue; } - auto usePushConstants = deviceManager->m_DeviceParams.maxPushConstantSize >= renderProgManager.layoutAttributes[BINDING_LAYOUT_POST_PROCESS_INGAME].rpBufSize ? "1" : "0"; + auto usePushConstants = renderProgManager.layoutTypeAttributes[BINDING_LAYOUT_POST_PROCESS_INGAME].pcEnabled ? "1" : "0"; if( !token.Icmp( "program" ) ) { diff --git a/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp b/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp index 9701a80aa0..495dbf98c3 100644 --- a/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp +++ b/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp @@ -482,16 +482,17 @@ void idRenderBackend::DrawElementsWithCounters( const drawSurf_t* surf, bool sha { if( deviceManager->GetGraphicsAPI() == nvrhi::GraphicsAPI::VULKAN ) { - // Reset the graphics state if push constants are enabled or + // Reset the graphics state if the uniforms or binding layout type + // have changed for Vulkan - either push constants are enabled or // the constant buffer is written to and the render pass is // ended for vulkan. setGraphicsState will reinstate the // render pass or set up for push constants. changeState = true; } - else if( renderProgManager.layoutAttributes[bindingLayoutType].pcEnabled ) + else if( renderProgManager.layoutTypeAttributes[bindingLayoutType].pcEnabled ) { // Reset the graphics state if push constants are enabled and - // the uniforms or binding layout have changed for DX12. + // the uniforms or binding layout type have changed for DX12. // setGraphicsState will set up for push constants. changeState = true; } @@ -575,9 +576,9 @@ void idRenderBackend::GetCurrentBindingLayout( int type ) auto range = nvrhi::EntireBuffer; auto uniformsBindingSetItem = nvrhi::BindingSetItem::ConstantBuffer( 0, paramCb, range ); - if( deviceManager->m_DeviceParams.maxPushConstantSize >= renderProgManager.layoutAttributes[type].rpBufSize ) + if( renderProgManager.layoutTypeAttributes[type].pcEnabled ) { - uniformsBindingSetItem = nvrhi::BindingSetItem::PushConstants( 0, renderProgManager.layoutAttributes[type].rpBufSize ); + uniformsBindingSetItem = nvrhi::BindingSetItem::PushConstants( 0, renderProgManager.layoutTypeAttributes[type].rpBufSize ); } if( type == BINDING_LAYOUT_DEFAULT || type == BINDING_LAYOUT_GBUFFER || type == BINDING_LAYOUT_TEXTURE || type == BINDING_LAYOUT_WOBBLESKY || type == BINDING_LAYOUT_SSGI || type == BINDING_LAYOUT_POST_PROCESS ) diff --git a/neo/renderer/NVRHI/RenderProgs_NVRHI.cpp b/neo/renderer/NVRHI/RenderProgs_NVRHI.cpp index 531d127708..60a8cc28e3 100644 --- a/neo/renderer/NVRHI/RenderProgs_NVRHI.cpp +++ b/neo/renderer/NVRHI/RenderProgs_NVRHI.cpp @@ -300,13 +300,13 @@ void idRenderProgManager::SetUniformValue( const renderParm_t rp, const float va } } - for( int i = 0; i < renderParmLayouts[rp].Num(); i++ ) + for( int i = 0; i < renderParmLayoutTypes[rp].Num(); i++ ) { - // SRS - set flag if uniforms changed or volatile constant buffer enabled for layout - int layout = renderParmLayouts[rp][i]; - if( rpChanged || !layoutAttributes[layout].cbStatic ) + // SRS - set flag if uniforms changed or constant buffer is volatile and push constants disabled for layout type + int layoutType = renderParmLayoutTypes[rp][i]; + if( rpChanged || ( !layoutTypeAttributes[layoutType].cbStatic && !layoutTypeAttributes[layoutType].pcEnabled ) ) { - uniformsChanged[layout] = true; + uniformsChanged[layoutType] = true; } } } @@ -333,7 +333,7 @@ idRenderProgManager::SelectUniforms */ void idRenderProgManager::SelectUniforms( renderParmSet_t* renderParmSet, int bindingLayoutType ) { - switch ( layoutAttributes[bindingLayoutType].rpSubSet ) + switch ( layoutTypeAttributes[bindingLayoutType].rpSubSet ) { case renderParmSet0: { @@ -409,9 +409,9 @@ void idRenderProgManager::SelectUniforms( renderParmSet_t* renderParmSet, int bi case renderParmSet8: { - for( int i = 0; i < rpMaximalSet8.Num(); i++ ) + for( int i = 0; i < rpNominalSet8.Num(); i++ ) { - memcpy( &renderParmSet->maximalSet[i], &uniforms[rpMaximalSet8[i]], sizeof( idVec4 ) ); + memcpy( &renderParmSet->nominalSet[i], &uniforms[rpNominalSet8[i]], sizeof( idVec4 ) ); } break; } @@ -434,10 +434,19 @@ void idRenderProgManager::SelectUniforms( renderParmSet_t* renderParmSet, int bi break; } + case renderParmSet11: + { + for( int i = 0; i < rpMaximalSet11.Num(); i++ ) + { + memcpy( &renderParmSet->maximalSet[i], &uniforms[rpMaximalSet11[i]], sizeof( idVec4 ) ); + } + break; + } + case renderParmNullSet: default: { - common->FatalError( "No layout subset found for binding layout set %d\n", bindingLayoutType ); + common->FatalError( "No renderparm subset found for binding layout type %d\n", bindingLayoutType ); } } @@ -450,29 +459,20 @@ bool idRenderProgManager::CommitConstantBuffer( nvrhi::ICommandList* commandList const int bindingLayoutType = BindingLayoutType(); // SRS - If push constants enabled, skip writing the constant buffer but return state change indicator - if( layoutAttributes[bindingLayoutType].pcEnabled ) + if( layoutTypeAttributes[bindingLayoutType].pcEnabled ) { - if( deviceManager->GetGraphicsAPI() == nvrhi::GraphicsAPI::VULKAN ) - { - // SRS - always return true to force writing of Vulkan push constants - return true; - } - else // DX12 - { - // SRS - return uniforms change status to control writing of DX12 root constants return uniformsChanged[bindingLayoutType] || bindingLayoutTypeChanged; - } } // RB: It would be better to NUM_BINDING_LAYOUTS uniformsChanged entrys but we don't know the current binding layout type when we set the uniforms. // The vkDoom3 backend even didn't bother with this and always fired the uniforms for each draw call. - // SRS - Implemented uniformsChanged detection at per-layout granularity + // SRS - Implemented uniformsChanged detection at per-binding layout type granularity else if( uniformsChanged[bindingLayoutType] || bindingLayoutTypeChanged ) { renderParmSet_t renderParmSet; SelectUniforms( &renderParmSet, bindingLayoutType ); - commandList->writeBuffer( constantBuffer[bindingLayoutType], &renderParmSet, layoutAttributes[bindingLayoutType].rpBufSize ); + commandList->writeBuffer( constantBuffer[bindingLayoutType], &renderParmSet, layoutTypeAttributes[bindingLayoutType].rpBufSize ); for( int i = 0; i < NUM_BINDING_LAYOUTS; i++ ) { @@ -487,13 +487,13 @@ bool idRenderProgManager::CommitConstantBuffer( nvrhi::ICommandList* commandList void idRenderProgManager::CommitPushConstants( nvrhi::ICommandList* commandList, int bindingLayoutType ) { - if( layoutAttributes[bindingLayoutType].pcEnabled ) + if( layoutTypeAttributes[bindingLayoutType].pcEnabled ) { renderParmSet_t renderParmSet; SelectUniforms( &renderParmSet, bindingLayoutType ); - commandList->setPushConstants( &renderParmSet, layoutAttributes[bindingLayoutType].rpBufSize ); + commandList->setPushConstants( &renderParmSet, layoutTypeAttributes[bindingLayoutType].rpBufSize ); for( int i = 0; i < NUM_BINDING_LAYOUTS; i++ ) { diff --git a/neo/renderer/RenderProgs.cpp b/neo/renderer/RenderProgs.cpp index f807947495..ca5fd291c9 100644 --- a/neo/renderer/RenderProgs.cpp +++ b/neo/renderer/RenderProgs.cpp @@ -74,15 +74,15 @@ static void R_ReloadShaders( const idCmdArgs& args ) uniformsLayout ================================================================================================ */ -nvrhi::BindingLayoutHandle idRenderProgManager::uniformsLayout( bindingLayoutType_t layout, bool skinning ) +nvrhi::BindingLayoutHandle idRenderProgManager::uniformsLayout( bindingLayoutType_t layoutType, bool skinning ) { // SRS - Create initial layout item based on choice of static vs. volatile constant buffer - auto rpLayoutItem = layoutAttributes[layout].cbStatic ? nvrhi::BindingLayoutItem::ConstantBuffer( 0 ) : nvrhi::BindingLayoutItem::VolatileConstantBuffer( 0 ); + auto rpLayoutItem = layoutTypeAttributes[layoutType].cbStatic ? nvrhi::BindingLayoutItem::ConstantBuffer( 0 ) : nvrhi::BindingLayoutItem::VolatileConstantBuffer( 0 ); - // SRS - Optionally override based on renderparm subset size and push constant enablement - if( deviceManager->m_DeviceParams.maxPushConstantSize >= layoutAttributes[layout].rpBufSize ) + // SRS - Optionally override based on push constant enablement for binding layout type + if( layoutTypeAttributes[layoutType].pcEnabled ) { - rpLayoutItem = nvrhi::BindingLayoutItem::PushConstants( 0, layoutAttributes[layout].rpBufSize ); + rpLayoutItem = nvrhi::BindingLayoutItem::PushConstants( 0, layoutTypeAttributes[layoutType].rpBufSize ); } // SRS - Create and return uniforms layout based on above choices and skinning enablement @@ -201,156 +201,158 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) rpNominalSet5.Num() * sizeof( idVec4 ) > sizeof( rpNominalSet ) || rpNominalSet6.Num() * sizeof( idVec4 ) > sizeof( rpNominalSet ) || rpNominalSet7.Num() * sizeof( idVec4 ) > sizeof( rpNominalSet ) || - rpMaximalSet8.Num() * sizeof( idVec4 ) > sizeof( rpMaximalSet ) || + rpNominalSet8.Num() * sizeof( idVec4 ) > sizeof( rpNominalSet ) || rpMaximalSet9.Num() * sizeof( idVec4 ) > sizeof( rpMaximalSet ) || - rpMaximalSet10.Num() * sizeof( idVec4 ) > sizeof( rpMaximalSet ) ) + rpMaximalSet10.Num() * sizeof( idVec4 ) > sizeof( rpMaximalSet ) || + rpMaximalSet11.Num() * sizeof( idVec4 ) > sizeof( rpMaximalSet ) ) { common->FatalError( "Renderparm subset sizes exceed push constant buffer sizes" ); } - for( int layout = 0; layout < NUM_BINDING_LAYOUTS; layout++ ) + for( int layoutType = 0; layoutType < NUM_BINDING_LAYOUTS; layoutType++ ) { // SRS - Define renderparm subset attributes for each binding layout type - if( rpMinimalSet0Layouts.Find( ( bindingLayoutType_t )layout ) ) + if( rpMinimalSet0LayoutTypes.Find( ( bindingLayoutType_t )layoutType ) ) { - layoutAttributes[layout].rpSubSet = renderParmSet0; - layoutAttributes[layout].rpBufSize = rpMinimalSet0.Num() * sizeof( idVec4 ); - layoutAttributes[layout].cbStatic = false; + layoutTypeAttributes[layoutType].rpSubSet = renderParmSet0; + layoutTypeAttributes[layoutType].rpBufSize = rpMinimalSet0.Num() * sizeof( idVec4 ); + layoutTypeAttributes[layoutType].cbStatic = false; - // SRS - create renderparm to binding layouts mapping for efficient render-time lookups + // SRS - create renderparm to binding layout types mapping for efficient render-time lookups for( int i = 0; i < rpMinimalSet0.Num(); i++ ) { - renderParmLayouts[rpMinimalSet0[i]].Append( ( bindingLayoutType_t )layout ); + renderParmLayoutTypes[rpMinimalSet0[i]].Append( ( bindingLayoutType_t )layoutType ); } } - else if( rpMinimalSet1Layouts.Find( ( bindingLayoutType_t )layout ) ) + else if( rpMinimalSet1LayoutTypes.Find( ( bindingLayoutType_t )layoutType ) ) { - layoutAttributes[layout].rpSubSet = renderParmSet1; - layoutAttributes[layout].rpBufSize = rpMinimalSet1.Num() * sizeof( idVec4 ); - layoutAttributes[layout].cbStatic = true; + layoutTypeAttributes[layoutType].rpSubSet = renderParmSet1; + layoutTypeAttributes[layoutType].rpBufSize = rpMinimalSet1.Num() * sizeof( idVec4 ); + layoutTypeAttributes[layoutType].cbStatic = false; - // SRS - create renderparm to binding layouts mapping for efficient render-time lookups for( int i = 0; i < rpMinimalSet1.Num(); i++ ) { - renderParmLayouts[rpMinimalSet1[i]].Append( ( bindingLayoutType_t )layout ); + renderParmLayoutTypes[rpMinimalSet1[i]].Append( ( bindingLayoutType_t )layoutType ); } } - else if( rpMinimalSet2Layouts.Find( ( bindingLayoutType_t )layout ) ) + else if( rpMinimalSet2LayoutTypes.Find( ( bindingLayoutType_t )layoutType ) ) { - layoutAttributes[layout].rpSubSet = renderParmSet2; - layoutAttributes[layout].rpBufSize = rpMinimalSet2.Num() * sizeof( idVec4 ); - layoutAttributes[layout].cbStatic = true; + layoutTypeAttributes[layoutType].rpSubSet = renderParmSet2; + layoutTypeAttributes[layoutType].rpBufSize = rpMinimalSet2.Num() * sizeof( idVec4 ); + layoutTypeAttributes[layoutType].cbStatic = false; - // SRS - create renderparm to binding layouts mapping for efficient render-time lookups for( int i = 0; i < rpMinimalSet2.Num(); i++ ) { - renderParmLayouts[rpMinimalSet2[i]].Append( ( bindingLayoutType_t )layout ); + renderParmLayoutTypes[rpMinimalSet2[i]].Append( ( bindingLayoutType_t )layoutType ); } } - else if( rpNominalSet3Layouts.Find( ( bindingLayoutType_t )layout ) ) + else if( rpNominalSet3LayoutTypes.Find( ( bindingLayoutType_t )layoutType ) ) { - layoutAttributes[layout].rpSubSet = renderParmSet3; - layoutAttributes[layout].rpBufSize = rpNominalSet3.Num() * sizeof( idVec4 ); - layoutAttributes[layout].cbStatic = false; + layoutTypeAttributes[layoutType].rpSubSet = renderParmSet3; + layoutTypeAttributes[layoutType].rpBufSize = rpNominalSet3.Num() * sizeof( idVec4 ); + layoutTypeAttributes[layoutType].cbStatic = false; - // SRS - create renderparm to binding layouts mapping for efficient render-time lookups for( int i = 0; i < rpNominalSet3.Num(); i++ ) { - renderParmLayouts[rpNominalSet3[i]].Append( ( bindingLayoutType_t )layout ); + renderParmLayoutTypes[rpNominalSet3[i]].Append( ( bindingLayoutType_t )layoutType ); } } - else if( rpNominalSet4Layouts.Find( ( bindingLayoutType_t )layout ) ) + else if( rpNominalSet4LayoutTypes.Find( ( bindingLayoutType_t )layoutType ) ) { - layoutAttributes[layout].rpSubSet = renderParmSet4; - layoutAttributes[layout].rpBufSize = rpNominalSet4.Num() * sizeof( idVec4 ); - layoutAttributes[layout].cbStatic = false; + layoutTypeAttributes[layoutType].rpSubSet = renderParmSet4; + layoutTypeAttributes[layoutType].rpBufSize = rpNominalSet4.Num() * sizeof( idVec4 ); + layoutTypeAttributes[layoutType].cbStatic = false; - // SRS - create renderparm to binding layouts mapping for efficient render-time lookups for( int i = 0; i < rpNominalSet4.Num(); i++ ) { - renderParmLayouts[rpNominalSet4[i]].Append( ( bindingLayoutType_t )layout ); + renderParmLayoutTypes[rpNominalSet4[i]].Append( ( bindingLayoutType_t )layoutType ); } } - else if( rpNominalSet5Layouts.Find( ( bindingLayoutType_t )layout ) ) + else if( rpNominalSet5LayoutTypes.Find( ( bindingLayoutType_t )layoutType ) ) { - layoutAttributes[layout].rpSubSet = renderParmSet5; - layoutAttributes[layout].rpBufSize = rpNominalSet5.Num() * sizeof( idVec4 ); - layoutAttributes[layout].cbStatic = false; + layoutTypeAttributes[layoutType].rpSubSet = renderParmSet5; + layoutTypeAttributes[layoutType].rpBufSize = rpNominalSet5.Num() * sizeof( idVec4 ); + layoutTypeAttributes[layoutType].cbStatic = false; - // SRS - create renderparm to binding layouts mapping for efficient render-time lookups for( int i = 0; i < rpNominalSet5.Num(); i++ ) { - renderParmLayouts[rpNominalSet5[i]].Append( ( bindingLayoutType_t )layout ); + renderParmLayoutTypes[rpNominalSet5[i]].Append( ( bindingLayoutType_t )layoutType ); } } - else if( rpNominalSet6Layouts.Find( ( bindingLayoutType_t )layout ) ) + else if( rpNominalSet6LayoutTypes.Find( ( bindingLayoutType_t )layoutType ) ) { - layoutAttributes[layout].rpSubSet = renderParmSet6; - layoutAttributes[layout].rpBufSize = rpNominalSet6.Num() * sizeof( idVec4 ); - layoutAttributes[layout].cbStatic = false; + layoutTypeAttributes[layoutType].rpSubSet = renderParmSet6; + layoutTypeAttributes[layoutType].rpBufSize = rpNominalSet6.Num() * sizeof( idVec4 ); + layoutTypeAttributes[layoutType].cbStatic = false; - // SRS - create renderparm to binding layouts mapping for efficient render-time lookups for( int i = 0; i < rpNominalSet6.Num(); i++ ) { - renderParmLayouts[rpNominalSet6[i]].Append( ( bindingLayoutType_t )layout ); + renderParmLayoutTypes[rpNominalSet6[i]].Append( ( bindingLayoutType_t )layoutType ); } } - else if( rpNominalSet7Layouts.Find( ( bindingLayoutType_t )layout ) ) + else if( rpNominalSet7LayoutTypes.Find( ( bindingLayoutType_t )layoutType ) ) { - layoutAttributes[layout].rpSubSet = renderParmSet7; - layoutAttributes[layout].rpBufSize = rpNominalSet7.Num() * sizeof( idVec4 ); - layoutAttributes[layout].cbStatic = false; + layoutTypeAttributes[layoutType].rpSubSet = renderParmSet7; + layoutTypeAttributes[layoutType].rpBufSize = rpNominalSet7.Num() * sizeof( idVec4 ); + layoutTypeAttributes[layoutType].cbStatic = false; - // SRS - create renderparm to binding layouts mapping for efficient render-time lookups for( int i = 0; i < rpNominalSet7.Num(); i++ ) { - renderParmLayouts[rpNominalSet7[i]].Append( ( bindingLayoutType_t )layout ); + renderParmLayoutTypes[rpNominalSet7[i]].Append( ( bindingLayoutType_t )layoutType ); } } - else if( rpMaximalSet8Layouts.Find( ( bindingLayoutType_t )layout ) ) + else if( rpNominalSet8LayoutTypes.Find( ( bindingLayoutType_t )layoutType ) ) { - layoutAttributes[layout].rpSubSet = renderParmSet8; - layoutAttributes[layout].rpBufSize = rpMaximalSet8.Num() * sizeof( idVec4 ); - layoutAttributes[layout].cbStatic = true; + layoutTypeAttributes[layoutType].rpSubSet = renderParmSet8; + layoutTypeAttributes[layoutType].rpBufSize = rpNominalSet8.Num() * sizeof( idVec4 ); + layoutTypeAttributes[layoutType].cbStatic = false; - // SRS - create renderparm to binding layouts mapping for efficient render-time lookups - for( int i = 0; i < rpMaximalSet8.Num(); i++ ) + for( int i = 0; i < rpNominalSet8.Num(); i++ ) { - renderParmLayouts[rpMaximalSet8[i]].Append( ( bindingLayoutType_t )layout ); + renderParmLayoutTypes[rpNominalSet8[i]].Append( ( bindingLayoutType_t )layoutType ); } } - else if( rpMaximalSet9Layouts.Find( ( bindingLayoutType_t )layout ) ) + else if( rpMaximalSet9LayoutTypes.Find( ( bindingLayoutType_t )layoutType ) ) { - layoutAttributes[layout].rpSubSet = renderParmSet9; - layoutAttributes[layout].rpBufSize = rpMaximalSet9.Num() * sizeof( idVec4 ); - layoutAttributes[layout].cbStatic = true; + layoutTypeAttributes[layoutType].rpSubSet = renderParmSet9; + layoutTypeAttributes[layoutType].rpBufSize = rpMaximalSet9.Num() * sizeof( idVec4 ); + layoutTypeAttributes[layoutType].cbStatic = false; - // SRS - create renderparm to binding layouts mapping for efficient render-time lookups for( int i = 0; i < rpMaximalSet9.Num(); i++ ) { - renderParmLayouts[rpMaximalSet9[i]].Append( ( bindingLayoutType_t )layout ); + renderParmLayoutTypes[rpMaximalSet9[i]].Append( ( bindingLayoutType_t )layoutType ); } } - else if( rpMaximalSet10Layouts.Find( ( bindingLayoutType_t )layout ) ) + else if( rpMaximalSet10LayoutTypes.Find( ( bindingLayoutType_t )layoutType ) ) { - layoutAttributes[layout].rpSubSet = renderParmSet10; - layoutAttributes[layout].rpBufSize = rpMaximalSet10.Num() * sizeof( idVec4 ); - layoutAttributes[layout].cbStatic = true; + layoutTypeAttributes[layoutType].rpSubSet = renderParmSet10; + layoutTypeAttributes[layoutType].rpBufSize = rpMaximalSet10.Num() * sizeof( idVec4 ); + layoutTypeAttributes[layoutType].cbStatic = false; - // SRS - create renderparm to binding layouts mapping for efficient render-time lookups for( int i = 0; i < rpMaximalSet10.Num(); i++ ) { - renderParmLayouts[rpMaximalSet10[i]].Append( ( bindingLayoutType_t )layout ); + renderParmLayoutTypes[rpMaximalSet10[i]].Append( ( bindingLayoutType_t )layoutType ); + } + } + else if( rpMaximalSet11LayoutTypes.Find( ( bindingLayoutType_t )layoutType ) ) + { + layoutTypeAttributes[layoutType].rpSubSet = renderParmSet11; + layoutTypeAttributes[layoutType].rpBufSize = rpMaximalSet11.Num() * sizeof( idVec4 ); + layoutTypeAttributes[layoutType].cbStatic = false; + + for( int i = 0; i < rpMaximalSet11.Num(); i++ ) + { + renderParmLayoutTypes[rpMaximalSet11[i]].Append( ( bindingLayoutType_t )layoutType ); } } else { - layoutAttributes[layout].rpSubSet = renderParmNullSet; - layoutAttributes[layout].rpBufSize = 0; - layoutAttributes[layout].cbStatic = false; + layoutTypeAttributes[layoutType].rpSubSet = renderParmNullSet; + layoutTypeAttributes[layoutType].rpBufSize = 0; + layoutTypeAttributes[layoutType].cbStatic = false; } - layoutAttributes[layout].pcEnabled = deviceManager->m_DeviceParams.maxPushConstantSize >= layoutAttributes[layout].rpBufSize; + layoutTypeAttributes[layoutType].pcEnabled = deviceManager->m_DeviceParams.maxPushConstantSize >= layoutTypeAttributes[layoutType].rpBufSize; } auto defaultLayoutDesc = nvrhi::BindingLayoutDesc() @@ -423,11 +425,11 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) bindingLayouts[BINDING_LAYOUT_BLIT] = { device->createBindingLayout( blitLayoutDesc ) }; - auto aoLayoutItem = layoutAttributes[BINDING_LAYOUT_DRAW_AO].cbStatic ? nvrhi::BindingLayoutItem::ConstantBuffer( 0 ) : nvrhi::BindingLayoutItem::VolatileConstantBuffer( 0 ); + auto aoLayoutItem = layoutTypeAttributes[BINDING_LAYOUT_DRAW_AO].cbStatic ? nvrhi::BindingLayoutItem::ConstantBuffer( 0 ) : nvrhi::BindingLayoutItem::VolatileConstantBuffer( 0 ); - if( deviceManager->m_DeviceParams.maxPushConstantSize >= layoutAttributes[BINDING_LAYOUT_DRAW_AO].rpBufSize ) + if( layoutTypeAttributes[BINDING_LAYOUT_DRAW_AO].pcEnabled ) { - aoLayoutItem = nvrhi::BindingLayoutItem::PushConstants( 0, layoutAttributes[BINDING_LAYOUT_DRAW_AO].rpBufSize ); + aoLayoutItem = nvrhi::BindingLayoutItem::PushConstants( 0, layoutTypeAttributes[BINDING_LAYOUT_DRAW_AO].rpBufSize ); } auto aoLayoutDesc = nvrhi::BindingLayoutDesc() @@ -520,11 +522,11 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) uniformsLayout( BINDING_LAYOUT_BLENDLIGHT_SKINNED, true ), blendLightBindingLayout, samplerOneBindingLayout }; - auto pp3DLayoutItem = layoutAttributes[BINDING_LAYOUT_POST_PROCESS_INGAME].cbStatic ? nvrhi::BindingLayoutItem::ConstantBuffer( 0 ) : nvrhi::BindingLayoutItem::VolatileConstantBuffer( 0 ); + auto pp3DLayoutItem = layoutTypeAttributes[BINDING_LAYOUT_POST_PROCESS_INGAME].cbStatic ? nvrhi::BindingLayoutItem::ConstantBuffer( 0 ) : nvrhi::BindingLayoutItem::VolatileConstantBuffer( 0 ); - if( deviceManager->m_DeviceParams.maxPushConstantSize >= layoutAttributes[BINDING_LAYOUT_POST_PROCESS_INGAME].rpBufSize ) + if( layoutTypeAttributes[BINDING_LAYOUT_POST_PROCESS_INGAME].pcEnabled ) { - pp3DLayoutItem = nvrhi::BindingLayoutItem::PushConstants( 0, layoutAttributes[BINDING_LAYOUT_POST_PROCESS_INGAME].rpBufSize ); + pp3DLayoutItem = nvrhi::BindingLayoutItem::PushConstants( 0, layoutTypeAttributes[BINDING_LAYOUT_POST_PROCESS_INGAME].rpBufSize ); } auto pp3DBindingLayout = nvrhi::BindingLayoutDesc() @@ -536,11 +538,11 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) bindingLayouts[BINDING_LAYOUT_POST_PROCESS_INGAME] = { device->createBindingLayout( pp3DBindingLayout ), samplerOneBindingLayout }; - auto ppFxLayoutItem = layoutAttributes[BINDING_LAYOUT_POST_PROCESS_FINAL].cbStatic ? nvrhi::BindingLayoutItem::ConstantBuffer( 0 ) : nvrhi::BindingLayoutItem::VolatileConstantBuffer( 0 ); + auto ppFxLayoutItem = layoutTypeAttributes[BINDING_LAYOUT_POST_PROCESS_FINAL].cbStatic ? nvrhi::BindingLayoutItem::ConstantBuffer( 0 ) : nvrhi::BindingLayoutItem::VolatileConstantBuffer( 0 ); - if( deviceManager->m_DeviceParams.maxPushConstantSize >= layoutAttributes[BINDING_LAYOUT_POST_PROCESS_FINAL].rpBufSize ) + if( layoutTypeAttributes[BINDING_LAYOUT_POST_PROCESS_FINAL].pcEnabled ) { - ppFxLayoutItem = nvrhi::BindingLayoutItem::PushConstants( 0, layoutAttributes[BINDING_LAYOUT_POST_PROCESS_FINAL].rpBufSize ); + ppFxLayoutItem = nvrhi::BindingLayoutItem::PushConstants( 0, layoutTypeAttributes[BINDING_LAYOUT_POST_PROCESS_FINAL].rpBufSize ); } auto ppFxBindingLayout = nvrhi::BindingLayoutDesc() @@ -567,11 +569,11 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) uniformsLayout( BINDING_LAYOUT_NORMAL_CUBE_SKINNED, true ), normalCubeBindingLayout, samplerOneBindingLayout }; - auto binkVideoLayoutItem = layoutAttributes[BINDING_LAYOUT_BINK_VIDEO].cbStatic ? nvrhi::BindingLayoutItem::ConstantBuffer( 0 ) : nvrhi::BindingLayoutItem::VolatileConstantBuffer( 0 ); + auto binkVideoLayoutItem = layoutTypeAttributes[BINDING_LAYOUT_BINK_VIDEO].cbStatic ? nvrhi::BindingLayoutItem::ConstantBuffer( 0 ) : nvrhi::BindingLayoutItem::VolatileConstantBuffer( 0 ); - if( deviceManager->m_DeviceParams.maxPushConstantSize >= layoutAttributes[BINDING_LAYOUT_BINK_VIDEO].rpBufSize ) + if( layoutTypeAttributes[BINDING_LAYOUT_BINK_VIDEO].pcEnabled ) { - binkVideoLayoutItem = nvrhi::BindingLayoutItem::PushConstants( 0, layoutAttributes[BINDING_LAYOUT_BINK_VIDEO].rpBufSize ); + binkVideoLayoutItem = nvrhi::BindingLayoutItem::PushConstants( 0, layoutTypeAttributes[BINDING_LAYOUT_BINK_VIDEO].rpBufSize ); } auto binkVideoBindingLayout = nvrhi::BindingLayoutDesc() @@ -583,11 +585,11 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) bindingLayouts[BINDING_LAYOUT_BINK_VIDEO] = { device->createBindingLayout( binkVideoBindingLayout ), samplerOneBindingLayout }; - auto motionVectorsLayoutItem = layoutAttributes[BINDING_LAYOUT_TAA_MOTION_VECTORS].cbStatic ? nvrhi::BindingLayoutItem::ConstantBuffer( 0 ) : nvrhi::BindingLayoutItem::VolatileConstantBuffer( 0 ); + auto motionVectorsLayoutItem = layoutTypeAttributes[BINDING_LAYOUT_TAA_MOTION_VECTORS].cbStatic ? nvrhi::BindingLayoutItem::ConstantBuffer( 0 ) : nvrhi::BindingLayoutItem::VolatileConstantBuffer( 0 ); - if( deviceManager->m_DeviceParams.maxPushConstantSize >= layoutAttributes[BINDING_LAYOUT_TAA_MOTION_VECTORS].rpBufSize ) + if( layoutTypeAttributes[BINDING_LAYOUT_TAA_MOTION_VECTORS].pcEnabled ) { - motionVectorsLayoutItem = nvrhi::BindingLayoutItem::PushConstants( 0, layoutAttributes[BINDING_LAYOUT_TAA_MOTION_VECTORS].rpBufSize ); + motionVectorsLayoutItem = nvrhi::BindingLayoutItem::PushConstants( 0, layoutTypeAttributes[BINDING_LAYOUT_TAA_MOTION_VECTORS].rpBufSize ); } auto motionVectorsBindingLayout = nvrhi::BindingLayoutDesc() @@ -635,28 +637,28 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) bindingLayouts[BINDING_LAYOUT_EXPOSURE] = { device->createBindingLayout( exposureLayout ) }; - // SRS - allocate static/volatile constant buffers after binding layout sizes are defined + // SRS - allocate static/volatile constant buffers after renderparm buffer sizes are defined for each binding layout type for( int i = 0; i < NUM_BINDING_LAYOUTS; i++ ) { nvrhi::BufferDesc constantBufferDesc; // SRS - allocate static constant buffer for specific binding layouts, otherwise volatile - if( layoutAttributes[i].cbStatic ) + if( layoutTypeAttributes[i].cbStatic ) { - constantBufferDesc = nvrhi::utils::CreateStaticConstantBufferDesc( layoutAttributes[i].rpBufSize, va( "RenderParams_%d", i ) ); + constantBufferDesc = nvrhi::utils::CreateStaticConstantBufferDesc( layoutTypeAttributes[i].rpBufSize, va( "RenderParams_%d", i ) ); constantBufferDesc.initialState = nvrhi::ResourceStates::ConstantBuffer; constantBufferDesc.keepInitialState = true; } else { - constantBufferDesc = nvrhi::utils::CreateVolatileConstantBufferDesc( layoutAttributes[i].rpBufSize, va( "RenderParams_%d", i ), 8192 ); + constantBufferDesc = nvrhi::utils::CreateVolatileConstantBufferDesc( layoutTypeAttributes[i].rpBufSize, va( "RenderParams_%d", i ), 8192 ); } constantBuffer[i] = device->createBuffer( constantBufferDesc ); } // SRS - added support for runtime configuration of push constants - #define usePushConstants(layout) (deviceManager->m_DeviceParams.maxPushConstantSize >= layoutAttributes[layout].rpBufSize ? "1" : "0") + #define usePushConstants( layoutType ) ( layoutTypeAttributes[layoutType].pcEnabled ? "1" : "0" ) // RB: added checks for GPU skinning struct builtinShaders_t @@ -806,7 +808,7 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) // SRS - disabled VECTORS_ONLY now that BUILTIN_TAA_MOTION_VECTORS is properly defined { BUILTIN_MOTION_BLUR, "builtin/post/motionBlur", "", { { "VECTORS_ONLY", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_TAA_MOTION_VECTORS ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_TAA_MOTION_VECTORS }, - { BUILTIN_DEBUG_SHADOWMAP, "builtin/debug/debug_shadowmap", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_GBUFFER ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_GBUFFER }, + { BUILTIN_DEBUG_SHADOWMAP, "builtin/debug/debug_shadowmap", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_TEXTURE ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_TEXTURE }, // SP begin { BUILTIN_BLIT, "builtin/blit", "", { { "TEXTURE_ARRAY", "0" } }, false, SHADER_STAGE_FRAGMENT, LAYOUT_UNKNOWN, BINDING_LAYOUT_BLIT }, diff --git a/neo/renderer/RenderProgs.h b/neo/renderer/RenderProgs.h index 4201d1efc9..146ba1f4c6 100644 --- a/neo/renderer/RenderProgs.h +++ b/neo/renderer/RenderProgs.h @@ -218,6 +218,7 @@ enum renderParmSubSet_t renderParmSet8, renderParmSet9, renderParmSet10, + renderParmSet11, renderParmNullSet }; @@ -229,47 +230,57 @@ enum renderParmSubSet_t const idList rpMinimalSet0 = { RENDERPARM_LOCALVIEWORIGIN, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_COLOR, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W }; -const idList rpMinimalSet0Layouts = { BINDING_LAYOUT_DEFAULT, BINDING_LAYOUT_DEFAULT_SKINNED, BINDING_LAYOUT_CONSTANT_BUFFER_ONLY, BINDING_LAYOUT_CONSTANT_BUFFER_ONLY_SKINNED, BINDING_LAYOUT_BINK_VIDEO }; +const idList rpMinimalSet0LayoutTypes = { BINDING_LAYOUT_DEFAULT, BINDING_LAYOUT_DEFAULT_SKINNED, BINDING_LAYOUT_CONSTANT_BUFFER_ONLY, BINDING_LAYOUT_CONSTANT_BUFFER_ONLY_SKINNED, BINDING_LAYOUT_BINK_VIDEO }; -const idList rpMinimalSet1 = { RENDERPARM_SCREENCORRECTIONFACTOR, RENDERPARM_WINDOWCOORD, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_PROJMATRIX_Z, RENDERPARM_OVERBRIGHT }; +const idList rpMinimalSet1 = { RENDERPARM_SCREENCORRECTIONFACTOR, RENDERPARM_WINDOWCOORD, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_OVERBRIGHT }; -const idList rpMinimalSet1Layouts = { BINDING_LAYOUT_POST_PROCESS, BINDING_LAYOUT_TAA_MOTION_VECTORS }; +const idList rpMinimalSet1LayoutTypes = { BINDING_LAYOUT_POST_PROCESS, BINDING_LAYOUT_TAA_MOTION_VECTORS }; const idList rpMinimalSet2 = { RENDERPARM_SCREENCORRECTIONFACTOR, RENDERPARM_WINDOWCOORD, RENDERPARM_MODELMATRIX_X, RENDERPARM_MODELMATRIX_Y, RENDERPARM_MODELMATRIX_Z, RENDERPARM_MODELMATRIX_W, RENDERPARM_JITTERTEXSCALE, RENDERPARM_JITTERTEXOFFSET }; -const idList rpMinimalSet2Layouts = { BINDING_LAYOUT_POST_PROCESS_FINAL, BINDING_LAYOUT_DRAW_AO, BINDING_LAYOUT_DRAW_AO1 }; +const idList rpMinimalSet2LayoutTypes = { BINDING_LAYOUT_POST_PROCESS_FINAL, BINDING_LAYOUT_DRAW_AO, BINDING_LAYOUT_DRAW_AO1 }; -const idList rpNominalSet3 = { RENDERPARM_SCREENCORRECTIONFACTOR, RENDERPARM_BUMPMATRIX_S, RENDERPARM_BUMPMATRIX_T, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_COLOR, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_MODELVIEWMATRIX_X, RENDERPARM_MODELVIEWMATRIX_Y, RENDERPARM_MODELVIEWMATRIX_Z, RENDERPARM_TEXTUREMATRIX_S, RENDERPARM_TEXTUREMATRIX_T, RENDERPARM_TEXGEN_0_ENABLED }; +// SRS - Limit rpNominalSets to maximum of 15 idVec4 entries (15*16 = 240 bytes) to fit within D3D12 root constant limit +const idList rpNominalSet3 = { RENDERPARM_BUMPMATRIX_S, RENDERPARM_BUMPMATRIX_T, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_MODELVIEWMATRIX_X, RENDERPARM_MODELVIEWMATRIX_Y, RENDERPARM_MODELVIEWMATRIX_Z }; -const idList rpNominalSet3Layouts = { BINDING_LAYOUT_GBUFFER, BINDING_LAYOUT_GBUFFER_SKINNED }; +const idList rpNominalSet3LayoutTypes = { BINDING_LAYOUT_GBUFFER, BINDING_LAYOUT_GBUFFER_SKINNED }; -const idList rpNominalSet4 = { RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_COLOR, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_TEXTUREMATRIX_S, RENDERPARM_TEXTUREMATRIX_T, RENDERPARM_TEXGEN_0_S, RENDERPARM_TEXGEN_0_T, RENDERPARM_TEXGEN_0_Q, RENDERPARM_TEXGEN_0_ENABLED, RENDERPARM_TEXGEN_1_S, RENDERPARM_TEXGEN_1_T, RENDERPARM_ALPHA_TEST }; +// SRS - Limit rpNominalSets to maximum of 15 idVec4 entries (15*16 = 240 bytes) to fit within D3D12 root constant limit +const idList rpNominalSet4 = { RENDERPARM_SCREENCORRECTIONFACTOR, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_COLOR, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_TEXTUREMATRIX_S, RENDERPARM_TEXTUREMATRIX_T, RENDERPARM_TEXGEN_0_S, RENDERPARM_TEXGEN_0_T, RENDERPARM_TEXGEN_0_Q, RENDERPARM_TEXGEN_0_ENABLED, RENDERPARM_ALPHA_TEST }; -const idList rpNominalSet4Layouts = { BINDING_LAYOUT_TEXTURE, BINDING_LAYOUT_TEXTURE_SKINNED, BINDING_LAYOUT_FOG, BINDING_LAYOUT_FOG_SKINNED, BINDING_LAYOUT_BLENDLIGHT, BINDING_LAYOUT_BLENDLIGHT_SKINNED }; +const idList rpNominalSet4LayoutTypes = { BINDING_LAYOUT_TEXTURE, BINDING_LAYOUT_TEXTURE_SKINNED }; -const idList rpNominalSet5 = { RENDERPARM_LOCALVIEWORIGIN, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_COLOR, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_MODELMATRIX_X, RENDERPARM_MODELMATRIX_Y, RENDERPARM_MODELMATRIX_Z, RENDERPARM_MODELMATRIX_W, RENDERPARM_WOBBLESKY_X, RENDERPARM_WOBBLESKY_Y, RENDERPARM_WOBBLESKY_Z, RENDERPARM_CASCADEDISTANCES }; +// SRS - Limit rpNominalSets to maximum of 15 idVec4 entries (15*16 = 240 bytes) to fit within D3D12 root constant limit +const idList rpNominalSet5 = { RENDERPARM_LOCALVIEWORIGIN, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_COLOR, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_MODELMATRIX_X, RENDERPARM_MODELMATRIX_Y, RENDERPARM_MODELMATRIX_Z, RENDERPARM_WOBBLESKY_X, RENDERPARM_WOBBLESKY_Y, RENDERPARM_WOBBLESKY_Z }; -const idList rpNominalSet5Layouts = { BINDING_LAYOUT_WOBBLESKY, BINDING_LAYOUT_NORMAL_CUBE, BINDING_LAYOUT_NORMAL_CUBE_SKINNED }; +const idList rpNominalSet5LayoutTypes = { BINDING_LAYOUT_WOBBLESKY, BINDING_LAYOUT_NORMAL_CUBE, BINDING_LAYOUT_NORMAL_CUBE_SKINNED }; -const idList rpNominalSet6 = { RENDERPARM_SCREENCORRECTIONFACTOR, RENDERPARM_WINDOWCOORD, RENDERPARM_COLOR, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_MODELMATRIX_X, RENDERPARM_MODELMATRIX_Y, RENDERPARM_MODELMATRIX_Z, RENDERPARM_MODELMATRIX_W, RENDERPARM_OVERBRIGHT, RENDERPARM_GLOBALLIGHTORIGIN, RENDERPARM_JITTERTEXSCALE, RENDERPARM_JITTERTEXOFFSET, RENDERPARM_CASCADEDISTANCES }; +// SRS - Limit rpNominalSets to maximum of 15 idVec4 entries (15*16 = 240 bytes) to fit within D3D12 root constant limit +const idList rpNominalSet6 = { RENDERPARM_SCREENCORRECTIONFACTOR, RENDERPARM_COLOR, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_MODELMATRIX_X, RENDERPARM_MODELMATRIX_Y, RENDERPARM_MODELMATRIX_Z, RENDERPARM_MODELMATRIX_W, RENDERPARM_GLOBALLIGHTORIGIN, RENDERPARM_JITTERTEXSCALE, RENDERPARM_JITTERTEXOFFSET, RENDERPARM_CASCADEDISTANCES }; -const idList rpNominalSet6Layouts = { BINDING_LAYOUT_SSGI, BINDING_LAYOUT_SSGI_SKINNED }; +const idList rpNominalSet6LayoutTypes = { BINDING_LAYOUT_SSGI, BINDING_LAYOUT_SSGI_SKINNED }; -const idList rpNominalSet7 = { RENDERPARM_WINDOWCOORD, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_PROJMATRIX_Y, RENDERPARM_PROJMATRIX_W, RENDERPARM_MODELVIEWMATRIX_Z, RENDERPARM_ENABLE_SKINNING, RENDERPARM_ALPHA_TEST, RENDERPARM_USER0, RENDERPARM_USER1, RENDERPARM_USER2, RENDERPARM_USER3, RENDERPARM_USER4, RENDERPARM_USER5 }; +// SRS - Limit rpNominalSets to maximum of 15 idVec4 entries (15*16 = 240 bytes) to fit within D3D12 root constant limit +const idList rpNominalSet7 = { RENDERPARM_COLOR, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_TEXGEN_0_S, RENDERPARM_TEXGEN_0_T, RENDERPARM_TEXGEN_0_Q, RENDERPARM_TEXGEN_1_S, RENDERPARM_TEXGEN_1_T }; -const idList rpNominalSet7Layouts = { BINDING_LAYOUT_POST_PROCESS_INGAME }; +const idList rpNominalSet7LayoutTypes = { BINDING_LAYOUT_FOG, BINDING_LAYOUT_FOG_SKINNED, BINDING_LAYOUT_BLENDLIGHT, BINDING_LAYOUT_BLENDLIGHT_SKINNED }; -const idList rpMaximalSet8 = { RENDERPARM_SCREENCORRECTIONFACTOR, RENDERPARM_WINDOWCOORD, RENDERPARM_DIFFUSEMODIFIER, RENDERPARM_SPECULARMODIFIER, RENDERPARM_LOCALLIGHTORIGIN, RENDERPARM_LOCALVIEWORIGIN, RENDERPARM_BUMPMATRIX_S, RENDERPARM_BUMPMATRIX_T, RENDERPARM_DIFFUSEMATRIX_S, RENDERPARM_DIFFUSEMATRIX_T, RENDERPARM_SPECULARMATRIX_S, RENDERPARM_SPECULARMATRIX_T, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_GLOBALEYEPOS, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_MODELMATRIX_X, RENDERPARM_MODELMATRIX_Y, RENDERPARM_MODELMATRIX_Z, RENDERPARM_MODELMATRIX_W, RENDERPARM_AMBIENT_COLOR, RENDERPARM_GLOBALLIGHTORIGIN, RENDERPARM_JITTERTEXSCALE, RENDERPARM_JITTERTEXOFFSET, RENDERPARM_CASCADEDISTANCES }; +// SRS - Limit rpNominalSets to maximum of 15 idVec4 entries (15*16 = 240 bytes) to fit within D3D12 root constant limit +const idList rpNominalSet8 = { RENDERPARM_WINDOWCOORD, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_PROJMATRIX_Y, RENDERPARM_PROJMATRIX_W, RENDERPARM_MODELVIEWMATRIX_Z, RENDERPARM_ENABLE_SKINNING, RENDERPARM_ALPHA_TEST, RENDERPARM_USER0, RENDERPARM_USER1, RENDERPARM_USER2 }; -const idList rpMaximalSet8Layouts = { BINDING_LAYOUT_AMBIENT_LIGHTING_IBL, BINDING_LAYOUT_AMBIENT_LIGHTING_IBL_SKINNED }; +const idList rpNominalSet8LayoutTypes = { BINDING_LAYOUT_POST_PROCESS_INGAME }; -const idList rpMaximalSet9 = { RENDERPARM_DIFFUSEMODIFIER, RENDERPARM_SPECULARMODIFIER, RENDERPARM_LOCALLIGHTORIGIN, RENDERPARM_LOCALVIEWORIGIN, RENDERPARM_LIGHTPROJECTION_S, RENDERPARM_LIGHTPROJECTION_T, RENDERPARM_LIGHTPROJECTION_Q, RENDERPARM_LIGHTFALLOFF_S, RENDERPARM_BUMPMATRIX_S, RENDERPARM_BUMPMATRIX_T, RENDERPARM_DIFFUSEMATRIX_S, RENDERPARM_DIFFUSEMATRIX_T, RENDERPARM_SPECULARMATRIX_S, RENDERPARM_SPECULARMATRIX_T, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W }; +const idList rpMaximalSet9 = { RENDERPARM_SCREENCORRECTIONFACTOR, RENDERPARM_WINDOWCOORD, RENDERPARM_DIFFUSEMODIFIER, RENDERPARM_SPECULARMODIFIER, RENDERPARM_LOCALLIGHTORIGIN, RENDERPARM_LOCALVIEWORIGIN, RENDERPARM_BUMPMATRIX_S, RENDERPARM_BUMPMATRIX_T, RENDERPARM_DIFFUSEMATRIX_S, RENDERPARM_DIFFUSEMATRIX_T, RENDERPARM_SPECULARMATRIX_S, RENDERPARM_SPECULARMATRIX_T, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_GLOBALEYEPOS, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_MODELMATRIX_X, RENDERPARM_MODELMATRIX_Y, RENDERPARM_MODELMATRIX_Z, RENDERPARM_MODELMATRIX_W, RENDERPARM_AMBIENT_COLOR, RENDERPARM_GLOBALLIGHTORIGIN, RENDERPARM_JITTERTEXSCALE, RENDERPARM_JITTERTEXOFFSET, RENDERPARM_CASCADEDISTANCES }; -const idList rpMaximalSet9Layouts = { BINDING_LAYOUT_DRAW_INTERACTION, BINDING_LAYOUT_DRAW_INTERACTION_SKINNED }; +const idList rpMaximalSet9LayoutTypes = { BINDING_LAYOUT_AMBIENT_LIGHTING_IBL, BINDING_LAYOUT_AMBIENT_LIGHTING_IBL_SKINNED }; -const idList rpMaximalSet10 = { RENDERPARM_SCREENCORRECTIONFACTOR, RENDERPARM_DIFFUSEMODIFIER, RENDERPARM_SPECULARMODIFIER, RENDERPARM_LOCALLIGHTORIGIN, RENDERPARM_LOCALVIEWORIGIN, RENDERPARM_LIGHTPROJECTION_S, RENDERPARM_LIGHTPROJECTION_T, RENDERPARM_LIGHTPROJECTION_Q, RENDERPARM_LIGHTFALLOFF_S, RENDERPARM_BUMPMATRIX_S, RENDERPARM_BUMPMATRIX_T, RENDERPARM_DIFFUSEMATRIX_S, RENDERPARM_DIFFUSEMATRIX_T, RENDERPARM_SPECULARMATRIX_S, RENDERPARM_SPECULARMATRIX_T, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_MODELMATRIX_X, RENDERPARM_MODELMATRIX_Y, RENDERPARM_MODELMATRIX_Z, RENDERPARM_MODELMATRIX_W, RENDERPARM_MODELVIEWMATRIX_X, RENDERPARM_MODELVIEWMATRIX_Y, RENDERPARM_MODELVIEWMATRIX_Z, RENDERPARM_MODELVIEWMATRIX_W, RENDERPARM_GLOBALLIGHTORIGIN, RENDERPARM_JITTERTEXSCALE, RENDERPARM_JITTERTEXOFFSET, RENDERPARM_CASCADEDISTANCES, RENDERPARM_SHADOW_MATRIX_0_X, RENDERPARM_SHADOW_MATRIX_0_Y, RENDERPARM_SHADOW_MATRIX_0_Z, RENDERPARM_SHADOW_MATRIX_0_W, RENDERPARM_SHADOW_MATRIX_1_X, RENDERPARM_SHADOW_MATRIX_1_Y, RENDERPARM_SHADOW_MATRIX_1_Z, RENDERPARM_SHADOW_MATRIX_1_W, RENDERPARM_SHADOW_MATRIX_2_X, RENDERPARM_SHADOW_MATRIX_2_Y, RENDERPARM_SHADOW_MATRIX_2_Z, RENDERPARM_SHADOW_MATRIX_2_W, RENDERPARM_SHADOW_MATRIX_3_X, RENDERPARM_SHADOW_MATRIX_3_Y, RENDERPARM_SHADOW_MATRIX_3_Z, RENDERPARM_SHADOW_MATRIX_3_W, RENDERPARM_SHADOW_MATRIX_4_X, RENDERPARM_SHADOW_MATRIX_4_Y, RENDERPARM_SHADOW_MATRIX_4_Z, RENDERPARM_SHADOW_MATRIX_4_W, RENDERPARM_SHADOW_MATRIX_5_X, RENDERPARM_SHADOW_MATRIX_5_Y, RENDERPARM_SHADOW_MATRIX_5_Z, RENDERPARM_SHADOW_MATRIX_5_W, RENDERPARM_SHADOW_ATLAS_OFFSET_0, RENDERPARM_SHADOW_ATLAS_OFFSET_1, RENDERPARM_SHADOW_ATLAS_OFFSET_2, RENDERPARM_SHADOW_ATLAS_OFFSET_3, RENDERPARM_SHADOW_ATLAS_OFFSET_4, RENDERPARM_SHADOW_ATLAS_OFFSET_5 }; +const idList rpMaximalSet10 = { RENDERPARM_DIFFUSEMODIFIER, RENDERPARM_SPECULARMODIFIER, RENDERPARM_LOCALLIGHTORIGIN, RENDERPARM_LOCALVIEWORIGIN, RENDERPARM_LIGHTPROJECTION_S, RENDERPARM_LIGHTPROJECTION_T, RENDERPARM_LIGHTPROJECTION_Q, RENDERPARM_LIGHTFALLOFF_S, RENDERPARM_BUMPMATRIX_S, RENDERPARM_BUMPMATRIX_T, RENDERPARM_DIFFUSEMATRIX_S, RENDERPARM_DIFFUSEMATRIX_T, RENDERPARM_SPECULARMATRIX_S, RENDERPARM_SPECULARMATRIX_T, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W }; -const idList rpMaximalSet10Layouts = { BINDING_LAYOUT_DRAW_INTERACTION_SM, BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED }; +const idList rpMaximalSet10LayoutTypes = { BINDING_LAYOUT_DRAW_INTERACTION, BINDING_LAYOUT_DRAW_INTERACTION_SKINNED }; + +const idList rpMaximalSet11 = { RENDERPARM_SCREENCORRECTIONFACTOR, RENDERPARM_DIFFUSEMODIFIER, RENDERPARM_SPECULARMODIFIER, RENDERPARM_LOCALLIGHTORIGIN, RENDERPARM_LOCALVIEWORIGIN, RENDERPARM_LIGHTPROJECTION_S, RENDERPARM_LIGHTPROJECTION_T, RENDERPARM_LIGHTPROJECTION_Q, RENDERPARM_LIGHTFALLOFF_S, RENDERPARM_BUMPMATRIX_S, RENDERPARM_BUMPMATRIX_T, RENDERPARM_DIFFUSEMATRIX_S, RENDERPARM_DIFFUSEMATRIX_T, RENDERPARM_SPECULARMATRIX_S, RENDERPARM_SPECULARMATRIX_T, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_MODELMATRIX_X, RENDERPARM_MODELMATRIX_Y, RENDERPARM_MODELMATRIX_Z, RENDERPARM_MODELMATRIX_W, RENDERPARM_MODELVIEWMATRIX_X, RENDERPARM_MODELVIEWMATRIX_Y, RENDERPARM_MODELVIEWMATRIX_Z, RENDERPARM_MODELVIEWMATRIX_W, RENDERPARM_GLOBALLIGHTORIGIN, RENDERPARM_JITTERTEXSCALE, RENDERPARM_JITTERTEXOFFSET, RENDERPARM_CASCADEDISTANCES, RENDERPARM_SHADOW_MATRIX_0_X, RENDERPARM_SHADOW_MATRIX_0_Y, RENDERPARM_SHADOW_MATRIX_0_Z, RENDERPARM_SHADOW_MATRIX_0_W, RENDERPARM_SHADOW_MATRIX_1_X, RENDERPARM_SHADOW_MATRIX_1_Y, RENDERPARM_SHADOW_MATRIX_1_Z, RENDERPARM_SHADOW_MATRIX_1_W, RENDERPARM_SHADOW_MATRIX_2_X, RENDERPARM_SHADOW_MATRIX_2_Y, RENDERPARM_SHADOW_MATRIX_2_Z, RENDERPARM_SHADOW_MATRIX_2_W, RENDERPARM_SHADOW_MATRIX_3_X, RENDERPARM_SHADOW_MATRIX_3_Y, RENDERPARM_SHADOW_MATRIX_3_Z, RENDERPARM_SHADOW_MATRIX_3_W, RENDERPARM_SHADOW_MATRIX_4_X, RENDERPARM_SHADOW_MATRIX_4_Y, RENDERPARM_SHADOW_MATRIX_4_Z, RENDERPARM_SHADOW_MATRIX_4_W, RENDERPARM_SHADOW_MATRIX_5_X, RENDERPARM_SHADOW_MATRIX_5_Y, RENDERPARM_SHADOW_MATRIX_5_Z, RENDERPARM_SHADOW_MATRIX_5_W, RENDERPARM_SHADOW_ATLAS_OFFSET_0, RENDERPARM_SHADOW_ATLAS_OFFSET_1, RENDERPARM_SHADOW_ATLAS_OFFSET_2, RENDERPARM_SHADOW_ATLAS_OFFSET_3, RENDERPARM_SHADOW_ATLAS_OFFSET_4, RENDERPARM_SHADOW_ATLAS_OFFSET_5 }; + +const idList rpMaximalSet11LayoutTypes = { BINDING_LAYOUT_DRAW_INTERACTION_SM, BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED }; enum rpStage_t { @@ -489,9 +500,6 @@ idRenderProgManager */ class idRenderProgManager { - friend class idRenderBackend; - friend class idMaterial; - public: idRenderProgManager(); virtual ~idRenderProgManager(); @@ -1068,6 +1076,10 @@ class idRenderProgManager static const char* FindEmbeddedSourceShader( const char* name ); +protected: + friend class idRenderBackend; + friend class idMaterial; + private: void LoadShader( int index, rpStage_t stage ); @@ -1137,7 +1149,7 @@ class idRenderProgManager void LoadShader( shader_t& shader ); - struct layoutAttributes_t + struct layoutTypeAttributes_t { renderParmSubSet_t rpSubSet; int rpBufSize; @@ -1150,11 +1162,11 @@ class idRenderProgManager idList shaders; idStaticList< idVec4, RENDERPARM_TOTAL > uniforms; bool uniformsChanged[NUM_BINDING_LAYOUTS]; - layoutAttributes_t layoutAttributes[NUM_BINDING_LAYOUTS]; - idList renderParmLayouts[RENDERPARM_TOTAL]; + layoutTypeAttributes_t layoutTypeAttributes[NUM_BINDING_LAYOUTS]; + idList renderParmLayoutTypes[RENDERPARM_TOTAL]; nvrhi::IDevice* device; - nvrhi::BindingLayoutHandle uniformsLayout( bindingLayoutType_t layout, bool skinning ); + nvrhi::BindingLayoutHandle uniformsLayout( bindingLayoutType_t layoutType, bool skinning ); using VertexAttribDescList = idList< nvrhi::VertexAttributeDesc >; idStaticList< VertexAttribDescList, NUM_VERTEX_LAYOUTS > vertexLayoutDescs; diff --git a/neo/shaders/CMakeLists.txt b/neo/shaders/CMakeLists.txt index 24ad276533..71447828a8 100644 --- a/neo/shaders/CMakeLists.txt +++ b/neo/shaders/CMakeLists.txt @@ -1,6 +1,6 @@ include(../compileshaders.cmake) -file(GLOB globalshaders "BRDF.inc.hlsl" "global_inc.hlsl" "vulkan.hlsli" "renderParmSet0.inc.hlsl" "renderParmSet1.inc.hlsl" "renderParmSet2.inc.hlsl" "renderParmSet3.inc.hlsl" "renderParmSet4.inc.hlsl" "renderParmSet5.inc.hlsl" "renderParmSet6.inc.hlsl" "renderParmSet7.inc.hlsl" "renderParmSet8.inc.hlsl" "renderParmSet9.inc.hlsl" "renderParmSet10.inc.hlsl") +file(GLOB globalshaders "BRDF.inc.hlsl" "global_inc.hlsl" "vulkan.hlsli" "renderParmSet0.inc.hlsl" "renderParmSet1.inc.hlsl" "renderParmSet2.inc.hlsl" "renderParmSet3.inc.hlsl" "renderParmSet4.inc.hlsl" "renderParmSet5.inc.hlsl" "renderParmSet6.inc.hlsl" "renderParmSet7.inc.hlsl" "renderParmSet8.inc.hlsl" "renderParmSet9.inc.hlsl" "renderParmSet10.inc.hlsl" "renderParmSet11.inc.hlsl") file(GLOB builtins "builtin/*.hlsl") file(GLOB debug "builtin/debug/*hlsl") file(GLOB fog "builtin/fog/*hlsl") @@ -37,4 +37,4 @@ compile_shaders_all_platforms( 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/bloodorb1_capture.ps.hlsl b/neo/shaders/bloodorb1_capture.ps.hlsl index 7cf854cf37..36b219e310 100644 --- a/neo/shaders/bloodorb1_capture.ps.hlsl +++ b/neo/shaders/bloodorb1_capture.ps.hlsl @@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet7.inc.hlsl" +#include "renderParmSet8.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/bloodorb1_capture.vs.hlsl b/neo/shaders/bloodorb1_capture.vs.hlsl index f5ed4752b7..f8b9ce4846 100644 --- a/neo/shaders/bloodorb1_capture.vs.hlsl +++ b/neo/shaders/bloodorb1_capture.vs.hlsl @@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet7.inc.hlsl" +#include "renderParmSet8.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/bloodorb2_capture.ps.hlsl b/neo/shaders/bloodorb2_capture.ps.hlsl index eae16bd84a..e10c67210e 100644 --- a/neo/shaders/bloodorb2_capture.ps.hlsl +++ b/neo/shaders/bloodorb2_capture.ps.hlsl @@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet7.inc.hlsl" +#include "renderParmSet8.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/bloodorb2_capture.vs.hlsl b/neo/shaders/bloodorb2_capture.vs.hlsl index 1a990b3d61..cd1c1f1c3e 100644 --- a/neo/shaders/bloodorb2_capture.vs.hlsl +++ b/neo/shaders/bloodorb2_capture.vs.hlsl @@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet7.inc.hlsl" +#include "renderParmSet8.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/bloodorb3_capture.ps.hlsl b/neo/shaders/bloodorb3_capture.ps.hlsl index 96109985df..7a208141d6 100644 --- a/neo/shaders/bloodorb3_capture.ps.hlsl +++ b/neo/shaders/bloodorb3_capture.ps.hlsl @@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet7.inc.hlsl" +#include "renderParmSet8.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/bloodorb3_capture.vs.hlsl b/neo/shaders/bloodorb3_capture.vs.hlsl index a88f2fee18..b089133233 100644 --- a/neo/shaders/bloodorb3_capture.vs.hlsl +++ b/neo/shaders/bloodorb3_capture.vs.hlsl @@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet7.inc.hlsl" +#include "renderParmSet8.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/bloodorb_draw.ps.hlsl b/neo/shaders/bloodorb_draw.ps.hlsl index 34cc7a43c7..0a2cf9e6eb 100644 --- a/neo/shaders/bloodorb_draw.ps.hlsl +++ b/neo/shaders/bloodorb_draw.ps.hlsl @@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet7.inc.hlsl" +#include "renderParmSet8.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/bloodorb_draw.vs.hlsl b/neo/shaders/bloodorb_draw.vs.hlsl index c98815fb08..9394aec487 100644 --- a/neo/shaders/bloodorb_draw.vs.hlsl +++ b/neo/shaders/bloodorb_draw.vs.hlsl @@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet7.inc.hlsl" +#include "renderParmSet8.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/builtin/debug/debug_shadowmap.ps.hlsl b/neo/shaders/builtin/debug/debug_shadowmap.ps.hlsl index ef7d8f49af..881ce7ffce 100644 --- a/neo/shaders/builtin/debug/debug_shadowmap.ps.hlsl +++ b/neo/shaders/builtin/debug/debug_shadowmap.ps.hlsl @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet3.inc.hlsl" +#include "renderParmSet4.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/builtin/debug/debug_shadowmap.vs.hlsl b/neo/shaders/builtin/debug/debug_shadowmap.vs.hlsl index 5a06bb729c..c57d3c9d94 100644 --- a/neo/shaders/builtin/debug/debug_shadowmap.vs.hlsl +++ b/neo/shaders/builtin/debug/debug_shadowmap.vs.hlsl @@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet3.inc.hlsl" +#include "renderParmSet4.inc.hlsl" // *INDENT-OFF* @@ -55,14 +55,14 @@ void main( VS_IN vertex, out VS_OUT result ) result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); // compute oldschool texgen or multiply by texture matrix - //BRANCH if( pc.rpTexGen0Enabled.x > 0.0 ) - //{ - // result.texcoord0.x = dot4( vertex.position, rpTexGen0S ); - // result.texcoord0.y = dot4( vertex.position, rpTexGen0T ); - //} - //else - //{ + BRANCH if( pc.rpTexGen0Enabled.x > 0.0 ) + { + result.texcoord0.x = dot4( vertex.position, pc.rpTexGen0S ); + result.texcoord0.y = dot4( vertex.position, pc.rpTexGen0T ); + } + else + { result.texcoord0.x = dot4( vertex.texcoord.xy, pc.rpTextureMatrixS ); result.texcoord0.y = dot4( vertex.texcoord.xy, pc.rpTextureMatrixT ); - //} + } } diff --git a/neo/shaders/builtin/fog/blendLight.ps.hlsl b/neo/shaders/builtin/fog/blendLight.ps.hlsl index 3f763825cf..4b93a979ab 100644 --- a/neo/shaders/builtin/fog/blendLight.ps.hlsl +++ b/neo/shaders/builtin/fog/blendLight.ps.hlsl @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet4.inc.hlsl" +#include "renderParmSet7.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/builtin/fog/blendLight.vs.hlsl b/neo/shaders/builtin/fog/blendLight.vs.hlsl index a7782d2ca7..be5dd6da84 100644 --- a/neo/shaders/builtin/fog/blendLight.vs.hlsl +++ b/neo/shaders/builtin/fog/blendLight.vs.hlsl @@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet4.inc.hlsl" +#include "renderParmSet7.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/builtin/fog/fog.ps.hlsl b/neo/shaders/builtin/fog/fog.ps.hlsl index c0249f262b..409506bc4d 100644 --- a/neo/shaders/builtin/fog/fog.ps.hlsl +++ b/neo/shaders/builtin/fog/fog.ps.hlsl @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet4.inc.hlsl" +#include "renderParmSet7.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/builtin/fog/fog.vs.hlsl b/neo/shaders/builtin/fog/fog.vs.hlsl index 1567fb2322..26257a4af7 100644 --- a/neo/shaders/builtin/fog/fog.vs.hlsl +++ b/neo/shaders/builtin/fog/fog.vs.hlsl @@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet4.inc.hlsl" +#include "renderParmSet7.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/builtin/lighting/ambient_lightgrid_IBL.ps.hlsl b/neo/shaders/builtin/lighting/ambient_lightgrid_IBL.ps.hlsl index 04daae35b8..c940c009a2 100644 --- a/neo/shaders/builtin/lighting/ambient_lightgrid_IBL.ps.hlsl +++ b/neo/shaders/builtin/lighting/ambient_lightgrid_IBL.ps.hlsl @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet8.inc.hlsl" +#include "renderParmSet9.inc.hlsl" #include "BRDF.inc.hlsl" diff --git a/neo/shaders/builtin/lighting/ambient_lightgrid_IBL.vs.hlsl b/neo/shaders/builtin/lighting/ambient_lightgrid_IBL.vs.hlsl index 1848735ce4..e0760eaf85 100644 --- a/neo/shaders/builtin/lighting/ambient_lightgrid_IBL.vs.hlsl +++ b/neo/shaders/builtin/lighting/ambient_lightgrid_IBL.vs.hlsl @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet8.inc.hlsl" +#include "renderParmSet9.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/builtin/lighting/ambient_lighting_IBL.ps.hlsl b/neo/shaders/builtin/lighting/ambient_lighting_IBL.ps.hlsl index 18fc1c6e3e..794c2fb07e 100644 --- a/neo/shaders/builtin/lighting/ambient_lighting_IBL.ps.hlsl +++ b/neo/shaders/builtin/lighting/ambient_lighting_IBL.ps.hlsl @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet8.inc.hlsl" +#include "renderParmSet9.inc.hlsl" #include "BRDF.inc.hlsl" diff --git a/neo/shaders/builtin/lighting/ambient_lighting_IBL.vs.hlsl b/neo/shaders/builtin/lighting/ambient_lighting_IBL.vs.hlsl index 5a07ef5ac2..2305a04c3e 100644 --- a/neo/shaders/builtin/lighting/ambient_lighting_IBL.vs.hlsl +++ b/neo/shaders/builtin/lighting/ambient_lighting_IBL.vs.hlsl @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet8.inc.hlsl" +#include "renderParmSet9.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/builtin/lighting/interaction.ps.hlsl b/neo/shaders/builtin/lighting/interaction.ps.hlsl index b63652f013..5f9f64967a 100644 --- a/neo/shaders/builtin/lighting/interaction.ps.hlsl +++ b/neo/shaders/builtin/lighting/interaction.ps.hlsl @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet9.inc.hlsl" +#include "renderParmSet10.inc.hlsl" #include "BRDF.inc.hlsl" diff --git a/neo/shaders/builtin/lighting/interaction.vs.hlsl b/neo/shaders/builtin/lighting/interaction.vs.hlsl index 728f9b753c..3476f35b2c 100644 --- a/neo/shaders/builtin/lighting/interaction.vs.hlsl +++ b/neo/shaders/builtin/lighting/interaction.vs.hlsl @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet9.inc.hlsl" +#include "renderParmSet10.inc.hlsl" // *INDENT-OFF* #if USE_GPU_SKINNING diff --git a/neo/shaders/builtin/lighting/interactionAmbient.ps.hlsl b/neo/shaders/builtin/lighting/interactionAmbient.ps.hlsl index 6a1ab655c5..2a24babb1d 100644 --- a/neo/shaders/builtin/lighting/interactionAmbient.ps.hlsl +++ b/neo/shaders/builtin/lighting/interactionAmbient.ps.hlsl @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet9.inc.hlsl" +#include "renderParmSet10.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/builtin/lighting/interactionAmbient.vs.hlsl b/neo/shaders/builtin/lighting/interactionAmbient.vs.hlsl index 13eb23cb96..0fa671f45c 100644 --- a/neo/shaders/builtin/lighting/interactionAmbient.vs.hlsl +++ b/neo/shaders/builtin/lighting/interactionAmbient.vs.hlsl @@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet9.inc.hlsl" +#include "renderParmSet10.inc.hlsl" // *INDENT-OFF* #if USE_GPU_SKINNING diff --git a/neo/shaders/builtin/lighting/interactionSM.ps.hlsl b/neo/shaders/builtin/lighting/interactionSM.ps.hlsl index 49c581eb34..0661ef7e5e 100644 --- a/neo/shaders/builtin/lighting/interactionSM.ps.hlsl +++ b/neo/shaders/builtin/lighting/interactionSM.ps.hlsl @@ -29,7 +29,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet10.inc.hlsl" +#include "renderParmSet11.inc.hlsl" #include "BRDF.inc.hlsl" diff --git a/neo/shaders/builtin/lighting/interactionSM.vs.hlsl b/neo/shaders/builtin/lighting/interactionSM.vs.hlsl index 9c198fb883..c011571a3e 100644 --- a/neo/shaders/builtin/lighting/interactionSM.vs.hlsl +++ b/neo/shaders/builtin/lighting/interactionSM.vs.hlsl @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet10.inc.hlsl" +#include "renderParmSet11.inc.hlsl" // *INDENT-OFF* #if USE_GPU_SKINNING diff --git a/neo/shaders/colorProcess.ps.hlsl b/neo/shaders/colorProcess.ps.hlsl index 58f1a20e7f..ea7f7ec0a1 100644 --- a/neo/shaders/colorProcess.ps.hlsl +++ b/neo/shaders/colorProcess.ps.hlsl @@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet7.inc.hlsl" +#include "renderParmSet8.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/colorProcess.vs.hlsl b/neo/shaders/colorProcess.vs.hlsl index 11ba58bf04..60c6c96055 100644 --- a/neo/shaders/colorProcess.vs.hlsl +++ b/neo/shaders/colorProcess.vs.hlsl @@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet7.inc.hlsl" +#include "renderParmSet8.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/enviroSuit.ps.hlsl b/neo/shaders/enviroSuit.ps.hlsl index ac5ee89017..c3b6857c7d 100644 --- a/neo/shaders/enviroSuit.ps.hlsl +++ b/neo/shaders/enviroSuit.ps.hlsl @@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet7.inc.hlsl" +#include "renderParmSet8.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/enviroSuit.vs.hlsl b/neo/shaders/enviroSuit.vs.hlsl index 705635602b..109c8bd44a 100644 --- a/neo/shaders/enviroSuit.vs.hlsl +++ b/neo/shaders/enviroSuit.vs.hlsl @@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet7.inc.hlsl" +#include "renderParmSet8.inc.hlsl" // User Renderparms start at 128 as per renderprogs.h diff --git a/neo/shaders/fogwithlights.ps.hlsl b/neo/shaders/fogwithlights.ps.hlsl index a13d3b9bd2..b347338c7c 100644 --- a/neo/shaders/fogwithlights.ps.hlsl +++ b/neo/shaders/fogwithlights.ps.hlsl @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet7.inc.hlsl" +#include "renderParmSet8.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/fogwithlights.vs.hlsl b/neo/shaders/fogwithlights.vs.hlsl index dde69c70e5..8a462c577c 100644 --- a/neo/shaders/fogwithlights.vs.hlsl +++ b/neo/shaders/fogwithlights.vs.hlsl @@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet7.inc.hlsl" +#include "renderParmSet8.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/global_inc.hlsl b/neo/shaders/global_inc.hlsl index 7e710710e1..eb6a0d166c 100644 --- a/neo/shaders/global_inc.hlsl +++ b/neo/shaders/global_inc.hlsl @@ -449,7 +449,7 @@ static int2 textureSize( Texture2D buffer, int mipLevel ) return int2( width, height ); } -// SRS - moved to renderParmSet7.inc.hlsl and renderParmSet8.inc.hlsl +// SRS - moved to renderParmSet8.inc.hlsl and renderParmSet9.inc.hlsl //static float2 vposToScreenPosTexCoord( float2 vpos ) //{ // return vpos.xy * rpWindowCoord.xy; diff --git a/neo/shaders/heatHazeWithMask.ps.hlsl b/neo/shaders/heatHazeWithMask.ps.hlsl index 7d43e368b5..57783acc9a 100644 --- a/neo/shaders/heatHazeWithMask.ps.hlsl +++ b/neo/shaders/heatHazeWithMask.ps.hlsl @@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet7.inc.hlsl" +#include "renderParmSet8.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/heatHazeWithMask.vs.hlsl b/neo/shaders/heatHazeWithMask.vs.hlsl index 6acf545a0d..9b53654075 100644 --- a/neo/shaders/heatHazeWithMask.vs.hlsl +++ b/neo/shaders/heatHazeWithMask.vs.hlsl @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet7.inc.hlsl" +#include "renderParmSet8.inc.hlsl" // User Renderparms start at 128 as per renderprogs.h diff --git a/neo/shaders/heatHazeWithMaskAndVertex.ps.hlsl b/neo/shaders/heatHazeWithMaskAndVertex.ps.hlsl index 20679c2893..ed83fee248 100644 --- a/neo/shaders/heatHazeWithMaskAndVertex.ps.hlsl +++ b/neo/shaders/heatHazeWithMaskAndVertex.ps.hlsl @@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet7.inc.hlsl" +#include "renderParmSet8.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/heatHazeWithMaskAndVertex.vs.hlsl b/neo/shaders/heatHazeWithMaskAndVertex.vs.hlsl index 1170733487..4f720b5332 100644 --- a/neo/shaders/heatHazeWithMaskAndVertex.vs.hlsl +++ b/neo/shaders/heatHazeWithMaskAndVertex.vs.hlsl @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet7.inc.hlsl" +#include "renderParmSet8.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/heathaze.ps.hlsl b/neo/shaders/heathaze.ps.hlsl index f5271aff36..1cf1a80783 100644 --- a/neo/shaders/heathaze.ps.hlsl +++ b/neo/shaders/heathaze.ps.hlsl @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet7.inc.hlsl" +#include "renderParmSet8.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/heathaze.vs.hlsl b/neo/shaders/heathaze.vs.hlsl index d01d90a9e2..493a4a0a0d 100644 --- a/neo/shaders/heathaze.vs.hlsl +++ b/neo/shaders/heathaze.vs.hlsl @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet7.inc.hlsl" +#include "renderParmSet8.inc.hlsl" // User Renderparms start at 128 as per renderprogs.h diff --git a/neo/shaders/mattiascrt.ps.hlsl b/neo/shaders/mattiascrt.ps.hlsl index acb91b668a..410745c47b 100644 --- a/neo/shaders/mattiascrt.ps.hlsl +++ b/neo/shaders/mattiascrt.ps.hlsl @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet7.inc.hlsl" +#include "renderParmSet8.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/mattiascrt.vs.hlsl b/neo/shaders/mattiascrt.vs.hlsl index b67b7e193a..aa1cec252c 100644 --- a/neo/shaders/mattiascrt.vs.hlsl +++ b/neo/shaders/mattiascrt.vs.hlsl @@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet7.inc.hlsl" +#include "renderParmSet8.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/renderParmSet1.inc.hlsl b/neo/shaders/renderParmSet1.inc.hlsl index 48e9bcd40b..f1b03f4a30 100644 --- a/neo/shaders/renderParmSet1.inc.hlsl +++ b/neo/shaders/renderParmSet1.inc.hlsl @@ -39,8 +39,6 @@ struct renderParmSet1_t float4 rpMVPmatrixZ; float4 rpMVPmatrixW; - float4 rpProjectionMatrixZ; - float4 rpOverbright; }; diff --git a/neo/shaders/renderParmSet10.inc.hlsl b/neo/shaders/renderParmSet10.inc.hlsl index 26cc78acad..23a4a13f57 100644 --- a/neo/shaders/renderParmSet10.inc.hlsl +++ b/neo/shaders/renderParmSet10.inc.hlsl @@ -27,9 +27,10 @@ If you have questions concerning this license or the applicable additional terms =========================================================================== */ +#include "vulkan.hlsli" + struct renderParmSet10_t { - float4 rpScreenCorrectionFactor; float4 rpDiffuseModifier; float4 rpSpecularModifier; @@ -40,7 +41,7 @@ struct renderParmSet10_t float4 rpLightProjectionT; float4 rpLightProjectionQ; float4 rpLightFalloffS; - + float4 rpBumpMatrixS; float4 rpBumpMatrixT; @@ -52,29 +53,11 @@ struct renderParmSet10_t float4 rpVertexColorModulate; float4 rpVertexColorAdd; - + float4 rpMVPmatrixX; float4 rpMVPmatrixY; float4 rpMVPmatrixZ; float4 rpMVPmatrixW; - - float4 rpModelMatrixX; - float4 rpModelMatrixY; - float4 rpModelMatrixZ; - float4 rpModelMatrixW; - - float4 rpModelViewMatrixX; - float4 rpModelViewMatrixY; - float4 rpModelViewMatrixZ; - float4 rpModelViewMatrixW; - - float4 rpGlobalLightOrigin; - float4 rpJitterTexScale; - float4 rpJitterTexOffset; - float4 rpCascadeDistances; - - float4 rpShadowMatrices[6 * 4]; - float4 rpShadowAtlasOffsets[6]; }; #if USE_PUSH_CONSTANTS diff --git a/neo/shaders/renderParmSet11.inc.hlsl b/neo/shaders/renderParmSet11.inc.hlsl new file mode 100644 index 0000000000..0c63fd2565 --- /dev/null +++ b/neo/shaders/renderParmSet11.inc.hlsl @@ -0,0 +1,93 @@ +/* +=========================================================================== + +Doom 3 BFG Edition GPL Source Code +Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. +Copyright (C) 2013-2020 Robert Beckebans + +This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). + +Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Doom 3 BFG Edition Source Code. If not, see . + +In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. + +If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. + +=========================================================================== +*/ + +#include "vulkan.hlsli" + +struct renderParmSet11_t +{ + float4 rpScreenCorrectionFactor; + float4 rpDiffuseModifier; + float4 rpSpecularModifier; + + float4 rpLocalLightOrigin; + float4 rpLocalViewOrigin; + + float4 rpLightProjectionS; + float4 rpLightProjectionT; + float4 rpLightProjectionQ; + float4 rpLightFalloffS; + + float4 rpBumpMatrixS; + float4 rpBumpMatrixT; + + float4 rpDiffuseMatrixS; + float4 rpDiffuseMatrixT; + + float4 rpSpecularMatrixS; + float4 rpSpecularMatrixT; + + float4 rpVertexColorModulate; + float4 rpVertexColorAdd; + + float4 rpMVPmatrixX; + float4 rpMVPmatrixY; + float4 rpMVPmatrixZ; + float4 rpMVPmatrixW; + + float4 rpModelMatrixX; + float4 rpModelMatrixY; + float4 rpModelMatrixZ; + float4 rpModelMatrixW; + + float4 rpModelViewMatrixX; + float4 rpModelViewMatrixY; + float4 rpModelViewMatrixZ; + float4 rpModelViewMatrixW; + + float4 rpGlobalLightOrigin; + float4 rpJitterTexScale; + float4 rpJitterTexOffset; + float4 rpCascadeDistances; + + float4 rpShadowMatrices[6 * 4]; + float4 rpShadowAtlasOffsets[6]; +}; + +#if USE_PUSH_CONSTANTS + +VK_PUSH_CONSTANT ConstantBuffer pc : register( b0 ); + +#else + +cbuffer pc : register( b0 VK_DESCRIPTOR_SET( 0 ) ) +{ + renderParmSet11_t pc; +} + +#endif diff --git a/neo/shaders/renderParmSet3.inc.hlsl b/neo/shaders/renderParmSet3.inc.hlsl index e6ecc1cb45..73b14891e7 100644 --- a/neo/shaders/renderParmSet3.inc.hlsl +++ b/neo/shaders/renderParmSet3.inc.hlsl @@ -31,16 +31,12 @@ If you have questions concerning this license or the applicable additional terms struct renderParmSet3_t { - float4 rpScreenCorrectionFactor; - float4 rpBumpMatrixS; float4 rpBumpMatrixT; float4 rpVertexColorModulate; float4 rpVertexColorAdd; - float4 rpColor; - float4 rpMVPmatrixX; float4 rpMVPmatrixY; float4 rpMVPmatrixZ; @@ -49,11 +45,6 @@ struct renderParmSet3_t float4 rpModelViewMatrixX; float4 rpModelViewMatrixY; float4 rpModelViewMatrixZ; - - float4 rpTextureMatrixS; - float4 rpTextureMatrixT; - - float4 rpTexGen0Enabled; }; #if USE_PUSH_CONSTANTS diff --git a/neo/shaders/renderParmSet4.inc.hlsl b/neo/shaders/renderParmSet4.inc.hlsl index 715345cc89..cca86d3855 100644 --- a/neo/shaders/renderParmSet4.inc.hlsl +++ b/neo/shaders/renderParmSet4.inc.hlsl @@ -31,6 +31,8 @@ If you have questions concerning this license or the applicable additional terms struct renderParmSet4_t { + float4 rpScreenCorrectionFactor; + float4 rpVertexColorModulate; float4 rpVertexColorAdd; @@ -49,9 +51,6 @@ struct renderParmSet4_t float4 rpTexGen0Q; float4 rpTexGen0Enabled; - float4 rpTexGen1S; - float4 rpTexGen1T; - float4 rpAlphaTest; }; diff --git a/neo/shaders/renderParmSet5.inc.hlsl b/neo/shaders/renderParmSet5.inc.hlsl index a15d733bed..adab55d499 100644 --- a/neo/shaders/renderParmSet5.inc.hlsl +++ b/neo/shaders/renderParmSet5.inc.hlsl @@ -46,13 +46,10 @@ struct renderParmSet5_t float4 rpModelMatrixX; float4 rpModelMatrixY; float4 rpModelMatrixZ; - float4 rpModelMatrixW; float4 rpWobbleSkyX; float4 rpWobbleSkyY; float4 rpWobbleSkyZ; - - float4 rpCascadeDistances; }; #if USE_PUSH_CONSTANTS diff --git a/neo/shaders/renderParmSet6.inc.hlsl b/neo/shaders/renderParmSet6.inc.hlsl index daa04d0017..b122a32907 100644 --- a/neo/shaders/renderParmSet6.inc.hlsl +++ b/neo/shaders/renderParmSet6.inc.hlsl @@ -32,7 +32,6 @@ If you have questions concerning this license or the applicable additional terms struct renderParmSet6_t { float4 rpScreenCorrectionFactor; - float4 rpWindowCoord; float4 rpColor; @@ -46,8 +45,6 @@ struct renderParmSet6_t float4 rpModelMatrixZ; float4 rpModelMatrixW; - float4 rpOverbright; - float4 rpGlobalLightOrigin; float4 rpJitterTexScale; float4 rpJitterTexOffset; diff --git a/neo/shaders/renderParmSet7.inc.hlsl b/neo/shaders/renderParmSet7.inc.hlsl index 64067ef3eb..a0c1cc0cd0 100644 --- a/neo/shaders/renderParmSet7.inc.hlsl +++ b/neo/shaders/renderParmSet7.inc.hlsl @@ -31,27 +31,19 @@ If you have questions concerning this license or the applicable additional terms struct renderParmSet7_t { - float4 rpWindowCoord; + float4 rpColor; float4 rpMVPmatrixX; float4 rpMVPmatrixY; float4 rpMVPmatrixZ; float4 rpMVPmatrixW; - float4 rpProjectionMatrixY; - float4 rpProjectionMatrixW; + float4 rpTexGen0S; + float4 rpTexGen0T; + float4 rpTexGen0Q; - float4 rpModelViewMatrixZ; - - float4 rpEnableSkinning; - float4 rpAlphaTest; - - float4 rpUser0; - float4 rpUser1; - float4 rpUser2; - float4 rpUser3; - float4 rpUser4; - float4 rpUser5; + float4 rpTexGen1S; + float4 rpTexGen1T; }; #if USE_PUSH_CONSTANTS @@ -66,8 +58,3 @@ cbuffer pc : register( b0 VK_DESCRIPTOR_SET( 0 ) ) } #endif - -static float2 vposToScreenPosTexCoord( float2 vpos ) -{ - return vpos.xy * pc.rpWindowCoord.xy; -} diff --git a/neo/shaders/renderParmSet8.inc.hlsl b/neo/shaders/renderParmSet8.inc.hlsl index 4921969e8e..0d19d84b0a 100644 --- a/neo/shaders/renderParmSet8.inc.hlsl +++ b/neo/shaders/renderParmSet8.inc.hlsl @@ -31,47 +31,24 @@ If you have questions concerning this license or the applicable additional terms struct renderParmSet8_t { - float4 rpScreenCorrectionFactor; float4 rpWindowCoord; - float4 rpDiffuseModifier; - float4 rpSpecularModifier; - - float4 rpLocalLightOrigin; - float4 rpLocalViewOrigin; - - float4 rpBumpMatrixS; - float4 rpBumpMatrixT; - - float4 rpDiffuseMatrixS; - float4 rpDiffuseMatrixT; - - float4 rpSpecularMatrixS; - float4 rpSpecularMatrixT; - - float4 rpVertexColorModulate; - float4 rpVertexColorAdd; - - float4 rpGlobalEyePos; float4 rpMVPmatrixX; float4 rpMVPmatrixY; float4 rpMVPmatrixZ; float4 rpMVPmatrixW; - - float4 rpModelMatrixX; - float4 rpModelMatrixY; - float4 rpModelMatrixZ; - float4 rpModelMatrixW; - - //float4 rpWobbleSkyX; - //float4 rpWobbleSkyY; - //float4 rpWobbleSkyZ; - - float4 rpAmbientColor; - float4 rpGlobalLightOrigin; - float4 rpJitterTexScale; - float4 rpJitterTexOffset; - float4 rpCascadeDistances; + + float4 rpProjectionMatrixY; + float4 rpProjectionMatrixW; + + float4 rpModelViewMatrixZ; + + float4 rpEnableSkinning; + float4 rpAlphaTest; + + float4 rpUser0; + float4 rpUser1; + float4 rpUser2; }; #if USE_PUSH_CONSTANTS diff --git a/neo/shaders/renderParmSet9.inc.hlsl b/neo/shaders/renderParmSet9.inc.hlsl index 976c8db923..dd775debd8 100644 --- a/neo/shaders/renderParmSet9.inc.hlsl +++ b/neo/shaders/renderParmSet9.inc.hlsl @@ -31,17 +31,14 @@ If you have questions concerning this license or the applicable additional terms struct renderParmSet9_t { + float4 rpScreenCorrectionFactor; + float4 rpWindowCoord; float4 rpDiffuseModifier; float4 rpSpecularModifier; float4 rpLocalLightOrigin; float4 rpLocalViewOrigin; - float4 rpLightProjectionS; - float4 rpLightProjectionT; - float4 rpLightProjectionQ; - float4 rpLightFalloffS; - float4 rpBumpMatrixS; float4 rpBumpMatrixT; @@ -54,10 +51,23 @@ struct renderParmSet9_t float4 rpVertexColorModulate; float4 rpVertexColorAdd; + float4 rpGlobalEyePos; + float4 rpMVPmatrixX; float4 rpMVPmatrixY; float4 rpMVPmatrixZ; float4 rpMVPmatrixW; + + float4 rpModelMatrixX; + float4 rpModelMatrixY; + float4 rpModelMatrixZ; + float4 rpModelMatrixW; + + float4 rpAmbientColor; + float4 rpGlobalLightOrigin; + float4 rpJitterTexScale; + float4 rpJitterTexOffset; + float4 rpCascadeDistances; }; #if USE_PUSH_CONSTANTS @@ -72,3 +82,8 @@ cbuffer pc : register( b0 VK_DESCRIPTOR_SET( 0 ) ) } #endif + +static float2 vposToScreenPosTexCoord( float2 vpos ) +{ + return vpos.xy * pc.rpWindowCoord.xy; +} diff --git a/neo/shaders/vertbuffershaders.hlsl b/neo/shaders/vertbuffershaders.hlsl index 47fdc7283f..313ea8f2c1 100644 --- a/neo/shaders/vertbuffershaders.hlsl +++ b/neo/shaders/vertbuffershaders.hlsl @@ -21,7 +21,7 @@ */ #include "global_inc.hlsl" -#include "renderParmSet7.inc.hlsl" +#include "renderParmSet8.inc.hlsl" #pragma pack_matrix(row_major) diff --git a/neo/shaders/vornoipattern.ps.hlsl b/neo/shaders/vornoipattern.ps.hlsl index 9c45215b1e..c2a1907780 100644 --- a/neo/shaders/vornoipattern.ps.hlsl +++ b/neo/shaders/vornoipattern.ps.hlsl @@ -56,7 +56,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet7.inc.hlsl" +#include "renderParmSet8.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/vornoipattern.vs.hlsl b/neo/shaders/vornoipattern.vs.hlsl index 0da34a96e5..6b2bbe6fed 100644 --- a/neo/shaders/vornoipattern.vs.hlsl +++ b/neo/shaders/vornoipattern.vs.hlsl @@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet7.inc.hlsl" +#include "renderParmSet8.inc.hlsl" // *INDENT-OFF* diff --git a/neo/sys/DeviceManager.h b/neo/sys/DeviceManager.h index 46d545b7f1..cfb9b7f5a2 100644 --- a/neo/sys/DeviceManager.h +++ b/neo/sys/DeviceManager.h @@ -110,8 +110,9 @@ struct DeviceCreationParameters // SRS - Used by idImage::AllocImage() to determine if format D24S8 is supported by device (default = true) bool enableImageFormatD24S8 = true; - // SRS - Used by RenderProgs to determine maximum push constant size (set default for DX12, override for Vulkan) - int maxPushConstantSize = 256; + // SRS - Used by RenderProgs to determine maximum push constant size for renderer (set default for DX12, override for Vulkan) + // - D3D12 root constant max < 256 bytes due to layout root parameters (i.e. 256 - sizeof(DWORD) * 4 layouts max = 240 bytes) + int maxPushConstantSize = 240; // sufficient to support D3D12 push constants for rpMinimalSets & rpNominalSets }; struct DefaultMessageCallback : public nvrhi::IMessageCallback @@ -153,7 +154,6 @@ class DeviceManager friend class idRenderBackend; friend class idImage; friend class idRenderProgManager; - friend class idMaterial; void* windowInstance; void* windowHandle; diff --git a/neo/sys/DeviceManager_VK.cpp b/neo/sys/DeviceManager_VK.cpp index 4985708847..0a70c21936 100644 --- a/neo/sys/DeviceManager_VK.cpp +++ b/neo/sys/DeviceManager_VK.cpp @@ -946,7 +946,7 @@ bool DeviceManager_VK::createDevice() allocatorCreateInfo.instance = m_VulkanInstance; allocatorCreateInfo.pVulkanFunctions = &vulkanFunctions; allocatorCreateInfo.flags = bufferAddressSupported ? VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT : 0; - allocatorCreateInfo.preferredLargeHeapBlockSize = r_vmaDeviceLocalMemoryMB.GetInteger() * 1024 * 1024; + allocatorCreateInfo.preferredLargeHeapBlockSize = ( VkDeviceSize )r_vmaDeviceLocalMemoryMB.GetInteger() * 1024 * 1024; vmaCreateAllocator( &allocatorCreateInfo, &m_VmaAllocator ); #endif From 988d3ed17964a7d7c0cbefc82057aab219b48389 Mon Sep 17 00:00:00 2001 From: Stephen Saunders Date: Tue, 10 Oct 2023 09:40:19 -0400 Subject: [PATCH 03/15] Clamp max push constant size to nvrhi::c_MaxPushConstantSize (cherry picked from commit 509b19698b71501f6166dc3bc5f8aae2337769a2) --- neo/renderer/RenderProgs.h | 2 +- neo/sys/DeviceManager.h | 2 +- neo/sys/DeviceManager_VK.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/neo/renderer/RenderProgs.h b/neo/renderer/RenderProgs.h index 146ba1f4c6..e8ced381dd 100644 --- a/neo/renderer/RenderProgs.h +++ b/neo/renderer/RenderProgs.h @@ -1152,7 +1152,7 @@ class idRenderProgManager struct layoutTypeAttributes_t { renderParmSubSet_t rpSubSet; - int rpBufSize; + uint32_t rpBufSize; bool cbStatic; bool pcEnabled; }; diff --git a/neo/sys/DeviceManager.h b/neo/sys/DeviceManager.h index cfb9b7f5a2..ad28d0a7f5 100644 --- a/neo/sys/DeviceManager.h +++ b/neo/sys/DeviceManager.h @@ -112,7 +112,7 @@ struct DeviceCreationParameters // SRS - Used by RenderProgs to determine maximum push constant size for renderer (set default for DX12, override for Vulkan) // - D3D12 root constant max < 256 bytes due to layout root parameters (i.e. 256 - sizeof(DWORD) * 4 layouts max = 240 bytes) - int maxPushConstantSize = 240; // sufficient to support D3D12 push constants for rpMinimalSets & rpNominalSets + uint32_t maxPushConstantSize = Min( ( uint32_t )240, nvrhi::c_MaxPushConstantSize ); }; struct DefaultMessageCallback : public nvrhi::IMessageCallback diff --git a/neo/sys/DeviceManager_VK.cpp b/neo/sys/DeviceManager_VK.cpp index 0a70c21936..d55e2efdb7 100644 --- a/neo/sys/DeviceManager_VK.cpp +++ b/neo/sys/DeviceManager_VK.cpp @@ -927,7 +927,7 @@ bool DeviceManager_VK::createDevice() // SRS - Determine maxPushConstantSize for Vulkan device vk::PhysicalDeviceProperties deviceProperties; m_VulkanPhysicalDevice.getProperties( &deviceProperties ); - m_DeviceParams.maxPushConstantSize = deviceProperties.limits.maxPushConstantsSize; + m_DeviceParams.maxPushConstantSize = Min( deviceProperties.limits.maxPushConstantsSize, nvrhi::c_MaxPushConstantSize ); // stash the renderer string auto prop = m_VulkanPhysicalDevice.getProperties(); From 3b7f5c7121e05b918d72f2e8898ff07195c85f5d Mon Sep 17 00:00:00 2001 From: Stephen Saunders Date: Tue, 10 Oct 2023 12:14:13 -0400 Subject: [PATCH 04/15] Define r_useDX12PushConstants cvar (default off) to control DX12 push constants (cherry picked from commit 5a766072ed006aadc4b2f12b65e526201597c63b) --- neo/sys/DeviceManager.h | 5 ++--- neo/sys/DeviceManager_DX12.cpp | 8 ++++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/neo/sys/DeviceManager.h b/neo/sys/DeviceManager.h index ad28d0a7f5..174ac55844 100644 --- a/neo/sys/DeviceManager.h +++ b/neo/sys/DeviceManager.h @@ -110,9 +110,8 @@ struct DeviceCreationParameters // SRS - Used by idImage::AllocImage() to determine if format D24S8 is supported by device (default = true) bool enableImageFormatD24S8 = true; - // SRS - Used by RenderProgs to determine maximum push constant size for renderer (set default for DX12, override for Vulkan) - // - D3D12 root constant max < 256 bytes due to layout root parameters (i.e. 256 - sizeof(DWORD) * 4 layouts max = 240 bytes) - uint32_t maxPushConstantSize = Min( ( uint32_t )240, nvrhi::c_MaxPushConstantSize ); + // SRS - Used by RenderProgs to determine maximum push constant size (default = off, override during device init) + uint32_t maxPushConstantSize = 0; }; struct DefaultMessageCallback : public nvrhi::IMessageCallback diff --git a/neo/sys/DeviceManager_DX12.cpp b/neo/sys/DeviceManager_DX12.cpp index 29d9142a21..16a32817a1 100644 --- a/neo/sys/DeviceManager_DX12.cpp +++ b/neo/sys/DeviceManager_DX12.cpp @@ -47,6 +47,7 @@ using nvrhi::RefCountPtr; #define HR_RETURN(hr) if(FAILED(hr)) return false idCVar r_graphicsAdapter( "r_graphicsAdapter", "", CVAR_RENDERER | CVAR_INIT | CVAR_ARCHIVE, "Substring in the name the DXGI graphics adapter to select a certain GPU" ); +idCVar r_useDX12PushConstants( "r_useDX12PushConstants", "0", CVAR_RENDERER | CVAR_BOOL | CVAR_INIT, "Use D3D12 root constants / push constants for DX12 renderer" ); class DeviceManager_DX12 : public DeviceManager { @@ -444,6 +445,13 @@ bool DeviceManager_DX12::CreateDeviceAndSwapChain() m_NvrhiDevice = nvrhi::validation::createValidationLayer( m_NvrhiDevice ); } + // SRS - Determine maxPushConstantSize for DX12 device (enabled based on r_useDX12PushConstants cvar setting) + if( r_useDX12PushConstants.GetBool() ) + { + // SRS - D3D12 root constant max < 256 bytes due to layout root parameters: reduce by sizeof(DWORD) * 4 layouts max + m_DeviceParams.maxPushConstantSize = Min( ( uint32_t )( 256 - sizeof( DWORD ) * 4 ), nvrhi::c_MaxPushConstantSize ); + } + if( !CreateRenderTargets() ) { return false; From 915119041ee1a8667c111a0ea263a0b87e7a982b Mon Sep 17 00:00:00 2001 From: Stephen Saunders Date: Sat, 21 Oct 2023 13:26:20 -0400 Subject: [PATCH 05/15] Fix uniforms change detection and add r_useVulkanPushConstants cvar (default on) (cherry picked from commit 2063c72912a76f07f545dddaa806e0e7869d0b1c) --- neo/renderer/NVRHI/RenderProgs_NVRHI.cpp | 9 ++++---- neo/renderer/RenderBackend.cpp | 3 +++ neo/renderer/RenderProgs.cpp | 26 ++++++++++++------------ neo/sys/DeviceManager_VK.cpp | 10 ++++++--- 4 files changed, 27 insertions(+), 21 deletions(-) diff --git a/neo/renderer/NVRHI/RenderProgs_NVRHI.cpp b/neo/renderer/NVRHI/RenderProgs_NVRHI.cpp index 60a8cc28e3..aefb9cd5a6 100644 --- a/neo/renderer/NVRHI/RenderProgs_NVRHI.cpp +++ b/neo/renderer/NVRHI/RenderProgs_NVRHI.cpp @@ -300,13 +300,12 @@ void idRenderProgManager::SetUniformValue( const renderParm_t rp, const float va } } - for( int i = 0; i < renderParmLayoutTypes[rp].Num(); i++ ) + if( rpChanged ) { - // SRS - set flag if uniforms changed or constant buffer is volatile and push constants disabled for layout type - int layoutType = renderParmLayoutTypes[rp][i]; - if( rpChanged || ( !layoutTypeAttributes[layoutType].cbStatic && !layoutTypeAttributes[layoutType].pcEnabled ) ) + for( int i = 0; i < renderParmLayoutTypes[rp].Num(); i++ ) { - uniformsChanged[layoutType] = true; + // SRS - set flag if uniforms changed for associated binding layout types + uniformsChanged[renderParmLayoutTypes[rp][i]] = true; } } } diff --git a/neo/renderer/RenderBackend.cpp b/neo/renderer/RenderBackend.cpp index 51b405619f..73f5042c5d 100644 --- a/neo/renderer/RenderBackend.cpp +++ b/neo/renderer/RenderBackend.cpp @@ -5457,6 +5457,9 @@ void idRenderBackend::DrawViewInternal( const viewDef_t* _viewDef, const int ste currentIndexOffset = 0; currentJointOffset = 0; + // SRS - clear renderparms and initialize/set change status for all binding layout types + renderProgManager.ZeroUniforms(); + //------------------------------------------------- // RB_BeginDrawingView // diff --git a/neo/renderer/RenderProgs.cpp b/neo/renderer/RenderProgs.cpp index ca5fd291c9..04a53cc7b5 100644 --- a/neo/renderer/RenderProgs.cpp +++ b/neo/renderer/RenderProgs.cpp @@ -221,7 +221,7 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) // SRS - create renderparm to binding layout types mapping for efficient render-time lookups for( int i = 0; i < rpMinimalSet0.Num(); i++ ) { - renderParmLayoutTypes[rpMinimalSet0[i]].Append( ( bindingLayoutType_t )layoutType ); + renderParmLayoutTypes[rpMinimalSet0[i]].AddUnique( ( bindingLayoutType_t )layoutType ); } } else if( rpMinimalSet1LayoutTypes.Find( ( bindingLayoutType_t )layoutType ) ) @@ -232,7 +232,7 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) for( int i = 0; i < rpMinimalSet1.Num(); i++ ) { - renderParmLayoutTypes[rpMinimalSet1[i]].Append( ( bindingLayoutType_t )layoutType ); + renderParmLayoutTypes[rpMinimalSet1[i]].AddUnique( ( bindingLayoutType_t )layoutType ); } } else if( rpMinimalSet2LayoutTypes.Find( ( bindingLayoutType_t )layoutType ) ) @@ -243,7 +243,7 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) for( int i = 0; i < rpMinimalSet2.Num(); i++ ) { - renderParmLayoutTypes[rpMinimalSet2[i]].Append( ( bindingLayoutType_t )layoutType ); + renderParmLayoutTypes[rpMinimalSet2[i]].AddUnique( ( bindingLayoutType_t )layoutType ); } } else if( rpNominalSet3LayoutTypes.Find( ( bindingLayoutType_t )layoutType ) ) @@ -254,7 +254,7 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) for( int i = 0; i < rpNominalSet3.Num(); i++ ) { - renderParmLayoutTypes[rpNominalSet3[i]].Append( ( bindingLayoutType_t )layoutType ); + renderParmLayoutTypes[rpNominalSet3[i]].AddUnique( ( bindingLayoutType_t )layoutType ); } } else if( rpNominalSet4LayoutTypes.Find( ( bindingLayoutType_t )layoutType ) ) @@ -265,7 +265,7 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) for( int i = 0; i < rpNominalSet4.Num(); i++ ) { - renderParmLayoutTypes[rpNominalSet4[i]].Append( ( bindingLayoutType_t )layoutType ); + renderParmLayoutTypes[rpNominalSet4[i]].AddUnique( ( bindingLayoutType_t )layoutType ); } } else if( rpNominalSet5LayoutTypes.Find( ( bindingLayoutType_t )layoutType ) ) @@ -276,7 +276,7 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) for( int i = 0; i < rpNominalSet5.Num(); i++ ) { - renderParmLayoutTypes[rpNominalSet5[i]].Append( ( bindingLayoutType_t )layoutType ); + renderParmLayoutTypes[rpNominalSet5[i]].AddUnique( ( bindingLayoutType_t )layoutType ); } } else if( rpNominalSet6LayoutTypes.Find( ( bindingLayoutType_t )layoutType ) ) @@ -287,7 +287,7 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) for( int i = 0; i < rpNominalSet6.Num(); i++ ) { - renderParmLayoutTypes[rpNominalSet6[i]].Append( ( bindingLayoutType_t )layoutType ); + renderParmLayoutTypes[rpNominalSet6[i]].AddUnique( ( bindingLayoutType_t )layoutType ); } } else if( rpNominalSet7LayoutTypes.Find( ( bindingLayoutType_t )layoutType ) ) @@ -298,7 +298,7 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) for( int i = 0; i < rpNominalSet7.Num(); i++ ) { - renderParmLayoutTypes[rpNominalSet7[i]].Append( ( bindingLayoutType_t )layoutType ); + renderParmLayoutTypes[rpNominalSet7[i]].AddUnique( ( bindingLayoutType_t )layoutType ); } } else if( rpNominalSet8LayoutTypes.Find( ( bindingLayoutType_t )layoutType ) ) @@ -309,7 +309,7 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) for( int i = 0; i < rpNominalSet8.Num(); i++ ) { - renderParmLayoutTypes[rpNominalSet8[i]].Append( ( bindingLayoutType_t )layoutType ); + renderParmLayoutTypes[rpNominalSet8[i]].AddUnique( ( bindingLayoutType_t )layoutType ); } } else if( rpMaximalSet9LayoutTypes.Find( ( bindingLayoutType_t )layoutType ) ) @@ -320,7 +320,7 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) for( int i = 0; i < rpMaximalSet9.Num(); i++ ) { - renderParmLayoutTypes[rpMaximalSet9[i]].Append( ( bindingLayoutType_t )layoutType ); + renderParmLayoutTypes[rpMaximalSet9[i]].AddUnique( ( bindingLayoutType_t )layoutType ); } } else if( rpMaximalSet10LayoutTypes.Find( ( bindingLayoutType_t )layoutType ) ) @@ -331,7 +331,7 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) for( int i = 0; i < rpMaximalSet10.Num(); i++ ) { - renderParmLayoutTypes[rpMaximalSet10[i]].Append( ( bindingLayoutType_t )layoutType ); + renderParmLayoutTypes[rpMaximalSet10[i]].AddUnique( ( bindingLayoutType_t )layoutType ); } } else if( rpMaximalSet11LayoutTypes.Find( ( bindingLayoutType_t )layoutType ) ) @@ -342,7 +342,7 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) for( int i = 0; i < rpMaximalSet11.Num(); i++ ) { - renderParmLayoutTypes[rpMaximalSet11[i]].Append( ( bindingLayoutType_t )layoutType ); + renderParmLayoutTypes[rpMaximalSet11[i]].AddUnique( ( bindingLayoutType_t )layoutType ); } } else @@ -352,7 +352,7 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) layoutTypeAttributes[layoutType].cbStatic = false; } - layoutTypeAttributes[layoutType].pcEnabled = deviceManager->m_DeviceParams.maxPushConstantSize >= layoutTypeAttributes[layoutType].rpBufSize; + layoutTypeAttributes[layoutType].pcEnabled = layoutTypeAttributes[layoutType].rpBufSize <= deviceManager->m_DeviceParams.maxPushConstantSize; } auto defaultLayoutDesc = nvrhi::BindingLayoutDesc() diff --git a/neo/sys/DeviceManager_VK.cpp b/neo/sys/DeviceManager_VK.cpp index d55e2efdb7..f2529bdd04 100644 --- a/neo/sys/DeviceManager_VK.cpp +++ b/neo/sys/DeviceManager_VK.cpp @@ -55,6 +55,7 @@ #endif idCVar r_preferFastSync( "r_preferFastSync", "1", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_BOOL, "Prefer Fast Sync/no-tearing in place of VSync off/tearing (Vulkan only)" ); +idCVar r_useVulkanPushConstants( "r_useVulkanPushConstants", "1", CVAR_RENDERER | CVAR_BOOL | CVAR_INIT, "Use push constants for Vulkan renderer" ); // Define the Vulkan dynamic dispatcher - this needs to occur in exactly one cpp file in the program. VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE @@ -925,9 +926,12 @@ bool DeviceManager_VK::createDevice() enablePModeFifoRelaxed = find( surfacePModes.begin(), surfacePModes.end(), vk::PresentModeKHR::eFifoRelaxed ) != surfacePModes.end(); // SRS - Determine maxPushConstantSize for Vulkan device - vk::PhysicalDeviceProperties deviceProperties; - m_VulkanPhysicalDevice.getProperties( &deviceProperties ); - m_DeviceParams.maxPushConstantSize = Min( deviceProperties.limits.maxPushConstantsSize, nvrhi::c_MaxPushConstantSize ); + if( r_useVulkanPushConstants.GetBool() ) + { + vk::PhysicalDeviceProperties deviceProperties; + m_VulkanPhysicalDevice.getProperties( &deviceProperties ); + m_DeviceParams.maxPushConstantSize = Min( deviceProperties.limits.maxPushConstantsSize, nvrhi::c_MaxPushConstantSize ); + } // stash the renderer string auto prop = m_VulkanPhysicalDevice.getProperties(); From 416424561cebd6c41a2bca73cd2e5056ee94d4b2 Mon Sep 17 00:00:00 2001 From: Stephen Saunders Date: Mon, 23 Oct 2023 21:04:59 -0400 Subject: [PATCH 06/15] Simplify change detection logic that controls writing of constant buffers / push constants (cherry picked from commit c1f712a3d66ee6177c7eca518034c960b8bc97f2) --- neo/renderer/NVRHI/RenderBackend_NVRHI.cpp | 4 +++- neo/renderer/NVRHI/RenderProgs_NVRHI.cpp | 10 ++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp b/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp index 495dbf98c3..2c5681e805 100644 --- a/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp +++ b/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp @@ -478,7 +478,9 @@ void idRenderBackend::DrawElementsWithCounters( const drawSurf_t* surf, bool sha stateScissor = context.scissor; } - if( renderProgManager.CommitConstantBuffer( commandList, bindingLayoutType != prevBindingLayoutType ) ) + // SRS - don't check if binding layout type changed since it is already handled above and renderparm change detection + // logic is sufficient to control writing of the constant buffer / push constants for each binding layout type + if( renderProgManager.CommitConstantBuffer( commandList, false /*bindingLayoutType != prevBindingLayoutType*/ ) ) { if( deviceManager->GetGraphicsAPI() == nvrhi::GraphicsAPI::VULKAN ) { diff --git a/neo/renderer/NVRHI/RenderProgs_NVRHI.cpp b/neo/renderer/NVRHI/RenderProgs_NVRHI.cpp index aefb9cd5a6..84966d5021 100644 --- a/neo/renderer/NVRHI/RenderProgs_NVRHI.cpp +++ b/neo/renderer/NVRHI/RenderProgs_NVRHI.cpp @@ -473,10 +473,7 @@ bool idRenderProgManager::CommitConstantBuffer( nvrhi::ICommandList* commandList commandList->writeBuffer( constantBuffer[bindingLayoutType], &renderParmSet, layoutTypeAttributes[bindingLayoutType].rpBufSize ); - for( int i = 0; i < NUM_BINDING_LAYOUTS; i++ ) - { - uniformsChanged[i] = false; - } + uniformsChanged[bindingLayoutType] = false; return true; } @@ -494,9 +491,6 @@ void idRenderProgManager::CommitPushConstants( nvrhi::ICommandList* commandList, commandList->setPushConstants( &renderParmSet, layoutTypeAttributes[bindingLayoutType].rpBufSize ); - for( int i = 0; i < NUM_BINDING_LAYOUTS; i++ ) - { - uniformsChanged[i] = false; - } + uniformsChanged[bindingLayoutType] = false; } } From 012d7bc1910ea0835eb19041d6b738d1c5c95d48 Mon Sep 17 00:00:00 2001 From: Stephen Saunders Date: Wed, 29 Nov 2023 11:11:57 -0500 Subject: [PATCH 07/15] Memory Optimization: allocate constant buffers only when push constants not enabled (cherry picked from commit ea6d69878697e072e20802cabf2c5cc914d20528) --- neo/renderer/RenderProgs.cpp | 30 +++++++++++++++++------------- neo/renderer/RenderProgs.h | 1 + 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/neo/renderer/RenderProgs.cpp b/neo/renderer/RenderProgs.cpp index 04a53cc7b5..edd13b07c4 100644 --- a/neo/renderer/RenderProgs.cpp +++ b/neo/renderer/RenderProgs.cpp @@ -638,23 +638,27 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) bindingLayouts[BINDING_LAYOUT_EXPOSURE] = { device->createBindingLayout( exposureLayout ) }; // SRS - allocate static/volatile constant buffers after renderparm buffer sizes are defined for each binding layout type + // - allocate constant buffers only when needed, i.e. when push constants are not enabled for binding layout type for( int i = 0; i < NUM_BINDING_LAYOUTS; i++ ) { - nvrhi::BufferDesc constantBufferDesc; - - // SRS - allocate static constant buffer for specific binding layouts, otherwise volatile - if( layoutTypeAttributes[i].cbStatic ) - { - constantBufferDesc = nvrhi::utils::CreateStaticConstantBufferDesc( layoutTypeAttributes[i].rpBufSize, va( "RenderParams_%d", i ) ); - constantBufferDesc.initialState = nvrhi::ResourceStates::ConstantBuffer; - constantBufferDesc.keepInitialState = true; - } - else + if( !renderProgManager.layoutTypeAttributes[i].pcEnabled ) { - constantBufferDesc = nvrhi::utils::CreateVolatileConstantBufferDesc( layoutTypeAttributes[i].rpBufSize, va( "RenderParams_%d", i ), 8192 ); - } + nvrhi::BufferDesc constantBufferDesc; - constantBuffer[i] = device->createBuffer( constantBufferDesc ); + // SRS - allocate static constant buffer for specific binding layouts, otherwise volatile + if( layoutTypeAttributes[i].cbStatic ) + { + constantBufferDesc = nvrhi::utils::CreateStaticConstantBufferDesc( layoutTypeAttributes[i].rpBufSize, va( "RenderParams_%d", i ) ); + constantBufferDesc.initialState = nvrhi::ResourceStates::ConstantBuffer; + constantBufferDesc.keepInitialState = true; + } + else + { + constantBufferDesc = nvrhi::utils::CreateVolatileConstantBufferDesc( layoutTypeAttributes[i].rpBufSize, va( "RenderParams_%d", i ), 8192 ); + } + + constantBuffer[i] = device->createBuffer( constantBufferDesc ); + } } // SRS - added support for runtime configuration of push constants diff --git a/neo/renderer/RenderProgs.h b/neo/renderer/RenderProgs.h index e8ced381dd..47a303ddfb 100644 --- a/neo/renderer/RenderProgs.h +++ b/neo/renderer/RenderProgs.h @@ -227,6 +227,7 @@ enum renderParmSubSet_t // - rpNominalSets **must** be <= sizeof( rpNominalSet ) -> currently 16 entries or 256 bytes // - rpMaximalSets **must** be <= sizeof( rpMaximalSet ) -> currently 64 entries or 1024 bytes // - The order/contents of all subsets must match the renderParmSet*.inc.hlsl include files +// - Each and every Binding Layout type must be a member of one and only one renderparm subset const idList rpMinimalSet0 = { RENDERPARM_LOCALVIEWORIGIN, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_COLOR, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W }; From ff2aa9f7a5bc67cb171246f915e20822feb26bc9 Mon Sep 17 00:00:00 2001 From: Stephen Saunders Date: Wed, 20 Dec 2023 13:49:26 -0500 Subject: [PATCH 08/15] Fix ImmediateMode so debug tools work properly with push constants (cherry picked from commit ee3b6f9b2f0754cf0bcaf47a2d124f2c337defe1) --- neo/renderer/ImmediateMode.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/neo/renderer/ImmediateMode.cpp b/neo/renderer/ImmediateMode.cpp index aa0d8cc828..d623a365f9 100644 --- a/neo/renderer/ImmediateMode.cpp +++ b/neo/renderer/ImmediateMode.cpp @@ -138,7 +138,7 @@ void fhImmediateMode::End() vertexBuffer.Update( drawVerts, drawVertsUsed * sizeof( idDrawVert ), 0, false, commandList ); indexBuffer.Update( lineIndices, drawVertsUsed * sizeof( triIndex_t ), 0, false, commandList ); - renderProgManager.CommitConstantBuffer( commandList, true ); + renderProgManager.CommitConstantBuffer( commandList, false ); int bindingLayoutType = renderProgManager.BindingLayoutType(); @@ -147,7 +147,7 @@ void fhImmediateMode::End() for( int i = 0; i < layouts->Num(); i++ ) { - if( !tr.backend.currentBindingSets[i] || *tr.backend.currentBindingSets[i]->getDesc() != tr.backend.pendingBindingSetDescs[bindingLayoutType][i] ) + if( !tr.backend.currentBindingSets[i] || *tr.backend.currentBindingSets[i]->getDesc() != tr.backend.pendingBindingSetDescs[bindingLayoutType][i] || bindingLayoutType != tr.backend.prevBindingLayoutType ) { tr.backend.currentBindingSets[i] = tr.backend.bindingCache.GetOrCreateBindingSet( tr.backend.pendingBindingSetDescs[bindingLayoutType][i], ( *layouts )[i] ); } @@ -182,6 +182,8 @@ void fhImmediateMode::End() state.viewport.addScissorRect( nvrhi::Rect( viewport ) ); commandList->setGraphicsState( state ); + + renderProgManager.CommitPushConstants( commandList, bindingLayoutType ); } nvrhi::DrawArguments args; From df6c995648ab218ccfa2b7447c183be926be01e7 Mon Sep 17 00:00:00 2001 From: Stephen Saunders Date: Thu, 25 Jan 2024 00:58:03 -0500 Subject: [PATCH 09/15] Move Vulkan maxPushConstantSize to CreateDeviceAndSwapChain() to match DX12 and avoid merge conflict --- neo/sys/DeviceManager_VK.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/neo/sys/DeviceManager_VK.cpp b/neo/sys/DeviceManager_VK.cpp index f2529bdd04..9b8b4f1c48 100644 --- a/neo/sys/DeviceManager_VK.cpp +++ b/neo/sys/DeviceManager_VK.cpp @@ -925,14 +925,6 @@ bool DeviceManager_VK::createDevice() enablePModeImmediate = find( surfacePModes.begin(), surfacePModes.end(), vk::PresentModeKHR::eImmediate ) != surfacePModes.end(); enablePModeFifoRelaxed = find( surfacePModes.begin(), surfacePModes.end(), vk::PresentModeKHR::eFifoRelaxed ) != surfacePModes.end(); - // SRS - Determine maxPushConstantSize for Vulkan device - if( r_useVulkanPushConstants.GetBool() ) - { - vk::PhysicalDeviceProperties deviceProperties; - m_VulkanPhysicalDevice.getProperties( &deviceProperties ); - m_DeviceParams.maxPushConstantSize = Min( deviceProperties.limits.maxPushConstantsSize, nvrhi::c_MaxPushConstantSize ); - } - // stash the renderer string auto prop = m_VulkanPhysicalDevice.getProperties(); m_RendererString = std::string( prop.deviceName.data() ); @@ -1227,6 +1219,13 @@ bool DeviceManager_VK::CreateDeviceAndSwapChain() m_ValidationLayer = nvrhi::validation::createValidationLayer( m_NvrhiDevice ); } + // SRS - Determine maxPushConstantSize for Vulkan device + if( r_useVulkanPushConstants.GetBool() ) + { + auto deviceProperties = m_VulkanPhysicalDevice.getProperties(); + m_DeviceParams.maxPushConstantSize = Min( deviceProperties.limits.maxPushConstantsSize, nvrhi::c_MaxPushConstantSize ); + } + CHECK( createSwapChain() ); m_BarrierCommandList = m_NvrhiDevice->createCommandList(); From 233c797ea845d72de13e1e91097f9541c4bd263b Mon Sep 17 00:00:00 2001 From: SRSaunders <82544213+SRSaunders@users.noreply.github.com> Date: Tue, 2 Apr 2024 23:15:48 -0400 Subject: [PATCH 10/15] Set ShaderMake retryCount=20 to handle macOS/linux shell failures during parallel SPIRV compilation --- neo/compileshaders.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/neo/compileshaders.cmake b/neo/compileshaders.cmake index c2d10d6979..3779f38027 100644 --- a/neo/compileshaders.cmake +++ b/neo/compileshaders.cmake @@ -120,6 +120,7 @@ function(compile_shaders) --platform=SPIRV --binaryBlob --outputExt=.bin + --retryCount=20 # SRS - allow 20 retries to recover from any macOS/linux command shell failures during multi-threaded compilation -I ${SHADER_INCLUDE_DIR} -D SPIRV ${CFLAGS} From fadc9a6ebfeee3cdc39caca21c39fa74094edd13 Mon Sep 17 00:00:00 2001 From: SRSaunders <82544213+SRSaunders@users.noreply.github.com> Date: Mon, 19 Aug 2024 17:01:11 -0400 Subject: [PATCH 11/15] Refactor renderparm subsets and layout types for compatibility with PSX vertex jitter --- neo/renderer/NVRHI/RenderBackend_NVRHI.cpp | 4 +- neo/renderer/NVRHI/RenderProgs_NVRHI.cpp | 18 +++++ neo/renderer/RenderCommon.h | 9 +-- neo/renderer/RenderProgs.cpp | 51 ++++++++++---- neo/renderer/RenderProgs.h | 53 +++++++++----- neo/shaders/CMakeLists.txt | 2 +- .../builtin/SSAO/AmbientOcclusion_AO.ps.hlsl | 2 +- .../builtin/SSAO/AmbientOcclusion_AO.vs.hlsl | 2 +- .../SSAO/AmbientOcclusion_blur.ps.hlsl | 2 +- .../SSAO/AmbientOcclusion_blur.vs.hlsl | 2 +- neo/shaders/builtin/color.vs.hlsl | 2 +- .../builtin/debug/debug_shadowmap.ps.hlsl | 2 +- .../builtin/debug/debug_shadowmap.vs.hlsl | 2 +- neo/shaders/builtin/depth.vs.hlsl | 2 +- neo/shaders/builtin/fog/blendLight.vs.hlsl | 2 +- neo/shaders/builtin/fog/fog.vs.hlsl | 2 +- neo/shaders/builtin/gbuffer.vs.hlsl | 2 +- .../builtin/legacy/bumpyenvironment.vs.hlsl | 2 +- .../builtin/legacy/environment.vs.hlsl | 2 +- neo/shaders/builtin/legacy/skybox.ps.hlsl | 2 +- neo/shaders/builtin/legacy/skybox.vs.hlsl | 4 +- neo/shaders/builtin/legacy/wobblesky.vs.hlsl | 2 +- .../lighting/ambient_lightgrid_IBL.vs.hlsl | 2 +- .../lighting/ambient_lighting_IBL.vs.hlsl | 2 +- .../builtin/lighting/interaction.vs.hlsl | 2 +- .../lighting/interactionAmbient.vs.hlsl | 2 +- .../builtin/lighting/interactionSM.vs.hlsl | 2 +- neo/shaders/builtin/post/crt_advanced.ps.hlsl | 1 + neo/shaders/builtin/post/crt_advanced.vs.hlsl | 3 +- neo/shaders/builtin/post/crt_aperture.ps.hlsl | 1 + neo/shaders/builtin/post/crt_aperture.vs.hlsl | 3 +- neo/shaders/builtin/post/crt_easymode.ps.hlsl | 1 + neo/shaders/builtin/post/crt_easymode.vs.hlsl | 3 +- neo/shaders/builtin/post/retro_2bit.ps.hlsl | 1 + neo/shaders/builtin/post/retro_2bit.vs.hlsl | 3 +- neo/shaders/builtin/post/retro_cpc.ps.hlsl | 2 +- neo/shaders/builtin/post/retro_cpc.vs.hlsl | 4 +- neo/shaders/builtin/post/retro_nes.ps.hlsl | 1 + neo/shaders/builtin/post/retro_nes.vs.hlsl | 3 +- neo/shaders/builtin/texture.vs.hlsl | 2 +- neo/shaders/builtin/texture_color.vs.hlsl | 2 +- .../builtin/texture_color_texgen.ps.hlsl | 2 +- .../builtin/texture_color_texgen.vs.hlsl | 4 +- neo/shaders/builtin/vertex_color.vs.hlsl | 2 +- neo/shaders/builtin/video/bink.vs.hlsl | 2 +- neo/shaders/global_inc.hlsl | 8 +-- neo/shaders/renderParmSet0.inc.hlsl | 7 +- neo/shaders/renderParmSet1.inc.hlsl | 2 +- neo/shaders/renderParmSet10.inc.hlsl | 12 ++-- neo/shaders/renderParmSet11.inc.hlsl | 17 +++-- neo/shaders/renderParmSet12.inc.hlsl | 70 +++++++++++++++++++ neo/shaders/renderParmSet13.inc.hlsl | 63 +++++++++++++++++ neo/shaders/renderParmSet2.inc.hlsl | 6 +- neo/shaders/renderParmSet3.inc.hlsl | 15 +++- neo/shaders/renderParmSet4.inc.hlsl | 7 +- neo/shaders/renderParmSet5.inc.hlsl | 6 +- neo/shaders/renderParmSet7.inc.hlsl | 4 ++ neo/shaders/renderParmSet9.inc.hlsl | 13 ++-- 58 files changed, 340 insertions(+), 111 deletions(-) create mode 100644 neo/shaders/renderParmSet12.inc.hlsl create mode 100644 neo/shaders/renderParmSet13.inc.hlsl diff --git a/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp b/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp index f653a3e256..9537de260d 100644 --- a/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp +++ b/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp @@ -583,7 +583,7 @@ void idRenderBackend::GetCurrentBindingLayout( int type ) uniformsBindingSetItem = nvrhi::BindingSetItem::PushConstants( 0, renderProgManager.layoutTypeAttributes[type].rpBufSize ); } - if( type == BINDING_LAYOUT_DEFAULT || type == BINDING_LAYOUT_GBUFFER || type == BINDING_LAYOUT_TEXTURE || type == BINDING_LAYOUT_WOBBLESKY || type == BINDING_LAYOUT_SSGI || type == BINDING_LAYOUT_POST_PROCESS ) + if( type == BINDING_LAYOUT_DEFAULT || type == BINDING_LAYOUT_GBUFFER || type == BINDING_LAYOUT_TEXTURE || type == BINDING_LAYOUT_TEXGEN || type == BINDING_LAYOUT_LEGACY || type == BINDING_LAYOUT_DEBUG || type == BINDING_LAYOUT_POST_PROCESS ) { if( desc[0].bindings.empty() ) { @@ -621,7 +621,7 @@ void idRenderBackend::GetCurrentBindingLayout( int type ) desc[2].bindings[0].resourceHandle = ( nvrhi::ISampler* )GetImageAt( 0 )->GetSampler( samplerCache ); } } - else if( type == BINDING_LAYOUT_DEFAULT_SKINNED || type == BINDING_LAYOUT_GBUFFER_SKINNED || type == BINDING_LAYOUT_TEXTURE_SKINNED || type == BINDING_LAYOUT_SSGI_SKINNED ) + else if( type == BINDING_LAYOUT_DEFAULT_SKINNED || type == BINDING_LAYOUT_GBUFFER_SKINNED || type == BINDING_LAYOUT_TEXTURE_SKINNED || type == BINDING_LAYOUT_DEBUG_SKINNED ) { if( desc[0].bindings.empty() ) { diff --git a/neo/renderer/NVRHI/RenderProgs_NVRHI.cpp b/neo/renderer/NVRHI/RenderProgs_NVRHI.cpp index 0386351ee0..0bce7cb88c 100644 --- a/neo/renderer/NVRHI/RenderProgs_NVRHI.cpp +++ b/neo/renderer/NVRHI/RenderProgs_NVRHI.cpp @@ -488,6 +488,24 @@ void idRenderProgManager::SelectUniforms( renderParmSet_t* renderParmSet, int bi break; } + case renderParmSet12: + { + for( int i = 0; i < rpNominalSet12.Num(); i++ ) + { + memcpy( &renderParmSet->nominalSet[i], &uniforms[rpNominalSet12[i]], sizeof( idVec4 ) ); + } + break; + } + + case renderParmSet13: + { + for( int i = 0; i < rpNominalSet13.Num(); i++ ) + { + memcpy( &renderParmSet->nominalSet[i], &uniforms[rpNominalSet13[i]], sizeof( idVec4 ) ); + } + break; + } + case renderParmNullSet: default: { diff --git a/neo/renderer/RenderCommon.h b/neo/renderer/RenderCommon.h index 3b40b7b734..f5f65b8d8b 100644 --- a/neo/renderer/RenderCommon.h +++ b/neo/renderer/RenderCommon.h @@ -806,11 +806,12 @@ enum bindingLayoutType_t BINDING_LAYOUT_TEXTURE, BINDING_LAYOUT_TEXTURE_SKINNED, + BINDING_LAYOUT_TEXGEN, - BINDING_LAYOUT_WOBBLESKY, + BINDING_LAYOUT_LEGACY, - BINDING_LAYOUT_SSGI, - BINDING_LAYOUT_SSGI_SKINNED, + BINDING_LAYOUT_DEBUG, + BINDING_LAYOUT_DEBUG_SKINNED, BINDING_LAYOUT_POST_PROCESS, // SRS end @@ -1721,7 +1722,7 @@ TR_BACKEND_DRAW typedef idVec4 rpMinimalSet[8]; // 128 bytes for minimal Vulkan push / DX12 root constant sizes typedef idVec4 rpNominalSet[16]; // 256 bytes for nominal Vulkan push / DX12 root constant sizes -typedef idVec4 rpMaximalSet[64]; // 1024 bytes for larger sizes (e.g. 4096 limit on macOS MoltenVK) +typedef idVec4 rpMaximalSet[72]; // 1152 bytes for larger sizes (e.g. 4096 limit on macOS MoltenVK) struct renderParmSet_t { diff --git a/neo/renderer/RenderProgs.cpp b/neo/renderer/RenderProgs.cpp index 142086a7bc..aba3b13046 100644 --- a/neo/renderer/RenderProgs.cpp +++ b/neo/renderer/RenderProgs.cpp @@ -204,7 +204,9 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) rpNominalSet8.Num() * sizeof( idVec4 ) > sizeof( rpNominalSet ) || rpMaximalSet9.Num() * sizeof( idVec4 ) > sizeof( rpMaximalSet ) || rpMaximalSet10.Num() * sizeof( idVec4 ) > sizeof( rpMaximalSet ) || - rpMaximalSet11.Num() * sizeof( idVec4 ) > sizeof( rpMaximalSet ) ) + rpMaximalSet11.Num() * sizeof( idVec4 ) > sizeof( rpMaximalSet ) || + rpNominalSet12.Num() * sizeof( idVec4 ) > sizeof( rpNominalSet ) || + rpNominalSet13.Num() * sizeof( idVec4 ) > sizeof( rpNominalSet ) ) { common->FatalError( "Renderparm subset sizes exceed push constant buffer sizes" ); } @@ -345,6 +347,28 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) renderParmLayoutTypes[rpMaximalSet11[i]].AddUnique( ( bindingLayoutType_t )layoutType ); } } + else if( rpNominalSet12LayoutTypes.Find( ( bindingLayoutType_t )layoutType ) ) + { + layoutTypeAttributes[layoutType].rpSubSet = renderParmSet12; + layoutTypeAttributes[layoutType].rpBufSize = rpNominalSet12.Num() * sizeof( idVec4 ); + layoutTypeAttributes[layoutType].cbStatic = false; + + for( int i = 0; i < rpNominalSet12.Num(); i++ ) + { + renderParmLayoutTypes[rpNominalSet12[i]].AddUnique( ( bindingLayoutType_t )layoutType ); + } + } + else if( rpNominalSet13LayoutTypes.Find( ( bindingLayoutType_t )layoutType ) ) + { + layoutTypeAttributes[layoutType].rpSubSet = renderParmSet13; + layoutTypeAttributes[layoutType].rpBufSize = rpNominalSet13.Num() * sizeof( idVec4 ); + layoutTypeAttributes[layoutType].cbStatic = false; + + for( int i = 0; i < rpNominalSet13.Num(); i++ ) + { + renderParmLayoutTypes[rpNominalSet13[i]].AddUnique( ( bindingLayoutType_t )layoutType ); + } + } else { layoutTypeAttributes[layoutType].rpSubSet = renderParmNullSet; @@ -374,11 +398,12 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) bindingLayouts[BINDING_LAYOUT_TEXTURE] = { uniformsLayout( BINDING_LAYOUT_TEXTURE, false ), defaultLayout, samplerOneBindingLayout }; bindingLayouts[BINDING_LAYOUT_TEXTURE_SKINNED] = { uniformsLayout( BINDING_LAYOUT_TEXTURE_SKINNED, true ), defaultLayout, samplerOneBindingLayout }; + bindingLayouts[BINDING_LAYOUT_TEXGEN] = { uniformsLayout( BINDING_LAYOUT_TEXGEN, false ), defaultLayout, samplerOneBindingLayout }; - bindingLayouts[BINDING_LAYOUT_WOBBLESKY] = { uniformsLayout( BINDING_LAYOUT_WOBBLESKY, false ), defaultLayout, samplerOneBindingLayout }; + bindingLayouts[BINDING_LAYOUT_LEGACY] = { uniformsLayout( BINDING_LAYOUT_LEGACY, false ), defaultLayout, samplerOneBindingLayout }; - bindingLayouts[BINDING_LAYOUT_SSGI] = { uniformsLayout( BINDING_LAYOUT_SSGI, false ), defaultLayout, samplerOneBindingLayout }; - bindingLayouts[BINDING_LAYOUT_SSGI_SKINNED] = { uniformsLayout( BINDING_LAYOUT_SSGI_SKINNED, true ), defaultLayout, samplerOneBindingLayout }; + bindingLayouts[BINDING_LAYOUT_DEBUG] = { uniformsLayout( BINDING_LAYOUT_DEBUG, false ), defaultLayout, samplerOneBindingLayout }; + bindingLayouts[BINDING_LAYOUT_DEBUG_SKINNED] = { uniformsLayout( BINDING_LAYOUT_DEBUG_SKINNED, true ), defaultLayout, samplerOneBindingLayout }; bindingLayouts[BINDING_LAYOUT_POST_PROCESS] = { uniformsLayout( BINDING_LAYOUT_POST_PROCESS, false ), defaultLayout, samplerOneBindingLayout }; @@ -733,7 +758,7 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) { BUILTIN_TEXTURE_VERTEXCOLOR, "builtin/texture_color", "", { { "USE_GPU_SKINNING", "0" }, {"USE_SRGB", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_TEXTURE ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_TEXTURE }, { BUILTIN_TEXTURE_VERTEXCOLOR_SRGB, "builtin/texture_color", "_sRGB", { { "USE_GPU_SKINNING", "0" }, {"USE_SRGB", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_TEXTURE ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_TEXTURE }, { BUILTIN_TEXTURE_VERTEXCOLOR_SKINNED, "builtin/texture_color", "_skinned", { { "USE_GPU_SKINNING", "1" }, {"USE_SRGB", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_TEXTURE_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_TEXTURE_SKINNED }, - { BUILTIN_TEXTURE_TEXGEN_VERTEXCOLOR, "builtin/texture_color_texgen", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_TEXTURE ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_TEXTURE }, + { BUILTIN_TEXTURE_TEXGEN_VERTEXCOLOR, "builtin/texture_color_texgen", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_TEXGEN ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_TEXGEN }, { BUILTIN_INTERACTION, "builtin/lighting/interaction", "", { { "USE_GPU_SKINNING", "0" }, { "USE_PBR", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION }, { BUILTIN_INTERACTION_SKINNED, "builtin/lighting/interaction", "_skinned", { { "USE_GPU_SKINNING", "1" }, { "USE_PBR", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SKINNED }, @@ -787,8 +812,8 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) { BUILTIN_PBR_INTERACTION_SHADOW_ATLAS_PARALLEL_SKINNED, "builtin/lighting/interactionSM", "_atlas_parallel_skinned_PBR", { { "USE_GPU_SKINNING", "1" }, { "LIGHT_POINT", "0" }, { "LIGHT_PARALLEL", "1" }, { "USE_PBR", "1" }, { "USE_NORMAL_FMT_RGB8", "0" }, { "USE_SHADOW_ATLAS", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED }, // debug stuff - { BUILTIN_DEBUG_LIGHTGRID, "builtin/debug/lightgrid", "", { { "USE_GPU_SKINNING", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_SSGI ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_SSGI }, - { BUILTIN_DEBUG_LIGHTGRID_SKINNED, "builtin/debug/lightgrid", "_skinned", { { "USE_GPU_SKINNING", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_SSGI_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_SSGI_SKINNED }, + { BUILTIN_DEBUG_LIGHTGRID, "builtin/debug/lightgrid", "", { { "USE_GPU_SKINNING", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DEBUG ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEBUG }, + { BUILTIN_DEBUG_LIGHTGRID_SKINNED, "builtin/debug/lightgrid", "_skinned", { { "USE_GPU_SKINNING", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DEBUG_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEBUG_SKINNED }, { BUILTIN_DEBUG_OCTAHEDRON, "builtin/debug/octahedron", "", { { "USE_GPU_SKINNING", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DEFAULT ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, { BUILTIN_DEBUG_OCTAHEDRON_SKINNED, "builtin/debug/octahedron", "_skinned", { { "USE_GPU_SKINNING", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DEFAULT_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT_SKINNED }, @@ -805,8 +830,8 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) { BUILTIN_BLENDLIGHT_SKINNED, "builtin/fog/blendlight", "_skinned", { { "USE_GPU_SKINNING", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_BLENDLIGHT_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_BLENDLIGHT_SKINNED }, { BUILTIN_FOG, "builtin/fog/fog", "", { { "USE_GPU_SKINNING", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_FOG ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_FOG }, { BUILTIN_FOG_SKINNED, "builtin/fog/fog", "_skinned", { { "USE_GPU_SKINNING", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_FOG_SKINNED ) } }, true, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_FOG_SKINNED }, - { BUILTIN_SKYBOX, "builtin/legacy/skybox", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DEFAULT ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, - { BUILTIN_WOBBLESKY, "builtin/legacy/wobblesky", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_WOBBLESKY ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_WOBBLESKY }, + { BUILTIN_SKYBOX, "builtin/legacy/skybox", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_LEGACY ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_LEGACY }, + { BUILTIN_WOBBLESKY, "builtin/legacy/wobblesky", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_LEGACY ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_LEGACY }, { BUILTIN_POSTPROCESS, "builtin/post/postprocess", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_POST_PROCESS_FINAL ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_POST_PROCESS_FINAL }, { BUILTIN_POSTPROCESS_RETRO_2BIT, "builtin/post/retro_2bit", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_POST_PROCESS_FINAL ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_POST_PROCESS_FINAL }, { BUILTIN_POSTPROCESS_RETRO_C64, "builtin/post/retro_c64", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_POST_PROCESS_FINAL ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_POST_PROCESS_FINAL }, @@ -839,9 +864,9 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) { BUILTIN_AMBIENT_OCCLUSION_AND_OUTPUT, "builtin/SSAO/AmbientOcclusion_AO", "_write", { { "BRIGHTPASS", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_AO ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_AO }, { BUILTIN_AMBIENT_OCCLUSION_BLUR, "builtin/SSAO/AmbientOcclusion_blur", "", { { "BRIGHTPASS", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_AO ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_AO }, { BUILTIN_AMBIENT_OCCLUSION_BLUR_AND_OUTPUT, "builtin/SSAO/AmbientOcclusion_blur", "_write", { { "BRIGHTPASS", "1" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DRAW_AO ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DRAW_AO }, - { BUILTIN_DEEP_GBUFFER_RADIOSITY_SSGI, "builtin/SSGI/DeepGBufferRadiosity_radiosity", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_SSGI ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_SSGI }, - { BUILTIN_DEEP_GBUFFER_RADIOSITY_BLUR, "builtin/SSGI/DeepGBufferRadiosity_blur", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_SSGI ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_SSGI }, - { BUILTIN_DEEP_GBUFFER_RADIOSITY_BLUR_AND_OUTPUT, "builtin/SSGI/DeepGBufferRadiosity_blur", "_write", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_SSGI ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_SSGI }, + { BUILTIN_DEEP_GBUFFER_RADIOSITY_SSGI, "builtin/SSGI/DeepGBufferRadiosity_radiosity", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DEBUG ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEBUG }, + { BUILTIN_DEEP_GBUFFER_RADIOSITY_BLUR, "builtin/SSGI/DeepGBufferRadiosity_blur", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DEBUG ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEBUG }, + { BUILTIN_DEEP_GBUFFER_RADIOSITY_BLUR_AND_OUTPUT, "builtin/SSGI/DeepGBufferRadiosity_blur", "_write", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DEBUG ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEBUG }, { BUILTIN_STEREO_DEGHOST, "builtin/VR/stereoDeGhost", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DEFAULT ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, { BUILTIN_STEREO_WARP, "builtin/VR/stereoWarp", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_DEFAULT ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT }, @@ -853,7 +878,7 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) // SRS - disabled VECTORS_ONLY now that BUILTIN_TAA_MOTION_VECTORS is properly defined { BUILTIN_MOTION_BLUR, "builtin/post/motionBlur", "", { { "VECTORS_ONLY", "0" }, { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_TAA_MOTION_VECTORS ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_TAA_MOTION_VECTORS }, - { BUILTIN_DEBUG_SHADOWMAP, "builtin/debug/debug_shadowmap", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_TEXTURE ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_TEXTURE }, + { BUILTIN_DEBUG_SHADOWMAP, "builtin/debug/debug_shadowmap", "", { { "USE_PUSH_CONSTANTS", usePushConstants( BINDING_LAYOUT_TEXGEN ) } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_TEXGEN }, // SP begin { BUILTIN_BLIT, "builtin/blit", "", { { "TEXTURE_ARRAY", "0" } }, false, SHADER_STAGE_FRAGMENT, LAYOUT_UNKNOWN, BINDING_LAYOUT_BLIT }, diff --git a/neo/renderer/RenderProgs.h b/neo/renderer/RenderProgs.h index 6a1832eb52..b3be6dab35 100644 --- a/neo/renderer/RenderProgs.h +++ b/neo/renderer/RenderProgs.h @@ -222,17 +222,19 @@ enum renderParmSubSet_t renderParmSet9, renderParmSet10, renderParmSet11, + renderParmSet12, + renderParmSet13, renderParmNullSet }; // SRS - For push constants, define the renderparm subsets and the binding layouts they apply to // - rpMinimalSets **must** be <= sizeof( rpMinimalSet ) -> currently 8 entries or 128 bytes // - rpNominalSets **must** be <= sizeof( rpNominalSet ) -> currently 16 entries or 256 bytes -// - rpMaximalSets **must** be <= sizeof( rpMaximalSet ) -> currently 64 entries or 1024 bytes +// - rpMaximalSets **must** be <= sizeof( rpMaximalSet ) -> currently 72 entries or 1152 bytes // - The order/contents of all subsets must match the renderParmSet*.inc.hlsl include files // - Each and every Binding Layout type must be a member of one and only one renderparm subset -const idList rpMinimalSet0 = { RENDERPARM_LOCALVIEWORIGIN, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_COLOR, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W }; +const idList rpMinimalSet0 = { RENDERPARM_LOCALVIEWORIGIN, RENDERPARM_COLOR, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_PROJMATRIX_W, RENDERPARM_PSX_DISTORTIONS }; const idList rpMinimalSet0LayoutTypes = { BINDING_LAYOUT_DEFAULT, BINDING_LAYOUT_DEFAULT_SKINNED, BINDING_LAYOUT_CONSTANT_BUFFER_ONLY, BINDING_LAYOUT_CONSTANT_BUFFER_ONLY_SKINNED, BINDING_LAYOUT_BINK_VIDEO }; @@ -240,52 +242,65 @@ const idList rpMinimalSet1 = { RENDERPARM_SCREENCORREC const idList rpMinimalSet1LayoutTypes = { BINDING_LAYOUT_POST_PROCESS, BINDING_LAYOUT_TAA_MOTION_VECTORS }; -const idList rpMinimalSet2 = { RENDERPARM_SCREENCORRECTIONFACTOR, RENDERPARM_WINDOWCOORD, RENDERPARM_MODELMATRIX_X, RENDERPARM_MODELMATRIX_Y, RENDERPARM_MODELMATRIX_Z, RENDERPARM_MODELMATRIX_W, RENDERPARM_JITTERTEXSCALE, RENDERPARM_JITTERTEXOFFSET }; +const idList rpMinimalSet2 = { RENDERPARM_SCREENCORRECTIONFACTOR, RENDERPARM_WINDOWCOORD, RENDERPARM_DIFFUSEMODIFIER, RENDERPARM_JITTERTEXSCALE, RENDERPARM_JITTERTEXOFFSET }; -const idList rpMinimalSet2LayoutTypes = { BINDING_LAYOUT_POST_PROCESS_FINAL, BINDING_LAYOUT_DRAW_AO, BINDING_LAYOUT_DRAW_AO1 }; +const idList rpMinimalSet2LayoutTypes = { BINDING_LAYOUT_POST_PROCESS_FINAL, BINDING_LAYOUT_POST_PROCESS_CRT }; -// SRS - Limit rpNominalSets to maximum of 15 idVec4 entries (15*16 = 240 bytes) to fit within D3D12 root constant limit -const idList rpNominalSet3 = { RENDERPARM_BUMPMATRIX_S, RENDERPARM_BUMPMATRIX_T, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_MODELVIEWMATRIX_X, RENDERPARM_MODELVIEWMATRIX_Y, RENDERPARM_MODELVIEWMATRIX_Z }; +// SRS - Try to limit rpNominalSets to 15 idVec4 entries (15*16 = 240 bytes) to fit within D3D12 root constant limit, otherwise 16 entries is the max for non-Apple Vulkan +const idList rpNominalSet3 = { RENDERPARM_LOCALVIEWORIGIN, RENDERPARM_BUMPMATRIX_S, RENDERPARM_BUMPMATRIX_T, RENDERPARM_SPECULARMATRIX_S, RENDERPARM_SPECULARMATRIX_T, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_MODELMATRIX_X, RENDERPARM_MODELMATRIX_Y, RENDERPARM_MODELMATRIX_Z, RENDERPARM_PROJMATRIX_W, RENDERPARM_PSX_DISTORTIONS }; const idList rpNominalSet3LayoutTypes = { BINDING_LAYOUT_GBUFFER, BINDING_LAYOUT_GBUFFER_SKINNED }; -// SRS - Limit rpNominalSets to maximum of 15 idVec4 entries (15*16 = 240 bytes) to fit within D3D12 root constant limit -const idList rpNominalSet4 = { RENDERPARM_SCREENCORRECTIONFACTOR, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_COLOR, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_TEXTUREMATRIX_S, RENDERPARM_TEXTUREMATRIX_T, RENDERPARM_TEXGEN_0_S, RENDERPARM_TEXGEN_0_T, RENDERPARM_TEXGEN_0_Q, RENDERPARM_TEXGEN_0_ENABLED, RENDERPARM_ALPHA_TEST }; +// SRS - Try to limit rpNominalSets to 15 idVec4 entries (15*16 = 240 bytes) to fit within D3D12 root constant limit, otherwise 16 entries is the max for non-Apple Vulkan +const idList rpNominalSet4 = { RENDERPARM_LOCALVIEWORIGIN, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_COLOR, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_PROJMATRIX_W, RENDERPARM_TEXTUREMATRIX_S, RENDERPARM_TEXTUREMATRIX_T, RENDERPARM_TEXGEN_0_S, RENDERPARM_TEXGEN_0_T, RENDERPARM_TEXGEN_0_ENABLED, RENDERPARM_ALPHA_TEST, RENDERPARM_PSX_DISTORTIONS }; const idList rpNominalSet4LayoutTypes = { BINDING_LAYOUT_TEXTURE, BINDING_LAYOUT_TEXTURE_SKINNED }; -// SRS - Limit rpNominalSets to maximum of 15 idVec4 entries (15*16 = 240 bytes) to fit within D3D12 root constant limit -const idList rpNominalSet5 = { RENDERPARM_LOCALVIEWORIGIN, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_COLOR, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_MODELMATRIX_X, RENDERPARM_MODELMATRIX_Y, RENDERPARM_MODELMATRIX_Z, RENDERPARM_WOBBLESKY_X, RENDERPARM_WOBBLESKY_Y, RENDERPARM_WOBBLESKY_Z }; +// SRS - Try to limit rpNominalSets to 15 idVec4 entries (15*16 = 240 bytes) to fit within D3D12 root constant limit, otherwise 16 entries is the max for non-Apple Vulkan +const idList rpNominalSet5 = { RENDERPARM_LOCALVIEWORIGIN, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_COLOR, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_MODELMATRIX_X, RENDERPARM_MODELMATRIX_Y, RENDERPARM_MODELMATRIX_Z, RENDERPARM_PROJMATRIX_W, RENDERPARM_WOBBLESKY_X, RENDERPARM_WOBBLESKY_Y, RENDERPARM_WOBBLESKY_Z, RENDERPARM_PSX_DISTORTIONS }; -const idList rpNominalSet5LayoutTypes = { BINDING_LAYOUT_WOBBLESKY, BINDING_LAYOUT_NORMAL_CUBE, BINDING_LAYOUT_NORMAL_CUBE_SKINNED }; +const idList rpNominalSet5LayoutTypes = { BINDING_LAYOUT_LEGACY, BINDING_LAYOUT_NORMAL_CUBE, BINDING_LAYOUT_NORMAL_CUBE_SKINNED }; -// SRS - Limit rpNominalSets to maximum of 15 idVec4 entries (15*16 = 240 bytes) to fit within D3D12 root constant limit +// SRS - Try to limit rpNominalSets to 15 idVec4 entries (15*16 = 240 bytes) to fit within D3D12 root constant limit, otherwise 16 entries is the max for non-Apple Vulkan const idList rpNominalSet6 = { RENDERPARM_SCREENCORRECTIONFACTOR, RENDERPARM_COLOR, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_MODELMATRIX_X, RENDERPARM_MODELMATRIX_Y, RENDERPARM_MODELMATRIX_Z, RENDERPARM_MODELMATRIX_W, RENDERPARM_GLOBALLIGHTORIGIN, RENDERPARM_JITTERTEXSCALE, RENDERPARM_JITTERTEXOFFSET, RENDERPARM_CASCADEDISTANCES }; -const idList rpNominalSet6LayoutTypes = { BINDING_LAYOUT_SSGI, BINDING_LAYOUT_SSGI_SKINNED }; +const idList rpNominalSet6LayoutTypes = { BINDING_LAYOUT_DEBUG, BINDING_LAYOUT_DEBUG_SKINNED }; -// SRS - Limit rpNominalSets to maximum of 15 idVec4 entries (15*16 = 240 bytes) to fit within D3D12 root constant limit -const idList rpNominalSet7 = { RENDERPARM_COLOR, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_TEXGEN_0_S, RENDERPARM_TEXGEN_0_T, RENDERPARM_TEXGEN_0_Q, RENDERPARM_TEXGEN_1_S, RENDERPARM_TEXGEN_1_T }; +// SRS - Try to limit rpNominalSets to 15 idVec4 entries (15*16 = 240 bytes) to fit within D3D12 root constant limit, otherwise 16 entries is the max for non-Apple Vulkan +const idList rpNominalSet7 = { RENDERPARM_COLOR, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_PROJMATRIX_W, RENDERPARM_TEXGEN_0_S, RENDERPARM_TEXGEN_0_T, RENDERPARM_TEXGEN_0_Q, RENDERPARM_TEXGEN_1_S, RENDERPARM_TEXGEN_1_T, RENDERPARM_PSX_DISTORTIONS }; const idList rpNominalSet7LayoutTypes = { BINDING_LAYOUT_FOG, BINDING_LAYOUT_FOG_SKINNED, BINDING_LAYOUT_BLENDLIGHT, BINDING_LAYOUT_BLENDLIGHT_SKINNED }; -// SRS - Limit rpNominalSets to maximum of 15 idVec4 entries (15*16 = 240 bytes) to fit within D3D12 root constant limit +// SRS - Try to limit rpNominalSets to 15 idVec4 entries (15*16 = 240 bytes) to fit within D3D12 root constant limit, otherwise 16 entries is the max for non-Apple Vulkan const idList rpNominalSet8 = { RENDERPARM_WINDOWCOORD, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_PROJMATRIX_Y, RENDERPARM_PROJMATRIX_W, RENDERPARM_MODELVIEWMATRIX_Z, RENDERPARM_ENABLE_SKINNING, RENDERPARM_ALPHA_TEST, RENDERPARM_USER0, RENDERPARM_USER1, RENDERPARM_USER2 }; const idList rpNominalSet8LayoutTypes = { BINDING_LAYOUT_POST_PROCESS_INGAME }; -const idList rpMaximalSet9 = { RENDERPARM_SCREENCORRECTIONFACTOR, RENDERPARM_WINDOWCOORD, RENDERPARM_DIFFUSEMODIFIER, RENDERPARM_SPECULARMODIFIER, RENDERPARM_LOCALLIGHTORIGIN, RENDERPARM_LOCALVIEWORIGIN, RENDERPARM_BUMPMATRIX_S, RENDERPARM_BUMPMATRIX_T, RENDERPARM_DIFFUSEMATRIX_S, RENDERPARM_DIFFUSEMATRIX_T, RENDERPARM_SPECULARMATRIX_S, RENDERPARM_SPECULARMATRIX_T, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_GLOBALEYEPOS, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_MODELMATRIX_X, RENDERPARM_MODELMATRIX_Y, RENDERPARM_MODELMATRIX_Z, RENDERPARM_MODELMATRIX_W, RENDERPARM_AMBIENT_COLOR, RENDERPARM_GLOBALLIGHTORIGIN, RENDERPARM_JITTERTEXSCALE, RENDERPARM_JITTERTEXOFFSET, RENDERPARM_CASCADEDISTANCES }; +// SRS - rpMaximalSets have more than 16 idVec4 entries (>16*16 = 256 bytes) and are useful for MoltenVK on Apple platforms where the push constant limit is 4096 bytes +const idList rpMaximalSet9 = { RENDERPARM_SCREENCORRECTIONFACTOR, RENDERPARM_WINDOWCOORD, RENDERPARM_DIFFUSEMODIFIER, RENDERPARM_SPECULARMODIFIER, RENDERPARM_LOCALLIGHTORIGIN, RENDERPARM_LOCALVIEWORIGIN, RENDERPARM_BUMPMATRIX_S, RENDERPARM_BUMPMATRIX_T, RENDERPARM_DIFFUSEMATRIX_S, RENDERPARM_DIFFUSEMATRIX_T, RENDERPARM_SPECULARMATRIX_S, RENDERPARM_SPECULARMATRIX_T, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_GLOBALEYEPOS, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_MODELMATRIX_X, RENDERPARM_MODELMATRIX_Y, RENDERPARM_MODELMATRIX_Z, RENDERPARM_MODELMATRIX_W, RENDERPARM_PROJMATRIX_W, RENDERPARM_AMBIENT_COLOR, RENDERPARM_GLOBALLIGHTORIGIN, RENDERPARM_JITTERTEXSCALE, RENDERPARM_JITTERTEXOFFSET, RENDERPARM_PSX_DISTORTIONS, RENDERPARM_CASCADEDISTANCES }; const idList rpMaximalSet9LayoutTypes = { BINDING_LAYOUT_AMBIENT_LIGHTING_IBL, BINDING_LAYOUT_AMBIENT_LIGHTING_IBL_SKINNED }; -const idList rpMaximalSet10 = { RENDERPARM_DIFFUSEMODIFIER, RENDERPARM_SPECULARMODIFIER, RENDERPARM_LOCALLIGHTORIGIN, RENDERPARM_LOCALVIEWORIGIN, RENDERPARM_LIGHTPROJECTION_S, RENDERPARM_LIGHTPROJECTION_T, RENDERPARM_LIGHTPROJECTION_Q, RENDERPARM_LIGHTFALLOFF_S, RENDERPARM_BUMPMATRIX_S, RENDERPARM_BUMPMATRIX_T, RENDERPARM_DIFFUSEMATRIX_S, RENDERPARM_DIFFUSEMATRIX_T, RENDERPARM_SPECULARMATRIX_S, RENDERPARM_SPECULARMATRIX_T, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W }; +// SRS - rpMaximalSets have more than 16 idVec4 entries (>16*16 = 256 bytes) and are useful for MoltenVK on Apple platforms where the push constant limit is 4096 bytes +const idList rpMaximalSet10 = { RENDERPARM_DIFFUSEMODIFIER, RENDERPARM_SPECULARMODIFIER, RENDERPARM_LOCALLIGHTORIGIN, RENDERPARM_LOCALVIEWORIGIN, RENDERPARM_LIGHTPROJECTION_S, RENDERPARM_LIGHTPROJECTION_T, RENDERPARM_LIGHTPROJECTION_Q, RENDERPARM_LIGHTFALLOFF_S, RENDERPARM_BUMPMATRIX_S, RENDERPARM_BUMPMATRIX_T, RENDERPARM_DIFFUSEMATRIX_S, RENDERPARM_DIFFUSEMATRIX_T, RENDERPARM_SPECULARMATRIX_S, RENDERPARM_SPECULARMATRIX_T, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_PROJMATRIX_W, RENDERPARM_PSX_DISTORTIONS }; const idList rpMaximalSet10LayoutTypes = { BINDING_LAYOUT_DRAW_INTERACTION, BINDING_LAYOUT_DRAW_INTERACTION_SKINNED }; -const idList rpMaximalSet11 = { RENDERPARM_SCREENCORRECTIONFACTOR, RENDERPARM_DIFFUSEMODIFIER, RENDERPARM_SPECULARMODIFIER, RENDERPARM_LOCALLIGHTORIGIN, RENDERPARM_LOCALVIEWORIGIN, RENDERPARM_LIGHTPROJECTION_S, RENDERPARM_LIGHTPROJECTION_T, RENDERPARM_LIGHTPROJECTION_Q, RENDERPARM_LIGHTFALLOFF_S, RENDERPARM_BUMPMATRIX_S, RENDERPARM_BUMPMATRIX_T, RENDERPARM_DIFFUSEMATRIX_S, RENDERPARM_DIFFUSEMATRIX_T, RENDERPARM_SPECULARMATRIX_S, RENDERPARM_SPECULARMATRIX_T, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_MODELMATRIX_X, RENDERPARM_MODELMATRIX_Y, RENDERPARM_MODELMATRIX_Z, RENDERPARM_MODELMATRIX_W, RENDERPARM_MODELVIEWMATRIX_X, RENDERPARM_MODELVIEWMATRIX_Y, RENDERPARM_MODELVIEWMATRIX_Z, RENDERPARM_MODELVIEWMATRIX_W, RENDERPARM_GLOBALLIGHTORIGIN, RENDERPARM_JITTERTEXSCALE, RENDERPARM_JITTERTEXOFFSET, RENDERPARM_CASCADEDISTANCES, RENDERPARM_SHADOW_MATRIX_0_X, RENDERPARM_SHADOW_MATRIX_0_Y, RENDERPARM_SHADOW_MATRIX_0_Z, RENDERPARM_SHADOW_MATRIX_0_W, RENDERPARM_SHADOW_MATRIX_1_X, RENDERPARM_SHADOW_MATRIX_1_Y, RENDERPARM_SHADOW_MATRIX_1_Z, RENDERPARM_SHADOW_MATRIX_1_W, RENDERPARM_SHADOW_MATRIX_2_X, RENDERPARM_SHADOW_MATRIX_2_Y, RENDERPARM_SHADOW_MATRIX_2_Z, RENDERPARM_SHADOW_MATRIX_2_W, RENDERPARM_SHADOW_MATRIX_3_X, RENDERPARM_SHADOW_MATRIX_3_Y, RENDERPARM_SHADOW_MATRIX_3_Z, RENDERPARM_SHADOW_MATRIX_3_W, RENDERPARM_SHADOW_MATRIX_4_X, RENDERPARM_SHADOW_MATRIX_4_Y, RENDERPARM_SHADOW_MATRIX_4_Z, RENDERPARM_SHADOW_MATRIX_4_W, RENDERPARM_SHADOW_MATRIX_5_X, RENDERPARM_SHADOW_MATRIX_5_Y, RENDERPARM_SHADOW_MATRIX_5_Z, RENDERPARM_SHADOW_MATRIX_5_W, RENDERPARM_SHADOW_ATLAS_OFFSET_0, RENDERPARM_SHADOW_ATLAS_OFFSET_1, RENDERPARM_SHADOW_ATLAS_OFFSET_2, RENDERPARM_SHADOW_ATLAS_OFFSET_3, RENDERPARM_SHADOW_ATLAS_OFFSET_4, RENDERPARM_SHADOW_ATLAS_OFFSET_5 }; +// SRS - rpMaximalSets have more than 16 idVec4 entries (>16*16 = 256 bytes) and are useful for MoltenVK on Apple platforms where the push constant limit is 4096 bytes +const idList rpMaximalSet11 = { RENDERPARM_SCREENCORRECTIONFACTOR, RENDERPARM_DIFFUSEMODIFIER, RENDERPARM_SPECULARMODIFIER, RENDERPARM_LOCALLIGHTORIGIN, RENDERPARM_LOCALVIEWORIGIN, RENDERPARM_LIGHTPROJECTION_S, RENDERPARM_LIGHTPROJECTION_T, RENDERPARM_LIGHTPROJECTION_Q, RENDERPARM_LIGHTFALLOFF_S, RENDERPARM_BUMPMATRIX_S, RENDERPARM_BUMPMATRIX_T, RENDERPARM_DIFFUSEMATRIX_S, RENDERPARM_DIFFUSEMATRIX_T, RENDERPARM_SPECULARMATRIX_S, RENDERPARM_SPECULARMATRIX_T, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_MODELMATRIX_X, RENDERPARM_MODELMATRIX_Y, RENDERPARM_MODELMATRIX_Z, RENDERPARM_MODELMATRIX_W, RENDERPARM_PROJMATRIX_W, RENDERPARM_MODELVIEWMATRIX_X, RENDERPARM_MODELVIEWMATRIX_Y, RENDERPARM_MODELVIEWMATRIX_Z, RENDERPARM_MODELVIEWMATRIX_W, RENDERPARM_GLOBALLIGHTORIGIN, RENDERPARM_JITTERTEXSCALE, RENDERPARM_JITTERTEXOFFSET, RENDERPARM_PSX_DISTORTIONS, RENDERPARM_CASCADEDISTANCES, RENDERPARM_SHADOW_MATRIX_0_X, RENDERPARM_SHADOW_MATRIX_0_Y, RENDERPARM_SHADOW_MATRIX_0_Z, RENDERPARM_SHADOW_MATRIX_0_W, RENDERPARM_SHADOW_MATRIX_1_X, RENDERPARM_SHADOW_MATRIX_1_Y, RENDERPARM_SHADOW_MATRIX_1_Z, RENDERPARM_SHADOW_MATRIX_1_W, RENDERPARM_SHADOW_MATRIX_2_X, RENDERPARM_SHADOW_MATRIX_2_Y, RENDERPARM_SHADOW_MATRIX_2_Z, RENDERPARM_SHADOW_MATRIX_2_W, RENDERPARM_SHADOW_MATRIX_3_X, RENDERPARM_SHADOW_MATRIX_3_Y, RENDERPARM_SHADOW_MATRIX_3_Z, RENDERPARM_SHADOW_MATRIX_3_W, RENDERPARM_SHADOW_MATRIX_4_X, RENDERPARM_SHADOW_MATRIX_4_Y, RENDERPARM_SHADOW_MATRIX_4_Z, RENDERPARM_SHADOW_MATRIX_4_W, RENDERPARM_SHADOW_MATRIX_5_X, RENDERPARM_SHADOW_MATRIX_5_Y, RENDERPARM_SHADOW_MATRIX_5_Z, RENDERPARM_SHADOW_MATRIX_5_W, RENDERPARM_SHADOW_ATLAS_OFFSET_0, RENDERPARM_SHADOW_ATLAS_OFFSET_1, RENDERPARM_SHADOW_ATLAS_OFFSET_2, RENDERPARM_SHADOW_ATLAS_OFFSET_3, RENDERPARM_SHADOW_ATLAS_OFFSET_4, RENDERPARM_SHADOW_ATLAS_OFFSET_5 }; const idList rpMaximalSet11LayoutTypes = { BINDING_LAYOUT_DRAW_INTERACTION_SM, BINDING_LAYOUT_DRAW_INTERACTION_SM_SKINNED }; +// SRS - Try to limit rpNominalSets to 15 idVec4 entries (15*16 = 240 bytes) to fit within D3D12 root constant limit, otherwise 16 entries is the max for non-Apple Vulkan +const idList rpNominalSet12 = { RENDERPARM_SCREENCORRECTIONFACTOR, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_COLOR, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_PROJMATRIX_W, RENDERPARM_TEXTUREMATRIX_S, RENDERPARM_TEXTUREMATRIX_T, RENDERPARM_TEXGEN_0_S, RENDERPARM_TEXGEN_0_T, RENDERPARM_TEXGEN_0_Q, RENDERPARM_TEXGEN_0_ENABLED, RENDERPARM_PSX_DISTORTIONS }; + +const idList rpNominalSet12LayoutTypes = { BINDING_LAYOUT_TEXGEN }; + +// SRS - Try to limit rpNominalSets to 15 idVec4 entries (15*16 = 240 bytes) to fit within D3D12 root constant limit, otherwise 16 entries is the max for non-Apple Vulkan +const idList rpNominalSet13 = { RENDERPARM_SCREENCORRECTIONFACTOR, RENDERPARM_WINDOWCOORD, RENDERPARM_MODELMATRIX_X, RENDERPARM_MODELMATRIX_Y, RENDERPARM_MODELMATRIX_Z, RENDERPARM_MODELMATRIX_W, RENDERPARM_PROJMATRIX_Z, RENDERPARM_MODELVIEWMATRIX_X, RENDERPARM_MODELVIEWMATRIX_Y, RENDERPARM_MODELVIEWMATRIX_Z, RENDERPARM_JITTERTEXSCALE, RENDERPARM_JITTERTEXOFFSET }; + +const idList rpNominalSet13LayoutTypes = { BINDING_LAYOUT_POST_PROCESS_FINAL2, BINDING_LAYOUT_DRAW_AO, BINDING_LAYOUT_DRAW_AO1 }; + enum rpStage_t { SHADER_STAGE_VERTEX = BIT( 0 ), diff --git a/neo/shaders/CMakeLists.txt b/neo/shaders/CMakeLists.txt index 97f82d7ed8..c33994eb50 100644 --- a/neo/shaders/CMakeLists.txt +++ b/neo/shaders/CMakeLists.txt @@ -1,6 +1,6 @@ include(../compileshaders.cmake) -file(GLOB globalshaders "BRDF.inc.hlsl" "global_inc.hlsl" "vulkan.hlsli" "renderParmSet0.inc.hlsl" "renderParmSet1.inc.hlsl" "renderParmSet2.inc.hlsl" "renderParmSet3.inc.hlsl" "renderParmSet4.inc.hlsl" "renderParmSet5.inc.hlsl" "renderParmSet6.inc.hlsl" "renderParmSet7.inc.hlsl" "renderParmSet8.inc.hlsl" "renderParmSet9.inc.hlsl" "renderParmSet10.inc.hlsl" "renderParmSet11.inc.hlsl") +file(GLOB globalshaders "BRDF.inc.hlsl" "global_inc.hlsl" "vulkan.hlsli" "renderParmSet0.inc.hlsl" "renderParmSet1.inc.hlsl" "renderParmSet2.inc.hlsl" "renderParmSet3.inc.hlsl" "renderParmSet4.inc.hlsl" "renderParmSet5.inc.hlsl" "renderParmSet6.inc.hlsl" "renderParmSet7.inc.hlsl" "renderParmSet8.inc.hlsl" "renderParmSet9.inc.hlsl" "renderParmSet10.inc.hlsl" "renderParmSet11.inc.hlsl" "renderParmSet12.inc.hlsl" "renderParmSet13.inc.hlsl") file(GLOB builtins "builtin/*.hlsl") file(GLOB debug "builtin/debug/*hlsl") file(GLOB fog "builtin/fog/*hlsl") diff --git a/neo/shaders/builtin/SSAO/AmbientOcclusion_AO.ps.hlsl b/neo/shaders/builtin/SSAO/AmbientOcclusion_AO.ps.hlsl index f557b95614..80ede90abe 100644 --- a/neo/shaders/builtin/SSAO/AmbientOcclusion_AO.ps.hlsl +++ b/neo/shaders/builtin/SSAO/AmbientOcclusion_AO.ps.hlsl @@ -30,7 +30,7 @@ */ #include "global_inc.hlsl" -#include "renderParmSet2.inc.hlsl" +#include "renderParmSet13.inc.hlsl" #define DIFFERENT_DEPTH_RESOLUTIONS 0 diff --git a/neo/shaders/builtin/SSAO/AmbientOcclusion_AO.vs.hlsl b/neo/shaders/builtin/SSAO/AmbientOcclusion_AO.vs.hlsl index 64c0eda249..0a7c3abe45 100644 --- a/neo/shaders/builtin/SSAO/AmbientOcclusion_AO.vs.hlsl +++ b/neo/shaders/builtin/SSAO/AmbientOcclusion_AO.vs.hlsl @@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet2.inc.hlsl" +#include "renderParmSet13.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/builtin/SSAO/AmbientOcclusion_blur.ps.hlsl b/neo/shaders/builtin/SSAO/AmbientOcclusion_blur.ps.hlsl index f7c10b8bf6..d0ca7d9cf4 100644 --- a/neo/shaders/builtin/SSAO/AmbientOcclusion_blur.ps.hlsl +++ b/neo/shaders/builtin/SSAO/AmbientOcclusion_blur.ps.hlsl @@ -17,7 +17,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "global_inc.hlsl" -#include "renderParmSet2.inc.hlsl" +#include "renderParmSet13.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/builtin/SSAO/AmbientOcclusion_blur.vs.hlsl b/neo/shaders/builtin/SSAO/AmbientOcclusion_blur.vs.hlsl index 2315cc52f7..f425992378 100644 --- a/neo/shaders/builtin/SSAO/AmbientOcclusion_blur.vs.hlsl +++ b/neo/shaders/builtin/SSAO/AmbientOcclusion_blur.vs.hlsl @@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet2.inc.hlsl" +#include "renderParmSet13.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/builtin/color.vs.hlsl b/neo/shaders/builtin/color.vs.hlsl index 38a3121420..0f406cca15 100644 --- a/neo/shaders/builtin/color.vs.hlsl +++ b/neo/shaders/builtin/color.vs.hlsl @@ -103,5 +103,5 @@ void main( VS_IN vertex, out VS_OUT result ) result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); #endif - result.position.xyz = psxVertexJitter( result.position ); + result.position.xyz = psxVertexJitter( pc.rpPSXDistortions, pc.rpProjectionMatrixW, result.position ); } diff --git a/neo/shaders/builtin/debug/debug_shadowmap.ps.hlsl b/neo/shaders/builtin/debug/debug_shadowmap.ps.hlsl index 881ce7ffce..e0d5b5e57c 100644 --- a/neo/shaders/builtin/debug/debug_shadowmap.ps.hlsl +++ b/neo/shaders/builtin/debug/debug_shadowmap.ps.hlsl @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet4.inc.hlsl" +#include "renderParmSet12.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/builtin/debug/debug_shadowmap.vs.hlsl b/neo/shaders/builtin/debug/debug_shadowmap.vs.hlsl index c57d3c9d94..b4757dc5d6 100644 --- a/neo/shaders/builtin/debug/debug_shadowmap.vs.hlsl +++ b/neo/shaders/builtin/debug/debug_shadowmap.vs.hlsl @@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet4.inc.hlsl" +#include "renderParmSet12.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/builtin/depth.vs.hlsl b/neo/shaders/builtin/depth.vs.hlsl index b14d6ddf4d..0391aaa6fc 100644 --- a/neo/shaders/builtin/depth.vs.hlsl +++ b/neo/shaders/builtin/depth.vs.hlsl @@ -102,5 +102,5 @@ void main( VS_IN vertex, out VS_OUT result ) result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); #endif - result.position.xyz = psxVertexJitter( result.position ); + result.position.xyz = psxVertexJitter( pc.rpPSXDistortions, pc.rpProjectionMatrixW, result.position ); } diff --git a/neo/shaders/builtin/fog/blendLight.vs.hlsl b/neo/shaders/builtin/fog/blendLight.vs.hlsl index 6709f0b41c..39e1694c12 100644 --- a/neo/shaders/builtin/fog/blendLight.vs.hlsl +++ b/neo/shaders/builtin/fog/blendLight.vs.hlsl @@ -122,5 +122,5 @@ void main( VS_IN vertex, out VS_OUT result ) result.texcoord1.y = 0.5; #endif - result.position.xyz = psxVertexJitter( result.position ); + result.position.xyz = psxVertexJitter( pc.rpPSXDistortions, pc.rpProjectionMatrixW, result.position ); } diff --git a/neo/shaders/builtin/fog/fog.vs.hlsl b/neo/shaders/builtin/fog/fog.vs.hlsl index 35dc27037b..27f3656656 100644 --- a/neo/shaders/builtin/fog/fog.vs.hlsl +++ b/neo/shaders/builtin/fog/fog.vs.hlsl @@ -118,5 +118,5 @@ void main( VS_IN vertex, out VS_OUT result ) result.texcoord1.y = dot4( vertex.position, pc.rpTexGen1T ); #endif - result.position.xyz = psxVertexJitter( result.position ); + result.position.xyz = psxVertexJitter( pc.rpPSXDistortions, pc.rpProjectionMatrixW, result.position ); } diff --git a/neo/shaders/builtin/gbuffer.vs.hlsl b/neo/shaders/builtin/gbuffer.vs.hlsl index 3a55d4c5e7..d385bee79e 100644 --- a/neo/shaders/builtin/gbuffer.vs.hlsl +++ b/neo/shaders/builtin/gbuffer.vs.hlsl @@ -131,7 +131,7 @@ void main( VS_IN vertex, out VS_OUT result ) result.position.z = dot4( modelPosition, pc.rpMVPmatrixZ ); result.position.w = dot4( modelPosition, pc.rpMVPmatrixW ); - result.position.xyz = psxVertexJitter( result.position ); + result.position.xyz = psxVertexJitter( pc.rpPSXDistortions, pc.rpProjectionMatrixW, result.position ); // textures 0 takes the base coordinates by the texture matrix result.texcoord0.x = dot4( vertex.texcoord.xy, pc.rpBumpMatrixS ); diff --git a/neo/shaders/builtin/legacy/bumpyenvironment.vs.hlsl b/neo/shaders/builtin/legacy/bumpyenvironment.vs.hlsl index 9ebf2b469a..b00a5bcf60 100644 --- a/neo/shaders/builtin/legacy/bumpyenvironment.vs.hlsl +++ b/neo/shaders/builtin/legacy/bumpyenvironment.vs.hlsl @@ -175,7 +175,7 @@ void main( VS_IN vertex, out VS_OUT result ) #endif - result.position.xyz = psxVertexJitter( result.position ); + result.position.xyz = psxVertexJitter( pc.rpPSXDistortions, pc.rpProjectionMatrixW, result.position ); result.color = pc.rpColor; } diff --git a/neo/shaders/builtin/legacy/environment.vs.hlsl b/neo/shaders/builtin/legacy/environment.vs.hlsl index a89aff8d40..5d2a5839f0 100644 --- a/neo/shaders/builtin/legacy/environment.vs.hlsl +++ b/neo/shaders/builtin/legacy/environment.vs.hlsl @@ -122,7 +122,7 @@ void main( VS_IN vertex, out VS_OUT result ) result.texcoord1 = vNormal.xyz; #endif - result.position.xyz = psxVertexJitter( result.position ); + result.position.xyz = psxVertexJitter( pc.rpPSXDistortions, pc.rpProjectionMatrixW, result.position ); result.color = sRGBAToLinearRGBA( pc.rpColor ); } diff --git a/neo/shaders/builtin/legacy/skybox.ps.hlsl b/neo/shaders/builtin/legacy/skybox.ps.hlsl index ec281eaca2..fb094069ef 100644 --- a/neo/shaders/builtin/legacy/skybox.ps.hlsl +++ b/neo/shaders/builtin/legacy/skybox.ps.hlsl @@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet0.inc.hlsl" +#include "renderParmSet5.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/builtin/legacy/skybox.vs.hlsl b/neo/shaders/builtin/legacy/skybox.vs.hlsl index 17def7c838..7bb5d068ec 100644 --- a/neo/shaders/builtin/legacy/skybox.vs.hlsl +++ b/neo/shaders/builtin/legacy/skybox.vs.hlsl @@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet0.inc.hlsl" +#include "renderParmSet5.inc.hlsl" // *INDENT-OFF* @@ -55,7 +55,7 @@ void main( VS_IN vertex, out VS_OUT result ) result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); - result.position.xyz = psxVertexJitter( result.position ); + result.position.xyz = psxVertexJitter( pc.rpPSXDistortions, pc.rpProjectionMatrixW, result.position ); result.texcoord0 = vertex.position.xyz - pc.rpLocalViewOrigin.xyz; diff --git a/neo/shaders/builtin/legacy/wobblesky.vs.hlsl b/neo/shaders/builtin/legacy/wobblesky.vs.hlsl index 894cd03b33..d6399ebb14 100644 --- a/neo/shaders/builtin/legacy/wobblesky.vs.hlsl +++ b/neo/shaders/builtin/legacy/wobblesky.vs.hlsl @@ -56,7 +56,7 @@ void main( VS_IN vertex, out VS_OUT result ) result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); - result.position.xyz = psxVertexJitter( result.position ); + result.position.xyz = psxVertexJitter( pc.rpPSXDistortions, pc.rpProjectionMatrixW, result.position ); float3 t0 = vertex.position.xyz - pc.rpLocalViewOrigin.xyz; result.texcoord0.x = dot3( t0, pc.rpWobbleSkyX ); diff --git a/neo/shaders/builtin/lighting/ambient_lightgrid_IBL.vs.hlsl b/neo/shaders/builtin/lighting/ambient_lightgrid_IBL.vs.hlsl index feba03950a..4ab94d4be1 100644 --- a/neo/shaders/builtin/lighting/ambient_lightgrid_IBL.vs.hlsl +++ b/neo/shaders/builtin/lighting/ambient_lightgrid_IBL.vs.hlsl @@ -134,7 +134,7 @@ void main( VS_IN vertex, out VS_OUT result ) result.position.z = dot4( modelPosition, pc.rpMVPmatrixZ ); result.position.w = dot4( modelPosition, pc.rpMVPmatrixW ); - result.position.xyz = psxVertexJitter( result.position ); + result.position.xyz = psxVertexJitter( pc.rpPSXDistortions, pc.rpProjectionMatrixW, result.position ); float4 defaultTexCoord = float4( 0.0f, 0.5f, 0.0f, 1.0f ); diff --git a/neo/shaders/builtin/lighting/ambient_lighting_IBL.vs.hlsl b/neo/shaders/builtin/lighting/ambient_lighting_IBL.vs.hlsl index de18145eb8..d6f0e89464 100644 --- a/neo/shaders/builtin/lighting/ambient_lighting_IBL.vs.hlsl +++ b/neo/shaders/builtin/lighting/ambient_lighting_IBL.vs.hlsl @@ -134,7 +134,7 @@ void main( VS_IN vertex, out VS_OUT result ) result.position.z = dot4( modelPosition, pc.rpMVPmatrixZ ); result.position.w = dot4( modelPosition, pc.rpMVPmatrixW ); - result.position.xyz = psxVertexJitter( result.position ); + result.position.xyz = psxVertexJitter( pc.rpPSXDistortions, pc.rpProjectionMatrixW, result.position ); float4 defaultTexCoord = float4( 0.0f, 0.5f, 0.0f, 1.0f ); diff --git a/neo/shaders/builtin/lighting/interaction.vs.hlsl b/neo/shaders/builtin/lighting/interaction.vs.hlsl index 366346f4b2..560c6bd783 100644 --- a/neo/shaders/builtin/lighting/interaction.vs.hlsl +++ b/neo/shaders/builtin/lighting/interaction.vs.hlsl @@ -133,7 +133,7 @@ void main( VS_IN vertex, out VS_OUT result ) result.position.z = dot4( modelPosition, pc.rpMVPmatrixZ ); result.position.w = dot4( modelPosition, pc.rpMVPmatrixW ); - result.position.xyz = psxVertexJitter( result.position ); + result.position.xyz = psxVertexJitter( pc.rpPSXDistortions, pc.rpProjectionMatrixW, result.position ); float4 defaultTexCoord = float4( 0.0f, 0.5f, 0.0f, 1.0f ); diff --git a/neo/shaders/builtin/lighting/interactionAmbient.vs.hlsl b/neo/shaders/builtin/lighting/interactionAmbient.vs.hlsl index 3aa7c3d4f6..97408b2433 100644 --- a/neo/shaders/builtin/lighting/interactionAmbient.vs.hlsl +++ b/neo/shaders/builtin/lighting/interactionAmbient.vs.hlsl @@ -134,7 +134,7 @@ void main( VS_IN vertex, out VS_OUT result ) result.position.z = dot4( modelPosition, pc.rpMVPmatrixZ ); result.position.w = dot4( modelPosition, pc.rpMVPmatrixW ); - result.position.xyz = psxVertexJitter( result.position ); + result.position.xyz = psxVertexJitter( pc.rpPSXDistortions, pc.rpProjectionMatrixW, result.position ); float4 defaultTexCoord = float4( 0.0f, 0.5f, 0.0f, 1.0f ); diff --git a/neo/shaders/builtin/lighting/interactionSM.vs.hlsl b/neo/shaders/builtin/lighting/interactionSM.vs.hlsl index d199bc9bd2..2db1fc1bdb 100644 --- a/neo/shaders/builtin/lighting/interactionSM.vs.hlsl +++ b/neo/shaders/builtin/lighting/interactionSM.vs.hlsl @@ -136,7 +136,7 @@ void main( VS_IN vertex, out VS_OUT result ) result.position.z = dot4( modelPosition, pc.rpMVPmatrixZ ); result.position.w = dot4( modelPosition, pc.rpMVPmatrixW ); - result.position.xyz = psxVertexJitter( result.position ); + result.position.xyz = psxVertexJitter( pc.rpPSXDistortions, pc.rpProjectionMatrixW, result.position ); float4 defaultTexCoord = float4( 0.0f, 0.5f, 0.0f, 1.0f ); diff --git a/neo/shaders/builtin/post/crt_advanced.ps.hlsl b/neo/shaders/builtin/post/crt_advanced.ps.hlsl index 30f1455404..0a9d7ebdb5 100644 --- a/neo/shaders/builtin/post/crt_advanced.ps.hlsl +++ b/neo/shaders/builtin/post/crt_advanced.ps.hlsl @@ -29,6 +29,7 @@ If you have questions concerning this license or the applicable additional terms */ #include +#include "renderParmSet2.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/builtin/post/crt_advanced.vs.hlsl b/neo/shaders/builtin/post/crt_advanced.vs.hlsl index 75519fe84b..d0999dd6fb 100644 --- a/neo/shaders/builtin/post/crt_advanced.vs.hlsl +++ b/neo/shaders/builtin/post/crt_advanced.vs.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet2.inc.hlsl" // *INDENT-OFF* @@ -52,4 +53,4 @@ void main( VS_IN vertex, out VS_OUT result ) result.position.y = -result.position.y; result.texcoord0 = vertex.texcoord; -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/post/crt_aperture.ps.hlsl b/neo/shaders/builtin/post/crt_aperture.ps.hlsl index 41106ed9fa..0165fc6e2a 100644 --- a/neo/shaders/builtin/post/crt_aperture.ps.hlsl +++ b/neo/shaders/builtin/post/crt_aperture.ps.hlsl @@ -29,6 +29,7 @@ #include +#include "renderParmSet2.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/builtin/post/crt_aperture.vs.hlsl b/neo/shaders/builtin/post/crt_aperture.vs.hlsl index 75519fe84b..d0999dd6fb 100644 --- a/neo/shaders/builtin/post/crt_aperture.vs.hlsl +++ b/neo/shaders/builtin/post/crt_aperture.vs.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet2.inc.hlsl" // *INDENT-OFF* @@ -52,4 +53,4 @@ void main( VS_IN vertex, out VS_OUT result ) result.position.y = -result.position.y; result.texcoord0 = vertex.texcoord; -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/post/crt_easymode.ps.hlsl b/neo/shaders/builtin/post/crt_easymode.ps.hlsl index 724c931b61..95a9f52a95 100644 --- a/neo/shaders/builtin/post/crt_easymode.ps.hlsl +++ b/neo/shaders/builtin/post/crt_easymode.ps.hlsl @@ -29,6 +29,7 @@ #include +#include "renderParmSet2.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/builtin/post/crt_easymode.vs.hlsl b/neo/shaders/builtin/post/crt_easymode.vs.hlsl index 75519fe84b..d0999dd6fb 100644 --- a/neo/shaders/builtin/post/crt_easymode.vs.hlsl +++ b/neo/shaders/builtin/post/crt_easymode.vs.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet2.inc.hlsl" // *INDENT-OFF* @@ -52,4 +53,4 @@ void main( VS_IN vertex, out VS_OUT result ) result.position.y = -result.position.y; result.texcoord0 = vertex.texcoord; -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/post/retro_2bit.ps.hlsl b/neo/shaders/builtin/post/retro_2bit.ps.hlsl index e186eb5eff..246d5c16b1 100644 --- a/neo/shaders/builtin/post/retro_2bit.ps.hlsl +++ b/neo/shaders/builtin/post/retro_2bit.ps.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet2.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/builtin/post/retro_2bit.vs.hlsl b/neo/shaders/builtin/post/retro_2bit.vs.hlsl index 75519fe84b..d0999dd6fb 100644 --- a/neo/shaders/builtin/post/retro_2bit.vs.hlsl +++ b/neo/shaders/builtin/post/retro_2bit.vs.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet2.inc.hlsl" // *INDENT-OFF* @@ -52,4 +53,4 @@ void main( VS_IN vertex, out VS_OUT result ) result.position.y = -result.position.y; result.texcoord0 = vertex.texcoord; -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/post/retro_cpc.ps.hlsl b/neo/shaders/builtin/post/retro_cpc.ps.hlsl index cf4d50f269..c08cd1786d 100644 --- a/neo/shaders/builtin/post/retro_cpc.ps.hlsl +++ b/neo/shaders/builtin/post/retro_cpc.ps.hlsl @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet2.inc.hlsl" +#include "renderParmSet13.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/builtin/post/retro_cpc.vs.hlsl b/neo/shaders/builtin/post/retro_cpc.vs.hlsl index 97ea031968..1dbafe26d6 100644 --- a/neo/shaders/builtin/post/retro_cpc.vs.hlsl +++ b/neo/shaders/builtin/post/retro_cpc.vs.hlsl @@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet2.inc.hlsl" +#include "renderParmSet13.inc.hlsl" // *INDENT-OFF* @@ -54,4 +54,4 @@ void main( VS_IN vertex, out VS_OUT result ) result.position.y = -result.position.y; result.texcoord0 = vertex.texcoord; -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/post/retro_nes.ps.hlsl b/neo/shaders/builtin/post/retro_nes.ps.hlsl index 386b5f8943..c3efb8c4d6 100644 --- a/neo/shaders/builtin/post/retro_nes.ps.hlsl +++ b/neo/shaders/builtin/post/retro_nes.ps.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet2.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/builtin/post/retro_nes.vs.hlsl b/neo/shaders/builtin/post/retro_nes.vs.hlsl index 75519fe84b..d0999dd6fb 100644 --- a/neo/shaders/builtin/post/retro_nes.vs.hlsl +++ b/neo/shaders/builtin/post/retro_nes.vs.hlsl @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet2.inc.hlsl" // *INDENT-OFF* @@ -52,4 +53,4 @@ void main( VS_IN vertex, out VS_OUT result ) result.position.y = -result.position.y; result.texcoord0 = vertex.texcoord; -} \ No newline at end of file +} diff --git a/neo/shaders/builtin/texture.vs.hlsl b/neo/shaders/builtin/texture.vs.hlsl index 4d0090af80..27abf44e4e 100644 --- a/neo/shaders/builtin/texture.vs.hlsl +++ b/neo/shaders/builtin/texture.vs.hlsl @@ -54,7 +54,7 @@ void main( VS_IN vertex, out VS_OUT result ) result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); - result.position.xyz = psxVertexJitter( result.position ); + result.position.xyz = psxVertexJitter( pc.rpPSXDistortions, pc.rpProjectionMatrixW, result.position ); // compute oldschool texgen or multiply by texture matrix BRANCH if( pc.rpTexGen0Enabled.x > 0.0 ) diff --git a/neo/shaders/builtin/texture_color.vs.hlsl b/neo/shaders/builtin/texture_color.vs.hlsl index dcaf3f0d6c..8c5447ffc8 100644 --- a/neo/shaders/builtin/texture_color.vs.hlsl +++ b/neo/shaders/builtin/texture_color.vs.hlsl @@ -103,7 +103,7 @@ void main( VS_IN vertex, out VS_OUT result ) result.position.z = dot4( modelPosition, pc.rpMVPmatrixZ ); result.position.w = dot4( modelPosition, pc.rpMVPmatrixW ); - result.position.xyz = psxVertexJitter( result.position ); + result.position.xyz = psxVertexJitter( pc.rpPSXDistortions, pc.rpProjectionMatrixW, result.position ); // compute oldschool texgen or multiply by texture matrix BRANCH if( pc.rpTexGen0Enabled.x > 0.0 ) diff --git a/neo/shaders/builtin/texture_color_texgen.ps.hlsl b/neo/shaders/builtin/texture_color_texgen.ps.hlsl index 7393d848cc..5a13b742a4 100644 --- a/neo/shaders/builtin/texture_color_texgen.ps.hlsl +++ b/neo/shaders/builtin/texture_color_texgen.ps.hlsl @@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet4.inc.hlsl" +#include "renderParmSet12.inc.hlsl" // *INDENT-OFF* diff --git a/neo/shaders/builtin/texture_color_texgen.vs.hlsl b/neo/shaders/builtin/texture_color_texgen.vs.hlsl index 32883f5ac2..ea31b13c87 100644 --- a/neo/shaders/builtin/texture_color_texgen.vs.hlsl +++ b/neo/shaders/builtin/texture_color_texgen.vs.hlsl @@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet4.inc.hlsl" +#include "renderParmSet12.inc.hlsl" // *INDENT-OFF* @@ -56,7 +56,7 @@ void main( VS_IN vertex, out VS_OUT result ) result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); - result.position.xyz = psxVertexJitter( result.position ); + result.position.xyz = psxVertexJitter( pc.rpPSXDistortions, pc.rpProjectionMatrixW, result.position ); float4 tc0; tc0.x = dot4( vertex.position, pc.rpTexGen0S ); diff --git a/neo/shaders/builtin/vertex_color.vs.hlsl b/neo/shaders/builtin/vertex_color.vs.hlsl index 0463db17a8..c50fb533d6 100644 --- a/neo/shaders/builtin/vertex_color.vs.hlsl +++ b/neo/shaders/builtin/vertex_color.vs.hlsl @@ -56,7 +56,7 @@ void main( VS_IN vertex, out VS_OUT result ) result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); - result.position.xyz = psxVertexJitter( result.position ); + result.position.xyz = psxVertexJitter( pc.rpPSXDistortions, pc.rpProjectionMatrixW, result.position ); result.color = swizzleColor( vertex.color ); } diff --git a/neo/shaders/builtin/video/bink.vs.hlsl b/neo/shaders/builtin/video/bink.vs.hlsl index c2a8acd55e..0d1c4b4f34 100644 --- a/neo/shaders/builtin/video/bink.vs.hlsl +++ b/neo/shaders/builtin/video/bink.vs.hlsl @@ -54,7 +54,7 @@ void main( VS_IN vertex, out VS_OUT result ) result.position.z = dot4( vertex.position, pc.rpMVPmatrixZ ); result.position.w = dot4( vertex.position, pc.rpMVPmatrixW ); - result.position.xyz = psxVertexJitter( result.position ); + result.position.xyz = psxVertexJitter( pc.rpPSXDistortions, pc.rpProjectionMatrixW, result.position ); result.texcoord0 = vertex.texcoord; } diff --git a/neo/shaders/global_inc.hlsl b/neo/shaders/global_inc.hlsl index b6d067658d..5d709b436f 100644 --- a/neo/shaders/global_inc.hlsl +++ b/neo/shaders/global_inc.hlsl @@ -498,9 +498,9 @@ static int2 textureSize( Texture2D buffer, int mipLevel ) // https://www.david-colson.com/2021/11/30/ps1-style-renderer.html // emulate rasterization with fixed point math -static float3 psxVertexJitter( float4 clipPos ) +static float3 psxVertexJitter( float4 psxDistortions, float4 projectionMatrixW, float4 clipPos ) { - float jitterScale = pc.rpPSXDistortions.x; + float jitterScale = psxDistortions.x; if( jitterScale > 0.0 ) { // snap to vertex to a pixel position on a lower grid @@ -508,10 +508,10 @@ static float3 psxVertexJitter( float4 clipPos ) //float2 resolution = float2( 320, 240 ) * ( 1.0 - jitterScale ); //float2 resolution = float2( 160, 120 ); - float2 resolution = float2( pc.rpPSXDistortions.x, pc.rpPSXDistortions.y ); + float2 resolution = float2( psxDistortions.x, psxDistortions.y ); // depth independent snapping - float w = dot4( pc.rpProjectionMatrixW, float4( vertex.xyz, 1.0 ) ); + float w = dot4( projectionMatrixW, float4( vertex.xyz, 1.0 ) ); vertex.xy = round( vertex.xy / w * resolution ) / resolution * w; //vertex.xy = floor( vertex.xy / 4.0 ) * 4.0; diff --git a/neo/shaders/renderParmSet0.inc.hlsl b/neo/shaders/renderParmSet0.inc.hlsl index 4c6f755146..a47c5fd841 100644 --- a/neo/shaders/renderParmSet0.inc.hlsl +++ b/neo/shaders/renderParmSet0.inc.hlsl @@ -33,15 +33,16 @@ struct renderParmSet0_t { float4 rpLocalViewOrigin; - float4 rpVertexColorModulate; - float4 rpVertexColorAdd; - float4 rpColor; float4 rpMVPmatrixX; float4 rpMVPmatrixY; float4 rpMVPmatrixZ; float4 rpMVPmatrixW; + + float4 rpProjectionMatrixW; + + float4 rpPSXDistortions; }; #if USE_PUSH_CONSTANTS diff --git a/neo/shaders/renderParmSet1.inc.hlsl b/neo/shaders/renderParmSet1.inc.hlsl index f1b03f4a30..b3b2b5a57f 100644 --- a/neo/shaders/renderParmSet1.inc.hlsl +++ b/neo/shaders/renderParmSet1.inc.hlsl @@ -38,7 +38,7 @@ struct renderParmSet1_t float4 rpMVPmatrixY; float4 rpMVPmatrixZ; float4 rpMVPmatrixW; - + float4 rpOverbright; }; diff --git a/neo/shaders/renderParmSet10.inc.hlsl b/neo/shaders/renderParmSet10.inc.hlsl index 23a4a13f57..f2edc0b346 100644 --- a/neo/shaders/renderParmSet10.inc.hlsl +++ b/neo/shaders/renderParmSet10.inc.hlsl @@ -36,7 +36,7 @@ struct renderParmSet10_t float4 rpLocalLightOrigin; float4 rpLocalViewOrigin; - + float4 rpLightProjectionS; float4 rpLightProjectionT; float4 rpLightProjectionQ; @@ -44,20 +44,24 @@ struct renderParmSet10_t float4 rpBumpMatrixS; float4 rpBumpMatrixT; - + float4 rpDiffuseMatrixS; float4 rpDiffuseMatrixT; float4 rpSpecularMatrixS; float4 rpSpecularMatrixT; - + float4 rpVertexColorModulate; float4 rpVertexColorAdd; - + float4 rpMVPmatrixX; float4 rpMVPmatrixY; float4 rpMVPmatrixZ; float4 rpMVPmatrixW; + + float4 rpProjectionMatrixW; + + float4 rpPSXDistortions; }; #if USE_PUSH_CONSTANTS diff --git a/neo/shaders/renderParmSet11.inc.hlsl b/neo/shaders/renderParmSet11.inc.hlsl index 0c63fd2565..2f2d748b41 100644 --- a/neo/shaders/renderParmSet11.inc.hlsl +++ b/neo/shaders/renderParmSet11.inc.hlsl @@ -37,21 +37,21 @@ struct renderParmSet11_t float4 rpLocalLightOrigin; float4 rpLocalViewOrigin; - + float4 rpLightProjectionS; float4 rpLightProjectionT; float4 rpLightProjectionQ; float4 rpLightFalloffS; - + float4 rpBumpMatrixS; float4 rpBumpMatrixT; - + float4 rpDiffuseMatrixS; float4 rpDiffuseMatrixT; float4 rpSpecularMatrixS; float4 rpSpecularMatrixT; - + float4 rpVertexColorModulate; float4 rpVertexColorAdd; @@ -59,12 +59,14 @@ struct renderParmSet11_t float4 rpMVPmatrixY; float4 rpMVPmatrixZ; float4 rpMVPmatrixW; - + float4 rpModelMatrixX; float4 rpModelMatrixY; float4 rpModelMatrixZ; float4 rpModelMatrixW; - + + float4 rpProjectionMatrixW; + float4 rpModelViewMatrixX; float4 rpModelViewMatrixY; float4 rpModelViewMatrixZ; @@ -73,8 +75,9 @@ struct renderParmSet11_t float4 rpGlobalLightOrigin; float4 rpJitterTexScale; float4 rpJitterTexOffset; + float4 rpPSXDistortions; float4 rpCascadeDistances; - + float4 rpShadowMatrices[6 * 4]; float4 rpShadowAtlasOffsets[6]; }; diff --git a/neo/shaders/renderParmSet12.inc.hlsl b/neo/shaders/renderParmSet12.inc.hlsl new file mode 100644 index 0000000000..bfde719dd8 --- /dev/null +++ b/neo/shaders/renderParmSet12.inc.hlsl @@ -0,0 +1,70 @@ +/* +=========================================================================== + +Doom 3 BFG Edition GPL Source Code +Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. +Copyright (C) 2013-2020 Robert Beckebans + +This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). + +Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Doom 3 BFG Edition Source Code. If not, see . + +In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. + +If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. + +=========================================================================== +*/ + +#include "vulkan.hlsli" + +struct renderParmSet12_t +{ + float4 rpScreenCorrectionFactor; + + float4 rpVertexColorModulate; + float4 rpVertexColorAdd; + + float4 rpColor; + + float4 rpMVPmatrixX; + float4 rpMVPmatrixY; + float4 rpMVPmatrixZ; + float4 rpMVPmatrixW; + + float4 rpProjectionMatrixW; + + float4 rpTextureMatrixS; + float4 rpTextureMatrixT; + + float4 rpTexGen0S; + float4 rpTexGen0T; + float4 rpTexGen0Q; + float4 rpTexGen0Enabled; + + float4 rpPSXDistortions; +}; + +#if USE_PUSH_CONSTANTS + +VK_PUSH_CONSTANT ConstantBuffer pc : register( b0 ); + +#else + +cbuffer pc : register( b0 VK_DESCRIPTOR_SET( 0 ) ) +{ + renderParmSet12_t pc; +} + +#endif diff --git a/neo/shaders/renderParmSet13.inc.hlsl b/neo/shaders/renderParmSet13.inc.hlsl new file mode 100644 index 0000000000..70d2b256b1 --- /dev/null +++ b/neo/shaders/renderParmSet13.inc.hlsl @@ -0,0 +1,63 @@ +/* +=========================================================================== + +Doom 3 BFG Edition GPL Source Code +Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. +Copyright (C) 2013-2020 Robert Beckebans + +This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). + +Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Doom 3 BFG Edition Source Code. If not, see . + +In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. + +If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. + +=========================================================================== +*/ + +#include "vulkan.hlsli" + +struct renderParmSet13_t +{ + float4 rpScreenCorrectionFactor; + float4 rpWindowCoord; + + float4 rpModelMatrixX; + float4 rpModelMatrixY; + float4 rpModelMatrixZ; + float4 rpModelMatrixW; + + float4 rpProjectionMatrixZ; + + float4 rpModelViewMatrixX; + float4 rpModelViewMatrixY; + float4 rpModelViewMatrixZ; + + float4 rpJitterTexScale; + float4 rpJitterTexOffset; +}; + +#if USE_PUSH_CONSTANTS + +VK_PUSH_CONSTANT ConstantBuffer pc : register( b0 ); + +#else + +cbuffer pc : register( b0 VK_DESCRIPTOR_SET( 0 ) ) +{ + renderParmSet13_t pc; +} + +#endif diff --git a/neo/shaders/renderParmSet2.inc.hlsl b/neo/shaders/renderParmSet2.inc.hlsl index e320e6cc49..bf206b7a24 100644 --- a/neo/shaders/renderParmSet2.inc.hlsl +++ b/neo/shaders/renderParmSet2.inc.hlsl @@ -33,11 +33,7 @@ struct renderParmSet2_t { float4 rpScreenCorrectionFactor; float4 rpWindowCoord; - - float4 rpModelMatrixX; - float4 rpModelMatrixY; - float4 rpModelMatrixZ; - float4 rpModelMatrixW; + float4 rpDiffuseModifier; float4 rpJitterTexScale; float4 rpJitterTexOffset; diff --git a/neo/shaders/renderParmSet3.inc.hlsl b/neo/shaders/renderParmSet3.inc.hlsl index 73b14891e7..e0fde51196 100644 --- a/neo/shaders/renderParmSet3.inc.hlsl +++ b/neo/shaders/renderParmSet3.inc.hlsl @@ -31,9 +31,14 @@ If you have questions concerning this license or the applicable additional terms struct renderParmSet3_t { + float4 rpLocalViewOrigin; + float4 rpBumpMatrixS; float4 rpBumpMatrixT; + float4 rpSpecularMatrixS; + float4 rpSpecularMatrixT; + float4 rpVertexColorModulate; float4 rpVertexColorAdd; @@ -42,9 +47,13 @@ struct renderParmSet3_t float4 rpMVPmatrixZ; float4 rpMVPmatrixW; - float4 rpModelViewMatrixX; - float4 rpModelViewMatrixY; - float4 rpModelViewMatrixZ; + float4 rpModelMatrixX; + float4 rpModelMatrixY; + float4 rpModelMatrixZ; + + float4 rpProjectionMatrixW; + + float4 rpPSXDistortions; }; #if USE_PUSH_CONSTANTS diff --git a/neo/shaders/renderParmSet4.inc.hlsl b/neo/shaders/renderParmSet4.inc.hlsl index cca86d3855..b9fb7d9492 100644 --- a/neo/shaders/renderParmSet4.inc.hlsl +++ b/neo/shaders/renderParmSet4.inc.hlsl @@ -31,7 +31,7 @@ If you have questions concerning this license or the applicable additional terms struct renderParmSet4_t { - float4 rpScreenCorrectionFactor; + float4 rpLocalViewOrigin; float4 rpVertexColorModulate; float4 rpVertexColorAdd; @@ -43,15 +43,18 @@ struct renderParmSet4_t float4 rpMVPmatrixZ; float4 rpMVPmatrixW; + float4 rpProjectionMatrixW; + float4 rpTextureMatrixS; float4 rpTextureMatrixT; float4 rpTexGen0S; float4 rpTexGen0T; - float4 rpTexGen0Q; float4 rpTexGen0Enabled; float4 rpAlphaTest; + + float4 rpPSXDistortions; }; #if USE_PUSH_CONSTANTS diff --git a/neo/shaders/renderParmSet5.inc.hlsl b/neo/shaders/renderParmSet5.inc.hlsl index adab55d499..766a044597 100644 --- a/neo/shaders/renderParmSet5.inc.hlsl +++ b/neo/shaders/renderParmSet5.inc.hlsl @@ -46,10 +46,14 @@ struct renderParmSet5_t float4 rpModelMatrixX; float4 rpModelMatrixY; float4 rpModelMatrixZ; - + + float4 rpProjectionMatrixW; + float4 rpWobbleSkyX; float4 rpWobbleSkyY; float4 rpWobbleSkyZ; + + float4 rpPSXDistortions; }; #if USE_PUSH_CONSTANTS diff --git a/neo/shaders/renderParmSet7.inc.hlsl b/neo/shaders/renderParmSet7.inc.hlsl index a0c1cc0cd0..9fa0a69852 100644 --- a/neo/shaders/renderParmSet7.inc.hlsl +++ b/neo/shaders/renderParmSet7.inc.hlsl @@ -38,12 +38,16 @@ struct renderParmSet7_t float4 rpMVPmatrixZ; float4 rpMVPmatrixW; + float4 rpProjectionMatrixW; + float4 rpTexGen0S; float4 rpTexGen0T; float4 rpTexGen0Q; float4 rpTexGen1S; float4 rpTexGen1T; + + float4 rpPSXDistortions; }; #if USE_PUSH_CONSTANTS diff --git a/neo/shaders/renderParmSet9.inc.hlsl b/neo/shaders/renderParmSet9.inc.hlsl index dd775debd8..a63fa4ca89 100644 --- a/neo/shaders/renderParmSet9.inc.hlsl +++ b/neo/shaders/renderParmSet9.inc.hlsl @@ -38,35 +38,38 @@ struct renderParmSet9_t float4 rpLocalLightOrigin; float4 rpLocalViewOrigin; - + float4 rpBumpMatrixS; float4 rpBumpMatrixT; - + float4 rpDiffuseMatrixS; float4 rpDiffuseMatrixT; float4 rpSpecularMatrixS; float4 rpSpecularMatrixT; - + float4 rpVertexColorModulate; float4 rpVertexColorAdd; - + float4 rpGlobalEyePos; float4 rpMVPmatrixX; float4 rpMVPmatrixY; float4 rpMVPmatrixZ; float4 rpMVPmatrixW; - + float4 rpModelMatrixX; float4 rpModelMatrixY; float4 rpModelMatrixZ; float4 rpModelMatrixW; + float4 rpProjectionMatrixW; + float4 rpAmbientColor; float4 rpGlobalLightOrigin; float4 rpJitterTexScale; float4 rpJitterTexOffset; + float4 rpPSXDistortions; float4 rpCascadeDistances; }; From ae4da72ee3cf8550e840bd07852ffa370daa6d8a Mon Sep 17 00:00:00 2001 From: SRSaunders <82544213+SRSaunders@users.noreply.github.com> Date: Tue, 26 Nov 2024 23:33:27 -0500 Subject: [PATCH 12/15] Add new SMAA binding layout types to push constant subset mapping --- neo/renderer/NVRHI/RenderBackend_NVRHI.cpp | 10 ++++------ neo/renderer/RenderProgs.h | 2 +- neo/shaders/builtin/post/SMAA.inc.hlsl | 4 ++-- .../builtin/post/SMAA_blending_weight_calc.ps.hlsl | 2 +- .../builtin/post/SMAA_blending_weight_calc.vs.hlsl | 2 +- neo/shaders/builtin/post/SMAA_edge_detection.ps.hlsl | 2 +- neo/shaders/builtin/post/SMAA_edge_detection.vs.hlsl | 2 +- neo/shaders/builtin/post/SMAA_final.ps.hlsl | 2 +- neo/shaders/builtin/post/SMAA_final.vs.hlsl | 2 +- neo/shaders/builtin/post/screen.ps.hlsl | 2 +- 10 files changed, 14 insertions(+), 16 deletions(-) diff --git a/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp b/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp index 3fac9d0ed1..f281525fc1 100644 --- a/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp +++ b/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp @@ -1572,14 +1572,13 @@ void idRenderBackend::GetCurrentBindingLayout( int type ) { desc[0].bindings = { - nvrhi::BindingSetItem::ConstantBuffer( 0, paramCb, range ), + uniformsBindingSetItem, nvrhi::BindingSetItem::Texture_SRV( 0, ( nvrhi::ITexture* )GetImageAt( 0 )->GetTextureID() ) }; } else { - desc[0].bindings[0].resourceHandle = paramCb; - desc[0].bindings[0].range = range; + desc[0].bindings[0] = uniformsBindingSetItem; desc[0].bindings[1].resourceHandle = ( nvrhi::ITexture* )GetImageAt( 0 )->GetTextureID(); } @@ -1603,7 +1602,7 @@ void idRenderBackend::GetCurrentBindingLayout( int type ) { desc[0].bindings = { - nvrhi::BindingSetItem::ConstantBuffer( 0, paramCb, range ), + uniformsBindingSetItem, nvrhi::BindingSetItem::Texture_SRV( 0, ( nvrhi::ITexture* )GetImageAt( 0 )->GetTextureID() ), nvrhi::BindingSetItem::Texture_SRV( 1, ( nvrhi::ITexture* )GetImageAt( 1 )->GetTextureID() ), nvrhi::BindingSetItem::Texture_SRV( 2, ( nvrhi::ITexture* )GetImageAt( 2 )->GetTextureID() ) @@ -1611,8 +1610,7 @@ void idRenderBackend::GetCurrentBindingLayout( int type ) } else { - desc[0].bindings[0].resourceHandle = paramCb; - desc[0].bindings[0].range = range; + desc[0].bindings[0] = uniformsBindingSetItem; desc[0].bindings[1].resourceHandle = ( nvrhi::ITexture* )GetImageAt( 0 )->GetTextureID(); desc[0].bindings[2].resourceHandle = ( nvrhi::ITexture* )GetImageAt( 1 )->GetTextureID(); desc[0].bindings[3].resourceHandle = ( nvrhi::ITexture* )GetImageAt( 2 )->GetTextureID(); diff --git a/neo/renderer/RenderProgs.h b/neo/renderer/RenderProgs.h index 41eb528438..dd638c525d 100644 --- a/neo/renderer/RenderProgs.h +++ b/neo/renderer/RenderProgs.h @@ -244,7 +244,7 @@ const idList rpMinimalSet1LayoutTypes = { BINDI const idList rpMinimalSet2 = { RENDERPARM_SCREENCORRECTIONFACTOR, RENDERPARM_WINDOWCOORD, RENDERPARM_DIFFUSEMODIFIER, RENDERPARM_JITTERTEXSCALE, RENDERPARM_JITTERTEXOFFSET }; -const idList rpMinimalSet2LayoutTypes = { BINDING_LAYOUT_POST_PROCESS_FINAL, BINDING_LAYOUT_POST_PROCESS_CRT }; +const idList rpMinimalSet2LayoutTypes = { BINDING_LAYOUT_POST_PROCESS_FINAL, BINDING_LAYOUT_POST_PROCESS_CRT, BINDING_LAYOUT_SMAA_EDGE_DETECTION, BINDING_LAYOUT_SMAA_WEIGHT_CALC }; // SRS - Try to limit rpNominalSets to 15 idVec4 entries (15*16 = 240 bytes) to fit within D3D12 root constant limit, otherwise 16 entries is the max for non-Apple Vulkan const idList rpNominalSet3 = { RENDERPARM_LOCALVIEWORIGIN, RENDERPARM_BUMPMATRIX_S, RENDERPARM_BUMPMATRIX_T, RENDERPARM_SPECULARMATRIX_S, RENDERPARM_SPECULARMATRIX_T, RENDERPARM_VERTEXCOLOR_MODULATE, RENDERPARM_VERTEXCOLOR_ADD, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_MODELMATRIX_X, RENDERPARM_MODELMATRIX_Y, RENDERPARM_MODELMATRIX_Z, RENDERPARM_PROJMATRIX_W, RENDERPARM_PSX_DISTORTIONS }; diff --git a/neo/shaders/builtin/post/SMAA.inc.hlsl b/neo/shaders/builtin/post/SMAA.inc.hlsl index 5caa87a195..ac3fca4a18 100644 --- a/neo/shaders/builtin/post/SMAA.inc.hlsl +++ b/neo/shaders/builtin/post/SMAA.inc.hlsl @@ -1,4 +1,4 @@ -/** +/** * Copyright (C) 2013 Jorge Jimenez (jorge@iryoku.com) * Copyright (C) 2013 Jose I. Echevarria (joseignacioechevarria@gmail.com) * Copyright (C) 2013 Belen Masia (bmasia@unizar.es) @@ -296,7 +296,7 @@ */ // RB begin -#define SMAA_RT_METRICS rpScreenCorrectionFactor +#define SMAA_RT_METRICS pc.rpScreenCorrectionFactor #define SMAA_PRESET_HIGH // RB end diff --git a/neo/shaders/builtin/post/SMAA_blending_weight_calc.ps.hlsl b/neo/shaders/builtin/post/SMAA_blending_weight_calc.ps.hlsl index d3dff3f34c..467bed69d0 100644 --- a/neo/shaders/builtin/post/SMAA_blending_weight_calc.ps.hlsl +++ b/neo/shaders/builtin/post/SMAA_blending_weight_calc.ps.hlsl @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet1.inc.hlsl" +#include "renderParmSet2.inc.hlsl" #define SMAA_INCLUDE_VS 0 diff --git a/neo/shaders/builtin/post/SMAA_blending_weight_calc.vs.hlsl b/neo/shaders/builtin/post/SMAA_blending_weight_calc.vs.hlsl index 5ab2975176..3d484ef0b6 100644 --- a/neo/shaders/builtin/post/SMAA_blending_weight_calc.vs.hlsl +++ b/neo/shaders/builtin/post/SMAA_blending_weight_calc.vs.hlsl @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet1.inc.hlsl" +#include "renderParmSet2.inc.hlsl" #define SMAA_INCLUDE_VS 1 diff --git a/neo/shaders/builtin/post/SMAA_edge_detection.ps.hlsl b/neo/shaders/builtin/post/SMAA_edge_detection.ps.hlsl index 7f612b855b..eada2a043a 100644 --- a/neo/shaders/builtin/post/SMAA_edge_detection.ps.hlsl +++ b/neo/shaders/builtin/post/SMAA_edge_detection.ps.hlsl @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet1.inc.hlsl" +#include "renderParmSet2.inc.hlsl" #define SMAA_INCLUDE_VS 0 diff --git a/neo/shaders/builtin/post/SMAA_edge_detection.vs.hlsl b/neo/shaders/builtin/post/SMAA_edge_detection.vs.hlsl index 715096978b..68d10a6c5e 100644 --- a/neo/shaders/builtin/post/SMAA_edge_detection.vs.hlsl +++ b/neo/shaders/builtin/post/SMAA_edge_detection.vs.hlsl @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet1.inc.hlsl" +#include "renderParmSet2.inc.hlsl" #define SMAA_INCLUDE_VS 1 diff --git a/neo/shaders/builtin/post/SMAA_final.ps.hlsl b/neo/shaders/builtin/post/SMAA_final.ps.hlsl index 3ad4c3417f..b35129c84c 100644 --- a/neo/shaders/builtin/post/SMAA_final.ps.hlsl +++ b/neo/shaders/builtin/post/SMAA_final.ps.hlsl @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet1.inc.hlsl" +#include "renderParmSet2.inc.hlsl" #define SMAA_INCLUDE_VS 0 diff --git a/neo/shaders/builtin/post/SMAA_final.vs.hlsl b/neo/shaders/builtin/post/SMAA_final.vs.hlsl index e9b261bd8e..95ee0c8582 100644 --- a/neo/shaders/builtin/post/SMAA_final.vs.hlsl +++ b/neo/shaders/builtin/post/SMAA_final.vs.hlsl @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet1.inc.hlsl" +#include "renderParmSet2.inc.hlsl" #define SMAA_INCLUDE_VS 1 diff --git a/neo/shaders/builtin/post/screen.ps.hlsl b/neo/shaders/builtin/post/screen.ps.hlsl index 1a99a61ac6..d690a8f245 100644 --- a/neo/shaders/builtin/post/screen.ps.hlsl +++ b/neo/shaders/builtin/post/screen.ps.hlsl @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" -#include "renderParmSet1.inc.hlsl" +#include "renderParmSet12.inc.hlsl" // *INDENT-OFF* From aa94bfdc2075cee85b3be08ee5ef4fd918bde723 Mon Sep 17 00:00:00 2001 From: SRSaunders <82544213+SRSaunders@users.noreply.github.com> Date: Sun, 8 Dec 2024 22:05:55 -0500 Subject: [PATCH 13/15] Add bumpyenvironment2 shader and octahedron cube layout types to push constant subset mapping --- neo/renderer/NVRHI/RenderBackend_NVRHI.cpp | 11 +-- neo/renderer/NVRHI/RenderProgs_NVRHI.cpp | 9 ++ neo/renderer/RenderProgs.cpp | 14 ++- neo/renderer/RenderProgs.h | 6 ++ neo/shaders/CMakeLists.txt | 2 +- .../builtin/legacy/bumpyenvironment2.ps.hlsl | 95 ++++++++++--------- .../builtin/legacy/bumpyenvironment2.vs.hlsl | 51 +++++----- neo/shaders/renderParmSet14.inc.hlsl | 83 ++++++++++++++++ 8 files changed, 190 insertions(+), 81 deletions(-) create mode 100644 neo/shaders/renderParmSet14.inc.hlsl diff --git a/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp b/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp index 3bc2a32b94..944f99e49d 100644 --- a/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp +++ b/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp @@ -1790,16 +1790,14 @@ void idRenderBackend::GetCurrentBindingLayout( int type ) { desc[0].bindings = { - nvrhi::BindingSetItem::ConstantBuffer( 0, paramCb, range ), + uniformsBindingSetItem, nvrhi::BindingSetItem::StructuredBuffer_SRV( 11, currentJointBuffer, nvrhi::Format::UNKNOWN, nvrhi::BufferRange( currentJointOffset, sizeof( idVec4 ) * numBoneMatrices ) ) }; } else { auto& bindings = desc[0].bindings; - bindings[0].resourceHandle = paramCb; - bindings[0].range = range; - + bindings[0] = uniformsBindingSetItem; bindings[1].resourceHandle = currentJointBuffer; bindings[1].range = nvrhi::BufferRange{ currentJointOffset, sizeof( idVec4 )* numBoneMatrices }; } @@ -1810,13 +1808,12 @@ void idRenderBackend::GetCurrentBindingLayout( int type ) { desc[0].bindings = { - nvrhi::BindingSetItem::ConstantBuffer( 0, paramCb, range ), + uniformsBindingSetItem, }; } else { - desc[0].bindings[0].resourceHandle = paramCb; - desc[0].bindings[0].range = range; + desc[0].bindings[0] = uniformsBindingSetItem; } } diff --git a/neo/renderer/NVRHI/RenderProgs_NVRHI.cpp b/neo/renderer/NVRHI/RenderProgs_NVRHI.cpp index 0bce7cb88c..cd285bdebf 100644 --- a/neo/renderer/NVRHI/RenderProgs_NVRHI.cpp +++ b/neo/renderer/NVRHI/RenderProgs_NVRHI.cpp @@ -506,6 +506,15 @@ void idRenderProgManager::SelectUniforms( renderParmSet_t* renderParmSet, int bi break; } + case renderParmSet14: + { + for( int i = 0; i < rpMaximalSet14.Num(); i++ ) + { + memcpy( &renderParmSet->maximalSet[i], &uniforms[rpMaximalSet14[i]], sizeof( idVec4 ) ); + } + break; + } + case renderParmNullSet: default: { diff --git a/neo/renderer/RenderProgs.cpp b/neo/renderer/RenderProgs.cpp index a4fd41ce74..0b8792f224 100644 --- a/neo/renderer/RenderProgs.cpp +++ b/neo/renderer/RenderProgs.cpp @@ -206,7 +206,8 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) rpMaximalSet10.Num() * sizeof( idVec4 ) > sizeof( rpMaximalSet ) || rpMaximalSet11.Num() * sizeof( idVec4 ) > sizeof( rpMaximalSet ) || rpNominalSet12.Num() * sizeof( idVec4 ) > sizeof( rpNominalSet ) || - rpNominalSet13.Num() * sizeof( idVec4 ) > sizeof( rpNominalSet ) ) + rpNominalSet13.Num() * sizeof( idVec4 ) > sizeof( rpNominalSet ) || + rpMaximalSet14.Num() * sizeof( idVec4 ) > sizeof( rpMaximalSet ) ) { common->FatalError( "Renderparm subset sizes exceed push constant buffer sizes" ); } @@ -369,6 +370,17 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) renderParmLayoutTypes[rpNominalSet13[i]].AddUnique( ( bindingLayoutType_t )layoutType ); } } + else if( rpMaximalSet14LayoutTypes.Find( ( bindingLayoutType_t )layoutType ) ) + { + layoutTypeAttributes[layoutType].rpSubSet = renderParmSet14; + layoutTypeAttributes[layoutType].rpBufSize = rpMaximalSet14.Num() * sizeof( idVec4 ); + layoutTypeAttributes[layoutType].cbStatic = false; + + for( int i = 0; i < rpMaximalSet14.Num(); i++ ) + { + renderParmLayoutTypes[rpMaximalSet14[i]].AddUnique( ( bindingLayoutType_t )layoutType ); + } + } else { layoutTypeAttributes[layoutType].rpSubSet = renderParmNullSet; diff --git a/neo/renderer/RenderProgs.h b/neo/renderer/RenderProgs.h index 168632a838..5ceffe9e4d 100644 --- a/neo/renderer/RenderProgs.h +++ b/neo/renderer/RenderProgs.h @@ -224,6 +224,7 @@ enum renderParmSubSet_t renderParmSet11, renderParmSet12, renderParmSet13, + renderParmSet14, renderParmNullSet }; @@ -301,6 +302,11 @@ const idList rpNominalSet13 = { RENDERPARM_SCREENCORRE const idList rpNominalSet13LayoutTypes = { BINDING_LAYOUT_POST_PROCESS_FINAL2, BINDING_LAYOUT_DRAW_AO, BINDING_LAYOUT_DRAW_AO1 }; +// SRS - rpMaximalSets have more than 16 idVec4 entries (>16*16 = 256 bytes) and are useful for MoltenVK on Apple platforms where the push constant limit is 4096 bytes +const idList rpMaximalSet14 = { RENDERPARM_WINDOWCOORD, RENDERPARM_LOCALLIGHTORIGIN, RENDERPARM_LOCALVIEWORIGIN, RENDERPARM_COLOR, RENDERPARM_GLOBALEYEPOS, RENDERPARM_MVPMATRIX_X, RENDERPARM_MVPMATRIX_Y, RENDERPARM_MVPMATRIX_Z, RENDERPARM_MVPMATRIX_W, RENDERPARM_MODELMATRIX_X, RENDERPARM_MODELMATRIX_Y, RENDERPARM_MODELMATRIX_Z, RENDERPARM_MODELMATRIX_W, RENDERPARM_PROJMATRIX_Z, RENDERPARM_PROJMATRIX_W, RENDERPARM_MODELVIEWMATRIX_X, RENDERPARM_MODELVIEWMATRIX_Y, RENDERPARM_MODELVIEWMATRIX_Z, RENDERPARM_WOBBLESKY_X, RENDERPARM_WOBBLESKY_Y, RENDERPARM_WOBBLESKY_Z, RENDERPARM_GLOBALLIGHTORIGIN, RENDERPARM_JITTERTEXSCALE, RENDERPARM_PSX_DISTORTIONS, RENDERPARM_SHADOW_MATRIX_0_X, RENDERPARM_SHADOW_MATRIX_0_Y, RENDERPARM_SHADOW_MATRIX_0_Z, RENDERPARM_SHADOW_MATRIX_0_W, RENDERPARM_SHADOW_MATRIX_1_X, RENDERPARM_SHADOW_MATRIX_1_Y, RENDERPARM_SHADOW_MATRIX_1_Z, RENDERPARM_SHADOW_MATRIX_1_W }; + +const idList rpMaximalSet14LayoutTypes = { BINDING_LAYOUT_OCTAHEDRON_CUBE, BINDING_LAYOUT_OCTAHEDRON_CUBE_SKINNED }; + enum rpStage_t { SHADER_STAGE_VERTEX = BIT( 0 ), diff --git a/neo/shaders/CMakeLists.txt b/neo/shaders/CMakeLists.txt index c33994eb50..6e81a44fee 100644 --- a/neo/shaders/CMakeLists.txt +++ b/neo/shaders/CMakeLists.txt @@ -1,6 +1,6 @@ include(../compileshaders.cmake) -file(GLOB globalshaders "BRDF.inc.hlsl" "global_inc.hlsl" "vulkan.hlsli" "renderParmSet0.inc.hlsl" "renderParmSet1.inc.hlsl" "renderParmSet2.inc.hlsl" "renderParmSet3.inc.hlsl" "renderParmSet4.inc.hlsl" "renderParmSet5.inc.hlsl" "renderParmSet6.inc.hlsl" "renderParmSet7.inc.hlsl" "renderParmSet8.inc.hlsl" "renderParmSet9.inc.hlsl" "renderParmSet10.inc.hlsl" "renderParmSet11.inc.hlsl" "renderParmSet12.inc.hlsl" "renderParmSet13.inc.hlsl") +file(GLOB globalshaders "BRDF.inc.hlsl" "global_inc.hlsl" "vulkan.hlsli" "renderParmSet0.inc.hlsl" "renderParmSet1.inc.hlsl" "renderParmSet2.inc.hlsl" "renderParmSet3.inc.hlsl" "renderParmSet4.inc.hlsl" "renderParmSet5.inc.hlsl" "renderParmSet6.inc.hlsl" "renderParmSet7.inc.hlsl" "renderParmSet8.inc.hlsl" "renderParmSet9.inc.hlsl" "renderParmSet10.inc.hlsl" "renderParmSet11.inc.hlsl" "renderParmSet12.inc.hlsl" "renderParmSet13.inc.hlsl" "renderParmSet14.inc.hlsl") file(GLOB builtins "builtin/*.hlsl") file(GLOB debug "builtin/debug/*hlsl") file(GLOB fog "builtin/fog/*hlsl") diff --git a/neo/shaders/builtin/legacy/bumpyenvironment2.ps.hlsl b/neo/shaders/builtin/legacy/bumpyenvironment2.ps.hlsl index 5b4e13445e..02e9d36cdb 100644 --- a/neo/shaders/builtin/legacy/bumpyenvironment2.ps.hlsl +++ b/neo/shaders/builtin/legacy/bumpyenvironment2.ps.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet14.inc.hlsl" // *INDENT-OFF* @@ -66,20 +67,20 @@ float3 ReconstructPositionCS( int2 hitPixel ) // Load returns 0 for any value accessed out of bounds float depth = texelFetch( t_Depth, hitPixel, 0 ).r; - float2 uv = hitPixel * rpWindowCoord.xy; + float2 uv = hitPixel * pc.rpWindowCoord.xy; // derive clip space from the depth buffer and screen position float3 ndc = float3( uv.x * 2.0 - 1.0, 1.0 - uv.y * 2.0, depth ); - float clipW = -rpProjectionMatrixZ.w / ( -rpProjectionMatrixZ.z - ndc.z ); + float clipW = -pc.rpProjectionMatrixZ.w / ( -pc.rpProjectionMatrixZ.z - ndc.z ); float4 clip = float4( ndc * clipW, clipW ); // camera space position float4 csP; - csP.x = dot4( rpShadowMatrices[0], clip ); - csP.y = dot4( rpShadowMatrices[1], clip ); - csP.z = dot4( rpShadowMatrices[2], clip ); - csP.w = dot4( rpShadowMatrices[3], clip ); + csP.x = dot4( pc.rpShadowMatrices[0], clip ); + csP.y = dot4( pc.rpShadowMatrices[1], clip ); + csP.z = dot4( pc.rpShadowMatrices[2], clip ); + csP.w = dot4( pc.rpShadowMatrices[3], clip ); csP.xyz /= csP.w; //csP.z = abs( csP.z ); // this is still negative Z like for OpenGL @@ -169,16 +170,16 @@ bool TraceScreenSpaceRay( // Project into homogeneous clip space float4 ray4D = float4( rayStart, 1.0 ); float4 H0; - H0.x = dot4( ray4D, rpShadowMatrices[4] ); - H0.y = dot4( ray4D, rpShadowMatrices[5] ); - H0.z = dot4( ray4D, rpShadowMatrices[6] ); - H0.w = dot4( ray4D, rpShadowMatrices[7] ); + H0.x = dot4( ray4D, pc.rpShadowMatrices[4] ); + H0.y = dot4( ray4D, pc.rpShadowMatrices[5] ); + H0.z = dot4( ray4D, pc.rpShadowMatrices[6] ); + H0.w = dot4( ray4D, pc.rpShadowMatrices[7] ); float4 H1; - H1.x = dot4( rayEnd, rpShadowMatrices[4] ); - H1.y = dot4( rayEnd, rpShadowMatrices[5] ); - H1.z = dot4( rayEnd, rpShadowMatrices[6] ); - H1.w = dot4( rayEnd, rpShadowMatrices[7] ); + H1.x = dot4( rayEnd, pc.rpShadowMatrices[4] ); + H1.y = dot4( rayEnd, pc.rpShadowMatrices[5] ); + H1.z = dot4( rayEnd, pc.rpShadowMatrices[6] ); + H1.w = dot4( rayEnd, pc.rpShadowMatrices[7] ); float k0 = 1.0f / H0.w; float k1 = 1.0f / H1.w; @@ -284,8 +285,8 @@ bool TraceScreenSpaceRay( // You may need hitPixel.y = depthBufferSize.y - hitPixel.y; here if your vertical axis // is different than ours in screen space - //hitPixel.x = rpWindowCoord.z - hitPixel.x; - //hitPixel.y = rpWindowCoord.w - hitPixel.y; + //hitPixel.x = pc.rpWindowCoord.z - hitPixel.x; + //hitPixel.y = pc.rpWindowCoord.w - hitPixel.y; sceneZMax = ReconstructPositionCS( hitPixel ).z; } @@ -328,7 +329,7 @@ void main( PS_IN fragment, out PS_OUT result ) globalNormal.y = dot3( localNormal, fragment.texcoord3 ); globalNormal.z = dot3( localNormal, fragment.texcoord4 ); - float3 screenNormalWS = ( ( 2.0 * t_ScreenNormals.Sample( s_LinearClamp, fragment.position.xy * rpWindowCoord.xy ).rgb ) - 1.0 ); + float3 screenNormalWS = ( ( 2.0 * t_ScreenNormals.Sample( s_LinearClamp, fragment.position.xy * pc.rpWindowCoord.xy ).rgb ) - 1.0 ); // https://blog.selfshadow.com/publications/blending-in-detail/ @@ -341,7 +342,7 @@ void main( PS_IN fragment, out PS_OUT result ) float3 globalPosition = fragment.texcoord5.xyz; - float3 globalView = normalize( globalPosition - rpGlobalEyePos.xyz ); + float3 globalView = normalize( globalPosition - pc.rpGlobalEyePos.xyz ); float3 reflectionVector = reflect( globalView, globalNormal ); reflectionVector = normalize( reflectionVector ); @@ -356,39 +357,39 @@ void main( PS_IN fragment, out PS_OUT result ) // parallax box correction using portal area bounds float hitScale = 0.0; float3 bounds[2]; - bounds[0].x = rpWobbleSkyX.x; - bounds[0].y = rpWobbleSkyX.y; - bounds[0].z = rpWobbleSkyX.z; + bounds[0].x = pc.rpWobbleSkyX.x; + bounds[0].y = pc.rpWobbleSkyX.y; + bounds[0].z = pc.rpWobbleSkyX.z; - bounds[1].x = rpWobbleSkyY.x; - bounds[1].y = rpWobbleSkyY.y; - bounds[1].z = rpWobbleSkyY.z; + bounds[1].x = pc.rpWobbleSkyY.x; + bounds[1].y = pc.rpWobbleSkyY.y; + bounds[1].z = pc.rpWobbleSkyY.z; // we can't start inside the box so move this outside and use the reverse path rayStart += reflectionVector * 10000.0; // only do a box <-> ray intersection test if we use a local cubemap - if( ( rpWobbleSkyX.w > 0.0 ) && AABBRayIntersection( bounds, rayStart, -reflectionVector, hitScale ) ) + if( ( pc.rpWobbleSkyX.w > 0.0 ) && AABBRayIntersection( bounds, rayStart, -reflectionVector, hitScale ) ) { float3 hitPoint = rayStart - reflectionVector * hitScale; - // rpWobbleSkyZ is cubemap center + // pc.rpWobbleSkyZ is cubemap center #if 1 - reflectionVector = hitPoint - rpWobbleSkyZ.xyz; + reflectionVector = hitPoint - pc.rpWobbleSkyZ.xyz; octCoord0 = octCoord1 = octCoord2 = GetSampleVector( reflectionVector ); #else // this should look better but only works in the case all 3 probes are in this area bbox - octCoord0 = GetSampleVector( hitPoint - rpTexGen0S.xyz ); - octCoord1 = GetSampleVector( hitPoint - rpTexGen0T.xyz ); - octCoord2 = GetSampleVector( hitPoint - rpTexGen0Q.xyz ); + octCoord0 = GetSampleVector( hitPoint - pc.rpTexGen0S.xyz ); + octCoord1 = GetSampleVector( hitPoint - pc.rpTexGen0T.xyz ); + octCoord2 = GetSampleVector( hitPoint - pc.rpTexGen0Q.xyz ); #endif } #endif const float mip = 0; - float3 radiance = t_RadianceCubeMap1.SampleLevel( s_LinearClamp, octCoord0, mip ).rgb * rpLocalLightOrigin.x; - radiance += t_RadianceCubeMap2.SampleLevel( s_LinearClamp, octCoord1, mip ).rgb * rpLocalLightOrigin.y; - radiance += t_RadianceCubeMap3.SampleLevel( s_LinearClamp, octCoord2, mip ).rgb * rpLocalLightOrigin.z; + float3 radiance = t_RadianceCubeMap1.SampleLevel( s_LinearClamp, octCoord0, mip ).rgb * pc.rpLocalLightOrigin.x; + radiance += t_RadianceCubeMap2.SampleLevel( s_LinearClamp, octCoord1, mip ).rgb * pc.rpLocalLightOrigin.y; + radiance += t_RadianceCubeMap3.SampleLevel( s_LinearClamp, octCoord2, mip ).rgb * pc.rpLocalLightOrigin.z; #if 1 // Screen Space Reflections @@ -397,10 +398,10 @@ void main( PS_IN fragment, out PS_OUT result ) float3 viewNormal; - // TODO this should be rpViewMatrixX - viewNormal.x = dot3( rpModelViewMatrixX, globalNormal ); - viewNormal.y = dot3( rpModelViewMatrixY, globalNormal ); - viewNormal.z = dot3( rpModelViewMatrixZ, globalNormal ); + // TODO this should be pc.rpViewMatrixX + viewNormal.x = dot3( pc.rpModelViewMatrixX, globalNormal ); + viewNormal.y = dot3( pc.rpModelViewMatrixY, globalNormal ); + viewNormal.z = dot3( pc.rpModelViewMatrixZ, globalNormal ); rayStart = ReconstructPositionCS( fragment.position.xy ); @@ -412,7 +413,7 @@ void main( PS_IN fragment, out PS_OUT result ) // use forward vector instead of V to avoid bending float vDotR = ( dot3( float3( 0, 0, 1 ), reflectionVector ) ); - const float maxSteps = rpJitterTexScale.x; + const float maxSteps = pc.rpJitterTexScale.x; float2 hitPixel; float3 hitPoint; @@ -422,9 +423,9 @@ void main( PS_IN fragment, out PS_OUT result ) float jitter = 1.0; //jitter = ( int( fragment.position.x + fragment.position.y) & 1 ) * 0.5; // like in the paper but sucks jitter = InterleavedGradientNoise( fragment.position.xy ); - //jitter = InterleavedGradientNoiseAnim( fragment.position.xy, rpJitterTexOffset.w ); + //jitter = InterleavedGradientNoiseAnim( fragment.position.xy, pc.rpJitterTexOffset.w ); - jitter = lerp( 1.0, jitter, rpGlobalLightOrigin.w ); + jitter = lerp( 1.0, jitter, pc.rpGlobalLightOrigin.w ); // using the same jitter on probe fallback to make it seamless // looks kinda bad because on close ups you don't want to see the noise @@ -435,20 +436,20 @@ void main( PS_IN fragment, out PS_OUT result ) intersection = TraceScreenSpaceRay( rayStart, rayDir, - rpGlobalLightOrigin.z, // zThickness 0.5 - rpGlobalLightOrigin.x, // stride + pc.rpGlobalLightOrigin.z, // zThickness 0.5 + pc.rpGlobalLightOrigin.x, // stride jitter, // jitter maxSteps, // max steps - rpGlobalLightOrigin.y * METERS_TO_DOOM, // max Distance + pc.rpGlobalLightOrigin.y * METERS_TO_DOOM, // max Distance hitPixel, hitPoint, rayDebug ); } - float2 delta = ( hitPixel * rpWindowCoord.xy ) - ( fragment.position.xy * rpWindowCoord.xy ); + float2 delta = ( hitPixel * pc.rpWindowCoord.xy ) - ( fragment.position.xy * pc.rpWindowCoord.xy ); float deltaLen = length( delta ); - if( ( hitPixel.x > rpWindowCoord.z || hitPixel.x < 0.0 || hitPixel.y > rpWindowCoord.w || hitPixel.y < 0.0 ) ) + if( ( hitPixel.x > pc.rpWindowCoord.z || hitPixel.x < 0.0 || hitPixel.y > pc.rpWindowCoord.w || hitPixel.y < 0.0 ) ) { intersection = false; } @@ -456,13 +457,13 @@ void main( PS_IN fragment, out PS_OUT result ) if( intersection ) { radiance = float3( 0, 1, 0 ); - radiance = t_ScreenColor.Sample( s_LinearClamp, hitPixel * rpWindowCoord.xy ).rgb; + radiance = t_ScreenColor.Sample( s_LinearClamp, hitPixel * pc.rpWindowCoord.xy ).rgb; //radiance = float3( delta, 0 ); //radiance = float3( 0, deltaLen, 0 ); //radiance = rayDebug / maxSteps; - //radiance = float3( hitPixel * rpWindowCoord.xy, 0 ); + //radiance = float3( hitPixel * pc.rpWindowCoord.xy, 0 ); } else { diff --git a/neo/shaders/builtin/legacy/bumpyenvironment2.vs.hlsl b/neo/shaders/builtin/legacy/bumpyenvironment2.vs.hlsl index 1bf569f8fa..42a993638a 100644 --- a/neo/shaders/builtin/legacy/bumpyenvironment2.vs.hlsl +++ b/neo/shaders/builtin/legacy/bumpyenvironment2.vs.hlsl @@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms */ #include "global_inc.hlsl" +#include "renderParmSet14.inc.hlsl" // *INDENT-OFF* #if USE_GPU_SKINNING @@ -126,20 +127,20 @@ void main( VS_IN vertex, out VS_OUT result ) float3 bitangent = vBitangent.xyz; #endif - result.position.x = dot4( modelPosition, rpMVPmatrixX ); - result.position.y = dot4( modelPosition, rpMVPmatrixY ); - result.position.z = dot4( modelPosition, rpMVPmatrixZ ); - result.position.w = dot4( modelPosition, rpMVPmatrixW ); + result.position.x = dot4( modelPosition, pc.rpMVPmatrixX ); + result.position.y = dot4( modelPosition, pc.rpMVPmatrixY ); + result.position.z = dot4( modelPosition, pc.rpMVPmatrixZ ); + result.position.w = dot4( modelPosition, pc.rpMVPmatrixW ); - result.position.xyz = psxVertexJitter( result.position ); + result.position.xyz = psxVertexJitter( pc.rpPSXDistortions, pc.rpProjectionMatrixW, result.position ); result.texcoord0 = vertex.texcoord.xy; // PSX affine texture mapping #if 0 - if( rpPSXDistortions.z > 0.0 ) + if( pc.rpPSXDistortions.z > 0.0 ) { - float distance = length( rpLocalViewOrigin - modelPosition ); + float distance = length( pc.rpLocalViewOrigin - modelPosition ); float warp = psxAffineWarp( distance ); result.texcoord0.z = warp; @@ -149,31 +150,31 @@ void main( VS_IN vertex, out VS_OUT result ) } #endif - float4 toEye = rpLocalViewOrigin - modelPosition; + float4 toEye = pc.rpLocalViewOrigin - modelPosition; - result.texcoord1.x = dot3( toEye, rpModelMatrixX ); - result.texcoord1.y = dot3( toEye, rpModelMatrixY ); - result.texcoord1.z = dot3( toEye, rpModelMatrixZ ); + result.texcoord1.x = dot3( toEye, pc.rpModelMatrixX ); + result.texcoord1.y = dot3( toEye, pc.rpModelMatrixY ); + result.texcoord1.z = dot3( toEye, pc.rpModelMatrixZ ); // rotate from tangent space into world space - result.texcoord2.x = dot3( tangent, rpModelMatrixX ); - result.texcoord3.x = dot3( tangent, rpModelMatrixY ); - result.texcoord4.x = dot3( tangent, rpModelMatrixZ ); + result.texcoord2.x = dot3( tangent, pc.rpModelMatrixX ); + result.texcoord3.x = dot3( tangent, pc.rpModelMatrixY ); + result.texcoord4.x = dot3( tangent, pc.rpModelMatrixZ ); - result.texcoord2.y = dot3( bitangent, rpModelMatrixX ); - result.texcoord3.y = dot3( bitangent, rpModelMatrixY ); - result.texcoord4.y = dot3( bitangent, rpModelMatrixZ ); + result.texcoord2.y = dot3( bitangent, pc.rpModelMatrixX ); + result.texcoord3.y = dot3( bitangent, pc.rpModelMatrixY ); + result.texcoord4.y = dot3( bitangent, pc.rpModelMatrixZ ); - result.texcoord2.z = dot3( normal, rpModelMatrixX ); - result.texcoord3.z = dot3( normal, rpModelMatrixY ); - result.texcoord4.z = dot3( normal, rpModelMatrixZ ); + result.texcoord2.z = dot3( normal, pc.rpModelMatrixX ); + result.texcoord3.z = dot3( normal, pc.rpModelMatrixY ); + result.texcoord4.z = dot3( normal, pc.rpModelMatrixZ ); float4 worldPosition; - worldPosition.x = dot4( modelPosition, rpModelMatrixX ); - worldPosition.y = dot4( modelPosition, rpModelMatrixY ); - worldPosition.z = dot4( modelPosition, rpModelMatrixZ ); - worldPosition.w = dot4( modelPosition, rpModelMatrixW ); + worldPosition.x = dot4( modelPosition, pc.rpModelMatrixX ); + worldPosition.y = dot4( modelPosition, pc.rpModelMatrixY ); + worldPosition.z = dot4( modelPosition, pc.rpModelMatrixZ ); + worldPosition.w = dot4( modelPosition, pc.rpModelMatrixW ); result.texcoord5 = worldPosition; - result.color = rpColor; + result.color = pc.rpColor; } diff --git a/neo/shaders/renderParmSet14.inc.hlsl b/neo/shaders/renderParmSet14.inc.hlsl new file mode 100644 index 0000000000..144c0e6812 --- /dev/null +++ b/neo/shaders/renderParmSet14.inc.hlsl @@ -0,0 +1,83 @@ +/* +=========================================================================== + +Doom 3 BFG Edition GPL Source Code +Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. +Copyright (C) 2013-2020 Robert Beckebans + +This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). + +Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Doom 3 BFG Edition Source Code. If not, see . + +In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. + +If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. + +=========================================================================== +*/ + +#include "vulkan.hlsli" + +struct renderParmSet14_t +{ + float4 rpWindowCoord; + + float4 rpLocalLightOrigin; + float4 rpLocalViewOrigin; + + float4 rpColor; + float4 rpGlobalEyePos; + + float4 rpMVPmatrixX; + float4 rpMVPmatrixY; + float4 rpMVPmatrixZ; + float4 rpMVPmatrixW; + + float4 rpModelMatrixX; + float4 rpModelMatrixY; + float4 rpModelMatrixZ; + float4 rpModelMatrixW; + + float4 rpProjectionMatrixZ; + float4 rpProjectionMatrixW; + + float4 rpModelViewMatrixX; + float4 rpModelViewMatrixY; + float4 rpModelViewMatrixZ; + + float4 rpWobbleSkyX; + float4 rpWobbleSkyY; + float4 rpWobbleSkyZ; + + // RB begin + float4 rpGlobalLightOrigin; + float4 rpJitterTexScale; + float4 rpPSXDistortions; + + float4 rpShadowMatrices[2 * 4]; + // RB end +}; + +#if USE_PUSH_CONSTANTS + +VK_PUSH_CONSTANT ConstantBuffer pc : register( b0 ); + +#else + +cbuffer pc : register( b0 VK_DESCRIPTOR_SET( 0 ) ) +{ + renderParmSet14_t pc; +} + +#endif From e01f78024f4cb5cf36d9cad1ea105a644d5b949e Mon Sep 17 00:00:00 2001 From: SRSaunders <82544213+SRSaunders@users.noreply.github.com> Date: Sun, 19 Jan 2025 00:44:19 -0500 Subject: [PATCH 14/15] Restore logic for committing constant buffers on binding layout change --- neo/renderer/NVRHI/RenderBackend_NVRHI.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp b/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp index 944f99e49d..cbb0b41036 100644 --- a/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp +++ b/neo/renderer/NVRHI/RenderBackend_NVRHI.cpp @@ -478,9 +478,9 @@ void idRenderBackend::DrawElementsWithCounters( const drawSurf_t* surf, bool sha stateScissor = context.scissor; } - // SRS - don't check if binding layout type changed since it is already handled above and renderparm change detection - // logic is sufficient to control writing of the constant buffer / push constants for each binding layout type - if( renderProgManager.CommitConstantBuffer( commandList, false /*bindingLayoutType != prevBindingLayoutType*/ ) ) + // SRS - generate and commit a new volatile constant buffer if uniforms or binding layout type have changed + // - for push constants return change status only, uniforms will be written after set graphics state + if( renderProgManager.CommitConstantBuffer( commandList, bindingLayoutType != prevBindingLayoutType ) ) { if( deviceManager->GetGraphicsAPI() == nvrhi::GraphicsAPI::VULKAN ) { From 91e3a05fcbb551912094d850e9c7e024cebba32a Mon Sep 17 00:00:00 2001 From: SRSaunders <82544213+SRSaunders@users.noreply.github.com> Date: Sun, 19 Jan 2025 20:07:43 -0500 Subject: [PATCH 15/15] Work-around Vulkan GPU timeout errors by disabling PCs on x86 for select layout types --- neo/renderer/RenderProgs.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/neo/renderer/RenderProgs.cpp b/neo/renderer/RenderProgs.cpp index f79515c78e..c52d4495a5 100644 --- a/neo/renderer/RenderProgs.cpp +++ b/neo/renderer/RenderProgs.cpp @@ -391,6 +391,19 @@ void idRenderProgManager::Init( nvrhi::IDevice* device ) layoutTypeAttributes[layoutType].pcEnabled = layoutTypeAttributes[layoutType].rpBufSize <= deviceManager->m_DeviceParams.maxPushConstantSize; } +#if defined(USE_INTRINSICS_SSE) // USE_INTRINSICS_SSE is a portable proxy for x86 and is disabled when compiling or x-compiling to arm64 on macOS + if( deviceManager->GetGraphicsAPI() == nvrhi::GraphicsAPI::VULKAN ) + { + // SRS - FIXME: Disable Vulkan push constants for select layout types to reduce GPU Timeout Errors (seen on Intel/Linux and Intel/macOS) + // - Possibly due to exceeding pc buffer limits (nvrhi or driver) or imperfect logic for push constant uniforms change detection - TBD + // - Note these correspond to rpNominalSet3LayoutTypes and rpNominalSet4LayoutTypes for rpNominalSet3 and rpNominalSet4 renderparm sets + layoutTypeAttributes[BINDING_LAYOUT_GBUFFER].pcEnabled = false; + layoutTypeAttributes[BINDING_LAYOUT_GBUFFER_SKINNED].pcEnabled = false; + layoutTypeAttributes[BINDING_LAYOUT_TEXTURE].pcEnabled = false; + layoutTypeAttributes[BINDING_LAYOUT_TEXTURE_SKINNED].pcEnabled = false; + } +#endif + auto defaultLayoutDesc = nvrhi::BindingLayoutDesc() .setVisibility( nvrhi::ShaderType::Pixel ) .addItem( nvrhi::BindingLayoutItem::Texture_SRV( 0 ) );