Ryujinx/src/Ryujinx.Graphics.Metal/Shaders/ColorBlitShaderSource.metal

37 lines
799 B
Metal
Raw Normal View History

2023-08-02 04:36:07 +02:00
#include <metal_stdlib>
using namespace metal;
2023-08-03 01:56:59 +02:00
constant float2 quadVertices[] = {
float2(-1, -1),
float2(-1, 1),
float2( 1, 1),
float2(-1, -1),
float2( 1, 1),
float2( 1, -1)
2023-08-02 04:36:07 +02:00
};
2023-08-03 01:56:59 +02:00
struct CopyVertexOut {
float4 position [[position]];
float2 uv;
};
vertex CopyVertexOut vertexMain(unsigned short vid [[vertex_id]]) {
float2 position = quadVertices[vid];
CopyVertexOut out;
out.position = float4(position, 0, 1);
2023-08-03 02:32:59 +02:00
out.position.y = -out.position.y;
2023-08-03 01:56:59 +02:00
out.uv = position * 0.5f + 0.5f;
return out;
2023-08-02 04:36:07 +02:00
}
2023-08-03 01:56:59 +02:00
fragment float4 fragmentMain(CopyVertexOut in [[stage_in]],
texture2d<float> tex) {
constexpr sampler sam(min_filter::nearest, mag_filter::nearest, mip_filter::none);
2023-08-03 03:18:28 +02:00
return tex.sample(sam, in.uv).xyzw;
2023-08-02 04:36:07 +02:00
}