Showing the changes to libraries/render-utils/src/FramebufferCache.cpp (1 of 11 files). Show all
Unified · Split
| @@ -45,6 +45,8 @@ void FramebufferCache::setFrameBufferSize(QSize frameBufferSize) { · 44 unmodified lines | |||
| 45 | _cachedFramebuffers.clear(); | 45 | _cachedFramebuffers.clear(); |
| 46 | _lightingTexture.reset(); | 46 | _lightingTexture.reset(); |
| 47 | _lightingFramebuffer.reset(); | 47 | _lightingFramebuffer.reset(); |
| 48 | _depthPyramidFramebuffer.reset(); | ||
| 49 | _depthPyramidTexture.reset(); | ||
| 48 | } | 50 | } |
| 49 | } | 51 | } |
| 50 | 52 | ||
| @@ -96,6 +98,14 @@ void FramebufferCache::createPrimaryFramebuffer() { · 45 unmodified lines | |||
| 96 | _lightingFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create()); | 98 | _lightingFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create()); |
| 97 | _lightingFramebuffer->setRenderBuffer(0, _lightingTexture); | 99 | _lightingFramebuffer->setRenderBuffer(0, _lightingTexture); |
| 98 | _lightingFramebuffer->setDepthStencilBuffer(_primaryDepthTexture, depthFormat); | 100 | _lightingFramebuffer->setDepthStencilBuffer(_primaryDepthTexture, depthFormat); |
| 101 | |||
| 102 | |||
| 103 | // For AO: | ||
| 104 | _depthPyramidTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element(gpu::SCALAR, gpu::HALF, gpu::RGB), width, height, smoothSampler)); | ||
| 105 | _depthPyramidFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create()); | ||
| 106 | _depthPyramidFramebuffer->setRenderBuffer(0, _depthPyramidTexture); | ||
| 107 | _depthPyramidFramebuffer->setDepthStencilBuffer(_primaryDepthTexture, depthFormat); | ||
| 108 | |||
| 99 | } | 109 | } |
| 100 | 110 | ||
| 101 | gpu::FramebufferPointer FramebufferCache::getPrimaryFramebuffer() { | 111 | gpu::FramebufferPointer FramebufferCache::getPrimaryFramebuffer() { |
| @@ -197,3 +207,17 @@ gpu::FramebufferPointer FramebufferCache::getSelfieFramebuffer() { · 95 unmodified lines | |||
| 197 | } | 207 | } |
| 198 | return _selfieFramebuffer; | 208 | return _selfieFramebuffer; |
| 199 | } | 209 | } |
| 210 | |||
| 211 | gpu::FramebufferPointer FramebufferCache::getDepthPyramidFramebuffer() { | ||
| 212 | if (!_depthPyramidFramebuffer) { | ||
| 213 | createPrimaryFramebuffer(); | ||
| 214 | } | ||
| 215 | return _depthPyramidFramebuffer; | ||
| 216 | } | ||
| 217 | |||
| 218 | gpu::TexturePointer FramebufferCache::getDepthPyramidTexture() { | ||
| 219 | if (!_depthPyramidTexture) { | ||
| 220 | createPrimaryFramebuffer(); | ||
| 221 | } | ||
| 222 | return _depthPyramidTexture; | ||
| 223 | } | ||