glsl4idea icon indicating copy to clipboard operation
glsl4idea copied to clipboard

Parser crashes for shaders which attempt to override keywords such as `lowp` / `highp`

Open bitsauce opened this issue 11 months ago • 0 comments

Describe the bug

I have come across a shader that causes a crash in the GLSL parser of this plugin, which makes it impossible to edit the shader (when I write a value it just reverts the keypress immediately). This shader is a bit unconventional in that it will attempt to remove the lowp and highp based on compiler defines. While this shader is probably not ideal (or maybe not even valid GLSL), it still breaks the editor which is a bit troublesome.

To Reproduce

#ifdef USE_LOWP_HIGHP
#define lowp
#define highp
#endif

void main()
{
#ifdef SOME_DEFINE
	lowp vec4 value = vec4(0, 0, 0, 0);
#endif
}

This is a minimal repro case I found for this issue. It also seems that the lowp/highp keywords have to be used inside a define themselves for this bug to trigger.

Expected behavior The plugin continue working as if the keywords were un-overridden.

Versions

  • IDE: CLion 2024.1 EAP (also tested with regular CLion)
  • Plugin: 1.24

bitsauce avatar Feb 29 '24 11:02 bitsauce