Showing the changes to libraries/render-utils/src/FramebufferCache.cpp (1 of 7 files). Show all
Unified · Split
| @@ -35,7 +35,9 @@ void FramebufferCache::setFrameBufferSize(QSize frameBufferSize) { · 34 unmodified lines | ||
| 35 | 35 | _frameBufferSize = frameBufferSize; |
| 36 | 36 | _primaryFramebufferFull.reset(); |
| 37 | 37 | _primaryFramebufferDepthColor.reset(); |
| 38 | + _primaryFramebufferDepthStencilColor.reset(); | |
| 38 | 39 | _primaryDepthTexture.reset(); |
| 40 | + _primaryStencilTexture.reset(); | |
| 39 | 41 | _primaryColorTexture.reset(); |
| 40 | 42 | _primaryNormalTexture.reset(); |
| 41 | 43 | _primarySpecularTexture.reset(); |
| @@ -47,6 +49,7 @@ void FramebufferCache::setFrameBufferSize(QSize frameBufferSize) { · 5 unmodified lines | ||
| 47 | 49 | void FramebufferCache::createPrimaryFramebuffer() { |
| 48 | 50 | _primaryFramebufferFull = gpu::FramebufferPointer(gpu::Framebuffer::create()); |
| 49 | 51 | _primaryFramebufferDepthColor = gpu::FramebufferPointer(gpu::Framebuffer::create()); |
| 52 | + _primaryFramebufferDepthStencilColor = gpu::FramebufferPointer(gpu::Framebuffer::create()); | |
| 50 | 53 | |
| 51 | 54 | auto colorFormat = gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA); |
| 52 | 55 | auto width = _frameBufferSize.width(); |
| @@ -63,12 +66,19 @@ void FramebufferCache::createPrimaryFramebuffer() { · 10 unmodified lines | ||
| 63 | 66 | |
| 64 | 67 | _primaryFramebufferDepthColor->setRenderBuffer(0, _primaryColorTexture); |
| 65 | 68 | |
| 69 | + _primaryFramebufferDepthStencilColor->setRenderBuffer(0, _primaryColorTexture); | |
| 70 | + | |
| 66 | 71 | auto depthFormat = gpu::Element(gpu::SCALAR, gpu::FLOAT, gpu::DEPTH); |
| 67 | 72 | _primaryDepthTexture = gpu::TexturePointer(gpu::Texture::create2D(depthFormat, width, height, defaultSampler)); |
| 68 | 73 | |
| 74 | + auto stencilFormat = gpu::Element(gpu::VEC2, gpu::UINT32, gpu::DEPTH_STENCIL); | |
| 75 | + _primaryStencilTexture = gpu::TexturePointer(gpu::Texture::create2D(stencilFormat, width, height, defaultSampler)); | |
| 76 | + | |
| 69 | 77 | _primaryFramebufferFull->setDepthStencilBuffer(_primaryDepthTexture, depthFormat); |
| 70 | 78 | |
| 71 | 79 | _primaryFramebufferDepthColor->setDepthStencilBuffer(_primaryDepthTexture, depthFormat); |
| 80 | + | |
| 81 | + _primaryFramebufferDepthStencilColor->setDepthStencilBuffer(_primaryStencilTexture, stencilFormat); | |
| 72 | 82 | |
| 73 | 83 | _selfieFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create()); |
| 74 | 84 | auto tex = gpu::TexturePointer(gpu::Texture::create2D(colorFormat, width * 0.5, height * 0.5, defaultSampler)); |
| @@ -89,6 +99,12 @@ gpu::FramebufferPointer FramebufferCache::getPrimaryFramebufferDepthColor() { · 14 unmodified lines | ||
| 89 | 99 | return _primaryFramebufferDepthColor; |
| 90 | 100 | } |
| 91 | 101 | |
| 102 | +gpu::FramebufferPointer FramebufferCache::getPrimaryFramebufferDepthStencilColor() { | |
| 103 | + if (!_primaryFramebufferDepthStencilColor) { | |
| 104 | + createPrimaryFramebuffer(); | |
| 105 | + } | |
| 106 | + return _primaryFramebufferDepthStencilColor; | |
| 107 | +} | |
| 92 | 108 | |
| 93 | 109 | gpu::TexturePointer FramebufferCache::getPrimaryDepthTexture() { |
| 94 | 110 | if (!_primaryDepthTexture) { |
| @@ -97,6 +113,13 @@ gpu::TexturePointer FramebufferCache::getPrimaryDepthTexture() { · 2 unmodified lines | ||
| 97 | 113 | return _primaryDepthTexture; |
| 98 | 114 | } |
| 99 | 115 | |
| 116 | +gpu::TexturePointer FramebufferCache::getPrimaryStencilTexture() { | |
| 117 | + if (!_primaryStencilTexture) { | |
| 118 | + createPrimaryFramebuffer(); | |
| 119 | + } | |
| 120 | + return _primaryStencilTexture; | |
| 121 | +} | |
| 122 | + | |
| 100 | 123 | gpu::TexturePointer FramebufferCache::getPrimaryColorTexture() { |
| 101 | 124 | if (!_primaryColorTexture) { |
| 102 | 125 | createPrimaryFramebuffer(); |