Skip to content

Instantly share code, notes, and snippets.

@MasDennis
Created October 31, 2020 13:20
Show Gist options
  • Save MasDennis/b3664f83dc786d6e369caa4e6dc72ec5 to your computer and use it in GitHub Desktop.
Save MasDennis/b3664f83dc786d6e369caa4e6dc72ec5 to your computer and use it in GitHub Desktop.
constant float4x4 quadVertices = float4x4(float4( -1.0, -1.0, 0.0, 1.0 ),
float4( 1.0, -1.0, 0.0, 1.0 ),
float4( -1.0, 1.0, 0.0, 1.0 ),
float4( 1.0, 1.0, 0.0, 1.0 ));
constant float4x2 quadTextureCoordinates = float4x2(float2( 1.0, 1.0 ),
float2( 0.0, 1.0 ),
float2( 1.0, 0.0 ),
float2( 0.0, 0.0 ));
vertex ScreenQuadVertex screenQuadVertex(uint vertex_id [[vertex_id]],
const constant Uniforms& uniforms [[buffer(0)]])
{
ScreenQuadVertex outVertex;
outVertex.position = quadVertices[vertex_id];
outVertex.position.x *= uniforms.aspectRatioAdjustment;
outVertex.texcoord = quadTextureCoordinates[vertex_id];
return outVertex;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment