mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-14 06:34:10 +00:00
TAA is working. Fixed wrong output resolution
This commit is contained in:
parent
d078ada2d8
commit
6cd2b98491
17 changed files with 135 additions and 66 deletions
|
@ -513,7 +513,7 @@ void R_SetupProjectionMatrix( viewDef_t* viewDef )
|
|||
const int viewWidth = viewDef->viewport.x2 - viewDef->viewport.x1 + 1;
|
||||
const int viewHeight = viewDef->viewport.y2 - viewDef->viewport.y1 + 1;
|
||||
|
||||
#if 1
|
||||
#if 0
|
||||
jitterx = jitterx * width / viewWidth;
|
||||
jitterx += r_centerX.GetFloat();
|
||||
jitterx += viewDef->renderView.stereoScreenSeparation;
|
||||
|
@ -528,9 +528,9 @@ void R_SetupProjectionMatrix( viewDef_t* viewDef )
|
|||
const float yoffset = ( ymax + ymin ) / height;
|
||||
|
||||
#else
|
||||
// better for TAA: https://alextardif.com/TAA.html
|
||||
const float xoffset = 1.0f * jitterx / viewWidth;
|
||||
const float yoffset = 1.0f * jittery / viewHeight;
|
||||
// according to https://www.elopezr.com/temporal-aa-and-the-quest-for-the-holy-trail/
|
||||
const float xoffset = jitterx / ( 2.0f * viewWidth );
|
||||
const float yoffset = jittery / ( 2.0f * viewHeight );
|
||||
#endif
|
||||
|
||||
// RB: IMPORTANT - the projectionMatrix has a few changes to make it work with Vulkan
|
||||
|
|
|
@ -115,15 +115,6 @@ enum textureFormat_t
|
|||
|
||||
int BitsForFormat( textureFormat_t format );
|
||||
|
||||
enum textureSamples_t
|
||||
{
|
||||
SAMPLE_1 = BIT( 0 ),
|
||||
SAMPLE_2 = BIT( 1 ),
|
||||
SAMPLE_4 = BIT( 2 ),
|
||||
SAMPLE_8 = BIT( 3 ),
|
||||
SAMPLE_16 = BIT( 4 )
|
||||
};
|
||||
|
||||
/*
|
||||
================================================
|
||||
DXT5 color formats
|
||||
|
@ -160,7 +151,7 @@ public:
|
|||
textureType_t textureType;
|
||||
textureFormat_t format;
|
||||
textureColor_t colorFormat;
|
||||
textureSamples_t samples;
|
||||
uint samples;
|
||||
int width;
|
||||
int height; // not needed for cube maps
|
||||
int numLevels; // if 0, will be 1 for NEAREST / LINEAR filters, otherwise based on size
|
||||
|
@ -179,7 +170,7 @@ ID_INLINE idImageOpts::idImageOpts()
|
|||
{
|
||||
format = FMT_NONE;
|
||||
colorFormat = CFM_DEFAULT;
|
||||
samples = SAMPLE_1;
|
||||
samples = 1;
|
||||
width = 0;
|
||||
height = 0;
|
||||
numLevels = 0;
|
||||
|
@ -462,7 +453,7 @@ public:
|
|||
nvrhi::ICommandList* commandList,
|
||||
bool isRenderTarget = false,
|
||||
bool isUAV = false,
|
||||
textureSamples_t samples = SAMPLE_1,
|
||||
uint sampleCount = 1,
|
||||
cubeFiles_t cubeFiles = CF_2D );
|
||||
|
||||
void GenerateCubeImage( const byte* pic[6], int size,
|
||||
|
@ -667,6 +658,7 @@ public:
|
|||
idImage* alphaNotchImage; // 2x1 texture with just 1110 and 1111 with point sampling
|
||||
idImage* whiteImage; // full of 0xff
|
||||
idImage* blackImage; // full of 0x00
|
||||
idImage* blackDiffuseImage; // full of 0x00
|
||||
idImage* cyanImage; // cyan
|
||||
idImage* noFalloffImage; // all 255, but zero clamped
|
||||
idImage* fogImage; // increasing alpha is denser fog
|
||||
|
|
|
@ -45,6 +45,25 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#define DEFAULT_SIZE 16
|
||||
|
||||
static uint GetMSAASamples()
|
||||
{
|
||||
switch( r_antiAliasing.GetInteger() )
|
||||
{
|
||||
case ANTI_ALIASING_MSAA_2X:
|
||||
return 2;
|
||||
|
||||
case ANTI_ALIASING_MSAA_4X:
|
||||
return 4;
|
||||
|
||||
case ANTI_ALIASING_MSAA_8X:
|
||||
return 8;
|
||||
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idImage::MakeDefault
|
||||
|
@ -142,6 +161,16 @@ static void R_BlackImage( idImage* image, nvrhi::ICommandList* commandList )
|
|||
TF_DEFAULT, TR_REPEAT, TD_DEFAULT, commandList );
|
||||
}
|
||||
|
||||
static void R_BlackDiffuseImage( idImage* image, nvrhi::ICommandList* commandList )
|
||||
{
|
||||
byte data[DEFAULT_SIZE][DEFAULT_SIZE][4];
|
||||
|
||||
// solid black texture
|
||||
memset( data, 0, sizeof( data ) );
|
||||
image->GenerateImage( ( byte* )data, DEFAULT_SIZE, DEFAULT_SIZE,
|
||||
TF_DEFAULT, TR_REPEAT, TD_DIFFUSE, commandList );
|
||||
}
|
||||
|
||||
static void R_CyanImage( idImage* image, nvrhi::ICommandList* commandList )
|
||||
{
|
||||
byte data[DEFAULT_SIZE][DEFAULT_SIZE][4];
|
||||
|
@ -224,22 +253,26 @@ static void R_RGBA8LinearImage( idImage* image, nvrhi::ICommandList* commandList
|
|||
|
||||
static void R_LdrNativeImage( idImage* image, nvrhi::ICommandList* commandList )
|
||||
{
|
||||
image->GenerateImage( NULL, renderSystem->GetWidth(), renderSystem->GetHeight(), TF_NEAREST, TR_CLAMP, TD_LOOKUP_TABLE_RGBA, nullptr, true );//, msaaSamples );
|
||||
//uint sampleCount = GetMSAASamples();
|
||||
|
||||
image->GenerateImage( NULL, renderSystem->GetWidth(), renderSystem->GetHeight(), TF_NEAREST, TR_CLAMP, TD_LOOKUP_TABLE_RGBA, nullptr, true, false, 1 );
|
||||
}
|
||||
|
||||
static void R_DepthImage( idImage* image, nvrhi::ICommandList* commandList )
|
||||
{
|
||||
// RB: NULL data and MSAA support
|
||||
#if defined(USE_HDR_MSAA)
|
||||
textureSamples_t msaaSamples = glConfig.multisamples;
|
||||
#else
|
||||
int msaaSamples = 0;
|
||||
#endif
|
||||
image->GenerateImage( NULL, renderSystem->GetWidth(), renderSystem->GetHeight(), TF_NEAREST, TR_CLAMP, TD_DEPTH_STENCIL, nullptr, true );//, msaaSamples );
|
||||
// RB end
|
||||
uint sampleCount = GetMSAASamples();
|
||||
|
||||
image->GenerateImage( NULL, renderSystem->GetWidth(), renderSystem->GetHeight(), TF_NEAREST, TR_CLAMP, TD_DEPTH_STENCIL, nullptr, true, false, sampleCount );
|
||||
}
|
||||
|
||||
// RB begin
|
||||
static void R_HDR_RGBA16FImage_ResNative_MSAAOpt( idImage* image, nvrhi::ICommandList* commandList )
|
||||
{
|
||||
uint sampleCount = GetMSAASamples();
|
||||
|
||||
image->GenerateImage( NULL, renderSystem->GetWidth(), renderSystem->GetHeight(), TF_NEAREST, TR_CLAMP, TD_RGBA16F, nullptr, true, sampleCount == 1, sampleCount );
|
||||
}
|
||||
|
||||
static void R_HDR_RGBA16FImage_ResNative( idImage* image, nvrhi::ICommandList* commandList )
|
||||
{
|
||||
image->GenerateImage( NULL, renderSystem->GetWidth(), renderSystem->GetHeight(), TF_NEAREST, TR_CLAMP, TD_RGBA16F, nullptr, true );
|
||||
|
@ -312,7 +345,9 @@ static void R_AmbientOcclusionImage_ResNative( idImage* image, nvrhi::ICommandLi
|
|||
|
||||
static void R_GeometryBufferImage_ResNative( idImage* image, nvrhi::ICommandList* commandList )
|
||||
{
|
||||
image->GenerateImage( NULL, renderSystem->GetWidth(), renderSystem->GetHeight(), TF_LINEAR, TR_CLAMP, TD_RGBA16F, nullptr, true );
|
||||
uint sampleCount = GetMSAASamples();
|
||||
|
||||
image->GenerateImage( NULL, renderSystem->GetWidth(), renderSystem->GetHeight(), TF_LINEAR, TR_CLAMP, TD_RGBA16F, nullptr, true, false, sampleCount );
|
||||
}
|
||||
|
||||
static void R_SSAOImage_ResHalf( idImage* image, nvrhi::ICommandList* commandList )
|
||||
|
@ -989,12 +1024,12 @@ static void R_CreateBrdfLutImage( idImage* image, nvrhi::ICommandList* commandLi
|
|||
|
||||
static void R_CreateEnvprobeImage_UAC_lobby_irradiance( idImage* image, nvrhi::ICommandList* commandList )
|
||||
{
|
||||
image->GenerateImage( ( byte* )IMAGE_ENV_UAC_LOBBY_AMB_H_Bytes, IMAGE_ENV_UAC_LOBBY_AMB_H_TEX_WIDTH, IMAGE_ENV_UAC_LOBBY_AMB_H_TEX_HEIGHT, TF_DEFAULT, TR_CLAMP, TD_R11G11B10F, commandList, false, false, SAMPLE_1, CF_2D_PACKED_MIPCHAIN );
|
||||
image->GenerateImage( ( byte* )IMAGE_ENV_UAC_LOBBY_AMB_H_Bytes, IMAGE_ENV_UAC_LOBBY_AMB_H_TEX_WIDTH, IMAGE_ENV_UAC_LOBBY_AMB_H_TEX_HEIGHT, TF_DEFAULT, TR_CLAMP, TD_R11G11B10F, commandList, false, false, 1, CF_2D_PACKED_MIPCHAIN );
|
||||
}
|
||||
|
||||
static void R_CreateEnvprobeImage_UAC_lobby_radiance( idImage* image, nvrhi::ICommandList* commandList )
|
||||
{
|
||||
image->GenerateImage( ( byte* )IMAGE_ENV_UAC_LOBBY_SPEC_H_Bytes, IMAGE_ENV_UAC_LOBBY_SPEC_H_TEX_WIDTH, IMAGE_ENV_UAC_LOBBY_SPEC_H_TEX_HEIGHT, TF_DEFAULT, TR_CLAMP, TD_R11G11B10F, commandList, false, false, SAMPLE_1, CF_2D_PACKED_MIPCHAIN );
|
||||
image->GenerateImage( ( byte* )IMAGE_ENV_UAC_LOBBY_SPEC_H_Bytes, IMAGE_ENV_UAC_LOBBY_SPEC_H_TEX_WIDTH, IMAGE_ENV_UAC_LOBBY_SPEC_H_TEX_HEIGHT, TF_DEFAULT, TR_CLAMP, TD_R11G11B10F, commandList, false, false, 1, CF_2D_PACKED_MIPCHAIN );
|
||||
}
|
||||
|
||||
// RB end
|
||||
|
@ -1011,6 +1046,7 @@ void idImageManager::CreateIntrinsicImages()
|
|||
defaultImage = ImageFromFunction( "_default", R_DefaultImage );
|
||||
whiteImage = ImageFromFunction( "_white", R_WhiteImage );
|
||||
blackImage = ImageFromFunction( "_black", R_BlackImage );
|
||||
blackDiffuseImage = ImageFromFunction( "_blackDiffuse", R_BlackDiffuseImage );
|
||||
cyanImage = ImageFromFunction( "_cyan", R_CyanImage );
|
||||
flatNormalMap = ImageFromFunction( "_flat", R_FlatNormalImage );
|
||||
alphaNotchImage = ImageFromFunction( "_alphaNotch", R_AlphaNotchImage );
|
||||
|
@ -1034,10 +1070,7 @@ void idImageManager::CreateIntrinsicImages()
|
|||
randomImage256 = globalImages->ImageFromFunction( "_random256", R_CreateRandom256Image );
|
||||
blueNoiseImage256 = globalImages->ImageFromFunction( "_blueNoise256", R_CreateBlueNoise256Image );
|
||||
|
||||
currentRenderHDRImage = globalImages->ImageFromFunction( "_currentRenderHDR", R_HDR_RGBA16FImage_ResNative );
|
||||
#if defined(USE_HDR_MSAA)
|
||||
currentRenderHDRImageNoMSAA = globalImages->ImageFromFunction( "_currentRenderHDRNoMSAA", R_HDR_RGBA16FImage_ResNative_NoMSAA );
|
||||
#endif
|
||||
currentRenderHDRImage = globalImages->ImageFromFunction( "_currentRenderHDR", R_HDR_RGBA16FImage_ResNative_MSAAOpt );
|
||||
currentRenderHDRImageQuarter = globalImages->ImageFromFunction( "_currentRenderHDRQuarter", R_HDR_RGBA16FImage_ResQuarter );
|
||||
currentRenderHDRImage64 = globalImages->ImageFromFunction( "_currentRenderHDR64", R_HDR_RGBA16FImage_Res64 );
|
||||
currentRenderLDR = globalImages->ImageFromFunction( "_currentRenderLDR", R_LdrNativeImage );
|
||||
|
|
|
@ -965,7 +965,7 @@ void idImage::Reload( bool force, nvrhi::ICommandList* commandList )
|
|||
GenerateImage
|
||||
================
|
||||
*/
|
||||
void idImage::GenerateImage( const byte* pic, int width, int height, textureFilter_t filterParm, textureRepeat_t repeatParm, textureUsage_t usageParm, nvrhi::ICommandList* commandList, bool isRenderTarget, bool isUAV, textureSamples_t samples, cubeFiles_t _cubeFiles )
|
||||
void idImage::GenerateImage( const byte* pic, int width, int height, textureFilter_t filterParm, textureRepeat_t repeatParm, textureUsage_t usageParm, nvrhi::ICommandList* commandList, bool isRenderTarget, bool isUAV, uint sampleCount, cubeFiles_t _cubeFiles )
|
||||
{
|
||||
PurgeImage();
|
||||
|
||||
|
@ -974,11 +974,11 @@ void idImage::GenerateImage( const byte* pic, int width, int height, textureFilt
|
|||
usage = usageParm;
|
||||
cubeFiles = _cubeFiles;
|
||||
|
||||
opts.textureType = ( samples > SAMPLE_1 ) ? TT_2D_MULTISAMPLE : TT_2D;
|
||||
opts.textureType = ( sampleCount > 1 ) ? TT_2D_MULTISAMPLE : TT_2D;
|
||||
opts.width = width;
|
||||
opts.height = height;
|
||||
opts.numLevels = 0;
|
||||
opts.samples = samples;
|
||||
opts.samples = sampleCount;
|
||||
opts.isRenderTarget = isRenderTarget;
|
||||
opts.isUAV = isUAV;
|
||||
|
||||
|
|
|
@ -162,8 +162,8 @@ void Framebuffer::ResizeFramebuffers()
|
|||
|
||||
globalFramebuffers.ldrFBO = new Framebuffer( "_ldr",
|
||||
nvrhi::FramebufferDesc()
|
||||
.addColorAttachment( globalImages->currentRenderLDR->texture )
|
||||
.setDepthAttachment( globalImages->currentDepthImage->texture ) );
|
||||
.addColorAttachment( globalImages->currentRenderLDR->texture ) );
|
||||
//.setDepthAttachment( globalImages->currentDepthImage->texture ) );
|
||||
|
||||
globalFramebuffers.hdrFBO = new Framebuffer( "_hdr",
|
||||
nvrhi::FramebufferDesc()
|
||||
|
|
|
@ -269,8 +269,17 @@ void idRenderBackend::DrawElementsWithCounters( const drawSurf_t* surf )
|
|||
}
|
||||
}
|
||||
|
||||
uint64_t stateBits = glStateBits;
|
||||
|
||||
if( currentFrameBuffer == globalFramebuffers.ldrFBO )
|
||||
{
|
||||
// make sure that FBO doesn't require a depth buffer
|
||||
stateBits |= GLS_DEPTHFUNC_ALWAYS | GLS_DEPTHMASK;
|
||||
stateBits &= ~( GLS_STENCIL_FUNC_BITS | GLS_STENCIL_OP_BITS );
|
||||
}
|
||||
|
||||
int program = renderProgManager.CurrentProgram();
|
||||
PipelineKey key{ glStateBits, program, depthBias, slopeScaleBias, currentFrameBuffer };
|
||||
PipelineKey key{ stateBits, program, depthBias, slopeScaleBias, currentFrameBuffer };
|
||||
auto pipeline = pipelineCache.GetOrCreatePipeline( key );
|
||||
|
||||
if( currentPipeline != pipeline )
|
||||
|
@ -1038,6 +1047,13 @@ void idRenderBackend::CheckCVars()
|
|||
//glDisable( GL_MULTISAMPLE );
|
||||
break;
|
||||
}
|
||||
|
||||
if( tr.IsInitialized() )
|
||||
{
|
||||
Framebuffer::ResizeFramebuffers();
|
||||
}
|
||||
|
||||
r_antiAliasing.ClearModified();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -43,16 +43,12 @@ TemporalAntiAliasingPass::TemporalAntiAliasingPass()
|
|||
|
||||
void TemporalAntiAliasingPass::Init(
|
||||
nvrhi::IDevice* device,
|
||||
//std::shared_ptr<ShaderFactory> shaderFactory,
|
||||
CommonRenderPasses* _commonPasses,
|
||||
const viewDef_t* viewDef,
|
||||
const CreateParameters& params )
|
||||
|
||||
{
|
||||
m_CommonPasses = _commonPasses;
|
||||
|
||||
//const IView* sampleView = compositeView.GetChildView( ViewType::PLANAR, 0 );
|
||||
|
||||
const nvrhi::TextureDesc& unresolvedColorDesc = params.unresolvedColor->getDesc();
|
||||
const nvrhi::TextureDesc& resolvedColorDesc = params.resolvedColor->getDesc();
|
||||
const nvrhi::TextureDesc& feedback1Desc = params.feedback1->getDesc();
|
||||
|
@ -99,16 +95,42 @@ void TemporalAntiAliasingPass::Init(
|
|||
//ResolveMacros.push_back( ShaderMacro( "USE_CATMULL_ROM_FILTER", params.useCatmullRomFilter ? "1" : "0" ) );
|
||||
//m_TemporalAntiAliasingCS = shaderFactory->CreateShader( "donut/passes/taa_cs.hlsl", "main", &ResolveMacros, nvrhi::ShaderType::Compute );
|
||||
|
||||
auto taaResolveShaderInfo = renderProgManager.GetProgramInfo( BUILTIN_TAA_RESOLVE );
|
||||
m_TemporalAntiAliasingCS = taaResolveShaderInfo.cs;
|
||||
switch( r_antiAliasing.GetInteger() )
|
||||
{
|
||||
case ANTI_ALIASING_MSAA_2X:
|
||||
{
|
||||
auto taaResolveShaderInfo = renderProgManager.GetProgramInfo( BUILTIN_TAA_RESOLVE_MSAA_2X );
|
||||
m_TemporalAntiAliasingCS = taaResolveShaderInfo.cs;
|
||||
break;
|
||||
}
|
||||
|
||||
case ANTI_ALIASING_MSAA_4X:
|
||||
{
|
||||
auto taaResolveShaderInfo = renderProgManager.GetProgramInfo( BUILTIN_TAA_RESOLVE_MSAA_4X );
|
||||
m_TemporalAntiAliasingCS = taaResolveShaderInfo.cs;
|
||||
break;
|
||||
}
|
||||
|
||||
case ANTI_ALIASING_MSAA_8X:
|
||||
{
|
||||
auto taaResolveShaderInfo = renderProgManager.GetProgramInfo( BUILTIN_TAA_RESOLVE_MSAA_8X );
|
||||
m_TemporalAntiAliasingCS = taaResolveShaderInfo.cs;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
auto taaResolveShaderInfo = renderProgManager.GetProgramInfo( BUILTIN_TAA_RESOLVE );
|
||||
m_TemporalAntiAliasingCS = taaResolveShaderInfo.cs;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
nvrhi::SamplerDesc samplerDesc;
|
||||
samplerDesc.addressU = samplerDesc.addressV = samplerDesc.addressW = nvrhi::SamplerAddressMode::Border;
|
||||
samplerDesc.borderColor = nvrhi::Color( 0.0f );
|
||||
m_BilinearSampler = device->createSampler( samplerDesc );
|
||||
|
||||
m_ResolvedColorSize = idVec2( float( resolvedColorDesc.width ), float( resolvedColorDesc.height ) );
|
||||
|
||||
nvrhi::BufferDesc constantBufferDesc;
|
||||
constantBufferDesc.byteSize = sizeof( TemporalAntiAliasingConstants );
|
||||
constantBufferDesc.debugName = "TemporalAntiAliasingConstants";
|
||||
|
@ -188,8 +210,6 @@ void TemporalAntiAliasingPass::Init(
|
|||
pipelineDesc.bindingLayouts = { m_ResolveBindingLayout };
|
||||
|
||||
m_ResolvePso = device->createComputePipeline( pipelineDesc );
|
||||
|
||||
//AdvanceFrame();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -264,7 +284,7 @@ void TemporalAntiAliasingPass::TemporalResolve(
|
|||
taaConstants.outputViewOrigin = idVec2( viewportOutput.minX, viewportOutput.minY );
|
||||
taaConstants.outputViewSize = idVec2( viewportOutput.width(), viewportOutput.height() );
|
||||
taaConstants.inputPixelOffset.Set( 0, 0 ); // TODO = viewInput->GetPixelOffset();
|
||||
taaConstants.outputTextureSizeInv = 1.0f / m_ResolvedColorSize;
|
||||
taaConstants.outputTextureSizeInv = 1.0f / idVec2( float( renderSystem->GetWidth() ), float( renderSystem->GetHeight() ) );
|
||||
taaConstants.inputOverOutputViewSize = taaConstants.inputViewSize / taaConstants.outputViewSize;
|
||||
taaConstants.outputOverInputViewSize = taaConstants.outputViewSize / taaConstants.inputViewSize;
|
||||
taaConstants.clampingFactor = params.enableHistoryClamping ? params.clampingFactor : -1.f;
|
||||
|
|
|
@ -104,7 +104,6 @@ private:
|
|||
|
||||
uint32_t m_FrameIndex;
|
||||
uint32_t m_StencilMask;
|
||||
idVec2 m_ResolvedColorSize;
|
||||
|
||||
idVec2 m_R2Jitter;
|
||||
|
||||
|
|
|
@ -987,11 +987,13 @@ void idRenderBackend::DrawSingleInteraction( drawInteraction_t* din, bool useFas
|
|||
return;
|
||||
}
|
||||
|
||||
if( din->diffuseImage == NULL || r_skipDiffuse.GetBool() )
|
||||
if( r_skipDiffuse.GetInteger() == 2 )
|
||||
{
|
||||
// this isn't a YCoCg black, but it doesn't matter, because
|
||||
// the diffuseColor will also be 0
|
||||
din->diffuseImage = globalImages->blackImage;
|
||||
din->diffuseImage = globalImages->whiteImage;
|
||||
}
|
||||
else if( din->diffuseImage == NULL || r_skipDiffuse.GetInteger() > 0 )
|
||||
{
|
||||
din->diffuseImage = globalImages->blackDiffuseImage;
|
||||
}
|
||||
if( din->specularImage == NULL || r_skipSpecular.GetBool() || ( din->vLight && din->vLight->lightShader->IsAmbientLight() ) )
|
||||
{
|
||||
|
@ -6089,7 +6091,7 @@ void idRenderBackend::DrawScreenSpaceAmbientOcclusion( const viewDef_t* _viewDef
|
|||
if( r_shadowMapRandomizeJitter.GetBool() )
|
||||
{
|
||||
jitterTexOffset[2] = Sys_Milliseconds() / 1000.0f;
|
||||
jitterTexOffset[3] = tr.frameCount % 256;
|
||||
jitterTexOffset[3] = tr.frameCount % 64;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -7383,7 +7385,7 @@ void idRenderBackend::PostProcess( const void* data )
|
|||
if( r_shadowMapRandomizeJitter.GetBool() )
|
||||
{
|
||||
jitterTexOffset[2] = Sys_Milliseconds() / 1000.0f;
|
||||
jitterTexOffset[3] = tr.frameCount % 256;
|
||||
jitterTexOffset[3] = tr.frameCount % 64;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -474,6 +474,9 @@ void idRenderProgManager::Init( nvrhi::IDevice* _device )
|
|||
{ BUILTIN_MOTION_BLUR, "builtin/post/motionBlur", "_vectors", { { "VECTORS_ONLY", "1" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_TAA_MOTION_VECTORS },
|
||||
//{ BUILTIN_TAA_MOTION_VECTORS, "builtin/post/motion_vectors", "", { { "USE_STENCIL", "0" }, { "QUAD_Z", "0" } }, false, SHADER_STAGE_DEFAULT, LAYOUT_UNKNOWN, 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 },
|
||||
|
|
|
@ -383,6 +383,9 @@ enum
|
|||
|
||||
BUILTIN_TAA_MOTION_VECTORS,
|
||||
BUILTIN_TAA_RESOLVE,
|
||||
BUILTIN_TAA_RESOLVE_MSAA_2X,
|
||||
BUILTIN_TAA_RESOLVE_MSAA_4X,
|
||||
BUILTIN_TAA_RESOLVE_MSAA_8X,
|
||||
|
||||
BUILTIN_AMBIENT_OCCLUSION,
|
||||
BUILTIN_AMBIENT_OCCLUSION_AND_OUTPUT,
|
||||
|
|
|
@ -155,7 +155,7 @@ idCVar r_skipDecals( "r_skipDecals", "0", CVAR_RENDERER | CVAR_BOOL, "skip decal
|
|||
idCVar r_skipOverlays( "r_skipOverlays", "0", CVAR_RENDERER | CVAR_BOOL, "skip overlay surfaces" );
|
||||
idCVar r_skipSpecular( "r_skipSpecular", "0", CVAR_RENDERER | CVAR_BOOL | CVAR_CHEAT | CVAR_ARCHIVE, "use black for specular1" );
|
||||
idCVar r_skipBump( "r_skipBump", "0", CVAR_RENDERER | CVAR_BOOL | CVAR_ARCHIVE, "uses a flat surface instead of the bump map" );
|
||||
idCVar r_skipDiffuse( "r_skipDiffuse", "0", CVAR_RENDERER | CVAR_BOOL, "use black for diffuse" );
|
||||
idCVar r_skipDiffuse( "r_skipDiffuse", "0", CVAR_RENDERER | CVAR_INTEGER, "use black for diffuse" );
|
||||
idCVar r_skipSubviews( "r_skipSubviews", "0", CVAR_RENDERER | CVAR_INTEGER, "1 = don't render any gui elements on surfaces" );
|
||||
idCVar r_skipGuiShaders( "r_skipGuiShaders", "0", CVAR_RENDERER | CVAR_INTEGER, "1 = skip all gui elements on surfaces, 2 = skip drawing but still handle events, 3 = draw but skip events", 0, 3, idCmdSystem::ArgCompletion_Integer<0, 3> );
|
||||
idCVar r_skipParticles( "r_skipParticles", "0", CVAR_RENDERER | CVAR_INTEGER, "1 = skip all particle systems", 0, 1, idCmdSystem::ArgCompletion_Integer<0, 1> );
|
||||
|
@ -336,7 +336,7 @@ idCVar r_useLightGrid( "r_useLightGrid", "1", CVAR_RENDERER | CVAR_BOOL, "" );
|
|||
idCVar r_exposure( "r_exposure", "0.5", CVAR_ARCHIVE | CVAR_RENDERER | CVAR_FLOAT, "HDR exposure or LDR brightness [-4.0 .. 4.0]", -4.0f, 4.0f );
|
||||
|
||||
idCVar r_useTemporalAA( "r_useTemporalAA", "1", CVAR_RENDERER | CVAR_BOOL, "only disable for debugging" );
|
||||
idCVar r_taaJitter( "r_taaJitter", "0", CVAR_RENDERER | CVAR_INTEGER, "0: None, 1: MSAA, 2: Halton, 3: R2 Sequence, 4: White Noise" );
|
||||
idCVar r_taaJitter( "r_taaJitter", "2", CVAR_RENDERER | CVAR_INTEGER, "0: None, 1: MSAA, 2: Halton, 3: R2 Sequence, 4: White Noise" );
|
||||
idCVar r_taaEnableHistoryClamping( "r_taaEnableHistoryClamping", "1", CVAR_RENDERER | CVAR_BOOL, "" );
|
||||
idCVar r_taaClampingFactor( "r_taaClampingFactor", "1.0", CVAR_RENDERER | CVAR_FLOAT, "" );
|
||||
idCVar r_taaNewFrameWeight( "r_taaNewFrameWeight", "0.1", CVAR_RENDERER | CVAR_FLOAT, "" );
|
||||
|
@ -450,7 +450,7 @@ void R_SetNewMode( const bool fullInit )
|
|||
break;
|
||||
|
||||
default:
|
||||
parms.multiSamples = 0;
|
||||
parms.multiSamples = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#define DIFFERENT_DEPTH_RESOLUTIONS 0
|
||||
#define USE_DEPTH_PEEL 0
|
||||
#define CS_Z_PACKED_TOGETHER 0
|
||||
#define TEMPORALLY_VARY_TAPS 0
|
||||
#define TEMPORALLY_VARY_TAPS 1
|
||||
#define HIGH_QUALITY 1
|
||||
#define USE_OCT16 0
|
||||
#define USE_MIPMAPS 1
|
||||
|
@ -118,7 +118,7 @@ float BlueNoise( float2 n, float x )
|
|||
float noise = t_BlueNoise.Sample( blueNoiseSampler, n.xy * rpJitterTexOffset.xy ).r;
|
||||
|
||||
#if TEMPORALLY_VARY_TAPS
|
||||
noise = frac( noise + 0.61803398875 * rpJitterTexOffset.z * x );
|
||||
noise = frac( noise + c_goldenRatioConjugate * rpJitterTexOffset.z * x );
|
||||
#else
|
||||
noise = frac( noise );
|
||||
#endif
|
||||
|
|
|
@ -485,9 +485,6 @@ float InterleavedGradientNoiseAnim( float2 uv, float frameIndex )
|
|||
return rnd;
|
||||
}
|
||||
|
||||
// RB: the golden ratio is useful to animate Blue noise
|
||||
#define GOLDEN_RATIO_CONJUGATE 0.61803398875
|
||||
|
||||
// RB: very efficient white noise without sine https://www.shadertoy.com/view/4djSRW
|
||||
#define HASHSCALE3 float3(443.897, 441.423, 437.195)
|
||||
|
||||
|
@ -546,7 +543,7 @@ static float3 ditherChromaticBlueNoise( float3 color, float2 n, SamplerState blu
|
|||
float3 noise = tex2D( blueTex, uv ).rgb;
|
||||
|
||||
// rpJitterTexOffset.w is frameTime % 64
|
||||
noise = frac( noise + GOLDEN_RATIO_CONJUGATE * rpJitterTexOffset.w );
|
||||
noise = frac( noise + c_goldenRatioConjugate * rpJitterTexOffset.w );
|
||||
|
||||
// triangular noise [-0.5;1.5[
|
||||
noise.x = RemapNoiseTriErp( noise.x );
|
||||
|
|
|
@ -76,7 +76,7 @@ builtin/post/tonemapping.ps.hlsl -T ps_5_0 -D HISTOGRAM_BINS=256 -D SOURCE_ARRAY
|
|||
builtin/post/tonemapping.vs.hlsl -T vs_5_0 -D HISTOGRAM_BINS=256 -D SOURCE_ARRAY={0,1} -D QUAD_Z={0,1}
|
||||
builtin/post/motion_vectors.vs.hlsl -T vs_5_0 -D USE_STENCIL=0 -D QUAD_Z={0,1}
|
||||
builtin/post/motion_vectors.ps.hlsl -T ps_5_0 -D USE_STENCIL=0 -D QUAD_Z={0,1}
|
||||
builtin/post/taa.cs.hlsl -T cs_5_0 -D SAMPLE_COUNT={1,2,4} -D USE_CATMULL_ROM_FILTER={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}
|
||||
|
|
|
@ -41,6 +41,7 @@ struct DeviceCreationParameters
|
|||
int windowPosY = -1;
|
||||
uint32_t backBufferWidth = 1280;
|
||||
uint32_t backBufferHeight = 720;
|
||||
uint32_t backBufferSampleCount = 1; // optional HDR Framebuffer MSAA
|
||||
uint32_t refreshRate = 0;
|
||||
uint32_t swapChainBufferCount = 3;
|
||||
nvrhi::Format swapChainFormat = nvrhi::Format::RGBA8_UNORM; // RB: don't do the sRGB gamma ramp with the swapchain
|
||||
|
|
|
@ -1125,6 +1125,7 @@ bool DeviceManager::CreateWindowDeviceAndSwapChain( const glimpParms_t& parms, c
|
|||
// RB
|
||||
deviceParms.backBufferWidth = parms.width;
|
||||
deviceParms.backBufferHeight = parms.height;
|
||||
deviceParms.backBufferSampleCount = parms.multiSamples;
|
||||
deviceParms.vsyncEnabled = requestedVSync;
|
||||
|
||||
if( !CreateDeviceAndSwapChain() )
|
||||
|
@ -1148,6 +1149,7 @@ void DeviceManager::UpdateWindowSize( const glimpParms_t& params )
|
|||
|
||||
if( int( deviceParms.backBufferWidth ) != params.width ||
|
||||
int( deviceParms.backBufferHeight ) != params.height ||
|
||||
int( deviceParms.backBufferSampleCount ) != params.multiSamples ||
|
||||
( deviceParms.vsyncEnabled != requestedVSync && GetGraphicsAPI() == nvrhi::GraphicsAPI::VULKAN ) )
|
||||
{
|
||||
// window is not minimized, and the size has changed
|
||||
|
@ -1156,6 +1158,7 @@ void DeviceManager::UpdateWindowSize( const glimpParms_t& params )
|
|||
|
||||
deviceParms.backBufferWidth = params.width;
|
||||
deviceParms.backBufferHeight = params.height;
|
||||
deviceParms.backBufferSampleCount = params.multiSamples;
|
||||
deviceParms.vsyncEnabled = requestedVSync;
|
||||
|
||||
ResizeSwapChain();
|
||||
|
|
Loading…
Reference in a new issue