mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-25 00:04:15 +00:00
Pass correct shader stages for the descriptors
This commit is contained in:
parent
5b14cbdb22
commit
c246a92a7e
@ -77,7 +77,7 @@ pub fn write_descriptor_sets(doc: &parse::Spirv) -> String {
|
|||||||
binding: {binding},
|
binding: {binding},
|
||||||
ty: {desc_ty},
|
ty: {desc_ty},
|
||||||
array_count: 1,
|
array_count: 1,
|
||||||
stages: ShaderStages::all(), // TODO:
|
stages: stages.clone(),
|
||||||
readonly: {readonly},
|
readonly: {readonly},
|
||||||
}}", binding = d.binding, desc_ty = d.desc_ty,
|
}}", binding = d.binding, desc_ty = d.desc_ty,
|
||||||
readonly = if d.readonly { "true" } else { "false" })
|
readonly = if d.readonly { "true" } else { "false" })
|
||||||
@ -85,7 +85,7 @@ pub fn write_descriptor_sets(doc: &parse::Spirv) -> String {
|
|||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
output.push_str(&format!(r#"
|
output.push_str(&format!(r#"
|
||||||
fn set{set}_layout() -> VecIntoIter<DescriptorDesc> {{
|
fn set{set}_layout(stages: ShaderStages) -> VecIntoIter<DescriptorDesc> {{
|
||||||
vec![
|
vec![
|
||||||
{descr}
|
{descr}
|
||||||
].into_iter()
|
].into_iter()
|
||||||
@ -96,8 +96,7 @@ pub fn write_descriptor_sets(doc: &parse::Spirv) -> String {
|
|||||||
let max_set = sets_list.iter().cloned().max().map(|v| v + 1).unwrap_or(0);
|
let max_set = sets_list.iter().cloned().max().map(|v| v + 1).unwrap_or(0);
|
||||||
|
|
||||||
output.push_str(&format!(r#"
|
output.push_str(&format!(r#"
|
||||||
#[derive(Default)]
|
pub struct Layout(ShaderStages);
|
||||||
pub struct Layout;
|
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
unsafe impl PipelineLayoutDesc for Layout {{
|
unsafe impl PipelineLayoutDesc for Layout {{
|
||||||
@ -111,7 +110,7 @@ pub fn write_descriptor_sets(doc: &parse::Spirv) -> String {
|
|||||||
}}
|
}}
|
||||||
}}
|
}}
|
||||||
|
|
||||||
"#, layouts = (0 .. max_set).map(|n| format!("set{}_layout()", n)).collect::<Vec<_>>().join(",")));
|
"#, layouts = (0 .. max_set).map(|n| format!("set{}_layout(self.0)", n)).collect::<Vec<_>>().join(",")));
|
||||||
|
|
||||||
output
|
output
|
||||||
}
|
}
|
||||||
|
@ -32,37 +32,37 @@ pub fn write_entry_point(doc: &parse::Spirv, instruction: &parse::Instruction) -
|
|||||||
let (ty, f_call) = match *execution {
|
let (ty, f_call) = match *execution {
|
||||||
enums::ExecutionModel::ExecutionModelVertex => {
|
enums::ExecutionModel::ExecutionModelVertex => {
|
||||||
let t = format!("::vulkano::pipeline::shader::VertexShaderEntryPoint<(), {0}Input, {0}Output, Layout>", capitalized_ep_name);
|
let t = format!("::vulkano::pipeline::shader::VertexShaderEntryPoint<(), {0}Input, {0}Output, Layout>", capitalized_ep_name);
|
||||||
let f = format!("vertex_shader_entry_point(::std::ffi::CStr::from_ptr(NAME.as_ptr() as *const _), {0}Input, {0}Output, Layout)", capitalized_ep_name);
|
let f = format!("vertex_shader_entry_point(::std::ffi::CStr::from_ptr(NAME.as_ptr() as *const _), {0}Input, {0}Output, Layout(ShaderStages {{ vertex: true, .. ShaderStages::none() }}))", capitalized_ep_name);
|
||||||
(t, f)
|
(t, f)
|
||||||
},
|
},
|
||||||
|
|
||||||
enums::ExecutionModel::ExecutionModelTessellationControl => {
|
enums::ExecutionModel::ExecutionModelTessellationControl => {
|
||||||
let t = format!("::vulkano::pipeline::shader::TessControlShaderEntryPoint<(), {0}Input, {0}Output, Layout>", capitalized_ep_name);
|
let t = format!("::vulkano::pipeline::shader::TessControlShaderEntryPoint<(), {0}Input, {0}Output, Layout>", capitalized_ep_name);
|
||||||
let f = format!("tess_control_shader_entry_point(::std::ffi::CStr::from_ptr(NAME.as_ptr() as *const _), {0}Input, {0}Output, Layout)", capitalized_ep_name);
|
let f = format!("tess_control_shader_entry_point(::std::ffi::CStr::from_ptr(NAME.as_ptr() as *const _), {0}Input, {0}Output, Layout(ShaderStages {{ tessellation_control: true, .. ShaderStages::none() }}))", capitalized_ep_name);
|
||||||
(t, f)
|
(t, f)
|
||||||
},
|
},
|
||||||
|
|
||||||
enums::ExecutionModel::ExecutionModelTessellationEvaluation => {
|
enums::ExecutionModel::ExecutionModelTessellationEvaluation => {
|
||||||
let t = format!("::vulkano::pipeline::shader::TessEvaluationShaderEntryPoint<(), {0}Input, {0}Output, Layout>", capitalized_ep_name);
|
let t = format!("::vulkano::pipeline::shader::TessEvaluationShaderEntryPoint<(), {0}Input, {0}Output, Layout>", capitalized_ep_name);
|
||||||
let f = format!("tess_evaluation_shader_entry_point(::std::ffi::CStr::from_ptr(NAME.as_ptr() as *const _), {0}Input, {0}Output, Layout)", capitalized_ep_name);
|
let f = format!("tess_evaluation_shader_entry_point(::std::ffi::CStr::from_ptr(NAME.as_ptr() as *const _), {0}Input, {0}Output, Layout(ShaderStages {{ tessellation_evaluation: true, .. ShaderStages::none() }}))", capitalized_ep_name);
|
||||||
(t, f)
|
(t, f)
|
||||||
},
|
},
|
||||||
|
|
||||||
enums::ExecutionModel::ExecutionModelGeometry => {
|
enums::ExecutionModel::ExecutionModelGeometry => {
|
||||||
let t = format!("::vulkano::pipeline::shader::GeometryShaderEntryPoint<(), {0}Input, {0}Output, Layout>", capitalized_ep_name);
|
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)", 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 {{ geometry: true, .. ShaderStages::none() }}))", capitalized_ep_name);
|
||||||
(t, f)
|
(t, f)
|
||||||
},
|
},
|
||||||
|
|
||||||
enums::ExecutionModel::ExecutionModelFragment => {
|
enums::ExecutionModel::ExecutionModelFragment => {
|
||||||
let t = format!("::vulkano::pipeline::shader::FragmentShaderEntryPoint<(), {0}Input, {0}Output, Layout>", capitalized_ep_name);
|
let t = format!("::vulkano::pipeline::shader::FragmentShaderEntryPoint<(), {0}Input, {0}Output, Layout>", capitalized_ep_name);
|
||||||
let f = format!("fragment_shader_entry_point(::std::ffi::CStr::from_ptr(NAME.as_ptr() as *const _), {0}Input, {0}Output, Layout)", capitalized_ep_name);
|
let f = format!("fragment_shader_entry_point(::std::ffi::CStr::from_ptr(NAME.as_ptr() as *const _), {0}Input, {0}Output, Layout(ShaderStages {{ fragment: true, .. ShaderStages::none() }}))", capitalized_ep_name);
|
||||||
(t, f)
|
(t, f)
|
||||||
},
|
},
|
||||||
|
|
||||||
enums::ExecutionModel::ExecutionModelGLCompute => {
|
enums::ExecutionModel::ExecutionModelGLCompute => {
|
||||||
(format!("::vulkano::pipeline::shader::ComputeShaderEntryPoint<(), Layout>"),
|
(format!("::vulkano::pipeline::shader::ComputeShaderEntryPoint<(), Layout>"),
|
||||||
format!("compute_shader_entry_point(::std::ffi::CStr::from_ptr(NAME.as_ptr() as *const _), Layout)"))
|
format!("compute_shader_entry_point(::std::ffi::CStr::from_ptr(NAME.as_ptr() as *const _), Layout(ShaderStages {{ compute: true, .. ShaderStages::none() }}))"))
|
||||||
},
|
},
|
||||||
|
|
||||||
enums::ExecutionModel::ExecutionModelKernel => panic!("Kernels are not supported"),
|
enums::ExecutionModel::ExecutionModelKernel => panic!("Kernels are not supported"),
|
||||||
|
Loading…
Reference in New Issue
Block a user