UstymUkhman / vite-plugin-glsl

:spider_web: Import, inline (and compress) GLSL shader files :electric_plug:
https://www.npmjs.com/package/vite-plugin-glsl
MIT License
321 stars 22 forks source link

Tips for making this work with GLSL Lint #43

Closed Swoorup closed 1 year ago

Swoorup commented 1 year ago

I have found that you can make this work with https://marketplace.visualstudio.com/items?itemName=dtoplak.vscode-glsllint

Just use the following script replacing the script_to_run to path to glslangValidator. Only downside is that all errors are printed 2 lines below.

#!/bin/bash

# The script you want to forward the arguments to
script_to_run="/opt/homebrew/bin/glslangValidator"

# Generate a filename based on the current timestamp
timestamp=$(date +%Y%m%d%H%M%S)
log_file="/tmp/glslangValidator_log.txt"

# Log the input arguments
echo "[$timestamp] Input arguments: $@" > "$log_file"

# Concatenate the specified lines to the standard input
echo -e "#version 100\n#extension GL_GOOGLE_include_directive : require\n$(cat)" | "$script_to_run" "$@" 
UstymUkhman commented 1 year ago

Hi @Swoorup ! Sorry, what do you mean by "making this work"? I use Shader languages support for VS Code extension for example and as you can see, it's linting correctly my shader files:

linting

Swoorup commented 1 year ago

Hi @Swoorup ! Sorry, what do you mean by "making this work"? I use Shader languages support for VS Code extension for example and as you can see, it's linting correctly my shader files:

linting

Yeah not a question. Just a tip to using the extension I linked. Afaik that extension only supports hlsl linting/validation? The one I linked uses glslLangValidator. The include statement doesn't work without requiring the extension

image
UstymUkhman commented 1 year ago

Got it, thanks! I would say, if you have a chance to chose, I would go with "Shader languages support for VS Code" since from what I see on the marketplace, their readme claims this extension should work with HLSL, GLSL and Cg shaders and I haven't had any problems using it with WebGL. However, you might consider installing WGSL if you need to work with WebGPU. I haven't tested it deeply myself though.