WebGL-GLSL-Editor icon indicating copy to clipboard operation
WebGL-GLSL-Editor copied to clipboard

[Bug]: errors not showing up

Open sedghi opened this issue 1 year ago • 5 comments

The extension's version

1.3.8

VS Code's version

1.88.1

Extension host

Desktop VS Code

Operating system

macOS

Description

Is there any known issues on , as you see the error for not having ; is not highlighted.

My file is named vtkVolumeFS.glsl here is the file

https://github.com/Kitware/vtk-js/blob/master/Sources/Rendering/OpenGL/glsl/vtkVolumeFS.glsl

CleanShot 2024-05-01 at 11 23 21@2x

version: 1.88.1 (Universal) Commit: e170252f762678dec6ca2cc69aba1570769a5d39 Date: 2024-04-10T17:42:52.765Z (2 wks ago) Electron: 28.2.8 ElectronBuildId: 27744544 Chromium: 120.0.6099.291 Node.js: 18.18.2 V8: 12.0.267.19-electron.0 OS: Darwin arm64 22.6.0

sedghi avatar May 01 '24 15:05 sedghi

Also the formatter seems not to work

CleanShot 2024-05-01 at 11 30 07@2x

sedghi avatar May 01 '24 15:05 sedghi

Hi, thank you for creating the issue!

You don't see errors, because your file's extension is .glsl. The compiler (glslang) needs to know the shader stage (vertex, or fragment), to give you diagnostic messages. If the file's extension is .vs, or .vert, it knows that it is a vertex shader. If the file's extension is .fs, or .frag, it knows that it is a fragment shader. But with .glsl, it doesn't know, and it can't provide any errors. So changing the file's extension should solve the problem, although the extension is meant to be used with GLSL ES 1, and GLSL ES 3. If you use it with other versions of GLSL, you might get invalid error messages.

The formatter is a more difficult issue. I tried to format your file on Windows, and it works fine for me (although there are a lot of preprocessor directives, so the result is not ideal). Unfortunately, I don't have any macOS devices, so I can't reproduce the problem. If you open the output panel (View / Output) and select Extension Host from the dropdown, can you see an error message? If yes, could you paste the content? If not, could you try it on a different platform? Also, is the problem only present with this file, or formatting doesn't seem to work at all? Do other features, like go to definition, or outline work properly?

racz16 avatar May 01 '24 16:05 racz16

Thanks for your prompt reply. Is there anywhere that i can specify that this file is a fragment shader without changing the extension?

sedghi avatar May 01 '24 17:05 sedghi

Not at the moment. It is possible to tell glslang what is the shader stage with a flag, but the question is how the user can tell which file is which shader stage. It can be a configuration or a custom file, but then you would need to list all your GLSL files with full paths. You could create a specific comment to sign what is the shader stage, but again, you would need to change all GLSL files. Another option is to search for stage-specific elements, for example, gl_Position can only appear in a vertex shader, discard can only appear in a fragment shader, etc. But it's not always trivial to decide based on that, and some GLSL files are meant to be "included" to both vertex and fragment shaders.

racz16 avatar May 01 '24 17:05 racz16

I understand, thanks a lot!

sedghi avatar May 01 '24 17:05 sedghi