HelperShaders class
This commit is contained in:
parent
00fce5a51d
commit
93c71110e1
5 changed files with 72 additions and 45 deletions
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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue