From b6a3b3c598d25dab40380669d4f018c16fe34f69 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Fri, 5 Feb 2016 16:32:02 +0100 Subject: [PATCH] Add input attribute types to vertex shader type --- shader-parser/src/lib.rs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/shader-parser/src/lib.rs b/shader-parser/src/lib.rs index ea36ae1d..762e39ed 100644 --- a/shader-parser/src/lib.rs +++ b/shader-parser/src/lib.rs @@ -113,7 +113,26 @@ fn write_entry_point(doc: &parse::Spirv, instruction: &parse::Instruction) -> St let ty = match *execution { enums::ExecutionModel::ExecutionModelVertex => { - format!("::vulkano::shader::VertexShaderEntryPoint") + let mut input_types = Vec::new(); + + // TODO: sort types by location + + for interface in interface.iter() { + for i in doc.instructions.iter() { + match i { + &parse::Instruction::Variable { result_type_id, result_id, + storage_class: enums::StorageClass::StorageClassInput, .. } + if &result_id == interface => + { + input_types.push(type_from_id(doc, result_type_id)); + }, + _ => () + } + } + } + + format!("::vulkano::shader::VertexShaderEntryPoint<({input})>", + input = input_types.join(", ") + ",") }, enums::ExecutionModel::ExecutionModelTessellationControl => {