danielscherzer / GLSL

VSIX Project that provides GLSL language integration.
258 stars 28 forks source link

Spurious intellisense error #16

Closed diaphore closed 6 years ago

diaphore commented 6 years ago

This small snippet raises intellisense errors :

#version 460 core
layout(constant_id = 0) const uint foo = 123;
void main() {}
error C1319: can't apply layout to global variable 'foo'
error C7548: 'layout(constant_id) or layout(local_size_[xyz]_id)' requires "#extension GL_KHR_vulkan_glsl : enable" before use

On the other hand, it compiles fine with both the official glslangValidator and glslc :

$ glslc --target-env=opengl foo.comp
$ glslangValidator -G foo.comp
danielscherzer commented 6 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 for instance this snipped raises:

fatal error C9999: *** exception during compilation ***
error C1319: can't apply layout to global variable 'foo'
error C7548: 'layout(constant_id) or layout(local_size_[xyz]_id)' requires "#extension GL_KHR_vulkan_glsl : enable" before use

with the NVIDIA 1060 as default and my INTEL 530 driver responds:

'constant_id' : syntax error syntax error
'' :  incorrect GLSL version: 460
'GL_ARB_explicit_attrib_location' :  extension is not available in current GLSL version

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.

diaphore commented 6 years ago

Got it, thanks for the precision.