Porta tots els shaders a Vulkan i Metal

This commit is contained in:
2026-05-04 12:35:58 +02:00
parent 8d42d5741f
commit ef37a7a2e6
38 changed files with 2942 additions and 8 deletions

View File

@@ -0,0 +1,42 @@
#include <metal_stdlib>
using namespace metal;
// Creation by Silexars — Danguafer
// MSL port of creation.vk.glsl.
struct ShadertoyUBO {
float iTime;
float2 iResolution;
};
struct PassthroughVOut {
float4 pos [[position]];
float2 uv;
};
fragment float4 creation_fs(PassthroughVOut in [[stage_in]],
constant ShadertoyUBO& U [[buffer(0)]]) {
float2 fragCoord = in.uv * U.iResolution;
float t = U.iTime;
float2 r = U.iResolution;
float3 c = float3(0.0);
float l = 0.0;
float z = t;
for (int i = 0; i < 3; i++) {
float2 p = fragCoord / r;
float2 uv = p;
p -= 0.5;
p.x *= r.x / r.y;
z += 0.07;
l = length(p);
float invl = (l > 0.0) ? (1.0 / l) : 0.0;
uv += p * invl * (sin(z) + 1.0) * abs(sin(l * 9.0 - z - z));
float2 m = fract(uv) - 0.5;
float denom = length(m);
if (denom < 1e-6) denom = 1e-6;
c[i] = 0.01 / denom;
}
float L = (l > 0.0) ? l : 1.0;
return float4(c / L, t);
}

Binary file not shown.

View File

@@ -0,0 +1,45 @@
#version 450
// Name: Creation by Silexars
// Author: Danguafer
// URL: https://www.shadertoy.com/view/XsXXDn
layout(location = 0) in vec2 vUV;
layout(location = 0) out vec4 FragColor;
layout(set = 3, binding = 0) uniform ShadertoyUBO {
float iTime;
vec2 iResolution;
};
#define t iTime
#define r iResolution.xy
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec3 c = vec3(0.0);
float l;
float z = t;
for (int i = 0; i < 3; i++) {
vec2 uv, p = fragCoord.xy / r;
uv = p;
p -= 0.5;
p.x *= r.x / r.y;
z += 0.07;
l = length(p);
float invl = (l > 0.0) ? (1.0 / l) : 0.0;
uv += p * invl * (sin(z) + 1.0) * abs(sin(l * 9.0 - z - z));
vec2 m = mod(uv, 1.0) - 0.5;
float denom = length(m);
if (denom < 1e-6) denom = 1e-6;
c[i] = 0.01 / denom;
}
float L = (l > 0.0) ? l : 1.0;
fragColor = vec4(c / L, t);
}
void main() {
vec2 fragCoordPixels = vUV * iResolution;
vec4 outColor;
mainImage(outColor, fragCoordPixels);
FragColor = outColor;
}