mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 10:35:43 -05:00
Fixed discard primitive logic.
This commit is contained in:
parent
ebd1595b23
commit
a09f804ac3
3 changed files with 31 additions and 2 deletions
|
@ -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);
|
||||
|
||||
|
|
10
src/bgfx.cpp
10
src/bgfx.cpp
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue