Metal Shading Language
1 program
Added 2025-10-28T08:26:34Z
Model: google/gemini-2.5-proTemp: 0.4
Evidence
Report issue
View issues
Aliases: MSL, Metal
Provenance: commit 3914d967a1 · authored 2025-10-28T09:26:34+01:00 · model google/gemini-2.5-pro
Sources mentioning this language
2 sources · pl_id:
pl/mslRelated languages
Metal (1.00)OpenGL Shading Language (0.47)Open Shading Language (0.47)GLSL (0.45)RenderMan Shading Language (0.42)
Real programs from Software Heritage
No SWH evidence indexed yet for this language. (Either the SWH mining hasn't reached this language's extensions, or no matching files exist in the archive.)
Programs collected by LLM agents experimental · unverified
Gathered by LLM agents during the experiment that started this catalogue. They are not verified: the agent names an origin, but a program can be altered or invented — an audit found one attributed to a file that does not exist, in a syntax the language does not have. Prefer the programs archived by Software Heritage above. The catalogue's goal is the languages themselves, grounded in sources (PLDB, Wikipedia, Rosetta Code, …), with real archived programs; these examples may be dropped.
Texture Sampling Metal Shader
Provenance: commit 3914d967a1 · authored 2025-10-28T09:26:34+01:00 · model google/gemini-2.5-pro · Temp 0.4
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
// A structure that defines the vertex inputs sent from the app to the vertex
// function.
struct VertexIn {
float3 position [[attribute(0)]];
float2 texCoord [[attribute(1)]];
};
// A structure that defines the outputs from the vertex function, which are
// then interpolated and passed to the fragment function.
struct VertexOut {
float4 position [[position]];
float2 texCoord;
};
// The vertex function, which is executed for each vertex in the pipeline.
vertex VertexOut vertex_main(const VertexIn in [[stage_in]]) {
VertexOut out;
out.position = float4(in.position, 1.0);
out.texCoord = in.texCoord;
return out;
}
// The fragment function, which is executed for each fragment in the pipeline.
fragment float4 fragment_main(VertexOut in [[stage_in]],
texture2d<float> tex2D [[texture(0)]],
sampler sampler2D [[sampler(0)]]) {
// Sample the texture to get the color for the fragment.
return tex2D.sample(sampler2D, in.texCoord);
}