mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-15 07:00:58 +00:00
Mars City 1 works, disabled Binding/Sample Caches
This commit is contained in:
parent
59349e88f3
commit
274766f5d5
7 changed files with 57 additions and 43 deletions
|
@ -39,7 +39,7 @@ nvrhi::BindingSetHandle BindingCache::GetCachedBindingSet( const nvrhi::BindingS
|
|||
|
||||
nvrhi::BindingSetHandle BindingCache::GetOrCreateBindingSet( const nvrhi::BindingSetDesc& desc, nvrhi::IBindingLayout* layout )
|
||||
{
|
||||
#if 1
|
||||
#if 0
|
||||
size_t hash = 0;
|
||||
nvrhi::hash_combine( hash, desc );
|
||||
nvrhi::hash_combine( hash, layout );
|
||||
|
|
|
@ -723,7 +723,7 @@ void idRenderBackend::GetCurrentBindingLayout( nvrhi::BindingSetDesc& bindingSet
|
|||
bindingSetDesc
|
||||
.addItem( nvrhi::BindingSetItem::ConstantBuffer( 0, renderProgManager.ConstantBuffer() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 0, ( nvrhi::ITexture* )GetImageAt( 0 )->GetTextureID() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 0, ( nvrhi::ISampler* )GetImageAt( 0 )->GetSampler( samplerCache ) ) );
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 0, commonPasses.m_AnisotropicWrapSampler ) );
|
||||
}
|
||||
else if( renderProgManager.BindingLayoutType() == BINDING_LAYOUT_GBUFFER )
|
||||
{
|
||||
|
@ -753,10 +753,11 @@ void idRenderBackend::GetCurrentBindingLayout( nvrhi::BindingSetDesc& bindingSet
|
|||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 0, ( nvrhi::ITexture* )GetImageAt( 0 )->GetTextureID() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 1, ( nvrhi::ITexture* )GetImageAt( 1 )->GetTextureID() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 2, ( nvrhi::ITexture* )GetImageAt( 2 )->GetTextureID() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 0, ( nvrhi::ISampler* )GetImageAt( 0 )->GetSampler( samplerCache ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 1, ( nvrhi::ISampler* )GetImageAt( 1 )->GetSampler( samplerCache ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 2, ( nvrhi::ISampler* )GetImageAt( 2 )->GetSampler( samplerCache ) ) );
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 0, commonPasses.m_LinearClampSampler ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 1, commonPasses.m_LinearClampSampler ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 2, commonPasses.m_PointWrapSampler ) ); // blue noise
|
||||
}
|
||||
/*
|
||||
else if( renderProgManager.BindingLayoutType() == BINDING_LAYOUT_DRAW_AO1 )
|
||||
{
|
||||
bindingSetDesc
|
||||
|
@ -764,6 +765,7 @@ void idRenderBackend::GetCurrentBindingLayout( nvrhi::BindingSetDesc& bindingSet
|
|||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 0, ( nvrhi::ITexture* )GetImageAt( 0 )->GetTextureID() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 0, ( nvrhi::ISampler* )GetImageAt( 0 )->GetSampler( samplerCache ) ) );
|
||||
}
|
||||
*/
|
||||
else if( renderProgManager.BindingLayoutType() == BINDING_LAYOUT_DRAW_INTERACTION )
|
||||
{
|
||||
bindingSetDesc
|
||||
|
@ -789,7 +791,8 @@ void idRenderBackend::GetCurrentBindingLayout( nvrhi::BindingSetDesc& bindingSet
|
|||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 6, ( nvrhi::ITexture* )GetImageAt( 6 )->GetTextureID() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 0, commonPasses.m_AnisotropicWrapSampler ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 1, commonPasses.m_LinearClampSampler ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 2, commonPasses.m_LinearClampCompareSampler ) );
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 2, commonPasses.m_LinearClampCompareSampler ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 3, commonPasses.m_PointWrapSampler ) ); // blue noise
|
||||
}
|
||||
else if( renderProgManager.BindingLayoutType() == BINDING_LAYOUT_DRAW_FOG )
|
||||
{
|
||||
|
@ -797,8 +800,8 @@ void idRenderBackend::GetCurrentBindingLayout( nvrhi::BindingSetDesc& bindingSet
|
|||
.addItem( nvrhi::BindingSetItem::ConstantBuffer( 0, renderProgManager.ConstantBuffer() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 0, ( nvrhi::ITexture* )GetImageAt( 0 )->GetTextureID() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 1, ( nvrhi::ITexture* )GetImageAt( 1 )->GetTextureID() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 0, ( nvrhi::ISampler* )GetImageAt( 0 )->GetSampler( samplerCache ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 1, ( nvrhi::ISampler* )GetImageAt( 1 )->GetSampler( samplerCache ) ) );
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 0, commonPasses.m_LinearClampSampler ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 1, commonPasses.m_LinearClampSampler ) );
|
||||
}
|
||||
else if( renderProgManager.BindingLayoutType() == BINDING_LAYOUT_POST_PROCESS_CNM )
|
||||
{
|
||||
|
@ -806,8 +809,8 @@ void idRenderBackend::GetCurrentBindingLayout( nvrhi::BindingSetDesc& bindingSet
|
|||
.addItem( nvrhi::BindingSetItem::ConstantBuffer( 0, renderProgManager.ConstantBuffer() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 0, ( nvrhi::ITexture* )GetImageAt( 0 )->GetTextureID() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 1, ( nvrhi::ITexture* )GetImageAt( 1 )->GetTextureID() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 2, ( nvrhi::ITexture* )GetImageAt( 1 )->GetTextureID() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 0, ( nvrhi::ISampler* )GetImageAt( 0 )->GetSampler( samplerCache ) ) );
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 2, ( nvrhi::ITexture* )GetImageAt( 2 )->GetTextureID() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 0, commonPasses.m_LinearClampSampler ) );
|
||||
}
|
||||
else if( renderProgManager.BindingLayoutType() == BINDING_LAYOUT_NORMAL_CUBE )
|
||||
{
|
||||
|
@ -866,8 +869,9 @@ void idRenderBackend::GL_EndFrame()
|
|||
|
||||
void idRenderBackend::GL_EndRenderPass()
|
||||
{
|
||||
#if 0//defined( USE_NVRHI )
|
||||
#if defined( USE_NVRHI )
|
||||
commandList->close();
|
||||
|
||||
deviceManager->GetDevice()->executeCommandList( commandList );
|
||||
|
||||
bindingCache.Clear();
|
||||
|
|
|
@ -3767,6 +3767,7 @@ void idRenderBackend::DrawInteractions( const viewDef_t* _viewDef )
|
|||
// go back from light view to default camera view
|
||||
ResetViewportAndScissorToDefaultCamera( _viewDef );
|
||||
|
||||
GL_EndRenderPass();
|
||||
if( vLight->localInteractions != NULL )
|
||||
{
|
||||
renderLog.OpenBlock( "Local Light Interactions", colorPurple );
|
||||
|
|
|
@ -191,8 +191,8 @@ void idRenderProgManager::Init( nvrhi::IDevice* _device )
|
|||
.addItem( nvrhi::BindingLayoutItem::Texture_SRV( 8 ) ) // radiance cube map 1
|
||||
.addItem( nvrhi::BindingLayoutItem::Texture_SRV( 9 ) ) // radiance cube map 2
|
||||
.addItem( nvrhi::BindingLayoutItem::Texture_SRV( 10 ) ) // radiance cube map 3
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 0 ) ) // (Wrap) Anisotropic sampler: normal sampler & specular sampler
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 1 ) ); // (Clamp) Linear sampler: brdf lut sampler & ssao sampler
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 0 ) ) // (Wrap) Anisotropic sampler: normal sampler & specular sampler
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 1 ) ); // (Clamp) Linear sampler: brdf lut sampler & ssao sampler
|
||||
|
||||
bindingLayouts[BINDING_LAYOUT_AMBIENT_LIGHTING_IBL] = device->createBindingLayout( ambientIblLayoutDesc );
|
||||
|
||||
|
@ -245,9 +245,10 @@ void idRenderProgManager::Init( nvrhi::IDevice* _device )
|
|||
.addItem( nvrhi::BindingLayoutItem::Texture_SRV( 4 ) ) // light projection
|
||||
.addItem( nvrhi::BindingLayoutItem::Texture_SRV( 5 ) ) // shadow map array
|
||||
.addItem( nvrhi::BindingLayoutItem::Texture_SRV( 6 ) ) // jitter
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 0 ) )
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 1 ) )
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 2 ) );
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 0 ) ) // material
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 1 ) ) // lighting
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 2 ) ) // shadow compare
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 3 ) ); // blue noise for shadow jitter
|
||||
|
||||
bindingLayouts[BINDING_LAYOUT_DRAW_INTERACTION_SM] = device->createBindingLayout( interactionSmBindingLayout );
|
||||
|
||||
|
|
|
@ -28,19 +28,18 @@ If you have questions concerning this license or the applicable additional terms
|
|||
*/
|
||||
|
||||
#include "global_inc.hlsl"
|
||||
|
||||
#include "BRDF.inc.hlsl"
|
||||
|
||||
|
||||
// *INDENT-OFF*
|
||||
Texture2D t_Normal : register( t0 );
|
||||
Texture2D t_Specular : register( t1 );
|
||||
Texture2D t_BaseColor : register( t2 );
|
||||
Texture2D t_LightFalloff : register( t3 );
|
||||
Texture2D t_LightProjection : register( t4 );
|
||||
Texture2D t_Normal : register( t0 );
|
||||
Texture2D t_Specular : register( t1 );
|
||||
Texture2D t_BaseColor : register( t2 );
|
||||
Texture2D t_LightFalloff : register( t3 );
|
||||
Texture2D t_LightProjection : register( t4 );
|
||||
|
||||
SamplerState AnisotropicWrapSampler : register(s0);
|
||||
SamplerState LinearClampSampler : register( s1 );
|
||||
SamplerState s_Material : register( s0 ); // for the normal/specular/basecolor
|
||||
SamplerState s_Lighting : register( s1 ); // for sampling the jitter
|
||||
|
||||
struct PS_IN
|
||||
{
|
||||
|
@ -63,11 +62,11 @@ struct PS_OUT
|
|||
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
half4 bumpMap = t_Normal.Sample( AnisotropicWrapSampler, fragment.texcoord1.xy );
|
||||
half4 lightFalloff = idtex2Dproj( LinearClampSampler, t_LightFalloff, fragment.texcoord2 );
|
||||
half4 lightProj = idtex2Dproj( LinearClampSampler, t_LightProjection, fragment.texcoord3 );
|
||||
half4 YCoCG = t_BaseColor.Sample( AnisotropicWrapSampler, fragment.texcoord4.xy );
|
||||
half4 specMapSRGB = t_Specular.Sample( AnisotropicWrapSampler, fragment.texcoord5.xy );
|
||||
half4 bumpMap = t_Normal.Sample( s_Material, fragment.texcoord1.xy );
|
||||
half4 lightFalloff = idtex2Dproj( s_Lighting, t_LightFalloff, fragment.texcoord2 );
|
||||
half4 lightProj = idtex2Dproj( s_Lighting, t_LightProjection, fragment.texcoord3 );
|
||||
half4 YCoCG = t_BaseColor.Sample( s_Material, fragment.texcoord4.xy );
|
||||
half4 specMapSRGB = t_Specular.Sample( s_Material, fragment.texcoord5.xy );
|
||||
half4 specMap = sRGBAToLinearRGBA( specMapSRGB );
|
||||
|
||||
half3 lightVector = normalize( fragment.texcoord0.xyz );
|
||||
|
@ -112,7 +111,7 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
// values in a very narrow range (~0.02 - 0.08)
|
||||
|
||||
// approximate non-metals with linear RGB 0.04 which is 0.08 * 0.5 (default in UE4)
|
||||
const half3 dielectricColor = half3( 0.04, 0.04, 0.04 );
|
||||
const half3 dielectricColor = _half3( 0.04 );
|
||||
|
||||
// derive diffuse and specular from albedo(m) base color
|
||||
const half3 baseColor = diffuseMap;
|
||||
|
|
|
@ -41,9 +41,10 @@ Texture2D t_LightProjection : register( t4 );
|
|||
Texture2DArray<float> t_ShadowMapArray : register( t5 );
|
||||
Texture2D t_Jitter : register( t6 );
|
||||
|
||||
SamplerState samp0 : register(s0); // for the normal/specular/color/light fall/light projection textures
|
||||
SamplerState samp1 : register(s1); // for sampling the jitter
|
||||
SamplerComparisonState samp2 : register(s2); // for the depth shadow map sampler with a compare function
|
||||
SamplerState s_Material : register( s0 ); // for the normal/specular/basecolor
|
||||
SamplerState s_Lighting : register( s1 ); // for sampling the jitter
|
||||
SamplerComparisonState s_Shadow : register( s2 ); // for the depth shadow map sampler with a compare function
|
||||
SamplerState s_Jitter : register( s3 ); // for sampling the jitter
|
||||
|
||||
struct PS_IN
|
||||
{
|
||||
|
@ -71,7 +72,7 @@ float BlueNoise( float2 n, float x )
|
|||
{
|
||||
float2 uv = n.xy * rpJitterTexOffset.xy;
|
||||
|
||||
float noise = t_Jitter.Sample( samp1, uv ).r;
|
||||
float noise = t_Jitter.Sample( s_Jitter, uv ).r;
|
||||
|
||||
noise = frac( noise + c_goldenRatioConjugate * rpJitterTexOffset.w * x );
|
||||
|
||||
|
@ -96,11 +97,11 @@ float2 VogelDiskSample( float sampleIndex, float samplesCount, float phi )
|
|||
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
half4 bumpMap = t_Normal.Sample( samp0, fragment.texcoord1.xy );
|
||||
half4 lightFalloff = idtex2Dproj( samp1, t_LightFalloff, fragment.texcoord2 );
|
||||
half4 lightProj = idtex2Dproj( samp1, t_LightProjection, fragment.texcoord3 );
|
||||
half4 YCoCG = t_BaseColor.Sample( samp0, fragment.texcoord4.xy );
|
||||
half4 specMapSRGB = t_Specular.Sample( samp0, fragment.texcoord5.xy );
|
||||
half4 bumpMap = t_Normal.Sample( s_Material, fragment.texcoord1.xy );
|
||||
half4 lightFalloff = idtex2Dproj( s_Lighting, t_LightFalloff, fragment.texcoord2 );
|
||||
half4 lightProj = idtex2Dproj( s_Lighting, t_LightProjection, fragment.texcoord3 );
|
||||
half4 YCoCG = t_BaseColor.Sample( s_Material, fragment.texcoord4.xy );
|
||||
half4 specMapSRGB = t_Specular.Sample( s_Material, fragment.texcoord5.xy );
|
||||
half4 specMap = sRGBAToLinearRGBA( specMapSRGB );
|
||||
|
||||
half3 lightVector = normalize( fragment.texcoord0.xyz );
|
||||
|
@ -288,7 +289,7 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
float stepSize = 1.0 / numSamples;
|
||||
|
||||
float4 jitterTC = ( fragment.position * rpScreenCorrectionFactor ) + rpJitterTexOffset;
|
||||
float4 random = t_Jitter.Sample( samp1, jitterTC.xy ) * PI;
|
||||
float4 random = t_Jitter.Sample( s_Jitter, jitterTC.xy ) * PI;
|
||||
//float4 random = fragment.position;
|
||||
|
||||
float2 rot;
|
||||
|
@ -357,7 +358,7 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
|
||||
float4 shadowTexcoordJittered = float4( shadowTexcoord.xy + jitterRotated * shadowTexelSize, shadowTexcoord.z, shadowTexcoord.w );
|
||||
|
||||
shadow += idtex2Dproj( samp1, t_ShadowMapArray, shadowTexcoordJittered.xywz );
|
||||
shadow += idtex2Dproj( s_Shadow, t_ShadowMapArray, shadowTexcoordJittered.xywz );
|
||||
}
|
||||
|
||||
shadow *= stepSize;
|
||||
|
@ -385,7 +386,7 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
|
||||
float4 shadowTexcoordJittered = float4( shadowTexcoord.xy + jitter * shadowTexelSize, shadowTexcoord.z, shadowTexcoord.w );
|
||||
|
||||
shadow += t_ShadowMapArray.SampleCmpLevelZero( samp2, shadowTexcoordJittered.xyw, shadowTexcoordJittered.z );
|
||||
shadow += t_ShadowMapArray.SampleCmpLevelZero( s_Shadow, shadowTexcoordJittered.xyw, shadowTexcoordJittered.z );
|
||||
}
|
||||
|
||||
shadow *= stepSize;
|
||||
|
|
|
@ -140,7 +140,15 @@ void main(
|
|||
else
|
||||
{
|
||||
// Tonemapping curve is applied after exposure.
|
||||
// Gamma correction is done by rendering to an sRGB render target.
|
||||
o_rgba.rgb = ACESFilm( o_rgba.rgb );
|
||||
}
|
||||
|
||||
#if 0
|
||||
// Gamma correction since we are not rendering to an sRGB render target.
|
||||
const float hdrGamma = 2.2;
|
||||
float gamma = 1.0 / hdrGamma;
|
||||
o_rgba.r = pow( o_rgba.r, gamma );
|
||||
o_rgba.g = pow( o_rgba.g, gamma );
|
||||
o_rgba.b = pow( o_rgba.b, gamma );
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue