From 7653fa2c372c893f0cebe55f07997d9eb70b6aae Mon Sep 17 00:00:00 2001 From: samcake Date: Wed, 13 Apr 2016 10:56:29 -0700 Subject: [PATCH] Fixing the resize of framebuffer to avoid reassigning the render buffer every frame --- libraries/gpu/src/gpu/Framebuffer.cpp | 2 ++ libraries/render-utils/src/AntialiasingEffect.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/gpu/src/gpu/Framebuffer.cpp b/libraries/gpu/src/gpu/Framebuffer.cpp index abaa0f9ef1..6c0e59f5dc 100755 --- a/libraries/gpu/src/gpu/Framebuffer.cpp +++ b/libraries/gpu/src/gpu/Framebuffer.cpp @@ -118,12 +118,14 @@ void Framebuffer::resize(uint16 width, uint16 height, uint16 numSamples) { if (_renderBuffers[i]) { _renderBuffers[i]._texture->resize2D(width, height, numSamples); _numSamples = _renderBuffers[i]._texture->getNumSamples(); + ++_colorStamps[i]; } } if (_depthStencilBuffer) { _depthStencilBuffer._texture->resize2D(width, height, numSamples); _numSamples = _depthStencilBuffer._texture->getNumSamples(); + ++_depthStamp; } _width = width; diff --git a/libraries/render-utils/src/AntialiasingEffect.cpp b/libraries/render-utils/src/AntialiasingEffect.cpp index 6c26b16124..1f00d468b0 100644 --- a/libraries/render-utils/src/AntialiasingEffect.cpp +++ b/libraries/render-utils/src/AntialiasingEffect.cpp @@ -56,6 +56,7 @@ const gpu::PipelinePointer& Antialiasing::getAntialiasingPipeline() { auto height = _antialiasingBuffer->getHeight(); auto defaultSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_POINT); _antialiasingTexture = gpu::TexturePointer(gpu::Texture::create2D(format, width, height, defaultSampler)); + _antialiasingBuffer->setRenderBuffer(0, _antialiasingTexture); // Good to go add the brand new pipeline _antialiasingPipeline = gpu::Pipeline::create(program, state); @@ -126,7 +127,6 @@ void Antialiasing::run(const render::SceneContextPointer& sceneContext, const re // FXAA step getAntialiasingPipeline(); batch.setResourceTexture(0, framebufferCache->getLightingTexture()); - _antialiasingBuffer->setRenderBuffer(0, _antialiasingTexture); batch.setFramebuffer(_antialiasingBuffer); batch.setPipeline(getAntialiasingPipeline());