danielscherzer / GLSL

VSIX Project that provides GLSL language integration.
255 stars 27 forks source link

Red underlining at a valid syntax #19

Closed pzgulyas closed 5 years ago

pzgulyas commented 5 years ago

Installed product versions

Description

Red underlining occurs at a valid syntax accepted by glslangValidator.exe.

Steps to recreate

Write the following lines into a file eg. Shader.frag:

#version 450
layout (set = 0, binding = 0) uniform texture2D Texture;
layout (set = 0, binding = 1) uniform sampler Sampler;

Current behavior

The sampler line can be made accepted by adding

#extension GL_KHR_vulkan_glsl : enable

But this is implicitly added by glslang, so in a live code there is no need to explicitly add this line. And the underlining of the texture2D line still remains.

pzgulyas commented 5 years ago

(I would also have a sub-request. Would it be possible to exclude the leading spaces (tabs) in the line from the red underlining? This would match more of how this underlining works in VS.)

danielscherzer commented 5 years ago

Hi, I can confirm this behavior. Compiling with both the official glslangValidator and glslc does not matter to the extension because it uses the current graphics cards driver to compile. For my system (INTEL 530 driver) for instance this snipped raises:

'Texture' : syntax error syntax error   

But the raised errors most probably will change depending on the driver version. The intend of this extension is to check if the shader works on the current hardware. Checking if the shader code works on the glslLang and glslc compiler is currently not supported.

pzgulyas commented 5 years ago

Ah, thanks, I wasn't aware of that it can be compiled with the driver too, although it sounds logical. :-) Wouldn't it be possible to add an option of the compiler used?

danielscherzer commented 5 years ago

Yes this is possible, but I'm not sure when I have the time to implement it.

danielscherzer commented 5 years ago

I added support for an external glsllang compatible compiler. Does this resolve your issue?