glslang icon indicating copy to clipboard operation
glslang copied to clipboard

GL_ARB_cull_distance extension not supported.

Open ZhiqianXia opened this issue 3 years ago • 2 comments

Hi , the GL_ARB_cull_distance not be supported for glslang. thanks.

glslang output :

ERROR: D:\local\Temp\93f5459f-aa34-4345-aec3-1435a5369eb0.tmp:2: '#extension' : extension not supported: GL_ARB_cull_distance
ERROR: D:\local\Temp\93f5459f-aa34-4345-aec3-1435a5369eb0.tmp:2: '#extension' : extra tokens -- expected newline 
ERROR: D:\local\Temp\93f5459f-aa34-4345-aec3-1435a5369eb0.tmp:2: '' : compilation terminated 
ERROR: 3 compilation errors.  No code generated.

shader :

#version 440
#extension GL_ARB_cull_distance : require
#ifndef GL_ARB_cull_distance
    #error GL_ARB_cull_distance is undefined
#endif

in float gl_CullDistance[8];

highp float fetch()
{
    highp float sum = 0.0;
    sum += abs(gl_CullDistance[0]) * 1.0;
    sum += abs(gl_CullDistance[1]) * 2.0;
    sum += abs(gl_CullDistance[2]) * 3.0;
    sum += abs(gl_CullDistance[3]) * 4.0;
    sum += abs(gl_CullDistance[4]) * 5.0;
    sum += abs(gl_CullDistance[5]) * 6.0;
    sum += abs(gl_CullDistance[6]) * 7.0;
    sum += abs(gl_CullDistance[7]) * 8.0;
    return sum / 72.0;
}

#define ASSIGN_RETURN_VALUE fetch()
out vec4 out_fs;
/* Fragment shader main function */
void main()
{
    out_fs = vec4(ASSIGN_RETURN_VALUE, 1.0, 1.0, 1.0);
}

ZhiqianXia avatar Jan 12 '22 03:01 ZhiqianXia

If you just change

- #version 440
+ #version 450

- out vec4 out_fs;
+ layout(location = 0) out vec4 out_fs;

it should work

in https://www.khronos.org/registry/OpenGL/specs/gl/GLSLangSpec.4.50.pdf it says

Incorporate the GL_ARB_cull_distance extensions to add the built-in variable gl_CullDistance[], which will cull whole primitives

So I guess is there a reason not to just update the GLSL version you are using for your shader?

sfricke-samsung avatar Mar 18 '22 04:03 sfricke-samsung

@sfricke-samsung Yes,There are some CTS test have older version in order to validate the extension GL_ARB_cull_distance.

ZhiqianXia avatar Mar 22 '22 02:03 ZhiqianXia