Skip to content

Commit ca57f7b

Browse files
committed
sokol: Fix crash when no render target was initialized
1 parent cbb6dc7 commit ca57f7b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Source/Render/sokol/SokolRenderState.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -715,11 +715,12 @@ void cSokolRender::CreateCommand(VertexBuffer* vb, size_t vertices, IndexBuffer*
715715

716716
SokolPipelineContext pipeline_context;
717717
pipeline_context.pipeline_type = pipelineType;
718-
pipeline_context.pipeline_target = SOKOL_PIPELINE_TARGET_SWAPCHAIN;
719718
pipeline_context.pipeline_mode = activePipelineMode;
720719
pipeline_context.primitive_type = activeDrawBuffer->primitive;
721720
pipeline_context.vertex_fmt = vb->fmt;
722-
if (activeRenderTarget == shadowMapRenderTarget) {
721+
if (activeRenderTarget == nullptr) {
722+
pipeline_context.pipeline_target = SOKOL_PIPELINE_TARGET_SWAPCHAIN;
723+
} else if (activeRenderTarget == shadowMapRenderTarget) {
723724
pipeline_context.pipeline_target = SOKOL_PIPELINE_TARGET_SHADOWMAP;
724725
// render back-faces in shadow pass to prevent shadow acne on front-faces
725726
pipeline_context.pipeline_mode.cull = CULL_CCW;

0 commit comments

Comments
 (0)