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:
23
shaders/ball.vert
Normal file
23
shaders/ball.vert
Normal file
@@ -0,0 +1,23 @@
|
||||
#version 450
|
||||
// Per-instance data (input_rate = INSTANCE in the pipeline)
|
||||
layout(location=0) in vec2 center;
|
||||
layout(location=1) in vec2 halfsize;
|
||||
layout(location=2) in vec4 col;
|
||||
layout(location=0) out vec2 v_uv;
|
||||
layout(location=1) out vec4 v_col;
|
||||
void main() {
|
||||
// gl_VertexIndex cycles 0..5 per instance (6 vertices = 2 triangles)
|
||||
// Vertex order: TL TR BL | TR BR BL (CCW winding)
|
||||
const vec2 offsets[6] = vec2[6](
|
||||
vec2(-1.0, 1.0), vec2(1.0, 1.0), vec2(-1.0,-1.0),
|
||||
vec2( 1.0, 1.0), vec2(1.0,-1.0), vec2(-1.0,-1.0)
|
||||
);
|
||||
const vec2 uvs[6] = vec2[6](
|
||||
vec2(0.0,0.0), vec2(1.0,0.0), vec2(0.0,1.0),
|
||||
vec2(1.0,0.0), vec2(1.0,1.0), vec2(0.0,1.0)
|
||||
);
|
||||
int vid = gl_VertexIndex;
|
||||
gl_Position = vec4(center + offsets[vid] * halfsize, 0.0, 1.0);
|
||||
v_uv = uvs[vid];
|
||||
v_col = col;
|
||||
}
|
||||
Reference in New Issue
Block a user