[vello_shaders] Use the per_entry_point_map option for MSL

This commit is contained in:
Arman Uguray 2023-03-29 10:09:27 -07:00
parent 87803cc8a6
commit 14ab8d90ae

View file

@ -3,7 +3,7 @@ use naga::back::msl;
use super::{BindType, ShaderInfo}; use super::{BindType, ShaderInfo};
pub fn translate(shader: &ShaderInfo) -> Result<String, msl::Error> { pub fn translate(shader: &ShaderInfo) -> Result<String, msl::Error> {
let mut map = msl::PerStageMap::default(); let mut map = msl::EntryPointResourceMap::default();
let mut buffer_index = 0u8; let mut buffer_index = 0u8;
let mut image_index = 0u8; let mut image_index = 0u8;
let mut binding_map = msl::BindingMap::default(); let mut binding_map = msl::BindingMap::default();
@ -26,18 +26,22 @@ pub fn translate(shader: &ShaderInfo) -> Result<String, msl::Error> {
target.mutable = resource.ty.is_mutable(); target.mutable = resource.ty.is_mutable();
binding_map.insert(binding, target); binding_map.insert(binding, target);
} }
map.cs = msl::PerStageResources { map.insert(
"main".to_string(),
msl::EntryPointResources {
resources: binding_map, resources: binding_map,
push_constant_buffer: None, push_constant_buffer: None,
sizes_buffer: Some(30), sizes_buffer: Some(30),
}; },
);
let options = msl::Options { let options = msl::Options {
lang_version: (2, 0), lang_version: (2, 0),
per_stage_map: map, per_entry_point_map: map,
inline_samplers: vec![], inline_samplers: vec![],
spirv_cross_compatibility: false, spirv_cross_compatibility: false,
fake_missing_bindings: false, fake_missing_bindings: false,
bounds_check_policies: naga::proc::BoundsCheckPolicies::default(), bounds_check_policies: naga::proc::BoundsCheckPolicies::default(),
zero_initialize_workgroup_memory: false,
}; };
let (source, _) = msl::write_string( let (source, _) = msl::write_string(
&shader.module, &shader.module,