PDA

View Full Version : Linux GLSL compiler - Nvidia driver



Elurahu
09-21-2011, 10:06 AM
I've having some issues linking a shader program on our current Linux platform. It works perfectly on any Windows platform I've tried using. I'm getting the following errors:

Link info
---------
error: type mismatch for varying parameter (named FragData.kVSPos)
between shader stages
error: type mismatch for varying parameter (named FragData.fRadius)
between shader stages
error: type mismatch for varying parameter (named FragData.kColor)
between shader stages
error: type mismatch for varying parameter (named FragData.kMapping)
between shader stages

which are defined in a geometry shader and a fragment shader.

Geometry definition:
out FragData
{
flat vec3 kVSPos;
flat float fRadius;
flat vec3 kColor;
smooth vec2 kMapping;
} OUT;

Fragment definition:
in FragData
{
flat vec3 kVSPos;
flat float fRadius;
flat vec3 kColor;
smooth vec2 kMapping;
} IN;

Hope someone can help out.

Dark Photon
09-21-2011, 03:59 PM
Try something like this:



struct VaryingStruct
{
vec3 kVSPos ;
float fRadius ;
vec3 kColor ;
vec2 kMapping;
};

// VERTEX SHADER
out ShaderVars { VaryingStruct vars; };

// FRAGMENT SHADER
in ShaderVars { VaryingStruct vars; };


Then in your shader use "vars.fRadius", etc. I'm not going to claim that I "get" this syntax, but it works. Try it. Then add your interpolation qualifiers.

BTW, are you saying your example works with Windows NVidia drivers but not Linux NVidia drivers? Which versions of each?

Elurahu
09-22-2011, 12:05 AM
Wonderful - I'll try that out immediately.

Linux driver version: 280.13
Windows driver version: 280.36

Windows 7 and Ubuntu 11.4

Elurahu
09-22-2011, 12:17 AM
Same problems as before - Now it reads:

This is driving me nuts. It's a work related thing so I have to get it working one way or another.

Link info
---------
error: type mismatch for varying parameter (named ShaderVars.vars.kVSPos)
between shader stages
error: type mismatch for varying parameter (named ShaderVars.vars.fRadius)
between shader stages
error: type mismatch for varying parameter (named ShaderVars.vars.kColor)
between shader stages
error: type mismatch for varying parameter (named ShaderVars.vars.kMapping)
between shader stages

Geometry shader:
----------------------------
#version 330
#extension GL_EXT_geometry_shader4 : enable

precision mediump float;

layout(points) in;
layout(triangle_strip, max_vertices=4) out;

// Attributes
in VertexData
{
in vec3 kVSPos;
in vec3 kColor;
in float fRadius;
} IN[];

struct VaryingStruct
{
vec3 kVSPos;
float fRadius;
vec3 kColor;
vec2 kMapping;
};

out ShaderVars
{
VaryingStruct vars;
};

Fragment shader:
----------------------------
#version 330

// Input
struct VaryingStruct
{
vec3 kVSPos;
float fRadius;
vec3 kColor;
vec2 kMapping;
};

in ShaderVars
{
VaryingStruct vars;
};

// Output
out vec4 FRAGDATA0;

Alfonse Reinheart
09-22-2011, 01:47 AM
#version 330
#extension GL_EXT_geometry_shader4 : enable

This seems... contradictory and confusing.

GLSL 3.30 has geometry shader functionality built into it. Geometry shader functionality that is very different from that exposed by the EXT version. I would suggest not confusing the driver by telling it that you could be using two different interfaces to the same tech. Your shader seems to be 3.30, so just call it that and drop the extension part.

Elurahu
09-22-2011, 01:56 AM
Thank you for the input Alfonse - I did find the error just now.

It turned out that I set the VS and GS to mediump but had forgotten to set the FS to mediump which resulted in conflicting types.

Regarding the extension in my experience I HAVE to do it - At least on the older Nvidia GLSL compilers.

Edit: Tried just excluding it which also works fine. Guess they fixed it :)