mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-24 08:21:25 +01:00
msl: emit point size even when there is no struct
This commit is contained in:
1 parent
301e9c3763
commit
f9d7531bb1
1 file changed
+12
-12
+12
-12
@@ -1658,6 +1658,7 @@ impl<W: Write> Writer<W> {
|
||||
) -> BackendResult {
|
||||
match result_struct {
|
||||
Some(struct_name) => {
|
||||
let mut has_point_size = false;
|
||||
let result_ty = context.function.result.as_ref().unwrap().ty;
|
||||
match context.module.types[result_ty].inner {
|
||||
crate::TypeInner::Struct { ref members, .. } => {
|
||||
@@ -1668,7 +1669,6 @@ impl<W: Write> Writer<W> {
|
||||
write!(self.out, "{}return {} {{", level, struct_name)?;
|
||||
|
||||
let mut is_first = true;
|
||||
let mut has_point_size = false;
|
||||
|
||||
for (index, member) in members.iter().enumerate() {
|
||||
match member.binding {
|
||||
@@ -1715,23 +1715,23 @@ impl<W: Write> Writer<W> {
|
||||
write!(self.out, "{} {}.{}", comma, tmp, name)?;
|
||||
}
|
||||
}
|
||||
|
||||
if let FunctionOrigin::EntryPoint(ep_index) = context.origin {
|
||||
let stage = context.module.entry_points[ep_index as usize].stage;
|
||||
if context.pipeline_options.allow_point_size
|
||||
&& stage == crate::ShaderStage::Vertex
|
||||
&& !has_point_size
|
||||
{
|
||||
// point size was injected and comes last
|
||||
write!(self.out, ", 1.0")?;
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
write!(self.out, "{}return {} {{ ", level, struct_name)?;
|
||||
self.put_expression(expr_handle, context, true)?;
|
||||
}
|
||||
}
|
||||
|
||||
if let FunctionOrigin::EntryPoint(ep_index) = context.origin {
|
||||
let stage = context.module.entry_points[ep_index as usize].stage;
|
||||
if context.pipeline_options.allow_point_size
|
||||
&& stage == crate::ShaderStage::Vertex
|
||||
&& !has_point_size
|
||||
{
|
||||
// point size was injected and comes last
|
||||
write!(self.out, ", 1.0")?;
|
||||
}
|
||||
}
|
||||
write!(self.out, " }}")?;
|
||||
}
|
||||
None => {
|
||||
|
||||
Reference in new issue
Block a user