Jump to content

Writing geometry shader with argument passing in UUSL


photo

Recommended Posts

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 ?

 

Link to comment

Hi Akshay,

 

Unfortuantely, geometry shader wrapper is not yet finished.

 

If you need to write that function you will have to use native GLSL / HLSL language and write code twice:

#ifdef DIRECT3D11
<put HLSL code here>
...
#elif OPENGL
<put glsl code here>
...
#endif

Sorry for the inconvenience caused.

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
×
×
  • Create New...