mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-17 20:52:36 +01:00
Cleanup.
This commit is contained in:
30
src/bgfx.cpp
30
src/bgfx.cpp
@@ -858,14 +858,14 @@ namespace bgfx
|
||||
if (m_discard)
|
||||
{
|
||||
discard();
|
||||
return m_num;
|
||||
return m_numRenderItems;
|
||||
}
|
||||
|
||||
if (BGFX_CONFIG_MAX_DRAW_CALLS-1 <= m_num
|
||||
if (BGFX_CONFIG_MAX_DRAW_CALLS-1 <= m_numRenderItems
|
||||
|| (0 == m_draw.m_numVertices && 0 == m_draw.m_numIndices) )
|
||||
{
|
||||
++m_numDropped;
|
||||
return m_num;
|
||||
return m_numRenderItems;
|
||||
}
|
||||
|
||||
m_uniformEnd = m_uniformBuffer->getPos();
|
||||
@@ -888,9 +888,8 @@ namespace bgfx
|
||||
s_ctx->m_seq[_id]++;
|
||||
|
||||
uint64_t key = m_key.encodeDraw(type);
|
||||
m_sortKeys[m_num] = key;
|
||||
m_sortValues[m_num] = m_numRenderItems;
|
||||
++m_num;
|
||||
m_sortKeys[m_numRenderItems] = key;
|
||||
m_sortValues[m_numRenderItems] = m_numRenderItems;
|
||||
|
||||
m_draw.m_constBegin = m_uniformBegin;
|
||||
m_draw.m_constEnd = m_uniformEnd;
|
||||
@@ -928,7 +927,7 @@ namespace bgfx
|
||||
m_stateFlags = BGFX_STATE_NONE;
|
||||
}
|
||||
|
||||
return m_num;
|
||||
return m_numRenderItems;
|
||||
}
|
||||
|
||||
uint32_t Frame::dispatch(uint8_t _id, ProgramHandle _handle, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags)
|
||||
@@ -936,13 +935,13 @@ namespace bgfx
|
||||
if (m_discard)
|
||||
{
|
||||
discard();
|
||||
return m_num;
|
||||
return m_numRenderItems;
|
||||
}
|
||||
|
||||
if (BGFX_CONFIG_MAX_DRAW_CALLS-1 <= m_num)
|
||||
if (BGFX_CONFIG_MAX_DRAW_CALLS-1 <= m_numRenderItems)
|
||||
{
|
||||
++m_numDropped;
|
||||
return m_num;
|
||||
return m_numRenderItems;
|
||||
}
|
||||
|
||||
m_uniformEnd = m_uniformBuffer->getPos();
|
||||
@@ -961,9 +960,8 @@ namespace bgfx
|
||||
s_ctx->m_seq[_id]++;
|
||||
|
||||
uint64_t key = m_key.encodeCompute();
|
||||
m_sortKeys[m_num] = key;
|
||||
m_sortValues[m_num] = m_numRenderItems;
|
||||
++m_num;
|
||||
m_sortKeys[m_numRenderItems] = key;
|
||||
m_sortValues[m_numRenderItems] = m_numRenderItems;
|
||||
|
||||
m_compute.m_constBegin = m_uniformBegin;
|
||||
m_compute.m_constEnd = m_uniformEnd;
|
||||
@@ -975,7 +973,7 @@ namespace bgfx
|
||||
m_bind.clear();
|
||||
m_uniformBegin = m_uniformEnd;
|
||||
|
||||
return m_num;
|
||||
return m_numRenderItems;
|
||||
}
|
||||
|
||||
void Frame::blit(uint8_t _id, TextureHandle _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, TextureHandle _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth)
|
||||
@@ -1020,11 +1018,11 @@ namespace bgfx
|
||||
viewRemap[m_viewRemap[ii] ] = uint8_t(ii);
|
||||
}
|
||||
|
||||
for (uint32_t ii = 0, num = m_num; ii < num; ++ii)
|
||||
for (uint32_t ii = 0, num = m_numRenderItems; ii < num; ++ii)
|
||||
{
|
||||
m_sortKeys[ii] = SortKey::remapView(m_sortKeys[ii], viewRemap);
|
||||
}
|
||||
bx::radixSort(m_sortKeys, s_ctx->m_tempKeys, m_sortValues, s_ctx->m_tempValues, m_num);
|
||||
bx::radixSort(m_sortKeys, s_ctx->m_tempKeys, m_sortValues, s_ctx->m_tempValues, m_numRenderItems);
|
||||
|
||||
for (uint32_t ii = 0, num = m_numBlitItems; ii < num; ++ii)
|
||||
{
|
||||
|
||||
@@ -1612,7 +1612,6 @@ namespace bgfx
|
||||
m_matrixCache.reset();
|
||||
m_rectCache.reset();
|
||||
m_key.reset();
|
||||
m_num = 0;
|
||||
m_numRenderItems = 0;
|
||||
m_numDropped = 0;
|
||||
m_numBlitItems = 0;
|
||||
@@ -1636,7 +1635,7 @@ namespace bgfx
|
||||
if (0 < m_numDropped)
|
||||
{
|
||||
BX_TRACE("Too many draw calls: %d, dropped %d (max: %d)"
|
||||
, m_num+m_numDropped
|
||||
, m_numRenderItems+m_numDropped
|
||||
, m_numDropped
|
||||
, BGFX_CONFIG_MAX_DRAW_CALLS
|
||||
);
|
||||
@@ -2001,7 +2000,6 @@ namespace bgfx
|
||||
|
||||
UniformBuffer* m_uniformBuffer;
|
||||
|
||||
RenderItemCount m_num;
|
||||
RenderItemCount m_numRenderItems;
|
||||
RenderItemCount m_numDropped;
|
||||
uint16_t m_numBlitItems;
|
||||
|
||||
@@ -5651,7 +5651,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
||||
uint8_t restartState = 0;
|
||||
viewState.m_rect = _render->m_rect[0];
|
||||
|
||||
int32_t numItems = _render->m_num;
|
||||
int32_t numItems = _render->m_numRenderItems;
|
||||
for (int32_t item = 0, restartItem = numItems; item < numItems || restartItem < numItems;)
|
||||
{
|
||||
const uint64_t encodedKey = _render->m_sortKeys[item];
|
||||
@@ -6439,7 +6439,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
||||
|
||||
submitBlit(bs, BGFX_CONFIG_MAX_VIEWS);
|
||||
|
||||
if (0 < _render->m_num)
|
||||
if (0 < _render->m_numRenderItems)
|
||||
{
|
||||
if (0 != (m_resolution.m_flags & BGFX_RESET_FLUSH_AFTER_RENDER) )
|
||||
{
|
||||
@@ -6567,7 +6567,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
||||
|
||||
double elapsedCpuMs = double(frameTime)*toMs;
|
||||
tvm.printf(10, pos++, 0x8e, " Submitted: %5d (draw %5d, compute %4d) / CPU %7.4f [ms] %c GPU %7.4f [ms] (latency %d) "
|
||||
, _render->m_num
|
||||
, _render->m_numRenderItems
|
||||
, statsKeyType[0]
|
||||
, statsKeyType[1]
|
||||
, elapsedCpuMs
|
||||
|
||||
@@ -5127,7 +5127,7 @@ data.NumQualityLevels = 0;
|
||||
// uint8_t restartState = 0;
|
||||
viewState.m_rect = _render->m_rect[0];
|
||||
|
||||
int32_t numItems = _render->m_num;
|
||||
int32_t numItems = _render->m_numRenderItems;
|
||||
for (int32_t item = 0, restartItem = numItems; item < numItems || restartItem < numItems;)
|
||||
{
|
||||
const uint64_t encodedKey = _render->m_sortKeys[item];
|
||||
@@ -5690,7 +5690,7 @@ data.NumQualityLevels = 0;
|
||||
|
||||
submitBlit(bs, BGFX_CONFIG_MAX_VIEWS);
|
||||
|
||||
if (0 < _render->m_num)
|
||||
if (0 < _render->m_numRenderItems)
|
||||
{
|
||||
if (0 != (m_resolution.m_flags & BGFX_RESET_FLUSH_AFTER_RENDER) )
|
||||
{
|
||||
@@ -5864,7 +5864,7 @@ data.NumQualityLevels = 0;
|
||||
|
||||
double elapsedCpuMs = double(frameTime)*toMs;
|
||||
tvm.printf(10, pos++, 0x8e, " Submitted: %5d (draw %5d, compute %4d) / CPU %7.4f [ms] "
|
||||
, _render->m_num
|
||||
, _render->m_numRenderItems
|
||||
, statsKeyType[0]
|
||||
, statsKeyType[1]
|
||||
, elapsedCpuMs
|
||||
|
||||
@@ -3767,7 +3767,7 @@ namespace bgfx { namespace d3d9
|
||||
|
||||
if (0 == (_render->m_debug&BGFX_DEBUG_IFH) )
|
||||
{
|
||||
for (uint32_t item = 0, numItems = _render->m_num; item < numItems; ++item)
|
||||
for (uint32_t item = 0, numItems = _render->m_numRenderItems; item < numItems; ++item)
|
||||
{
|
||||
const uint64_t encodedKey = _render->m_sortKeys[item];
|
||||
const bool isCompute = key.decode(encodedKey, _render->m_viewRemap);
|
||||
@@ -4319,7 +4319,7 @@ namespace bgfx { namespace d3d9
|
||||
|
||||
submitBlit(bs, BGFX_CONFIG_MAX_VIEWS);
|
||||
|
||||
if (0 < _render->m_num)
|
||||
if (0 < _render->m_numRenderItems)
|
||||
{
|
||||
if (0 != (m_resolution.m_flags & BGFX_RESET_FLUSH_AFTER_RENDER) )
|
||||
{
|
||||
@@ -4422,7 +4422,7 @@ namespace bgfx { namespace d3d9
|
||||
|
||||
double elapsedCpuMs = double(frameTime)*toMs;
|
||||
tvm.printf(10, pos++, 0x8e, " Submitted: %5d (draw %5d, compute %4d) / CPU %7.4f [ms] %c GPU %7.4f [ms] (latency %d)"
|
||||
, _render->m_num
|
||||
, _render->m_numRenderItems
|
||||
, statsKeyType[0]
|
||||
, statsKeyType[1]
|
||||
, elapsedCpuMs
|
||||
|
||||
@@ -6629,7 +6629,7 @@ namespace bgfx { namespace gl
|
||||
uint8_t restartState = 0;
|
||||
viewState.m_rect = _render->m_rect[0];
|
||||
|
||||
int32_t numItems = _render->m_num;
|
||||
int32_t numItems = _render->m_numRenderItems;
|
||||
for (int32_t item = 0, restartItem = numItems; item < numItems || restartItem < numItems;)
|
||||
{
|
||||
const uint64_t encodedKey = _render->m_sortKeys[item];
|
||||
@@ -7578,7 +7578,7 @@ namespace bgfx { namespace gl
|
||||
GL_CHECK(glBindVertexArray(m_vao) );
|
||||
}
|
||||
|
||||
if (0 < _render->m_num)
|
||||
if (0 < _render->m_numRenderItems)
|
||||
{
|
||||
if (0 != (m_resolution.m_flags & BGFX_RESET_FLUSH_AFTER_RENDER) )
|
||||
{
|
||||
@@ -7683,7 +7683,7 @@ namespace bgfx { namespace gl
|
||||
|
||||
double elapsedCpuMs = double(frameTime)*toMs;
|
||||
tvm.printf(10, pos++, 0x8e, " Submitted: %5d (draw %5d, compute %4d) / CPU %7.4f [ms] %c GPU %7.4f [ms] (latency %d) "
|
||||
, _render->m_num
|
||||
, _render->m_numRenderItems
|
||||
, statsKeyType[0]
|
||||
, statsKeyType[1]
|
||||
, elapsedCpuMs
|
||||
|
||||
@@ -3271,7 +3271,7 @@ namespace bgfx { namespace mtl
|
||||
uint8_t restartState = 0;
|
||||
viewState.m_rect = _render->m_rect[0];
|
||||
|
||||
int32_t numItems = _render->m_num;
|
||||
int32_t numItems = _render->m_numRenderItems;
|
||||
for (int32_t item = 0, restartItem = numItems; item < numItems || restartItem < numItems;)
|
||||
{
|
||||
const uint64_t encodedKey = _render->m_sortKeys[item];
|
||||
@@ -3879,7 +3879,7 @@ namespace bgfx { namespace mtl
|
||||
|
||||
submitBlit(bs, BGFX_CONFIG_MAX_VIEWS);
|
||||
|
||||
if (0 < _render->m_num)
|
||||
if (0 < _render->m_numRenderItems)
|
||||
{
|
||||
captureElapsed = -bx::getHPCounter();
|
||||
capture();
|
||||
@@ -3890,7 +3890,7 @@ namespace bgfx { namespace mtl
|
||||
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_MTL) )
|
||||
{
|
||||
if (0 < _render->m_num)
|
||||
if (0 < _render->m_numRenderItems)
|
||||
{
|
||||
rce.popDebugGroup();
|
||||
}
|
||||
@@ -3973,7 +3973,7 @@ namespace bgfx { namespace mtl
|
||||
|
||||
double elapsedCpuMs = double(frameTime)*toMs;
|
||||
tvm.printf(10, pos++, 0x8e, " Submitted: %4d (draw %4d, compute %4d) / CPU %3.4f [ms] %c GPU %3.4f [ms] (latency %d)"
|
||||
, _render->m_num
|
||||
, _render->m_numRenderItems
|
||||
, statsKeyType[0]
|
||||
, statsKeyType[1]
|
||||
, elapsedCpuMs
|
||||
|
||||
@@ -3758,7 +3758,7 @@ VK_DESTROY
|
||||
// uint8_t restartState = 0;
|
||||
viewState.m_rect = _render->m_rect[0];
|
||||
|
||||
int32_t numItems = _render->m_num;
|
||||
int32_t numItems = _render->m_numRenderItems;
|
||||
for (int32_t item = 0, restartItem = numItems; item < numItems || restartItem < numItems;)
|
||||
{
|
||||
const uint64_t encodedKey = _render->m_sortKeys[item];
|
||||
@@ -4495,7 +4495,7 @@ BX_UNUSED(presentMin, presentMax);
|
||||
|
||||
double elapsedCpuMs = double(frameTime)*toMs;
|
||||
tvm.printf(10, pos++, 0x8e, " Submitted: %5d (draw %5d, compute %4d) / CPU %7.4f [ms] "
|
||||
, _render->m_num
|
||||
, _render->m_numRenderItems
|
||||
, statsKeyType[0]
|
||||
, statsKeyType[1]
|
||||
, elapsedCpuMs
|
||||
|
||||
Reference in New Issue
Block a user