Darkyenus / glsl4idea

A GLSL language plugin for IntelliJ IDEA
GNU Lesser General Public License v3.0
101 stars 30 forks source link

No support for GL_EXT_shader_explicit_arithmetic_types causing errors on primitive type conversions and functions #175

Open Cazadorro opened 1 year ago

Cazadorro commented 1 year ago

I have the following enabled:

#extension GL_EXT_shader_explicit_arithmetic_types         : enable
#extension GL_EXT_shader_explicit_arithmetic_types_int8    : enable
#extension GL_EXT_shader_explicit_arithmetic_types_int16   : enable
#extension GL_EXT_shader_explicit_arithmetic_types_int32   : enable
#extension GL_EXT_shader_explicit_arithmetic_types_int64   : enable
#extension GL_EXT_shader_explicit_arithmetic_types_float16 : enable
#extension GL_EXT_shader_explicit_arithmetic_types_float32 : enable
#extension GL_EXT_shader_explicit_arithmetic_types_float64 : enable

see https://github.com/KhronosGroup/GLSL/blob/master/extensions/ext/GL_EXT_shader_explicit_arithmetic_types.txt

primitive types and conversions are not known to this plugin, so I get erroneous errors. See:

i32vec4 sort_dsc(i32vec4 value){
    //http://pages.ripco.net/~jgamble/nw.html
    if (value[0] < value[1]){
        swap(value[0], value[1]);
    }
    if (value[2] < value[3]){
        swap(value[2], value[3]);
    }
    if (value[0] < value[2]){
        swap(value[0], value[2]);
    }
    if (value[1] < value[3]){
        swap(value[1], value[3]);
    }
    if (value[1] < value[2]){
        swap(value[1], value[2]);
    }
    return value;
}

I get "subscripted expression must be of array matrix or vector type".

here;

int32_t wrap(int32_t value, int32_t max){
    return ((value % max) + max) % max;
}

I get "incompatible operands int32_t and int32_t".

for things like

uint8_t foo = uint8_t(0); 
uint bar = uint(bar);

I get "cannot resolve constructor uint(uint8_t)" and it suggests basically everything not in GL_EXT_shader_explicit_arithmetic_types
these types, in addition to the i/u8,16,32 and f16->f64 should be recognized as built in types just as u/i64vec2->4 and u/int64_t are.

Versions Clion 2022.3, Plugin 1.23

Darkyenus commented 1 year ago

They keep adding types faster than I can add them! This should be a fairly easy fix.