#include #import "rasterizer.metal" float4 apply_eraser( float4 color, float2 paper_coord, metal::texture2d_ms eraser_texture) { // Work out the coordinates in the eraser texture (which applies to the whole screen) paper_coord[0] *= float(eraser_texture.get_width()); paper_coord[1] *= float(eraser_texture.get_height()); // Sample the eraser const uint num_samples = eraser_texture.get_num_samples(); const uint2 eraser_coord = uint2(paper_coord); half eraser_total = 0; for (uint sample_num=0; sample_num