Merge pull request #7656 from samcake/orange

Fixing the resize of gpu::framebuffer to avoid unecessary re validation every frame
This commit is contained in:
Brad Hefta-Gaub 2016-04-13 12:34:47 -07:00
commit 1c2c6804ac
2 changed files with 3 additions and 1 deletions

View file

@ -118,12 +118,14 @@ void Framebuffer::resize(uint16 width, uint16 height, uint16 numSamples) {
if (_renderBuffers[i]) { if (_renderBuffers[i]) {
_renderBuffers[i]._texture->resize2D(width, height, numSamples); _renderBuffers[i]._texture->resize2D(width, height, numSamples);
_numSamples = _renderBuffers[i]._texture->getNumSamples(); _numSamples = _renderBuffers[i]._texture->getNumSamples();
++_colorStamps[i];
} }
} }
if (_depthStencilBuffer) { if (_depthStencilBuffer) {
_depthStencilBuffer._texture->resize2D(width, height, numSamples); _depthStencilBuffer._texture->resize2D(width, height, numSamples);
_numSamples = _depthStencilBuffer._texture->getNumSamples(); _numSamples = _depthStencilBuffer._texture->getNumSamples();
++_depthStamp;
} }
_width = width; _width = width;

View file

@ -56,6 +56,7 @@ const gpu::PipelinePointer& Antialiasing::getAntialiasingPipeline() {
auto height = _antialiasingBuffer->getHeight(); auto height = _antialiasingBuffer->getHeight();
auto defaultSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_POINT); auto defaultSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_POINT);
_antialiasingTexture = gpu::TexturePointer(gpu::Texture::create2D(format, width, height, defaultSampler)); _antialiasingTexture = gpu::TexturePointer(gpu::Texture::create2D(format, width, height, defaultSampler));
_antialiasingBuffer->setRenderBuffer(0, _antialiasingTexture);
// Good to go add the brand new pipeline // Good to go add the brand new pipeline
_antialiasingPipeline = gpu::Pipeline::create(program, state); _antialiasingPipeline = gpu::Pipeline::create(program, state);
@ -126,7 +127,6 @@ void Antialiasing::run(const render::SceneContextPointer& sceneContext, const re
// FXAA step // FXAA step
getAntialiasingPipeline(); getAntialiasingPipeline();
batch.setResourceTexture(0, framebufferCache->getLightingTexture()); batch.setResourceTexture(0, framebufferCache->getLightingTexture());
_antialiasingBuffer->setRenderBuffer(0, _antialiasingTexture);
batch.setFramebuffer(_antialiasingBuffer); batch.setFramebuffer(_antialiasingBuffer);
batch.setPipeline(getAntialiasingPipeline()); batch.setPipeline(getAntialiasingPipeline());