diff --git a/include/bgfx/bgfx.h b/include/bgfx/bgfx.h index ff48be4cd..1ae049053 100644 --- a/include/bgfx/bgfx.h +++ b/include/bgfx/bgfx.h @@ -1907,7 +1907,9 @@ namespace bgfx /// Begin submitting draw calls from thread. /// - Encoder* begin(); + /// @param[in] _forThread Explicitly request an encoder for a worker thread. + /// + Encoder* begin(bool _forThread = false); /// End submitting draw calls from thread. /// diff --git a/include/bgfx/defines.h b/include/bgfx/defines.h index f9a83234e..cc11d1cdf 100644 --- a/include/bgfx/defines.h +++ b/include/bgfx/defines.h @@ -6,7 +6,7 @@ #ifndef BGFX_DEFINES_H_HEADER_GUARD #define BGFX_DEFINES_H_HEADER_GUARD -#define BGFX_API_VERSION UINT32_C(83) +#define BGFX_API_VERSION UINT32_C(84) /// Color RGB/alpha/depth write. When it's not specified write will be disabled. #define BGFX_STATE_WRITE_R UINT64_C(0x0000000000000001) //!< Enable R write. diff --git a/src/bgfx.cpp b/src/bgfx.cpp index 87162a182..27e57fd2b 100644 --- a/src/bgfx.cpp +++ b/src/bgfx.cpp @@ -1749,12 +1749,12 @@ namespace bgfx } } - Encoder* Context::begin() + Encoder* Context::begin(bool _forThread) { EncoderImpl* encoder = &m_encoder[0]; #if BGFX_CONFIG_MULTITHREADED - if (BGFX_API_THREAD_MAGIC != s_threadIndex) + if (_forThread || BGFX_API_THREAD_MAGIC != s_threadIndex) { bx::MutexScope scopeLock(m_encoderApiLock); @@ -3015,9 +3015,9 @@ namespace bgfx s_ctx->reset(_width, _height, _flags, _format); } - Encoder* begin() + Encoder* begin(bool _forThread) { - return s_ctx->begin(); + return s_ctx->begin(_forThread); } #define BGFX_ENCODER(_func) reinterpret_cast(this)->_func diff --git a/src/bgfx_p.h b/src/bgfx_p.h index 825b5f248..e17a313c6 100644 --- a/src/bgfx_p.h +++ b/src/bgfx_p.h @@ -4507,7 +4507,7 @@ namespace bgfx } } - BGFX_API_FUNC(Encoder* begin() ); + BGFX_API_FUNC(Encoder* begin(bool _forThread) ); BGFX_API_FUNC(void end(Encoder* _encoder) );