Fixed discard primitive logic.

This commit is contained in:
bkaradzic 2013-07-29 19:01:29 -07:00
parent ebd1595b23
commit a09f804ac3
3 changed files with 31 additions and 2 deletions

View file

@ -643,6 +643,10 @@ namespace bgfx
/// calls.
/// @param _num Number of indices to allocate.
///
/// NOTE:
/// You must call setIndexBuffer after alloc in order to avoid memory
/// leak.
///
void allocTransientIndexBuffer(TransientIndexBuffer* _tib, uint32_t _num);
/// Allocate transient vertex buffer.
@ -653,9 +657,18 @@ namespace bgfx
/// @param _num Number of vertices to allocate.
/// @param _decl Vertex declaration.
///
/// NOTE:
/// You must call setVertexBuffer after alloc in order to avoid memory
/// leak.
///
void allocTransientVertexBuffer(TransientVertexBuffer* _tvb, uint32_t _num, const VertexDecl& _decl);
/// Allocate instance data buffer.
///
/// NOTE:
/// You must call setInstanceDataBuffer after alloc in order to avoid
/// memory leak.
///
const InstanceDataBuffer* allocInstanceDataBuffer(uint32_t _num, uint16_t _stride);
/// Create vertex shader from memory buffer.
@ -951,6 +964,9 @@ namespace bgfx
///
void submitMask(uint32_t _viewMask, int32_t _depth = 0);
/// Discard all previously set state for draw call.
void discard();
/// Request screen shot.
void saveScreenShot(const char* _filePath);

View file

@ -529,7 +529,7 @@ namespace bgfx
{
if (m_discard)
{
m_discard = false;
discard();
return;
}
@ -566,7 +566,7 @@ namespace bgfx
{
if (m_discard)
{
m_discard = false;
discard();
return;
}
@ -1496,6 +1496,12 @@ namespace bgfx
s_ctx.m_submit->submitMask(_viewMask, _depth);
}
void discard()
{
BGFX_CHECK_MAIN_THREAD();
s_ctx.m_submit->discard();
}
void saveScreenShot(const char* _filePath)
{
BGFX_CHECK_MAIN_THREAD();

View file

@ -1153,6 +1153,13 @@ namespace bgfx
}
}
void discard()
{
m_discard = false;
m_state.clear();
m_flags = BGFX_STATE_NONE;
}
void submit(uint8_t _id, int32_t _depth);
void submitMask(uint32_t _viewMask, int32_t _depth);
void sort();