FIX asan error (false positive). Use of bx::uint32_cnttz with 0 results in undefined value.
This commit is contained in:
parent
6a81093267
commit
e4f0d6893a
@ -131,8 +131,9 @@ static bgfx::UniformHandle s_texColor;
|
||||
|
||||
void setViewClearMask(uint32_t _viewMask, uint8_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil)
|
||||
{
|
||||
for (uint32_t view = 0, viewMask = _viewMask, ntz = bx::uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, view += 1, ntz = bx::uint32_cnttz(viewMask) )
|
||||
for (uint32_t view = 0, viewMask = _viewMask; 0 != viewMask; viewMask >>= 1, view += 1 )
|
||||
{
|
||||
const uint32_t ntz = bx::uint32_cnttz(viewMask);
|
||||
viewMask >>= ntz;
|
||||
view += ntz;
|
||||
|
||||
@ -142,8 +143,9 @@ void setViewClearMask(uint32_t _viewMask, uint8_t _flags, uint32_t _rgba, float
|
||||
|
||||
void setViewTransformMask(uint32_t _viewMask, const void* _view, const void* _proj)
|
||||
{
|
||||
for (uint32_t view = 0, viewMask = _viewMask, ntz = bx::uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, view += 1, ntz = bx::uint32_cnttz(viewMask) )
|
||||
for (uint32_t view = 0, viewMask = _viewMask; 0 != viewMask; viewMask >>= 1, view += 1 )
|
||||
{
|
||||
const uint32_t ntz = bx::uint32_cnttz(viewMask);
|
||||
viewMask >>= ntz;
|
||||
view += ntz;
|
||||
|
||||
@ -153,8 +155,9 @@ void setViewTransformMask(uint32_t _viewMask, const void* _view, const void* _pr
|
||||
|
||||
void setViewRectMask(uint32_t _viewMask, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height)
|
||||
{
|
||||
for (uint32_t view = 0, viewMask = _viewMask, ntz = bx::uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, view += 1, ntz = bx::uint32_cnttz(viewMask) )
|
||||
for (uint32_t view = 0, viewMask = _viewMask; 0 != viewMask; viewMask >>= 1, view += 1 )
|
||||
{
|
||||
const uint32_t ntz = bx::uint32_cnttz(viewMask);
|
||||
viewMask >>= ntz;
|
||||
view += ntz;
|
||||
|
||||
|
@ -99,8 +99,9 @@ static bgfx::FrameBufferHandle s_stencilFb;
|
||||
|
||||
void setViewClearMask(uint32_t _viewMask, uint8_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil)
|
||||
{
|
||||
for (uint32_t view = 0, viewMask = _viewMask, ntz = bx::uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, view += 1, ntz = bx::uint32_cnttz(viewMask) )
|
||||
for (uint32_t view = 0, viewMask = _viewMask; 0 != viewMask; viewMask >>= 1, view += 1 )
|
||||
{
|
||||
const uint32_t ntz = bx::uint32_cnttz(viewMask);
|
||||
viewMask >>= ntz;
|
||||
view += ntz;
|
||||
|
||||
@ -110,8 +111,9 @@ void setViewClearMask(uint32_t _viewMask, uint8_t _flags, uint32_t _rgba, float
|
||||
|
||||
void setViewTransformMask(uint32_t _viewMask, const void* _view, const void* _proj)
|
||||
{
|
||||
for (uint32_t view = 0, viewMask = _viewMask, ntz = bx::uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, view += 1, ntz = bx::uint32_cnttz(viewMask) )
|
||||
for (uint32_t view = 0, viewMask = _viewMask; 0 != viewMask; viewMask >>= 1, view += 1 )
|
||||
{
|
||||
const uint32_t ntz = bx::uint32_cnttz(viewMask);
|
||||
viewMask >>= ntz;
|
||||
view += ntz;
|
||||
|
||||
@ -121,8 +123,9 @@ void setViewTransformMask(uint32_t _viewMask, const void* _view, const void* _pr
|
||||
|
||||
void setViewRectMask(uint32_t _viewMask, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height)
|
||||
{
|
||||
for (uint32_t view = 0, viewMask = _viewMask, ntz = bx::uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, view += 1, ntz = bx::uint32_cnttz(viewMask) )
|
||||
for (uint32_t view = 0, viewMask = _viewMask; 0 != viewMask; viewMask >>= 1, view += 1 )
|
||||
{
|
||||
const uint32_t ntz = bx::uint32_cnttz(viewMask);
|
||||
viewMask >>= ntz;
|
||||
view += ntz;
|
||||
|
||||
|
@ -1232,11 +1232,12 @@ namespace bgfx
|
||||
if (UINT8_MAX != m_draw.m_streamMask)
|
||||
{
|
||||
uint32_t numVertices = UINT32_MAX;
|
||||
for (uint32_t idx = 0, streamMask = m_draw.m_streamMask, ntz = bx::uint32_cnttz(streamMask)
|
||||
for (uint32_t idx = 0, streamMask = m_draw.m_streamMask
|
||||
; 0 != streamMask
|
||||
; streamMask >>= 1, idx += 1, ntz = bx::uint32_cnttz(streamMask)
|
||||
; streamMask >>= 1, idx += 1
|
||||
)
|
||||
{
|
||||
const uint32_t ntz = bx::uint32_cnttz(streamMask);
|
||||
streamMask >>= ntz;
|
||||
idx += ntz;
|
||||
numVertices = bx::min(numVertices, m_numVertices[idx]);
|
||||
|
@ -457,11 +457,12 @@ namespace bgfx
|
||||
return true;
|
||||
}
|
||||
|
||||
for (uint32_t idx = 0, streamMask = _new.m_streamMask, ntz = bx::uint32_cnttz(streamMask)
|
||||
for (uint32_t idx = 0, streamMask = _new.m_streamMask
|
||||
; 0 != streamMask
|
||||
; streamMask >>= 1, idx += 1, ntz = bx::uint32_cnttz(streamMask)
|
||||
; streamMask >>= 1, idx += 1
|
||||
)
|
||||
{
|
||||
const uint32_t ntz = bx::uint32_cnttz(streamMask);
|
||||
streamMask >>= ntz;
|
||||
idx += ntz;
|
||||
|
||||
|
@ -5881,11 +5881,12 @@ namespace bgfx { namespace d3d11
|
||||
|
||||
if (UINT8_MAX != draw.m_streamMask)
|
||||
{
|
||||
for (uint32_t idx = 0, streamMask = draw.m_streamMask, ntz = bx::uint32_cnttz(streamMask)
|
||||
for (uint32_t idx = 0, streamMask = draw.m_streamMask
|
||||
; 0 != streamMask
|
||||
; streamMask >>= 1, idx += 1, ntz = bx::uint32_cnttz(streamMask), ++numStreams
|
||||
; streamMask >>= 1, idx += 1, ++numStreams
|
||||
)
|
||||
{
|
||||
const uint32_t ntz = bx::uint32_cnttz(streamMask);
|
||||
streamMask >>= ntz;
|
||||
idx += ntz;
|
||||
|
||||
|
@ -3952,11 +3952,12 @@ namespace bgfx { namespace d3d12
|
||||
|
||||
if (UINT8_MAX != _draw.m_streamMask)
|
||||
{
|
||||
for (uint32_t idx = 0, streamMask = _draw.m_streamMask, ntz = bx::uint32_cnttz(streamMask)
|
||||
for (uint32_t idx = 0, streamMask = _draw.m_streamMask
|
||||
; 0 != streamMask
|
||||
; streamMask >>= 1, idx += 1, ntz = bx::uint32_cnttz(streamMask), ++numStreams
|
||||
; streamMask >>= 1, idx += 1, ++numStreams
|
||||
)
|
||||
{
|
||||
const uint32_t ntz = bx::uint32_cnttz(streamMask);
|
||||
streamMask >>= ntz;
|
||||
idx += ntz;
|
||||
|
||||
@ -6255,11 +6256,12 @@ namespace bgfx { namespace d3d12
|
||||
uint8_t numStreams = 0;
|
||||
if (UINT8_MAX != draw.m_streamMask)
|
||||
{
|
||||
for (uint32_t idx = 0, streamMask = draw.m_streamMask, ntz = bx::uint32_cnttz(streamMask)
|
||||
for (uint32_t idx = 0, streamMask = draw.m_streamMask
|
||||
; 0 != streamMask
|
||||
; streamMask >>= 1, idx += 1, ntz = bx::uint32_cnttz(streamMask), ++numStreams
|
||||
; streamMask >>= 1, idx += 1, ++numStreams
|
||||
)
|
||||
{
|
||||
const uint32_t ntz = bx::uint32_cnttz(streamMask);
|
||||
streamMask >>= ntz;
|
||||
idx += ntz;
|
||||
|
||||
|
@ -4228,11 +4228,12 @@ namespace bgfx { namespace d3d9
|
||||
|
||||
uint32_t numVertices = draw.m_numVertices;
|
||||
uint8_t numStreams = 0;
|
||||
for (uint32_t idx = 0, streamMask = draw.m_streamMask, ntz = bx::uint32_cnttz(streamMask)
|
||||
for (uint32_t idx = 0, streamMask = draw.m_streamMask
|
||||
; 0 != streamMask
|
||||
; streamMask >>= 1, idx += 1, ntz = bx::uint32_cnttz(streamMask), ++numStreams
|
||||
; streamMask >>= 1, idx += 1, ++numStreams
|
||||
)
|
||||
{
|
||||
{
|
||||
const uint32_t ntz = bx::uint32_cnttz(streamMask);
|
||||
streamMask >>= ntz;
|
||||
idx += ntz;
|
||||
|
||||
|
@ -7113,11 +7113,12 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
|
||||
|
||||
{
|
||||
bool diffStreamHandles = false;
|
||||
for (uint32_t idx = 0, streamMask = draw.m_streamMask, ntz = bx::uint32_cnttz(streamMask)
|
||||
for (uint32_t idx = 0, streamMask = draw.m_streamMask
|
||||
; 0 != streamMask
|
||||
; streamMask >>= 1, idx += 1, ntz = bx::uint32_cnttz(streamMask)
|
||||
; streamMask >>= 1, idx += 1
|
||||
)
|
||||
{
|
||||
{
|
||||
const uint32_t ntz = bx::uint32_cnttz(streamMask);
|
||||
streamMask >>= ntz;
|
||||
idx += ntz;
|
||||
|
||||
@ -7140,11 +7141,12 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
|
||||
currentState.m_instanceDataOffset = draw.m_instanceDataOffset;
|
||||
currentState.m_instanceDataStride = draw.m_instanceDataStride;
|
||||
|
||||
for (uint32_t idx = 0, streamMask = draw.m_streamMask, ntz = bx::uint32_cnttz(streamMask)
|
||||
for (uint32_t idx = 0, streamMask = draw.m_streamMask
|
||||
; 0 != streamMask
|
||||
; streamMask >>= 1, idx += 1, ntz = bx::uint32_cnttz(streamMask)
|
||||
; streamMask >>= 1, idx += 1
|
||||
)
|
||||
{
|
||||
const uint32_t ntz = bx::uint32_cnttz(streamMask);
|
||||
streamMask >>= ntz;
|
||||
idx += ntz;
|
||||
|
||||
@ -7173,11 +7175,12 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
|
||||
if (0 != currentState.m_streamMask)
|
||||
{
|
||||
bool diffStartVertex = false;
|
||||
for (uint32_t idx = 0, streamMask = draw.m_streamMask, ntz = bx::uint32_cnttz(streamMask)
|
||||
for (uint32_t idx = 0, streamMask = draw.m_streamMask
|
||||
; 0 != streamMask
|
||||
; streamMask >>= 1, idx += 1, ntz = bx::uint32_cnttz(streamMask)
|
||||
; streamMask >>= 1, idx += 1
|
||||
)
|
||||
{
|
||||
{
|
||||
const uint32_t ntz = bx::uint32_cnttz(streamMask);
|
||||
streamMask >>= ntz;
|
||||
idx += ntz;
|
||||
|
||||
@ -7202,11 +7205,12 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
|
||||
|
||||
if (UINT8_MAX != draw.m_streamMask)
|
||||
{
|
||||
for (uint32_t idx = 0, streamMask = draw.m_streamMask, ntz = bx::uint32_cnttz(streamMask)
|
||||
for (uint32_t idx = 0, streamMask = draw.m_streamMask
|
||||
; 0 != streamMask
|
||||
; streamMask >>= 1, idx += 1, ntz = bx::uint32_cnttz(streamMask)
|
||||
; streamMask >>= 1, idx += 1
|
||||
)
|
||||
{
|
||||
{
|
||||
const uint32_t ntz = bx::uint32_cnttz(streamMask);
|
||||
streamMask >>= ntz;
|
||||
idx += ntz;
|
||||
|
||||
@ -7235,11 +7239,12 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
|
||||
uint32_t numVertices = draw.m_numVertices;
|
||||
if (UINT32_MAX == numVertices)
|
||||
{
|
||||
for (uint32_t idx = 0, streamMask = draw.m_streamMask, ntz = bx::uint32_cnttz(streamMask)
|
||||
for (uint32_t idx = 0, streamMask = draw.m_streamMask
|
||||
; 0 != streamMask
|
||||
; streamMask >>= 1, idx += 1, ntz = bx::uint32_cnttz(streamMask)
|
||||
; streamMask >>= 1, idx += 1
|
||||
)
|
||||
{
|
||||
const uint32_t ntz = bx::uint32_cnttz(streamMask);
|
||||
streamMask >>= ntz;
|
||||
idx += ntz;
|
||||
|
||||
|
@ -4199,11 +4199,12 @@ namespace bgfx { namespace mtl
|
||||
|
||||
uint32_t numVertices = draw.m_numVertices;
|
||||
uint8_t numStreams = 0;
|
||||
for (uint32_t idx = 0, streamMask = draw.m_streamMask, ntz = bx::uint32_cnttz(streamMask)
|
||||
for (uint32_t idx = 0, streamMask = draw.m_streamMask
|
||||
; 0 != streamMask
|
||||
; streamMask >>= 1, idx += 1, ntz = bx::uint32_cnttz(streamMask), ++numStreams
|
||||
; streamMask >>= 1, idx += 1, ++numStreams
|
||||
)
|
||||
{
|
||||
{
|
||||
const uint32_t ntz = bx::uint32_cnttz(streamMask);
|
||||
streamMask >>= ntz;
|
||||
idx += ntz;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user