mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
Only query for GL_MAX_SAMPLES once
This commit is contained in:
parent
3c08f5ae48
commit
fc01a6b832
2 changed files with 3 additions and 16 deletions
|
@ -65,6 +65,7 @@ CVAR(Bool, gl_renderbuffers, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG);
|
||||||
FGLRenderBuffers::FGLRenderBuffers()
|
FGLRenderBuffers::FGLRenderBuffers()
|
||||||
{
|
{
|
||||||
glGetIntegerv(GL_FRAMEBUFFER_BINDING, (GLint*)&mOutputFB);
|
glGetIntegerv(GL_FRAMEBUFFER_BINDING, (GLint*)&mOutputFB);
|
||||||
|
glGetIntegerv(GL_MAX_SAMPLES, &mMaxSamples);
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -147,7 +148,7 @@ void FGLRenderBuffers::Setup(int width, int height, int sceneWidth, int sceneHei
|
||||||
if (width <= 0 || height <= 0)
|
if (width <= 0 || height <= 0)
|
||||||
I_FatalError("Requested invalid render buffer sizes: screen = %dx%d", width, height);
|
I_FatalError("Requested invalid render buffer sizes: screen = %dx%d", width, height);
|
||||||
|
|
||||||
int samples = GetCvarSamples();
|
int samples = clamp((int)gl_multisample, 0, mMaxSamples);
|
||||||
|
|
||||||
GLint activeTex;
|
GLint activeTex;
|
||||||
GLint textureBinding;
|
GLint textureBinding;
|
||||||
|
@ -269,20 +270,6 @@ GLuint FGLRenderBuffers::GetHdrFormat()
|
||||||
return ((gl.flags & RFL_NO_RGBA16F) != 0) ? GL_RGBA8 : GL_RGBA16;
|
return ((gl.flags & RFL_NO_RGBA16F) != 0) ? GL_RGBA8 : GL_RGBA16;
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// Converts the CVAR multisample value into a valid level for OpenGL
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
int FGLRenderBuffers::GetCvarSamples()
|
|
||||||
{
|
|
||||||
int maxSamples = 0;
|
|
||||||
glGetIntegerv(GL_MAX_SAMPLES, &maxSamples);
|
|
||||||
|
|
||||||
return clamp((int)gl_multisample, 0, maxSamples);
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// Creates a 2D texture defaulting to linear filtering and clamp to edge
|
// Creates a 2D texture defaulting to linear filtering and clamp to edge
|
||||||
|
|
|
@ -59,12 +59,12 @@ private:
|
||||||
void DeleteRenderBuffer(GLuint &handle);
|
void DeleteRenderBuffer(GLuint &handle);
|
||||||
void DeleteFrameBuffer(GLuint &handle);
|
void DeleteFrameBuffer(GLuint &handle);
|
||||||
|
|
||||||
int GetCvarSamples();
|
|
||||||
GLuint GetHdrFormat();
|
GLuint GetHdrFormat();
|
||||||
|
|
||||||
int mWidth = 0;
|
int mWidth = 0;
|
||||||
int mHeight = 0;
|
int mHeight = 0;
|
||||||
int mSamples = 0;
|
int mSamples = 0;
|
||||||
|
int mMaxSamples = 0;
|
||||||
int mBloomWidth = 0;
|
int mBloomWidth = 0;
|
||||||
int mBloomHeight = 0;
|
int mBloomHeight = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue