fixed the reported selected MSAA sample counts for GL2/GL3

This commit is contained in:
myT 2022-12-04 01:02:37 +01:00
parent 69c1bee127
commit a7e87a065b
6 changed files with 20 additions and 6 deletions

View file

@ -91,6 +91,8 @@ chg: with r_backend GL3, depth fade with MSAA now requires GLSL 4.00 at a minimu
chg: with r_backend GL3, alpha to coverage now requires GLSL 4.00 at a minimum
fix: the reported MSAA sample counts for the GL2 and GL3 back-ends could be wrong
fix: registration of a read-only CVar would keep the existing value
fix: the Direct3D projection transform didn't perfectly match the OpenGL version

View file

@ -1833,6 +1833,7 @@ static qbool GAL_Init()
glInfo.depthFadeSupport = r_depthFade->integer == 1;
glInfo.mipGenSupport = mipGenOK;
glInfo.alphaToCoverageSupport = alphaToCoverageOK;
glInfo.msaaSampleCount = sampleDesc.Count;
if(fullInit)
{
@ -1881,8 +1882,6 @@ static qbool GAL_Init()
d3d.splitBufferOffsets = r_d3d11_syncOffsets->integer == D3D11SO_SPLITOFFSETS;
}
ri.Printf(PRINT_ALL, "MSAA: %d samples requested, %d selected\n", r_msaa->integer, sampleDesc.Count);
return qtrue;
}

View file

@ -501,6 +501,11 @@ static void GL2_CreateColorRenderBufferStorageMS( int* samples )
if ( errorCode != GL_NO_ERROR )
ri.Error( ERR_FATAL, "Failed to create multi-sampled render buffer storage (error 0x%X)\n", (unsigned int)errorCode );
GLint realSampleCount = 0;
glGetRenderbufferParameteriv( GL_RENDERBUFFER, GL_RENDERBUFFER_SAMPLES, &realSampleCount );
if ( glGetError() == GL_NO_ERROR && realSampleCount > 0 )
sampleCount = realSampleCount;
*samples = sampleCount;
}
@ -599,8 +604,7 @@ static qbool GL2_FBO_Init()
GL2_FBO_CreateSS( frameBuffersPostProcess[1], qtrue );
}
if ( result )
ri.Printf( PRINT_ALL, "MSAA: %d samples requested, %d selected\n", r_msaa->integer, finalSampleCount );
glInfo.msaaSampleCount = finalSampleCount;
return result;
}

View file

@ -958,6 +958,13 @@ static void CreateColorTextureStorageMS(int* samples)
ri.Error(ERR_FATAL, "Failed to create multi-sampled texture storage (error 0x%X)\n", (unsigned int)errorCode);
}
GLint realSampleCount = 0;
glGetTexLevelParameteriv(GL_TEXTURE_2D_MULTISAMPLE, 0, GL_TEXTURE_SAMPLES, &realSampleCount);
if(glGetError() == GL_NO_ERROR && realSampleCount > 0)
{
sampleCount = realSampleCount;
}
*samples = sampleCount;
}
@ -1058,7 +1065,7 @@ static void FBO_Init()
FBO_CreateSS(&gl.fbSS[1], qtrue, qtrue, "post-process #2");
}
ri.Printf(PRINT_ALL, "MSAA: %d samples requested, %d selected\n", r_msaa->integer, finalSampleCount);
glInfo.msaaSampleCount = finalSampleCount;
}
static void FBO_Bind(const FrameBuffer* fb)

View file

@ -325,8 +325,9 @@ void GfxInfo_f( void )
ri.Printf( PRINT_ALL, "Renderer: %s\n", glConfig.renderer_string );
if ( glConfig.version_string[0] != '\0' )
ri.Printf( PRINT_ALL, "OpenGL version: %s\n", glConfig.version_string );
ri.Printf( PRINT_ALL, "MSAA : %dx\n", glInfo.msaaSampleCount );
ri.Printf( PRINT_ALL, "MSAA alpha to coverage: %s\n", glInfo.alphaToCoverageSupport ? "ON" : "OFF" );
ri.Printf( PRINT_ALL, "Depth fade : %s\n", glInfo.depthFadeSupport ? "ON" : "OFF" );
ri.Printf( PRINT_ALL, "Alpha to coverage : %s\n", glInfo.alphaToCoverageSupport ? "ON" : "OFF" );
ri.Printf( PRINT_ALL, "GPU mip-map generation: %s\n", glInfo.mipGenSupport ? "ON" : "OFF" );
gal.PrintInfo();
}

View file

@ -1676,6 +1676,7 @@ struct glinfo_t {
qbool depthFadeSupport;
qbool mipGenSupport;
qbool alphaToCoverageSupport;
int msaaSampleCount; // active number of samples, can differ from r_msaa->integer
};
extern glinfo_t glInfo;