Help with compiler error message

I’m getting the following error

0(70) : error C1067: too little data in type constructor

with the geometry shader code below. I’m using the Nvidia 195.36.24 driver under Ubuntu 10.4. Can anyone explain what the problem with the Cell constructor is in the buildCell function?


#version 150 core
#extension GL_EXT_geometry_shader4 : enable

in vec3 gs_position[1];
in uvec4 gs_cellData1_4[1];
in uvec3 gs_cellData5_7[1];
in uint gs_colorIndex[1];

uniform mat4 rotation;
uniform mat4 location;
uniform mat4 projection;

uniform samplerBuffer cornerPositions;
uniform vec4 color;
uniform float colorArray[3u * 30u];

out vec4 fs_color;

layout(points) in;
layout(triangle_strip) out;

vec3 cornerPosition(uint aCornerIndex)
{
    return texelFetch(cornerPositions, int(aCornerIndex - 1u)).xyz;
}

vec4 colorValue(in uint aColorIndex)
{
    uint base = aColorIndex * 3u;
    if (base >= uint(colorArray.length())) {
         return color;
    } else {
        return vec4(colorArray[int(base)],
                         colorArray[int(base+1u)],
                         colorArray[int(base+2u)],
                         1.0); 
    }
}

vec4 transformPosition(in vec3 aPosition)
{
    vec4 rotatedPosition = rotation * vec4(aPosition, 1.0);
    vec4 locatedRotated = location * rotatedPosition;
    return projection * locatedRotated;
}

struct Cell 
{
    vec4 center;
    uint number;
    uint faceCount;
    vec4 corners[6];
};

Cell buildCell()
{
    vec4 center = transformPosition(gs_position[0]);
    uint number = gs_cellData1_4[0].x;
    uint faceCount = number <= 12u ? 5u : 6u;
    vec4 corners[6];
    corners[0] = transformPosition(cornerPosition(gs_cellData1_4[0].y));
    corners[1] = transformPosition(cornerPosition(gs_cellData1_4[0].z));
    corners[2] = transformPosition(cornerPosition(gs_cellData1_4[0].w));
    corners[3] = transformPosition(cornerPosition(gs_cellData5_7[0].x));
    corners[4] = transformPosition(cornerPosition(gs_cellData5_7[0].y));
    if (faceCount < 6u) {
        corners[5] = transformPosition(cornerPosition(gs_cellData5_7[0].z));
    } else {
        corners[5] = vec4(0.0,0.0,0.0);
    }
    return Cell(center, number, faceCount, corners);
}

void main()
{
//    uint pID = uint(gl_PrimitiveIDIn);
//    uint cellID = pID < 60u ? pID / 5u : 12u + (( pID - 60u ) / 6u);

    Cell cell = buildCell();
    fs_color = colorValue(gs_colorIndex[0]); 
    for (int i = 0; i < int(cell.faceCount); ++i) {
        gl_Position = cell.center;
        EmitVertex();
        gl_position = cell.corners[i];
        EmitVertex();
        int j = i + 1;
        j = (j == int(cell.faceCount)) ? 0 : j;
        gl_position = cell.corners[j];
        EndPrimitive();
    }
}

Nothing wrong with the Cell constructor. Look 2 lines above…


else {
        corners[5] = vec4(0.0,0.0,0.0);
    }

Thanks. I must have miscounted the lines and got fixated on the struct constructor.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.