Hello ,
I am writing geometry shader using UUSL,
My shader works fine with opengl , but in directX it fails , because of output variable used in DirectX
Suppose I do Emit Vertex in main routine like this it works in both HLSL/GLSL
MAIN_GEOM_BEGIN(GEOMETRY_OUT,GEOMETRY_IN)
//some code
OUT_POSITION = postionLHS;
OUT_DATA(1). = colorABC;
EMIT_VERTEX
OUT_POSITION = postionLHS;
OUT_DATA(1). = colorABC;
EMIT_VERTEX
OUT_POSITION = postionLHS;
OUT_DATA(1). = colorABC;
EMIT_VERTEX
END_PRIMITIVE
END_GEOM
But I want to create a function like
CreateTriangle( int index, float offset )
{
OUT_POSITION = postionLHS;
OUT_DATA(1). = colorABC;
EMIT_VERTEX
OUT_POSITION = postionLHS;
OUT_DATA(1). = colorABC;
EMIT_VERTEX
OUT_POSITION = postionLHS;
OUT_DATA(1). = colorABC;
EMIT_VERTEX
END_PRIMITIVE
}
MAIN_GEOM_BEGIN(GEOMETRY_OUT,GEOMETRY_IN)
CreateTriangle( 0, 0.25);
CreateTriangle( 1, -0.25);
CreateTriangle( 2, 0.50);
END_GEOM
Currently OUT_POSITION is not available in HLSL shader for CreateTriangle
How can i pass the output arguments to CreateTriangle Routine which works in both HLSL or GLSL ?