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 | _frameBufferSize = frameBufferSize; | 35 | _frameBufferSize = frameBufferSize; |
| 36 | _primaryFramebufferFull.reset(); | 36 | _primaryFramebufferFull.reset(); |
| 37 | _primaryFramebufferDepthColor.reset(); | 37 | _primaryFramebufferDepthColor.reset(); |
| 38 | _primaryFramebufferDepthStencilColor.reset(); | ||
| 38 | _primaryDepthTexture.reset(); | 39 | _primaryDepthTexture.reset(); |
| 40 | _primaryStencilTexture.reset(); | ||
| 39 | _primaryColorTexture.reset(); | 41 | _primaryColorTexture.reset(); |
| 40 | _primaryNormalTexture.reset(); | 42 | _primaryNormalTexture.reset(); |
| 41 | _primarySpecularTexture.reset(); | 43 | _primarySpecularTexture.reset(); |
| @@ -47,6 +49,7 @@ void FramebufferCache::setFrameBufferSize(QSize frameBufferSize) { · 5 unmodified lines | |||
| 47 | void FramebufferCache::createPrimaryFramebuffer() { | 49 | void FramebufferCache::createPrimaryFramebuffer() { |
| 48 | _primaryFramebufferFull = gpu::FramebufferPointer(gpu::Framebuffer::create()); | 50 | _primaryFramebufferFull = gpu::FramebufferPointer(gpu::Framebuffer::create()); |
| 49 | _primaryFramebufferDepthColor = gpu::FramebufferPointer(gpu::Framebuffer::create()); | 51 | _primaryFramebufferDepthColor = gpu::FramebufferPointer(gpu::Framebuffer::create()); |
| 52 | _primaryFramebufferDepthStencilColor = gpu::FramebufferPointer(gpu::Framebuffer::create()); | ||
| 50 | 53 | ||
| 51 | auto colorFormat = gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA); | 54 | auto colorFormat = gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA); |
| 52 | auto width = _frameBufferSize.width(); | 55 | auto width = _frameBufferSize.width(); |
| @@ -63,12 +66,19 @@ void FramebufferCache::createPrimaryFramebuffer() { · 10 unmodified lines | |||
| 63 | 66 | ||
| 64 | _primaryFramebufferDepthColor->setRenderBuffer(0, _primaryColorTexture); | 67 | _primaryFramebufferDepthColor->setRenderBuffer(0, _primaryColorTexture); |
| 65 | 68 | ||
| 69 | _primaryFramebufferDepthStencilColor->setRenderBuffer(0, _primaryColorTexture); | ||
| 70 | |||
| 66 | auto depthFormat = gpu::Element(gpu::SCALAR, gpu::FLOAT, gpu::DEPTH); | 71 | auto depthFormat = gpu::Element(gpu::SCALAR, gpu::FLOAT, gpu::DEPTH); |
| 67 | _primaryDepthTexture = gpu::TexturePointer(gpu::Texture::create2D(depthFormat, width, height, defaultSampler)); | 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 | _primaryFramebufferFull->setDepthStencilBuffer(_primaryDepthTexture, depthFormat); | 77 | _primaryFramebufferFull->setDepthStencilBuffer(_primaryDepthTexture, depthFormat); |
| 70 | 78 | ||
| 71 | _primaryFramebufferDepthColor->setDepthStencilBuffer(_primaryDepthTexture, depthFormat); | 79 | _primaryFramebufferDepthColor->setDepthStencilBuffer(_primaryDepthTexture, depthFormat); |
| 80 | |||
| 81 | _primaryFramebufferDepthStencilColor->setDepthStencilBuffer(_primaryStencilTexture, stencilFormat); | ||
| 72 | 82 | ||
| 73 | _selfieFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create()); | 83 | _selfieFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create()); |
| 74 | auto tex = gpu::TexturePointer(gpu::Texture::create2D(colorFormat, width * 0.5, height * 0.5, defaultSampler)); | 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 | return _primaryFramebufferDepthColor; | 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 | gpu::TexturePointer FramebufferCache::getPrimaryDepthTexture() { | 109 | gpu::TexturePointer FramebufferCache::getPrimaryDepthTexture() { |
| 94 | if (!_primaryDepthTexture) { | 110 | if (!_primaryDepthTexture) { |
| @@ -97,6 +113,13 @@ gpu::TexturePointer FramebufferCache::getPrimaryDepthTexture() { · 2 unmodified lines | |||
| 97 | return _primaryDepthTexture; | 113 | return _primaryDepthTexture; |
| 98 | } | 114 | } |
| 99 | 115 | ||
| 116 | gpu::TexturePointer FramebufferCache::getPrimaryStencilTexture() { | ||
| 117 | if (!_primaryStencilTexture) { | ||
| 118 | createPrimaryFramebuffer(); | ||
| 119 | } | ||
| 120 | return _primaryStencilTexture; | ||
| 121 | } | ||
| 122 | |||
| 100 | gpu::TexturePointer FramebufferCache::getPrimaryColorTexture() { | 123 | gpu::TexturePointer FramebufferCache::getPrimaryColorTexture() { |
| 101 | if (!_primaryColorTexture) { | 124 | if (!_primaryColorTexture) { |
| 102 | createPrimaryFramebuffer(); | 125 | createPrimaryFramebuffer(); |