e2c95bdcbc
We used to use the Binding decoration for this, but this method is hopelessly broken. If no explicit MSL resource remapping exists, we remap automatically in a manner which should always "just work".
41 lines
680 B
Plaintext
41 lines
680 B
Plaintext
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
|
|
using namespace metal;
|
|
|
|
struct SSBO3
|
|
{
|
|
float4 v;
|
|
};
|
|
|
|
struct SSBO0
|
|
{
|
|
float4 v;
|
|
};
|
|
|
|
struct SSBO1
|
|
{
|
|
float4 v;
|
|
};
|
|
|
|
struct SSBO2
|
|
{
|
|
float4 v;
|
|
};
|
|
|
|
struct spvDescriptorSetBuffer0
|
|
{
|
|
const device SSBO0* ssbo0 [[id(0)]];
|
|
};
|
|
|
|
struct spvDescriptorSetBuffer1
|
|
{
|
|
const device SSBO1* ssbo1 [[id(0)]];
|
|
};
|
|
|
|
kernel void main0(constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], constant spvDescriptorSetBuffer1& spvDescriptorSet1 [[buffer(1)]], device SSBO3& ssbo3 [[buffer(2)]], const device SSBO2& ssbo2 [[buffer(3)]])
|
|
{
|
|
ssbo3.v = ((*spvDescriptorSet0.ssbo0).v + (*spvDescriptorSet1.ssbo1).v) + ssbo2.v;
|
|
}
|
|
|