summaryrefslogtreecommitdiffstats
path: root/HLSL2GLSLConverter/testshaders/SelectArraySlice.gsh
blob: a2176ec2b3913fbc9e72de26fbcb02a65c0d4610 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "CommonShaderStructs.shinc"

struct SelectArraySliceGSOut
{
    QuadVSOut VSOutput;
    int RenderTargetIndex : SV_RenderTargetArrayIndex;
};

cbuffer cbTileAttribs
{
    int g_TileArrayIndex[4];
}

[maxvertexcount(3)]
void SelectArraySliceGS(triangle QuadVSOut In[3], 
                        inout TriangleStream<SelectArraySliceGSOut> triStream )
{
    uint InstID = In[0].m_uiInstID;
    int RTIndex = g_TileArrayIndex[InstID];
    for(int i=0; i<3; i++)
    {
        SelectArraySliceGSOut Out;
        Out.VSOutput = In[i];
        Out.RenderTargetIndex = RTIndex;
        triStream.Append( Out );
    }
}