From 9a43e45891d8bcf53147b0627388e72f6f59ef5f Mon Sep 17 00:00:00 2001 From: Dario Date: Thu, 7 Apr 2016 04:31:47 +0200 Subject: [PATCH] =?UTF-8?q?Api=20improvement.=20Calling=20setUniform()=20w?= =?UTF-8?q?ith=20UINT16=5FMAX=20will=20use=20the=20=5Fn=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/bgfx/bgfx.h | 3 ++- src/bgfx_p.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/bgfx/bgfx.h b/include/bgfx/bgfx.h index eda902ce2..37d0538e3 100644 --- a/include/bgfx/bgfx.h +++ b/include/bgfx/bgfx.h @@ -2165,7 +2165,8 @@ namespace bgfx /// /// @param[in] _handle Uniform. /// @param[in] _value Pointer to uniform data. - /// @param[in] _num Number of elements. + /// @param[in] _num Number of elements. Passing `UINT16_MAX` will + /// use the _num passed on uniform creation. /// /// @attention C99 equivalent is `bgfx_set_uniform`. /// diff --git a/src/bgfx_p.h b/src/bgfx_p.h index 34fd1378f..1bb850e47 100644 --- a/src/bgfx_p.h +++ b/src/bgfx_p.h @@ -3617,7 +3617,7 @@ namespace bgfx { BGFX_CHECK_HANDLE("setUniform", m_uniformHandle, _handle); UniformRef& uniform = m_uniformRef[_handle.idx]; - BX_CHECK(uniform.m_num >= _num, "Truncated uniform update. %d (max: %d)", _num, uniform.m_num); + BX_CHECK(_num == UINT16_MAX || uniform.m_num >= _num, "Truncated uniform update. %d (max: %d)", _num, uniform.m_num); if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM) ) { BX_CHECK(m_uniformSet.end() == m_uniformSet.find(_handle.idx)