summaryrefslogtreecommitdiffstats
path: root/ComputeShaders/scaleInPlace.hlsl
blob: d0320b4300880615b6c4212d482de6d596d2fd37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
RWBuffer<float> buffer: register( u0 );

cbuffer Constants: register( b0 )
{
	uint4 src0_elements: packoffset( c0 );
	uint4 src0_strides: packoffset( c1 );
	float multiplier: packoffset( c2.x );
}

[ numthreads( 32, 1, 1 ) ]
void main( uint3 group: SV_GroupID, uint thread : SV_GroupIndex )
{
	const uint nc0 = src0_elements[ 0 ];
	uint i = group.x * src0_strides[ 1 ];
	const uint iEnd = i + nc0;
	const float mul = multiplier;
	for( i += thread; i < iEnd; i += 32 )
	{
		float f = buffer[ i ];
		f *= mul;
		buffer[ i ] = f;
	}
}