SPIRV-Cross/reference/shaders-msl-no-opt/comp/buffer-device-address-from-pointer-complex-chain.msl23.comp
Hans-Kristian Arntzen df76a14056 MSL: Refactor member reference in terms of one boolean.
ptr_chain was really just masking the proper i == 0 check.
Be more explicit about what the check is actually doing and comment
this.
2022-11-21 13:40:27 +01:00

29 lines
342 B
Plaintext

#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct SSBO;
struct S
{
float3 v;
};
struct SSBO
{
S s[1];
};
struct PC
{
uint2 ptr;
};
kernel void main0(constant PC& pc [[buffer(0)]])
{
device SSBO* ssbo = reinterpret_cast<device SSBO*>(as_type<ulong>(pc.ptr));
ssbo->s[0].v = float3(1.0);
}