
258 IV Shadows
void ps_main ( PS_IN input)
{
// Allocate a new element in the list element buffer by
// atomically incrementing the buffer counter .
int counter = listElementBuffer.IncrementCounter();
// Store the required information and apply a depth bias.
listElementBuffer[counter ]. depth = input. posToShader.z + bias ;
listElementBuffer[counter ]. alpha = input. alpha;
//pixel screen coordinate to buffer index
int index = ( int)( input .pos.y * Width + input .pos.x );
int originalVal;
// Atomically exchange the element in the head buffer.
InterlockedExchange(headBuffer[index ], counter , originalVal);
// Create the link to the existing list.
listElementBuffer[ ...