[2.1] No Geometry Shader output in Renderdoc Topic is solved

Problems building or running the engine, queries about how to use features etc.
Post Reply
gabbsson
Halfling
Posts: 62
Joined: Wed Aug 08, 2018 9:03 am
x 9

[2.1] No Geometry Shader output in Renderdoc

Post by gabbsson » Mon Jul 08, 2019 3:49 pm

Hello!

I'm debugging an issue I'm having with sending data between shaders.
I have implemented a way to do "pie clipping", simply put taking the max clip distance of two planes.
To achieve this i calculate two clip distances in the vertex shader and send them to the pixel shader, where i check which is max and then discard if that value is less than zero.

Everything works fine with my "custom" PBS, even when using its geometry shader, but for my custom Unlit i get the error message:
"... variable not written by geometry shader".
The message is clear and I when to check my compiled shaders to see if a property was off or something like that.
I can't find any reason why it shouldn't work, I've made sure that the in-out interface is the same as the vertex shader and I write the to the attributes for each emitted vertex.

Next I figured I'd check Renderdoc to see what the output it is and its entirely blank, says I have no GS output.
But the geometry is showing, its just not clipped... which is why I am posting here. I am confused what to do next.

The Unlit geometry shader has a few different cases, lines turned into thicker quads to emulate thickness and triangles into lines to make wireframes.
For lines it seems to work fine, I can see the GS output, but for wireframe I can't see the output, but it does turn the triangles into lines.

So if anyone has any idea what to debug next or even better a solution let me know!
I realize more info is probably needed. I'll happily share the code etc. if needed. Just figured I'd keep the post "short" for now.

Cheers!
0 x

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 4036
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 214
Contact:

Re: [2.1] No Geometry Shader output in Renderdoc

Post by dark_sylinc » Mon Jul 08, 2019 4:17 pm

Check that the generated shaders (the ones we dump on disk) have matching signatures.

It's possible one of your shaders is creating a struct that is missing member variables. Something like e.g. your VS declares:

Code: Select all

struct MyConstBuffer
{
   int a;
   int b;
};

out
{
    float c;
    float d;
}
But your GS declares:

Code: Select all

struct MyConstBuffer
{
   int b;
};

out
{
    float d;
}
1 x

gabbsson
Halfling
Posts: 62
Joined: Wed Aug 08, 2018 9:03 am
x 9

Re: [2.1] No Geometry Shader output in Renderdoc

Post by gabbsson » Tue Jul 09, 2019 8:24 am

dark_sylinc wrote:
Mon Jul 08, 2019 4:17 pm
Check that the generated shaders (the ones we dump on disk) have matching signatures.

It's possible one of your shaders is creating a struct that is missing member variables. Something like e.g. your VS declares:

Code: Select all

struct MyConstBuffer
{
   int a;
   int b;
};

out
{
    float c;
    float d;
}
But your GS declares:

Code: Select all

struct MyConstBuffer
{
   int b;
};

out
{
    float d;
}
This was the first thing I thought to check and I can't see whats wrong, but I'm still understanding shaders so I'm sure I've missed something.
In your example you have struct MyConstBuffer without in/out, I was not aware that was part of the signature?
I'll go back and check again.

When I created the GeometryShader I started from a copy of the VertexShader to make sure I got "everything", and removed stuff later.
How about the Uniform declaration stuff, is that part of the signature?

EDIT:

I found the issue. It was just as you said, I missed assigning half of my pie clip planes.
Thanks! Guess I'm never really as thorough as I think I am.
1 x

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 4036
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 214
Contact:

Re: [2.1] No Geometry Shader output in Renderdoc

Post by dark_sylinc » Tue Jul 09, 2019 4:20 pm

gabbsson wrote:
Tue Jul 09, 2019 8:24 am
How about the Uniform declaration stuff, is that part of the signature?
Strictly speaking IIRC I think they're not when it comes to GLSL (HLSL and Metal are different), however several drivers may barf if you use exactly the same name or slots for a uniform struct declaration with a different signature (so... to stay on the safe side... never do it, on any platform).
0 x

Post Reply