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

@ -143,6 +143,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();
@ -226,6 +229,10 @@ void FGLRenderBuffers::CreatePipeline(int width, int height)
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);