
3. Deferred Attribute Interpolation Shading 93
1 #e x t e n si on GL NV shader thread group : e nable
2 uint sid =0; // Shading sample address
3 if (( gl_ThreadInWarpNV &3)==0) // One thread allocates memory.
4 sid = atomicCounterIncrement ( ctr_shading_samples );
5 // Communicate to all invocations .
6 uint sid_sw = floatBitsToUint (
7 quadSwizzle0NV ( uintBitsToFloat( sid )));
8 if ( sid_sw == 0 ) { // Fails when there are helper−invocations .
9 if( sid == 0 ) // Allocate shading samples for all invocations .
10 sid = atomicCounterIncrement ( ctr_shading_samples );
11 store_shading_sample ( sid );
12 } else if (( gl_ThreadInWarpNV &0x03)==0) {
13 sid