diff --git a/src/back/hlsl/writer.rs b/src/back/hlsl/writer.rs index 78cff0ce81..c42cf9f454 100644 --- a/src/back/hlsl/writer.rs +++ b/src/back/hlsl/writer.rs @@ -773,7 +773,8 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> { back::FunctionType::Function(handle) => { for (index, arg) in func.arguments.iter().enumerate() { // Write argument type - let arg_ty = match module.types[arg.ty].inner { + let ty_inner = &module.types[arg.ty].inner; + let arg_ty = match *ty_inner { // pointers in function arguments are expected and resolve to `inout` TypeInner::Pointer { base, .. } => { //TODO: can we narrow this down to just `in` when possible? @@ -789,6 +790,9 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> { // Write argument name. Space is important. write!(self.out, " {}", argument_name)?; + if let TypeInner::Array { size, .. } = *ty_inner { + self.write_array_size(module, size)?; + } if index < func.arguments.len() - 1 { // Add a separator between args write!(self.out, ", ")?; @@ -1858,7 +1862,7 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> { components: &[Handle], ) -> BackendResult { let (open_b, close_b) = match module.types[ty].inner { - TypeInner::Struct { .. } => ("{ ", " }"), + TypeInner::Array { .. } | TypeInner::Struct { .. } => ("{ ", " }"), _ => { // We should write type only for non struct constants self.write_type(module, ty)?; diff --git a/tests/out/hlsl/quad-vert.hlsl b/tests/out/hlsl/quad-vert.hlsl index 72cf5a0d50..d190a05e55 100644 --- a/tests/out/hlsl/quad-vert.hlsl +++ b/tests/out/hlsl/quad-vert.hlsl @@ -16,7 +16,7 @@ struct type10 { static float2 v_uv = (float2)0; static float2 a_uv1 = (float2)0; -static gl_PerVertex perVertexStruct = { float4(0.0, 0.0, 0.0, 1.0), 1.0, float(0.0), float(0.0) }; +static gl_PerVertex perVertexStruct = { float4(0.0, 0.0, 0.0, 1.0), 1.0, { 0.0 }, { 0.0 } }; static float2 a_pos1 = (float2)0; struct VertexInput_main {