| 76 | } |
| 77 | |
| 78 | void GBuffer::Resize(IRenderDevice* pDevice, Uint32 Width, Uint32 Height) |
| 79 | { |
| 80 | if (Width == m_Width && Height == m_Height) |
| 81 | return; |
| 82 | |
| 83 | VERIFY_EXPR(pDevice != nullptr && Width > 0 && Height > 0); |
| 84 | |
| 85 | m_Width = Width; |
| 86 | m_Height = Height; |
| 87 | |
| 88 | m_Buffers.clear(); |
| 89 | if (m_Width == 0 || m_Height == 0) |
| 90 | return; |
| 91 | |
| 92 | TextureDesc TexDesc; |
| 93 | TexDesc.Width = Width; |
| 94 | TexDesc.Height = Height; |
| 95 | TexDesc.MipLevels = 1; |
| 96 | TexDesc.ArraySize = 1; |
| 97 | TexDesc.Usage = USAGE_DEFAULT; |
| 98 | TexDesc.Type = RESOURCE_DIM_TEX_2D; |
| 99 | |
| 100 | for (const auto& ElemDesc : m_ElemDesc) |
| 101 | { |
| 102 | TexDesc.Format = ElemDesc.Format; |
| 103 | TexDesc.BindFlags = ElemDesc.BindFlags; |
| 104 | TexDesc.ClearValue = ElemDesc.ClearValue; |
| 105 | VERIFY_EXPR(TexDesc.BindFlags != BIND_NONE); |
| 106 | |
| 107 | std::string Name = "GBuffer " + std::to_string(m_Buffers.size()); |
| 108 | TexDesc.Name = Name.c_str(); |
| 109 | |
| 110 | RefCntAutoPtr<ITexture> pGBufferTex; |
| 111 | pDevice->CreateTexture(TexDesc, nullptr, &pGBufferTex); |
| 112 | VERIFY_EXPR(pGBufferTex); |
| 113 | |
| 114 | m_Buffers.emplace_back(std::move(pGBufferTex)); |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | void GBuffer::Bind(IDeviceContext* pContext, |
| 119 | Uint32 BuffersMask, |
nothing calls this directly
no outgoing calls
no test coverage detected