GLSL geometry input/output primitive issue

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Tannz0rz
Posts: 35
Joined: Fri May 08, 2009 12:25 am
Location: Orlando FL, USA

GLSL geometry input/output primitive issue

Post by Tannz0rz »

I've been trying to make use of geometry shaders recently and I've come to notice that only the "triangles" layout appears to work. All other layouts don't render the mesh visible at all. Mind you, I've tried simple pass-throughs for testing purposes.

Vert and frag programs for both:

Code: Select all

 
// Vert
void main()
{
    gl_Position = ftransform();
}
 
// Frag
void main()
{
    gl_FragColor = vec4(1.0);
}
 
As triangle:

Code: Select all

 
layout(triangles) in;
layout(triangle_strip, max_vertices = 3) out;
 
void main() 
{
    for(int i = 0; i < 3; i++) 
    {
        gl_Position = gl_in[i].gl_Position;
        
        EmitVertex();
    }
    
    EndPrimitive();
}
 
As line:

Code: Select all

 
layout(lines) in;
layout(line_strip, max_vertices = 2) out;
 
void main() 
{
    for(int i = 0; i < 2; i++) 
    {
        gl_Position = gl_in[i].gl_Position;
 
        EmitVertex();
    }
 
    EndPrimitive();
}
 
Even though these images should be unnecessary, they always make understanding easier:
Triangle
Line

And yes, I have properly set the compile targets and primitive type parameters in my "addHighLevelShaderMaterial" call. I've come to notice that even if I have the primitive type set to something aside from EPT_TRIANGLES and EPT_TRIANGLE_STRIP the triangle code still works. I've even tried a "points" pass-through (uses only 1 vertex) to no avail.

Running Irrlicht 1.8 on a Radeon Sapphire HD 5770.

Regards,
Tannz0rz
Image
Tannz0rz
Posts: 35
Joined: Fri May 08, 2009 12:25 am
Location: Orlando FL, USA

Re: GLSL geometry input/output primitive issue

Post by Tannz0rz »

I found the bit I've been looking for. Was this just a mistake or is it intentionally unimplemented?

Code: Select all

 
COpenGLSLMaterialRenderer::COpenGLSLMaterialRenderer(video::COpenGLDriver* driver,
        s32& outMaterialTypeNr, const c8* vertexShaderProgram,
        const c8* vertexShaderEntryPointName,
        E_VERTEX_SHADER_TYPE vsCompileTarget,
        const c8* pixelShaderProgram,
        const c8* pixelShaderEntryPointName,
        E_PIXEL_SHADER_TYPE psCompileTarget,
        const c8* geometryShaderProgram,
        const c8* geometryShaderEntryPointName,
        E_GEOMETRY_SHADER_TYPE gsCompileTarget,
        scene::E_PRIMITIVE_TYPE inType, scene::E_PRIMITIVE_TYPE outType,
        u32 verticesOut,
        IShaderConstantSetCallBack* callback,
        video::IMaterialRenderer* baseMaterial,
        s32 userData)
    : Driver(driver), CallBack(callback), BaseMaterial(baseMaterial),
        Program(0), Program2(0), UserData(userData)
{
    #ifdef _DEBUG
    setDebugName("COpenGLSLMaterialRenderer");
    #endif
 
    //entry points must always be main, and the compile target isn't selectable
    //it is fine to ignore what has been asked for, as the compiler should spot anything wrong
    //just check that GLSL is available
 
    if (BaseMaterial)
        BaseMaterial->grab();
 
    if (CallBack)
        CallBack->grab();
 
    if (!Driver->queryFeature(EVDF_ARB_GLSL))
        return;
 
    init(outMaterialTypeNr, vertexShaderProgram, pixelShaderProgram, geometryShaderProgram);
}
 
I'm assuming the "init" call is supposed to be:

Code: Select all

init(outMaterialTypeNr, vertexShaderProgram, pixelShaderProgram, geometryShaderProgram, inType, outType, verticesOut);
EDIT: Rebuilt it with the correction and... it's doing the same thing. Looks like I still need some help.
Image
Tannz0rz
Posts: 35
Joined: Fri May 08, 2009 12:25 am
Location: Orlando FL, USA

Re: GLSL geometry input/output primitive issue

Post by Tannz0rz »

Bump. Anyone have an answer?
Image
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

Re: GLSL geometry input/output primitive issue

Post by Cube_ »

Sorry, I am a dummy when it comes to shading ^^; (btw bumping it is pretty unnecessary, since someone will stumble upon it eventually (oh and you should use the edit function when adding information instead of double posting)
"this is not the bottleneck you are looking for"
CuteAlien
Admin
Posts: 9670
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: GLSL geometry input/output primitive issue

Post by CuteAlien »

Bump once in a while is ok :-)
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply