Skip to content

Commit

Permalink
Add snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
evahop committed Sep 28, 2023
1 parent d023ab8 commit 7724f35
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/in/msl-varyings.wgsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
struct Vertex {
@location(0) position: vec2f
}

struct NoteInstance {
@location(1) position: vec2f
}

struct VertexOutput {
@builtin(position) position: vec4f
}

@vertex
fn vs_main(vertex: Vertex, note: NoteInstance) -> VertexOutput {
var out: VertexOutput;
return out;
}

@fragment
fn fs_main(in: VertexOutput, note: NoteInstance) -> @location(0) vec4f {
return in.position;
}
49 changes: 49 additions & 0 deletions tests/out/msl/msl-varyings.msl
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// language: metal2.0
#include <metal_stdlib>
#include <simd/simd.h>

using metal::uint;

struct Vertex {
metal::float2 position;
};
struct NoteInstance {
metal::float2 position;
};
struct VertexOutput {
metal::float4 position;
};

struct vs_mainInput {
metal::float2 position [[attribute(0)]];
metal::float2 position_1 [[attribute(1)]];
};
struct vs_mainOutput {
metal::float4 position [[position]];
};
vertex vs_mainOutput vs_main(
vs_mainInput varyings [[stage_in]]
) {
const Vertex vertex_ = { varyings.position };
const NoteInstance note = { varyings.position_1 };
VertexOutput out = {};
VertexOutput _e3 = out;
const auto _tmp = _e3;
return vs_mainOutput { _tmp.position };
}


struct fs_mainInput {
metal::float2 position_3 [[user(loc1), center_perspective]];
};
struct fs_mainOutput {
metal::float4 member_1 [[color(0)]];
};
fragment fs_mainOutput fs_main(
fs_mainInput varyings_1 [[stage_in]]
, metal::float4 position_2 [[position]]
) {
const VertexOutput in = { position_2 };
const NoteInstance note_1 = { varyings_1.position_3 };
return fs_mainOutput { in.position };
}
1 change: 1 addition & 0 deletions tests/snapshots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,7 @@ fn convert_wgsl() {
"constructors",
Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL,
),
("msl-varyings", Targets::METAL),
];

for &(name, targets) in inputs.iter() {
Expand Down

0 comments on commit 7724f35

Please sign in to comment.