#include <metal_stdlib> | |
using namespace metal; | |
struct S { | |
float3 v; | |
uint i; | |
}; | |
struct tint_module_vars_struct { | |
device S* io; | |
}; | |
float3 Bad(uint index, float3 rd) { | |
float3 normal = float3(0.0f); | |
normal[index] = -(sign(rd[index])); | |
return normalize(normal); | |
} | |
kernel void tint_symbol(uint idx [[thread_index_in_threadgroup]], device S* io [[buffer(0)]]) { | |
tint_module_vars_struct const tint_module_vars = {.io=io}; | |
(*tint_module_vars.io).v = Bad((*tint_module_vars.io).i, (*tint_module_vars.io).v); | |
} |