RADV: LLVM linking error
I was using a geometry shader but i seem to get this error from the compiler. I can't tell if its my poor coding.
LLVM ERROR: Cannot select: 0x7a6be810b200: f32 = select 0x7a6be810b880, ConstantFP:f32<1.000000e+00>, 0x7a6be810aff8 0x7a6be810b880: i32 = bitcast 0x7a6be810b2d0 0x7a6be810b2d0: f32 = llvm.amdgcn.interp.mov nsz arcp TargetConstant:i64<1909>, TargetConstant:i32<2>, TargetConstant:i32<2>, TargetConstant:i32<1>, 0x7a6be810b7b0 0x7a6be810daa0: i64 = TargetConstant<1909> 0x7a6be810b8e8: i32 = TargetConstant<2> 0x7a6be810b8e8: i32 = TargetConstant<2> 0x7a6be810d7c8: i32 = TargetConstant<1> 0x7a6be810b7b0: i32,ch = CopyFromReg 0x7a6be80300a8, Register:i32 %23 0x7a6be810b818: i32 = Register %23 0x7a6be810b610: f32 = ConstantFP<1.000000e+00> 0x7a6be810aff8: f32,ch = CopyFromReg 0x7a6be80300a8, Register:f32 %13 0x7a6be810aec0: f32 = Register %13 In function: main
Vertex Shader
#version 410 core
layout (location = 0) in vec3 point;
layout (location = 1) in vec3 normal;
layout (location = 2) in vec2 uv;
layout (location = 3) in int uBone;
layout (location = 4) in ivec4 bones;
layout (location = 5) in vec4 weights;
uniform mat4 bone[200];
out vData
{
vec2 uv;
vec3 normal;
} data;
void main()
{
data.uv = uv;
data.normal = normal;
vec4 position = vec4(0.0);
if(uBone == 1)
{
for (int i = 0; i < 4; i++)
{
if(bones[i] == 0xFFFFFFFF)
break;
position += bone[bones[i]] * vec4(point, 1.0) * weights[i];
}
}
else
{
position = vec4(point, 1.0);
}
position.w = 1.0;
gl_Position = position;
}
Fragment Shader
#version 410 core
in fData
{
in vec2 frag_uv;
in vec3 frag_normal;
flat in int shadestyle;
flat in bool uTexture;
flat in bool mColored;
flat in vec3 color;
};
uniform sampler2D text2D[3];
out vec4 FragColor;
void main()
{
vec4 pixel = vec4(0.0);
switch(shadestyle)
{
case 0:
if(uTexture)
pixel = texture(text2D[0], vec2(frag_uv.x, frag_uv.y));
if(mColored) // add alpha flag
pixel = vec4(color, 1.0);
break;
}
if(pixel.a < 0.1)
discard;
FragColor = pixel;
}
Geometry Shader
#version 410 core
layout(triangles) in;
layout(triangle_strip, max_vertices = 3) out;
uniform mat4 MVP;
uniform int shadestyle;
uniform bool uTexture;
uniform bool mColored;
uniform vec3 mColor;
uniform bool outline;
uniform float outlinethickness;
in vData
{
vec2 uv;
vec3 normal;
} data[];
out fData
{
out vec2 frag_uv;
out vec3 frag_normal;
flat out int shadestyle;
flat out bool uTexture;
flat out bool mColored;
flat out vec3 color;
} frag;
void main()
{
for (int i = 0; i < gl_in.length(); i++)
{
gl_Position = MVP * gl_in[i].gl_Position;
frag.frag_uv = data[i].uv;
frag.frag_normal = data[i].normal;
frag.shadestyle = shadestyle;
frag.mColored = mColored;
frag.color = mColor;
frag.uTexture = uTexture;
EmitVertex();
}
EndPrimitive();
if(outline)
{
// Calculate screen space edge vectors
vec2 edges[3];
for (int i = 0; i < 3; i++)
{
edges[i] = vec2(gl_in[(i + 1) % 3].gl_Position.xy - gl_in[i].gl_Position.xy);
}
// Find the normal to the triangle
vec2 normal = normalize(vec2(-edges[0].y, edges[0].x));
// Create the outline by expanding the vertices
for (int i = 0; i < 3; i++) {
gl_Position = MVP * (gl_in[i].gl_Position + vec4(normal * outlinethickness, 0.0, 0.0));
EmitVertex();
}
EndPrimitive();
}
}