mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-21 22:34:43 +00:00
Fix compilation of geometry shaders
This commit is contained in:
parent
f58894b049
commit
b909682401
@ -16,14 +16,15 @@ use location_decoration;
|
||||
use name_from_id;
|
||||
|
||||
pub fn write_entry_point(doc: &parse::Spirv, instruction: &parse::Instruction) -> (String, String) {
|
||||
let (execution, ep_name, interface) = match instruction {
|
||||
let (execution, id, ep_name, interface) = match instruction {
|
||||
&parse::Instruction::EntryPoint {
|
||||
ref execution,
|
||||
id,
|
||||
ref name,
|
||||
ref interface,
|
||||
..
|
||||
} => {
|
||||
(execution, name, interface)
|
||||
(execution, id, name, interface)
|
||||
},
|
||||
_ => unreachable!(),
|
||||
};
|
||||
@ -88,13 +89,35 @@ pub fn write_entry_point(doc: &parse::Spirv, instruction: &parse::Instruction) -
|
||||
},
|
||||
|
||||
enums::ExecutionModel::ExecutionModelGeometry => {
|
||||
let mut execution_mode = "Points"; // fallback value
|
||||
|
||||
for instruction in doc.instructions.iter() {
|
||||
if let &parse::Instruction::ExecutionMode { target_id, ref mode, .. } = instruction {
|
||||
if target_id != id {
|
||||
continue;
|
||||
}
|
||||
execution_mode = match mode {
|
||||
&enums::ExecutionMode::ExecutionModeInputPoints => "Points",
|
||||
&enums::ExecutionMode::ExecutionModeInputLines => "Lines",
|
||||
&enums::ExecutionMode::ExecutionModeInputLinesAdjacency => "LinesWithAdjacency",
|
||||
&enums::ExecutionMode::ExecutionModeTriangles => "Triangles",
|
||||
&enums::ExecutionMode::ExecutionModeInputTrianglesAdjacency => "TrianglesWithAdjacency",
|
||||
_ => continue,
|
||||
};
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
let execution_mode = format!("::vulkano::pipeline::shader::GeometryShaderExecutionMode::{0}", execution_mode);
|
||||
|
||||
let t = format!("::vulkano::pipeline::shader::GeometryShaderEntryPoint<(), {0}Input, \
|
||||
{0}Output, Layout>",
|
||||
capitalized_ep_name);
|
||||
let f = format!("geometry_shader_entry_point(::std::ffi::CStr::from_ptr(NAME.\
|
||||
as_ptr() as *const _), {0}Input, {0}Output, Layout(ShaderStages {{ \
|
||||
as_ptr() as *const _), {1}, {0}Input, {0}Output, Layout(ShaderStages {{ \
|
||||
geometry: true, .. ShaderStages::none() }}))",
|
||||
capitalized_ep_name);
|
||||
capitalized_ep_name,
|
||||
execution_mode);
|
||||
(t, f)
|
||||
},
|
||||
|
||||
|
@ -108,6 +108,11 @@ pub enum Instruction {
|
||||
name: String,
|
||||
interface: Vec<u32>,
|
||||
},
|
||||
ExecutionMode {
|
||||
target_id: u32,
|
||||
mode: ExecutionMode,
|
||||
optional_literals: Vec<u32>,
|
||||
},
|
||||
Capability(Capability),
|
||||
TypeVoid { result_id: u32 },
|
||||
TypeBool { result_id: u32 },
|
||||
@ -227,6 +232,13 @@ fn decode_instruction(opcode: u16, operands: &[u32]) -> Result<Instruction, Pars
|
||||
interface: r.to_owned(),
|
||||
}
|
||||
},
|
||||
16 => {
|
||||
Instruction::ExecutionMode {
|
||||
target_id: operands[0],
|
||||
mode: ExecutionMode::from_num(operands[1])?,
|
||||
optional_literals: operands[2..].to_vec(),
|
||||
}
|
||||
}
|
||||
17 => Instruction::Capability(Capability::from_num(operands[0])?),
|
||||
19 => Instruction::TypeVoid { result_id: operands[0] },
|
||||
20 => Instruction::TypeBool { result_id: operands[0] },
|
||||
|
Loading…
Reference in New Issue
Block a user