2014-02-07 13:46:55 +01:00
|
|
|
#include "BlurSharedData.hlsli"
|
|
|
|
|
|
|
|
[numthreads(1,N,1)]
|
|
|
|
void main(int3 ThreadID : SV_DispatchThreadID, int3 gThreadID : SV_GroupThreadID)
|
|
|
|
{
|
|
|
|
|
|
|
|
if(gThreadID.y < blurRadius)
|
|
|
|
{
|
|
|
|
int y = max(ThreadID.y-blurRadius,0);
|
2014-02-13 15:24:19 +01:00
|
|
|
gCache[gThreadID.y] = inTex[min(int2(ThreadID.x,y) + Start, Stop-1)];
|
2014-02-07 13:46:55 +01:00
|
|
|
}
|
|
|
|
if(gThreadID.y >= N-blurRadius)
|
|
|
|
{
|
2014-02-18 12:02:48 +01:00
|
|
|
int y = min(ThreadID.y +blurRadius, Stop.y-1);
|
2014-02-13 15:24:19 +01:00
|
|
|
gCache[gThreadID.y+2*blurRadius] = inTex[int2(ThreadID.x,y) + Start];
|
2014-02-07 13:46:55 +01:00
|
|
|
}
|
2014-02-18 12:02:48 +01:00
|
|
|
gCache[gThreadID.y+blurRadius] = inTex[min(ThreadID.xy + Start, Stop-1)];
|
2014-02-07 13:46:55 +01:00
|
|
|
|
|
|
|
GroupMemoryBarrierWithGroupSync();
|
|
|
|
|
|
|
|
float4 blurCol = float4(0,0,0,0);
|
|
|
|
|
|
|
|
[unroll]
|
|
|
|
for(int i = -blurRadius; i <= blurRadius;++i)
|
|
|
|
{
|
|
|
|
int k = gThreadID.y + blurRadius + i;
|
|
|
|
blurCol +=Weights[i + blurRadius] * gCache[k];
|
|
|
|
}
|
|
|
|
|
2014-02-18 12:02:48 +01:00
|
|
|
outTex[min(ThreadID.xy + Start, Stop-1)] = blurCol * BlurMask + inTex[min(ThreadID.xy + Start, Stop-1)] * ( float4(1,1,1,1) - BlurMask);;
|
2014-02-17 09:03:53 +01:00
|
|
|
//outTex[ThreadID.xy + Start] = inTex[ThreadID.xy+ Start];
|
2014-02-07 13:46:55 +01:00
|
|
|
}
|