MCPcopy Create free account
hub / github.com/BabylonJS/BabylonNative / FrameBufferManager

Class FrameBufferManager

Plugins/NativeEngine/Source/NativeEngine.h:164–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162 };
163
164 struct FrameBufferManager final
165 {
166 FrameBufferManager()
167 {
168 m_boundFrameBuffer = m_backBuffer = new FrameBufferData(BGFX_INVALID_HANDLE, GetNewViewId(), bgfx::getStats()->width, bgfx::getStats()->height);
169 }
170
171 FrameBufferData* CreateNew(bgfx::FrameBufferHandle frameBufferHandle, uint16_t width, uint16_t height)
172 {
173 return new FrameBufferData(frameBufferHandle, GetNewViewId(), width, height);
174 }
175
176 void Bind(FrameBufferData* data)
177 {
178 m_boundFrameBuffer = data;
179
180 // TODO: Consider doing this only on bgfx::reset(); the effects of this call don't survive reset, but as
181 // long as there's no reset this doesn't technically need to be called every time the frame buffer is bound.
182 m_boundFrameBuffer->SetUpView(GetNewViewId());
183
184 // bgfx::setTexture()? Why?
185 // TODO: View order?
186 }
187
188 FrameBufferData& GetBound() const
189 {
190 return *m_boundFrameBuffer;
191 }
192
193 void Unbind(FrameBufferData* data)
194 {
195 assert(m_boundFrameBuffer == data);
196 (void)data;
197 m_boundFrameBuffer = m_backBuffer;
198 }
199
200 uint16_t GetNewViewId()
201 {
202 m_nextId++;
203 assert(m_nextId < bgfx::getCaps()->limits.maxViews);
204 return m_nextId;
205 }
206
207 void Reset()
208 {
209 m_nextId = 0;
210 }
211
212 private:
213 FrameBufferData* m_boundFrameBuffer{nullptr};
214 FrameBufferData* m_backBuffer{nullptr};
215 uint16_t m_nextId{0};
216 };
217
218 struct UniformInfo final
219 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected