mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-30 08:27:39 +00:00

Project Lead: Evan Hemsley <evan@moonside.games> Co-designer, Metal Port, Console Ports: Co-authored-by: Caleb Cornett <caleb.cornett@outlook.com> Production, QA, Debug: Co-authored-by: Ethan Lee <flibitijibibo@gmail.com> SDL_Render Driver, Bugfixes: Co-authored-by: Andrei Alexeyev <akari@taisei-project.org> Additional D3D12 Programming, Bugfixes: Co-authored-by: Bart van der Werf <bluelive@gmail.com> Bugfixes and Feedback: Co-authored-by: Zakary Strange <zakarystrange@gmail.com> Co-authored-by: meyraud705 <meyraud705@gmail.com> Co-authored-by: Joshua T. Fisher <playmer@gmail.com> Co-authored-by: Topi Ritala <ritalat@fastmail.com> Co-authored-by: David Gow <david@ingeniumdigital.com> Original API Proposal: Co-authored-by: Ryan C. Gordon <icculus@icculus.org>
38 lines
No EOL
633 B
Metal
38 lines
No EOL
633 B
Metal
#include <metal_stdlib>
|
|
using namespace metal;
|
|
|
|
struct VSOutput
|
|
{
|
|
float4 color [[user(locn0)]];
|
|
float4 position [[position]];
|
|
};
|
|
|
|
#ifdef VERTEX
|
|
|
|
struct UBO
|
|
{
|
|
float4x4 modelViewProj;
|
|
};
|
|
|
|
struct VSInput
|
|
{
|
|
float3 position [[attribute(0)]];
|
|
float3 color [[attribute(1)]];
|
|
};
|
|
|
|
vertex VSOutput vs_main(VSInput input [[stage_in]], constant UBO& ubo [[buffer(0)]])
|
|
{
|
|
VSOutput output;
|
|
output.color = float4(input.color, 1.0);
|
|
output.position = ubo.modelViewProj * float4(input.position, 1.0);
|
|
return output;
|
|
}
|
|
|
|
#else
|
|
|
|
fragment float4 fs_main(VSOutput input [[stage_in]])
|
|
{
|
|
return input.color;
|
|
}
|
|
|
|
#endif |