shaderc
shaderc copied to clipboard
glslc crash with segmentation fault
Hello !
I'm a recent Vulkan user, and I just ran into an issue.
When I compile the fragment shader below, glslc trigger a segmentation fault (coredump.bin.zip)
#version 460
#extension GL_ARB_separate_shader_objects : enable
#extension GL_EXT_nonuniform_qualifier : enable
layout(location = 0) in vec3 fragColor;
layout(location = 1) in vec2 fragTextCoords;
layout(location = 2) flat in uint textureIndex;
layout(location = 3) in vec3 inFragPos;
layout(location = 4) in vec3 inNormal;
layout(location = 0) out vec4 outColor;
layout (push_constant) uniform constants {
vec4 position;
mat4 viewproj;
} cameraData;
layout(set = 1, binding = 0) uniform sampler2D texSampler[];
struct Material {
vec3 ambientColor;
vec3 diffuse;
vec3 specular;
float shininess;
};
layout (std140, set = 0, binding = 1) readonly buffer ObjectMaterials {
Material materials[];
} objectMaterials;
vec4 computeBasicLight(Material mat) {
float ambientStrength = 0.1;
vec3 ambient = ambientStrength * mat.ambientColor;
vec3 norm = normalize(inNormal);
vec3 lightDir = normalize(vec3(11.0, 16.0, 24.0) - inFragPos);
float diff = max(dot(norm, lightDir), 0.0);
vec3 diffuse = diff * mat.diffuse;
return vec4(ambient + diffuse, 1.0);
}
void main() {
vec4 pixelColor = texture(texSampler[textureIndex], fragTextCoords);
outColor = pixelColor * computeBasicLight(objectMaterials[0]);
}
glslc --version
2021.0
2021.1
11.4.0
Target: SPIR-V 1.0
I know that the function call computeBasicLight(objectMaterials[0]) is invalid, but shouldn't it print an error message ?