google / google/shaderc

glslc crash with segmentation fault

Open
#1,207 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.2k
Forks
445
Avg merge
11h 6m
Merged PRs (30d)
6

Description

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](https://github.com/google/shaderc/files/6773015/coredump.bin.zip))

```glsl
#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
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.