History

grouping the depth and stencil buffer into a single buffer

samcake committed 11 years ago

Commit bad5ea71 parent f1058034 files · +8 −45Browse files

Showing the changes to libraries/render-utils/src/FramebufferCache.cpp (1 of 4 files). Show all

Unified · Split

libraries/render-utils/src/FramebufferCache.cpp+2−29
@@ -35,9 +35,7 @@ void FramebufferCache::setFrameBufferSize(QSize frameBufferSize) { · 34 unmodified lines
3535 _frameBufferSize = frameBufferSize;
3636 _primaryFramebufferFull.reset();
3737 _primaryFramebufferDepthColor.reset();
38− _primaryFramebufferStencilColor.reset();
3938 _primaryDepthTexture.reset();
40− _primaryStencilTexture.reset();
4139 _primaryColorTexture.reset();
4240 _primaryNormalTexture.reset();
4341 _primarySpecularTexture.reset();
@@ -49,7 +47,6 @@ void FramebufferCache::setFrameBufferSize(QSize frameBufferSize) { · 5 unmodified lines
4947 void FramebufferCache::createPrimaryFramebuffer() {
5048 _primaryFramebufferFull = gpu::FramebufferPointer(gpu::Framebuffer::create());
5149 _primaryFramebufferDepthColor = gpu::FramebufferPointer(gpu::Framebuffer::create());
52− _primaryFramebufferStencilColor = gpu::FramebufferPointer(gpu::Framebuffer::create());
5350
5451 auto colorFormat = gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA);
5552 auto width = _frameBufferSize.width();
@@ -66,24 +63,14 @@ void FramebufferCache::createPrimaryFramebuffer() { · 10 unmodified lines
6663
6764 _primaryFramebufferDepthColor->setRenderBuffer(0, _primaryColorTexture);
6865
69− _primaryFramebufferStencilColor->setRenderBuffer(0, _primaryColorTexture);
70−
7166 // auto depthFormat = gpu::Element(gpu::SCALAR, gpu::FLOAT, gpu::DEPTH);
7267 auto depthFormat = gpu::Element(gpu::SCALAR, gpu::UINT32, gpu::DEPTH_STENCIL); // Depth24_Stencil8 texel format
7368 _primaryDepthTexture = gpu::TexturePointer(gpu::Texture::create2D(depthFormat, width, height, defaultSampler));
74−
75− // auto stencilFormat = gpu::Element(gpu::SCALAR, gpu::UINT32, gpu::DEPTH_STENCIL); // Depth24_Stencil8 texel format
76− auto stencilFormat = depthFormat;
77− // _primaryStencilTexture = gpu::TexturePointer(gpu::Texture::create2D(stencilFormat, width, height, defaultSampler));
78− _primaryStencilTexture = _primaryDepthTexture;
79−
69+
8070 _primaryFramebufferFull->setDepthStencilBuffer(_primaryDepthTexture, depthFormat);
8171
8272 _primaryFramebufferDepthColor->setDepthStencilBuffer(_primaryDepthTexture, depthFormat);
83−
84− // _primaryFramebufferStencilColor->setDepthStencilBuffer(_primaryStencilTexture, stencilFormat);
85− _primaryFramebufferStencilColor = _primaryFramebufferDepthColor;
86−
73+
8774 _selfieFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create());
8875 auto tex = gpu::TexturePointer(gpu::Texture::create2D(colorFormat, width * 0.5, height * 0.5, defaultSampler));
8976 _selfieFramebuffer->setRenderBuffer(0, tex);
@@ -103,13 +90,6 @@ gpu::FramebufferPointer FramebufferCache::getPrimaryFramebufferDepthColor() { · 13 unmodified lines
10390 return _primaryFramebufferDepthColor;
10491 }
10592
106−gpu::FramebufferPointer FramebufferCache::getPrimaryFramebufferStencilColor() {
107− if (!_primaryFramebufferStencilColor) {
108− createPrimaryFramebuffer();
109− }
110− return _primaryFramebufferStencilColor;
111−}
112−
11393 gpu::TexturePointer FramebufferCache::getPrimaryDepthTexture() {
11494 if (!_primaryDepthTexture) {
11595 createPrimaryFramebuffer();
@@ -117,13 +97,6 @@ gpu::TexturePointer FramebufferCache::getPrimaryDepthTexture() { · 1 unmodified line
11797 return _primaryDepthTexture;
11898 }
11999
120−gpu::TexturePointer FramebufferCache::getPrimaryStencilTexture() {
121− if (!_primaryStencilTexture) {
122− createPrimaryFramebuffer();
123− }
124− return _primaryStencilTexture;
125−}
126−
127100 gpu::TexturePointer FramebufferCache::getPrimaryColorTexture() {
128101 if (!_primaryColorTexture) {
129102 createPrimaryFramebuffer();