Skip to content

Commit

Permalink
sokol: Add proper thread checks
Browse files Browse the repository at this point in the history
  • Loading branch information
IonAgorria committed Feb 12, 2024
1 parent 5536738 commit 887524a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Source/Render/sokol/SokolRenderState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ int cSokolRender::Fill(int r, int g, int b, int a) {
}

int cSokolRender::Flush(bool wnd) {
MT_IS_GRAPH();
RenderSubmitEvent(RenderEvent::FLUSH_SCENE);
if (!sdl_window) {
xassert(0);
Expand All @@ -260,6 +261,7 @@ int cSokolRender::Flush(bool wnd) {
}

SokolBuffer* CreateSokolBuffer(MemoryResource* resource, size_t len, bool dynamic, sg_buffer_type type) {
MT_IS_GRAPH();
xassert(!resource->locked);
xassert(len <= resource->data_len);
sg_buffer_desc desc = {};
Expand Down Expand Up @@ -289,6 +291,7 @@ SokolBuffer* CreateSokolBuffer(MemoryResource* resource, size_t len, bool dynami
}

void cSokolRender::FinishActiveDrawBuffer() {
MT_IS_GRAPH();
if (!activeDrawBuffer || !activeDrawBuffer->written_vertices) {
#ifdef PERIMETER_RENDER_TRACKER_DRAW_BUFFER_STATE
RenderSubmitEvent(RenderEvent::FINISH_ACTIVE_DRAW_BUFFER, "No/Empty", activeDrawBuffer);
Expand All @@ -313,6 +316,7 @@ void cSokolRender::FinishActiveDrawBuffer() {
}

void cSokolRender::CreateCommand(VertexBuffer* vb, size_t vertices, IndexBuffer* ib, size_t indices) {
MT_IS_GRAPH();
if (0 == vertices) vertices = activeCommand.vertices;
if (0 == indices) indices = activeCommand.indices;
PIPELINE_TYPE pipelineType = activePipelineType;
Expand Down Expand Up @@ -467,6 +471,7 @@ void cSokolRender::CreateCommand(VertexBuffer* vb, size_t vertices, IndexBuffer*
}

void cSokolRender::SetActiveDrawBuffer(DrawBuffer* db) {
MT_IS_GRAPH();
if (activeDrawBuffer && activeDrawBuffer != db) {
//Submit previous buffer first
if (activeDrawBuffer->IsLocked()) {
Expand Down

0 comments on commit 887524a

Please sign in to comment.