Files
wgpu/tests/out/skybox.msl
Ashley 4664cd301a [Metal] Wrap a packed_float3 with float3 when loading from struct (#740)
* Implement the wrapping in Expression::Load instead

* Add changes to stack size

* stable and nightly can't seem to agree on a stack size

* Apply suggestions

* Add a comment about unexpected path

* Update skybox snapshot

* should_pack_struct_member returns an Option<ScalarKind>

* Remove accidental file
2021-04-21 09:16:11 -04:00

56 lines
1.7 KiB
Plaintext

#include <metal_stdlib>
#include <simd/simd.h>
struct VertexOutput {
metal::float4 position;
packed_float3 uv;
};
struct Data {
metal::float4x4 proj_inv;
metal::float4x4 view;
};
struct vs_mainInput {
};
struct vs_mainOutput {
metal::float4 position [[position]];
metal::float3 uv [[user(loc0), center_perspective]];
};
vertex vs_mainOutput vs_main(
metal::uint vertex_index [[vertex_id]]
, constant Data& r_data [[buffer(0)]]
) {
int tmp1_;
int tmp2_;
tmp1_ = static_cast<int>(vertex_index) / 2;
tmp2_ = static_cast<int>(vertex_index) & 1;
metal::float4 _e24 = metal::float4((static_cast<float>(tmp1_) * 4.0) - 1.0, (static_cast<float>(tmp2_) * 4.0) - 1.0, 0.0, 1.0);
const auto _tmp = VertexOutput {_e24, metal::transpose(metal::float3x3(r_data.view[0].xyz, r_data.view[1].xyz, r_data.view[2].xyz)) * (r_data.proj_inv * _e24).xyz};
return vs_mainOutput { _tmp.position, _tmp.uv };
}
struct fs_mainInput {
metal::float3 uv [[user(loc0), center_perspective]];
};
struct fs_mainOutput {
metal::float4 member1 [[color(0)]];
};
fragment fs_mainOutput fs_main(
fs_mainInput varyings1 [[stage_in]]
, metal::float4 position [[position]]
, metal::texturecube<float, metal::access::sample> r_texture [[texture(0)]]
) {
constexpr metal::sampler r_sampler(
metal::s_address::clamp_to_edge,
metal::t_address::clamp_to_edge,
metal::r_address::clamp_to_edge,
metal::mag_filter::linear,
metal::min_filter::linear,
metal::coord::normalized
);
const VertexOutput in = { position, varyings1.uv };
metal::float4 _e5 = r_texture.sample(r_sampler, in.uv);
return fs_mainOutput { _e5 };
}