KhronosGroup / glslang

Khronos-reference front end for GLSL/ESSL, partial front end for HLSL, and a SPIR-V generator.
Other
2.91k stars 817 forks source link

Compilation error: overlapping use of location #3486

Closed ragarg closed 4 months ago

ragarg commented 5 months ago
#version 450
precision highp sampler2DArray ;
precision highp float ;
precision mediump int ;
precision highp sampler2DArray ;
struct vertex
{
    vec3 position;
    vec3 center;
    vec3 tangent;
    vec3 shade_tang;
    vec3 binormal;
    vec3 normal;
    vec3 color;
} ;
bool is_equal3f ( vec3 a , vec3 b ) {
return any ( lessThan ( abs ( a - b ) , vec3 ( 0.000001 ) ) ) ;
}
vec3 qrot ( in vec4 q , in vec3 v )
{
return v + 2.0 * cross ( q . xyz , cross ( q . xyz , v ) + q . w * v ) ;
}
vec4 qinv ( in vec4 quat ) {
return vec4 ( - quat . xyz , quat . w ) ;
}
vec4 qmult ( in vec4 a , in vec4 b ) {
    vec4 dest;
dest . x = a . x * b . w + a . w * b . x + a . y * b . z - a . z * b . y ;
dest . y = a . y * b . w + a . w * b . y + a . z * b . x - a . x * b . z ;
dest . z = a . z * b . w + a . w * b . z + a . x * b . y - a . y * b . x ;
dest . w = a . w * b . w - a . x * b . x - a . y * b . y - a . z * b . z ;
return dest ;
}
vec4 qsetAxisAngle ( in vec3 axis , in float rad ) {
    vec4 dest;
rad = rad * 0.5 ;
float s = sin ( rad ) ;
dest . x = s * axis [ 0 ] ;
dest . y = s * axis [ 1 ] ;
dest . z = s * axis [ 2 ] ;
dest . w = cos ( rad ) ;
return dest ;
}
vec4 qfrom_dir ( in vec3 dir , in vec3 ident ) {
    vec4 dest;
float d = dot ( ident , dir ) ;
vec3 cr = cross ( ident , dir ) ;
dest . xyz = cr . xyz ;
dest . w = 1.0 + d ;
return normalize ( dest ) ;
}
vec3 tsr_transform ( vec3 trans , vec3 scale , vec4 quat , vec3 vec )
{
vec3 dest = vec * scale ;
dest = qrot ( quat , dest ) ;
dest += trans ;
return dest ;
}
vec3 tsr_transform_dir ( vec3 trans , vec3 scale , vec4 quat , vec3 dir )
{
vec3 dest = dir * scale ;
dest = qrot ( quat , dest ) ;
return dest ;
}
vec3 tsr_transform_inv ( vec3 trans , vec3 scale , vec4 quat , vec3 vec )
{
vec3 dest = vec - trans ;
dest = qrot ( qinv ( quat ) , dest ) ;
dest /= scale ;
return dest ;
}
vec3 tsr_transform_inv_dir ( vec3 trans , vec3 scale , vec4 quat , vec3 dir )
{
return qrot ( qinv ( quat ) , dir ) / scale ;
}
mat4 identity ( ) {
return mat4 ( 1.0 , 0.0 , 0.0 , 0.0 ,
0.0 , 1.0 , 0.0 , 0.0 ,
0.0 , 0.0 , 1.0 , 0.0 ,
0.0 , 0.0 , 0.0 , 1.0 ) ;
}
mat4 rotation_x ( float angle ) {
return mat4 ( 1.0 , 0.0 , 0.0 , 0.0 ,
0.0 , cos ( angle ) , sin ( angle ) , 0.0 ,
0.0 , - sin ( angle ) , cos ( angle ) , 0.0 ,
0.0 , 0.0 , 0.0 , 1.0 ) ;
}
mat4 rotation_y ( float angle ) {
return mat4 ( cos ( angle ) , 0.0 , - sin ( angle ) , 0.0 ,
0.0 , 1.0 , 0.0 , 0.0 ,
sin ( angle ) , 0.0 , cos ( angle ) , 0.0 ,
0.0 , 0.0 , 0.0 , 1.0 ) ;
}
mat4 rotation_z ( float angle ) {
return mat4 ( cos ( angle ) , sin ( angle ) , 0.0 , 0.0 ,
- sin ( angle ) , cos ( angle ) , 0.0 , 0.0 ,
0.0 , 0.0 , 1.0 , 0.0 ,
0.0 , 0.0 , 0.0 , 1.0 ) ;
}
vertex tbn_norm ( in vertex v ) {
return vertex ( v . position , v . center , normalize ( v . tangent ) ,
normalize ( v . shade_tang ) , normalize ( v . binormal ) , normalize ( v . normal ) , v . color ) ;
}
mat3 tsr_identity ( ) {
return mat3 ( 0.0 , 0.0 , 0.0 ,
1.0 , 1.0 , 1.0 ,
0.0 , 0.0 , 0.0 ) ;
}
mat4 tsr_to_mat4 ( mat3 t ) {
    mat4 matrix;
float qw = sqrt ( abs ( 1. - t [ 2 ] [ 0 ] * t [ 2 ] [ 0 ] - t [ 2 ] [ 1 ] * t [ 2 ] [ 1 ] - t [ 2 ] [ 2 ] * t [ 2 ] [ 2 ] ) ) ;
matrix [ 0 ] [ 0 ] = ( 1.0 - ( t [ 2 ] [ 1 ] * ( t [ 2 ] [ 1 ] + t [ 2 ] [ 1 ] ) + t [ 2 ] [ 2 ] * ( t [ 2 ] [ 2 ] + t [ 2 ] [ 2 ] ) ) ) * t [ 1 ] [ 0 ] ;
matrix [ 0 ] [ 1 ] = ( t [ 2 ] [ 0 ] * ( t [ 2 ] [ 1 ] + t [ 2 ] [ 1 ] ) + qw * ( t [ 2 ] [ 2 ] + t [ 2 ] [ 2 ] ) ) * t [ 1 ] [ 0 ] ;
matrix [ 0 ] [ 2 ] = ( t [ 2 ] [ 0 ] * ( t [ 2 ] [ 2 ] + t [ 2 ] [ 2 ] ) - qw * ( t [ 2 ] [ 1 ] + t [ 2 ] [ 1 ] ) ) * t [ 1 ] [ 0 ] ;
matrix [ 0 ] [ 3 ] = 0.0 ;
matrix [ 1 ] [ 0 ] = ( t [ 2 ] [ 0 ] * ( t [ 2 ] [ 1 ] + t [ 2 ] [ 1 ] ) - qw * ( t [ 2 ] [ 2 ] + t [ 2 ] [ 2 ] ) ) * t [ 1 ] [ 0 ] ;
matrix [ 1 ] [ 1 ] = ( 1.0 - ( t [ 2 ] [ 0 ] * ( t [ 2 ] [ 0 ] + t [ 2 ] [ 0 ] ) + t [ 2 ] [ 2 ] * ( t [ 2 ] [ 2 ] + t [ 2 ] [ 2 ] ) ) ) * t [ 1 ] [ 0 ] ;
matrix [ 1 ] [ 2 ] = ( t [ 2 ] [ 1 ] * ( t [ 2 ] [ 2 ] + t [ 2 ] [ 2 ] ) + qw * ( t [ 2 ] [ 0 ] + t [ 2 ] [ 0 ] ) ) * t [ 1 ] [ 0 ] ;
matrix [ 1 ] [ 3 ] = 0.0 ;
matrix [ 2 ] [ 0 ] = ( t [ 2 ] [ 0 ] * ( t [ 2 ] [ 2 ] + t [ 2 ] [ 2 ] ) + qw * ( t [ 2 ] [ 1 ] + t [ 2 ] [ 1 ] ) ) * t [ 1 ] [ 0 ] ;
matrix [ 2 ] [ 1 ] = ( t [ 2 ] [ 1 ] * ( t [ 2 ] [ 2 ] + t [ 2 ] [ 2 ] ) - qw * ( t [ 2 ] [ 0 ] + t [ 2 ] [ 0 ] ) ) * t [ 1 ] [ 0 ] ;
matrix [ 2 ] [ 2 ] = ( 1.0 - ( t [ 2 ] [ 0 ] * ( t [ 2 ] [ 0 ] + t [ 2 ] [ 0 ] ) + t [ 2 ] [ 1 ] * ( t [ 2 ] [ 1 ] + t [ 2 ] [ 1 ] ) ) ) * t [ 1 ] [ 0 ] ;
matrix [ 2 ] [ 3 ] = 0.0 ;
matrix [ 3 ] [ 0 ] = t [ 0 ] [ 0 ] ;
matrix [ 3 ] [ 1 ] = t [ 0 ] [ 1 ] ;
matrix [ 3 ] [ 2 ] = t [ 0 ] [ 2 ] ;
matrix [ 3 ] [ 3 ] = 1.0 ;
return matrix ;
}
mat3 tsr_set_quat ( in vec4 quat , in mat3 tsr ) {
if ( quat . w < 0. )
quat . xyz *= - 1. ;
tsr [ 2 ] = quat . xyz ;
return tsr ;
}
vec4 tsr_get_quat ( in mat3 tsr ) {
return vec4 ( tsr [ 2 ] , sqrt ( abs ( 1. - tsr [ 2 ] [ 0 ] * tsr [ 2 ] [ 0 ] - tsr [ 2 ] [ 1 ] * tsr [ 2 ] [ 1 ] - tsr [ 2 ] [ 2 ] * tsr [ 2 ] [ 2 ] ) ) ) ;
}
vec3 tsr9_transform ( mat3 tsr , vec3 vec )
{
vec3 dest = vec * tsr [ 1 ] ;
vec4 quat = tsr_get_quat ( tsr ) ;
dest = qrot ( quat , dest ) ;
dest += tsr [ 0 ] ;
return dest ;
}
vec3 tsr9_transform_dir ( mat3 tsr , vec3 dir )
{
vec3 dest = dir * tsr [ 1 ] ;
vec4 quat = tsr_get_quat ( tsr ) ;
dest = qrot ( quat , dest ) ;
return dest ;
}
vec3 tsr9_transform_normal ( mat3 tsr , vec3 norm )
{
vec3 dest = norm / tsr [ 1 ] ;
vec4 quat = tsr_get_quat ( tsr ) ;
dest = qrot ( quat , dest ) ;
return dest ;
}
mat3 tsr_set_trans ( in vec3 trans , in mat3 tsr )
{
tsr [ 0 ] = trans ;
return tsr ;
}
vec3 tsr_get_trans ( in mat3 tsr ) {
return tsr [ 0 ] ;
}
mat3 tsr_set_scale ( in vec3 scale , in mat3 tsr )
{
tsr [ 1 ] = scale ;
return tsr ;
}
vec3 tsr_get_scale ( in mat3 tsr ) {
return tsr [ 1 ] ;
}
mat3 tsr_multiply ( in mat3 tsr , in mat3 tsr2 ) {
    mat3 dest_tsr;
vec3 trans = tsr_get_trans ( tsr ) ;
vec3 trans2 = tsr_get_trans ( tsr2 ) ;
vec3 scale = tsr_get_scale ( tsr ) ;
vec3 scale2 = tsr_get_scale ( tsr2 ) ;
vec4 quat = tsr_get_quat ( tsr ) ;
vec4 quat2 = tsr_get_quat ( tsr2 ) ;
vec3 dest_trans = tsr_transform ( trans , scale , quat , trans2 ) ;
dest_tsr = tsr_set_trans ( dest_trans , dest_tsr ) ;
vec3 dest_scale = scale * scale2 ;
dest_tsr = tsr_set_scale ( dest_scale , dest_tsr ) ;
vec4 dest_quat = qmult ( quat , quat2 ) ;
dest_tsr = tsr_set_quat ( dest_quat , dest_tsr ) ;
return dest_tsr ;
}
mat3 tsr_multiply ( in mat3 tsr , in mat3 tsr2 , out mat3 dest ) {
dest = tsr_multiply ( tsr , tsr2 ) ;
return dest ;
}
mat3 euler_to_rotation_matrix ( vec3 euler )
{
float cosX = cos ( euler . x ) ;
float cosY = cos ( euler . y ) ;
float cosZ = cos ( euler . z ) ;
float sinX = sin ( euler . x ) ;
float sinY = sin ( euler . y ) ;
float sinZ = sin ( euler . z ) ;
float cosXcosZ = cosX * cosZ ;
float cosXsinZ = cosX * sinZ ;
float sinXcosZ = sinX * cosZ ;
float sinXsinZ = sinX * sinZ ;
    mat3 mat;
mat [ 0 ] [ 0 ] = cosY * cosZ ;
mat [ 0 ] [ 1 ] = cosY * sinZ ;
mat [ 0 ] [ 2 ] = - sinY ;
mat [ 1 ] [ 0 ] = sinY * sinXcosZ - cosXsinZ ;
mat [ 1 ] [ 1 ] = sinY * sinXsinZ + cosXcosZ ;
mat [ 1 ] [ 2 ] = cosY * sinX ;
mat [ 2 ] [ 0 ] = sinY * cosXcosZ + sinXsinZ ;
mat [ 2 ] [ 1 ] = sinY * cosXsinZ - sinXcosZ ;
mat [ 2 ] [ 2 ] = cosY * cosX ;
return mat ;
}
vec4 get_tbn_quat ( in vec4 tbn ) {
return normalize ( tbn ) ;
}
vec4 get_tbn_quat ( in vec4 tbn , out float correct_angle , out float handedness ) {
vec4 quat = get_tbn_quat ( tbn ) ;
correct_angle = length ( tbn ) * 3.14159265359 ;
handedness = sign ( tbn [ 3 ] ) ;
return get_tbn_quat ( tbn ) ;
}
float fast_sqrt ( float v )
{
return intBitsToFloat ( 532487669 + ( floatBitsToInt ( v ) >> 1 ) ) ;
}
vec2 fast_sqrt ( vec2 v )
{
return intBitsToFloat ( 532487669 + ( floatBitsToInt ( v ) >> 1 ) ) ;
}
float cone_cosine ( float r )
{
float gloss = - 2. + 2. / ( r * r ) ;
return exp2 ( - 3.32193 * r * r ) ;
}
void convert_uv_from_WebGL_to_WebGPU ( inout vec3 uv ) {
uv . y = 1. - uv . y ;
}
mat3 billboard_spherical ( vec3 center_pos , mat3 view_tsr ) {
vec4 bb_q = tsr_get_quat ( view_tsr ) ;
vec4 right_q = qsetAxisAngle ( vec3 ( 1.0 , 0.0 , 0.0 ) , 3.14159265359 / 2.0 ) ;
bb_q = qmult ( right_q , bb_q ) ;
bb_q = qinv ( bb_q ) ;
mat3 bb_tsr = tsr_identity ( ) ;
bb_tsr = tsr_set_trans ( center_pos , bb_tsr ) ;
bb_tsr = tsr_set_quat ( bb_q , bb_tsr ) ;
return bb_tsr ;
}
mat3 billboard_tsr ( in vec3 camera_eye , in vec3 wcen , in mat3 view_tsr ,
in mat3 model_tsr ) {
mat3 bill_tsr = billboard_spherical ( wcen , view_tsr ) ;
vec3 bill_scale = tsr_get_scale ( bill_tsr ) ;
vec3 model_scale = tsr_get_scale ( model_tsr ) ;
bill_tsr = tsr_set_scale ( bill_scale * model_scale , bill_tsr ) ;
return bill_tsr ;
}
vertex to_world ( in vec3 pos , in vec3 cen , in vec3 tng , in vec3 shd_tng , in vec3 bnr ,
in vec3 nrm , in mat3 model_tsr ) {
pos = tsr9_transform ( model_tsr , pos ) ;
cen = tsr9_transform ( model_tsr , cen ) ;
tng = tsr9_transform_dir ( model_tsr , tng ) ;
shd_tng = tsr9_transform_dir ( model_tsr , shd_tng ) ;
bnr = tsr9_transform_dir ( model_tsr , bnr ) ;
nrm = tsr9_transform_normal ( model_tsr , nrm ) ;
return tbn_norm ( vertex ( pos , cen , tng , shd_tng , bnr , nrm , vec3 ( 0.0 ) ) ) ;
}
vec2 scale_texcoord ( vec2 texcoord , vec3 texture_scale ) {
return ( texcoord + 0.5 ) * texture_scale . xy - 0.5 ;
}
layout (location=0) in vec3 a_position ;
layout (location=1) in vec4 a_tbn ;
layout (binding=0) uniform vertex_uni_block1{
    mat3 u_view_tsr;
};
layout (binding=1) uniform vertex_uni_block{
    mat4 u_p_point_light_matrix[2];
    float u_normal_offset;
    vec4 u_v_light_ts[2];
    vec4 u_v_light_r[2];
    mat4 u_proj_matrix;
    mat4 u_sky_vp_inverse;
    vec2 u_camera_range;
    vec2 u_subpixel_jitter;
};
layout (binding=2) uniform general_uni_block_subs{
    float u_cast_light_spot_size[2];
    float u_light_rads[2];
    float u_light_near_planes[2];
    int u_light_types[2];
    vec2 u_light_ranges[2];
    int u_lamp_indices[2];
};
layout (binding=3) uniform general_uni_block_subs_transient{
    vec3 u_camera_eye_frag;
};
layout (binding=4) uniform general_uni_block_obj_render_transient{
    mat3 u_model_tsr;
};
layout (location=0) out vec3 v_pos_world ;
layout (location=1) out vec3 v_normal ;
layout (location=2) out vec4 v_pos_view ;
layout (location=3) out vec4 v_tangent ;
layout (location=4) out vec3 v_shade_tang ;
layout (location=5) out vec4 v_shadow_point_coord[2] ;
layout (binding=5) uniform mesh_map_block{
    int u_mesh_map_level;
};
layout(set = 1, binding = 6) uniform sampler param_TEXTURE_mesh_mapSampler ;
layout(set = 1, binding = 7) uniform texture2DArray param_TEXTURE_mesh_mapTexture ;
#define param_TEXTURE_mesh_map sampler2DArray(param_TEXTURE_mesh_mapTexture, param_TEXTURE_mesh_mapSampler)
layout (binding=8) uniform nodes_block2{
    vec4 u_node_values[3];
    vec3 u_node_rgbs[1];
    vec4 u_node_mix_rgb_values[1];
    vec3 u_node_mix_rgbs_colors[1];
    vec4 u_node_normal_map_values[1];
    vec3 u_node_normal_map_colors[1];
};
vec4 get_shadow_coords_shifted ( mat4 light_proj_matrix , vec4 pos_light_space , mat4 v_light_matrix ) {
vec2 shift = ( light_proj_matrix * v_light_matrix [ 3 ] ) . xy ;
float half_tex_res = 2048.0 / 2.0 ;
shift = floor ( shift * half_tex_res + 0.5 ) / half_tex_res - shift ;
vec4 shadow_coord = light_proj_matrix * pos_light_space ;
shadow_coord . xy += shift ;
shadow_coord . xyz = 0.5 * ( shadow_coord . xyz + shadow_coord . w ) ;
return shadow_coord ;
}
void get_shadow_coords ( vec3 pos , vec3 nor ) {
for ( int i = 0 ; i < 2 ; i ++ ) {
int index = u_lamp_indices [ i ] ;
mat4 v_light_matrix = tsr_to_mat4 (
mat3 (
u_v_light_ts [ i ] . xyz ,
vec3 ( u_v_light_ts [ i ] . w ) ,
u_v_light_r [ i ] . xyz * ( 2. * float ( u_v_light_r [ i ] . w >= 0. ) - 1. )
)
) ;
vec4 pos_light = v_light_matrix * vec4 ( pos + u_normal_offset * nor ,
1.0 ) ;
if ( u_light_types [ i ] == 3 ) {
}
else {
v_shadow_point_coord [ index ] = get_shadow_coords_shifted ( u_p_point_light_matrix [ index ] , pos_light , v_light_matrix ) ;
}
}
}
vec2 vec_to_uv ( vec3 vec )
{
return vec2 ( vec . xy * 0.5 + vec2 ( 0.5 , 0.5 ) ) ;
}
vec3 uv_to_vec ( vec2 uv )
{
return vec3 ( uv * 2.0 - vec2 ( 1.0 , 1.0 ) , 0.0 ) ;
}
vec3 rgb_to_hsv ( vec3 rgb )
{
vec4 k = vec4 ( 0.0 , - 1.0 / 3.0 , 2.0 / 3.0 , - 1.0 ) ;
vec4 p = mix ( vec4 ( rgb . bg , k . wz ) , vec4 ( rgb . gb , k . xy ) , step ( rgb . b , rgb . g ) ) ;
vec4 q = mix ( vec4 ( p . xyw , rgb . r ) , vec4 ( rgb . r , p . yzx ) , step ( p . x , rgb . r ) ) ;
float d = q . x - min ( q . w , q . y ) ;
float e = 1.0e-10 ;
return vec3 ( abs ( q . z + ( q . w - q . y ) / ( 6.0 * d + e ) ) , d / ( q . x + e ) , q . x ) ;
}
vec3 hsv_to_rgb ( vec3 hsv )
{
vec4 k = vec4 ( 1.0 , 2.0 / 3.0 , 1.0 / 3.0 , 3.0 ) ;
vec3 p = abs ( fract ( vec3 ( hsv . r , hsv . r , hsv . r ) + k . xyz ) * 6.0 - k . www ) ;
return hsv . b * mix ( k . xxx , clamp ( p - k . xxx , 0.0 , 1.0 ) , hsv . g ) ;
}
void srgb_to_lin ( inout float color )
{
color = pow ( color , 2.2 ) ;
}
void lin_to_srgb ( inout float color )
{
color = pow ( color , 1.0 / 2.2 ) ;
}
void srgb_to_lin ( inout vec3 color )
{
color = pow ( color , vec3 ( 2.2 ) ) ;
}
void lin_to_srgb ( inout vec3 color )
{
color = pow ( color , vec3 ( 1.0 / 2.2 ) ) ;
}
void premultiply_alpha ( inout vec3 color , in float alpha )
{
color = color * alpha ;
}
float luma ( vec4 color ) {
vec3 luma_coeff = vec3 ( 0.299 , 0.587 , 0.114 ) ;
float l = dot ( color . rgb , luma_coeff ) ;
return l ;
}
layout (location=2) in vec2 param_UVMAP_a_0 ;
layout (location=6) out vec2 param_UVMAP_v_0 ;
void nodes_main ( in vec3 start_position , in vec3 nin_eye_dir , in vec4 nin_pos_view , in vec3 normal , out vec3 position ) {
position = start_position ;
vec3 unnorm_sided_normal = v_normal ;
vec3 nin_nmap_normal = normalize ( unnorm_sided_normal ) ;
vec3 norm_sided_normal = normalize ( unnorm_sided_normal ) ;
vec3 nin_normal = normalize ( v_normal ) ;
vec3 nin_geom_normal = norm_sided_normal ;
vec3 nmap_binormal = cross ( nin_nmap_normal , v_tangent . xyz ) * v_tangent . w ;
mat3 nin_nmap_tbn_matrix = mat3 ( v_tangent . xyz , nmap_binormal , nin_nmap_normal ) ;
{
param_UVMAP_v_0 = param_UVMAP_a_0 ;
}
}
void main ( void ) {
mat4 view_refl_matrix = mat4 ( 0.0 ) ;
mat3 view_tsr = u_view_tsr ;
mat3 model_tsr = u_model_tsr ;
vec3 position = a_position ;
float correct_angle , handedness ;
vec4 tbn_quat = get_tbn_quat ( a_tbn , correct_angle , handedness ) ;
vec3 norm_tbn = qrot ( tbn_quat , vec3 ( 0.0 , 1.0 , 0.0 ) ) ;
vec3 normal = norm_tbn ;
vec3 tangent = qrot ( tbn_quat , vec3 ( 1.0 , 0.0 , 0.0 ) ) ;
vec3 binormal = handedness * cross ( normal , tangent ) ;
vec4 tanget_rot_quat = qsetAxisAngle ( binormal , handedness * correct_angle ) ;
tangent = qrot ( tanget_rot_quat , normal ) ;
vec3 norm_world = normalize ( tsr9_transform_normal ( model_tsr , norm_tbn ) ) ;
vec3 shade_binormal = cross ( vec3 ( 0.0 , 0.0 , 1.0 ) , norm_world ) ;
vec3 shade_tangent = cross ( norm_world , shade_binormal ) ;
vec3 center = vec3 ( 0.0 ) ;
vertex world = to_world ( position , center , tangent , shade_tangent , binormal ,
normal , model_tsr ) ;
float m = ( dot ( cross ( world . normal , world . tangent ) ,
world . binormal ) < 0.0 ) ? - 1.0 : 1.0 ;
v_tangent = vec4 ( world . tangent , m ) ;
v_shade_tang = world . shade_tang ;
v_pos_world = world . position ;
v_normal = world . normal ;
    vec3 pos;
vec3 eye_dir = normalize ( u_camera_eye_frag - world . position ) ;
vec4 pos_view_node = vec4 ( tsr9_transform ( view_tsr , pos ) , 1.0 ) ;
nodes_main ( world . position , eye_dir , pos_view_node , world . normal , pos ) ;
vec4 pos_view = vec4 ( tsr9_transform ( view_tsr , pos ) , 1.0 ) ;
v_pos_view = pos_view ;
    vec4 pos_clip;
pos_clip = u_proj_matrix * pos_view ;
pos_clip . xy += u_subpixel_jitter * pos_clip . w ;
get_shadow_coords ( world . position , world . normal ) ;
gl_Position = pos_clip ;
}
// main.glslv

When parsing a shader in SPIR-V it gives an error

$ ./glslang.exe ../../../../test.vert.glsl --target-env vulkan1.3
../../../../test.vert.glsl
ERROR: ../../../../test.vert.glsl:403: 'location' : overlapping use of location 6
ERROR: 1 compilation errors.  No code generated.

ERROR: Linking vertex stage: Missing entry point: Each stage requires one entry point

SPIR-V is not generated for failed compile or link

At the same time, if in a construction site you change the array size from 2 to 1, then there is no error

layout (location=5) out vec4 v_shadow_point_coord[2] ; layout (location=5) out vec4 v_shadow_point_coord[1] ;

arcady-lunarg commented 4 months ago

This is expected, you have an array of two vec4s which takes two locations (5 and 6), and then you have something else in location 6 as well. If you reduce the size of the array to 1 you make it only take 1 location and then there are no overlaps. Perhaps the error message could be better in highlighting which two things overlap.