Sign in to follow this  
Diltsman

Geometry Shader output not drawn

Recommended Posts

Everything works fine when I have just my vertex and pixel shaders bound. When I bind my geometry shader, rather than outputting the cross I expect, nothing appears to be rendered to the output. Pix shows the crossed lines I expect coming out of the geometry shader, but it doesn't appear to render. My geometry shader is below. I know that his is a really trivial use of a geometry shader, but I want to understand how to use them before I write anything more advanced. I just noticed that Pix outputs the following error repeatedly, but I don't understand it. Time EID Type Context Message 0 65 Error Render D3D10: ERROR: ID3D10Device::Draw: Rasterization Unit is enabled (PixelShader is not NULL or Depth/Stencil test is enabled) but position is not provided by the last shader before the Rasterization Unit. [ EXECUTION ERROR #362: DEVICE_DRAW_POSITION_NOT_PRESENT ] Any ideas why nothing gets outputted when this is bound?
cbuffer ScreenConstantsBuffer
{
    float4x4 perspectiveTransform;
    float screenWidth;
    float screenHeight;
    float pointCrossSize;
    float invalid;
    float4 selectedColor;
    float4 defaultColor;
    float4 cameraLocation;
};

struct VS_INPUT
{
    float4 pos : SV_Position;
};

struct PS_INPUT
{
    float4 pos : POSITION;
};

[maxvertexcount(4)]
void GS(point VS_INPUT input[1], inout LineStream<PS_INPUT> output)
{
    PS_INPUT vertex;
    vertex.pos = input[0].pos;
    vertex.pos.x = input[0].pos.x - pointCrossSize / screenWidth;
    output.Append(vertex);
    vertex.pos.x = input[0].pos.x + pointCrossSize / screenWidth;
    output.Append(vertex);
    output.RestartStrip();

    vertex.pos = input[0].pos;
    vertex.pos.y = input[0].pos.y - pointCrossSize / screenWidth;
    output.Append(vertex);"
    vertex.pos.y = input[0].pos.y + pointCrossSize / screenWidth;
    output.Append(vertex);

    output.RestartStrip();
}


Share this post


Link to post
Share on other sites
Try setting PS_INPUT's schematic to SV_POSITION as well. Other than that, make sure that your shader transforms to view space. the PIX shader ouput is NOT in view space, so even if you see output for post VS and post GS, they may not be in the viewport at all. If that doesn't solve your problems, you could post your complete shader, it may help. Oh also make sure that your pos output's w component is 1 (doesn't work as 0, i'm not sure about other values).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this