Skip to content

Commit e4fbdfb

Browse files
committed
Fixed bgfx::discard to not reset uniforms to begining of buffer.
1 parent 47210b3 commit e4fbdfb

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/bgfx_p.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2642,7 +2642,10 @@ namespace bgfx
26422642
// clear all bytes (inclusively the padding) before we start.
26432643
bx::memSet(&m_bind, 0, sizeof(m_bind) );
26442644

2645-
discard(BGFX_DISCARD_ALL);
2645+
m_discard = false;
2646+
m_draw.clear(BGFX_DISCARD_ALL);
2647+
m_compute.clear(BGFX_DISCARD_ALL);
2648+
m_bind.clear(BGFX_DISCARD_ALL);
26462649
}
26472650

26482651
void begin(Frame* _frame, uint8_t _idx)
@@ -2981,6 +2984,13 @@ namespace bgfx
29812984
m_draw.clear(_flags);
29822985
m_compute.clear(_flags);
29832986
m_bind.clear(_flags);
2987+
2988+
if (_flags & BGFX_DISCARD_STATE)
2989+
{
2990+
UniformBuffer* uniformBuffer = m_frame->m_uniformBuffer[m_uniformIdx];
2991+
m_uniformEnd = uniformBuffer->getPos();
2992+
m_uniformBegin = m_uniformEnd;
2993+
}
29842994
}
29852995

29862996
void submit(ViewId _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, uint32_t _depth, uint8_t _flags);

0 commit comments

Comments
 (0)