floooh / sokol-tools

Command line tools for use with sokol headers
MIT License
229 stars 57 forks source link

Example shader code won't compile with shdc. #113

Closed charlietsao closed 10 months ago

charlietsao commented 10 months ago

The code failed to run with shdc.

@vs vs
uniform vs_params {
    mat4 mvp;
};

in vec4 position;
in vec2 texcoord0;

out vec4 color;
out vec2 uv;

void main() {
    gl_Position = mvp * position;
    uv = texcoord0;
}
@end

@fs fs
uniform texture2D tex;
uniform sampler smp;

in vec2 uv;
out vec4 frag_color;

void main() {
    frag_color = texture(sampler2D(tex,smp), uv);
}
@end

@program texcube vs fs

The error as followings:

./sokol-shdc --input shd.glsl --output shd.h --slang glsl300es -f bare
shd.glsl:29:0: error: outputs of vs 'vs' don't match inputs of fs 'fs' for attr #0 (vs=color,fs=uv)

The out vec4 color; at line 9 should be removed.

floooh commented 10 months ago

Oops, thanks for catching that!