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)
LLM-contributed programs
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);
}
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.)