SPIRV-Cross/reference/opt/shaders-msl/asm/frag/extract-packed-from-composite.asm.frag
Hans-Kristian Arntzen 66263d4569 Forward meta information in OpCompositeExtract.
Just like OpAccessChain we need to make use of the meta information
available to use from access_chain_internal as we can extract a packed
vector or transposed vector from a composite, not just memory load.
2019-01-07 10:43:55 +01:00

31 lines
532 B
GLSL

#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct Foo
{
packed_float3 a;
float b;
};
struct buf
{
Foo results[16];
float4 bar;
};
struct main0_out
{
float4 _entryPointOutput [[color(0)]];
};
fragment main0_out main0(constant buf& _11 [[buffer(0)]], float4 gl_FragCoord [[position]])
{
main0_out out = {};
int _67 = int(gl_FragCoord.x) % 16;
out._entryPointOutput = float4(dot(float3(_11.results[_67].a), _11.bar.xyz), _11.results[_67].b, 0.0, 0.0);
return out;
}