HelperShaders class
This commit is contained in:
committed by
Evan Husted
parent
d36c285b79
commit
fb8749ce4e
36
src/Ryujinx.Graphics.Metal/HelperShadersSource.metal
Normal file
36
src/Ryujinx.Graphics.Metal/HelperShadersSource.metal
Normal file
@@ -0,0 +1,36 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
constant float2 quadVertices[] = {
|
||||
float2(-1, -1),
|
||||
float2(-1, 1),
|
||||
float2( 1, 1),
|
||||
float2(-1, -1),
|
||||
float2( 1, 1),
|
||||
float2( 1, -1)
|
||||
};
|
||||
|
||||
struct CopyVertexOut {
|
||||
float4 position [[position]];
|
||||
float2 uv;
|
||||
};
|
||||
|
||||
vertex CopyVertexOut vertexBlit(unsigned short vid [[vertex_id]]) {
|
||||
float2 position = quadVertices[vid];
|
||||
|
||||
CopyVertexOut out;
|
||||
|
||||
out.position = float4(position, 0, 1);
|
||||
out.position.y = -out.position.y;
|
||||
out.uv = position * 0.5f + 0.5f;
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
fragment float4 fragmentBlit(CopyVertexOut in [[stage_in]],
|
||||
texture2d<float> tex) {
|
||||
constexpr sampler sam(min_filter::nearest, mag_filter::nearest, mip_filter::none);
|
||||
|
||||
return tex.sample(sam, in.uv).xyzw;
|
||||
}
|
||||
Reference in New Issue
Block a user