First render may not have known scene dimensions

This commit is contained in:
Magnus Norddahl 2016-08-13 18:43:30 +02:00 committed by Christoph Oelckers
parent af62352860
commit 94b72d25e9
1 changed files with 7 additions and 0 deletions

View File

@ -144,6 +144,9 @@ void FGLRenderBuffers::Setup(int width, int height, int sceneWidth, int sceneHei
if (!IsEnabled())
return;
if (width <= 0 || height <= 0)
I_FatalError("Requested invalid render buffer sizes: screen = %dx%d", width, height);
int samples = GetCvarSamples();
if (width == mWidth && height == mHeight && mSamples != samples)
@ -227,6 +230,10 @@ void FGLRenderBuffers::CreateBloom(int width, int height)
{
ClearBloom();
// No scene, no bloom!
if (width <= 0 || height <= 0)
return;
int bloomWidth = MAX(width / 2, 1);
int bloomHeight = MAX(height / 2, 1);
for (int i = 0; i < NumBloomLevels; i++)