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

Binary file not shown.

View File

@@ -4,7 +4,8 @@
// Author: JailDesigner
//
// Vulkan port of test.gl.glsl. Bindings follow the SDL3 GPU convention:
// set=3, binding=0 — fragment uniform buffer (ShadertoyUniforms in C++).
// set=3, binding=0 — fragment uniform buffer (anonymous block: members
// are accessible directly as iTime / iResolution, like Shadertoy).
layout(location = 0) in vec2 vUV;
layout(location = 0) out vec4 FragColor;
@@ -12,7 +13,7 @@ layout(location = 0) out vec4 FragColor;
layout(set = 3, binding = 0) uniform ShadertoyUBO {
float iTime;
vec2 iResolution;
} u;
};
vec3 palette(float t) {
vec3 a = vec3(1.0, 0.5, 0.5);
@@ -23,10 +24,10 @@ vec3 palette(float t) {
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord * 2.0 - u.iResolution) / u.iResolution.y;
vec2 uv = (fragCoord * 2.0 - iResolution) / iResolution.y;
float d = length(uv);
vec3 col = palette(d);
d = sin(d * 8.0 + u.iTime) / 8.0;
d = sin(d * 8.0 + iTime) / 8.0;
d = abs(d);
d = 0.02 / d;
col *= d;
@@ -34,7 +35,7 @@ void mainImage(out vec4 fragColor, in vec2 fragCoord) {
}
void main() {
vec2 fragCoordPixels = vUV * u.iResolution;
vec2 fragCoordPixels = vUV * iResolution;
vec4 outColor;
mainImage(outColor, fragCoordPixels);
FragColor = outColor;