Added warning for bad API use.

This commit is contained in:
Бранимир Караџић 2019-03-01 09:50:58 -08:00
parent bd2bbc84ed
commit 9cd697b1af

View File

@ -4062,7 +4062,19 @@ namespace bgfx
uint16_t getShaderUniforms(ShaderHandle _handle, UniformHandle* _uniforms, uint16_t _max)
{
return s_ctx->getShaderUniforms(_handle, _uniforms, _max);
BX_WARN(NULL == _uniforms || 0 != _max
, "Passing uniforms array pointer, but array maximum capacity is set to 0."
);
uint16_t num = s_ctx->getShaderUniforms(_handle, _uniforms, _max);
BX_WARN(0 == _max || num <= _max
, "Shader has more uniforms that capacity of output array. Output is truncated (num %d, max %d)."
, num
, _max
);
return num;
}
void setName(ShaderHandle _handle, const char* _name, int32_t _len)