| 35 | { |
| 36 | |
| 37 | static std::vector<GBuffer::ElementDesc> GetGBufferElementDescs(const GBuffer::ElementDesc* Elements, |
| 38 | size_t NumElements) |
| 39 | { |
| 40 | std::vector<GBuffer::ElementDesc> Elems{Elements, Elements + NumElements}; |
| 41 | for (auto& ElemDesc : Elems) |
| 42 | { |
| 43 | DEV_CHECK_ERR(ElemDesc.Format != TEX_FORMAT_UNKNOWN, "GBuffer element format is not specified"); |
| 44 | |
| 45 | if (ElemDesc.BindFlags == BIND_NONE) |
| 46 | { |
| 47 | const auto& FmtAttribs = GetTextureFormatAttribs(ElemDesc.Format); |
| 48 | if (FmtAttribs.ComponentType == COMPONENT_TYPE_DEPTH || FmtAttribs.ComponentType == COMPONENT_TYPE_DEPTH_STENCIL) |
| 49 | { |
| 50 | ElemDesc.BindFlags = BIND_DEPTH_STENCIL | BIND_SHADER_RESOURCE; |
| 51 | } |
| 52 | else |
| 53 | { |
| 54 | ElemDesc.BindFlags = BIND_RENDER_TARGET | BIND_SHADER_RESOURCE; |
| 55 | } |
| 56 | } |
| 57 | } |
| 58 | return Elems; |
| 59 | } |
| 60 | |
| 61 | GBuffer::GBuffer(const ElementDesc* Elements, |
| 62 | size_t NumElements) : |