fix(msl-out): use namer for <fun>{Input,Output} structs

This commit is contained in:
Erich Gubler 2024-10-22 08:43:32 -04:00
parent 2302b5fac6
commit 36fab5ce3d
3 changed files with 6 additions and 5 deletions

View File

@ -118,6 +118,7 @@ By @bradwerth [#6216](https://github.com/gfx-rs/wgpu/pull/6216).
- Added `gl_DrawID` to glsl and `DrawIndex` to spv. By @ChosenName in [#6325](https://github.com/gfx-rs/wgpu/pull/6325).
- Matrices can now be indexed by value (#4337), and indexing arrays by value no longer causes excessive spilling (#6358). By @jimblandy in [#6390](https://github.com/gfx-rs/wgpu/pull/6390).
- Add support for `textureQueryLevels` to the GLSL parser. By @magcius in [#6325](https://github.com/gfx-rs/wgpu/pull/6415).
- Fix unescaped identifiers in the Metal backend shader I/O structures causing shader miscompilation. By @ErichDonGubler in [#6438](https://github.com/gfx-rs/wgpu/pull/6438).
#### General

View File

@ -5063,7 +5063,7 @@ template <typename A>
// a struct type named `<fun>Input` to hold them. If we are doing
// vertex pulling, we instead update our attribute mapping to
// note the types, names, and zero values of the attributes.
let stage_in_name = format!("{fun_name}Input");
let stage_in_name = self.namer.call(&format!("{fun_name}Input"));
let varyings_member_name = self.namer.call("varyings");
let mut has_varyings = false;
if !flattened_arguments.is_empty() {
@ -5115,7 +5115,7 @@ template <typename A>
// Define a struct type named for the return value, if any, named
// `<fun>Output`.
let stage_out_name = format!("{fun_name}Output");
let stage_out_name = self.namer.call(&format!("{fun_name}Output"));
let result_member_name = self.namer.call("member");
let result_type_name = match fun.result {
Some(ref result) => {

View File

@ -12,11 +12,11 @@ struct OurVertexShaderOutput {
struct vsInput {
metal::float2 xy [[attribute(0)]];
};
struct vsOutput {
struct vsOutput_1 {
metal::float4 position [[position]];
metal::float2 texcoord [[user(loc0), center_perspective]];
};
vertex vsOutput vs(
vertex vsOutput_1 vs(
vsInput varyings [[stage_in]]
) {
const auto xy = varyings.xy;
@ -24,7 +24,7 @@ vertex vsOutput vs(
vsOutput.position = metal::float4(xy, 0.0, 1.0);
OurVertexShaderOutput _e6 = vsOutput;
const auto _tmp = _e6;
return vsOutput { _tmp.position, _tmp.texcoord };
return vsOutput_1 { _tmp.position, _tmp.texcoord };
}