vscode-glsllint icon indicating copy to clipboard operation
vscode-glsllint copied to clipboard

GLSL Lint: Wrong parameters when starting glslangValidator.

Open ImChenJiaQi opened this issue 1 year ago • 0 comments

getting error after install glsl lint extension GLSL Lint: Wrong parameters when starting glslangValidator. Arguments: -l --stdin -S -Id:\document\Github\Work\ykt_pc\YKTPC3\YKTPC\bin\Debug\net472\web3d stderr: GLSL Lint: GLSL Lint: failed to detect shader stage, you can add it's extension setting 'glsllint.additionalStageAssociations' or configure a fallback stage with 'glsllint.fallBackStage'

glsl settings.json:

"glsllint.glslifyUseCurrentFileAsBasedir": true,
    "security.workspace.trust.banner": "always",
    "security.workspace.trust.enabled": false,
    "glsllint.glslangValidatorPath": "F:\\Download\\glslang-master-windows-Release\\bin\\glslangValidator.exe",
    "glsllint.additionalStageAssociations": { },

the code


uniform vec3 topColor;     // 顶部颜色
uniform vec3 bottomColor;  // 底部颜色
uniform vec3 midTopColor;  // 中间上半部颜色
uniform vec3 midBottomColor; // 中间下半部颜色
varying vec3 vPosition;

void main() {
    float height = 20.0;  // 圆柱体总高度
    float midHeight = height / 2.0; // 中间高度
    
    vec3 color;

    if (vPosition.y > midHeight * 0.8) {
        // 顶部区域,设置为白色
        color = topColor;
    } else if (vPosition.y < -midHeight * 0.8) {
        // 底部区域,设置为白色
        color = bottomColor;
    } else if (vPosition.y >= 0.0) {
        // 中间上半部分,颜色为绿色到白色渐变
        float mixRatio = (vPosition.y) / (midHeight * 0.8);
        color = mix(midTopColor, topColor, mixRatio);
    } else {
        // 中间下半部分,颜色为红色到白色渐变
        float mixRatio = (-vPosition.y) / (midHeight * 0.8);
        color = mix(midBottomColor, bottomColor, mixRatio);
    }

    gl_FragColor = vec4(color, 1.0); // 输出颜色
}

ImChenJiaQi avatar Oct 28 '24 03:10 ImChenJiaQi