feat(gpu): afegir suport SPIRV (Vulkan) per Linux/Windows
- Nou: shaders/sprite.vert|frag, postfx.vert|frag, ball.vert (GLSL) - Nou: cmake/spv_to_header.cmake — converteix .spv → uint8_t C header - CMakeLists.txt: bloc non-Apple troba glslc, compila GLSL → SPIRV en build-time i genera headers embeguts a build/generated_shaders/ - gpu_context.cpp: MSL|METALLIB en Apple, SPIRV en la resta - gpu_pipeline.cpp: createShaderSPIRV() + branques #ifdef __APPLE__ per sprite/ball/postfx pipelines - Corregeix crash a engine.cpp:821 (Windows/Linux) causat per pipelines null quan init() fallava en no trobar suport MSL Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
24
shaders/postfx.frag
Normal file
24
shaders/postfx.frag
Normal file
@@ -0,0 +1,24 @@
|
||||
#version 450
|
||||
layout(location=0) in vec2 v_uv;
|
||||
layout(location=0) out vec4 out_color;
|
||||
layout(set=2, binding=0) uniform sampler2D scene;
|
||||
layout(set=3, binding=0) uniform PostFXUniforms {
|
||||
float vignette_strength;
|
||||
float chroma_strength;
|
||||
float scanline_strength;
|
||||
float time;
|
||||
} u;
|
||||
void main() {
|
||||
float ca = u.chroma_strength * 0.005;
|
||||
vec4 color;
|
||||
color.r = texture(scene, v_uv + vec2( ca, 0.0)).r;
|
||||
color.g = texture(scene, v_uv).g;
|
||||
color.b = texture(scene, v_uv - vec2( ca, 0.0)).b;
|
||||
color.a = texture(scene, v_uv).a;
|
||||
float scan = 0.85 + 0.15 * sin(v_uv.y * 3.14159265 * 720.0);
|
||||
color.rgb *= mix(1.0, scan, u.scanline_strength);
|
||||
vec2 d = v_uv - vec2(0.5, 0.5);
|
||||
float vignette = 1.0 - dot(d, d) * u.vignette_strength;
|
||||
color.rgb *= clamp(vignette, 0.0, 1.0);
|
||||
out_color = color;
|
||||
}
|
||||
Reference in New Issue
Block a user