From c9a782f8d65cc8009ede36153bda33274d42167d Mon Sep 17 00:00:00 2001 From: Gordon-F Date: Wed, 23 Jun 2021 20:09:48 +0300 Subject: [PATCH] [hlsl-out] Fix panic with shader with multiple entry points without argument --- src/back/hlsl/writer.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/back/hlsl/writer.rs b/src/back/hlsl/writer.rs index f924435ec0..c452542e42 100644 --- a/src/back/hlsl/writer.rs +++ b/src/back/hlsl/writer.rs @@ -542,7 +542,15 @@ impl<'a, W: Write> Writer<'a, W> { } back::FunctionType::EntryPoint(index) => { // EntryPoint arguments wrapped into structure - if !self.ep_inputs.is_empty() { + // We need to ensure that entry points have arguments too. + // For the case when we working with multiple entry points + // for example vertex shader with arguments and fragment shader without arguments. + if !self.ep_inputs.is_empty() + && !module.entry_points[index as usize] + .function + .arguments + .is_empty() + { if let Some(ref ep_input) = self.ep_inputs[index as usize] { write!( self.out,