Skip to content

Commit

Permalink
sokol: Fix crash when no render target was initialized
Browse files Browse the repository at this point in the history
  • Loading branch information
IonAgorria committed Oct 28, 2024
1 parent cbb6dc7 commit ca57f7b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Source/Render/sokol/SokolRenderState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -715,11 +715,12 @@ void cSokolRender::CreateCommand(VertexBuffer* vb, size_t vertices, IndexBuffer*

SokolPipelineContext pipeline_context;
pipeline_context.pipeline_type = pipelineType;
pipeline_context.pipeline_target = SOKOL_PIPELINE_TARGET_SWAPCHAIN;
pipeline_context.pipeline_mode = activePipelineMode;
pipeline_context.primitive_type = activeDrawBuffer->primitive;
pipeline_context.vertex_fmt = vb->fmt;
if (activeRenderTarget == shadowMapRenderTarget) {
if (activeRenderTarget == nullptr) {
pipeline_context.pipeline_target = SOKOL_PIPELINE_TARGET_SWAPCHAIN;
} else if (activeRenderTarget == shadowMapRenderTarget) {
pipeline_context.pipeline_target = SOKOL_PIPELINE_TARGET_SHADOWMAP;
// render back-faces in shadow pass to prevent shadow acne on front-faces
pipeline_context.pipeline_mode.cull = CULL_CCW;
Expand Down

0 comments on commit ca57f7b

Please sign in to comment.