| 2306 | } |
| 2307 | |
| 2308 | uint32_t Context::frame(bool _capture) |
| 2309 | { |
| 2310 | m_encoder[0].end(true); |
| 2311 | |
| 2312 | #if BGFX_CONFIG_MULTITHREADED |
| 2313 | bx::MutexScope resourceApiScope(m_resourceApiLock); |
| 2314 | |
| 2315 | encoderApiWait(); |
| 2316 | bx::MutexScope encoderApiScope(m_encoderApiLock); |
| 2317 | #else |
| 2318 | encoderApiWait(); |
| 2319 | #endif // BGFX_CONFIG_MULTITHREADED |
| 2320 | |
| 2321 | m_submit->m_capture = _capture; |
| 2322 | |
| 2323 | uint32_t frameNum = m_submit->m_frameNum; |
| 2324 | |
| 2325 | BGFX_PROFILER_SCOPE("bgfx/API thread frame", 0xff2040ff); |
| 2326 | // wait for render thread to finish |
| 2327 | renderSemWait(); |
| 2328 | frameNoRenderWait(); |
| 2329 | |
| 2330 | m_encoder[0].begin(m_submit, 0); |
| 2331 | |
| 2332 | return frameNum; |
| 2333 | } |
| 2334 | |
| 2335 | void Context::frameNoRenderWait() |
| 2336 | { |