Skip to content

Commit 056509a

Browse files
authored
fix create_pipeline crash in vulkan-enabled layer without calling load_param/load_model first (#5410)
1 parent 3b048d1 commit 056509a

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/layer.cpp

+10-3
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,16 @@ class Layer_final : public Layer
362362
#if NCNN_VULKAN
363363
if (layer_vulkan)
364364
{
365-
int ret = layer_vulkan->create_pipeline(opt);
366-
get_layer_properties();
367-
return ret;
365+
if (vkdev)
366+
{
367+
int ret = layer_vulkan->create_pipeline(opt);
368+
get_layer_properties();
369+
return ret;
370+
}
371+
372+
// fallback to cpu layer
373+
delete layer_vulkan;
374+
layer_vulkan = 0;
368375
}
369376
#endif // NCNN_VULKAN
370377

0 commit comments

Comments
 (0)