| 21 | } |
| 22 | |
| 23 | void Framebuffer::DepthStencil::SetSize(ref_ptr<dp::GraphicsContext> context, uint32_t width, uint32_t height) |
| 24 | { |
| 25 | if (m_texture && m_texture->GetWidth() == width && m_texture->GetHeight() == height) |
| 26 | return; |
| 27 | |
| 28 | Destroy(); |
| 29 | |
| 30 | Texture::Params params; |
| 31 | params.m_width = width; |
| 32 | params.m_height = height; |
| 33 | if (m_depthEnabled && m_stencilEnabled) |
| 34 | params.m_format = TextureFormat::DepthStencil; |
| 35 | else if (m_depthEnabled) |
| 36 | params.m_format = TextureFormat::Depth; |
| 37 | else |
| 38 | CHECK(false, ("Unsupported depth-stencil combination.")); |
| 39 | params.m_allocator = GetDefaultAllocator(context); |
| 40 | params.m_isRenderTarget = true; |
| 41 | |
| 42 | m_texture = make_unique_dp<FramebufferTexture>(); |
| 43 | m_texture->Create(context, params); |
| 44 | } |
| 45 | |
| 46 | void Framebuffer::DepthStencil::Destroy() |
| 47 | { |
no test coverage detected