SPIRV-Cross/reference/shaders-msl/frag/buffer-read.frag
Chip Davis 7cb817e40e Add spvTexelBufferCoord for buffer image reads, too.
I should've caught this when I fixed this for writes.
2018-09-23 14:37:03 -05:00

26 lines
497 B
GLSL

#pragma clang diagnostic ignored "-Wmissing-prototypes"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct main0_out
{
float4 FragColor [[color(0)]];
};
// Returns 2D texture coords corresponding to 1D texel buffer coords
uint2 spvTexelBufferCoord(uint tc)
{
return uint2(tc % 4096, tc / 4096);
}
fragment main0_out main0(texture2d<float> buf [[texture(0)]])
{
main0_out out = {};
out.FragColor = buf.read(spvTexelBufferCoord(0));
return out;
}