mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-14 06:34:10 +00:00
Disabled HDR MSAA support in favor of SMAA
This commit is contained in:
parent
c4316b14a4
commit
08f28edfb0
6 changed files with 33 additions and 8 deletions
|
@ -100,6 +100,7 @@ void Framebuffer::Init()
|
|||
globalFramebuffers.hdrFBO = new Framebuffer( "_hdr", glConfig.nativeScreenWidth, glConfig.nativeScreenHeight );
|
||||
globalFramebuffers.hdrFBO->Bind();
|
||||
|
||||
#if defined(USE_HDR_MSAA)
|
||||
if( r_multiSamples.GetBool() )
|
||||
{
|
||||
globalFramebuffers.hdrFBO->AddColorBuffer( GL_RGBA16F, 0, r_multiSamples.GetInteger() );
|
||||
|
@ -109,6 +110,7 @@ void Framebuffer::Init()
|
|||
globalFramebuffers.hdrFBO->AttachImageDepth( GL_TEXTURE_2D_MULTISAMPLE, globalImages->currentDepthImage );
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
globalFramebuffers.hdrFBO->AddColorBuffer( GL_RGBA16F, 0 );
|
||||
globalFramebuffers.hdrFBO->AddDepthBuffer( GL_DEPTH24_STENCIL8 );
|
||||
|
@ -120,7 +122,7 @@ void Framebuffer::Init()
|
|||
globalFramebuffers.hdrFBO->Check();
|
||||
|
||||
// HDR no MSAA
|
||||
|
||||
#if defined(USE_HDR_MSAA)
|
||||
globalFramebuffers.hdrNonMSAAFBO = new Framebuffer( "_hdrNoMSAA", glConfig.nativeScreenWidth, glConfig.nativeScreenHeight );
|
||||
globalFramebuffers.hdrNonMSAAFBO->Bind();
|
||||
|
||||
|
@ -128,6 +130,7 @@ void Framebuffer::Init()
|
|||
globalFramebuffers.hdrNonMSAAFBO->AttachImage2D( GL_TEXTURE_2D, globalImages->currentRenderHDRImageNoMSAA, 0 );
|
||||
|
||||
globalFramebuffers.hdrNonMSAAFBO->Check();
|
||||
#endif
|
||||
|
||||
// HDR DOWNSCALE
|
||||
|
||||
|
@ -176,6 +179,7 @@ void Framebuffer::CheckFramebuffers()
|
|||
globalImages->currentRenderHDRImage->Resize( glConfig.nativeScreenWidth, glConfig.nativeScreenHeight );
|
||||
globalImages->currentDepthImage->Resize( glConfig.nativeScreenWidth, glConfig.nativeScreenHeight );
|
||||
|
||||
#if defined(USE_HDR_MSAA)
|
||||
if( r_multiSamples.GetBool() )
|
||||
{
|
||||
globalImages->currentRenderHDRImageNoMSAA->Resize( glConfig.nativeScreenWidth, glConfig.nativeScreenHeight );
|
||||
|
@ -189,6 +193,7 @@ void Framebuffer::CheckFramebuffers()
|
|||
globalFramebuffers.hdrNonMSAAFBO->height = glConfig.nativeScreenHeight;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
globalFramebuffers.hdrFBO->Bind();
|
||||
globalFramebuffers.hdrFBO->AttachImage2D( GL_TEXTURE_2D, globalImages->currentRenderHDRImage, 0 );
|
||||
|
@ -222,25 +227,25 @@ void Framebuffer::CheckFramebuffers()
|
|||
}
|
||||
|
||||
// SMAA
|
||||
|
||||
|
||||
globalImages->smaaEdgesImage->Resize( glConfig.nativeScreenWidth, glConfig.nativeScreenHeight );
|
||||
|
||||
|
||||
globalFramebuffers.smaaEdgesFBO->width = glConfig.nativeScreenWidth / 4;
|
||||
globalFramebuffers.smaaEdgesFBO->height = glConfig.nativeScreenHeight / 4;
|
||||
|
||||
|
||||
globalFramebuffers.smaaEdgesFBO->Bind();
|
||||
globalFramebuffers.smaaEdgesFBO->AttachImage2D( GL_TEXTURE_2D, globalImages->smaaEdgesImage, 0 );
|
||||
globalFramebuffers.smaaEdgesFBO->Check();
|
||||
|
||||
|
||||
globalImages->smaaBlendImage->Resize( glConfig.nativeScreenWidth, glConfig.nativeScreenHeight );
|
||||
|
||||
|
||||
globalFramebuffers.smaaBlendFBO->width = glConfig.nativeScreenWidth / 4;
|
||||
globalFramebuffers.smaaBlendFBO->height = glConfig.nativeScreenHeight / 4;
|
||||
|
||||
|
||||
globalFramebuffers.smaaBlendFBO->Bind();
|
||||
globalFramebuffers.smaaBlendFBO->AttachImage2D( GL_TEXTURE_2D, globalImages->smaaBlendImage, 0 );
|
||||
globalFramebuffers.smaaBlendFBO->Check();
|
||||
|
||||
|
||||
Unbind();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,7 +121,9 @@ struct globalFramebuffers_t
|
|||
{
|
||||
Framebuffer* shadowFBO[MAX_SHADOWMAP_RESOLUTIONS];
|
||||
Framebuffer* hdrFBO;
|
||||
#if defined(USE_HDR_MSAA)
|
||||
Framebuffer* hdrNonMSAAFBO;
|
||||
#endif
|
||||
// Framebuffer* hdrQuarterFBO;
|
||||
Framebuffer* hdr64FBO;
|
||||
Framebuffer* bloomRenderFBO[MAX_BLOOM_BUFFERS];
|
||||
|
|
|
@ -352,7 +352,9 @@ public:
|
|||
idImage* grainImage1;
|
||||
idImage* randomImage256;
|
||||
idImage* currentRenderHDRImage;
|
||||
#if defined(USE_HDR_MSAA)
|
||||
idImage* currentRenderHDRImageNoMSAA;
|
||||
#endif
|
||||
idImage* currentRenderHDRImageQuarter;
|
||||
idImage* currentRenderHDRImage64;
|
||||
idImage* bloomRender[2];
|
||||
|
|
|
@ -163,7 +163,11 @@ static void R_RGBA8LinearImage( idImage* image )
|
|||
static void R_DepthImage( idImage* image )
|
||||
{
|
||||
// RB: NULL data and MSAA support
|
||||
#if defined(USE_HDR_MSAA)
|
||||
int msaaSamples = r_multiSamples.GetInteger();
|
||||
#else
|
||||
int msaaSamples = 0;
|
||||
#endif
|
||||
image->GenerateImage( NULL, glConfig.nativeScreenWidth, glConfig.nativeScreenHeight, TF_NEAREST, TR_CLAMP, TD_DEPTH, msaaSamples );
|
||||
// RB end
|
||||
}
|
||||
|
@ -171,7 +175,11 @@ static void R_DepthImage( idImage* image )
|
|||
// RB begin
|
||||
static void R_HDR_RGBA16FImage_ResNative( idImage* image )
|
||||
{
|
||||
#if defined(USE_HDR_MSAA)
|
||||
int msaaSamples = r_multiSamples.GetInteger();
|
||||
#else
|
||||
int msaaSamples = 0;
|
||||
#endif
|
||||
image->GenerateImage( NULL, glConfig.nativeScreenWidth, glConfig.nativeScreenHeight, TF_NEAREST, TR_CLAMP, TD_RGBA16F, msaaSamples );
|
||||
}
|
||||
|
||||
|
@ -833,7 +841,9 @@ void idImageManager::CreateIntrinsicImages()
|
|||
randomImage256 = globalImages->ImageFromFunction( "_random256", R_CreateRandom256Image );
|
||||
|
||||
currentRenderHDRImage = globalImages->ImageFromFunction( "_currentRenderHDR", R_HDR_RGBA16FImage_ResNative );
|
||||
#if defined(USE_HDR_MSAA)
|
||||
currentRenderHDRImageNoMSAA = globalImages->ImageFromFunction( "_currentRenderHDRNoMSAA", R_HDR_RGBA16FImage_ResNative_NoMSAA );
|
||||
#endif
|
||||
currentRenderHDRImageQuarter = globalImages->ImageFromFunction( "_currentRenderHDRQuarter", R_HDR_RGBA16FImage_ResQuarter );
|
||||
currentRenderHDRImage64 = globalImages->ImageFromFunction( "_currentRenderHDR64", R_HDR_RGBA16FImage_Res64 );
|
||||
|
||||
|
|
|
@ -729,6 +729,7 @@ void idImage::CopyFramebuffer( int x, int y, int imageWidth, int imageHeight )
|
|||
|
||||
//if( backEnd.glState.currentFramebuffer != NULL && backEnd.glState.currentFramebuffer->IsMultiSampled() )
|
||||
|
||||
#if defined(USE_HDR_MSAA)
|
||||
if( globalFramebuffers.hdrFBO->IsMultiSampled() )
|
||||
{
|
||||
glBindFramebuffer( GL_READ_FRAMEBUFFER, globalFramebuffers.hdrFBO->GetFramebuffer() );
|
||||
|
@ -745,6 +746,7 @@ void idImage::CopyFramebuffer( int x, int y, int imageWidth, int imageHeight )
|
|||
globalFramebuffers.hdrFBO->Bind();
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
glCopyTexImage2D( target, 0, GL_RGBA16F, x, y, imageWidth, imageHeight, 0 );
|
||||
}
|
||||
|
|
|
@ -4267,11 +4267,13 @@ static void RB_Tonemap( const viewDef_t* viewDef )
|
|||
|
||||
GL_SelectTexture( 0 );
|
||||
|
||||
#if defined(USE_HDR_MSAA)
|
||||
if( r_multiSamples.GetInteger() > 0 )
|
||||
{
|
||||
globalImages->currentRenderHDRImageNoMSAA->Bind();
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
globalImages->currentRenderHDRImage->Bind();
|
||||
}
|
||||
|
@ -4672,6 +4674,7 @@ void RB_DrawViewInternal( const viewDef_t* viewDef, const int stereoEye )
|
|||
GL_LINEAR );
|
||||
*/
|
||||
|
||||
#if defined(USE_HDR_MSAA)
|
||||
if( r_multiSamples.GetInteger() > 0 )
|
||||
{
|
||||
glBindFramebuffer( GL_READ_FRAMEBUFFER, globalFramebuffers.hdrFBO->GetFramebuffer() );
|
||||
|
@ -4690,6 +4693,7 @@ void RB_DrawViewInternal( const viewDef_t* viewDef, const int stereoEye )
|
|||
GL_LINEAR );
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
glBindFramebuffer( GL_READ_FRAMEBUFFER_EXT, globalFramebuffers.hdrFBO->GetFramebuffer() );
|
||||
glBindFramebuffer( GL_DRAW_FRAMEBUFFER_EXT, globalFramebuffers.hdr64FBO->GetFramebuffer() );
|
||||
|
|
Loading…
Reference in a new issue