brought back functionality from previous builds but now cross-platform
This commit is contained in:
34
funnyassets/gfx/ml_quad.metal
Normal file
34
funnyassets/gfx/ml_quad.metal
Normal file
@@ -0,0 +1,34 @@
|
||||
#include <metal_stdlib>
|
||||
using namespace metal;
|
||||
|
||||
struct VertexOut {
|
||||
float4 position [[position]];
|
||||
float2 texCoord;
|
||||
};
|
||||
|
||||
vertex VertexOut vertex_main(uint vertexID [[vertex_id]]) {
|
||||
float2 pos[] = {
|
||||
{-1.0, -1.0},
|
||||
{ 1.0, -1.0},
|
||||
{-1.0, 1.0},
|
||||
{ 1.0, 1.0},
|
||||
};
|
||||
|
||||
float2 uv[] = {
|
||||
{0.0, 1.0},
|
||||
{1.0, 1.0},
|
||||
{0.0, 0.0},
|
||||
{1.0, 0.0},
|
||||
};
|
||||
|
||||
VertexOut out;
|
||||
out.position = float4(pos[vertexID], 0.0, 1.0);
|
||||
out.texCoord = uv[vertexID];
|
||||
return out;
|
||||
}
|
||||
|
||||
fragment float4 fragment_main(VertexOut in [[stage_in]],
|
||||
texture2d<float> tex [[texture(0)]]) {
|
||||
constexpr sampler s(filter::linear);
|
||||
return pow(tex.sample(s, in.texCoord), 0.45f);
|
||||
}
|
||||
Reference in New Issue
Block a user