3 cbuffer OutputToVertexArrayCB : register( b0 )
\r
17 StructuredBuffer<float4> g_vertexPositions : register( t0 );
\r
18 StructuredBuffer<float4> g_vertexNormals : register( t1 );
\r
20 RWBuffer<float> g_vertexBuffer : register( u0 );
\r
23 [numthreads(128, 1, 1)]
\r
25 OutputToVertexArrayWithNormalsKernel( uint3 Gid : SV_GroupID, uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID, uint GI : SV_GroupIndex )
\r
27 int nodeID = DTid.x;
\r
28 if( nodeID < numNodes )
\r
30 float4 position = g_vertexPositions[nodeID + startNode];
\r
31 float4 normal = g_vertexNormals[nodeID + startNode];
\r
33 // Stride should account for the float->float4 conversion
\r
34 int positionDestination = nodeID * positionStride + positionOffset;
\r
35 g_vertexBuffer[positionDestination] = position.x;
\r
36 g_vertexBuffer[positionDestination+1] = position.y;
\r
37 g_vertexBuffer[positionDestination+2] = position.z;
\r
39 int normalDestination = nodeID * normalStride + normalOffset;
\r
40 g_vertexBuffer[normalDestination] = normal.x;
\r
41 g_vertexBuffer[normalDestination+1] = normal.y;
\r
42 g_vertexBuffer[normalDestination+2] = normal.z;
\r
46 [numthreads(128, 1, 1)]
\r
48 OutputToVertexArrayWithoutNormalsKernel( uint3 Gid : SV_GroupID, uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID, uint GI : SV_GroupIndex )
\r
50 int nodeID = DTid.x;
\r
51 if( nodeID < numNodes )
\r
53 float4 position = g_vertexPositions[nodeID + startNode];
\r
54 float4 normal = g_vertexNormals[nodeID + startNode];
\r
56 // Stride should account for the float->float4 conversion
\r
57 int positionDestination = nodeID * positionStride + positionOffset;
\r
58 g_vertexBuffer[positionDestination] = position.x;
\r
59 g_vertexBuffer[positionDestination+1] = position.y;
\r
60 g_vertexBuffer[positionDestination+2] = position.z;
\r